From 263d085885df024dca9250cc03c807912b0a7662 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 24 Apr 2012 22:33:21 +0000
Subject: [PATCH] Reformat to comply with new Checkstyle rules.

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java                       |  118 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java                     |   76 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java                  |  230 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java                          |  283 
 opendj3/opendj-rest2ldap/pom.xml                                                                                                   |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java                  |  231 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java                                         |  334 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java                                       |  182 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat                                                                   |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java                                                |  119 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Request.java                                              |  105 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java                                       |  358 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java                                                  |  530 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java                                          |  118 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java                      |   75 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties                                    |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java                                      |  376 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java             | 1938 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java                                                  |   38 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java                                 |  517 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java                                         |   30 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java                                     |  128 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java                                |  146 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java               |   84 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java                                             |  244 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java                                          |  238 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java                          |  626 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java                           |  103 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_CN.properties                              |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java                                              |  113 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java                                           | 1477 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java                           |  108 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java                                  |  376 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java                              |  213 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java                                       |   63 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java                          |  119 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java                                         |  869 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java                                                 |  605 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java                       |   55 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPFutureResultImpl.java                                  |  208 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java                                              | 1238 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Constants.java                                                 |  231 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java                   |  270 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java                              |  178 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java                                  |  336 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat                                                           |    6 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java                     |  194 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java                     |   63 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeException.java                                               |  190 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_es.properties                                 |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java                                                     |  573 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SubstringReader.java                                               |  268 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java                            |  319 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java                                |  793 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedResponseException.java                                   |   56 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java                      |   86 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java                                                     |  300 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java                    |  102 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java                                          |  594 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/CLIException.java                                        |  110 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Writer.java                                                    |  661 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java                      |   40 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java                                                 |  314 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java                                  |  593 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java                                           |   76 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java                |   29 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java                                        |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java                |   30 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java                                |  423 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java                                       |  217 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/CompletedFutureResult.java                                         |  248 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java                              |   74 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java                                                |  189 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java                  |   36 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java                        |  548 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java                                        |  719 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java                                                    | 1257 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat                                                                   |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java                             |  282 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_fr.properties                                            |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java                                        |   13 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentParser.java                                      | 3289 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java                                        |  133 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java                 | 1665 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java                                           |  252 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/RecursiveFutureResult.java                                         |  354 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java                                         |  230 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java                                                  |   18 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java              |  327 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EqualLengthApproximateMatchingRuleImpl.java                 |   64 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java               |  569 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java                       |  232 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java                                                    | 3145 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java                            |   60 
 opendj3/opendj-ldap-sdk-examples/pom.xml                                                                                           |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedRequestException.java                                    |   55 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java                                                  |  235 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java                                 |   74 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java                                                   | 4221 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java                      |   40 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java                        |  124 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferReaderTestCase.java                                      |   36 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java                                               |  364 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java                                          | 1096 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java                                      | 1256 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java                              |  309 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIF.java                                                          | 1285 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java                                              |   38 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConsoleApplication.java                                  |  596 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ReaderTestCase.java                                            | 1498 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java                                        |  839 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java                                        |   57 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java                                    |  500 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java                     |   94 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DN.java                                                            | 1581 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransportTestCase.java                                |   57 
 opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat                                                                     |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java                                                   |  117 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java                                         | 1261 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java                                   |   42 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java                       |  240 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java                     |  231 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java                        |  154 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java                               |   65 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java                                          |  306 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentGroup.java                                       |  268 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java                        |  126 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java                                |  239 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java                                 |  219 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java                                             | 1990 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java                                |   65 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java                                    |   54 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java                               |  162 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java                          |   38 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java                                |  153 
 opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh                                                               |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java                              |  142 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java                                          |  254 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java                                 |  308 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java                          |  263 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/package-info.java                                                  |   13 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java                                                |  324 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java                              |   30 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java                                          |  125 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestTestCase.java                                      |  146 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java                      |  135 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java                                       |  161 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java                          |  386 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java                               |   96 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java                                                 |   27 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java                       |   44 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_TW.properties                                         |   11 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java                                   | 1789 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java                |   45 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java                                          |  326 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java                                           |  116 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java                                         |   76 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java                 |  223 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java                                      |  105 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java                          |   60 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java                                         |  186 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java                       |  113 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java                                               |  563 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/AttributeMapper.java                                         |   95 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java             |   47 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java                        |   45 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java                                         |   50 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java                                  |  154 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConstants.java                                                 |  492 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java                              |  108 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/package-info.java                                         |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java                                       |  527 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/Base64TestCase.java                                                |  353 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReaderTestCase.java                                |   31 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java                                         |  625 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java                                         |  303 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java                                        |  141 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java                 |   99 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java                              |  294 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java                                         |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java                                            | 1445 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java                             |  361 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java                               |  158 
 opendj3/opendj-ldap-sync/src/main/assembly/libbin/_script-util.sh                                                                  |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java                                           | 1097 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java                                |   71 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java                         |   63 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java                                            |  137 
 opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat                                                            |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DefaultSchema.java                                          |   27 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java                      |   59 
 opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh                                                             |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java                              |  306 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java                                        | 2367 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java                                     |  158 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java                |  281 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java                  |  196 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java                                                   |  589 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java                              |  333 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java              |   68 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java                           |   69 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java                                                 |  340 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java                                        |   34 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java             |  261 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java                                  |  445 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java                |   47 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java              |  106 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java                            | 2249 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java                                                   |  645 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPMessageHandler.java                                            |  173 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java                    |   27 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java                                                          |  306 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java                                            |  237 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TypesTestCase.java                                                 |  204 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_es.properties                                            |   11 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java                                            | 1014 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java                                         |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java                          |  195 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java                   |   64 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/FilterResult.java                                         |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java                        |  270 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java                              |  168 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java                              |   71 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java                                          | 2006 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiChoiceArgument.java                                 |  421 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java                                 |  786 
 opendj3/opendj-ldap-sync/src/main/assembly/libbat/setcp.bat                                                                        |    6 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnectionFactoryImpl.java                                     |  463 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1WriterTestCase.java                                            | 1129 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java                     |  129 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_de.properties                                 |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPCompareFutureResultImpl.java                                   |   92 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core.properties                                               |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java                                                  |  125 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java                                         |  202 
 opendj3/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java                                       |   18 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java                   |   87 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java                          |  119 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StringArgument.java                                      |  220 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat                                                                   |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java                              |  147 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java                                       |  773 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryReader.java                                                   |   84 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java                                               |  730 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java              |   44 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java                        |  363 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java                                                       | 1504 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/LDAPTestCase.java                                                  |   18 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPSearchFutureResultImpl.java                                    |  162 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java                        |  838 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java                                |  659 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java                  |  220 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java                                                       | 1271 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java                                          |  294 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFStream.java                                            |  182 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java                           |  186 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java                                      |  224 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java                              |  108 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java                       |  620 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java                                          | 1780 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java                                            |  243 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java                            |   89 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java                                  |   89 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java                                    |  278 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java                                        |  242 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java                             |  193 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/package-info.java                                            |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleImpl.java                           |  218 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java                                                    | 1884 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java              |   84 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java                           | 1478 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java                                          | 2273 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java                                             |  755 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java                                  |   97 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java                          |  368 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java                                          |  554 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java                              |   56 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java                     |  101 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java                                  | 1601 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java                                |  155 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat                                                                  |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java                         |  979 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Base64.java                                                        |  634 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java                      |   75 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java  |  145 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/FileBasedArgument.java                                   |  403 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_CN.properties                                         |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java                                              |  261 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java                                                    | 1264 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java                    |  219 
 opendj3/opendj-ldap-toolkit/src/main/assembly/descriptor.xml                                                                       |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListenerOptions.java                                           |  259 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java                                       |   85 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java                               |  252 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Assertion.java                                                     |   38 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java                                   |  222 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java               |  184 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java                                     |   41 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java                                     |   18 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java                  |   36 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java                                          |  116 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java                                 |  244 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestContext.java                                                |  150 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java                        |  828 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java                                     |  670 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java                         |  178 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java                               |  173 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java                     |  100 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java                                  |  562 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Reader.java                                            |  259 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java         |   49 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java                                           |  716 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java                        |   63 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java              |   48 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java                                        |   25 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/CompletionHandler.java                                       |   27 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java                                          |  239 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java                                             |  361 
 opendj3/opendj-ldap-sync/src/main/assembly/descriptor.xml                                                                          |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java                                                |  356 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java                                    |  102 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java                       |   36 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java                            | 1213 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java                 |  281 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java              |  316 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java                                        |   66 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java                                        |   48 
 opendj3/src/site/resources/Example.ldif                                                                                            |   11 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiColumnPrinter.java                                  |  682 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat                                                                      |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java                               |  287 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java                                           |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java                                    |   93 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java            |   76 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java                                                 |  642 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java                           |  394 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecord.java                                                  |   63 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java                                       |  594 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java                            |   88 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/package-info.java                                                 |   11 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java                            |  239 
 opendj3/opendj-ldap-sync/src/main/assembly/libbat/_script-util.bat                                                                 |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java                                            |  821 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java                       |  230 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java                                                    |  888 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java                                    |  236 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java                      |  227 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java                               |  485 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java                                      |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java                                                    | 2376 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java                     |  632 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java                            |  227 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java                                  |  350 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java                                      |  112 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java                                         |  451 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java                  |   77 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java                                                      |   48 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java                       |  484 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ByteSequenceOutputStream.java                                      |  175 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat                                                                     |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java                                                 |  554 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java                        |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java                                      |  284 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java                           |  226 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java                      |  879 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java                                |  157 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/Main.java                                                         |   11 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java                      |  598 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java                 |   36 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java                                                  |  760 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Transforms.java                                           |   11 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java                      |   85 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java                         |  132 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java                                      |  136 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java                                 |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SortKey.java                                                       | 1100 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RestRequest.java                                             |   24 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java                                         | 1737 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Argument.java                                            | 1219 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java                                  |  108 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java                                  |   58 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPMessageHandler.java                                    |  294 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Writer.java                                            |  215 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java                                               |  823 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java                              |  252 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ja.properties                                 |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java                                                 |  797 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java                      |  282 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java                              |   64 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ToolConstants.java                                       |  966 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/package-info.java                                                  |   13 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java                                                 |  144 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java                                          |   46 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java                                        |  634 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java                 |  105 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java                        |   85 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_de.properties                                            |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java                                     |  318 
 opendj3/opendj-ldap-sync/src/main/assembly/bat/ldapsync.bat                                                                        |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java                              |  250 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java                                       |  303 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java                                             | 1008 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java                                         |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java                |   29 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java                   |  461 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java                                        |   86 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java                                        |   25 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java                                             |  445 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java                                            |  290 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/BooleanArgument.java                                     |  152 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java                                            |  360 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java                               |  277 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java                                |   58 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java                         |  231 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java                                |  223 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java            |   76 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPClientFilter.java                                              |  985 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java                                            |  903 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java              |   48 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java                                       |   56 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java                       |  164 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java                      |   76 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java                                              | 1083 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java                                |  132 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java                                           |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java                     |   75 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java                                            |  937 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java                                               | 1267 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java                  |  124 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java                                              | 1895 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java                   |   27 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java                 |  124 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java                                   |  136 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java                                         |   97 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ko.properties                                 |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java                  |   98 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java                                        |   66 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java                           |  155 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Reader.java                                                    |  680 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java                                           |  112 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java                                     |  427 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java                                                | 1787 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java                                                  |  520 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java                               |  109 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java                                    |  183 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Matchers.java                                             |   11 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java                                           |  211 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_fr.properties                                 |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/FutureResultTransformer.java                                       |  325 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java                               |  194 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java                                      |  480 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java                                    |  140 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RDN.java                                                           |  642 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java                                |  347 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java                                       |   98 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java                                    |   57 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java                                 |  319 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java                                   |  138 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/AsynchronousFutureResult.java                                      |  670 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java                                                     |  823 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java                                  |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java                                       |  317 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java        |   60 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java                                      |  181 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java                                  |  306 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat                                                                   |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java                              | 2524 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java                                              |  198 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTest.java                                      |  673 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/package-info.java                                                  |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java                                               | 1580 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java               |   49 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java                                                        | 3427 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java                                 |   55 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java                                       |   97 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java                      |   79 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java                               |   54 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java                                     |  138 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java                                       |  194 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java                         |  583 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java                            |  458 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java                              |  179 
 opendj3/opendj-ldap-sync/src/main/assembly/libbin/_client-script.sh                                                                |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java                                |  802 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java                               |  490 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java                    |  341 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/UtilTestCase.java                                                  |   18 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java                     |  328 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java                            |  220 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entry.java                                                         |  866 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java                               |  502 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ko.properties                                            |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/package-info.java                                                  |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java                          |  372 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java               |   48 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Predicate.java                                                     |   48 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultCode.java                                                    | 1218 
 opendj3/opendj-ldap-sync/src/main/assembly/libbat/_client-script.bat                                                               |    6 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java                                          |  537 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPOptions.java                                                   |  560 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java                                         |  105 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attribute.java                                                     |  763 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java                     |  453 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AVA.java                                                           | 1591 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java |  112 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat                                                                     |    6 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java                                       |  199 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java                                         | 1052 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java                                     |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java                        |  622 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java                                               |  437 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java                                                |   66 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java                                          | 6008 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java                                          |  384 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ModificationType.java                                              |  275 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java                                    |  156 
 opendj3/opendj-ldap-toolkit/pom.xml                                                                                                |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java                            |  275 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ReferralException.java                                             |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java                               |  334 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java                                   |   67 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/IntegerArgument.java                                     |  930 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java                           |  174 
 opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ja.properties                                            |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java                                                     |  597 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java                              |  371 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java                |  167 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java                        |   47 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java                           |  169 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java                                |  113 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java                    |   27 
 opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat                                                              |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java                           |  175 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchScope.java                                                   |  267 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java                                       |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java                           |  277 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java                        |  218 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java                                            |  766 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java                                         |   18 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FutureResult.java                                                  |  188 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Filter.java                                               |   11 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java                                       |   19 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java              |   47 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java                                          | 1481 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionSecurityLayerFilter.java                                 |  212 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java                                   |   18 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java                               |  257 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPBindFutureResultImpl.java                                      |  107 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java                              |   24 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java          |  131 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java                   |   27 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java                           |  363 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java                                                   |   18 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java                                                   |  795 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java               |   51 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Modification.java                                                  |  160 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java                    |  273 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java               |   66 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java                                         |   57 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java                                       |  505 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java                                            | 1452 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java                                     |   12 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/package-info.java                                                  |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java                                |   97 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java                      |  147 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java                |   51 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java                  |   53 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java                                  |  306 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java                                         |  147 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java                               |  130 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java                               |   56 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java                                     |  785 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java                                       |   93 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriterTestCase.java                                |   64 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java                                           |  931 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/Control.java                                              |  100 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java                    |  198 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java                                        |   91 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java                                |  305 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java                                    |  619 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java                                     |   68 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java                       |   63 
 opendj3/pom.xml                                                                                                                    |   13 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java                                           |  269 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java                                          |   97 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java                    |  674 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java                     |  229 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java                                                       | 1225 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java                                                 |   50 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java                                |  502 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentException.java                                   |   88 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java                                        |  253 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java                                                 |  228 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReadRequest.java                                             |   37 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java                                |  262 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java                              |   74 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java                                      |  990 
 opendj3/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat                                                                   |    6 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Response.java                                            |  105 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java                                     |  134 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java                                        |   25 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java                                |  106 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java                             |  850 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java                    |   64 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java                      |  838 
 opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/ChangeRecordContext.java                                  |   11 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnsupportedMessageException.java                                   |   70 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java                  |   33 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java                                                 | 5585 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/InternalConnection.java                                            |  515 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java                                   |  328 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPUtils.java                                                     | 1111 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java                                             |   71 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java                                      |  321 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java                                            | 1343 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java                                            |   90 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java                               |   63 
 opendj3/opendj-ldap-sdk/pom.xml                                                                                                    |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java                                        | 1398 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java                                             | 4389 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java                             |  163 
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Validator.java                                               |   41 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java                                              |  299 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java                                         |  135 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java                                        |  140 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java                   |   98 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferWriterTestCase.java                                      |   73 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java                        |  317 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java                                       |   25 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java                                          |  895 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java                        |   44 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java                                             |  188 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java                                               |  362 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java                             |  320 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPExtendedFutureResultImpl.java                                  |  125 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1InputStreamReaderTestCase.java                                 |   32 
 opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_TW.properties                              |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java                                       |   97 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java                                                    | 1008 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java                                   |  261 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java                                |  150 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java                                                       |  767 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java                                        |  523 
 opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java                                           |  342 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java        |  120 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java               |   48 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java                                      |  122 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java                                        |  863 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java        |   49 
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java                                         |  237 
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPFutureResultImpl.java                                          |   90 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java                                             | 3038 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java                              |  362 
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java                               |  699 
 opendj3/opendj-ldap-sync/pom.xml                                                                                                   |   11 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java                          |  228 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java                                   |  383 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java                                        |  539 
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java                                       |  177 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java                                           | 1030 
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java                        |  190 
 661 files changed, 107,342 insertions(+), 137,515 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk-examples/pom.xml b/opendj3/opendj-ldap-sdk-examples/pom.xml
index 9608c59..147b9bb 100644
--- a/opendj3/opendj-ldap-sdk-examples/pom.xml
+++ b/opendj3/opendj-ldap-sdk-examples/pom.xml
@@ -7,17 +7,16 @@
   ! (the "License").  You may not use this file except in compliance
   ! with the License.
   !
-  ! You can obtain a copy of the license at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+  ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
   ! or http://forgerock.org/license/CDDLv1.0.html.
   ! See the License for the specific language governing permissions
   ! and limitations under the License.
   !
   ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
+  ! file and include the License file at legal-notices/CDDLv1_0.txt.
+  ! If applicable, add the following below this CDDL HEADER, with the
+  ! fields enclosed by brackets "[]" replaced with your own identifying
+  ! information:
   !      Portions Copyright [yyyy] [name of copyright owner]
   !
   ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java
index d4beab3..5b668bb 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,160 +25,125 @@
  */
 package org.forgerock.opendj.examples;
 
-
-
 import java.io.IOException;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
-
-
 /**
  * Demonstrates accessing server information about capabilities and schema.
  */
-public final class GetInfo
-{
-  // Connection information
-  private static String host;
-  private static int port;
-  // The kind of server information to request (all, controls, extops)
-  private static String infoType;
+public final class GetInfo {
+    // Connection information
+    private static String host;
+    private static int port;
+    // The kind of server information to request (all, controls, extops)
+    private static String infoType;
 
-
-
-  /**
-   * Access the directory over LDAP to request information about capabilities
-   * and schema.
-   *
-   * @param args
-   *          The command line arguments
-   */
-  public static void main(final String[] args)
-  {
-    parseArgs(args);
-    connect();
-  }
-
-
-
-  /**
-   * Authenticate over LDAP.
-   */
-  private static void connect()
-  {
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port);
-    Connection connection = null;
-
-    try
-    {
-      connection = factory.getConnection();
-      connection.bind("", "".toCharArray()); // Anonymous bind
-
-      final String attributeList;
-      if (infoType.toLowerCase().equals("controls"))
-      {
-        attributeList = "supportedControl";
-      }
-      else if (infoType.toLowerCase().equals("extops"))
-      {
-        attributeList = "supportedExtension";
-      }
-      else
-      {
-        attributeList = "+"; // All operational attributes
-      }
-
-      final SearchResultEntry entry = connection.searchSingleEntry(
-          "",                      // DN is "" for root DSE.
-          SearchScope.BASE_OBJECT, // Read only the root DSE.
-          "objectclass=*",         // Every object matches this filter.
-          attributeList);          // Return these requested attributes.
-
-      final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
-      writer.writeComment("Root DSE for LDAP server at " + host + ":" + port);
-      if (entry != null)
-      {
-        writer.writeEntry(entry);
-      }
-      writer.flush();
-    }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
-    }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
-    }
-    catch (final IOException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
-      return;
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-    }
-  }
-
-
-
-  private static void giveUp()
-  {
-    printUsage();
-    System.exit(1);
-  }
-
-
-
-  /**
-   * Parse command line arguments.
-   *
-   * @param args
-   *          host port bind-dn bind-password info-type
-   */
-  private static void parseArgs(final String[] args)
-  {
-    if (args.length != 3)
-    {
-      giveUp();
+    /**
+     * Access the directory over LDAP to request information about capabilities
+     * and schema.
+     *
+     * @param args
+     *            The command line arguments
+     */
+    public static void main(final String[] args) {
+        parseArgs(args);
+        connect();
     }
 
-    host = args[0];
-    port = Integer.parseInt(args[1]);
-    infoType = args[2]; // all, controls, or extops
-    if (!(infoType.toLowerCase().equals("all")
-        || infoType.toLowerCase().equals("controls")
-        || infoType.toLowerCase().equals("extops")))
-    {
-      giveUp();
+    /**
+     * Authenticate over LDAP.
+     */
+    private static void connect() {
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port);
+        Connection connection = null;
+
+        try {
+            connection = factory.getConnection();
+            connection.bind("", "".toCharArray()); // Anonymous bind
+
+            final String attributeList;
+            if (infoType.toLowerCase().equals("controls")) {
+                attributeList = "supportedControl";
+            } else if (infoType.toLowerCase().equals("extops")) {
+                attributeList = "supportedExtension";
+            } else {
+                attributeList = "+"; // All operational attributes
+            }
+
+            final SearchResultEntry entry = connection.searchSingleEntry("", // DN
+                                                                             // is
+                                                                             // ""
+                                                                             // for
+                                                                             // root
+                                                                             // DSE.
+                    SearchScope.BASE_OBJECT, // Read only the root DSE.
+                    "objectclass=*", // Every object matches this filter.
+                    attributeList); // Return these requested attributes.
+
+            final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
+            writer.writeComment("Root DSE for LDAP server at " + host + ":" + port);
+            if (entry != null) {
+                writer.writeEntry(entry);
+            }
+            writer.flush();
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } catch (final IOException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+            return;
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
     }
-  }
 
+    private static void giveUp() {
+        printUsage();
+        System.exit(1);
+    }
 
+    /**
+     * Parse command line arguments.
+     *
+     * @param args
+     *            host port bind-dn bind-password info-type
+     */
+    private static void parseArgs(final String[] args) {
+        if (args.length != 3) {
+            giveUp();
+        }
 
-  private static void printUsage()
-  {
-    System.err.println("Usage: host port info-type");
-    System.err.println("\tAll arguments are required.");
-    System.err
-        .println("\tinfo-type to get can be either all, controls, or extops.");
-  }
+        host = args[0];
+        port = Integer.parseInt(args[1]);
+        infoType = args[2]; // all, controls, or extops
+        if (!(infoType.toLowerCase().equals("all") || infoType.toLowerCase().equals("controls") || infoType
+                .toLowerCase().equals("extops"))) {
+            giveUp();
+        }
+    }
 
+    private static void printUsage() {
+        System.err.println("Usage: host port info-type");
+        System.err.println("\tAll arguments are required.");
+        System.err.println("\tinfo-type to get can be either all, controls, or extops.");
+    }
 
-
-  private GetInfo()
-  {
-    // Not used.
-  }
+    private GetInfo() {
+        // Not used.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java
index 79de470..8d77837 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,18 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldif.ChangeRecord;
+import org.forgerock.opendj.ldif.ConnectionChangeRecordWriter;
+import org.forgerock.opendj.ldif.LDIFChangeRecordReader;
 
 /**
  * An example client application which applies update operations to a Directory
@@ -50,115 +50,86 @@
  *  &lt;host> &lt;port> &lt;username> &lt;password> [&lt;ldifFile>]
  * </pre>
  */
-public final class Modify
-{
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: host, port, username, password, LDIF
-   *          file name containing the update operations (will use stdin if not
-   *          provided).
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length < 4 || args.length > 5)
-    {
-      System.err
-          .println("Usage: host port username password [ldifFileName]");
-      System.exit(1);
+public final class Modify {
+    /**
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: host, port, username, password,
+     *            LDIF file name containing the update operations (will use
+     *            stdin if not provided).
+     */
+    public static void main(final String[] args) {
+        if (args.length < 4 || args.length > 5) {
+            System.err.println("Usage: host port username password [ldifFileName]");
+            System.exit(1);
+        }
+
+        // Parse command line arguments.
+        final String hostName = args[0];
+        final int port = Integer.parseInt(args[1]);
+        final String userName = args[2];
+        final String password = args[3];
+
+        // Create the LDIF reader which will either used the named file, if
+        // provided, or stdin.
+        InputStream ldif;
+        if (args.length > 4) {
+            try {
+                ldif = new FileInputStream(args[4]);
+            } catch (final FileNotFoundException e) {
+                System.err.println(e.getMessage());
+                System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+                return;
+            }
+        } else {
+            ldif = System.in;
+        }
+        final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldif);
+
+        // Connect and bind to the server.
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port);
+        Connection connection = null;
+
+        try {
+            connection = factory.getConnection();
+            connection.bind(userName, password.toCharArray());
+
+            // Write the changes.
+            final ConnectionChangeRecordWriter writer =
+                    new ConnectionChangeRecordWriter(connection);
+            while (reader.hasNext()) {
+                ChangeRecord changeRecord = reader.readChangeRecord();
+                writer.writeChangeRecord(changeRecord);
+                System.err.println("Successfully modified entry "
+                        + changeRecord.getName().toString());
+            }
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } catch (final IOException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+            return;
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+
+            try {
+                reader.close();
+            } catch (final IOException ignored) {
+                // Ignore.
+            }
+        }
     }
 
-    // Parse command line arguments.
-    final String hostName = args[0];
-    final int port = Integer.parseInt(args[1]);
-    final String userName = args[2];
-    final String password = args[3];
-
-    // Create the LDIF reader which will either used the named file, if
-    // provided, or stdin.
-    InputStream ldif;
-    if (args.length > 4)
-    {
-      try
-      {
-        ldif = new FileInputStream(args[4]);
-      }
-      catch (final FileNotFoundException e)
-      {
-        System.err.println(e.getMessage());
-        System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
-        return;
-      }
+    private Modify() {
+        // Not used.
     }
-    else
-    {
-      ldif = System.in;
-    }
-    final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        ldif);
-
-    // Connect and bind to the server.
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(
-        hostName, port);
-    Connection connection = null;
-
-    try
-    {
-      connection = factory.getConnection();
-      connection.bind(userName, password.toCharArray());
-
-      // Write the changes.
-      final ConnectionChangeRecordWriter writer =
-          new ConnectionChangeRecordWriter(connection);
-      while (reader.hasNext())
-      {
-        ChangeRecord changeRecord = reader.readChangeRecord();
-        writer.writeChangeRecord(changeRecord);
-        System.err.println("Successfully modified entry "
-            + changeRecord.getName().toString());
-      }
-    }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
-    }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
-    }
-    catch (final IOException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
-      return;
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-
-      try
-      {
-        reader.close();
-      }
-      catch (final IOException ignored)
-      {
-        // Ignore.
-      }
-    }
-  }
-
-
-
-  private Modify()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
index 99aac0d..d7e84d9 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,20 +27,46 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.controls.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
-
-
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.Connections;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LDAPClientContext;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.LDAPListener;
+import org.forgerock.opendj.ldap.LDAPListenerOptions;
+import org.forgerock.opendj.ldap.RequestContext;
+import org.forgerock.opendj.ldap.RequestHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.RoundRobinLoadBalancingAlgorithm;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.ServerConnectionFactory;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CancelExtendedRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Request;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 /**
  * An LDAP load balancing proxy which forwards requests to one or more remote
@@ -60,534 +85,402 @@
  *      [&lt;remoteAddress2> &lt;remotePort2> ...]
  * </pre>
  */
-public final class Proxy
-{
-  private static final class ProxyBackend implements
-      RequestHandler<RequestContext>
-  {
-    private final ConnectionFactory factory;
-    private final ConnectionFactory bindFactory;
+public final class Proxy {
+    private static final class ProxyBackend implements RequestHandler<RequestContext> {
+        private final ConnectionFactory factory;
+        private final ConnectionFactory bindFactory;
 
-
-
-    private ProxyBackend(final ConnectionFactory factory,
-        final ConnectionFactory bindFactory)
-    {
-      this.factory = factory;
-      this.bindFactory = bindFactory;
-    }
-
-
-
-    private abstract class AbstractRequestCompletionHandler
-        <R extends Result, H extends ResultHandler<? super R>>
-        implements ResultHandler<R>
-    {
-      final H resultHandler;
-      final Connection connection;
-
-
-
-      AbstractRequestCompletionHandler(final Connection connection,
-          final H resultHandler)
-      {
-        this.connection = connection;
-        this.resultHandler = resultHandler;
-      }
-
-
-
-      @Override
-      public final void handleErrorResult(final ErrorResultException error)
-      {
-        connection.close();
-        resultHandler.handleErrorResult(error);
-      }
-
-
-
-      @Override
-      public final void handleResult(final R result)
-      {
-        connection.close();
-        resultHandler.handleResult(result);
-      }
-
-    }
-
-
-
-    private abstract class ConnectionCompletionHandler<R extends Result>
-        implements ResultHandler<Connection>
-    {
-      private final ResultHandler<? super R> resultHandler;
-
-
-
-      ConnectionCompletionHandler(final ResultHandler<? super R> resultHandler)
-      {
-        this.resultHandler = resultHandler;
-      }
-
-
-
-      @Override
-      public final void handleErrorResult(final ErrorResultException error)
-      {
-        resultHandler.handleErrorResult(error);
-      }
-
-
-
-      @Override
-      public abstract void handleResult(Connection connection);
-
-    }
-
-
-
-    private final class RequestCompletionHandler<R extends Result> extends
-        AbstractRequestCompletionHandler<R, ResultHandler<? super R>>
-    {
-      RequestCompletionHandler(final Connection connection,
-          final ResultHandler<? super R> resultHandler)
-      {
-        super(connection, resultHandler);
-      }
-    }
-
-
-
-    private final class SearchRequestCompletionHandler extends
-        AbstractRequestCompletionHandler<Result, SearchResultHandler> implements
-        SearchResultHandler
-    {
-
-      SearchRequestCompletionHandler(final Connection connection,
-          final SearchResultHandler resultHandler)
-      {
-        super(connection, resultHandler);
-      }
-
-
-
-      /**
-       * {@inheritDoc}
-       */
-      @Override
-      public final boolean handleEntry(final SearchResultEntry entry)
-      {
-        return resultHandler.handleEntry(entry);
-      }
-
-
-
-      /**
-       * {@inheritDoc}
-       */
-      @Override
-      public final boolean handleReference(
-          final SearchResultReference reference)
-      {
-        return resultHandler.handleReference(reference);
-      }
-
-    }
-
-
-
-    private volatile ProxiedAuthV2RequestControl proxiedAuthControl = null;
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAdd(final RequestContext requestContext,
-        final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<Result> outerHandler =
-          new ConnectionCompletionHandler<Result>(resultHandler)
-      {
-
-        @Override
-        public void handleResult(final Connection connection)
-        {
-          final RequestCompletionHandler<Result> innerHandler =
-              new RequestCompletionHandler<Result>(connection, resultHandler);
-          connection.addAsync(request, intermediateResponseHandler,
-              innerHandler);
+        private ProxyBackend(final ConnectionFactory factory, final ConnectionFactory bindFactory) {
+            this.factory = factory;
+            this.bindFactory = bindFactory;
         }
 
-      };
+        private abstract class AbstractRequestCompletionHandler<R extends Result, H extends ResultHandler<? super R>>
+                implements ResultHandler<R> {
+            final H resultHandler;
+            final Connection connection;
 
-      factory.getConnectionAsync(outerHandler);
-    }
+            AbstractRequestCompletionHandler(final Connection connection, final H resultHandler) {
+                this.connection = connection;
+                this.resultHandler = resultHandler;
+            }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleBind(final RequestContext requestContext,
-        final int version, final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-    {
-
-      if (request.getAuthenticationType() != ((byte) 0x80))
-      {
-        // TODO: SASL authentication not implemented.
-        resultHandler.handleErrorResult(newErrorResult(
-            ResultCode.PROTOCOL_ERROR,
-            "non-SIMPLE authentication not supported: "
-                + request.getAuthenticationType()));
-      }
-      else
-      {
-        // Authenticate using a separate bind connection pool, because we
-        // don't want to change the state of the pooled connection.
-        final ConnectionCompletionHandler<BindResult> outerHandler =
-            new ConnectionCompletionHandler<BindResult>(resultHandler)
-        {
-
-          @Override
-          public void handleResult(final Connection connection)
-          {
-            final ResultHandler<BindResult> innerHandler =
-                new ResultHandler<BindResult>()
-            {
-
-              @Override
-              public final void handleErrorResult(
-                  final ErrorResultException error)
-              {
+            @Override
+            public final void handleErrorResult(final ErrorResultException error) {
                 connection.close();
                 resultHandler.handleErrorResult(error);
-              }
+            }
 
-
-
-              @Override
-              public final void handleResult(final BindResult result)
-              {
+            @Override
+            public final void handleResult(final R result) {
                 connection.close();
-                proxiedAuthControl = ProxiedAuthV2RequestControl
-                    .newControl("dn:" + request.getName());
                 resultHandler.handleResult(result);
-              }
-            };
-            connection.bindAsync(request, intermediateResponseHandler,
-                innerHandler);
-          }
+            }
 
-        };
-
-        proxiedAuthControl = null;
-        bindFactory.getConnectionAsync(outerHandler);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleCompare(final RequestContext requestContext,
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<CompareResult> outerHandler =
-          new ConnectionCompletionHandler<CompareResult>(resultHandler)
-      {
-
-        @Override
-        public void handleResult(final Connection connection)
-        {
-          final RequestCompletionHandler<CompareResult> innerHandler =
-              new RequestCompletionHandler<CompareResult>(connection,
-                  resultHandler);
-          connection.compareAsync(request, intermediateResponseHandler,
-              innerHandler);
         }
 
-      };
+        private abstract class ConnectionCompletionHandler<R extends Result> implements
+                ResultHandler<Connection> {
+            private final ResultHandler<? super R> resultHandler;
 
-      factory.getConnectionAsync(outerHandler);
-    }
+            ConnectionCompletionHandler(final ResultHandler<? super R> resultHandler) {
+                this.resultHandler = resultHandler;
+            }
 
+            @Override
+            public final void handleErrorResult(final ErrorResultException error) {
+                resultHandler.handleErrorResult(error);
+            }
 
+            @Override
+            public abstract void handleResult(Connection connection);
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleDelete(final RequestContext requestContext,
-        final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<Result> outerHandler =
-          new ConnectionCompletionHandler<Result>(resultHandler)
-      {
-
-        @Override
-        public void handleResult(final Connection connection)
-        {
-          final RequestCompletionHandler<Result> innerHandler =
-              new RequestCompletionHandler<Result>(connection, resultHandler);
-          connection.deleteAsync(request, intermediateResponseHandler,
-              innerHandler);
         }
 
-      };
-
-      factory.getConnectionAsync(outerHandler);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <R extends ExtendedResult> void handleExtendedRequest(
-        final RequestContext requestContext, final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-    {
-      if (request.getOID().equals(CancelExtendedRequest.OID))
-      {
-        // TODO: not implemented.
-        resultHandler.handleErrorResult(newErrorResult(
-            ResultCode.PROTOCOL_ERROR,
-            "Cancel extended request operation not supported"));
-      }
-      else if (request.getOID().equals(StartTLSExtendedRequest.OID))
-      {
-        // TODO: not implemented.
-        resultHandler.handleErrorResult(newErrorResult(
-            ResultCode.PROTOCOL_ERROR,
-            "StartTLS extended request operation not supported"));
-      }
-      else
-      {
-        // Forward all other extended operations.
-        addProxiedAuthControl(request);
-
-        final ConnectionCompletionHandler<R> outerHandler =
-            new ConnectionCompletionHandler<R>(resultHandler)
-        {
-
-          @Override
-          public void handleResult(final Connection connection)
-          {
-            final RequestCompletionHandler<R> innerHandler =
-                new RequestCompletionHandler<R>(connection, resultHandler);
-            connection.extendedRequestAsync(request,
-                intermediateResponseHandler, innerHandler);
-          }
-
-        };
-
-        factory.getConnectionAsync(outerHandler);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModify(final RequestContext requestContext,
-        final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<Result> outerHandler =
-          new ConnectionCompletionHandler<Result>(resultHandler)
-      {
-
-        @Override
-        public void handleResult(final Connection connection)
-        {
-          final RequestCompletionHandler<Result> innerHandler =
-              new RequestCompletionHandler<Result>(connection, resultHandler);
-          connection.modifyAsync(request, intermediateResponseHandler,
-              innerHandler);
+        private final class RequestCompletionHandler<R extends Result> extends
+                AbstractRequestCompletionHandler<R, ResultHandler<? super R>> {
+            RequestCompletionHandler(final Connection connection,
+                    final ResultHandler<? super R> resultHandler) {
+                super(connection, resultHandler);
+            }
         }
 
-      };
+        private final class SearchRequestCompletionHandler extends
+                AbstractRequestCompletionHandler<Result, SearchResultHandler> implements
+                SearchResultHandler {
 
-      factory.getConnectionAsync(outerHandler);
-    }
+            SearchRequestCompletionHandler(final Connection connection,
+                    final SearchResultHandler resultHandler) {
+                super(connection, resultHandler);
+            }
 
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public final boolean handleEntry(final SearchResultEntry entry) {
+                return resultHandler.handleEntry(entry);
+            }
 
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public final boolean handleReference(final SearchResultReference reference) {
+                return resultHandler.handleReference(reference);
+            }
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModifyDN(final RequestContext requestContext,
-        final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<Result> outerHandler =
-          new ConnectionCompletionHandler<Result>(resultHandler)
-      {
-
-        @Override
-        public void handleResult(final Connection connection)
-        {
-          final RequestCompletionHandler<Result> innerHandler =
-              new RequestCompletionHandler<Result>(connection, resultHandler);
-          connection.modifyDNAsync(request, intermediateResponseHandler,
-              innerHandler);
         }
 
-      };
+        private volatile ProxiedAuthV2RequestControl proxiedAuthControl = null;
 
-      factory.getConnectionAsync(outerHandler);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleSearch(final RequestContext requestContext,
-        final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-    {
-      addProxiedAuthControl(request);
-      final ConnectionCompletionHandler<Result> outerHandler =
-          new ConnectionCompletionHandler<Result>(resultHandler)
-      {
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public void handleResult(final Connection connection)
-        {
-          final SearchRequestCompletionHandler innerHandler =
-              new SearchRequestCompletionHandler(connection, resultHandler);
-          connection.searchAsync(request, intermediateResponseHandler,
-              innerHandler);
+        public void handleAdd(final RequestContext requestContext, final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<Result> outerHandler =
+                    new ConnectionCompletionHandler<Result>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final RequestCompletionHandler<Result> innerHandler =
+                                    new RequestCompletionHandler<Result>(connection, resultHandler);
+                            connection.addAsync(request, intermediateResponseHandler, innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
         }
 
-      };
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleBind(final RequestContext requestContext, final int version,
+                final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler) {
 
-      factory.getConnectionAsync(outerHandler);
+            if (request.getAuthenticationType() != ((byte) 0x80)) {
+                // TODO: SASL authentication not implemented.
+                resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                        "non-SIMPLE authentication not supported: "
+                                + request.getAuthenticationType()));
+            } else {
+                // Authenticate using a separate bind connection pool, because
+                // we
+                // don't want to change the state of the pooled connection.
+                final ConnectionCompletionHandler<BindResult> outerHandler =
+                        new ConnectionCompletionHandler<BindResult>(resultHandler) {
+
+                            @Override
+                            public void handleResult(final Connection connection) {
+                                final ResultHandler<BindResult> innerHandler =
+                                        new ResultHandler<BindResult>() {
+
+                                            @Override
+                                            public final void handleErrorResult(
+                                                    final ErrorResultException error) {
+                                                connection.close();
+                                                resultHandler.handleErrorResult(error);
+                                            }
+
+                                            @Override
+                                            public final void handleResult(final BindResult result) {
+                                                connection.close();
+                                                proxiedAuthControl =
+                                                        ProxiedAuthV2RequestControl
+                                                                .newControl("dn:"
+                                                                        + request.getName());
+                                                resultHandler.handleResult(result);
+                                            }
+                                        };
+                                connection.bindAsync(request, intermediateResponseHandler,
+                                        innerHandler);
+                            }
+
+                        };
+
+                proxiedAuthControl = null;
+                bindFactory.getConnectionAsync(outerHandler);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleCompare(final RequestContext requestContext,
+                final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<CompareResult> outerHandler =
+                    new ConnectionCompletionHandler<CompareResult>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final RequestCompletionHandler<CompareResult> innerHandler =
+                                    new RequestCompletionHandler<CompareResult>(connection,
+                                            resultHandler);
+                            connection.compareAsync(request, intermediateResponseHandler,
+                                    innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleDelete(final RequestContext requestContext, final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<Result> outerHandler =
+                    new ConnectionCompletionHandler<Result>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final RequestCompletionHandler<Result> innerHandler =
+                                    new RequestCompletionHandler<Result>(connection, resultHandler);
+                            connection.deleteAsync(request, intermediateResponseHandler,
+                                    innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public <R extends ExtendedResult> void handleExtendedRequest(
+                final RequestContext requestContext, final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) {
+            if (request.getOID().equals(CancelExtendedRequest.OID)) {
+                // TODO: not implemented.
+                resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                        "Cancel extended request operation not supported"));
+            } else if (request.getOID().equals(StartTLSExtendedRequest.OID)) {
+                // TODO: not implemented.
+                resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                        "StartTLS extended request operation not supported"));
+            } else {
+                // Forward all other extended operations.
+                addProxiedAuthControl(request);
+
+                final ConnectionCompletionHandler<R> outerHandler =
+                        new ConnectionCompletionHandler<R>(resultHandler) {
+
+                            @Override
+                            public void handleResult(final Connection connection) {
+                                final RequestCompletionHandler<R> innerHandler =
+                                        new RequestCompletionHandler<R>(connection, resultHandler);
+                                connection.extendedRequestAsync(request,
+                                        intermediateResponseHandler, innerHandler);
+                            }
+
+                        };
+
+                factory.getConnectionAsync(outerHandler);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModify(final RequestContext requestContext, final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<Result> outerHandler =
+                    new ConnectionCompletionHandler<Result>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final RequestCompletionHandler<Result> innerHandler =
+                                    new RequestCompletionHandler<Result>(connection, resultHandler);
+                            connection.modifyAsync(request, intermediateResponseHandler,
+                                    innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModifyDN(final RequestContext requestContext,
+                final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<Result> outerHandler =
+                    new ConnectionCompletionHandler<Result>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final RequestCompletionHandler<Result> innerHandler =
+                                    new RequestCompletionHandler<Result>(connection, resultHandler);
+                            connection.modifyDNAsync(request, intermediateResponseHandler,
+                                    innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleSearch(final RequestContext requestContext, final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) {
+            addProxiedAuthControl(request);
+            final ConnectionCompletionHandler<Result> outerHandler =
+                    new ConnectionCompletionHandler<Result>(resultHandler) {
+
+                        @Override
+                        public void handleResult(final Connection connection) {
+                            final SearchRequestCompletionHandler innerHandler =
+                                    new SearchRequestCompletionHandler(connection, resultHandler);
+                            connection.searchAsync(request, intermediateResponseHandler,
+                                    innerHandler);
+                        }
+
+                    };
+
+            factory.getConnectionAsync(outerHandler);
+        }
+
+        private void addProxiedAuthControl(final Request request) {
+            final ProxiedAuthV2RequestControl control = proxiedAuthControl;
+            if (control != null) {
+                request.addControl(control);
+            }
+        }
+
     }
 
+    /**
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: listen address, listen port,
+     *            remote address1, remote port1, remote address2, remote port2,
+     *            ...
+     */
+    public static void main(final String[] args) {
+        if (args.length < 4 || args.length % 2 != 0) {
+            System.err.println("Usage: listenAddress listenPort "
+                    + "remoteAddress1 remotePort1 remoteAddress2 remotePort2");
+            System.exit(1);
+        }
 
+        // Parse command line arguments.
+        final String localAddress = args[0];
+        final int localPort = Integer.parseInt(args[1]);
 
-    private void addProxiedAuthControl(final Request request)
-    {
-      final ProxiedAuthV2RequestControl control = proxiedAuthControl;
-      if (control != null)
-      {
-        request.addControl(control);
-      }
+        // Create load balancer.
+        final List<ConnectionFactory> factories = new LinkedList<ConnectionFactory>();
+        final List<ConnectionFactory> bindFactories = new LinkedList<ConnectionFactory>();
+        for (int i = 2; i < args.length; i += 2) {
+            final String remoteAddress = args[i];
+            final int remotePort = Integer.parseInt(args[i + 1]);
+
+            factories.add(Connections.newFixedConnectionPool(new LDAPConnectionFactory(
+                    remoteAddress, remotePort), Integer.MAX_VALUE));
+            bindFactories.add(Connections.newFixedConnectionPool(new LDAPConnectionFactory(
+                    remoteAddress, remotePort), Integer.MAX_VALUE));
+        }
+        final RoundRobinLoadBalancingAlgorithm algorithm =
+                new RoundRobinLoadBalancingAlgorithm(factories);
+        final RoundRobinLoadBalancingAlgorithm bindAlgorithm =
+                new RoundRobinLoadBalancingAlgorithm(bindFactories);
+        final ConnectionFactory factory = Connections.newLoadBalancer(algorithm);
+        final ConnectionFactory bindFactory = Connections.newLoadBalancer(bindAlgorithm);
+
+        // Create a server connection adapter.
+        final ProxyBackend backend = new ProxyBackend(factory, bindFactory);
+        final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler =
+                Connections.newServerConnectionFactory(backend);
+
+        // Create listener.
+        final LDAPListenerOptions options = new LDAPListenerOptions().setBacklog(4096);
+        LDAPListener listener = null;
+        try {
+            listener = new LDAPListener(localAddress, localPort, connectionHandler, options);
+            System.out.println("Press any key to stop the server...");
+            System.in.read();
+        } catch (final IOException e) {
+            System.out.println("Error listening on " + localAddress + ":" + localPort);
+            e.printStackTrace();
+        } finally {
+            if (listener != null) {
+                listener.close();
+            }
+        }
     }
 
-  }
-
-
-
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: listen address, listen port, remote
-   *          address1, remote port1, remote address2, remote port2, ...
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length < 4 || args.length % 2 != 0)
-    {
-      System.err.println("Usage: listenAddress listenPort "
-          + "remoteAddress1 remotePort1 remoteAddress2 remotePort2");
-      System.exit(1);
+    private Proxy() {
+        // Not used.
     }
-
-    // Parse command line arguments.
-    final String localAddress = args[0];
-    final int localPort = Integer.parseInt(args[1]);
-
-    // Create load balancer.
-    final List<ConnectionFactory> factories =
-        new LinkedList<ConnectionFactory>();
-    final List<ConnectionFactory> bindFactories =
-        new LinkedList<ConnectionFactory>();
-    for (int i = 2; i < args.length; i += 2)
-    {
-      final String remoteAddress = args[i];
-      final int remotePort = Integer.parseInt(args[i + 1]);
-
-      factories.add(Connections.newFixedConnectionPool(
-          new LDAPConnectionFactory(remoteAddress, remotePort),
-          Integer.MAX_VALUE));
-      bindFactories.add(Connections.newFixedConnectionPool(
-          new LDAPConnectionFactory(remoteAddress, remotePort),
-          Integer.MAX_VALUE));
-    }
-    final RoundRobinLoadBalancingAlgorithm algorithm =
-        new RoundRobinLoadBalancingAlgorithm(factories);
-    final RoundRobinLoadBalancingAlgorithm bindAlgorithm =
-        new RoundRobinLoadBalancingAlgorithm(bindFactories);
-    final ConnectionFactory factory = Connections.newLoadBalancer(algorithm);
-    final ConnectionFactory bindFactory = Connections
-        .newLoadBalancer(bindAlgorithm);
-
-    // Create a server connection adapter.
-    final ProxyBackend backend = new ProxyBackend(factory, bindFactory);
-    final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler
-      = Connections.newServerConnectionFactory(backend);
-
-    // Create listener.
-    final LDAPListenerOptions options = new LDAPListenerOptions()
-        .setBacklog(4096);
-    LDAPListener listener = null;
-    try
-    {
-      listener = new LDAPListener(localAddress, localPort, connectionHandler,
-          options);
-      System.out.println("Press any key to stop the server...");
-      System.in.read();
-    }
-    catch (final IOException e)
-    {
-      System.out
-          .println("Error listening on " + localAddress + ":" + localPort);
-      e.printStackTrace();
-    }
-    finally
-    {
-      if (listener != null)
-      {
-        listener.close();
-      }
-    }
-  }
-
-
-
-  private Proxy()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
index 1dbf0f7..2e47427 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,17 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.schema.*;
-
-
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.ObjectClass;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.Syntax;
 
 /**
  * An example client application which prints a summary of the schema on the
@@ -45,103 +48,83 @@
  *  &lt;host> &lt;port> &lt;username> &lt;password>
  * </pre>
  */
-public final class ReadSchema
-{
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: host, port, username, password.
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length != 4)
-    {
-      System.err.println("Usage: host port username password");
-      System.exit(1);
+public final class ReadSchema {
+    /**
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: host, port, username, password.
+     */
+    public static void main(final String[] args) {
+        if (args.length != 4) {
+            System.err.println("Usage: host port username password");
+            System.exit(1);
+        }
+
+        // Parse command line arguments.
+        final String hostName = args[0];
+        final int port = Integer.parseInt(args[1]);
+        final String userName = args[2];
+        final String password = args[3];
+
+        // Connect and bind to the server.
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port);
+        Connection connection = null;
+
+        try {
+            connection = factory.getConnection();
+            connection.bind(userName, password.toCharArray());
+
+            // Read the schema.
+            Schema schema = Schema.readSchemaForEntry(connection, DN.rootDN());
+
+            System.out.println("Attribute types");
+            for (AttributeType at : schema.getAttributeTypes()) {
+                System.out.println("  " + at.getNameOrOID());
+            }
+            System.out.println();
+
+            System.out.println("Object classes");
+            for (ObjectClass oc : schema.getObjectClasses()) {
+                System.out.println("  " + oc.getNameOrOID());
+            }
+            System.out.println();
+
+            System.out.println("Matching rules");
+            for (MatchingRule mr : schema.getMatchingRules()) {
+                System.out.println("  " + mr.getNameOrOID());
+            }
+            System.out.println();
+
+            System.out.println("Syntaxes");
+            for (Syntax s : schema.getSyntaxes()) {
+                System.out.println("  " + s.getDescription());
+            }
+            System.out.println();
+
+            // Etc...
+
+            System.out.println("WARNINGS");
+            for (LocalizableMessage m : schema.getWarnings()) {
+                System.out.println("  " + m.toString());
+            }
+            System.out.println();
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
     }
 
-    // Parse command line arguments.
-    final String hostName = args[0];
-    final int port = Integer.parseInt(args[1]);
-    final String userName = args[2];
-    final String password = args[3];
-
-    // Connect and bind to the server.
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(
-        hostName, port);
-    Connection connection = null;
-
-    try
-    {
-      connection = factory.getConnection();
-      connection.bind(userName, password.toCharArray());
-
-      // Read the schema.
-      Schema schema = Schema.readSchemaForEntry(connection, DN.rootDN());
-
-      System.out.println("Attribute types");
-      for (AttributeType at : schema.getAttributeTypes())
-      {
-        System.out.println("  " + at.getNameOrOID());
-      }
-      System.out.println();
-
-      System.out.println("Object classes");
-      for (ObjectClass oc : schema.getObjectClasses())
-      {
-        System.out.println("  " + oc.getNameOrOID());
-      }
-      System.out.println();
-
-      System.out.println("Matching rules");
-      for (MatchingRule mr : schema.getMatchingRules())
-      {
-        System.out.println("  " + mr.getNameOrOID());
-      }
-      System.out.println();
-
-      System.out.println("Syntaxes");
-      for (Syntax s : schema.getSyntaxes())
-      {
-        System.out.println("  " + s.getDescription());
-      }
-      System.out.println();
-
-      // Etc...
-
-      System.out.println("WARNINGS");
-      for (LocalizableMessage m : schema.getWarnings())
-      {
-        System.out.println("  " + m.toString());
-      }
-      System.out.println();
+    private ReadSchema() {
+        // Not used.
     }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
-    }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-    }
-  }
-
-
-
-  private ReadSchema()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
index 1db4eee..e664b9d 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -47,8 +46,6 @@
 import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
 
-
-
 /**
  * An example client application which performs SASL PLAIN authentication to a
  * directory server over LDAP with StartTLS. This example takes the following
@@ -60,9 +57,8 @@
  * <li>authcid - Authentication identity</li>
  * <li>passwd - Password of the user to authenticate</li>
  * </ul>
- * The host, port, authcid, and passwd are required.
- * SASL PLAIN is described in <a href="http://www.ietf.org/rfc/rfc4616.txt">RFC
- * 4616</a>.
+ * The host, port, authcid, and passwd are required. SASL PLAIN is described in
+ * <a href="http://www.ietf.org/rfc/rfc4616.txt">RFC 4616</a>.
  * <p>
  * The authzid and authcid are prefixed as described in <a
  * href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513, section
@@ -72,139 +68,114 @@
  * By default, OpenDJ is set up for SASL PLAIN to use the Exact Match Identity
  * Mapper to find entries by searching uid values for the user ID. In other
  * words, the following examples are equivalent.
+ *
  * <pre>
  * dn:uid=bjensen,ou=people,dc=example,dc=com
  * u:bjensen
  * </pre>
  */
-public final class SASLAuth
-{
-  /**
-   * Authenticate to the directory using SASL PLAIN.
-   * @param args The command line arguments
-   */
-  public static void main(String[] args)
-  {
-    parseArgs(args);
-    Connection connection = null;
+public final class SASLAuth {
+    /**
+     * Authenticate to the directory using SASL PLAIN.
+     *
+     * @param args
+     *            The command line arguments
+     */
+    public static void main(String[] args) {
+        parseArgs(args);
+        Connection connection = null;
 
-    try
-    {
-      final LDAPConnectionFactory factory =
-          new LDAPConnectionFactory(host, port, getTrustAllOptions());
-      connection = factory.getConnection();
-      PlainSASLBindRequest request = Requests.newPlainSASLBindRequest(
-          authcid, passwd.toCharArray());
-      if (authzid != null) request.setAuthorizationID(authzid);
-      connection.bind(request);
-      System.out.println("Authenticated as " + authcid + ".");
+        try {
+            final LDAPConnectionFactory factory =
+                    new LDAPConnectionFactory(host, port, getTrustAllOptions());
+            connection = factory.getConnection();
+            PlainSASLBindRequest request =
+                    Requests.newPlainSASLBindRequest(authcid, passwd.toCharArray());
+            if (authzid != null) {
+                request.setAuthorizationID(authzid);
+            }
+            connection.bind(request);
+            System.out.println("Authenticated as " + authcid + ".");
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } catch (final GeneralSecurityException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_CONNECT_ERROR.intValue());
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
     }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
+
+    /**
+     * For StartTLS the connection factory needs SSL context options. In the
+     * general case, a trust manager in the SSL context serves to check server
+     * certificates, and a key manager handles client keys when the server
+     * checks certificates from our client.
+     *
+     * OpenDJ directory server lets you install by default with a self-signed
+     * certificate that is not in the system trust store. To simplify this
+     * implementation trusts all server certificates.
+     */
+    private static LDAPOptions getTrustAllOptions() throws GeneralSecurityException {
+        LDAPOptions lo = new LDAPOptions();
+        SSLContext sslContext =
+                new SSLContextBuilder().setTrustManager(TrustManagers.trustAll()).getSSLContext();
+        lo.setSSLContext(sslContext);
+        lo.setUseStartTLS(true);
+        return lo;
     }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
+
+    private static String host;
+    private static int port;
+    private static String authzid;
+    private static String authcid;
+    private static String passwd;
+
+    /**
+     * Parse command line arguments.
+     *
+     * @param args
+     *            host port [authzid] authcid passwd
+     */
+    private static void parseArgs(String[] args) {
+        if (args.length < 4 || args.length > 5) {
+            giveUp();
+        }
+
+        host = args[0];
+        port = Integer.parseInt(args[1]);
+
+        if (args.length == 5) {
+            authzid = args[2];
+            authcid = args[3];
+            passwd = args[4];
+        } else {
+            authzid = null;
+            authcid = args[2];
+            passwd = args[3];
+        }
     }
-    catch (final GeneralSecurityException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_CONNECT_ERROR.intValue());
+
+    private static void giveUp() {
+        printUsage();
+        System.exit(1);
     }
-    finally
-    {
-      if (connection != null)
-        connection.close();
+
+    private static void printUsage() {
+        System.err.println("Usage: host port [authzid] authcid passwd");
+        System.err.println("\tThe port must be able to handle LDAP with StartTLS.");
+        System.err.println("\tSee http://www.ietf.org/rfc/rfc4616.txt for more on SASL PLAIN.");
     }
-  }
 
-
-
-  /**
-   * For StartTLS the connection factory needs SSL context options.
-   * In the general case, a trust manager in the SSL context serves to check
-   * server certificates, and a key manager handles client keys when the server
-   * checks certificates from our client.
-   *
-   * OpenDJ directory server lets you install by default with a self-signed
-   * certificate that is not in the system trust store. To simplify this
-   * implementation trusts all server certificates.
-   */
-  private static LDAPOptions getTrustAllOptions()
-    throws GeneralSecurityException
-  {
-    LDAPOptions lo = new LDAPOptions();
-    SSLContext sslContext = new SSLContextBuilder()
-      .setTrustManager(TrustManagers.trustAll()).getSSLContext();
-    lo.setSSLContext(sslContext);
-    lo.setUseStartTLS(true);
-    return lo;
-  }
-
-
-
-  private static String host;
-  private static int port;
-  private static String authzid;
-  private static String authcid;
-  private static String passwd;
-
-
-
-  /**
-   * Parse command line arguments.
-   * @param args host port [authzid] authcid passwd
-   */
-  private static void parseArgs(String[] args)
-  {
-    if (args.length < 4 || args.length > 5) giveUp();
-
-    host = args[0];
-    port = Integer.parseInt(args[1]);
-
-    if (args.length == 5)
-    {
-      authzid = args[2];
-      authcid = args[3];
-      passwd = args[4];
+    private SASLAuth() {
+        // Not used.
     }
-    else
-    {
-      authzid = null;
-      authcid = args[2];
-      passwd = args[3];
-    }
-  }
-
-
-
-  private static void giveUp()
-  {
-    printUsage();
-    System.exit(1);
-  }
-
-
-
-  private static void printUsage()
-  {
-    System.err.println(
-      "Usage: host port [authzid] authcid passwd");
-    System.err.println(
-      "\tThe port must be able to handle LDAP with StartTLS.");
-    System.err.println(
-      "\tSee http://www.ietf.org/rfc/rfc4616.txt for more on SASL PLAIN.");
-  }
-
-
-
-  private SASLAuth()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
index 0098552..0bbe01d 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,16 +27,19 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.responses.*;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.ErrorResultIOException;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
+import org.forgerock.opendj.ldif.ConnectionEntryReader;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
 /**
  * An example client application which searches a Directory Server. This example
@@ -48,141 +50,103 @@
  *      &lt;baseDN> &lt;scope> &lt;filter> [&lt;attibute> &lt;attribute> ...]
  * </pre>
  */
-public final class Search
-{
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: host, port, username, password, base
-   *          DN, scope, filter, and zero or more attributes to be retrieved.
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length < 7)
-    {
-      System.err
-          .println("Usage: host port username password baseDN scope "
-              + "filter [attribute ...]");
-      System.exit(1);
-    }
-
-    // Parse command line arguments.
-    final String hostName = args[0];
-    final int port = Integer.parseInt(args[1]);
-    final String userName = args[2];
-    final String password = args[3];
-    final String baseDN = args[4];
-    final String scopeString = args[5];
-    final String filter = args[6];
-    String[] attributes;
-    if (args.length > 7)
-    {
-      attributes = Arrays.copyOfRange(args, 7, args.length);
-    }
-    else
-    {
-      attributes = new String[0];
-    }
-
-    SearchScope scope;
-    if (scopeString.equalsIgnoreCase("base"))
-    {
-      scope = SearchScope.BASE_OBJECT;
-    }
-    else if (scopeString.equalsIgnoreCase("one"))
-    {
-      scope = SearchScope.SINGLE_LEVEL;
-    }
-    else if (scopeString.equalsIgnoreCase("sub"))
-    {
-      scope = SearchScope.WHOLE_SUBTREE;
-    }
-    else if (scopeString.equalsIgnoreCase("subordinates"))
-    {
-      scope = SearchScope.SUBORDINATES;
-    }
-    else
-    {
-      System.err.println("Unknown scope: " + scopeString);
-      System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
-      return;
-    }
-
-    // Create an LDIF writer which will write the search results to stdout.
-    final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
-
-    // Connect and bind to the server.
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(
-        hostName, port);
-    Connection connection = null;
-
-    try
-    {
-      connection = factory.getConnection();
-      connection.bind(userName, password.toCharArray());
-
-      // Read the entries and output them as LDIF.
-      final ConnectionEntryReader reader = connection.search(baseDN,
-          scope, filter, attributes);
-      while (reader.hasNext())
-      {
-        if (!reader.isReference())
-        {
-          final SearchResultEntry entry = reader.readEntry();
-          writer.writeComment("Search result entry: "
-              + entry.getName().toString());
-          writer.writeEntry(entry);
+public final class Search {
+    /**
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: host, port, username, password,
+     *            base DN, scope, filter, and zero or more attributes to be
+     *            retrieved.
+     */
+    public static void main(final String[] args) {
+        if (args.length < 7) {
+            System.err.println("Usage: host port username password baseDN scope "
+                    + "filter [attribute ...]");
+            System.exit(1);
         }
-        else
-        {
-          final SearchResultReference ref = reader.readReference();
 
-          // Got a continuation reference.
-          writer.writeComment("Search result reference: "
-              + ref.getURIs().toString());
+        // Parse command line arguments.
+        final String hostName = args[0];
+        final int port = Integer.parseInt(args[1]);
+        final String userName = args[2];
+        final String password = args[3];
+        final String baseDN = args[4];
+        final String scopeString = args[5];
+        final String filter = args[6];
+        String[] attributes;
+        if (args.length > 7) {
+            attributes = Arrays.copyOfRange(args, 7, args.length);
+        } else {
+            attributes = new String[0];
         }
-      }
-      writer.flush();
-    }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
-    }
-    catch (final ErrorResultIOException e)
-    {
-      System.err.println(e.getMessage());
-      System
-          .exit(e.getCause().getResult().getResultCode().intValue());
-      return;
-    }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
-    }
-    catch (final IOException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
-      return;
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-    }
-  }
 
+        SearchScope scope;
+        if (scopeString.equalsIgnoreCase("base")) {
+            scope = SearchScope.BASE_OBJECT;
+        } else if (scopeString.equalsIgnoreCase("one")) {
+            scope = SearchScope.SINGLE_LEVEL;
+        } else if (scopeString.equalsIgnoreCase("sub")) {
+            scope = SearchScope.WHOLE_SUBTREE;
+        } else if (scopeString.equalsIgnoreCase("subordinates")) {
+            scope = SearchScope.SUBORDINATES;
+        } else {
+            System.err.println("Unknown scope: " + scopeString);
+            System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+            return;
+        }
 
+        // Create an LDIF writer which will write the search results to stdout.
+        final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
 
-  private Search()
-  {
-    // Not used.
-  }
+        // Connect and bind to the server.
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port);
+        Connection connection = null;
+
+        try {
+            connection = factory.getConnection();
+            connection.bind(userName, password.toCharArray());
+
+            // Read the entries and output them as LDIF.
+            final ConnectionEntryReader reader =
+                    connection.search(baseDN, scope, filter, attributes);
+            while (reader.hasNext()) {
+                if (!reader.isReference()) {
+                    final SearchResultEntry entry = reader.readEntry();
+                    writer.writeComment("Search result entry: " + entry.getName().toString());
+                    writer.writeEntry(entry);
+                } else {
+                    final SearchResultReference ref = reader.readReference();
+
+                    // Got a continuation reference.
+                    writer.writeComment("Search result reference: " + ref.getURIs().toString());
+                }
+            }
+            writer.flush();
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final ErrorResultIOException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getCause().getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } catch (final IOException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+            return;
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
+    }
+
+    private Search() {
+        // Not used.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
index 6cacf31..ee6afe1 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,18 +27,25 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.concurrent.CountDownLatch;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
 /**
  * An example client application which searches a Directory Server using the
@@ -50,268 +56,198 @@
  *      &lt;baseDN> &lt;scope> &lt;filter> [&lt;attibute> &lt;attribute> ...]
  * </pre>
  */
-public final class SearchAsync
-{
-  private static final class BindResultHandlerImpl implements
-      ResultHandler<BindResult>
-  {
+public final class SearchAsync {
+    private static final class BindResultHandlerImpl implements ResultHandler<BindResult> {
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            System.err.println(error.getMessage());
+            resultCode = error.getResult().getResultCode().intValue();
+            COMPLETION_LATCH.countDown();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final BindResult result) {
+            // Bind succeeded: initiate search.
+            final SearchRequest request =
+                    Requests.newSearchRequest(baseDN, scope, filter, attributes);
+            connection.searchAsync(request, null, new SearchResultHandlerImpl());
+        }
+
+    }
+
+    private static final class ConnectResultHandlerImpl implements ResultHandler<Connection> {
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            System.err.println(error.getMessage());
+            resultCode = error.getResult().getResultCode().intValue();
+            COMPLETION_LATCH.countDown();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final Connection connection) {
+            // Connect succeeded: save connection and initiate bind.
+            SearchAsync.connection = connection;
+
+            final BindRequest request =
+                    Requests.newSimpleBindRequest(userName, password.toCharArray());
+            connection.bindAsync(request, null, new BindResultHandlerImpl());
+        }
+
+    }
+
+    private static final class SearchResultHandlerImpl implements SearchResultHandler {
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public synchronized boolean handleEntry(final SearchResultEntry entry) {
+            try {
+                WRITER.writeComment("Search result entry: " + entry.getName().toString());
+                WRITER.writeEntry(entry);
+            } catch (final IOException e) {
+                System.err.println(e.getMessage());
+                resultCode = ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+                COMPLETION_LATCH.countDown();
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            System.err.println(error.getMessage());
+            resultCode = error.getResult().getResultCode().intValue();
+            COMPLETION_LATCH.countDown();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public synchronized boolean handleReference(final SearchResultReference reference) {
+            try {
+                WRITER.writeComment("Search result reference: " + reference.getURIs().toString());
+            } catch (final IOException e) {
+                System.err.println(e.getMessage());
+                resultCode = ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+                COMPLETION_LATCH.countDown();
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final Result result) {
+            resultCode = result.getResultCode().intValue();
+            COMPLETION_LATCH.countDown();
+        }
+
+    }
+
+    private static final CountDownLatch COMPLETION_LATCH = new CountDownLatch(1);
+    private static final LDIFEntryWriter WRITER = new LDIFEntryWriter(System.out);
+    private static String userName;
+    private static String password;
+    private static String baseDN;
+    private static SearchScope scope;
+    private static String filter;
+    private static String[] attributes;
+    private static Connection connection = null;
+    private static int resultCode = 0;
 
     /**
-     * {@inheritDoc}
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: host, port, username, password,
+     *            base DN, scope, filter, and zero or more attributes to be
+     *            retrieved.
      */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      System.err.println(error.getMessage());
-      resultCode = error.getResult().getResultCode().intValue();
-      COMPLETION_LATCH.countDown();
+    public static void main(final String[] args) {
+        if (args.length < 7) {
+            System.err.println("Usage: host port username password baseDN scope "
+                    + "filter [attribute ...]");
+            System.exit(1);
+        }
+
+        // Parse command line arguments.
+        final String hostName = args[0];
+        final int port = Integer.parseInt(args[1]);
+        userName = args[2];
+        password = args[3];
+        baseDN = args[4];
+        final String scopeString = args[5];
+        filter = args[6];
+        if (args.length > 7) {
+            attributes = Arrays.copyOfRange(args, 7, args.length);
+        } else {
+            attributes = new String[0];
+        }
+
+        if (scopeString.equalsIgnoreCase("base")) {
+            scope = SearchScope.BASE_OBJECT;
+        } else if (scopeString.equalsIgnoreCase("one")) {
+            scope = SearchScope.SINGLE_LEVEL;
+        } else if (scopeString.equalsIgnoreCase("sub")) {
+            scope = SearchScope.WHOLE_SUBTREE;
+        } else if (scopeString.equalsIgnoreCase("subordinates")) {
+            scope = SearchScope.SUBORDINATES;
+        } else {
+            System.err.println("Unknown scope: " + scopeString);
+            System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+            return;
+        }
+
+        // Initiate the asynchronous connect, bind, and search.
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port);
+        factory.getConnectionAsync(new ConnectResultHandlerImpl());
+
+        // Await completion.
+        try {
+            COMPLETION_LATCH.await();
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        }
+
+        try {
+            WRITER.flush();
+        } catch (final IOException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+            return;
+        }
+
+        if (connection != null) {
+            connection.close();
+        }
+
+        System.exit(resultCode);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleResult(final BindResult result)
-    {
-      // Bind succeeded: initiate search.
-      final SearchRequest request = Requests.newSearchRequest(baseDN,
-          scope, filter, attributes);
-      connection.searchAsync(request, null, new SearchResultHandlerImpl());
+    private SearchAsync() {
+        // Not used.
     }
-
-  }
-
-
-
-  private static final class ConnectResultHandlerImpl implements
-      ResultHandler<Connection>
-  {
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      System.err.println(error.getMessage());
-      resultCode = error.getResult().getResultCode().intValue();
-      COMPLETION_LATCH.countDown();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleResult(final Connection connection)
-    {
-      // Connect succeeded: save connection and initiate bind.
-      SearchAsync.connection = connection;
-
-      final BindRequest request = Requests.newSimpleBindRequest(
-          userName, password.toCharArray());
-      connection.bindAsync(request, null, new BindResultHandlerImpl());
-    }
-
-  }
-
-
-
-  private static final class SearchResultHandlerImpl implements
-      SearchResultHandler
-  {
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized boolean handleEntry(
-        final SearchResultEntry entry)
-    {
-      try
-      {
-        WRITER.writeComment("Search result entry: "
-            + entry.getName().toString());
-        WRITER.writeEntry(entry);
-      }
-      catch (final IOException e)
-      {
-        System.err.println(e.getMessage());
-        resultCode = ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-        COMPLETION_LATCH.countDown();
-        return false;
-      }
-      return true;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      System.err.println(error.getMessage());
-      resultCode = error.getResult().getResultCode().intValue();
-      COMPLETION_LATCH.countDown();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized boolean handleReference(
-        final SearchResultReference reference)
-    {
-      try
-      {
-        WRITER.writeComment("Search result reference: "
-            + reference.getURIs().toString());
-      }
-      catch (final IOException e)
-      {
-        System.err.println(e.getMessage());
-        resultCode = ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-        COMPLETION_LATCH.countDown();
-        return false;
-      }
-      return true;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleResult(final Result result)
-    {
-      resultCode = result.getResultCode().intValue();
-      COMPLETION_LATCH.countDown();
-    }
-
-  }
-
-
-
-  private static final CountDownLatch COMPLETION_LATCH = new CountDownLatch(
-      1);
-  private static final LDIFEntryWriter WRITER = new LDIFEntryWriter(
-      System.out);
-  private static String userName;
-  private static String password;
-  private static String baseDN;
-  private static SearchScope scope;
-  private static String filter;
-  private static String[] attributes;
-  private static Connection connection = null;
-  private static int resultCode = 0;
-
-
-
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: host, port, username, password, base
-   *          DN, scope, filter, and zero or more attributes to be retrieved.
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length < 7)
-    {
-      System.err
-          .println("Usage: host port username password baseDN scope "
-              + "filter [attribute ...]");
-      System.exit(1);
-    }
-
-    // Parse command line arguments.
-    final String hostName = args[0];
-    final int port = Integer.parseInt(args[1]);
-    userName = args[2];
-    password = args[3];
-    baseDN = args[4];
-    final String scopeString = args[5];
-    filter = args[6];
-    if (args.length > 7)
-    {
-      attributes = Arrays.copyOfRange(args, 7, args.length);
-    }
-    else
-    {
-      attributes = new String[0];
-    }
-
-    if (scopeString.equalsIgnoreCase("base"))
-    {
-      scope = SearchScope.BASE_OBJECT;
-    }
-    else if (scopeString.equalsIgnoreCase("one"))
-    {
-      scope = SearchScope.SINGLE_LEVEL;
-    }
-    else if (scopeString.equalsIgnoreCase("sub"))
-    {
-      scope = SearchScope.WHOLE_SUBTREE;
-    }
-    else if (scopeString.equalsIgnoreCase("subordinates"))
-    {
-      scope = SearchScope.SUBORDINATES;
-    }
-    else
-    {
-      System.err.println("Unknown scope: " + scopeString);
-      System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
-      return;
-    }
-
-    // Initiate the asynchronous connect, bind, and search.
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(
-        hostName, port);
-    factory.getConnectionAsync(new ConnectResultHandlerImpl());
-
-    // Await completion.
-    try
-    {
-      COMPLETION_LATCH.await();
-    }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
-    }
-
-    try
-    {
-      WRITER.flush();
-    }
-    catch (final IOException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
-      return;
-    }
-
-    if (connection != null)
-    {
-      connection.close();
-    }
-
-    System.exit(resultCode);
-  }
-
-
-
-  private SearchAsync()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
index 53068f5..3527910 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -79,13 +78,13 @@
         char[] password = c.readPassword("Password: ");
 
         // Search using mail address, and then bind with the DN and password.
-        final LDAPConnectionFactory factory = new LDAPConnectionFactory(host,
-                port);
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port);
         Connection connection = null;
         try {
             connection = factory.getConnection();
-            SearchResultEntry entry = connection.searchSingleEntry(baseDN,
-                    SearchScope.WHOLE_SUBTREE, "(mail=" + mail + ")", "cn");
+            SearchResultEntry entry =
+                    connection.searchSingleEntry(baseDN, SearchScope.WHOLE_SUBTREE, "(mail=" + mail
+                            + ")", "cn");
             DN bindDN = entry.getName();
             BindResult result = connection.bind(bindDN.toString(), password);
 
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
index bc7ba0e..575f3ae 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.io.FileInputStream;
@@ -42,12 +39,45 @@
 
 import javax.net.ssl.SSLContext;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldap.CancelledResultException;
+import org.forgerock.opendj.ldap.Connections;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.KeyManagers;
+import org.forgerock.opendj.ldap.LDAPClientContext;
+import org.forgerock.opendj.ldap.LDAPListener;
+import org.forgerock.opendj.ldap.LDAPListenerOptions;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.Matcher;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RequestContext;
+import org.forgerock.opendj.ldap.RequestHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SSLContextBuilder;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.ServerConnection;
+import org.forgerock.opendj.ldap.ServerConnectionFactory;
+import org.forgerock.opendj.ldap.TrustManagers;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldif.LDIFEntryReader;
 
 /**
  * An LDAP directory server which exposes data contained in an LDIF file. This
@@ -64,527 +94,392 @@
  *  &lt;listenAddress> &lt;listenPort> [&lt;ldifFile>]
  * </pre>
  */
-public final class Server
-{
-  private static final class MemoryBackend implements
-      RequestHandler<RequestContext>
-  {
-    private final ConcurrentSkipListMap<DN, Entry> entries;
-    private final ReentrantReadWriteLock entryLock = new ReentrantReadWriteLock();
+public final class Server {
+    private static final class MemoryBackend implements RequestHandler<RequestContext> {
+        private final ConcurrentSkipListMap<DN, Entry> entries;
+        private final ReentrantReadWriteLock entryLock = new ReentrantReadWriteLock();
 
-
-
-    private MemoryBackend(final ConcurrentSkipListMap<DN, Entry> entries)
-    {
-      this.entries = entries;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAdd(final RequestContext requestContext,
-        final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      // TODO: controls.
-      entryLock.writeLock().lock();
-      try
-      {
-        DN dn = request.getName();
-        if (entries.containsKey(dn))
-        {
-          resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
-              ResultCode.ENTRY_ALREADY_EXISTS, "The entry " + dn.toString()
-                  + " already exists"));
+        private MemoryBackend(final ConcurrentSkipListMap<DN, Entry> entries) {
+            this.entries = entries;
         }
 
-        DN parent = dn.parent();
-        if (!entries.containsKey(parent))
-        {
-          resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
-              ResultCode.NO_SUCH_OBJECT,
-              "The parent entry " + parent.toString() + " does not exist"));
-        }
-        else
-        {
-          entries.put(dn, request);
-          resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-        }
-      }
-      finally
-      {
-        entryLock.writeLock().unlock();
-      }
-    }
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleAdd(final RequestContext requestContext, final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            // TODO: controls.
+            entryLock.writeLock().lock();
+            try {
+                DN dn = request.getName();
+                if (entries.containsKey(dn)) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                            ResultCode.ENTRY_ALREADY_EXISTS, "The entry " + dn.toString()
+                                    + " already exists"));
+                }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleBind(final RequestContext requestContext,
-        final int version, final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-    {
-      if (request.getAuthenticationType() != ((byte) 0x80))
-      {
-        // TODO: SASL authentication not implemented.
-        resultHandler.handleErrorResult(newErrorResult(
-            ResultCode.PROTOCOL_ERROR,
-            "non-SIMPLE authentication not supported: "
-                + request.getAuthenticationType()));
-      }
-      else
-      {
-        // TODO: always succeed.
-        resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleCompare(final RequestContext requestContext,
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-    {
-      // TODO:
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleDelete(final RequestContext requestContext,
-        final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      // TODO: controls.
-      entryLock.writeLock().lock();
-      try
-      {
-        // TODO: check for children.
-        DN dn = request.getName();
-        if (!entries.containsKey(dn))
-        {
-          resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
-              ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
-                  + " does not exist"));
-        }
-        else
-        {
-          entries.remove(dn);
-          resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-        }
-      }
-      finally
-      {
-        entryLock.writeLock().unlock();
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <R extends ExtendedResult> void handleExtendedRequest(
-        final RequestContext requestContext, final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-    {
-      // TODO: not implemented.
-      resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
-          "Extended request operation not supported"));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModify(final RequestContext requestContext,
-        final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      // TODO: controls.
-      // TODO: read lock is not really enough since concurrent updates may
-      // still occur to the same entry.
-      entryLock.readLock().lock();
-      try
-      {
-        DN dn = request.getName();
-        Entry entry = entries.get(dn);
-        if (entry == null)
-        {
-          resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
-              ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
-                  + " does not exist"));
-        }
-
-        Entry newEntry = new LinkedHashMapEntry(entry);
-        for (Modification mod : request.getModifications())
-        {
-          ModificationType modType = mod.getModificationType();
-          if (modType.equals(ModificationType.ADD))
-          {
-            // TODO: Reject empty attribute and duplicate values.
-            newEntry.addAttribute(mod.getAttribute(), null);
-          }
-          else if (modType.equals(ModificationType.DELETE))
-          {
-            // TODO: Reject missing values.
-            newEntry.removeAttribute(mod.getAttribute(), null);
-          }
-          else if (modType.equals(ModificationType.REPLACE))
-          {
-            newEntry.replaceAttribute(mod.getAttribute());
-          }
-          else
-          {
-            resultHandler.handleErrorResult(newErrorResult(
-                ResultCode.PROTOCOL_ERROR,
-                "Modify request contains an unsupported modification type"));
-            return;
-          }
-        }
-
-        entries.put(dn, newEntry);
-        resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-      }
-      finally
-      {
-        entryLock.readLock().unlock();
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModifyDN(final RequestContext requestContext,
-        final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      // TODO: not implemented.
-      resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
-          "ModifyDN request operation not supported"));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleSearch(final RequestContext requestContext,
-        final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-    {
-      // TODO: controls, limits, etc.
-      entryLock.readLock().lock();
-      try
-      {
-        DN dn = request.getName();
-        Entry baseEntry = entries.get(dn);
-        if (baseEntry == null)
-        {
-          resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
-              ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
-                  + " does not exist"));
-          return;
-        }
-
-        SearchScope scope = request.getScope();
-        Filter filter = request.getFilter();
-        Matcher matcher = filter.matcher();
-
-        if (scope.equals(SearchScope.BASE_OBJECT))
-        {
-          if (matcher.matches(baseEntry).toBoolean())
-          {
-            sendEntry(request, resultHandler, baseEntry);
-          }
-        }
-        else if (scope.equals(SearchScope.SINGLE_LEVEL))
-        {
-          NavigableMap<DN, Entry> subtree = entries.tailMap(dn, false);
-          for (Entry entry : subtree.values())
-          {
-            // Check for cancellation.
-            requestContext.checkIfCancelled(false);
-
-            DN childDN = entry.getName();
-            if (childDN.isChildOf(dn))
-            {
-              if (!matcher.matches(entry).toBoolean())
-              {
-                continue;
-              }
-
-              if (!sendEntry(request, resultHandler, entry))
-              {
-                // Caller has asked to stop sending results.
-                break;
-              }
+                DN parent = dn.parent();
+                if (!entries.containsKey(parent)) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                            ResultCode.NO_SUCH_OBJECT, "The parent entry " + parent.toString()
+                                    + " does not exist"));
+                } else {
+                    entries.put(dn, request);
+                    resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+                }
+            } finally {
+                entryLock.writeLock().unlock();
             }
-            else if (!childDN.isSubordinateOrEqualTo(dn))
-            {
-              // The remaining entries will be out of scope.
-              break;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleBind(final RequestContext requestContext, final int version,
+                final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler) {
+            if (request.getAuthenticationType() != ((byte) 0x80)) {
+                // TODO: SASL authentication not implemented.
+                resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                        "non-SIMPLE authentication not supported: "
+                                + request.getAuthenticationType()));
+            } else {
+                // TODO: always succeed.
+                resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
             }
-          }
         }
-        else if (scope.equals(SearchScope.WHOLE_SUBTREE))
-        {
-          NavigableMap<DN, Entry> subtree = entries.tailMap(dn);
-          for (Entry entry : subtree.values())
-          {
-            // Check for cancellation.
-            requestContext.checkIfCancelled(false);
 
-            DN childDN = entry.getName();
-            if (childDN.isSubordinateOrEqualTo(dn))
-            {
-              if (!matcher.matches(entry).toBoolean())
-              {
-                continue;
-              }
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleCompare(final RequestContext requestContext,
+                final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler) {
+            // TODO:
+        }
 
-              if (!sendEntry(request, resultHandler, entry))
-              {
-                // Caller has asked to stop sending results.
-                break;
-              }
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleDelete(final RequestContext requestContext, final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            // TODO: controls.
+            entryLock.writeLock().lock();
+            try {
+                // TODO: check for children.
+                DN dn = request.getName();
+                if (!entries.containsKey(dn)) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                            ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
+                                    + " does not exist"));
+                } else {
+                    entries.remove(dn);
+                    resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+                }
+            } finally {
+                entryLock.writeLock().unlock();
             }
-            else
-            {
-              // The remaining entries will be out of scope.
-              break;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public <R extends ExtendedResult> void handleExtendedRequest(
+                final RequestContext requestContext, final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) {
+            // TODO: not implemented.
+            resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                    "Extended request operation not supported"));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModify(final RequestContext requestContext, final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            // TODO: controls.
+            // TODO: read lock is not really enough since concurrent updates may
+            // still occur to the same entry.
+            entryLock.readLock().lock();
+            try {
+                DN dn = request.getName();
+                Entry entry = entries.get(dn);
+                if (entry == null) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                            ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
+                                    + " does not exist"));
+                }
+
+                Entry newEntry = new LinkedHashMapEntry(entry);
+                for (Modification mod : request.getModifications()) {
+                    ModificationType modType = mod.getModificationType();
+                    if (modType.equals(ModificationType.ADD)) {
+                        // TODO: Reject empty attribute and duplicate values.
+                        newEntry.addAttribute(mod.getAttribute(), null);
+                    } else if (modType.equals(ModificationType.DELETE)) {
+                        // TODO: Reject missing values.
+                        newEntry.removeAttribute(mod.getAttribute(), null);
+                    } else if (modType.equals(ModificationType.REPLACE)) {
+                        newEntry.replaceAttribute(mod.getAttribute());
+                    } else {
+                        resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                                "Modify request contains an unsupported modification type"));
+                        return;
+                    }
+                }
+
+                entries.put(dn, newEntry);
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            } finally {
+                entryLock.readLock().unlock();
             }
-          }
-        }
-        else
-        {
-          resultHandler.handleErrorResult(newErrorResult(
-              ResultCode.PROTOCOL_ERROR,
-              "Search request contains an unsupported search scope"));
-          return;
         }
 
-        resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-      }
-      catch (CancelledResultException e)
-      {
-        resultHandler.handleErrorResult(e);
-      }
-      finally
-      {
-        entryLock.readLock().unlock();
-      }
-    }
-
-
-
-    private boolean sendEntry(SearchRequest request,
-        SearchResultHandler resultHandler, Entry entry)
-    {
-      // TODO: check filter, strip attributes.
-      return resultHandler.handleEntry(Responses.newSearchResultEntry(entry));
-    }
-  }
-
-
-
-  /**
-   * Main method.
-   *
-   * @param args
-   *          The command line arguments: listen address, listen port, ldifFile
-   */
-  public static void main(final String[] args)
-  {
-    if (args.length != 3 && args.length != 6)
-    {
-      System.err.println("Usage: listenAddress listenPort ldifFile "
-          + "[keyStoreFile keyStorePassword certNickname]");
-      System.exit(1);
-    }
-
-    // Parse command line arguments.
-    final String localAddress = args[0];
-    final int localPort = Integer.parseInt(args[1]);
-    final String ldifFileName = args[2];
-    final String keyStoreFileName = (args.length == 6) ? args[3] : null;
-    final String keyStorePassword = (args.length == 6) ? args[4] : null;
-    final String certNickname = (args.length == 6) ? args[5] : null;
-
-    // Create the memory backend.
-    final ConcurrentSkipListMap<DN, Entry> entries =
-        readEntriesFromLDIF(ldifFileName);
-    final MemoryBackend backend = new MemoryBackend(entries);
-
-    // Create a server connection adapter.
-    final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler =
-        Connections.newServerConnectionFactory(backend);
-
-    // Create listener.
-    LDAPListener listener = null;
-    try
-    {
-      final LDAPListenerOptions options = new LDAPListenerOptions()
-          .setBacklog(4096);
-
-      if (keyStoreFileName != null)
-      {
-        // Configure SSL/TLS and enable it when connections are accepted.
-        final SSLContext sslContext = new SSLContextBuilder()
-            .setKeyManager(
-                KeyManagers.useSingleCertificate(certNickname, KeyManagers
-                    .useKeyStoreFile(keyStoreFileName,
-                        keyStorePassword.toCharArray(), null)))
-            .setTrustManager(TrustManagers.trustAll()).getSSLContext();
-
-        ServerConnectionFactory<LDAPClientContext, Integer> sslWrapper =
-            new ServerConnectionFactory<LDAPClientContext, Integer>()
-        {
-
-          public ServerConnection<Integer> handleAccept(
-              LDAPClientContext clientContext) throws ErrorResultException
-          {
-            clientContext.enableTLS(sslContext, null, null, false, false);
-            return connectionHandler.handleAccept(clientContext);
-          }
-        };
-
-        listener = new LDAPListener(localAddress, localPort, sslWrapper,
-            options);
-      }
-      else
-      {
-        // No SSL.
-        listener = new LDAPListener(localAddress, localPort, connectionHandler,
-            options);
-      }
-      System.out.println("Press any key to stop the server...");
-      System.in.read();
-    }
-    catch (final Exception e)
-    {
-      System.out
-          .println("Error listening on " + localAddress + ":" + localPort);
-      e.printStackTrace();
-    }
-    finally
-    {
-      if (listener != null)
-      {
-        listener.close();
-      }
-    }
-  }
-
-
-
-  /**
-   * Reads the entries from the named LDIF file.
-   *
-   * @param ldifFileName
-   *          The name of the LDIF file.
-   * @return The entries.
-   */
-  private static ConcurrentSkipListMap<DN, Entry> readEntriesFromLDIF(
-      final String ldifFileName)
-  {
-    final ConcurrentSkipListMap<DN, Entry> entries;
-    // Read the LDIF.
-    InputStream ldif;
-    try
-    {
-      ldif = new FileInputStream(ldifFileName);
-    }
-    catch (final FileNotFoundException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
-      return null; // Satisfy compiler.
-    }
-
-    entries = new ConcurrentSkipListMap<DN, Entry>();
-    final LDIFEntryReader reader = new LDIFEntryReader(ldif);
-    try
-    {
-      while (reader.hasNext())
-      {
-        Entry entry = reader.readEntry();
-        entries.put(entry.getName(), entry);
-      }
-    }
-    catch (final IOException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
-      return null; // Satisfy compiler.
-    }
-    finally
-    {
-      try
-      {
-        reader.close();
-      }
-      catch (final IOException ignored)
-      {
-        // Ignore.
-      }
-    }
-
-    // Quickly sanity check that every entry (except root entries) have a
-    // parent.
-    boolean isValid = true;
-    for (DN dn : entries.keySet())
-    {
-      if (dn.size() > 1)
-      {
-        DN parent = dn.parent();
-        if (!entries.containsKey(parent))
-        {
-          System.err.println("The entry \"" + dn.toString()
-              + "\" does not have a parent");
-          isValid = false;
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModifyDN(final RequestContext requestContext,
+                final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            // TODO: not implemented.
+            resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                    "ModifyDN request operation not supported"));
         }
-      }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleSearch(final RequestContext requestContext, final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) {
+            // TODO: controls, limits, etc.
+            entryLock.readLock().lock();
+            try {
+                DN dn = request.getName();
+                Entry baseEntry = entries.get(dn);
+                if (baseEntry == null) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                            ResultCode.NO_SUCH_OBJECT, "The entry " + dn.toString()
+                                    + " does not exist"));
+                    return;
+                }
+
+                SearchScope scope = request.getScope();
+                Filter filter = request.getFilter();
+                Matcher matcher = filter.matcher();
+
+                if (scope.equals(SearchScope.BASE_OBJECT)) {
+                    if (matcher.matches(baseEntry).toBoolean()) {
+                        sendEntry(request, resultHandler, baseEntry);
+                    }
+                } else if (scope.equals(SearchScope.SINGLE_LEVEL)) {
+                    NavigableMap<DN, Entry> subtree = entries.tailMap(dn, false);
+                    for (Entry entry : subtree.values()) {
+                        // Check for cancellation.
+                        requestContext.checkIfCancelled(false);
+
+                        DN childDN = entry.getName();
+                        if (childDN.isChildOf(dn)) {
+                            if (!matcher.matches(entry).toBoolean()) {
+                                continue;
+                            }
+
+                            if (!sendEntry(request, resultHandler, entry)) {
+                                // Caller has asked to stop sending results.
+                                break;
+                            }
+                        } else if (!childDN.isSubordinateOrEqualTo(dn)) {
+                            // The remaining entries will be out of scope.
+                            break;
+                        }
+                    }
+                } else if (scope.equals(SearchScope.WHOLE_SUBTREE)) {
+                    NavigableMap<DN, Entry> subtree = entries.tailMap(dn);
+                    for (Entry entry : subtree.values()) {
+                        // Check for cancellation.
+                        requestContext.checkIfCancelled(false);
+
+                        DN childDN = entry.getName();
+                        if (childDN.isSubordinateOrEqualTo(dn)) {
+                            if (!matcher.matches(entry).toBoolean()) {
+                                continue;
+                            }
+
+                            if (!sendEntry(request, resultHandler, entry)) {
+                                // Caller has asked to stop sending results.
+                                break;
+                            }
+                        } else {
+                            // The remaining entries will be out of scope.
+                            break;
+                        }
+                    }
+                } else {
+                    resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
+                            "Search request contains an unsupported search scope"));
+                    return;
+                }
+
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            } catch (CancelledResultException e) {
+                resultHandler.handleErrorResult(e);
+            } finally {
+                entryLock.readLock().unlock();
+            }
+        }
+
+        private boolean sendEntry(SearchRequest request, SearchResultHandler resultHandler,
+                Entry entry) {
+            // TODO: check filter, strip attributes.
+            return resultHandler.handleEntry(Responses.newSearchResultEntry(entry));
+        }
     }
-    if (!isValid)
-    {
-      System.exit(1);
+
+    /**
+     * Main method.
+     *
+     * @param args
+     *            The command line arguments: listen address, listen port,
+     *            ldifFile
+     */
+    public static void main(final String[] args) {
+        if (args.length != 3 && args.length != 6) {
+            System.err.println("Usage: listenAddress listenPort ldifFile "
+                    + "[keyStoreFile keyStorePassword certNickname]");
+            System.exit(1);
+        }
+
+        // Parse command line arguments.
+        final String localAddress = args[0];
+        final int localPort = Integer.parseInt(args[1]);
+        final String ldifFileName = args[2];
+        final String keyStoreFileName = (args.length == 6) ? args[3] : null;
+        final String keyStorePassword = (args.length == 6) ? args[4] : null;
+        final String certNickname = (args.length == 6) ? args[5] : null;
+
+        // Create the memory backend.
+        final ConcurrentSkipListMap<DN, Entry> entries = readEntriesFromLDIF(ldifFileName);
+        final MemoryBackend backend = new MemoryBackend(entries);
+
+        // Create a server connection adapter.
+        final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler =
+                Connections.newServerConnectionFactory(backend);
+
+        // Create listener.
+        LDAPListener listener = null;
+        try {
+            final LDAPListenerOptions options = new LDAPListenerOptions().setBacklog(4096);
+
+            if (keyStoreFileName != null) {
+                // Configure SSL/TLS and enable it when connections are
+                // accepted.
+                final SSLContext sslContext =
+                        new SSLContextBuilder().setKeyManager(
+                                KeyManagers.useSingleCertificate(certNickname, KeyManagers
+                                        .useKeyStoreFile(keyStoreFileName, keyStorePassword
+                                                .toCharArray(), null))).setTrustManager(
+                                TrustManagers.trustAll()).getSSLContext();
+
+                ServerConnectionFactory<LDAPClientContext, Integer> sslWrapper =
+                        new ServerConnectionFactory<LDAPClientContext, Integer>() {
+
+                            public ServerConnection<Integer> handleAccept(
+                                    LDAPClientContext clientContext) throws ErrorResultException {
+                                clientContext.enableTLS(sslContext, null, null, false, false);
+                                return connectionHandler.handleAccept(clientContext);
+                            }
+                        };
+
+                listener = new LDAPListener(localAddress, localPort, sslWrapper, options);
+            } else {
+                // No SSL.
+                listener = new LDAPListener(localAddress, localPort, connectionHandler, options);
+            }
+            System.out.println("Press any key to stop the server...");
+            System.in.read();
+        } catch (final Exception e) {
+            System.out.println("Error listening on " + localAddress + ":" + localPort);
+            e.printStackTrace();
+        } finally {
+            if (listener != null) {
+                listener.close();
+            }
+        }
     }
-    return entries;
-  }
 
+    /**
+     * Reads the entries from the named LDIF file.
+     *
+     * @param ldifFileName
+     *            The name of the LDIF file.
+     * @return The entries.
+     */
+    private static ConcurrentSkipListMap<DN, Entry> readEntriesFromLDIF(final String ldifFileName) {
+        final ConcurrentSkipListMap<DN, Entry> entries;
+        // Read the LDIF.
+        InputStream ldif;
+        try {
+            ldif = new FileInputStream(ldifFileName);
+        } catch (final FileNotFoundException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+            return null; // Satisfy compiler.
+        }
 
+        entries = new ConcurrentSkipListMap<DN, Entry>();
+        final LDIFEntryReader reader = new LDIFEntryReader(ldif);
+        try {
+            while (reader.hasNext()) {
+                Entry entry = reader.readEntry();
+                entries.put(entry.getName(), entry);
+            }
+        } catch (final IOException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+            return null; // Satisfy compiler.
+        } finally {
+            try {
+                reader.close();
+            } catch (final IOException ignored) {
+                // Ignore.
+            }
+        }
 
-  private Server()
-  {
-    // Not used.
-  }
+        // Quickly sanity check that every entry (except root entries) have a
+        // parent.
+        boolean isValid = true;
+        for (DN dn : entries.keySet()) {
+            if (dn.size() > 1) {
+                DN parent = dn.parent();
+                if (!entries.containsKey(parent)) {
+                    System.err
+                            .println("The entry \"" + dn.toString() + "\" does not have a parent");
+                    isValid = false;
+                }
+            }
+        }
+        if (!isValid) {
+            System.exit(1);
+        }
+        return entries;
+    }
+
+    private Server() {
+        // Not used.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
index 7591949..39c77d3 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.examples;
 
-
-
 import java.security.GeneralSecurityException;
 
 import javax.net.ssl.SSLContext;
@@ -41,8 +38,6 @@
 import org.forgerock.opendj.ldap.SSLContextBuilder;
 import org.forgerock.opendj.ldap.TrustManagers;
 
-
-
 /**
  * An example client application which performs simple authentication to a
  * directory server. This example takes the following command line parameters:
@@ -54,211 +49,168 @@
  * <li>use-starttls - (Optional) connect with StartTLS</li>
  * <li>use-ssl - (Optional) connect over SSL</li>
  * </ul>
- * The host, port, bind-dn, and bind-password are required. The use-starttls
- * and use-ssl parameters are optional and mutually exclusive.
+ * The host, port, bind-dn, and bind-password are required. The use-starttls and
+ * use-ssl parameters are optional and mutually exclusive.
  */
-public final class SimpleAuth
-{
+public final class SimpleAuth {
 
-  /**
-   * Authenticate to the directory either over LDAP, over LDAPS, or using
-   * StartTLS.
-   *
-   * @param args The command line arguments
-   */
-  public static void main(final String[] args)
-  {
-    parseArgs(args);
-    // Connect and bind to the server, then close the connection.
-    if (useStartTLS) connectStartTLS();
-    else if (useSSL) connectSSL();
-    else connect();
-  }
-
-
-
-  /**
-   * Authenticate over LDAP.
-   */
-  private static void connect()
-  {
-    final LDAPConnectionFactory factory = new LDAPConnectionFactory(
-      host, port);
-    Connection connection = null;
-
-    try
-    {
-      connection = factory.getConnection();
-      connection.bind(bindDN, bindPassword.toCharArray());
-      System.out.println("Authenticated as " + bindDN + ".");
+    /**
+     * Authenticate to the directory either over LDAP, over LDAPS, or using
+     * StartTLS.
+     *
+     * @param args
+     *            The command line arguments
+     */
+    public static void main(final String[] args) {
+        parseArgs(args);
+        // Connect and bind to the server, then close the connection.
+        if (useStartTLS) {
+            connectStartTLS();
+        } else if (useSSL) {
+            connectSSL();
+        } else {
+            connect();
+        }
     }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
+
+    /**
+     * Authenticate over LDAP.
+     */
+    private static void connect() {
+        final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port);
+        Connection connection = null;
+
+        try {
+            connection = factory.getConnection();
+            connection.bind(bindDN, bindPassword.toCharArray());
+            System.out.println("Authenticated as " + bindDN + ".");
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
     }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
+
+    /**
+     * For StartTLS and SSL the connection factory needs SSL context options. In
+     * the general case, a trust manager in the SSL context serves to check
+     * server certificates, and a key manager handles client keys when the
+     * server checks certificates from our client.
+     *
+     * OpenDJ directory server lets you install by default with a self-signed
+     * certificate that is not in the system trust store. To simplify this
+     * implementation trusts all server certificates.
+     */
+    private static LDAPOptions getTrustAllOptions() throws GeneralSecurityException {
+        LDAPOptions lo = new LDAPOptions();
+        SSLContext sslContext =
+                new SSLContextBuilder().setTrustManager(TrustManagers.trustAll()).getSSLContext();
+        lo.setSSLContext(sslContext);
+        lo.setUseStartTLS(useStartTLS);
+        return lo;
     }
-    finally
-    {
-      if (connection != null) connection.close();
+
+    /**
+     * Perform authentication over a secure connection, trusting all server
+     * certificates.
+     */
+    private static void trustAllConnect() {
+        Connection connection = null;
+
+        try {
+            final LDAPConnectionFactory factory =
+                    new LDAPConnectionFactory(host, port, getTrustAllOptions());
+            connection = factory.getConnection();
+            connection.bind(bindDN, bindPassword.toCharArray());
+            System.out.println("Authenticated as " + bindDN + ".");
+        } catch (final ErrorResultException e) {
+            System.err.println(e.getMessage());
+            System.exit(e.getResult().getResultCode().intValue());
+            return;
+        } catch (final InterruptedException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
+            return;
+        } catch (final GeneralSecurityException e) {
+            System.err.println(e.getMessage());
+            System.exit(ResultCode.CLIENT_SIDE_CONNECT_ERROR.intValue());
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
     }
-  }
 
-
-
-  /**
-   * For StartTLS and SSL the connection factory needs SSL context options.
-   * In the general case, a trust manager in the SSL context serves to check
-   * server certificates, and a key manager handles client keys when the server
-   * checks certificates from our client.
-   *
-   * OpenDJ directory server lets you install by default with a self-signed
-   * certificate that is not in the system trust store. To simplify this
-   * implementation trusts all server certificates.
-   */
-  private static LDAPOptions getTrustAllOptions()
-    throws GeneralSecurityException
-  {
-    LDAPOptions lo = new LDAPOptions();
-    SSLContext sslContext = new SSLContextBuilder()
-      .setTrustManager(TrustManagers.trustAll()).getSSLContext();
-    lo.setSSLContext(sslContext);
-    lo.setUseStartTLS(useStartTLS);
-    return lo;
-  }
-
-
-
-  /**
-   * Perform authentication over a secure connection, trusting all server
-   * certificates.
-   */
-  private static void trustAllConnect()
-  {
-    Connection connection = null;
-
-    try
-    {
-      final LDAPConnectionFactory factory =
-          new LDAPConnectionFactory(host, port, getTrustAllOptions());
-      connection = factory.getConnection();
-      connection.bind(bindDN, bindPassword.toCharArray());
-      System.out.println("Authenticated as " + bindDN + ".");
+    /**
+     * Authenticate using StartTLS.
+     */
+    private static void connectStartTLS() {
+        trustAllConnect();
     }
-    catch (final ErrorResultException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(e.getResult().getResultCode().intValue());
-      return;
+
+    /**
+     * Authenticate over LDAPS.
+     */
+    private static void connectSSL() {
+        trustAllConnect();
     }
-    catch (final InterruptedException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue());
-      return;
+
+    private static String host;
+    private static int port;
+    private static String bindDN;
+    private static String bindPassword;
+    private static boolean useStartTLS = false;
+    private static boolean useSSL = false;
+
+    /**
+     * Parse command line arguments.
+     *
+     * @param args
+     *            host port bind-dn bind-password [ use-starttls | use-ssl ]
+     */
+    private static void parseArgs(String[] args) {
+        if (args.length < 4 || args.length > 5) {
+            giveUp();
+        }
+
+        host = args[0];
+        port = Integer.parseInt(args[1]);
+        bindDN = args[2];
+        bindPassword = args[3];
+
+        if (args.length == 5) {
+            if (args[4].toLowerCase().equals("use-starttls")) {
+                useStartTLS = true;
+                useSSL = false;
+            } else if (args[4].toLowerCase().equals("use-ssl")) {
+                useStartTLS = false;
+                useSSL = true;
+            } else {
+                giveUp();
+            }
+        }
     }
-    catch (final GeneralSecurityException e)
-    {
-      System.err.println(e.getMessage());
-      System.exit(ResultCode.CLIENT_SIDE_CONNECT_ERROR.intValue());
+
+    private static void giveUp() {
+        printUsage();
+        System.exit(1);
     }
-    finally
-    {
-      if (connection != null)
-        connection.close();
+
+    private static void printUsage() {
+        System.err.println("Usage: host port bind-dn bind-password [ use-starttls | use-ssl ]");
+        System.err.println("\thost, port, bind-dn, and bind-password arguments are required.");
+        System.err.println("\tuse-starttls and use-ssl are optional and mutually exclusive.");
     }
-  }
 
-
-
-  /**
-   * Authenticate using StartTLS.
-   */
-  private static void connectStartTLS()
-  {
-    trustAllConnect();
-  }
-
-
-
-  /**
-   * Authenticate over LDAPS.
-   */
-  private static void connectSSL()
-  {
-    trustAllConnect();
-  }
-
-
-
-  private static String host;
-  private static int port;
-  private static String bindDN;
-  private static String bindPassword;
-  private static boolean useStartTLS = false;
-  private static boolean useSSL = false;
-
-
-
-  /**
-   * Parse command line arguments.
-   * @param args host port bind-dn bind-password [ use-starttls | use-ssl ]
-   */
-  private static void parseArgs(String[] args)
-  {
-    if (args.length < 4 || args.length > 5) giveUp();
-
-    host = args[0];
-    port = Integer.parseInt(args[1]);
-    bindDN = args[2];
-    bindPassword = args[3];
-
-    if (args.length == 5)
-    {
-      if (args[4].toLowerCase().equals("use-starttls"))
-      {
-        useStartTLS = true;
-        useSSL = false;
-      }
-      else if (args[4].toLowerCase().equals("use-ssl"))
-      {
-        useStartTLS = false;
-        useSSL = true;
-      }
-      else giveUp();
+    private SimpleAuth() {
+        // Not used.
     }
-  }
-
-
-
-  private static void giveUp()
-  {
-    printUsage();
-    System.exit(1);
-  }
-
-
-
-  private static void printUsage()
-  {
-    System.err.println(
-      "Usage: host port bind-dn bind-password [ use-starttls | use-ssl ]");
-    System.err.println(
-      "\thost, port, bind-dn, and bind-password arguments are required.");
-    System.err.println(
-      "\tuse-starttls and use-ssl are optional and mutually exclusive.");
-  }
-
-
-
-  private SimpleAuth()
-  {
-    // Not used.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
index 4e60328..674532a 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,3 +29,4 @@
  * OpenDJ LDAP SDK.
  */
 package org.forgerock.opendj.examples;
+
diff --git a/opendj3/opendj-ldap-sdk/pom.xml b/opendj3/opendj-ldap-sdk/pom.xml
index 6d11f55..1e50ef6 100644
--- a/opendj3/opendj-ldap-sdk/pom.xml
+++ b/opendj3/opendj-ldap-sdk/pom.xml
@@ -7,17 +7,16 @@
   ! (the "License").  You may not use this file except in compliance
   ! with the License.
   !
-  ! You can obtain a copy of the license at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+  ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
   ! or http://forgerock.org/license/CDDLv1.0.html.
   ! See the License for the specific language governing permissions
   ! and limitations under the License.
   !
   ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
+  ! file and include the License file at legal-notices/CDDLv1_0.txt.
+  ! If applicable, add the following below this CDDL HEADER, with the
+  ! fields enclosed by brackets "[]" replaced with your own identifying
+  ! information:
   !      Portions Copyright [yyyy] [name of copyright owner]
   !
   ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java
index 22a83b6..8a47862 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,9 +27,10 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
-import static com.forgerock.opendj.ldap.LDAPConstants.*;
+import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_TYPE;
+import static com.forgerock.opendj.ldap.LDAPConstants.ELEMENT_READ_STATE_NEED_VALUE_BYTES;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
@@ -49,770 +49,598 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Grizzly ASN1 reader implementation.
  */
-final class ASN1BufferReader extends AbstractASN1Reader implements ASN1Reader
-{
-  private final class ChildSequenceLimiter implements SequenceLimiter
-  {
-    private SequenceLimiter parent;
+final class ASN1BufferReader extends AbstractASN1Reader implements ASN1Reader {
+    private final class ChildSequenceLimiter implements SequenceLimiter {
+        private SequenceLimiter parent;
 
-    private ChildSequenceLimiter child;
+        private ChildSequenceLimiter child;
 
-    private int readLimit;
+        private int readLimit;
 
-    private int bytesRead;
+        private int bytesRead;
 
+        public void checkLimit(final int readSize) throws IOException {
+            if ((readLimit > 0) && (bytesRead + readSize > readLimit)) {
+                final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
 
+            parent.checkLimit(readSize);
 
-    public void checkLimit(final int readSize) throws IOException
-    {
-      if ((readLimit > 0) && (bytesRead + readSize > readLimit))
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-
-      parent.checkLimit(readSize);
-
-      bytesRead += readSize;
-    }
-
-
-
-    public SequenceLimiter endSequence() throws IOException
-    {
-      parent.checkLimit(remaining());
-
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE) && remaining() > 0)
-      {
-        StaticUtils.DEBUG_LOG
-            .fine(String.format(
-                "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE",
-                remaining()));
-      }
-
-      for (int i = 0; i < remaining(); i++)
-      {
-        buffer.get();
-      }
-
-      return parent;
-    }
-
-
-
-    public int remaining()
-    {
-      return readLimit - bytesRead;
-    }
-
-
-
-    public ChildSequenceLimiter startSequence(final int readLimit)
-    {
-      if (child == null)
-      {
-        child = new ChildSequenceLimiter();
-        child.parent = this;
-      }
-
-      child.readLimit = readLimit;
-      child.bytesRead = 0;
-
-      return child;
-    }
-  }
-
-
-
-  private final class RootSequenceLimiter implements SequenceLimiter
-  {
-    private ChildSequenceLimiter child;
-
-
-
-    public void checkLimit(final int readSize) throws IOException
-    {
-      if (buffer.remaining() < readSize)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-    }
-
-
-
-    public ChildSequenceLimiter endSequence() throws DecodeException
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED
-          .get();
-      throw new IllegalStateException(message.toString());
-    }
-
-
-
-    public int remaining()
-    {
-      return buffer.remaining();
-    }
-
-
-
-    public ChildSequenceLimiter startSequence(final int readLimit)
-    {
-      if (child == null)
-      {
-        child = new ChildSequenceLimiter();
-        child.parent = this;
-      }
-
-      child.readLimit = readLimit;
-      child.bytesRead = 0;
-
-      return child;
-    }
-  }
-
-
-
-  private interface SequenceLimiter
-  {
-    public void checkLimit(int readSize) throws IOException;
-
-
-
-    public SequenceLimiter endSequence() throws IOException;
-
-
-
-    public int remaining();
-
-
-
-    public SequenceLimiter startSequence(int readLimit);
-  }
-
-
-
-  private static final int MAX_STRING_BUFFER_SIZE = 1024;
-
-  private int state = ELEMENT_READ_STATE_NEED_TYPE;
-
-  private byte peekType = 0;
-
-  private int peekLength = -1;
-
-  private int lengthBytesNeeded = 0;
-
-  private final int maxElementSize;
-
-  private final CompositeBuffer buffer;
-
-  private SequenceLimiter readLimiter;
-
-  private final byte[] stringBuffer;
-
-
-
-  /**
-   * Creates a new ASN1 reader whose source is the provided input stream and
-   * having a user defined maximum BER element size.
-   *
-   * @param maxElementSize
-   *          The maximum BER element size, or <code>0</code> to indicate that
-   *          there is no limit.
-   * @param memoryManager
-   *          The memory manager to use for buffering.
-   */
-  ASN1BufferReader(final int maxElementSize,
-      final MemoryManager<?> memoryManager)
-  {
-    this.readLimiter = new RootSequenceLimiter();
-    this.stringBuffer = new byte[MAX_STRING_BUFFER_SIZE];
-    this.maxElementSize = maxElementSize;
-    this.buffer = BuffersBuffer.create(memoryManager);
-  }
-
-
-
-  /**
-   * Closes this ASN.1 reader and the underlying stream.
-   *
-   * @throws IOException
-   *           if an I/O error occurs
-   */
-  public void close() throws IOException
-  {
-    buffer.dispose();
-  }
-
-
-
-  /**
-   * Determines if a complete ASN.1 element is ready to be read from the stream
-   * reader.
-   *
-   * @return <code>true</code> if another complete element is available or
-   *         <code>false</code> otherwise.
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  public boolean elementAvailable() throws IOException
-  {
-    return !((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(true))
-        && !((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
-            && !needFirstLengthByteState(true))
-        && !((state == ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
-            && !needAdditionalLengthBytesState(true))
-        && peekLength <= readLimiter.remaining();
-
-  }
-
-
-
-  /**
-   * Determines if the input stream contains at least one ASN.1 element to be
-   * read.
-   *
-   * @return <code>true</code> if another element is available or
-   *         <code>false</code> otherwise.
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  public boolean hasNextElement() throws IOException
-  {
-    return (state != ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(true);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int peekLength() throws IOException
-  {
-    peekType();
-
-    switch (state)
-    {
-    case ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE:
-      needFirstLengthByteState(false);
-      break;
-
-    case ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES:
-      needAdditionalLengthBytesState(false);
-    }
-
-    return peekLength;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte peekType() throws IOException
-  {
-    if (state == ELEMENT_READ_STATE_NEED_TYPE)
-    {
-      needTypeState(false);
-    }
-
-    return peekType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean readBoolean() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength != 1)
-    {
-      final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    readLimiter.checkLimit(peekLength);
-    final byte readByte = buffer.get();
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType,
-          peekLength, String.valueOf(readByte != 0x00)));
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return readByte != 0x00;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSequence() throws IOException
-  {
-    readLimiter = readLimiter.endSequence();
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
-    }
-
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readEndSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int readEnumerated() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 4))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    // From an implementation point of view, an enumerated value is
-    // equivalent to an integer.
-    return (int) readInteger();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public long readInteger() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 8))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    readLimiter.checkLimit(peekLength);
-    if (peekLength > 4)
-    {
-      long longValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
-        final int readByte = buffer.get();
-        if ((i == 0) && (((byte) readByte) < 0))
-        {
-          longValue = 0xFFFFFFFFFFFFFFFFL;
+            bytesRead += readSize;
         }
-        longValue = (longValue << 8) | (readByte & 0xFF);
-      }
 
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return longValue;
-    }
-    else
-    {
-      int intValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
-        final int readByte = buffer.get();
-        if ((i == 0) && (((byte) readByte) < 0))
-        {
-          intValue = 0xFFFFFFFF;
+        public SequenceLimiter endSequence() throws IOException {
+            parent.checkLimit(remaining());
+
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE) && remaining() > 0) {
+                StaticUtils.DEBUG_LOG.fine(String.format(
+                        "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE", remaining()));
+            }
+
+            for (int i = 0; i < remaining(); i++) {
+                buffer.get();
+            }
+
+            return parent;
         }
-        intValue = (intValue << 8) | (readByte & 0xFF);
-      }
 
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType,
-            peekLength, intValue));
-      }
+        public int remaining() {
+            return readLimit - bytesRead;
+        }
 
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return intValue;
-    }
-  }
+        public ChildSequenceLimiter startSequence(final int readLimit) {
+            if (child == null) {
+                child = new ChildSequenceLimiter();
+                child.parent = this;
+            }
 
+            child.readLimit = readLimit;
+            child.bytesRead = 0;
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readNull() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    // Make sure that the decoded length is exactly zero byte.
-    if (peekLength != 0)
-    {
-      final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
+            return child;
+        }
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 NULL(type=0x%x, length=%d)", peekType, peekLength));
+    private final class RootSequenceLimiter implements SequenceLimiter {
+        private ChildSequenceLimiter child;
+
+        public void checkLimit(final int readSize) throws IOException {
+            if (buffer.remaining() < readSize) {
+                final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+        }
+
+        public ChildSequenceLimiter endSequence() throws DecodeException {
+            final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get();
+            throw new IllegalStateException(message.toString());
+        }
+
+        public int remaining() {
+            return buffer.remaining();
+        }
+
+        public ChildSequenceLimiter startSequence(final int readLimit) {
+            if (child == null) {
+                child = new ChildSequenceLimiter();
+                child.parent = this;
+            }
+
+            child.readLimit = readLimit;
+            child.bytesRead = 0;
+
+            return child;
+        }
     }
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
+    private interface SequenceLimiter {
+        public void checkLimit(int readSize) throws IOException;
 
+        public SequenceLimiter endSequence() throws IOException;
 
+        public int remaining();
 
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString readOctetString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return ByteString.empty();
+        public SequenceLimiter startSequence(int readLimit);
     }
 
-    readLimiter.checkLimit(peekLength);
-    // Copy the value and construct the element to return.
-    final byte[] value = new byte[peekLength];
-    buffer.get(value);
+    private static final int MAX_STRING_BUFFER_SIZE = 1024;
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG
-          .finest(String.format("READ ASN.1 OCTETSTRING(type=0x%x, length=%d)",
-              peekType, peekLength));
+    private int state = ELEMENT_READ_STATE_NEED_TYPE;
+
+    private byte peekType = 0;
+
+    private int peekLength = -1;
+
+    private int lengthBytesNeeded = 0;
+
+    private final int maxElementSize;
+
+    private final CompositeBuffer buffer;
+
+    private SequenceLimiter readLimiter;
+
+    private final byte[] stringBuffer;
+
+    /**
+     * Creates a new ASN1 reader whose source is the provided input stream and
+     * having a user defined maximum BER element size.
+     *
+     * @param maxElementSize
+     *            The maximum BER element size, or <code>0</code> to indicate
+     *            that there is no limit.
+     * @param memoryManager
+     *            The memory manager to use for buffering.
+     */
+    ASN1BufferReader(final int maxElementSize, final MemoryManager<?> memoryManager) {
+        this.readLimiter = new RootSequenceLimiter();
+        this.stringBuffer = new byte[MAX_STRING_BUFFER_SIZE];
+        this.maxElementSize = maxElementSize;
+        this.buffer = BuffersBuffer.create(memoryManager);
     }
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return ByteString.wrap(value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder readOctetString(final ByteStringBuilder builder)
-      throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return builder;
+    /**
+     * Closes this ASN.1 reader and the underlying stream.
+     *
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    public void close() throws IOException {
+        buffer.dispose();
     }
 
-    readLimiter.checkLimit(peekLength);
-    // Copy the value and construct the element to return.
-    // TODO: Is there a more efficient way to do this?
-    for (int i = 0; i < peekLength; i++)
-    {
-      builder.append(buffer.get());
+    /**
+     * Determines if a complete ASN.1 element is ready to be read from the
+     * stream reader.
+     *
+     * @return <code>true</code> if another complete element is available or
+     *         <code>false</code> otherwise.
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    public boolean elementAvailable() throws IOException {
+        return !((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(true))
+                && !((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
+                        && !needFirstLengthByteState(true))
+                && !((state == ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
+                        && !needAdditionalLengthBytesState(true))
+                && peekLength <= readLimiter.remaining();
+
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG
-          .finest(String.format("READ ASN.1 OCTETSTRING(type=0x%x, length=%d)",
-              peekType, peekLength));
+    /**
+     * Determines if the input stream contains at least one ASN.1 element to be
+     * read.
+     *
+     * @return <code>true</code> if another element is available or
+     *         <code>false</code> otherwise.
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    public boolean hasNextElement() throws IOException {
+        return (state != ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(true);
     }
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return builder;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int peekLength() throws IOException {
+        peekType();
 
+        switch (state) {
+        case ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE:
+            needFirstLengthByteState(false);
+            break;
 
+        case ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES:
+            needAdditionalLengthBytesState(false);
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String readOctetStringAsString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return "";
+        return peekLength;
     }
 
-    byte[] readBuffer;
-    if (peekLength <= stringBuffer.length)
-    {
-      readBuffer = stringBuffer;
-    }
-    else
-    {
-      readBuffer = new byte[peekLength];
+    /**
+     * {@inheritDoc}
+     */
+    public byte peekType() throws IOException {
+        if (state == ELEMENT_READ_STATE_NEED_TYPE) {
+            needTypeState(false);
+        }
+
+        return peekType;
     }
 
-    readLimiter.checkLimit(peekLength);
-    buffer.get(readBuffer, 0, peekLength);
+    /**
+     * {@inheritDoc}
+     */
+    public boolean readBoolean() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
+        if (peekLength != 1) {
+            final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
 
-    String str;
-    try
-    {
-      str = new String(readBuffer, 0, peekLength, "UTF-8");
-    }
-    catch (final Exception e)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        StaticUtils.DEBUG_LOG
-            .warning("Unable to decode ASN.1 OCTETSTRING bytes as UTF-8 string: "
-                + e.toString());
-      }
+        readLimiter.checkLimit(peekLength);
+        final byte readByte = buffer.get();
 
-      str = new String(stringBuffer, 0, peekLength);
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType, peekLength,
+                    String.valueOf(readByte != 0x00)));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return readByte != 0x00;
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType,
-          peekLength, str));
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSequence() throws IOException {
+        readLimiter = readLimiter.endSequence();
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
+        }
+
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
     }
 
-    return str;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSequence() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    readLimiter = readLimiter.startSequence(peekLength);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType,
-          peekLength));
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readEndSequence();
     }
 
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int readEnumerated() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
+        if ((peekLength < 1) || (peekLength > 4)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readStartSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Reader skipElement() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    readLimiter.checkLimit(peekLength);
-    for (int i = 0; i < peekLength; i++)
-    {
-      buffer.get();
-    }
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return this;
-  }
-
-
-
-  void appendBytesRead(final Buffer buffer)
-  {
-    this.buffer.append(buffer);
-  }
-
-
-
-  void disposeBytesRead()
-  {
-    this.buffer.shrink();
-  }
-
-
-
-  /**
-   * Internal helper method reading the additional ASN.1 length bytes and
-   * transition to the next state if successful.
-   *
-   * @param ensureRead
-   *          <code>true</code> to check for availability first.
-   * @return <code>true</code> if the length bytes was successfully read.
-   * @throws IOException
-   *           If an error occurs while reading from the stream.
-   */
-  private boolean needAdditionalLengthBytesState(final boolean ensureRead)
-      throws IOException
-  {
-    if (ensureRead && (readLimiter.remaining() < lengthBytesNeeded))
-    {
-      return false;
+        // From an implementation point of view, an enumerated value is
+        // equivalent to an integer.
+        return (int) readInteger();
     }
 
-    byte readByte;
-    readLimiter.checkLimit(lengthBytesNeeded);
-    while (lengthBytesNeeded > 0)
-    {
-      readByte = buffer.get();
-      peekLength = (peekLength << 8) | (readByte & 0xFF);
-      lengthBytesNeeded--;
+    /**
+     * {@inheritDoc}
+     */
+    public long readInteger() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if ((peekLength < 1) || (peekLength > 8)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        readLimiter.checkLimit(peekLength);
+        if (peekLength > 4) {
+            long longValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = buffer.get();
+                if ((i == 0) && (((byte) readByte) < 0)) {
+                    longValue = 0xFFFFFFFFFFFFFFFFL;
+                }
+                longValue = (longValue << 8) | (readByte & 0xFF);
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return longValue;
+        } else {
+            int intValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = buffer.get();
+                if ((i == 0) && (((byte) readByte) < 0)) {
+                    intValue = 0xFFFFFFFF;
+                }
+                intValue = (intValue << 8) | (readByte & 0xFF);
+            }
+
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType, peekLength,
+                        intValue));
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return intValue;
+        }
     }
 
-    // Make sure that the element is not larger than the maximum allowed
-    // message size.
-    if ((maxElementSize > 0) && (peekLength > maxElementSize))
-    {
-      final LocalizableMessage m = ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
-          .get(peekLength, maxElementSize);
-      throw DecodeException.fatalError(m);
-    }
-    state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public void readNull() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
+        // Make sure that the decoded length is exactly zero byte.
+        if (peekLength != 0) {
+            final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
 
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 NULL(type=0x%x, length=%d)",
+                    peekType, peekLength));
+        }
 
-  /**
-   * Internal helper method reading the first length bytes and transition to the
-   * next state if successful.
-   *
-   * @param ensureRead
-   *          <code>true</code> to check for availability first.
-   * @return <code>true</code> if the length bytes was successfully read
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  private boolean needFirstLengthByteState(final boolean ensureRead)
-      throws IOException
-  {
-    if (ensureRead && (readLimiter.remaining() <= 0))
-    {
-      return false;
+        state = ELEMENT_READ_STATE_NEED_TYPE;
     }
 
-    readLimiter.checkLimit(1);
-    byte readByte = buffer.get();
-    peekLength = (readByte & 0x7F);
-    if (peekLength != readByte)
-    {
-      lengthBytesNeeded = peekLength;
-      if (lengthBytesNeeded > 4)
-      {
-        final LocalizableMessage message = ERR_ASN1_INVALID_NUM_LENGTH_BYTES
-            .get(lengthBytesNeeded);
-        throw DecodeException.fatalError(message);
-      }
-      peekLength = 0x00;
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString readOctetString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
-      if (ensureRead && (readLimiter.remaining() < lengthBytesNeeded))
-      {
-        state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
-        return false;
-      }
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return ByteString.empty();
+        }
 
-      readLimiter.checkLimit(lengthBytesNeeded);
-      while (lengthBytesNeeded > 0)
-      {
-        readByte = buffer.get();
-        peekLength = (peekLength << 8) | (readByte & 0xFF);
-        lengthBytesNeeded--;
-      }
+        readLimiter.checkLimit(peekLength);
+        // Copy the value and construct the element to return.
+        final byte[] value = new byte[peekLength];
+        buffer.get(value);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return ByteString.wrap(value);
     }
 
-    // Make sure that the element is not larger than the maximum allowed
-    // message size.
-    if ((maxElementSize > 0) && (peekLength > maxElementSize))
-    {
-      final LocalizableMessage m = ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
-          .get(peekLength, maxElementSize);
-      throw DecodeException.fatalError(m);
-    }
-    state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return builder;
+        }
 
+        readLimiter.checkLimit(peekLength);
+        // Copy the value and construct the element to return.
+        // TODO: Is there a more efficient way to do this?
+        for (int i = 0; i < peekLength; i++) {
+            builder.append(buffer.get());
+        }
 
-  /**
-   * Internal helper method reading the ASN.1 type byte and transition to the
-   * next state if successful.
-   *
-   * @param ensureRead
-   *          <code>true</code> to check for availability first.
-   * @return <code>true</code> if the type byte was successfully read
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  private boolean needTypeState(final boolean ensureRead) throws IOException
-  {
-    // Read just the type.
-    if (ensureRead && (readLimiter.remaining() <= 0))
-    {
-      return false;
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return builder;
     }
 
-    readLimiter.checkLimit(1);
-    peekType = buffer.get();
-    state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String readOctetStringAsString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return "";
+        }
+
+        byte[] readBuffer;
+        if (peekLength <= stringBuffer.length) {
+            readBuffer = stringBuffer;
+        } else {
+            readBuffer = new byte[peekLength];
+        }
+
+        readLimiter.checkLimit(peekLength);
+        buffer.get(readBuffer, 0, peekLength);
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+
+        String str;
+        try {
+            str = new String(readBuffer, 0, peekLength, "UTF-8");
+        } catch (final Exception e) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                StaticUtils.DEBUG_LOG
+                        .warning("Unable to decode ASN.1 OCTETSTRING bytes as UTF-8 string: "
+                                + e.toString());
+            }
+
+            str = new String(stringBuffer, 0, peekLength);
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType, peekLength,
+                    str));
+        }
+
+        return str;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSequence() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        readLimiter = readLimiter.startSequence(peekLength);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readStartSequence();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Reader skipElement() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        readLimiter.checkLimit(peekLength);
+        for (int i = 0; i < peekLength; i++) {
+            buffer.get();
+        }
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return this;
+    }
+
+    void appendBytesRead(final Buffer buffer) {
+        this.buffer.append(buffer);
+    }
+
+    void disposeBytesRead() {
+        this.buffer.shrink();
+    }
+
+    /**
+     * Internal helper method reading the additional ASN.1 length bytes and
+     * transition to the next state if successful.
+     *
+     * @param ensureRead
+     *            <code>true</code> to check for availability first.
+     * @return <code>true</code> if the length bytes was successfully read.
+     * @throws IOException
+     *             If an error occurs while reading from the stream.
+     */
+    private boolean needAdditionalLengthBytesState(final boolean ensureRead) throws IOException {
+        if (ensureRead && (readLimiter.remaining() < lengthBytesNeeded)) {
+            return false;
+        }
+
+        byte readByte;
+        readLimiter.checkLimit(lengthBytesNeeded);
+        while (lengthBytesNeeded > 0) {
+            readByte = buffer.get();
+            peekLength = (peekLength << 8) | (readByte & 0xFF);
+            lengthBytesNeeded--;
+        }
+
+        // Make sure that the element is not larger than the maximum allowed
+        // message size.
+        if ((maxElementSize > 0) && (peekLength > maxElementSize)) {
+            final LocalizableMessage m =
+                    ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
+                            .get(peekLength, maxElementSize);
+            throw DecodeException.fatalError(m);
+        }
+        state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
+        return true;
+    }
+
+    /**
+     * Internal helper method reading the first length bytes and transition to
+     * the next state if successful.
+     *
+     * @param ensureRead
+     *            <code>true</code> to check for availability first.
+     * @return <code>true</code> if the length bytes was successfully read
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    private boolean needFirstLengthByteState(final boolean ensureRead) throws IOException {
+        if (ensureRead && (readLimiter.remaining() <= 0)) {
+            return false;
+        }
+
+        readLimiter.checkLimit(1);
+        byte readByte = buffer.get();
+        peekLength = (readByte & 0x7F);
+        if (peekLength != readByte) {
+            lengthBytesNeeded = peekLength;
+            if (lengthBytesNeeded > 4) {
+                final LocalizableMessage message =
+                        ERR_ASN1_INVALID_NUM_LENGTH_BYTES.get(lengthBytesNeeded);
+                throw DecodeException.fatalError(message);
+            }
+            peekLength = 0x00;
+
+            if (ensureRead && (readLimiter.remaining() < lengthBytesNeeded)) {
+                state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+                return false;
+            }
+
+            readLimiter.checkLimit(lengthBytesNeeded);
+            while (lengthBytesNeeded > 0) {
+                readByte = buffer.get();
+                peekLength = (peekLength << 8) | (readByte & 0xFF);
+                lengthBytesNeeded--;
+            }
+        }
+
+        // Make sure that the element is not larger than the maximum allowed
+        // message size.
+        if ((maxElementSize > 0) && (peekLength > maxElementSize)) {
+            final LocalizableMessage m =
+                    ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
+                            .get(peekLength, maxElementSize);
+            throw DecodeException.fatalError(m);
+        }
+        state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
+        return true;
+    }
+
+    /**
+     * Internal helper method reading the ASN.1 type byte and transition to the
+     * next state if successful.
+     *
+     * @param ensureRead
+     *            <code>true</code> to check for availability first.
+     * @return <code>true</code> if the type byte was successfully read
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    private boolean needTypeState(final boolean ensureRead) throws IOException {
+        // Read just the type.
+        if (ensureRead && (readLimiter.remaining() <= 0)) {
+            return false;
+        }
+
+        readLimiter.checkLimit(1);
+        peekType = buffer.get();
+        state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java
index 0e95868..bf62813 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ASN1BufferWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package com.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.BOOLEAN_VALUE_FALSE;
 import static org.forgerock.opendj.asn1.ASN1Constants.BOOLEAN_VALUE_TRUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED;
@@ -49,693 +46,499 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Grizzly ASN1 writer implementation.
  */
-final class ASN1BufferWriter extends AbstractASN1Writer implements ASN1Writer,
-    Cacheable
-{
-  private class ChildSequenceBuffer implements SequenceBuffer
-  {
-    private SequenceBuffer parent;
+final class ASN1BufferWriter extends AbstractASN1Writer implements ASN1Writer, Cacheable {
+    private class ChildSequenceBuffer implements SequenceBuffer {
+        private SequenceBuffer parent;
 
-    private ChildSequenceBuffer child;
+        private ChildSequenceBuffer child;
 
-    private final ByteStringBuilder buffer = new ByteStringBuilder(
-        BUFFER_INIT_SIZE);
+        private final ByteStringBuilder buffer = new ByteStringBuilder(BUFFER_INIT_SIZE);
 
+        public SequenceBuffer endSequence() throws IOException {
+            writeLength(parent, buffer.length());
+            parent.writeByteArray(buffer.getBackingArray(), 0, buffer.length());
 
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 END SEQUENCE(length=%d)",
+                        buffer.length()));
+            }
 
-    public SequenceBuffer endSequence() throws IOException
-    {
-      writeLength(parent, buffer.length());
-      parent.writeByteArray(buffer.getBackingArray(), 0, buffer.length());
+            return parent;
+        }
 
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 END SEQUENCE(length=%d)", buffer.length()));
-      }
+        public SequenceBuffer startSequence(final byte type) throws IOException {
+            if (child == null) {
+                child = new ChildSequenceBuffer();
+                child.parent = this;
+            }
 
-      return parent;
+            buffer.append(type);
+            child.buffer.clear();
+
+            return child;
+        }
+
+        public void writeByte(final byte b) throws IOException {
+            buffer.append(b);
+        }
+
+        public void writeByteArray(final byte[] bs, final int offset, final int length)
+                throws IOException {
+            buffer.append(bs, offset, length);
+        }
     }
 
+    private static final class RecyclableBuffer extends ByteBufferWrapper {
+        private volatile boolean usable = true;
 
+        private RecyclableBuffer() {
+            visible = ByteBuffer.allocate(BUFFER_INIT_SIZE);
+            allowBufferDispose = true;
+        }
 
-    public SequenceBuffer startSequence(final byte type) throws IOException
-    {
-      if (child == null)
-      {
-        child = new ChildSequenceBuffer();
-        child.parent = this;
-      }
+        @Override
+        public void dispose() {
+            usable = true;
+        }
 
-      buffer.append(type);
-      child.buffer.clear();
-
-      return child;
+        /**
+         * Ensures that the specified number of additional bytes will fit in the
+         * buffer and resizes it if necessary.
+         *
+         * @param size
+         *            The number of additional bytes.
+         */
+        public void ensureAdditionalCapacity(final int size) {
+            final int newCount = visible.position() + size;
+            if (newCount > visible.capacity()) {
+                final ByteBuffer newByteBuffer =
+                        ByteBuffer.allocate(Math.max(visible.capacity() << 1, newCount));
+                visible.flip();
+                visible = newByteBuffer.put(visible);
+            }
+        }
     }
 
+    private class RootSequenceBuffer implements SequenceBuffer {
+        private ChildSequenceBuffer child;
 
+        public SequenceBuffer endSequence() throws IOException {
+            final LocalizableMessage message = ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED.get();
+            throw new IllegalStateException(message.toString());
+        }
 
-    public void writeByte(final byte b) throws IOException
-    {
-      buffer.append(b);
+        public SequenceBuffer startSequence(final byte type) throws IOException {
+            if (child == null) {
+                child = new ChildSequenceBuffer();
+                child.parent = this;
+            }
+
+            outBuffer.ensureAdditionalCapacity(1);
+            outBuffer.put(type);
+            child.buffer.clear();
+
+            return child;
+        }
+
+        public void writeByte(final byte b) throws IOException {
+            outBuffer.ensureAdditionalCapacity(1);
+            outBuffer.put(b);
+        }
+
+        public void writeByteArray(final byte[] bs, final int offset, final int length)
+                throws IOException {
+            outBuffer.ensureAdditionalCapacity(length);
+            outBuffer.put(bs, offset, length);
+        }
     }
 
+    private interface SequenceBuffer {
+        public SequenceBuffer endSequence() throws IOException;
 
+        public SequenceBuffer startSequence(byte type) throws IOException;
 
-    public void writeByteArray(final byte[] bs, final int offset,
-        final int length) throws IOException
-    {
-      buffer.append(bs, offset, length);
-    }
-  }
+        public void writeByte(byte b) throws IOException;
 
-
-
-  private static final class RecyclableBuffer extends ByteBufferWrapper
-  {
-    private volatile boolean usable = true;
-
-
-
-    private RecyclableBuffer()
-    {
-      visible = ByteBuffer.allocate(BUFFER_INIT_SIZE);
-      allowBufferDispose = true;
+        public void writeByteArray(byte[] bs, int offset, int length) throws IOException;
     }
 
+    private static final int BUFFER_INIT_SIZE = 1024;
+    private final static ThreadCache.CachedTypeIndex<ASN1BufferWriter> WRITER_INDEX = ThreadCache
+            .obtainIndex(ASN1BufferWriter.class, 1);
 
+    static ASN1BufferWriter getWriter() {
+        ASN1BufferWriter asn1Writer = ThreadCache.takeFromCache(WRITER_INDEX);
+        if (asn1Writer == null) {
+            asn1Writer = new ASN1BufferWriter();
+        }
 
-    @Override
-    public void dispose()
-    {
-      usable = true;
+        if (!asn1Writer.outBuffer.usable) {
+            // If the output buffer is unusable, create a new one.
+            asn1Writer.outBuffer = new RecyclableBuffer();
+        }
+        asn1Writer.outBuffer.clear();
+        return asn1Writer;
     }
 
+    private SequenceBuffer sequenceBuffer;
+    private RecyclableBuffer outBuffer;
 
+    private final RootSequenceBuffer rootBuffer;
 
     /**
-     * Ensures that the specified number of additional bytes will fit in the
-     * buffer and resizes it if necessary.
-     *
-     * @param size
-     *          The number of additional bytes.
+     * Creates a new ASN.1 writer that writes to a StreamWriter.
      */
-    public void ensureAdditionalCapacity(final int size)
-    {
-      final int newCount = visible.position() + size;
-      if (newCount > visible.capacity())
-      {
-        final ByteBuffer newByteBuffer = ByteBuffer.allocate(Math.max(visible
-            .capacity() << 1, newCount));
-        visible.flip();
-        visible = newByteBuffer.put(visible);
-      }
-    }
-  }
-
-
-
-  private class RootSequenceBuffer implements SequenceBuffer
-  {
-    private ChildSequenceBuffer child;
-
-
-
-    public SequenceBuffer endSequence() throws IOException
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED
-          .get();
-      throw new IllegalStateException(message.toString());
+    private ASN1BufferWriter() {
+        this.sequenceBuffer = this.rootBuffer = new RootSequenceBuffer();
+        this.outBuffer = new RecyclableBuffer();
     }
 
-
-
-    public SequenceBuffer startSequence(final byte type) throws IOException
-    {
-      if (child == null)
-      {
-        child = new ChildSequenceBuffer();
-        child.parent = this;
-      }
-
-      outBuffer.ensureAdditionalCapacity(1);
-      outBuffer.put(type);
-      child.buffer.clear();
-
-      return child;
+    /**
+     * Closes this ASN.1 writer and the underlying outputstream. Any unfinished
+     * sequences will be ended.
+     *
+     * @throws IOException
+     *             if an error occurs while closing the stream.
+     */
+    public void close() throws IOException {
+        outBuffer = null;
     }
 
-
-
-    public void writeByte(final byte b) throws IOException
-    {
-      outBuffer.ensureAdditionalCapacity(1);
-      outBuffer.put(b);
+    /**
+     * Flushes the stream.
+     *
+     * @throws IOException
+     *             If an I/O error occurs
+     */
+    public void flush() throws IOException {
+        // Do nothing
     }
 
-
-
-    public void writeByteArray(final byte[] bs, final int offset,
-        final int length) throws IOException
-    {
-      outBuffer.ensureAdditionalCapacity(length);
-      outBuffer.put(bs, offset, length);
-    }
-  }
-
-
-
-  private interface SequenceBuffer
-  {
-    public SequenceBuffer endSequence() throws IOException;
-
-
-
-    public SequenceBuffer startSequence(byte type) throws IOException;
-
-
-
-    public void writeByte(byte b) throws IOException;
-
-
-
-    public void writeByteArray(byte[] bs, int offset, int length)
-        throws IOException;
-  }
-
-
-
-  private static final int BUFFER_INIT_SIZE = 1024;
-  private final static ThreadCache.CachedTypeIndex<ASN1BufferWriter> WRITER_INDEX = ThreadCache
-      .obtainIndex(ASN1BufferWriter.class, 1);
-
-
-
-  static ASN1BufferWriter getWriter()
-  {
-    ASN1BufferWriter asn1Writer = ThreadCache.takeFromCache(WRITER_INDEX);
-    if (asn1Writer == null)
-    {
-      asn1Writer = new ASN1BufferWriter();
+    public void recycle() {
+        sequenceBuffer = rootBuffer;
+        outBuffer.clear();
+        ThreadCache.putToCache(WRITER_INDEX, this);
     }
 
-    if (!asn1Writer.outBuffer.usable)
-    {
-      // If the output buffer is unusable, create a new one.
-      asn1Writer.outBuffer = new RecyclableBuffer();
-    }
-    asn1Writer.outBuffer.clear();
-    return asn1Writer;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) throws IOException {
+        sequenceBuffer.writeByte(type);
+        writeLength(sequenceBuffer, 1);
+        sequenceBuffer.writeByte(booleanValue ? BOOLEAN_VALUE_TRUE : BOOLEAN_VALUE_FALSE);
 
-
-
-  private SequenceBuffer sequenceBuffer;
-  private RecyclableBuffer outBuffer;
-
-  private final RootSequenceBuffer rootBuffer;
-
-
-
-  /**
-   * Creates a new ASN.1 writer that writes to a StreamWriter.
-   */
-  private ASN1BufferWriter()
-  {
-    this.sequenceBuffer = this.rootBuffer = new RootSequenceBuffer();
-    this.outBuffer = new RecyclableBuffer();
-  }
-
-
-
-  /**
-   * Closes this ASN.1 writer and the underlying outputstream. Any unfinished
-   * sequences will be ended.
-   *
-   * @throws IOException
-   *           if an error occurs while closing the stream.
-   */
-  public void close() throws IOException
-  {
-    outBuffer = null;
-  }
-
-
-
-  /**
-   * Flushes the stream.
-   *
-   * @throws IOException
-   *           If an I/O error occurs
-   */
-  public void flush() throws IOException
-  {
-    // Do nothing
-  }
-
-
-
-  public void recycle()
-  {
-    sequenceBuffer = rootBuffer;
-    outBuffer.clear();
-    ThreadCache.putToCache(WRITER_INDEX, this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeBoolean(final byte type, final boolean booleanValue)
-      throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    writeLength(sequenceBuffer, 1);
-    sequenceBuffer.writeByte(booleanValue ? BOOLEAN_VALUE_TRUE
-        : BOOLEAN_VALUE_FALSE);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1,
-          String.valueOf(booleanValue)));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEndSequence() throws IOException
-  {
-    sequenceBuffer = sequenceBuffer.endSequence();
-
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEndSet() throws IOException
-  {
-    return writeEndSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEnumerated(final byte type, final int intValue)
-      throws IOException
-  {
-    return writeInteger(type, intValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final byte type, final int intValue)
-      throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    if (((intValue < 0) && ((intValue & 0xFFFFFF80) == 0xFFFFFF80))
-        || ((intValue & 0x0000007F) == intValue))
-    {
-      writeLength(sequenceBuffer, 1);
-      sequenceBuffer.writeByte((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1,
-            intValue));
-      }
-    }
-    else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
-        || ((intValue & 0x00007FFF) == intValue))
-    {
-      writeLength(sequenceBuffer, 2);
-      sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2,
-            intValue));
-      }
-    }
-    else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
-        || ((intValue & 0x007FFFFF) == intValue))
-    {
-      writeLength(sequenceBuffer, 3);
-      sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3,
-            intValue));
-      }
-    }
-    else
-    {
-      writeLength(sequenceBuffer, 4);
-      sequenceBuffer.writeByte((byte) ((intValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4,
-            intValue));
-      }
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final byte type, final long longValue)
-      throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L))
-        || ((longValue & 0x000000000000007FL) == longValue))
-    {
-      writeLength(sequenceBuffer, 1);
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
-        || ((longValue & 0x0000000000007FFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 2);
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
-        || ((longValue & 0x00000000007FFFFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 3);
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
-        || ((longValue & 0x000000007FFFFFFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 4);
-      sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
-        || ((longValue & 0x0000007FFFFFFFFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 5);
-      sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
-        || ((longValue & 0x00007FFFFFFFFFFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 6);
-      sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
-        || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue))
-    {
-      writeLength(sequenceBuffer, 7);
-      sequenceBuffer.writeByte((byte) ((longValue >> 48) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7,
-            longValue));
-      }
-    }
-    else
-    {
-      writeLength(sequenceBuffer, 8);
-      sequenceBuffer.writeByte((byte) ((longValue >> 56) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 48) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
-      sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
-      sequenceBuffer.writeByte((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8,
-            longValue));
-      }
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeNull(final byte type) throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    writeLength(sequenceBuffer, 0);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 NULL(type=0x%x, length=%d)", type, 0));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final byte[] value,
-      final int offset, final int length) throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    writeLength(sequenceBuffer, length);
-    sequenceBuffer.writeByteArray(value, offset, length);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final ByteSequence value)
-      throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-    writeLength(sequenceBuffer, value.length());
-    // TODO: Is there a more efficient way to do this?
-    for (int i = 0; i < value.length(); i++)
-    {
-      sequenceBuffer.writeByte(value.byteAt(i));
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1, String
+                            .valueOf(booleanValue)));
+        }
+        return this;
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String
-          .format("WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value
-              .length()));
-    }
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEndSequence() throws IOException {
+        sequenceBuffer = sequenceBuffer.endSequence();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final String value)
-      throws IOException
-  {
-    sequenceBuffer.writeByte(type);
-
-    if (value == null)
-    {
-      writeLength(sequenceBuffer, 0);
-      return this;
+        return this;
     }
 
-    final byte[] bytes = StaticUtils.getBytes(value);
-    writeLength(sequenceBuffer, bytes.length);
-    sequenceBuffer.writeByteArray(bytes, 0, bytes.length);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
-          bytes.length, value));
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEndSet() throws IOException {
+        return writeEndSequence();
     }
-    return this;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSequence(final byte type) throws IOException
-  {
-    // Get a child sequence buffer
-    sequenceBuffer = sequenceBuffer.startSequence(type);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 START SEQUENCE(type=0x%x)", type));
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEnumerated(final byte type, final int intValue) throws IOException {
+        return writeInteger(type, intValue);
     }
-    return this;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSet(final byte type) throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    return writeStartSequence(type);
-  }
-
-
-
-  Buffer getBuffer()
-  {
-    outBuffer.usable = false;
-    return outBuffer.flip();
-  }
-
-
-
-  /**
-   * Writes the provided value for use as the length of an ASN.1 element.
-   *
-   * @param buffer
-   *          The sequence buffer to write to.
-   * @param length
-   *          The length to encode for use in an ASN.1 element.
-   * @throws IOException
-   *           if an error occurs while writing.
-   */
-  private void writeLength(final SequenceBuffer buffer, final int length)
-      throws IOException
-  {
-    if (length < 128)
-    {
-      buffer.writeByte((byte) length);
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final byte type, final int intValue) throws IOException {
+        sequenceBuffer.writeByte(type);
+        if (((intValue < 0) && ((intValue & 0xFFFFFF80) == 0xFFFFFF80))
+                || ((intValue & 0x0000007F) == intValue)) {
+            writeLength(sequenceBuffer, 1);
+            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, intValue));
+            }
+        } else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
+                || ((intValue & 0x00007FFF) == intValue)) {
+            writeLength(sequenceBuffer, 2);
+            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, intValue));
+            }
+        } else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
+                || ((intValue & 0x007FFFFF) == intValue)) {
+            writeLength(sequenceBuffer, 3);
+            sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, intValue));
+            }
+        } else {
+            writeLength(sequenceBuffer, 4);
+            sequenceBuffer.writeByte((byte) ((intValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((intValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((intValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, intValue));
+            }
+        }
+        return this;
     }
-    else if ((length & 0x000000FF) == length)
-    {
-      buffer.writeByte((byte) 0x81);
-      buffer.writeByte((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final byte type, final long longValue) throws IOException {
+        sequenceBuffer.writeByte(type);
+        if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L))
+                || ((longValue & 0x000000000000007FL) == longValue)) {
+            writeLength(sequenceBuffer, 1);
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
+                || ((longValue & 0x0000000000007FFFL) == longValue)) {
+            writeLength(sequenceBuffer, 2);
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
+                || ((longValue & 0x00000000007FFFFFL) == longValue)) {
+            writeLength(sequenceBuffer, 3);
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
+                || ((longValue & 0x000000007FFFFFFFL) == longValue)) {
+            writeLength(sequenceBuffer, 4);
+            sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
+                || ((longValue & 0x0000007FFFFFFFFFL) == longValue)) {
+            writeLength(sequenceBuffer, 5);
+            sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
+                || ((longValue & 0x00007FFFFFFFFFFFL) == longValue)) {
+            writeLength(sequenceBuffer, 6);
+            sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
+                || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue)) {
+            writeLength(sequenceBuffer, 7);
+            sequenceBuffer.writeByte((byte) ((longValue >> 48) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7, longValue));
+            }
+        } else {
+            writeLength(sequenceBuffer, 8);
+            sequenceBuffer.writeByte((byte) ((longValue >> 56) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 48) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 40) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 32) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 24) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 16) & 0xFF));
+            sequenceBuffer.writeByte((byte) ((longValue >> 8) & 0xFF));
+            sequenceBuffer.writeByte((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8, longValue));
+            }
+        }
+        return this;
     }
-    else if ((length & 0x0000FFFF) == length)
-    {
-      buffer.writeByte((byte) 0x82);
-      buffer.writeByte((byte) ((length >> 8) & 0xFF));
-      buffer.writeByte((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeNull(final byte type) throws IOException {
+        sequenceBuffer.writeByte(type);
+        writeLength(sequenceBuffer, 0);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 NULL(type=0x%x, length=%d)",
+                    type, 0));
+        }
+        return this;
     }
-    else if ((length & 0x00FFFFFF) == length)
-    {
-      buffer.writeByte((byte) 0x83);
-      buffer.writeByte((byte) ((length >> 16) & 0xFF));
-      buffer.writeByte((byte) ((length >> 8) & 0xFF));
-      buffer.writeByte((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final byte[] value, final int offset,
+            final int length) throws IOException {
+        sequenceBuffer.writeByte(type);
+        writeLength(sequenceBuffer, length);
+        sequenceBuffer.writeByteArray(value, offset, length);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
+        }
+        return this;
     }
-    else
-    {
-      buffer.writeByte((byte) 0x84);
-      buffer.writeByte((byte) ((length >> 24) & 0xFF));
-      buffer.writeByte((byte) ((length >> 16) & 0xFF));
-      buffer.writeByte((byte) ((length >> 8) & 0xFF));
-      buffer.writeByte((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final ByteSequence value)
+            throws IOException {
+        sequenceBuffer.writeByte(type);
+        writeLength(sequenceBuffer, value.length());
+        // TODO: Is there a more efficient way to do this?
+        for (int i = 0; i < value.length(); i++) {
+            sequenceBuffer.writeByte(value.byteAt(i));
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value.length()));
+        }
+        return this;
     }
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final String value) throws IOException {
+        sequenceBuffer.writeByte(type);
+
+        if (value == null) {
+            writeLength(sequenceBuffer, 0);
+            return this;
+        }
+
+        final byte[] bytes = StaticUtils.getBytes(value);
+        writeLength(sequenceBuffer, bytes.length);
+        sequenceBuffer.writeByteArray(bytes, 0, bytes.length);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
+                    bytes.length, value));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSequence(final byte type) throws IOException {
+        // Get a child sequence buffer
+        sequenceBuffer = sequenceBuffer.startSequence(type);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 START SEQUENCE(type=0x%x)",
+                    type));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSet(final byte type) throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        return writeStartSequence(type);
+    }
+
+    Buffer getBuffer() {
+        outBuffer.usable = false;
+        return outBuffer.flip();
+    }
+
+    /**
+     * Writes the provided value for use as the length of an ASN.1 element.
+     *
+     * @param buffer
+     *            The sequence buffer to write to.
+     * @param length
+     *            The length to encode for use in an ASN.1 element.
+     * @throws IOException
+     *             if an error occurs while writing.
+     */
+    private void writeLength(final SequenceBuffer buffer, final int length) throws IOException {
+        if (length < 128) {
+            buffer.writeByte((byte) length);
+        } else if ((length & 0x000000FF) == length) {
+            buffer.writeByte((byte) 0x81);
+            buffer.writeByte((byte) (length & 0xFF));
+        } else if ((length & 0x0000FFFF) == length) {
+            buffer.writeByte((byte) 0x82);
+            buffer.writeByte((byte) ((length >> 8) & 0xFF));
+            buffer.writeByte((byte) (length & 0xFF));
+        } else if ((length & 0x00FFFFFF) == length) {
+            buffer.writeByte((byte) 0x83);
+            buffer.writeByte((byte) ((length >> 16) & 0xFF));
+            buffer.writeByte((byte) ((length >> 8) & 0xFF));
+            buffer.writeByte((byte) (length & 0xFF));
+        } else {
+            buffer.writeByte((byte) 0x84);
+            buffer.writeByte((byte) ((length >> 24) & 0xFF));
+            buffer.writeByte((byte) ((length >> 16) & 0xFF));
+            buffer.writeByte((byte) ((length >> 8) & 0xFF));
+            buffer.writeByte((byte) (length & 0xFF));
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPFutureResultImpl.java
index a46aabe..294e9ee 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,148 +27,109 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.responses.IntermediateResponse;
 import org.forgerock.opendj.ldap.responses.Result;
 
 import com.forgerock.opendj.util.AsynchronousFutureResult;
 
-
-
 /**
  * Abstract future result implementation.
  *
  * @param <S>
- *          The type of result returned by this future.
+ *            The type of result returned by this future.
  */
-abstract class AbstractLDAPFutureResultImpl<S extends Result> extends
-    AsynchronousFutureResult<S> implements IntermediateResponseHandler
-{
-  private final Connection connection;
+abstract class AbstractLDAPFutureResultImpl<S extends Result> extends AsynchronousFutureResult<S>
+        implements IntermediateResponseHandler {
+    private final Connection connection;
 
-  private final int requestID;
+    private final int requestID;
 
-  private IntermediateResponseHandler intermediateResponseHandler;
+    private IntermediateResponseHandler intermediateResponseHandler;
 
-  private volatile long timestamp;
+    private volatile long timestamp;
 
+    AbstractLDAPFutureResultImpl(final int requestID, final ResultHandler<? super S> resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(resultHandler);
+        this.requestID = requestID;
+        this.connection = connection;
+        this.intermediateResponseHandler = intermediateResponseHandler;
+        this.timestamp = System.currentTimeMillis();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final int getRequestID() {
+        return requestID;
+    }
 
-  AbstractLDAPFutureResultImpl(final int requestID,
-      final ResultHandler<? super S> resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(resultHandler);
-    this.requestID = requestID;
-    this.connection = connection;
-    this.intermediateResponseHandler = intermediateResponseHandler;
-    this.timestamp = System.currentTimeMillis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final int getRequestID()
-  {
-    return requestID;
-  }
-
-
-
-  @Override
-  public final boolean handleIntermediateResponse(
-      final IntermediateResponse response)
-  {
-    // FIXME: there's a potential race condition here - the future could
-    // get cancelled between the isDone() call and the handler
-    // invocation. We'd need to add support for intermediate handlers in
-    // the synchronizer.
-    if (!isDone())
-    {
-      updateTimestamp();
-      if (intermediateResponseHandler != null)
-      {
-        if (!intermediateResponseHandler.handleIntermediateResponse(response))
-        {
-          intermediateResponseHandler = null;
+    @Override
+    public final boolean handleIntermediateResponse(final IntermediateResponse response) {
+        // FIXME: there's a potential race condition here - the future could
+        // get cancelled between the isDone() call and the handler
+        // invocation. We'd need to add support for intermediate handlers in
+        // the synchronizer.
+        if (!isDone()) {
+            updateTimestamp();
+            if (intermediateResponseHandler != null) {
+                if (!intermediateResponseHandler.handleIntermediateResponse(response)) {
+                    intermediateResponseHandler = null;
+                }
+            }
         }
-      }
+        return true;
     }
-    return true;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected final ErrorResultException handleCancelRequest(
-      final boolean mayInterruptIfRunning)
-  {
-    connection.abandonAsync(Requests.newAbandonRequest(requestID));
-    return null;
-  }
-
-
-
-  @Override
-  protected void toString(final StringBuilder sb)
-  {
-    sb.append(" requestID = ");
-    sb.append(requestID);
-    sb.append(" timestamp = ");
-    sb.append(timestamp);
-    super.toString(sb);
-  }
-
-
-
-  final void adaptErrorResult(final Result result)
-  {
-    final S errorResult = newErrorResult(result.getResultCode(),
-        result.getDiagnosticMessage(), result.getCause());
-    setResultOrError(errorResult);
-  }
-
-
-
-  final long getTimestamp()
-  {
-    return timestamp;
-  }
-
-
-
-  abstract S newErrorResult(ResultCode resultCode, String diagnosticMessage,
-      Throwable cause);
-
-
-
-  final void setResultOrError(final S result)
-  {
-    if (result.getResultCode().isExceptional())
-    {
-      handleErrorResult(ErrorResultException.newErrorResult(result));
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected final ErrorResultException handleCancelRequest(final boolean mayInterruptIfRunning) {
+        connection.abandonAsync(Requests.newAbandonRequest(requestID));
+        return null;
     }
-    else
-    {
-      handleResult(result);
+
+    @Override
+    protected void toString(final StringBuilder sb) {
+        sb.append(" requestID = ");
+        sb.append(requestID);
+        sb.append(" timestamp = ");
+        sb.append(timestamp);
+        super.toString(sb);
     }
-  }
 
+    final void adaptErrorResult(final Result result) {
+        final S errorResult =
+                newErrorResult(result.getResultCode(), result.getDiagnosticMessage(), result
+                        .getCause());
+        setResultOrError(errorResult);
+    }
 
+    final long getTimestamp() {
+        return timestamp;
+    }
 
-  final void updateTimestamp()
-  {
-    timestamp = System.currentTimeMillis();
-  }
+    abstract S newErrorResult(ResultCode resultCode, String diagnosticMessage, Throwable cause);
+
+    final void setResultOrError(final S result) {
+        if (result.getResultCode().isExceptional()) {
+            handleErrorResult(ErrorResultException.newErrorResult(result));
+        } else {
+            handleResult(result);
+        }
+    }
+
+    final void updateTimestamp() {
+        timestamp = System.currentTimeMillis();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPMessageHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPMessageHandler.java
index 9a9c0f2..f28fd41 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPMessageHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/AbstractLDAPMessageHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,210 +26,141 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
-
-
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.IntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 /**
  * Abstract LDAP message handler.
  *
  * @param <P>
- *          A user provided handler parameter.
+ *            A user provided handler parameter.
  */
-abstract class AbstractLDAPMessageHandler<P> implements LDAPMessageHandler<P>
-{
-  public void abandonRequest(final P param, final int messageID,
-      final AbandonRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
+abstract class AbstractLDAPMessageHandler<P> implements LDAPMessageHandler<P> {
+    public void abandonRequest(final P param, final int messageID, final AbandonRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void addRequest(final P param, final int messageID, final AddRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void addResult(final P param, final int messageID, final Result result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
-  public void addRequest(final P param, final int messageID,
-      final AddRequest request) throws UnexpectedRequestException, IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
+    public void bindRequest(final P param, final int messageID, final int version,
+            final GenericBindRequest request) throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void bindResult(final P param, final int messageID, final BindResult result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
+    public void compareRequest(final P param, final int messageID, final CompareRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
-  public void addResult(final P param, final int messageID, final Result result)
-      throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
+    public void compareResult(final P param, final int messageID, final CompareResult result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
+    public void deleteRequest(final P param, final int messageID, final DeleteRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void deleteResult(final P param, final int messageID, final Result result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
-  public void bindRequest(final P param, final int messageID,
-      final int version, final GenericBindRequest request)
-      throws UnexpectedRequestException, IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
+    public <R extends ExtendedResult> void extendedRequest(final P param, final int messageID,
+            final ExtendedRequest<R> request) throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void extendedResult(final P param, final int messageID, final ExtendedResult result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
+    public void intermediateResponse(final P param, final int messageID,
+            final IntermediateResponse response) throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, response);
+    }
 
-  public void bindResult(final P param, final int messageID,
-      final BindResult result) throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
+    public void modifyDNRequest(final P param, final int messageID, final ModifyDNRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void modifyDNResult(final P param, final int messageID, final Result result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
+    public void modifyRequest(final P param, final int messageID, final ModifyRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
-  public void compareRequest(final P param, final int messageID,
-      final CompareRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
+    public void modifyResult(final P param, final int messageID, final Result result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
+    public void searchRequest(final P param, final int messageID, final SearchRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
+    public void searchResult(final P param, final int messageID, final Result result)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, result);
+    }
 
-  public void compareResult(final P param, final int messageID,
-      final CompareResult result) throws UnexpectedResponseException,
-      IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
+    public void searchResultEntry(final P param, final int messageID, final SearchResultEntry entry)
+            throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, entry);
+    }
 
+    public void searchResultReference(final P param, final int messageID,
+            final SearchResultReference reference) throws UnexpectedResponseException, IOException {
+        throw new UnexpectedResponseException(messageID, reference);
+    }
 
+    public void unbindRequest(final P param, final int messageID, final UnbindRequest request)
+            throws UnexpectedRequestException, IOException {
+        throw new UnexpectedRequestException(messageID, request);
+    }
 
-  public void deleteRequest(final P param, final int messageID,
-      final DeleteRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void deleteResult(final P param, final int messageID,
-      final Result result) throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
-
-
-
-  public <R extends ExtendedResult> void extendedRequest(final P param,
-      final int messageID, final ExtendedRequest<R> request)
-      throws UnexpectedRequestException, IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void extendedResult(final P param, final int messageID,
-      final ExtendedResult result) throws UnexpectedResponseException,
-      IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
-
-
-
-  public void intermediateResponse(final P param, final int messageID,
-      final IntermediateResponse response) throws UnexpectedResponseException,
-      IOException
-  {
-    throw new UnexpectedResponseException(messageID, response);
-  }
-
-
-
-  public void modifyDNRequest(final P param, final int messageID,
-      final ModifyDNRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void modifyDNResult(final P param, final int messageID,
-      final Result result) throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
-
-
-
-  public void modifyRequest(final P param, final int messageID,
-      final ModifyRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void modifyResult(final P param, final int messageID,
-      final Result result) throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
-
-
-
-  public void searchRequest(final P param, final int messageID,
-      final SearchRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void searchResult(final P param, final int messageID,
-      final Result result) throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, result);
-  }
-
-
-
-  public void searchResultEntry(final P param, final int messageID,
-      final SearchResultEntry entry) throws UnexpectedResponseException,
-      IOException
-  {
-    throw new UnexpectedResponseException(messageID, entry);
-  }
-
-
-
-  public void searchResultReference(final P param, final int messageID,
-      final SearchResultReference reference)
-      throws UnexpectedResponseException, IOException
-  {
-    throw new UnexpectedResponseException(messageID, reference);
-  }
-
-
-
-  public void unbindRequest(final P param, final int messageID,
-      final UnbindRequest request) throws UnexpectedRequestException,
-      IOException
-  {
-    throw new UnexpectedRequestException(messageID, request);
-  }
-
-
-
-  public void unrecognizedMessage(final P param, final int messageID,
-      final byte messageTag, final ByteString messageBytes)
-      throws UnsupportedMessageException, IOException
-  {
-    throw new UnsupportedMessageException(messageID, messageTag, messageBytes);
-  }
+    public void unrecognizedMessage(final P param, final int messageID, final byte messageTag,
+            final ByteString messageBytes) throws UnsupportedMessageException, IOException {
+        throw new UnsupportedMessageException(messageID, messageTag, messageBytes);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionSecurityLayerFilter.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionSecurityLayerFilter.java
index f62b7cc..9c71d58 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionSecurityLayerFilter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionSecurityLayerFilter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.glassfish.grizzly.AbstractTransformer;
@@ -40,141 +37,92 @@
 import org.glassfish.grizzly.memory.Buffers;
 import org.glassfish.grizzly.memory.MemoryManager;
 
-
-
 /**
  * Connection security layer filter adapter.
  */
-final class ConnectionSecurityLayerFilter extends
-    AbstractCodecFilter<Buffer, Buffer>
-{
-  /**
-   * <tt>Transformer</tt>, which decodes SASL encrypted data, contained in the
-   * input Buffer, to the output Buffer.
-   */
-  private static final class Decoder extends
-      AbstractTransformer<Buffer, Buffer>
-  {
-    private static final int BUFFER_SIZE = 4096;
-    private final byte[] buffer = new byte[BUFFER_SIZE];
-    private final ConnectionSecurityLayer layer;
-    private final MemoryManager<?> memoryManager;
+final class ConnectionSecurityLayerFilter extends AbstractCodecFilter<Buffer, Buffer> {
+    /**
+     * <tt>Transformer</tt>, which decodes SASL encrypted data, contained in the
+     * input Buffer, to the output Buffer.
+     */
+    private static final class Decoder extends AbstractTransformer<Buffer, Buffer> {
+        private static final int BUFFER_SIZE = 4096;
+        private final byte[] buffer = new byte[BUFFER_SIZE];
+        private final ConnectionSecurityLayer layer;
+        private final MemoryManager<?> memoryManager;
 
+        public Decoder(final ConnectionSecurityLayer layer, final MemoryManager<?> memoryManager) {
+            this.layer = layer;
+            this.memoryManager = memoryManager;
+        }
 
+        public String getName() {
+            return this.getClass().getName();
+        }
 
-    public Decoder(final ConnectionSecurityLayer layer,
-        final MemoryManager<?> memoryManager)
-    {
-      this.layer = layer;
-      this.memoryManager = memoryManager;
+        public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) {
+            return input != null && input.hasRemaining();
+        }
+
+        @Override
+        public TransformationResult<Buffer, Buffer> transformImpl(final AttributeStorage storage,
+                final Buffer input) {
+
+            final int len = Math.min(buffer.length, input.remaining());
+            input.get(buffer, 0, len);
+
+            try {
+                final Buffer output = Buffers.wrap(memoryManager, layer.unwrap(buffer, 0, len));
+                return TransformationResult.createCompletedResult(output, input);
+            } catch (final ErrorResultException e) {
+                return TransformationResult.createErrorResult(e.getResult().getResultCode()
+                        .intValue(), e.getMessage());
+            }
+        }
     }
 
+    /**
+     * <tt>Transformer</tt>, which encodes SASL encrypted data, contained in the
+     * input Buffer, to the output Buffer.
+     */
+    private static final class Encoder extends AbstractTransformer<Buffer, Buffer> {
+        private static final int BUFFER_SIZE = 4096;
+        private final byte[] buffer = new byte[BUFFER_SIZE];
+        private final ConnectionSecurityLayer layer;
+        private final MemoryManager<?> memoryManager;
 
+        private Encoder(final ConnectionSecurityLayer layer, final MemoryManager<?> memoryManager) {
+            this.layer = layer;
+            this.memoryManager = memoryManager;
+        }
 
-    public String getName()
-    {
-      return this.getClass().getName();
+        public String getName() {
+            return this.getClass().getName();
+        }
+
+        public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) {
+            return input != null && input.hasRemaining();
+        }
+
+        @Override
+        public TransformationResult<Buffer, Buffer> transformImpl(final AttributeStorage storage,
+                final Buffer input) {
+
+            final int len = Math.min(buffer.length, input.remaining());
+            input.get(buffer, 0, len);
+
+            try {
+                final Buffer output = Buffers.wrap(memoryManager, layer.wrap(buffer, 0, len));
+                return TransformationResult.createCompletedResult(output, input);
+            } catch (final ErrorResultException e) {
+                return TransformationResult.createErrorResult(e.getResult().getResultCode()
+                        .intValue(), e.getMessage());
+            }
+        }
     }
 
-
-
-    public boolean hasInputRemaining(final AttributeStorage storage,
-        final Buffer input)
-    {
-      return input != null && input.hasRemaining();
+    ConnectionSecurityLayerFilter(final ConnectionSecurityLayer layer,
+            final MemoryManager<?> memoryManager) {
+        super(new Decoder(layer, memoryManager), new Encoder(layer, memoryManager));
     }
-
-
-
-    @Override
-    public TransformationResult<Buffer, Buffer> transformImpl(
-        final AttributeStorage storage, final Buffer input)
-    {
-
-      final int len = Math.min(buffer.length, input.remaining());
-      input.get(buffer, 0, len);
-
-      try
-      {
-        final Buffer output = Buffers.wrap(memoryManager,
-            layer.unwrap(buffer, 0, len));
-        return TransformationResult.createCompletedResult(output, input);
-      }
-      catch (final ErrorResultException e)
-      {
-        return TransformationResult.createErrorResult(e.getResult()
-            .getResultCode().intValue(), e.getMessage());
-      }
-    }
-  }
-
-
-
-  /**
-   * <tt>Transformer</tt>, which encodes SASL encrypted data, contained in the
-   * input Buffer, to the output Buffer.
-   */
-  private static final class Encoder extends
-      AbstractTransformer<Buffer, Buffer>
-  {
-    private static final int BUFFER_SIZE = 4096;
-    private final byte[] buffer = new byte[BUFFER_SIZE];
-    private final ConnectionSecurityLayer layer;
-    private final MemoryManager<?> memoryManager;
-
-
-
-    private Encoder(final ConnectionSecurityLayer layer,
-        final MemoryManager<?> memoryManager)
-    {
-      this.layer = layer;
-      this.memoryManager = memoryManager;
-    }
-
-
-
-    public String getName()
-    {
-      return this.getClass().getName();
-    }
-
-
-
-    public boolean hasInputRemaining(final AttributeStorage storage,
-        final Buffer input)
-    {
-      return input != null && input.hasRemaining();
-    }
-
-
-
-    @Override
-    public TransformationResult<Buffer, Buffer> transformImpl(
-        final AttributeStorage storage, final Buffer input)
-    {
-
-      final int len = Math.min(buffer.length, input.remaining());
-      input.get(buffer, 0, len);
-
-      try
-      {
-        final Buffer output = Buffers.wrap(memoryManager,
-            layer.wrap(buffer, 0, len));
-        return TransformationResult.createCompletedResult(output, input);
-      }
-      catch (final ErrorResultException e)
-      {
-        return TransformationResult.createErrorResult(e.getResult()
-            .getResultCode().intValue(), e.getMessage());
-      }
-    }
-  }
-
-
-
-  ConnectionSecurityLayerFilter(final ConnectionSecurityLayer layer,
-      final MemoryManager<?> memoryManager)
-  {
-    super(new Decoder(layer, memoryManager), new Encoder(layer, memoryManager));
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java
index fc4c997..a13232a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransport.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
@@ -37,155 +34,124 @@
 import org.glassfish.grizzly.strategies.SameThreadIOStrategy;
 import org.glassfish.grizzly.strategies.WorkerThreadIOStrategy;
 
-
-
 /**
  * The default {@link TCPNIOTransport} which all {@code LDAPConnectionFactory}s
  * and {@code LDAPListener}s will use unless otherwise specified in their
  * options.
  */
-final class DefaultTCPNIOTransport
-{
-  private static TCPNIOTransport defaultTransport = null;
+final class DefaultTCPNIOTransport {
+    private static TCPNIOTransport defaultTransport = null;
 
+    /**
+     * Returns the default {@link TCPNIOTransport} which all
+     * {@code LDAPConnectionFactory}s and {@code LDAPListener}s will use unless
+     * otherwise specified in their options.
+     *
+     * @return The default {@link TCPNIOTransport}.
+     */
+    static synchronized TCPNIOTransport getInstance() {
+        if (defaultTransport == null) {
+            final TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance();
 
+            // Determine which threading strategy to use, and total number of
+            // threads.
+            final String useWorkerThreadsStr =
+                    System.getProperty("org.forgerock.opendj.transport.useWorkerThreads");
+            final boolean useWorkerThreadStrategy;
+            if (useWorkerThreadsStr != null) {
+                useWorkerThreadStrategy = Boolean.parseBoolean(useWorkerThreadsStr);
+            } else {
+                // The most best performing strategy to use is the
+                // SameThreadIOStrategy,
+                // however it can only be used in cases where result listeners
+                // will not
+                // block.
+                useWorkerThreadStrategy = true;
+            }
 
-  /**
-   * Returns the default {@link TCPNIOTransport} which all
-   * {@code LDAPConnectionFactory}s and {@code LDAPListener}s will use unless
-   * otherwise specified in their options.
-   *
-   * @return The default {@link TCPNIOTransport}.
-   */
-  static synchronized TCPNIOTransport getInstance()
-  {
-    if (defaultTransport == null)
-    {
-      final TCPNIOTransportBuilder builder = TCPNIOTransportBuilder
-          .newInstance();
+            if (useWorkerThreadStrategy) {
+                builder.setIOStrategy(WorkerThreadIOStrategy.getInstance());
+            } else {
+                builder.setIOStrategy(SameThreadIOStrategy.getInstance());
+            }
 
-      // Determine which threading strategy to use, and total number of threads.
-      final String useWorkerThreadsStr = System
-          .getProperty("org.forgerock.opendj.transport.useWorkerThreads");
-      final boolean useWorkerThreadStrategy;
-      if (useWorkerThreadsStr != null)
-      {
-        useWorkerThreadStrategy = Boolean
-            .parseBoolean(useWorkerThreadsStr);
-      }
-      else
-      {
-        // The most best performing strategy to use is the SameThreadIOStrategy,
-        // however it can only be used in cases where result listeners will not
-        // block.
-        useWorkerThreadStrategy = true;
-      }
+            // Calculate thread counts.
+            final int cpus = Runtime.getRuntime().availableProcessors();
 
-      if (useWorkerThreadStrategy)
-      {
-        builder.setIOStrategy(WorkerThreadIOStrategy.getInstance());
-      }
-      else
-      {
-        builder.setIOStrategy(SameThreadIOStrategy.getInstance());
-      }
+            // Calculate the number of selector threads.
+            final String selectorsStr =
+                    System.getProperty("org.forgerock.opendj.transport.selectors");
+            final int selectorThreadCount;
 
-      // Calculate thread counts.
-      final int cpus = Runtime.getRuntime().availableProcessors();
+            if (selectorsStr != null) {
+                selectorThreadCount = Integer.parseInt(selectorsStr);
+            } else {
+                selectorThreadCount =
+                        useWorkerThreadStrategy ? Math.max(2, cpus / 4) : Math.max(5,
+                                (cpus / 2) - 1);
+            }
 
-      // Calculate the number of selector threads.
-      final String selectorsStr = System
-          .getProperty("org.forgerock.opendj.transport.selectors");
-      final int selectorThreadCount;
+            builder.getSelectorThreadPoolConfig().setCorePoolSize(selectorThreadCount)
+                    .setMaxPoolSize(selectorThreadCount).setPoolName(
+                            "OpenDJ LDAP SDK Grizzly selector thread");
 
-      if (selectorsStr != null)
-      {
-        selectorThreadCount = Integer.parseInt(selectorsStr);
-      }
-      else
-      {
-        selectorThreadCount = useWorkerThreadStrategy ? Math.max(2,
-            cpus / 4) : Math.max(5, (cpus / 2) - 1);
-      }
+            // Calculate the number of worker threads.
+            if (builder.getWorkerThreadPoolConfig() != null) {
+                final String workersStr =
+                        System.getProperty("org.forgerock.opendj.transport.workers");
+                final int workerThreadCount;
 
-      builder.getSelectorThreadPoolConfig()
-          .setCorePoolSize(selectorThreadCount)
-          .setMaxPoolSize(selectorThreadCount)
-          .setPoolName("OpenDJ LDAP SDK Grizzly selector thread");
+                if (workersStr != null) {
+                    workerThreadCount = Integer.parseInt(workersStr);
+                } else {
+                    workerThreadCount = useWorkerThreadStrategy ? Math.max(5, (cpus * 2)) : 0;
+                }
 
-      // Calculate the number of worker threads.
-      if (builder.getWorkerThreadPoolConfig() != null)
-      {
-        final String workersStr = System
-            .getProperty("org.forgerock.opendj.transport.workers");
-        final int workerThreadCount;
+                builder.getWorkerThreadPoolConfig().setCorePoolSize(workerThreadCount)
+                        .setMaxPoolSize(workerThreadCount).setPoolName(
+                                "OpenDJ LDAP SDK Grizzly worker thread");
+            }
 
-        if (workersStr != null)
-        {
-          workerThreadCount = Integer.parseInt(workersStr);
-        }
-        else
-        {
-          workerThreadCount = useWorkerThreadStrategy ? Math.max(5,
-              (cpus * 2)) : 0;
+            // Parse IO related options.
+            final String lingerStr = System.getProperty("org.forgerock.opendj.transport.linger");
+            if (lingerStr != null) {
+                // Disabled by default.
+                builder.setLinger(Integer.parseInt(lingerStr));
+            }
+
+            final String tcpNoDelayStr =
+                    System.getProperty("org.forgerock.opendj.transport.tcpNoDelay");
+            if (tcpNoDelayStr != null) {
+                // Enabled by default.
+                builder.setTcpNoDelay(Boolean.parseBoolean(tcpNoDelayStr));
+            }
+
+            final String reuseAddressStr =
+                    System.getProperty("org.forgerock.opendj.transport.reuseAddress");
+            if (reuseAddressStr != null) {
+                // Enabled by default.
+                builder.setReuseAddress(Boolean.parseBoolean(reuseAddressStr));
+            }
+
+            defaultTransport = builder.build();
+
+            // FIXME: raise bug in Grizzly. We should not need to do this, but
+            // failure
+            // to do so causes many deadlocks.
+            defaultTransport.setSelectorRunnersCount(selectorThreadCount);
+
+            try {
+                defaultTransport.start();
+            } catch (final IOException e) {
+                throw new RuntimeException(e);
+            }
         }
 
-        builder.getWorkerThreadPoolConfig()
-            .setCorePoolSize(workerThreadCount)
-            .setMaxPoolSize(workerThreadCount)
-            .setPoolName("OpenDJ LDAP SDK Grizzly worker thread");
-      }
-
-      // Parse IO related options.
-      final String lingerStr = System
-          .getProperty("org.forgerock.opendj.transport.linger");
-      if (lingerStr != null)
-      {
-        // Disabled by default.
-        builder.setLinger(Integer.parseInt(lingerStr));
-      }
-
-      final String tcpNoDelayStr = System
-          .getProperty("org.forgerock.opendj.transport.tcpNoDelay");
-      if (tcpNoDelayStr != null)
-      {
-        // Enabled by default.
-        builder.setTcpNoDelay(Boolean.parseBoolean(tcpNoDelayStr));
-      }
-
-      final String reuseAddressStr = System
-          .getProperty("org.forgerock.opendj.transport.reuseAddress");
-      if (reuseAddressStr != null)
-      {
-        // Enabled by default.
-        builder
-            .setReuseAddress(Boolean.parseBoolean(reuseAddressStr));
-      }
-
-      defaultTransport = builder.build();
-
-      // FIXME: raise bug in Grizzly. We should not need to do this, but failure
-      // to do so causes many deadlocks.
-      defaultTransport.setSelectorRunnersCount(selectorThreadCount);
-
-      try
-      {
-        defaultTransport.start();
-      }
-      catch (final IOException e)
-      {
-        throw new RuntimeException(e);
-      }
+        return defaultTransport;
     }
 
-    return defaultTransport;
-  }
-
-
-
-  private DefaultTCPNIOTransport()
-  {
-    // Prevent instantiation.
-  }
+    private DefaultTCPNIOTransport() {
+        // Prevent instantiation.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/InternalConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/InternalConnection.java
index 8a1606c..fd13cba 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/InternalConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/InternalConnection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,316 +27,278 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.AbstractAsynchronousConnection;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionEventListener;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.ServerConnection;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
 
 import com.forgerock.opendj.util.CompletedFutureResult;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a pseudo-connection object that can be used for performing
  * internal operations directly against a {@code ServerConnection}
  * implementation.
  */
-public final class InternalConnection extends AbstractAsynchronousConnection
-{
-  private static final class InternalBindFutureResultImpl extends
-      AbstractLDAPFutureResultImpl<BindResult>
-  {
-    private final BindRequest bindRequest;
+public final class InternalConnection extends AbstractAsynchronousConnection {
+    private static final class InternalBindFutureResultImpl extends
+            AbstractLDAPFutureResultImpl<BindResult> {
+        private final BindRequest bindRequest;
 
+        InternalBindFutureResultImpl(final int messageID, final BindRequest bindRequest,
+                final ResultHandler<? super BindResult> resultHandler,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final Connection connection) {
+            super(messageID, resultHandler, intermediateResponseHandler, connection);
+            this.bindRequest = bindRequest;
+        }
 
+        @Override
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("InternalBindFutureResultImpl(");
+            sb.append("bindRequest = ");
+            sb.append(bindRequest);
+            super.toString(sb);
+            sb.append(")");
+            return sb.toString();
+        }
 
-    InternalBindFutureResultImpl(final int messageID,
-        final BindRequest bindRequest,
-        final ResultHandler<? super BindResult> resultHandler,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final Connection connection)
-    {
-      super(messageID, resultHandler, intermediateResponseHandler, connection);
-      this.bindRequest = bindRequest;
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        BindResult newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+                final Throwable cause) {
+            return Responses.newBindResult(resultCode).setDiagnosticMessage(diagnosticMessage)
+                    .setCause(cause);
+        }
     }
 
+    private final ServerConnection<Integer> serverConnection;
+    private final List<ConnectionEventListener> listeners =
+            new CopyOnWriteArrayList<ConnectionEventListener>();
+    private final AtomicInteger messageID = new AtomicInteger();
 
-
-    @Override
-    public String toString()
-    {
-      final StringBuilder sb = new StringBuilder();
-      sb.append("InternalBindFutureResultImpl(");
-      sb.append("bindRequest = ");
-      sb.append(bindRequest);
-      super.toString(sb);
-      sb.append(")");
-      return sb.toString();
+    /**
+     * Sets the server connection associated with this internal connection.
+     *
+     * @param serverConnection
+     *            The server connection.
+     */
+    public InternalConnection(final ServerConnection<Integer> serverConnection) {
+        this.serverConnection = serverConnection;
     }
 
-
-
     /**
      * {@inheritDoc}
      */
     @Override
-    BindResult newErrorResult(final ResultCode resultCode,
-        final String diagnosticMessage, final Throwable cause)
-    {
-      return Responses.newBindResult(resultCode)
-          .setDiagnosticMessage(diagnosticMessage).setCause(cause);
+    public FutureResult<Void> abandonAsync(final AbandonRequest request) {
+        final int i = messageID.getAndIncrement();
+        serverConnection.handleAbandon(i, request);
+        return new CompletedFutureResult<Void>((Void) null, i);
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Result> addAsync(final AddRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(i, request, resultHandler, intermediateResponseHandler,
+                        this);
+        serverConnection.handleAdd(i, request, future, future);
+        return future;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addConnectionEventListener(final ConnectionEventListener listener) {
+        Validator.ensureNotNull(listener);
+        listeners.add(listener);
+    }
 
-  private final ServerConnection<Integer> serverConnection;
-  private final List<ConnectionEventListener> listeners =
-    new CopyOnWriteArrayList<ConnectionEventListener>();
-  private final AtomicInteger messageID = new AtomicInteger();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<BindResult> bindAsync(final BindRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super BindResult> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final InternalBindFutureResultImpl future =
+                new InternalBindFutureResultImpl(i, request, resultHandler,
+                        intermediateResponseHandler, this);
+        serverConnection.handleBind(i, 3, request, future, future);
+        return future;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close(final UnbindRequest request, final String reason) {
+        final int i = messageID.getAndIncrement();
+        serverConnection.handleConnectionClosed(i, request);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<CompareResult> compareAsync(final CompareRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super CompareResult> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPCompareFutureResultImpl future =
+                new LDAPCompareFutureResultImpl(i, request, resultHandler,
+                        intermediateResponseHandler, this);
+        serverConnection.handleCompare(i, request, future, future);
+        return future;
+    }
 
-  /**
-   * Sets the server connection associated with this internal connection.
-   *
-   * @param serverConnection
-   *          The server connection.
-   */
-  public InternalConnection(final ServerConnection<Integer> serverConnection)
-  {
-    this.serverConnection = serverConnection;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Result> deleteAsync(final DeleteRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(i, request, resultHandler, intermediateResponseHandler,
+                        this);
+        serverConnection.handleDelete(i, request, future, future);
+        return future;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
+            final ExtendedRequest<R> request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super R> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPExtendedFutureResultImpl<R> future =
+                new LDAPExtendedFutureResultImpl<R>(i, request, resultHandler,
+                        intermediateResponseHandler, this);
+        serverConnection.handleExtendedRequest(i, request, future, future);
+        return future;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isClosed() {
+        // FIXME: this should be true after close has been called.
+        return false;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Void> abandonAsync(final AbandonRequest request)
-  {
-    final int i = messageID.getAndIncrement();
-    serverConnection.handleAbandon(i, request);
-    return new CompletedFutureResult<Void>((Void) null, i);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isValid() {
+        // FIXME: this should be false if this connection is disconnected.
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Result> modifyAsync(final ModifyRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(i, request, resultHandler, intermediateResponseHandler,
+                        this);
+        serverConnection.handleModify(i, request, future, future);
+        return future;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(i, request, resultHandler, intermediateResponseHandler,
+                        this);
+        serverConnection.handleModifyDN(i, request, future, future);
+        return future;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Result> addAsync(final AddRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(i, request,
-        resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleAdd(i, request, future, future);
-    return future;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeConnectionEventListener(final ConnectionEventListener listener) {
+        Validator.ensureNotNull(listener);
+        listeners.remove(listener);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Result> searchAsync(final SearchRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final SearchResultHandler resultHandler) {
+        final int i = messageID.getAndIncrement();
+        final LDAPSearchFutureResultImpl future =
+                new LDAPSearchFutureResultImpl(i, request, resultHandler,
+                        intermediateResponseHandler, this);
+        serverConnection.handleSearch(i, request, future, future);
+        return future;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void addConnectionEventListener(final ConnectionEventListener listener)
-  {
-    Validator.ensureNotNull(listener);
-    listeners.add(listener);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<BindResult> bindAsync(final BindRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super BindResult> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final InternalBindFutureResultImpl future = new InternalBindFutureResultImpl(
-        i, request, resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleBind(i, 3, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close(final UnbindRequest request, final String reason)
-  {
-    final int i = messageID.getAndIncrement();
-    serverConnection.handleConnectionClosed(i, request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<CompareResult> compareAsync(final CompareRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super CompareResult> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPCompareFutureResultImpl future = new LDAPCompareFutureResultImpl(
-        i, request, resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleCompare(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Result> deleteAsync(final DeleteRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(i, request,
-        resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleDelete(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-      final ExtendedRequest<R> request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super R> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPExtendedFutureResultImpl<R> future = new LDAPExtendedFutureResultImpl<R>(
-        i, request, resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleExtendedRequest(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isClosed()
-  {
-    // FIXME: this should be true after close has been called.
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isValid()
-  {
-    // FIXME: this should be false if this connection is disconnected.
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Result> modifyAsync(final ModifyRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(i, request,
-        resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleModify(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(i, request,
-        resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleModifyDN(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void removeConnectionEventListener(
-      final ConnectionEventListener listener)
-  {
-    Validator.ensureNotNull(listener);
-    listeners.remove(listener);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Result> searchAsync(final SearchRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final SearchResultHandler resultHandler)
-  {
-    final int i = messageID.getAndIncrement();
-    final LDAPSearchFutureResultImpl future = new LDAPSearchFutureResultImpl(i,
-        request, resultHandler, intermediateResponseHandler, this);
-    serverConnection.handleSearch(i, request, future, future);
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    StringBuilder builder = new StringBuilder();
-    builder.append("InternalConnection(");
-    builder.append(String.valueOf(serverConnection));
-    builder.append(')');
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("InternalConnection(");
+        builder.append(String.valueOf(serverConnection));
+        builder.append(')');
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPBindFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPBindFutureResultImpl.java
index c790b86..e8309ce 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPBindFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPBindFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.ResultCode;
@@ -38,68 +35,50 @@
 import org.forgerock.opendj.ldap.responses.BindResult;
 import org.forgerock.opendj.ldap.responses.Responses;
 
-
-
 /**
  * Bind result future implementation.
  */
-final class LDAPBindFutureResultImpl extends
-    AbstractLDAPFutureResultImpl<BindResult>
-{
-  private final BindClient bindClient;
+final class LDAPBindFutureResultImpl extends AbstractLDAPFutureResultImpl<BindResult> {
+    private final BindClient bindClient;
 
+    LDAPBindFutureResultImpl(final int requestID, final BindClient bindClient,
+            final ResultHandler<? super BindResult> resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(requestID, resultHandler, intermediateResponseHandler, connection);
+        this.bindClient = bindClient;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean isCancelable() {
+        return false;
+    }
 
-  LDAPBindFutureResultImpl(final int requestID, final BindClient bindClient,
-      final ResultHandler<? super BindResult> resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(requestID, resultHandler, intermediateResponseHandler, connection);
-    this.bindClient = bindClient;
-  }
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("LDAPBindFutureResultImpl(");
+        sb.append("bindClient = ");
+        sb.append(bindClient);
+        super.toString(sb);
+        sb.append(")");
+        return sb.toString();
+    }
 
+    BindClient getBindClient() {
+        return bindClient;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected boolean isCancelable() {
-    return false;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder sb = new StringBuilder();
-    sb.append("LDAPBindFutureResultImpl(");
-    sb.append("bindClient = ");
-    sb.append(bindClient);
-    super.toString(sb);
-    sb.append(")");
-    return sb.toString();
-  }
-
-
-
-  BindClient getBindClient()
-  {
-    return bindClient;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  BindResult newErrorResult(final ResultCode resultCode,
-      final String diagnosticMessage, final Throwable cause)
-  {
-    return Responses.newBindResult(resultCode).setDiagnosticMessage(
-        diagnosticMessage).setCause(cause);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    BindResult newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+            final Throwable cause) {
+        return Responses.newBindResult(resultCode).setDiagnosticMessage(diagnosticMessage)
+                .setCause(cause);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPClientFilter.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPClientFilter.java
index 8635ad5..70b3d49 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPClientFilter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPClientFilter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.OID_NOTICE_OF_DISCONNECTION;
 
 import java.io.EOFException;
@@ -41,8 +38,21 @@
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindClient;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.IntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.glassfish.grizzly.Buffer;
 import org.glassfish.grizzly.Connection;
 import org.glassfish.grizzly.EmptyCompletionHandler;
@@ -52,593 +62,458 @@
 import org.glassfish.grizzly.filterchain.FilterChainContext;
 import org.glassfish.grizzly.filterchain.NextAction;
 
-
-
 /**
  * Grizzly filter implementation for decoding LDAP responses and handling client
  * side logic for SSL and SASL operations over LDAP.
  */
-final class LDAPClientFilter extends BaseFilter
-{
-  private static final Attribute<LDAPConnection> LDAP_CONNECTION_ATTR =
-    Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPClientConnection");
-  private static final Attribute<ASN1BufferReader> LDAP_ASN1_READER_ATTR =
-    Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPASN1Reader");
+final class LDAPClientFilter extends BaseFilter {
+    private static final Attribute<LDAPConnection> LDAP_CONNECTION_ATTR =
+            Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPClientConnection");
+    private static final Attribute<ASN1BufferReader> LDAP_ASN1_READER_ATTR =
+            Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPASN1Reader");
 
-  private final int maxASN1ElementSize;
-  private final LDAPReader ldapReader;
+    private final int maxASN1ElementSize;
+    private final LDAPReader ldapReader;
 
-  private static final AbstractLDAPMessageHandler<FilterChainContext>
-    CLIENT_RESPONSE_HANDLER = new AbstractLDAPMessageHandler<FilterChainContext>()
-  {
-    @Override
-    public void addResult(final FilterChainContext ctx, final int messageID,
-        final Result result) throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
+    private static final AbstractLDAPMessageHandler<FilterChainContext> CLIENT_RESPONSE_HANDLER =
+            new AbstractLDAPMessageHandler<FilterChainContext>() {
+                @Override
+                public void addResult(final FilterChainContext ctx, final int messageID,
+                        final Result result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPFutureResultImpl)
-          {
-            final LDAPFutureResultImpl future =
-                (LDAPFutureResultImpl) pendingRequest;
-            if (future.getRequest() instanceof AddRequest)
-            {
-              future.setResultOrError(result);
-              return;
-            }
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
-
-
-
-    @Override
-    public void bindResult(final FilterChainContext ctx, final int messageID,
-        final BindResult result) throws UnexpectedResponseException,
-        IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
-
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPBindFutureResultImpl)
-          {
-            final LDAPBindFutureResultImpl future =
-                ((LDAPBindFutureResultImpl) pendingRequest);
-            final BindClient bindClient = future.getBindClient();
-
-            try
-            {
-              if (!bindClient.evaluateResult(result))
-              {
-                // The server is expecting a multi stage bind response.
-                final int msgID =
-                    ldapConnection.continuePendingBindRequest(future);
-
-                final ASN1BufferWriter asn1Writer =
-                    ASN1BufferWriter.getWriter();
-                try
-                {
-                  final GenericBindRequest nextRequest = bindClient
-                      .nextBindRequest();
-                  new LDAPWriter().bindRequest(asn1Writer, msgID, 3,
-                      nextRequest);
-                  ctx.write(asn1Writer.getBuffer(), null);
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPFutureResultImpl) {
+                                final LDAPFutureResultImpl future =
+                                        (LDAPFutureResultImpl) pendingRequest;
+                                if (future.getRequest() instanceof AddRequest) {
+                                    future.setResultOrError(result);
+                                    return;
+                                }
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
                 }
-                finally
-                {
-                  asn1Writer.recycle();
+
+                @Override
+                public void bindResult(final FilterChainContext ctx, final int messageID,
+                        final BindResult result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
+
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPBindFutureResultImpl) {
+                                final LDAPBindFutureResultImpl future =
+                                        ((LDAPBindFutureResultImpl) pendingRequest);
+                                final BindClient bindClient = future.getBindClient();
+
+                                try {
+                                    if (!bindClient.evaluateResult(result)) {
+                                        // The server is expecting a multi stage
+                                        // bind response.
+                                        final int msgID =
+                                                ldapConnection.continuePendingBindRequest(future);
+
+                                        final ASN1BufferWriter asn1Writer =
+                                                ASN1BufferWriter.getWriter();
+                                        try {
+                                            final GenericBindRequest nextRequest =
+                                                    bindClient.nextBindRequest();
+                                            new LDAPWriter().bindRequest(asn1Writer, msgID, 3,
+                                                    nextRequest);
+                                            ctx.write(asn1Writer.getBuffer(), null);
+                                        } finally {
+                                            asn1Writer.recycle();
+                                        }
+                                        return;
+                                    }
+                                } catch (final ErrorResultException e) {
+                                    future.adaptErrorResult(e.getResult());
+                                    return;
+                                } catch (final IOException e) {
+                                    // FIXME: I18N need to have a better error
+                                    // message.
+                                    // FIXME: Is this the best result code?
+                                    final Result errorResult =
+                                            Responses
+                                                    .newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
+                                                    .setDiagnosticMessage(
+                                                            "An error occurred during multi-stage authentication")
+                                                    .setCause(e);
+                                    future.adaptErrorResult(errorResult);
+                                    return;
+                                }
+
+                                if (result.getResultCode() == ResultCode.SUCCESS) {
+                                    final ConnectionSecurityLayer l =
+                                            bindClient.getConnectionSecurityLayer();
+                                    if (l != null) {
+                                        // The connection needs to be secured by
+                                        // the SASL
+                                        // mechanism.
+                                        ldapConnection
+                                                .installFilter(new ConnectionSecurityLayerFilter(l,
+                                                        ctx.getConnection().getTransport()
+                                                                .getMemoryManager()));
+                                    }
+                                }
+
+                                ldapConnection.setBindOrStartTLSInProgress(false);
+                                future.setResultOrError(result);
+                                return;
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
                 }
-                return;
-              }
-            }
-            catch (final ErrorResultException e)
-            {
-              future.adaptErrorResult(e.getResult());
-              return;
-            }
-            catch (final IOException e)
-            {
-              // FIXME: I18N need to have a better error message.
-              // FIXME: Is this the best result code?
-              final Result errorResult = Responses.newResult(
-                  ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-                  "An error occurred during multi-stage authentication")
-                  .setCause(e);
-              future.adaptErrorResult(errorResult);
-              return;
-            }
 
-            if (result.getResultCode() == ResultCode.SUCCESS)
-            {
-              final ConnectionSecurityLayer l = bindClient
-                  .getConnectionSecurityLayer();
-              if (l != null)
-              {
-                // The connection needs to be secured by the SASL
-                // mechanism.
-                ldapConnection.installFilter(new ConnectionSecurityLayerFilter(l, ctx
-                    .getConnection().getTransport().getMemoryManager()));
-              }
-            }
+                @Override
+                public void compareResult(final FilterChainContext ctx, final int messageID,
+                        final CompareResult result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
-            ldapConnection.setBindOrStartTLSInProgress(false);
-            future.setResultOrError(result);
-            return;
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPCompareFutureResultImpl) {
+                                final LDAPCompareFutureResultImpl future =
+                                        (LDAPCompareFutureResultImpl) pendingRequest;
+                                future.setResultOrError(result);
+                                return;
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
+                }
 
+                @Override
+                public void deleteResult(final FilterChainContext ctx, final int messageID,
+                        final Result result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPFutureResultImpl) {
+                                final LDAPFutureResultImpl future =
+                                        (LDAPFutureResultImpl) pendingRequest;
+                                if (future.getRequest() instanceof DeleteRequest) {
+                                    future.setResultOrError(result);
+                                    return;
+                                }
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
+                }
 
-    @Override
-    public void compareResult(final FilterChainContext ctx,
-        final int messageID, final CompareResult result)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
+                @Override
+                public void extendedResult(final FilterChainContext ctx, final int messageID,
+                        final ExtendedResult result) throws UnexpectedResponseException,
+                        IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        if (messageID == 0) {
+                            if ((result.getOID() != null)
+                                    && result.getOID().equals(OID_NOTICE_OF_DISCONNECTION)) {
 
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPCompareFutureResultImpl)
-          {
-            final LDAPCompareFutureResultImpl future =
-                (LDAPCompareFutureResultImpl) pendingRequest;
-            future.setResultOrError(result);
-            return;
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
+                                final Result errorResult =
+                                        Responses
+                                                .newResult(result.getResultCode())
+                                                .setDiagnosticMessage(result.getDiagnosticMessage());
+                                ldapConnection.close(null, true, errorResult);
+                                return;
+                            } else {
+                                // Unsolicited notification received.
+                                ldapConnection.handleUnsolicitedNotification(result);
+                            }
+                        }
 
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPExtendedFutureResultImpl<?>) {
+                                final LDAPExtendedFutureResultImpl<?> extendedFuture =
+                                        ((LDAPExtendedFutureResultImpl<?>) pendingRequest);
+                                try {
+                                    handleExtendedResult0(ldapConnection, extendedFuture, result);
+                                } catch (final DecodeException de) {
+                                    // FIXME: should the connection be closed as
+                                    // well?
+                                    final Result errorResult =
+                                            Responses.newResult(
+                                                    ResultCode.CLIENT_SIDE_DECODING_ERROR)
+                                                    .setDiagnosticMessage(de.getLocalizedMessage())
+                                                    .setCause(de);
+                                    extendedFuture.adaptErrorResult(errorResult);
+                                }
+                            } else {
+                                throw new UnexpectedResponseException(messageID, result);
+                            }
+                        }
+                    }
+                }
 
-    @Override
-    public void deleteResult(final FilterChainContext ctx, final int messageID,
-        final Result result) throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
+                @Override
+                public void intermediateResponse(final FilterChainContext ctx, final int messageID,
+                        final IntermediateResponse response) throws UnexpectedResponseException,
+                        IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.getPendingRequest(messageID);
 
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPFutureResultImpl)
-          {
-            final LDAPFutureResultImpl future =
-                (LDAPFutureResultImpl) pendingRequest;
-            if (future.getRequest() instanceof DeleteRequest)
-            {
-              future.setResultOrError(result);
-              return;
-            }
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
+                        if (pendingRequest != null) {
+                            pendingRequest.handleIntermediateResponse(response);
+                        }
+                    }
+                }
 
+                @Override
+                public void modifyDNResult(final FilterChainContext ctx, final int messageID,
+                        final Result result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPFutureResultImpl) {
+                                final LDAPFutureResultImpl future =
+                                        (LDAPFutureResultImpl) pendingRequest;
+                                if (future.getRequest() instanceof ModifyDNRequest) {
+                                    future.setResultOrError(result);
+                                    return;
+                                }
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
+                }
 
-    @Override
-    public void extendedResult(final FilterChainContext ctx,
-        final int messageID, final ExtendedResult result)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        if (messageID == 0)
-        {
-          if ((result.getOID() != null)
-              && result.getOID().equals(OID_NOTICE_OF_DISCONNECTION))
-          {
+                @Override
+                public void modifyResult(final FilterChainContext ctx, final int messageID,
+                        final Result result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
-            final Result errorResult = Responses
-                .newResult(result.getResultCode()).setDiagnosticMessage(
-                    result.getDiagnosticMessage());
-            ldapConnection.close(null, true, errorResult);
-            return;
-          }
-          else
-          {
-            // Unsolicited notification received.
-            ldapConnection.handleUnsolicitedNotification(result);
-          }
-        }
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPFutureResultImpl) {
+                                final LDAPFutureResultImpl future =
+                                        (LDAPFutureResultImpl) pendingRequest;
+                                if (future.getRequest() instanceof ModifyRequest) {
+                                    future.setResultOrError(result);
+                                    return;
+                                }
+                            }
+                            throw new UnexpectedResponseException(messageID, result);
+                        }
+                    }
+                }
 
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
+                @Override
+                public void searchResult(final FilterChainContext ctx, final int messageID,
+                        final Result result) throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.removePendingRequest(messageID);
 
-        if(pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPExtendedFutureResultImpl<?>)
-          {
-            final LDAPExtendedFutureResultImpl<?> extendedFuture =
-              ((LDAPExtendedFutureResultImpl<?>) pendingRequest);
-            try
-            {
-              handleExtendedResult0(ldapConnection, extendedFuture, result);
-            }
-            catch (final DecodeException de)
-            {
-              // FIXME: should the connection be closed as well?
-              final Result errorResult = Responses.newResult(
-                  ResultCode.CLIENT_SIDE_DECODING_ERROR).setDiagnosticMessage(
-                  de.getLocalizedMessage()).setCause(de);
-              extendedFuture.adaptErrorResult(errorResult);
-            }
-          }
-          else
-          {
-            throw new UnexpectedResponseException(messageID, result);
-          }
-        }
-      }
-    }
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPSearchFutureResultImpl) {
+                                ((LDAPSearchFutureResultImpl) pendingRequest)
+                                        .setResultOrError(result);
+                            } else {
+                                throw new UnexpectedResponseException(messageID, result);
+                            }
+                        }
+                    }
+                }
 
+                @Override
+                public void searchResultEntry(final FilterChainContext ctx, final int messageID,
+                        final SearchResultEntry entry) throws UnexpectedResponseException,
+                        IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.getPendingRequest(messageID);
 
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPSearchFutureResultImpl) {
+                                ((LDAPSearchFutureResultImpl) pendingRequest).handleEntry(entry);
+                            } else {
+                                throw new UnexpectedResponseException(messageID, entry);
+                            }
+                        }
+                    }
+                }
 
-    @Override
-    public void intermediateResponse(final FilterChainContext ctx,
-        final int messageID, final IntermediateResponse response)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .getPendingRequest(messageID);
+                @Override
+                public void searchResultReference(final FilterChainContext ctx,
+                        final int messageID, final SearchResultReference reference)
+                        throws UnexpectedResponseException, IOException {
+                    final LDAPConnection ldapConnection =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (ldapConnection != null) {
+                        final AbstractLDAPFutureResultImpl<?> pendingRequest =
+                                ldapConnection.getPendingRequest(messageID);
 
-        if (pendingRequest != null)
-        {
-          pendingRequest.handleIntermediateResponse(response);
-        }
-      }
-    }
+                        if (pendingRequest != null) {
+                            if (pendingRequest instanceof LDAPSearchFutureResultImpl) {
+                                ((LDAPSearchFutureResultImpl) pendingRequest)
+                                        .handleReference(reference);
+                            } else {
+                                throw new UnexpectedResponseException(messageID, reference);
+                            }
+                        }
+                    }
+                }
 
+                // Needed in order to expose type information.
+                private <R extends ExtendedResult> void handleExtendedResult0(
+                        final LDAPConnection conn, final LDAPExtendedFutureResultImpl<R> future,
+                        final ExtendedResult result) throws DecodeException {
+                    final R decodedResponse =
+                            future.decodeResult(result, conn.getLDAPOptions().getDecodeOptions());
 
+                    if (future.getRequest() instanceof StartTLSExtendedRequest) {
+                        if (result.getResultCode() == ResultCode.SUCCESS) {
+                            try {
+                                final StartTLSExtendedRequest request =
+                                        (StartTLSExtendedRequest) future.getRequest();
+                                conn.startTLS(request.getSSLContext(), request
+                                        .getEnabledProtocols(), request.getEnabledCipherSuites(),
+                                        new EmptyCompletionHandler<SSLEngine>() {
+                                            @Override
+                                            public void completed(final SSLEngine result) {
+                                                conn.setBindOrStartTLSInProgress(false);
+                                                future.setResultOrError(decodedResponse);
+                                            }
 
-    @Override
-    public void modifyDNResult(final FilterChainContext ctx,
-        final int messageID, final Result result)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
+                                            @Override
+                                            public void failed(final Throwable throwable) {
+                                                final Result errorResult =
+                                                        Responses.newResult(
+                                                                ResultCode.CLIENT_SIDE_LOCAL_ERROR)
+                                                                .setCause(throwable)
+                                                                .setDiagnosticMessage(
+                                                                        "SSL handshake failed");
+                                                conn.setBindOrStartTLSInProgress(false);
+                                                conn.close(null, false, errorResult);
+                                                future.adaptErrorResult(errorResult);
+                                            }
+                                        });
+                                return;
+                            } catch (final IOException e) {
+                                final Result errorResult =
+                                        Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
+                                                .setCause(e).setDiagnosticMessage(e.getMessage());
+                                future.adaptErrorResult(errorResult);
+                                conn.close(null, false, errorResult);
+                                return;
+                            }
+                        }
+                    }
 
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPFutureResultImpl)
-          {
-            final LDAPFutureResultImpl future =
-                (LDAPFutureResultImpl) pendingRequest;
-            if (future.getRequest() instanceof ModifyDNRequest)
-            {
-              future.setResultOrError(result);
-              return;
-            }
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
-
-
-
-    @Override
-    public void modifyResult(final FilterChainContext ctx, final int messageID,
-        final Result result) throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
-
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPFutureResultImpl)
-          {
-            final LDAPFutureResultImpl future =
-                (LDAPFutureResultImpl) pendingRequest;
-            if (future.getRequest() instanceof ModifyRequest)
-            {
-              future.setResultOrError(result);
-              return;
-            }
-          }
-          throw new UnexpectedResponseException(messageID, result);
-        }
-      }
-    }
-
-
-
-    @Override
-    public void searchResult(final FilterChainContext ctx, final int messageID,
-        final Result result) throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .removePendingRequest(messageID);
-
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPSearchFutureResultImpl)
-          {
-            ((LDAPSearchFutureResultImpl) pendingRequest)
-                .setResultOrError(result);
-          }
-          else
-          {
-            throw new UnexpectedResponseException(messageID, result);
-          }
-        }
-      }
-    }
-
-
-
-    @Override
-    public void searchResultEntry(final FilterChainContext ctx,
-        final int messageID, final SearchResultEntry entry)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .getPendingRequest(messageID);
-
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPSearchFutureResultImpl)
-          {
-            ((LDAPSearchFutureResultImpl) pendingRequest).handleEntry(entry);
-          }
-          else
-          {
-            throw new UnexpectedResponseException(messageID, entry);
-          }
-        }
-      }
-    }
-
-
-
-    @Override
-    public void searchResultReference(final FilterChainContext ctx,
-        final int messageID, final SearchResultReference reference)
-        throws UnexpectedResponseException, IOException
-    {
-      final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if(ldapConnection != null)
-      {
-        final AbstractLDAPFutureResultImpl<?> pendingRequest = ldapConnection
-            .getPendingRequest(messageID);
-
-        if (pendingRequest != null)
-        {
-          if (pendingRequest instanceof LDAPSearchFutureResultImpl)
-          {
-            ((LDAPSearchFutureResultImpl) pendingRequest)
-                .handleReference(reference);
-          }
-          else
-          {
-            throw new UnexpectedResponseException(messageID, reference);
-          }
-        }
-      }
-    }
-
-
-
-    // Needed in order to expose type information.
-    private <R extends ExtendedResult> void handleExtendedResult0(
-        final LDAPConnection conn,
-        final LDAPExtendedFutureResultImpl<R> future,
-        final ExtendedResult result) throws DecodeException
-    {
-      final R decodedResponse = future.decodeResult(result, conn
-          .getLDAPOptions().getDecodeOptions());
-
-      if (future.getRequest() instanceof StartTLSExtendedRequest)
-      {
-        if (result.getResultCode() == ResultCode.SUCCESS)
-        {
-          try
-          {
-            final StartTLSExtendedRequest request = (StartTLSExtendedRequest) future
-                .getRequest();
-            conn.startTLS(request.getSSLContext(),
-                request.getEnabledProtocols(), request.getEnabledCipherSuites(),
-                new EmptyCompletionHandler<SSLEngine>()
-                {
-                  @Override
-                  public void completed(final SSLEngine result)
-                  {
-                    conn.setBindOrStartTLSInProgress(false);
                     future.setResultOrError(decodedResponse);
-                  }
+                }
+            };
 
+    LDAPClientFilter(final LDAPReader ldapReader, final int maxASN1ElementSize) {
+        this.ldapReader = ldapReader;
+        this.maxASN1ElementSize = maxASN1ElementSize;
+    }
 
-
-                  @Override
-                  public void failed(final Throwable throwable)
-                  {
-                    final Result errorResult = Responses.newResult(
-                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setCause(throwable)
-                        .setDiagnosticMessage("SSL handshake failed");
-                    conn.setBindOrStartTLSInProgress(false);
-                    conn.close(null, false, errorResult);
-                    future.adaptErrorResult(errorResult);
-                  }
-                });
+    @Override
+    public void exceptionOccurred(final FilterChainContext ctx, final Throwable error) {
+        final Connection<?> connection = ctx.getConnection();
+        if (!connection.isOpen()) {
+            // Grizzly doens't not deregister the read interest from the
+            // selector so closing the connection results in an
+            // EOFException.
+            // Just ignore errors on closed connections.
             return;
-          }
-          catch (final IOException e)
-          {
-            final Result errorResult = Responses.newResult(
-                ResultCode.CLIENT_SIDE_LOCAL_ERROR).setCause(e)
-                .setDiagnosticMessage(e.getMessage());
-            future.adaptErrorResult(errorResult);
-            conn.close(null, false, errorResult);
-            return;
-          }
         }
-      }
+        final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(connection);
 
-      future.setResultOrError(decodedResponse);
-    }
-  };
-
-
-
-  LDAPClientFilter(final LDAPReader ldapReader, final int maxASN1ElementSize)
-  {
-    this.ldapReader = ldapReader;
-    this.maxASN1ElementSize = maxASN1ElementSize;
-  }
-
-
-
-  @Override
-  public void exceptionOccurred(final FilterChainContext ctx,
-      final Throwable error)
-  {
-    final Connection<?> connection = ctx.getConnection();
-    if (!connection.isOpen())
-    {
-      // Grizzly doens't not deregister the read interest from the
-      // selector so closing the connection results in an
-      // EOFException.
-      // Just ignore errors on closed connections.
-      return;
-    }
-    final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(connection);
-
-    Result errorResult;
-    if (error instanceof EOFException)
-    {
-      // FIXME: Is this the best result code?
-      errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_SERVER_DOWN)
-          .setCause(error);
-    }
-    else
-    {
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
-          .setCause(error);
-    }
-    ldapConnection.close(null, false, errorResult);
-  }
-
-
-
-  @Override
-  public NextAction handleClose(final FilterChainContext ctx)
-      throws IOException
-  {
-    final Connection<?> connection = ctx.getConnection();
-    final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR
-        .remove(connection);
-    if (ldapConnection != null)
-    {
-      TimeoutChecker.INSTANCE.removeConnection(ldapConnection);
-      final Result errorResult = Responses
-          .newResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
-      ldapConnection.close(null, false, errorResult);
-    }
-    return ctx.getInvokeAction();
-  }
-
-
-
-  @Override
-  public NextAction handleRead(final FilterChainContext ctx) throws IOException
-  {
-    final Buffer buffer = (Buffer) ctx.getMessage();
-    ASN1BufferReader asn1Reader = LDAP_ASN1_READER_ATTR
-        .get(ctx.getConnection());
-    if (asn1Reader == null)
-    {
-      asn1Reader = new ASN1BufferReader(maxASN1ElementSize, ctx.getConnection()
-          .getTransport().getMemoryManager());
-      LDAP_ASN1_READER_ATTR.set(ctx.getConnection(), asn1Reader);
-    }
-    asn1Reader.appendBytesRead(buffer);
-
-    try
-    {
-      while (asn1Reader.elementAvailable())
-      {
-        ldapReader.decode(asn1Reader, CLIENT_RESPONSE_HANDLER, ctx);
-      }
-    }
-    catch(IOException ioe)
-    {
-      final LDAPConnection ldapConnection =
-          LDAP_CONNECTION_ATTR.get(ctx.getConnection());
-      final Result errorResult =
-          Responses.newResult(ResultCode.CLIENT_SIDE_DECODING_ERROR)
-              .setCause(ioe).setDiagnosticMessage(ioe.getMessage());
-      ldapConnection.close(null, false, errorResult);
-      throw ioe;
-    }
-    finally
-    {
-      asn1Reader.disposeBytesRead();
+        Result errorResult;
+        if (error instanceof EOFException) {
+            // FIXME: Is this the best result code?
+            errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_SERVER_DOWN).setCause(error);
+        } else {
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR).setCause(error);
+        }
+        ldapConnection.close(null, false, errorResult);
     }
 
-    return ctx.getStopAction();
-  }
+    @Override
+    public NextAction handleClose(final FilterChainContext ctx) throws IOException {
+        final Connection<?> connection = ctx.getConnection();
+        final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.remove(connection);
+        if (ldapConnection != null) {
+            TimeoutChecker.INSTANCE.removeConnection(ldapConnection);
+            final Result errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
+            ldapConnection.close(null, false, errorResult);
+        }
+        return ctx.getInvokeAction();
+    }
 
+    @Override
+    public NextAction handleRead(final FilterChainContext ctx) throws IOException {
+        final Buffer buffer = (Buffer) ctx.getMessage();
+        ASN1BufferReader asn1Reader = LDAP_ASN1_READER_ATTR.get(ctx.getConnection());
+        if (asn1Reader == null) {
+            asn1Reader =
+                    new ASN1BufferReader(maxASN1ElementSize, ctx.getConnection().getTransport()
+                            .getMemoryManager());
+            LDAP_ASN1_READER_ATTR.set(ctx.getConnection(), asn1Reader);
+        }
+        asn1Reader.appendBytesRead(buffer);
 
+        try {
+            while (asn1Reader.elementAvailable()) {
+                ldapReader.decode(asn1Reader, CLIENT_RESPONSE_HANDLER, ctx);
+            }
+        } catch (IOException ioe) {
+            final LDAPConnection ldapConnection = LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_DECODING_ERROR).setCause(ioe)
+                            .setDiagnosticMessage(ioe.getMessage());
+            ldapConnection.close(null, false, errorResult);
+            throw ioe;
+        } finally {
+            asn1Reader.disposeBytesRead();
+        }
 
-  void registerConnection(final Connection<?> connection,
-      final LDAPConnection ldapConnection)
-  {
-    TimeoutChecker.INSTANCE.addConnection(ldapConnection);
-    LDAP_CONNECTION_ATTR.set(connection, ldapConnection);
-  }
+        return ctx.getStopAction();
+    }
+
+    void registerConnection(final Connection<?> connection, final LDAPConnection ldapConnection) {
+        TimeoutChecker.INSTANCE.addConnection(ldapConnection);
+        LDAP_CONNECTION_ATTR.set(connection, ldapConnection);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPCompareFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPCompareFutureResultImpl.java
index 326d8e3..8242731 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPCompareFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPCompareFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.ResultCode;
@@ -38,59 +35,42 @@
 import org.forgerock.opendj.ldap.responses.CompareResult;
 import org.forgerock.opendj.ldap.responses.Responses;
 
-
-
 /**
  * Compare result future implementation.
  */
-final class LDAPCompareFutureResultImpl extends
-    AbstractLDAPFutureResultImpl<CompareResult>
-{
-  private final CompareRequest request;
+final class LDAPCompareFutureResultImpl extends AbstractLDAPFutureResultImpl<CompareResult> {
+    private final CompareRequest request;
 
+    LDAPCompareFutureResultImpl(final int requestID, final CompareRequest request,
+            final ResultHandler<? super CompareResult> resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(requestID, resultHandler, intermediateResponseHandler, connection);
+        this.request = request;
+    }
 
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("LDAPCompareFutureResultImpl(");
+        sb.append("request = ");
+        sb.append(request);
+        super.toString(sb);
+        sb.append(")");
+        return sb.toString();
+    }
 
-  LDAPCompareFutureResultImpl(final int requestID,
-      final CompareRequest request,
-      final ResultHandler<? super CompareResult> resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(requestID, resultHandler, intermediateResponseHandler, connection);
-    this.request = request;
-  }
+    CompareRequest getRequest() {
+        return request;
+    }
 
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder sb = new StringBuilder();
-    sb.append("LDAPCompareFutureResultImpl(");
-    sb.append("request = ");
-    sb.append(request);
-    super.toString(sb);
-    sb.append(")");
-    return sb.toString();
-  }
-
-
-
-  CompareRequest getRequest()
-  {
-    return request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  CompareResult newErrorResult(final ResultCode resultCode,
-      final String diagnosticMessage, final Throwable cause)
-  {
-    return Responses.newCompareResult(resultCode).setDiagnosticMessage(
-        diagnosticMessage).setCause(cause);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    CompareResult newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+            final Throwable cause) {
+        return Responses.newCompareResult(resultCode).setDiagnosticMessage(diagnosticMessage)
+                .setCause(cause);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
index 1988d9d..3659b85 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.io.IOException;
@@ -44,9 +41,35 @@
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.AbstractAsynchronousConnection;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionEventListener;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LDAPOptions;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindClient;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
 import org.glassfish.grizzly.CompletionHandler;
 import org.glassfish.grizzly.filterchain.Filter;
 import org.glassfish.grizzly.filterchain.FilterChain;
@@ -58,1041 +81,807 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * LDAP connection implementation.
  * <p>
  * TODO: handle illegal state exceptions.
  */
-final class LDAPConnection extends AbstractAsynchronousConnection implements
-    Connection
-{
-  private final org.glassfish.grizzly.Connection<?> connection;
-  private Result connectionInvalidReason;
-  private boolean isClosed = false;
-  private final List<ConnectionEventListener> listeners =
-      new CopyOnWriteArrayList<ConnectionEventListener>();
-  private final AtomicInteger nextMsgID = new AtomicInteger(1);
-  private final AtomicBoolean bindOrStartTLSInProgress = new AtomicBoolean(
-      false);
-  private final ConcurrentHashMap<Integer, AbstractLDAPFutureResultImpl<?>> pendingRequests =
-      new ConcurrentHashMap<Integer, AbstractLDAPFutureResultImpl<?>>();
-  private final Object stateLock = new Object();
-  private final LDAPWriter ldapWriter = new LDAPWriter();
-  private final LDAPOptions options;
+final class LDAPConnection extends AbstractAsynchronousConnection implements Connection {
+    private final org.glassfish.grizzly.Connection<?> connection;
+    private Result connectionInvalidReason;
+    private boolean isClosed = false;
+    private final List<ConnectionEventListener> listeners =
+            new CopyOnWriteArrayList<ConnectionEventListener>();
+    private final AtomicInteger nextMsgID = new AtomicInteger(1);
+    private final AtomicBoolean bindOrStartTLSInProgress = new AtomicBoolean(false);
+    private final ConcurrentHashMap<Integer, AbstractLDAPFutureResultImpl<?>> pendingRequests =
+            new ConcurrentHashMap<Integer, AbstractLDAPFutureResultImpl<?>>();
+    private final Object stateLock = new Object();
+    private final LDAPWriter ldapWriter = new LDAPWriter();
+    private final LDAPOptions options;
 
-
-
-  /**
-   * Creates a new LDAP connection.
-   *
-   * @param connection
-   *          The Grizzly connection.
-   * @param options
-   *          The LDAP client options.
-   */
-  LDAPConnection(final org.glassfish.grizzly.Connection<?> connection,
-      final LDAPOptions options)
-  {
-    this.connection = connection;
-    this.options = options;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Void> abandonAsync(final AbandonRequest request)
-  {
-    final AbstractLDAPFutureResultImpl<?> pendingRequest;
-    final int messageID = nextMsgID.getAndIncrement();
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        return new CompletedFutureResult<Void>(
-            newErrorResult(connectionInvalidReason), messageID);
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        final Result errorResult = Responses.newResult(
-            ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-            "Bind or Start TLS operation in progress");
-        return new CompletedFutureResult<Void>(newErrorResult(errorResult),
-            messageID);
-      }
-
-      // First remove the future associated with the request to be abandoned.
-      pendingRequest = pendingRequests.remove(request.getRequestID());
+    /**
+     * Creates a new LDAP connection.
+     *
+     * @param connection
+     *            The Grizzly connection.
+     * @param options
+     *            The LDAP client options.
+     */
+    LDAPConnection(final org.glassfish.grizzly.Connection<?> connection, final LDAPOptions options) {
+        this.connection = connection;
+        this.options = options;
     }
 
-    if (pendingRequest == null)
-    {
-      // There has never been a request with the specified message ID or the
-      // response has already been received and handled. We can ignore this
-      // abandon request.
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Void> abandonAsync(final AbandonRequest request) {
+        final AbstractLDAPFutureResultImpl<?> pendingRequest;
+        final int messageID = nextMsgID.getAndIncrement();
 
-      // Message ID will be -1 since no request was sent.
-      return new CompletedFutureResult<Void>((Void) null);
-    }
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                return new CompletedFutureResult<Void>(newErrorResult(connectionInvalidReason),
+                        messageID);
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                final Result errorResult =
+                        Responses.newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
+                                "Bind or Start TLS operation in progress");
+                return new CompletedFutureResult<Void>(newErrorResult(errorResult), messageID);
+            }
 
-    pendingRequest.cancel(false);
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.abandonRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-        return new CompletedFutureResult<Void>((Void) null, messageID);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      return new CompletedFutureResult<Void>(newErrorResult(errorResult),
-          messageID);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Result> addAsync(final AddRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(messageID,
-        request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses
-            .newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-                "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.addRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void addConnectionEventListener(final ConnectionEventListener listener)
-  {
-    Validator.ensureNotNull(listener);
-    listeners.add(listener);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<BindResult> bindAsync(final BindRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super BindResult> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-
-    BindClient context;
-    try
-    {
-      context = request
-          .createBindClient(connection.getPeerAddress() instanceof InetSocketAddress ?
-              ((InetSocketAddress) connection.getPeerAddress()).getHostName()
-              : connection.getPeerAddress().toString());
-    }
-    catch (final Exception e)
-    {
-      // FIXME: I18N need to have a better error message.
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses
-          .newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
-          .setDiagnosticMessage(
-              "An error occurred while creating a bind context").setCause(e);
-      final ErrorResultException error = ErrorResultException
-          .newErrorResult(errorResult);
-      if (resultHandler != null)
-      {
-        resultHandler.handleErrorResult(error);
-      }
-      return new CompletedFutureResult<BindResult>(error, messageID);
-    }
-
-    final LDAPBindFutureResultImpl future = new LDAPBindFutureResultImpl(
-        messageID, context, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (!pendingRequests.isEmpty())
-      {
-        future.setResultOrError(Responses.newBindResult(
-            ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-            "There are other operations pending on this connection"));
-        return future;
-      }
-
-      if (!bindOrStartTLSInProgress.compareAndSet(false, true))
-      {
-        future.setResultOrError(Responses.newBindResult(
-            ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-            "Bind or Start TLS operation in progress"));
-        return future;
-      }
-
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        // Use the bind client to get the initial request instead of using the
-        // bind request passed to this method.
-        final GenericBindRequest initialRequest = context.nextBindRequest();
-        ldapWriter.bindRequest(asn1Writer, messageID, 3, initialRequest);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      bindOrStartTLSInProgress.set(false);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close(final UnbindRequest request, final String reason)
-  {
-    // FIXME: I18N need to internationalize this message.
-    Validator.ensureNotNull(request);
-
-    close(
-        request,
-        false,
-        Responses.newResult(ResultCode.CLIENT_SIDE_USER_CANCELLED)
-            .setDiagnosticMessage(
-                "Connection closed by client"
-                    + (reason != null ? ": " + reason : "")));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<CompareResult> compareAsync(final CompareRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super CompareResult> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPCompareFutureResultImpl future = new LDAPCompareFutureResultImpl(
-        messageID, request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses.newCompareResult(
-            ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-            "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.compareRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Result> deleteAsync(final DeleteRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(messageID,
-        request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses
-            .newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-                "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.deleteRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-      final ExtendedRequest<R> request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super R> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPExtendedFutureResultImpl<R> future = new LDAPExtendedFutureResultImpl<R>(
-        messageID, request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (request.getOID().equals(StartTLSExtendedRequest.OID))
-      {
-        if (!pendingRequests.isEmpty())
-        {
-          future.setResultOrError(request.getResultDecoder()
-              .newExtendedErrorResult(ResultCode.OPERATIONS_ERROR, "",
-                  "There are pending operations on this connection"));
-          return future;
+            // First remove the future associated with the request to be
+            // abandoned.
+            pendingRequest = pendingRequests.remove(request.getRequestID());
         }
-        if (isTLSEnabled())
-        {
-          future.setResultOrError(request.getResultDecoder()
-              .newExtendedErrorResult(ResultCode.OPERATIONS_ERROR, "",
-                  "This connection is already TLS enabled"));
-          return future;
+
+        if (pendingRequest == null) {
+            // There has never been a request with the specified message ID or
+            // the
+            // response has already been received and handled. We can ignore
+            // this
+            // abandon request.
+
+            // Message ID will be -1 since no request was sent.
+            return new CompletedFutureResult<Void>((Void) null);
         }
-        if (!bindOrStartTLSInProgress.compareAndSet(false, true))
-        {
-          future.setResultOrError(request.getResultDecoder()
-              .newExtendedErrorResult(ResultCode.OPERATIONS_ERROR, "",
-                  "Bind or Start TLS operation in progress"));
-          return future;
+
+        pendingRequest.cancel(false);
+
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.abandonRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+                return new CompletedFutureResult<Void>((Void) null, messageID);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            return new CompletedFutureResult<Void>(newErrorResult(errorResult), messageID);
         }
-      }
-      else
-      {
-        if (bindOrStartTLSInProgress.get())
-        {
-          future.setResultOrError(request.getResultDecoder()
-              .newExtendedErrorResult(ResultCode.OPERATIONS_ERROR, "",
-                  "Bind or Start TLS operation in progress"));
-          return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Result> addAsync(final AddRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
+
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
         }
-      }
-      pendingRequests.put(messageID, future);
-    }
 
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.extendedRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-      bindOrStartTLSInProgress.set(false);
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.addRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
 
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
 
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isClosed()
-  {
-    synchronized (stateLock)
-    {
-      return isClosed;
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isValid()
-  {
-    synchronized (stateLock)
-    {
-      return connectionInvalidReason == null && !isClosed;
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Result> modifyAsync(final ModifyRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(messageID,
-        request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
         return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses
-            .newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-                "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
     }
 
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.modifyRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
+    /**
+     * {@inheritDoc}
+     */
+    public void addConnectionEventListener(final ConnectionEventListener listener) {
+        Validator.ensureNotNull(listener);
+        listeners.add(listener);
     }
 
-    return future;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<BindResult> bindAsync(final BindRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super BindResult> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPFutureResultImpl future = new LDAPFutureResultImpl(messageID,
-        request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses
-            .newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-                "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.modifyDNRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void removeConnectionEventListener(
-      final ConnectionEventListener listener)
-  {
-    Validator.ensureNotNull(listener);
-    listeners.remove(listener);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Result> searchAsync(final SearchRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final SearchResultHandler resultHandler)
-  {
-    final int messageID = nextMsgID.getAndIncrement();
-    final LDAPSearchFutureResultImpl future = new LDAPSearchFutureResultImpl(
-        messageID, request, resultHandler, intermediateResponseHandler, this);
-
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-        return future;
-      }
-      if (bindOrStartTLSInProgress.get())
-      {
-        future.setResultOrError(Responses
-            .newResult(ResultCode.OPERATIONS_ERROR).setDiagnosticMessage(
-                "Bind or Start TLS operation in progress"));
-        return future;
-      }
-      pendingRequests.put(messageID, future);
-    }
-
-    try
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        ldapWriter.searchRequest(asn1Writer, messageID, request);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-    catch (final IOException e)
-    {
-      pendingRequests.remove(messageID);
-
-      // FIXME: what other sort of IOExceptions can be thrown?
-      // FIXME: Is this the best result code?
-      final Result errorResult = Responses.newResult(
-          ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
-      connectionErrorOccurred(errorResult);
-      future.adaptErrorResult(errorResult);
-    }
-
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    StringBuilder builder = new StringBuilder();
-    builder.append("LDAPConnection(");
-    builder.append(connection.getLocalAddress());
-    builder.append(',');
-    builder.append(connection.getPeerAddress());
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  int continuePendingBindRequest(final LDAPBindFutureResultImpl future)
-      throws ErrorResultException
-  {
-    final int newMsgID = nextMsgID.getAndIncrement();
-    synchronized (stateLock)
-    {
-      if (connectionInvalidReason != null)
-      {
-        throw newErrorResult(connectionInvalidReason);
-      }
-      pendingRequests.put(newMsgID, future);
-    }
-    return newMsgID;
-  }
-
-
-
-  long cancelExpiredRequests(final long currentTime)
-  {
-    final long timeout = options.getTimeout(TimeUnit.MILLISECONDS);
-    long delay = timeout;
-    if (timeout > 0)
-    {
-      for (int requestID : pendingRequests.keySet())
-      {
-        final AbstractLDAPFutureResultImpl<?> future = pendingRequests
-            .get(requestID);
-        if (future != null)
-        {
-          final long diff = (future.getTimestamp() + timeout) - currentTime;
-          if (diff <= 0 && pendingRequests.remove(requestID) != null)
-          {
-            StaticUtils.DEBUG_LOG.fine("Cancelling expired future result: "
-                + future);
-            final Result result = Responses
-                .newResult(ResultCode.CLIENT_SIDE_TIMEOUT);
-            future.adaptErrorResult(result);
-
-            abandonAsync(Requests.newAbandonRequest(future.getRequestID()));
-          }
-          else
-          {
-            delay = Math.min(delay, diff);
-          }
+        BindClient context;
+        try {
+            context =
+                    request.createBindClient(
+                            connection.getPeerAddress() instanceof InetSocketAddress
+                            ? ((InetSocketAddress) connection.getPeerAddress()).getHostName()
+                            : connection.getPeerAddress().toString());
+        } catch (final Exception e) {
+            // FIXME: I18N need to have a better error message.
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                            "An error occurred while creating a bind context").setCause(e);
+            final ErrorResultException error = ErrorResultException.newErrorResult(errorResult);
+            if (resultHandler != null) {
+                resultHandler.handleErrorResult(error);
+            }
+            return new CompletedFutureResult<BindResult>(error, messageID);
         }
-      }
-    }
-    return delay;
-  }
 
+        final LDAPBindFutureResultImpl future =
+                new LDAPBindFutureResultImpl(messageID, context, resultHandler,
+                        intermediateResponseHandler, this);
 
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (!pendingRequests.isEmpty()) {
+                future.setResultOrError(Responses.newBindResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage(
+                                "There are other operations pending on this connection"));
+                return future;
+            }
 
-  void close(final UnbindRequest unbindRequest,
-      final boolean isDisconnectNotification, final Result reason)
-  {
-    boolean notifyClose = false;
-    boolean notifyErrorOccurred = false;
+            if (!bindOrStartTLSInProgress.compareAndSet(false, true)) {
+                future.setResultOrError(Responses.newBindResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
 
-    synchronized (stateLock)
-    {
-      if (isClosed)
-      {
-        // Already closed.
-        return;
-      }
-
-      if (connectionInvalidReason != null)
-      {
-        // Already closed.
-        isClosed = true;
-        return;
-      }
-
-      if (unbindRequest != null)
-      {
-        // User closed.
-        isClosed = true;
-        notifyClose = true;
-      }
-      else
-      {
-        notifyErrorOccurred = true;
-      }
-
-      // Mark the connection as invalid.
-      if (!isDisconnectNotification)
-      {
-        // Connection termination was detected locally, so use the provided
-        // reason for all subsequent requests.
-        connectionInvalidReason = reason;
-      }
-      else
-      {
-        // Connection termination was triggered remotely. We don't want to
-        // blindly pass on the result code to requests since it could be
-        // confused for a genuine response. For example, if the disconnect
-        // contained the invalidCredentials result code then this could be
-        // misinterpreted as a genuine authentication failure for subsequent
-        // bind requests.
-        connectionInvalidReason = Responses.newResult(
-            ResultCode.CLIENT_SIDE_SERVER_DOWN).setDiagnosticMessage(
-            "Connection closed by server");
-      }
-    }
-
-    // First abort all outstanding requests.
-    for (int requestID : pendingRequests.keySet())
-    {
-      final AbstractLDAPFutureResultImpl<?> future = pendingRequests
-          .remove(requestID);
-      if (future != null)
-      {
-        future.adaptErrorResult(connectionInvalidReason);
-      }
-    }
-
-    // Now try cleanly closing the connection if possible.
-    // Only send unbind if specified.
-    if (unbindRequest != null && !isDisconnectNotification)
-    {
-      try
-      {
-        final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-        try
-        {
-          ldapWriter.unbindRequest(asn1Writer, nextMsgID.getAndIncrement(),
-              unbindRequest);
-          connection.write(asn1Writer.getBuffer(), null);
+            pendingRequests.put(messageID, future);
         }
-        finally
-        {
-          asn1Writer.recycle();
+
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                // Use the bind client to get the initial request instead of
+                // using the
+                // bind request passed to this method.
+                final GenericBindRequest initialRequest = context.nextBindRequest();
+                ldapWriter.bindRequest(asn1Writer, messageID, 3, initialRequest);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
+
+            bindOrStartTLSInProgress.set(false);
+
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
         }
-      }
-      catch (final IOException e)
-      {
-        // Underlying channel prob blown up. Just ignore.
-      }
+
+        return future;
     }
 
-    try
-    {
-      connection.close();
-    }
-    catch (final IOException e)
-    {
-      // Ignore.
+    /**
+     * {@inheritDoc}
+     */
+    public void close(final UnbindRequest request, final String reason) {
+        // FIXME: I18N need to internationalize this message.
+        Validator.ensureNotNull(request);
+
+        close(request, false, Responses.newResult(ResultCode.CLIENT_SIDE_USER_CANCELLED)
+                .setDiagnosticMessage(
+                        "Connection closed by client" + (reason != null ? ": " + reason : "")));
     }
 
-    // Notify listeners.
-    if (notifyClose)
-    {
-      for (final ConnectionEventListener listener : listeners)
-      {
-        listener.handleConnectionClosed();
-      }
-    }
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<CompareResult> compareAsync(final CompareRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super CompareResult> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPCompareFutureResultImpl future =
+                new LDAPCompareFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
 
-    if (notifyErrorOccurred)
-    {
-      for (final ConnectionEventListener listener : listeners)
-      {
-        // Use the reason provided in the disconnect notification.
-        listener.handleConnectionError(isDisconnectNotification,
-            newErrorResult(reason));
-      }
-    }
-  }
-
-
-
-  LDAPOptions getLDAPOptions()
-  {
-    return options;
-  }
-
-
-
-  AbstractLDAPFutureResultImpl<?> getPendingRequest(final Integer messageID)
-  {
-    return pendingRequests.get(messageID);
-  }
-
-
-
-  void handleUnsolicitedNotification(final ExtendedResult result)
-  {
-    if (isClosed())
-    {
-      // Don't notify after connection is closed.
-      return;
-    }
-
-    for (final ConnectionEventListener listener : listeners)
-    {
-      listener.handleUnsolicitedNotification(result);
-    }
-  }
-
-
-
-  /**
-   * Installs a new Grizzly filter (e.g. SSL/SASL) beneath the top-level LDAP
-   * filter.
-   *
-   * @param filter
-   *          The filter to be installed.
-   */
-  void installFilter(final Filter filter)
-  {
-    synchronized (stateLock)
-    {
-      // Determine the index where the filter should be added.
-      FilterChain oldFilterChain = (FilterChain) connection.getProcessor();
-      int filterIndex = oldFilterChain.size() - 1;
-      if (filter instanceof SSLFilter)
-      {
-        // Beneath any ConnectionSecurityLayerFilters if present, otherwise
-        // beneath the LDAP filter.
-        for (int i = oldFilterChain.size() - 2; i >= 0; i--)
-        {
-          if (!(oldFilterChain.get(i) instanceof ConnectionSecurityLayerFilter))
-          {
-            filterIndex = i + 1;
-            break;
-          }
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newCompareResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
         }
-      }
 
-      // Create the new filter chain.
-      FilterChain newFilterChain = FilterChainBuilder.stateless()
-          .addAll(oldFilterChain)
-          .add(filterIndex, filter)
-          .build();
-      connection.setProcessor(newFilterChain);
-    }
-  }
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.compareRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
 
-
-
-  /**
-   * Indicates whether or not TLS is enabled on this connection.
-   *
-   * @return {@code true} if TLS is enabled on this connection, otherwise
-   *         {@code false}.
-   */
-  boolean isTLSEnabled()
-  {
-    synchronized (stateLock)
-    {
-      final FilterChain currentFilterChain = (FilterChain) connection
-          .getProcessor();
-      for (Filter filter : currentFilterChain)
-      {
-        if (filter instanceof SSLFilter)
-        {
-          return true;
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
         }
-      }
-      return false;
+
+        return future;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Result> deleteAsync(final DeleteRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
 
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
+        }
 
-  AbstractLDAPFutureResultImpl<?> removePendingRequest(final Integer messageID)
-  {
-    return pendingRequests.remove(messageID);
-  }
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.deleteRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
 
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
 
-
-  void setBindOrStartTLSInProgress(final boolean state)
-  {
-    bindOrStartTLSInProgress.set(state);
-  }
-
-
-
-  void startTLS(final SSLContext sslContext,
-      final List<String> protocols, final List<String> cipherSuites,
-      final CompletionHandler<SSLEngine> completionHandler) throws IOException
-  {
-    synchronized (stateLock)
-    {
-      if (isTLSEnabled())
-      {
-        throw new IllegalStateException("TLS already enabled");
-      }
-
-      SSLEngineConfigurator sslEngineConfigurator = new SSLEngineConfigurator(
-          sslContext, true, false, false);
-      sslEngineConfigurator.setEnabledProtocols(protocols.isEmpty() ? null
-          : protocols.toArray(new String[protocols.size()]));
-      sslEngineConfigurator
-          .setEnabledCipherSuites(cipherSuites.isEmpty() ? null : cipherSuites
-              .toArray(new String[cipherSuites.size()]));
-      SSLFilter sslFilter = new SSLFilter(null, sslEngineConfigurator);
-      installFilter(sslFilter);
-      sslFilter.handshake(connection, completionHandler);
+        return future;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
+            final ExtendedRequest<R> request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super R> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPExtendedFutureResultImpl<R> future =
+                new LDAPExtendedFutureResultImpl<R>(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
 
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (request.getOID().equals(StartTLSExtendedRequest.OID)) {
+                if (!pendingRequests.isEmpty()) {
+                    future.setResultOrError(request.getResultDecoder().newExtendedErrorResult(
+                            ResultCode.OPERATIONS_ERROR, "",
+                            "There are pending operations on this connection"));
+                    return future;
+                }
+                if (isTLSEnabled()) {
+                    future.setResultOrError(request.getResultDecoder().newExtendedErrorResult(
+                            ResultCode.OPERATIONS_ERROR, "",
+                            "This connection is already TLS enabled"));
+                    return future;
+                }
+                if (!bindOrStartTLSInProgress.compareAndSet(false, true)) {
+                    future.setResultOrError(request.getResultDecoder().newExtendedErrorResult(
+                            ResultCode.OPERATIONS_ERROR, "",
+                            "Bind or Start TLS operation in progress"));
+                    return future;
+                }
+            } else {
+                if (bindOrStartTLSInProgress.get()) {
+                    future.setResultOrError(request.getResultDecoder().newExtendedErrorResult(
+                            ResultCode.OPERATIONS_ERROR, "",
+                            "Bind or Start TLS operation in progress"));
+                    return future;
+                }
+            }
+            pendingRequests.put(messageID, future);
+        }
 
-  private void connectionErrorOccurred(final Result reason)
-  {
-    close(null, false, reason);
-  }
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.extendedRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
+            bindOrStartTLSInProgress.set(false);
+
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
+
+        return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isClosed() {
+        synchronized (stateLock) {
+            return isClosed;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isValid() {
+        synchronized (stateLock) {
+            return connectionInvalidReason == null && !isClosed;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Result> modifyAsync(final ModifyRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
+
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
+        }
+
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.modifyRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
+
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
+
+        return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPFutureResultImpl future =
+                new LDAPFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
+
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
+        }
+
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.modifyDNRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
+
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
+
+        return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void removeConnectionEventListener(final ConnectionEventListener listener) {
+        Validator.ensureNotNull(listener);
+        listeners.remove(listener);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Result> searchAsync(final SearchRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final SearchResultHandler resultHandler) {
+        final int messageID = nextMsgID.getAndIncrement();
+        final LDAPSearchFutureResultImpl future =
+                new LDAPSearchFutureResultImpl(messageID, request, resultHandler,
+                        intermediateResponseHandler, this);
+
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+                return future;
+            }
+            if (bindOrStartTLSInProgress.get()) {
+                future.setResultOrError(Responses.newResult(ResultCode.OPERATIONS_ERROR)
+                        .setDiagnosticMessage("Bind or Start TLS operation in progress"));
+                return future;
+            }
+            pendingRequests.put(messageID, future);
+        }
+
+        try {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                ldapWriter.searchRequest(asn1Writer, messageID, request);
+                connection.write(asn1Writer.getBuffer(), null);
+            } finally {
+                asn1Writer.recycle();
+            }
+        } catch (final IOException e) {
+            pendingRequests.remove(messageID);
+
+            // FIXME: what other sort of IOExceptions can be thrown?
+            // FIXME: Is this the best result code?
+            final Result errorResult =
+                    Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
+            connectionErrorOccurred(errorResult);
+            future.adaptErrorResult(errorResult);
+        }
+
+        return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("LDAPConnection(");
+        builder.append(connection.getLocalAddress());
+        builder.append(',');
+        builder.append(connection.getPeerAddress());
+        builder.append(')');
+        return builder.toString();
+    }
+
+    int continuePendingBindRequest(final LDAPBindFutureResultImpl future)
+            throws ErrorResultException {
+        final int newMsgID = nextMsgID.getAndIncrement();
+        synchronized (stateLock) {
+            if (connectionInvalidReason != null) {
+                throw newErrorResult(connectionInvalidReason);
+            }
+            pendingRequests.put(newMsgID, future);
+        }
+        return newMsgID;
+    }
+
+    long cancelExpiredRequests(final long currentTime) {
+        final long timeout = options.getTimeout(TimeUnit.MILLISECONDS);
+        long delay = timeout;
+        if (timeout > 0) {
+            for (int requestID : pendingRequests.keySet()) {
+                final AbstractLDAPFutureResultImpl<?> future = pendingRequests.get(requestID);
+                if (future != null) {
+                    final long diff = (future.getTimestamp() + timeout) - currentTime;
+                    if (diff <= 0 && pendingRequests.remove(requestID) != null) {
+                        StaticUtils.DEBUG_LOG.fine("Cancelling expired future result: " + future);
+                        final Result result = Responses.newResult(ResultCode.CLIENT_SIDE_TIMEOUT);
+                        future.adaptErrorResult(result);
+
+                        abandonAsync(Requests.newAbandonRequest(future.getRequestID()));
+                    } else {
+                        delay = Math.min(delay, diff);
+                    }
+                }
+            }
+        }
+        return delay;
+    }
+
+    void close(final UnbindRequest unbindRequest, final boolean isDisconnectNotification,
+            final Result reason) {
+        boolean notifyClose = false;
+        boolean notifyErrorOccurred = false;
+
+        synchronized (stateLock) {
+            if (isClosed) {
+                // Already closed.
+                return;
+            }
+
+            if (connectionInvalidReason != null) {
+                // Already closed.
+                isClosed = true;
+                return;
+            }
+
+            if (unbindRequest != null) {
+                // User closed.
+                isClosed = true;
+                notifyClose = true;
+            } else {
+                notifyErrorOccurred = true;
+            }
+
+            // Mark the connection as invalid.
+            if (!isDisconnectNotification) {
+                // Connection termination was detected locally, so use the
+                // provided
+                // reason for all subsequent requests.
+                connectionInvalidReason = reason;
+            } else {
+                // Connection termination was triggered remotely. We don't want
+                // to
+                // blindly pass on the result code to requests since it could be
+                // confused for a genuine response. For example, if the
+                // disconnect
+                // contained the invalidCredentials result code then this could
+                // be
+                // misinterpreted as a genuine authentication failure for
+                // subsequent
+                // bind requests.
+                connectionInvalidReason =
+                        Responses.newResult(ResultCode.CLIENT_SIDE_SERVER_DOWN)
+                                .setDiagnosticMessage("Connection closed by server");
+            }
+        }
+
+        // First abort all outstanding requests.
+        for (int requestID : pendingRequests.keySet()) {
+            final AbstractLDAPFutureResultImpl<?> future = pendingRequests.remove(requestID);
+            if (future != null) {
+                future.adaptErrorResult(connectionInvalidReason);
+            }
+        }
+
+        // Now try cleanly closing the connection if possible.
+        // Only send unbind if specified.
+        if (unbindRequest != null && !isDisconnectNotification) {
+            try {
+                final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+                try {
+                    ldapWriter
+                            .unbindRequest(asn1Writer, nextMsgID.getAndIncrement(), unbindRequest);
+                    connection.write(asn1Writer.getBuffer(), null);
+                } finally {
+                    asn1Writer.recycle();
+                }
+            } catch (final IOException e) {
+                // Underlying channel prob blown up. Just ignore.
+            }
+        }
+
+        try {
+            connection.close();
+        } catch (final IOException e) {
+            // Ignore.
+        }
+
+        // Notify listeners.
+        if (notifyClose) {
+            for (final ConnectionEventListener listener : listeners) {
+                listener.handleConnectionClosed();
+            }
+        }
+
+        if (notifyErrorOccurred) {
+            for (final ConnectionEventListener listener : listeners) {
+                // Use the reason provided in the disconnect notification.
+                listener.handleConnectionError(isDisconnectNotification, newErrorResult(reason));
+            }
+        }
+    }
+
+    LDAPOptions getLDAPOptions() {
+        return options;
+    }
+
+    AbstractLDAPFutureResultImpl<?> getPendingRequest(final Integer messageID) {
+        return pendingRequests.get(messageID);
+    }
+
+    void handleUnsolicitedNotification(final ExtendedResult result) {
+        if (isClosed()) {
+            // Don't notify after connection is closed.
+            return;
+        }
+
+        for (final ConnectionEventListener listener : listeners) {
+            listener.handleUnsolicitedNotification(result);
+        }
+    }
+
+    /**
+     * Installs a new Grizzly filter (e.g. SSL/SASL) beneath the top-level LDAP
+     * filter.
+     *
+     * @param filter
+     *            The filter to be installed.
+     */
+    void installFilter(final Filter filter) {
+        synchronized (stateLock) {
+            // Determine the index where the filter should be added.
+            FilterChain oldFilterChain = (FilterChain) connection.getProcessor();
+            int filterIndex = oldFilterChain.size() - 1;
+            if (filter instanceof SSLFilter) {
+                // Beneath any ConnectionSecurityLayerFilters if present,
+                // otherwise
+                // beneath the LDAP filter.
+                for (int i = oldFilterChain.size() - 2; i >= 0; i--) {
+                    if (!(oldFilterChain.get(i) instanceof ConnectionSecurityLayerFilter)) {
+                        filterIndex = i + 1;
+                        break;
+                    }
+                }
+            }
+
+            // Create the new filter chain.
+            FilterChain newFilterChain =
+                    FilterChainBuilder.stateless().addAll(oldFilterChain).add(filterIndex, filter)
+                            .build();
+            connection.setProcessor(newFilterChain);
+        }
+    }
+
+    /**
+     * Indicates whether or not TLS is enabled on this connection.
+     *
+     * @return {@code true} if TLS is enabled on this connection, otherwise
+     *         {@code false}.
+     */
+    boolean isTLSEnabled() {
+        synchronized (stateLock) {
+            final FilterChain currentFilterChain = (FilterChain) connection.getProcessor();
+            for (Filter filter : currentFilterChain) {
+                if (filter instanceof SSLFilter) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    AbstractLDAPFutureResultImpl<?> removePendingRequest(final Integer messageID) {
+        return pendingRequests.remove(messageID);
+    }
+
+    void setBindOrStartTLSInProgress(final boolean state) {
+        bindOrStartTLSInProgress.set(state);
+    }
+
+    void startTLS(final SSLContext sslContext, final List<String> protocols,
+            final List<String> cipherSuites, final CompletionHandler<SSLEngine> completionHandler)
+            throws IOException {
+        synchronized (stateLock) {
+            if (isTLSEnabled()) {
+                throw new IllegalStateException("TLS already enabled");
+            }
+
+            SSLEngineConfigurator sslEngineConfigurator =
+                    new SSLEngineConfigurator(sslContext, true, false, false);
+            sslEngineConfigurator.setEnabledProtocols(protocols.isEmpty() ? null : protocols
+                    .toArray(new String[protocols.size()]));
+            sslEngineConfigurator.setEnabledCipherSuites(cipherSuites.isEmpty() ? null
+                    : cipherSuites.toArray(new String[cipherSuites.size()]));
+            SSLFilter sslFilter = new SSLFilter(null, sslEngineConfigurator);
+            installFilter(sslFilter);
+            sslFilter.handshake(connection, completionHandler);
+        }
+    }
+
+    private void connectionErrorOccurred(final Result reason) {
+        close(null, false, reason);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnectionFactoryImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnectionFactoryImpl.java
index 71b5131..f321050 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnectionFactoryImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnectionFactoryImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.io.IOException;
@@ -38,7 +35,13 @@
 
 import javax.net.ssl.SSLEngine;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.LDAPOptions;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
@@ -54,306 +57,226 @@
 import com.forgerock.opendj.util.FutureResultTransformer;
 import com.forgerock.opendj.util.RecursiveFutureResult;
 
-
-
 /**
  * LDAP connection factory implementation.
  */
-public final class LDAPConnectionFactoryImpl implements ConnectionFactory
-{
+public final class LDAPConnectionFactoryImpl implements ConnectionFactory {
 
-  @SuppressWarnings("rawtypes")
-  private final class ConnectionCompletionHandler implements
-      CompletionHandler<org.glassfish.grizzly.Connection>
-  {
-    private final FutureResultTransformer<Result, Connection> startTLSFutureResult;
-    private final RecursiveFutureResult<LDAPConnection, ExtendedResult> connectionFutureResult;
-    private LDAPConnection connection;
+    @SuppressWarnings("rawtypes")
+    private final class ConnectionCompletionHandler implements
+            CompletionHandler<org.glassfish.grizzly.Connection> {
+        private final FutureResultTransformer<Result, Connection> startTLSFutureResult;
+        private final RecursiveFutureResult<LDAPConnection, ExtendedResult> connectionFutureResult;
+        private LDAPConnection connection;
 
+        private ConnectionCompletionHandler(final ResultHandler<? super Connection> handler) {
+            this.startTLSFutureResult = new FutureResultTransformer<Result, Connection>(handler) {
 
-
-    private ConnectionCompletionHandler(final ResultHandler<? super Connection> handler)
-    {
-      this.startTLSFutureResult = new FutureResultTransformer<Result, Connection>(
-          handler)
-      {
-
-        @Override
-        protected ErrorResultException transformErrorResult(
-            final ErrorResultException errorResult)
-        {
-          // Ensure that the connection is closed.
-          try
-          {
-            if (connection != null)
-            {
-              connection.close();
-            }
-          }
-          catch (final Exception e)
-          {
-            // Ignore.
-          }
-          return errorResult;
-        }
-
-
-
-        @Override
-        protected LDAPConnection transformResult(final Result result)
-            throws ErrorResultException
-        {
-          return connection;
-        }
-
-      };
-
-      this.connectionFutureResult = new RecursiveFutureResult<LDAPConnection, ExtendedResult>(
-          startTLSFutureResult)
-      {
-
-        @Override
-        protected FutureResult<? extends ExtendedResult> chainResult(
-            final LDAPConnection innerResult,
-            final ResultHandler<? super ExtendedResult> handler)
-            throws ErrorResultException
-        {
-          connection = innerResult;
-
-          if (options.getSSLContext() != null && options.useStartTLS())
-          {
-            // Chain StartTLS extended request.
-            final StartTLSExtendedRequest startTLS = Requests
-                .newStartTLSExtendedRequest(options.getSSLContext());
-            startTLS.addEnabledCipherSuite(options.getEnabledCipherSuites()
-                .toArray(new String[options.getEnabledCipherSuites().size()]));
-            startTLS.addEnabledProtocol(options.getEnabledProtocols().toArray(
-                new String[options.getEnabledProtocols().size()]));
-            return connection.extendedRequestAsync(startTLS, null, handler);
-          }
-          else if (options.getSSLContext() != null)
-          {
-            // Install SSL/TLS layer.
-            try
-            {
-              connection.startTLS(options.getSSLContext(),
-                  options.getEnabledProtocols(),
-                  options.getEnabledCipherSuites(),
-                  new EmptyCompletionHandler<SSLEngine>()
-                  {
-                    @Override
-                    public void completed(final SSLEngine result)
-                    {
-                      handler.handleResult(null);
+                @Override
+                protected ErrorResultException transformErrorResult(
+                        final ErrorResultException errorResult) {
+                    // Ensure that the connection is closed.
+                    try {
+                        if (connection != null) {
+                            connection.close();
+                        }
+                    } catch (final Exception e) {
+                        // Ignore.
                     }
+                    return errorResult;
+                }
 
+                @Override
+                protected LDAPConnection transformResult(final Result result)
+                        throws ErrorResultException {
+                    return connection;
+                }
 
+            };
 
-                    @Override
-                    public void failed(final Throwable throwable)
-                    {
-                      handler.handleErrorResult(newErrorResult(
-                          ResultCode.CLIENT_SIDE_CONNECT_ERROR,
-                          throwable.getMessage(), throwable));
-                    }
-                  });
-              return null;
-            }
-            catch (final IOException ioe)
-            {
-              throw newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR,
-                  ioe.getMessage(), ioe);
-            }
-          }
-          else
-          {
-            // Plain connection.
-            handler.handleResult(null);
-            return new CompletedFutureResult<ExtendedResult>(
-                (ExtendedResult) null);
-          }
+            this.connectionFutureResult =
+                    new RecursiveFutureResult<LDAPConnection, ExtendedResult>(startTLSFutureResult) {
+
+                        @Override
+                        protected FutureResult<? extends ExtendedResult> chainResult(
+                                final LDAPConnection innerResult,
+                                final ResultHandler<? super ExtendedResult> handler)
+                                throws ErrorResultException {
+                            connection = innerResult;
+
+                            if (options.getSSLContext() != null && options.useStartTLS()) {
+                                // Chain StartTLS extended request.
+                                final StartTLSExtendedRequest startTLS =
+                                        Requests.newStartTLSExtendedRequest(options.getSSLContext());
+                                startTLS.addEnabledCipherSuite(options
+                                        .getEnabledCipherSuites()
+                                        .toArray(
+                                                new String[options.getEnabledCipherSuites().size()]));
+                                startTLS.addEnabledProtocol(options.getEnabledProtocols().toArray(
+                                        new String[options.getEnabledProtocols().size()]));
+                                return connection.extendedRequestAsync(startTLS, null, handler);
+                            } else if (options.getSSLContext() != null) {
+                                // Install SSL/TLS layer.
+                                try {
+                                    connection.startTLS(options.getSSLContext(), options
+                                            .getEnabledProtocols(), options
+                                            .getEnabledCipherSuites(),
+                                            new EmptyCompletionHandler<SSLEngine>() {
+                                                @Override
+                                                public void completed(final SSLEngine result) {
+                                                    handler.handleResult(null);
+                                                }
+
+                                                @Override
+                                                public void failed(final Throwable throwable) {
+                                                    handler.handleErrorResult(newErrorResult(
+                                                            ResultCode.CLIENT_SIDE_CONNECT_ERROR,
+                                                            throwable.getMessage(), throwable));
+                                                }
+                                            });
+                                    return null;
+                                } catch (final IOException ioe) {
+                                    throw newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR, ioe
+                                            .getMessage(), ioe);
+                                }
+                            } else {
+                                // Plain connection.
+                                handler.handleResult(null);
+                                return new CompletedFutureResult<ExtendedResult>(
+                                        (ExtendedResult) null);
+                            }
+                        }
+
+                    };
+
+            startTLSFutureResult.setFutureResult(connectionFutureResult);
         }
 
-      };
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void cancelled() {
+            // Ignore this.
+        }
 
-      startTLSFutureResult.setFutureResult(connectionFutureResult);
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void completed(final org.glassfish.grizzly.Connection connection) {
+            connectionFutureResult.handleResult(adaptConnection(connection));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void failed(final Throwable throwable) {
+            connectionFutureResult.handleErrorResult(adaptConnectionException(throwable));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void updated(final org.glassfish.grizzly.Connection connection) {
+            // Ignore this.
+        }
+
     }
 
+    private final SocketAddress socketAddress;
+    private final TCPNIOTransport transport;
+    private final FilterChain defaultFilterChain;
+    private final LDAPClientFilter clientFilter;
+    private final LDAPOptions options;
 
+    /**
+     * Creates a new LDAP connection factory implementation which can be used to
+     * create connections to the Directory Server at the provided host and port
+     * address using provided connection options.
+     *
+     * @param address
+     *            The address of the Directory Server to connect to.
+     * @param options
+     *            The LDAP connection options to use when creating connections.
+     */
+    public LDAPConnectionFactoryImpl(final SocketAddress address, final LDAPOptions options) {
+        if (options.getTCPNIOTransport() == null) {
+            this.transport = DefaultTCPNIOTransport.getInstance();
+        } else {
+            this.transport = options.getTCPNIOTransport();
+        }
+        this.socketAddress = address;
+        this.options = new LDAPOptions(options);
+        this.clientFilter =
+                new LDAPClientFilter(new LDAPReader(this.options.getDecodeOptions()), 0);
+        this.defaultFilterChain =
+                FilterChainBuilder.stateless().add(new TransportFilter()).add(clientFilter).build();
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void cancelled()
-    {
-      // Ignore this.
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        return getConnectionAsync(null).get();
     }
 
-
-
     /**
      * {@inheritDoc}
      */
     @Override
-    public void completed(final org.glassfish.grizzly.Connection connection)
-    {
-      connectionFutureResult.handleResult(adaptConnection(connection));
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        final ConnectionCompletionHandler ch = new ConnectionCompletionHandler(handler);
+        try {
+            ch.connectionFutureResult.setFutureResult(transport.connect(socketAddress, ch));
+            return ch.startTLSFutureResult;
+        } catch (final IOException e) {
+            final ErrorResultException result = adaptConnectionException(e);
+            return new CompletedFutureResult<Connection>(result);
+        }
     }
 
-
+    /**
+     * Returns the address of the Directory Server.
+     *
+     * @return The address of the Directory Server.
+     */
+    public SocketAddress getSocketAddress() {
+        return socketAddress;
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void failed(final Throwable throwable)
-    {
-      connectionFutureResult
-          .handleErrorResult(adaptConnectionException(throwable));
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("LDAPConnectionFactory(");
+        builder.append(getSocketAddress().toString());
+        builder.append(')');
+        return builder.toString();
     }
 
+    private LDAPConnection adaptConnection(final org.glassfish.grizzly.Connection<?> connection) {
+        // Test shows that its much faster with non block writes but risk
+        // running out of memory if the server is slow.
+        connection.configureBlocking(true);
+        connection.setProcessor(defaultFilterChain);
 
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void updated(final org.glassfish.grizzly.Connection connection)
-    {
-      // Ignore this.
+        final LDAPConnection ldapConnection = new LDAPConnection(connection, options);
+        clientFilter.registerConnection(connection, ldapConnection);
+        return ldapConnection;
     }
 
-  }
+    private ErrorResultException adaptConnectionException(Throwable t) {
+        if (t instanceof ExecutionException) {
+            t = t.getCause();
+        }
 
-
-
-  private final SocketAddress socketAddress;
-  private final TCPNIOTransport transport;
-  private final FilterChain defaultFilterChain;
-  private final LDAPClientFilter clientFilter;
-  private final LDAPOptions options;
-
-
-
-  /**
-   * Creates a new LDAP connection factory implementation which can be used to
-   * create connections to the Directory Server at the provided host and port
-   * address using provided connection options.
-   *
-   * @param address
-   *          The address of the Directory Server to connect to.
-   * @param options
-   *          The LDAP connection options to use when creating connections.
-   */
-  public LDAPConnectionFactoryImpl(final SocketAddress address,
-      final LDAPOptions options)
-  {
-    if (options.getTCPNIOTransport() == null)
-    {
-      this.transport = DefaultTCPNIOTransport.getInstance();
+        return newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR, t.getMessage(), t);
     }
-    else
-    {
-      this.transport = options.getTCPNIOTransport();
-    }
-    this.socketAddress = address;
-    this.options = new LDAPOptions(options);
-    this.clientFilter = new LDAPClientFilter(new LDAPReader(
-        this.options.getDecodeOptions()), 0);
-    this.defaultFilterChain = FilterChainBuilder.stateless()
-        .add(new TransportFilter())
-        .add(clientFilter)
-        .build();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    return getConnectionAsync(null).get();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    final ConnectionCompletionHandler ch = new ConnectionCompletionHandler(handler);
-    try
-    {
-      ch.connectionFutureResult.setFutureResult(transport.connect(socketAddress, ch));
-      return ch.startTLSFutureResult;
-    }
-    catch (final IOException e)
-    {
-      final ErrorResultException result = adaptConnectionException(e);
-      return new CompletedFutureResult<Connection>(result);
-    }
-  }
-
-
-
-  /**
-   * Returns the address of the Directory Server.
-   *
-   * @return The address of the Directory Server.
-   */
-  public SocketAddress getSocketAddress()
-  {
-    return socketAddress;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("LDAPConnectionFactory(");
-    builder.append(getSocketAddress().toString());
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  private LDAPConnection adaptConnection(
-      final org.glassfish.grizzly.Connection<?> connection)
-  {
-    // Test shows that its much faster with non block writes but risk
-    // running out of memory if the server is slow.
-    connection.configureBlocking(true);
-    connection.setProcessor(defaultFilterChain);
-
-    final LDAPConnection ldapConnection = new LDAPConnection(connection,
-        options);
-    clientFilter.registerConnection(connection, ldapConnection);
-    return ldapConnection;
-  }
-
-
-
-  private ErrorResultException adaptConnectionException(Throwable t)
-  {
-    if (t instanceof ExecutionException)
-    {
-      t = t.getCause();
-    }
-
-    return newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR, t.getMessage(),
-        t);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConstants.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConstants.java
index 0d2cc35..eb2f82b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConstants.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConstants.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,307 +25,302 @@
  */
 package com.forgerock.opendj.ldap;
 
-
-
 /**
  * This class defines a number of constants used in the LDAP protocol.
  */
-public final class LDAPConstants
-{
+public final class LDAPConstants {
 
-  /**
-   * The protocol op type for bind requests.
-   */
-  public static final byte OP_TYPE_BIND_REQUEST = 0x60;
+    /**
+     * The protocol op type for bind requests.
+     */
+    public static final byte OP_TYPE_BIND_REQUEST = 0x60;
 
-  /**
-   * The protocol op type for bind responses.
-   */
-  public static final byte OP_TYPE_BIND_RESPONSE = 0x61;
+    /**
+     * The protocol op type for bind responses.
+     */
+    public static final byte OP_TYPE_BIND_RESPONSE = 0x61;
 
-  /**
-   * The protocol op type for unbind requests.
-   */
-  public static final byte OP_TYPE_UNBIND_REQUEST = 0x42;
+    /**
+     * The protocol op type for unbind requests.
+     */
+    public static final byte OP_TYPE_UNBIND_REQUEST = 0x42;
 
-  /**
-   * The protocol op type for search requests.
-   */
-  public static final byte OP_TYPE_SEARCH_REQUEST = 0x63;
+    /**
+     * The protocol op type for search requests.
+     */
+    public static final byte OP_TYPE_SEARCH_REQUEST = 0x63;
 
-  /**
-   * The protocol op type for search result entries.
-   */
-  public static final byte OP_TYPE_SEARCH_RESULT_ENTRY = 0x64;
+    /**
+     * The protocol op type for search result entries.
+     */
+    public static final byte OP_TYPE_SEARCH_RESULT_ENTRY = 0x64;
 
-  /**
-   * The protocol op type for search result references.
-   */
-  public static final byte OP_TYPE_SEARCH_RESULT_REFERENCE = 0x73;
+    /**
+     * The protocol op type for search result references.
+     */
+    public static final byte OP_TYPE_SEARCH_RESULT_REFERENCE = 0x73;
 
-  /**
-   * The protocol op type for search result done elements.
-   */
-  public static final byte OP_TYPE_SEARCH_RESULT_DONE = 0x65;
+    /**
+     * The protocol op type for search result done elements.
+     */
+    public static final byte OP_TYPE_SEARCH_RESULT_DONE = 0x65;
 
-  /**
-   * The protocol op type for modify requests.
-   */
-  public static final byte OP_TYPE_MODIFY_REQUEST = 0x66;
+    /**
+     * The protocol op type for modify requests.
+     */
+    public static final byte OP_TYPE_MODIFY_REQUEST = 0x66;
 
-  /**
-   * The protocol op type for modify responses.
-   */
-  public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
+    /**
+     * The protocol op type for modify responses.
+     */
+    public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
 
-  /**
-   * The protocol op type for add requests.
-   */
-  public static final byte OP_TYPE_ADD_REQUEST = 0x68;
+    /**
+     * The protocol op type for add requests.
+     */
+    public static final byte OP_TYPE_ADD_REQUEST = 0x68;
 
-  /**
-   * The protocol op type for add responses.
-   */
-  public static final byte OP_TYPE_ADD_RESPONSE = 0x69;
+    /**
+     * The protocol op type for add responses.
+     */
+    public static final byte OP_TYPE_ADD_RESPONSE = 0x69;
 
-  /**
-   * The protocol op type for delete requests.
-   */
-  public static final byte OP_TYPE_DELETE_REQUEST = 0x4A;
+    /**
+     * The protocol op type for delete requests.
+     */
+    public static final byte OP_TYPE_DELETE_REQUEST = 0x4A;
 
-  /**
-   * The protocol op type for delete responses.
-   */
-  public static final byte OP_TYPE_DELETE_RESPONSE = 0x6B;
+    /**
+     * The protocol op type for delete responses.
+     */
+    public static final byte OP_TYPE_DELETE_RESPONSE = 0x6B;
 
-  /**
-   * The protocol op type for modify DN requests.
-   */
-  public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
+    /**
+     * The protocol op type for modify DN requests.
+     */
+    public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
 
-  /**
-   * The protocol op type for modify DN responses.
-   */
-  public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
+    /**
+     * The protocol op type for modify DN responses.
+     */
+    public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
 
-  /**
-   * The protocol op type for compare requests.
-   */
-  public static final byte OP_TYPE_COMPARE_REQUEST = 0x6E;
+    /**
+     * The protocol op type for compare requests.
+     */
+    public static final byte OP_TYPE_COMPARE_REQUEST = 0x6E;
 
-  /**
-   * The protocol op type for compare responses.
-   */
-  public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
+    /**
+     * The protocol op type for compare responses.
+     */
+    public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
 
-  /**
-   * The protocol op type for abandon requests.
-   */
-  public static final byte OP_TYPE_ABANDON_REQUEST = 0x50;
+    /**
+     * The protocol op type for abandon requests.
+     */
+    public static final byte OP_TYPE_ABANDON_REQUEST = 0x50;
 
-  /**
-   * The protocol op type for extended requests.
-   */
-  public static final byte OP_TYPE_EXTENDED_REQUEST = 0x77;
+    /**
+     * The protocol op type for extended requests.
+     */
+    public static final byte OP_TYPE_EXTENDED_REQUEST = 0x77;
 
-  /**
-   * The protocol op type for extended responses.
-   */
-  public static final byte OP_TYPE_EXTENDED_RESPONSE = 0x78;
+    /**
+     * The protocol op type for extended responses.
+     */
+    public static final byte OP_TYPE_EXTENDED_RESPONSE = 0x78;
 
-  /**
-   * The protocol op type for intermediate responses.
-   */
-  public static final byte OP_TYPE_INTERMEDIATE_RESPONSE = 0x79;
+    /**
+     * The protocol op type for intermediate responses.
+     */
+    public static final byte OP_TYPE_INTERMEDIATE_RESPONSE = 0x79;
 
-  /**
-   * The BER type to use for encoding the sequence of controls in an LDAP
-   * message.
-   */
-  public static final byte TYPE_CONTROL_SEQUENCE = (byte) 0xA0;
+    /**
+     * The BER type to use for encoding the sequence of controls in an LDAP
+     * message.
+     */
+    public static final byte TYPE_CONTROL_SEQUENCE = (byte) 0xA0;
 
-  /**
-   * The BER type to use for encoding the sequence of referral URLs in an
-   * LDAPResult element.
-   */
-  public static final byte TYPE_REFERRAL_SEQUENCE = (byte) 0xA3;
+    /**
+     * The BER type to use for encoding the sequence of referral URLs in an
+     * LDAPResult element.
+     */
+    public static final byte TYPE_REFERRAL_SEQUENCE = (byte) 0xA3;
 
-  /**
-   * The BER type to use for the AuthenticationChoice element in a bind request
-   * when simple authentication is to be used.
-   */
-  public static final byte TYPE_AUTHENTICATION_SIMPLE = (byte) 0x80;
+    /**
+     * The BER type to use for the AuthenticationChoice element in a bind
+     * request when simple authentication is to be used.
+     */
+    public static final byte TYPE_AUTHENTICATION_SIMPLE = (byte) 0x80;
 
-  /**
-   * The BER type to use for the AuthenticationChoice element in a bind request
-   * when SASL authentication is to be used.
-   */
-  public static final byte TYPE_AUTHENTICATION_SASL = (byte) 0xA3;
+    /**
+     * The BER type to use for the AuthenticationChoice element in a bind
+     * request when SASL authentication is to be used.
+     */
+    public static final byte TYPE_AUTHENTICATION_SASL = (byte) 0xA3;
 
-  /**
-   * The BER type to use for the server SASL credentials in a bind response.
-   */
-  public static final byte TYPE_SERVER_SASL_CREDENTIALS = (byte) 0x87;
+    /**
+     * The BER type to use for the server SASL credentials in a bind response.
+     */
+    public static final byte TYPE_SERVER_SASL_CREDENTIALS = (byte) 0x87;
 
-  /**
-   * The BER type to use for AND filter components.
-   */
-  public static final byte TYPE_FILTER_AND = (byte) 0xA0;
+    /**
+     * The BER type to use for AND filter components.
+     */
+    public static final byte TYPE_FILTER_AND = (byte) 0xA0;
 
-  /**
-   * The BER type to use for OR filter components.
-   */
-  public static final byte TYPE_FILTER_OR = (byte) 0xA1;
+    /**
+     * The BER type to use for OR filter components.
+     */
+    public static final byte TYPE_FILTER_OR = (byte) 0xA1;
 
-  /**
-   * The BER type to use for NOT filter components.
-   */
-  public static final byte TYPE_FILTER_NOT = (byte) 0xA2;
+    /**
+     * The BER type to use for NOT filter components.
+     */
+    public static final byte TYPE_FILTER_NOT = (byte) 0xA2;
 
-  /**
-   * The BER type to use for equality filter components.
-   */
-  public static final byte TYPE_FILTER_EQUALITY = (byte) 0xA3;
+    /**
+     * The BER type to use for equality filter components.
+     */
+    public static final byte TYPE_FILTER_EQUALITY = (byte) 0xA3;
 
-  /**
-   * The BER type to use for substring filter components.
-   */
-  public static final byte TYPE_FILTER_SUBSTRING = (byte) 0xA4;
+    /**
+     * The BER type to use for substring filter components.
+     */
+    public static final byte TYPE_FILTER_SUBSTRING = (byte) 0xA4;
 
-  /**
-   * The BER type to use for greater than or equal to filter components.
-   */
-  public static final byte TYPE_FILTER_GREATER_OR_EQUAL = (byte) 0xA5;
+    /**
+     * The BER type to use for greater than or equal to filter components.
+     */
+    public static final byte TYPE_FILTER_GREATER_OR_EQUAL = (byte) 0xA5;
 
-  /**
-   * The BER type to use for less than or equal to filter components.
-   */
-  public static final byte TYPE_FILTER_LESS_OR_EQUAL = (byte) 0xA6;
+    /**
+     * The BER type to use for less than or equal to filter components.
+     */
+    public static final byte TYPE_FILTER_LESS_OR_EQUAL = (byte) 0xA6;
 
-  /**
-   * The BER type to use for presence filter components.
-   */
-  public static final byte TYPE_FILTER_PRESENCE = (byte) 0x87;
+    /**
+     * The BER type to use for presence filter components.
+     */
+    public static final byte TYPE_FILTER_PRESENCE = (byte) 0x87;
 
-  /**
-   * The BER type to use for approximate filter components.
-   */
-  public static final byte TYPE_FILTER_APPROXIMATE = (byte) 0xA8;
+    /**
+     * The BER type to use for approximate filter components.
+     */
+    public static final byte TYPE_FILTER_APPROXIMATE = (byte) 0xA8;
 
-  /**
-   * The BER type to use for extensible matching filter components.
-   */
-  public static final byte TYPE_FILTER_EXTENSIBLE_MATCH = (byte) 0xA9;
+    /**
+     * The BER type to use for extensible matching filter components.
+     */
+    public static final byte TYPE_FILTER_EXTENSIBLE_MATCH = (byte) 0xA9;
 
-  /**
-   * The BER type to use for the subInitial component of a substring filter.
-   */
-  public static final byte TYPE_SUBINITIAL = (byte) 0x80;
+    /**
+     * The BER type to use for the subInitial component of a substring filter.
+     */
+    public static final byte TYPE_SUBINITIAL = (byte) 0x80;
 
-  /**
-   * The BER type to use for the subAny component(s) of a substring filter.
-   */
-  public static final byte TYPE_SUBANY = (byte) 0x81;
+    /**
+     * The BER type to use for the subAny component(s) of a substring filter.
+     */
+    public static final byte TYPE_SUBANY = (byte) 0x81;
 
-  /**
-   * The BER type to use for the subFinal components of a substring filter.
-   */
-  public static final byte TYPE_SUBFINAL = (byte) 0x82;
+    /**
+     * The BER type to use for the subFinal components of a substring filter.
+     */
+    public static final byte TYPE_SUBFINAL = (byte) 0x82;
 
-  /**
-   * The BER type to use for the matching rule OID in a matching rule assertion.
-   */
-  public static final byte TYPE_MATCHING_RULE_ID = (byte) 0x81;
+    /**
+     * The BER type to use for the matching rule OID in a matching rule
+     * assertion.
+     */
+    public static final byte TYPE_MATCHING_RULE_ID = (byte) 0x81;
 
-  /**
-   * The BER type to use for the attribute type in a matching rule assertion.
-   */
-  public static final byte TYPE_MATCHING_RULE_TYPE = (byte) 0x82;
+    /**
+     * The BER type to use for the attribute type in a matching rule assertion.
+     */
+    public static final byte TYPE_MATCHING_RULE_TYPE = (byte) 0x82;
 
-  /**
-   * The BER type to use for the assertion value in a matching rule assertion.
-   */
-  public static final byte TYPE_MATCHING_RULE_VALUE = (byte) 0x83;
+    /**
+     * The BER type to use for the assertion value in a matching rule assertion.
+     */
+    public static final byte TYPE_MATCHING_RULE_VALUE = (byte) 0x83;
 
-  /**
-   * The BER type to use for the DN attributes flag in a matching rule
-   * assertion.
-   */
-  public static final byte TYPE_MATCHING_RULE_DN_ATTRIBUTES = (byte) 0x84;
+    /**
+     * The BER type to use for the DN attributes flag in a matching rule
+     * assertion.
+     */
+    public static final byte TYPE_MATCHING_RULE_DN_ATTRIBUTES = (byte) 0x84;
 
-  /**
-   * The BER type to use for the newSuperior component of a modify DN request.
-   */
-  public static final byte TYPE_MODIFY_DN_NEW_SUPERIOR = (byte) 0x80;
+    /**
+     * The BER type to use for the newSuperior component of a modify DN request.
+     */
+    public static final byte TYPE_MODIFY_DN_NEW_SUPERIOR = (byte) 0x80;
 
-  /**
-   * The BER type to use for the OID of an extended request.
-   */
-  public static final byte TYPE_EXTENDED_REQUEST_OID = (byte) 0x80;
+    /**
+     * The BER type to use for the OID of an extended request.
+     */
+    public static final byte TYPE_EXTENDED_REQUEST_OID = (byte) 0x80;
 
-  /**
-   * The BER type to use for the value of an extended request.
-   */
-  public static final byte TYPE_EXTENDED_REQUEST_VALUE = (byte) 0x81;
+    /**
+     * The BER type to use for the value of an extended request.
+     */
+    public static final byte TYPE_EXTENDED_REQUEST_VALUE = (byte) 0x81;
 
-  /**
-   * The BER type to use for the OID of an extended response.
-   */
-  public static final byte TYPE_EXTENDED_RESPONSE_OID = (byte) 0x8A;
+    /**
+     * The BER type to use for the OID of an extended response.
+     */
+    public static final byte TYPE_EXTENDED_RESPONSE_OID = (byte) 0x8A;
 
-  /**
-   * The BER type to use for the value of an extended response.
-   */
-  public static final byte TYPE_EXTENDED_RESPONSE_VALUE = (byte) 0x8B;
+    /**
+     * The BER type to use for the value of an extended response.
+     */
+    public static final byte TYPE_EXTENDED_RESPONSE_VALUE = (byte) 0x8B;
 
-  /**
-   * The BER type to use for the OID of an intermediate response message.
-   */
-  public static final byte TYPE_INTERMEDIATE_RESPONSE_OID = (byte) 0x80;
+    /**
+     * The BER type to use for the OID of an intermediate response message.
+     */
+    public static final byte TYPE_INTERMEDIATE_RESPONSE_OID = (byte) 0x80;
 
-  /**
-   * The BER type to use for the value of an intermediate response message.
-   */
-  public static final byte TYPE_INTERMEDIATE_RESPONSE_VALUE = (byte) 0x81;
+    /**
+     * The BER type to use for the value of an intermediate response message.
+     */
+    public static final byte TYPE_INTERMEDIATE_RESPONSE_VALUE = (byte) 0x81;
 
-  /**
-   * The OID for the Kerberos V GSSAPI mechanism.
-   */
-  public static final String OID_GSSAPI_KERBEROS_V = "1.2.840.113554.1.2.2";
+    /**
+     * The OID for the Kerberos V GSSAPI mechanism.
+     */
+    public static final String OID_GSSAPI_KERBEROS_V = "1.2.840.113554.1.2.2";
 
-  /**
-   * The OID for the LDAP notice of disconnection extended operation.
-   */
-  public static final String OID_NOTICE_OF_DISCONNECTION = "1.3.6.1.4.1.1466.20036";
+    /**
+     * The OID for the LDAP notice of disconnection extended operation.
+     */
+    public static final String OID_NOTICE_OF_DISCONNECTION = "1.3.6.1.4.1.1466.20036";
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be the BER type for a new element.
-   */
-  public static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be the BER type for a new element.
+     */
+    public static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be the first byte for the element length.
-   */
-  public static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be the first byte for the element length.
+     */
+    public static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be additional bytes of a multi-byte length.
-   */
-  public static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be additional bytes of a multi-byte length.
+     */
+    public static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be applied to the value of the element.
-   */
-  public static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be applied to the value of the element.
+     */
+    public static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
 
-
-
-  private LDAPConstants()
-  {
-    // Prevent instantiation.
-  }
+    private LDAPConstants() {
+        // Prevent instantiation.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPExtendedFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPExtendedFutureResultImpl.java
index ccba5e7..7dfe521 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPExtendedFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPExtendedFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,87 +27,67 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.ExtendedRequest;
 import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * Extended result future implementation.
  *
  * @param <R>
- *          The type of result returned by this future.
+ *            The type of result returned by this future.
  */
 final class LDAPExtendedFutureResultImpl<R extends ExtendedResult> extends
-    AbstractLDAPFutureResultImpl<R>
-{
-  private final ExtendedRequest<R> request;
+        AbstractLDAPFutureResultImpl<R> {
+    private final ExtendedRequest<R> request;
 
+    LDAPExtendedFutureResultImpl(final int requestID, final ExtendedRequest<R> request,
+            final ResultHandler<? super R> resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(requestID, resultHandler, intermediateResponseHandler, connection);
+        this.request = request;
+    }
 
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("LDAPExtendedFutureResultImpl(");
+        sb.append("request = ");
+        sb.append(request);
+        super.toString(sb);
+        sb.append(")");
+        return sb.toString();
+    }
 
-  LDAPExtendedFutureResultImpl(final int requestID,
-      final ExtendedRequest<R> request,
-      final ResultHandler<? super R> resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(requestID, resultHandler, intermediateResponseHandler, connection);
-    this.request = request;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean isCancelable() {
+        return !request.getOID().equals(StartTLSExtendedRequest.OID);
+    }
 
+    R decodeResult(final ExtendedResult result, final DecodeOptions options) throws DecodeException {
+        return request.getResultDecoder().decodeExtendedResult(result, options);
+    }
 
+    ExtendedRequest<R> getRequest() {
+        return request;
+    }
 
-  @Override
-  public String toString()
-  {
-    final StringBuilder sb = new StringBuilder();
-    sb.append("LDAPExtendedFutureResultImpl(");
-    sb.append("request = ");
-    sb.append(request);
-    super.toString(sb);
-    sb.append(")");
-    return sb.toString();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected boolean isCancelable() {
-    return !request.getOID().equals(StartTLSExtendedRequest.OID);
-  }
-
-
-
-  R decodeResult(final ExtendedResult result, final DecodeOptions options)
-      throws DecodeException
-  {
-    return request.getResultDecoder().decodeExtendedResult(result, options);
-  }
-
-
-
-  ExtendedRequest<R> getRequest()
-  {
-    return request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  R newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
-      final Throwable cause)
-  {
-    return request.getResultDecoder().newExtendedErrorResult(resultCode, "",
-        diagnosticMessage);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    R newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+            final Throwable cause) {
+        return request.getResultDecoder().newExtendedErrorResult(resultCode, "", diagnosticMessage);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPFutureResultImpl.java
index f5a12ec..522ae61 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.ResultCode;
@@ -38,57 +35,42 @@
 import org.forgerock.opendj.ldap.responses.Responses;
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Result future implementation.
  */
-final class LDAPFutureResultImpl extends AbstractLDAPFutureResultImpl<Result>
-{
-  private final Request request;
+final class LDAPFutureResultImpl extends AbstractLDAPFutureResultImpl<Result> {
+    private final Request request;
 
+    LDAPFutureResultImpl(final int requestID, final Request request,
+            final ResultHandler<? super Result> resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(requestID, resultHandler, intermediateResponseHandler, connection);
+        this.request = request;
+    }
 
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("LDAPFutureResultImpl(");
+        sb.append("request = ");
+        sb.append(request);
+        super.toString(sb);
+        sb.append(")");
+        return sb.toString();
+    }
 
-  LDAPFutureResultImpl(final int requestID, final Request request,
-      final ResultHandler<? super Result> resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(requestID, resultHandler, intermediateResponseHandler, connection);
-    this.request = request;
-  }
+    Request getRequest() {
+        return request;
+    }
 
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder sb = new StringBuilder();
-    sb.append("LDAPFutureResultImpl(");
-    sb.append("request = ");
-    sb.append(request);
-    super.toString(sb);
-    sb.append(")");
-    return sb.toString();
-  }
-
-
-
-  Request getRequest()
-  {
-    return request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  Result newErrorResult(final ResultCode resultCode,
-      final String diagnosticMessage, final Throwable cause)
-  {
-    return Responses.newResult(resultCode)
-        .setDiagnosticMessage(diagnosticMessage).setCause(cause);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    Result newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+            final Throwable cause) {
+        return Responses.newResult(resultCode).setDiagnosticMessage(diagnosticMessage).setCause(
+                cause);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java
index a1c1fd5..e5b1000 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPListenerImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.net.SocketAddress;
@@ -47,126 +44,93 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * LDAP listener implementation.
  */
-public final class LDAPListenerImpl implements Closeable
-{
-  private final TCPNIOTransport transport;
-  private final FilterChain defaultFilterChain;
-  private final ServerConnectionFactory<LDAPClientContext, Integer> connectionFactory;
-  private final TCPNIOServerConnection serverConnection;
+public final class LDAPListenerImpl implements Closeable {
+    private final TCPNIOTransport transport;
+    private final FilterChain defaultFilterChain;
+    private final ServerConnectionFactory<LDAPClientContext, Integer> connectionFactory;
+    private final TCPNIOServerConnection serverConnection;
 
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections using the provided address and connection options.
+     *
+     * @param address
+     *            The address to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @param options
+     *            The LDAP listener options.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     */
+    public LDAPListenerImpl(final SocketAddress address,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory,
+            final LDAPListenerOptions options) throws IOException {
+        if (options.getTCPNIOTransport() == null) {
+            this.transport = DefaultTCPNIOTransport.getInstance();
+        } else {
+            this.transport = options.getTCPNIOTransport();
+        }
+        this.connectionFactory = factory;
 
+        final DecodeOptions decodeOptions = new DecodeOptions(options.getDecodeOptions());
+        this.defaultFilterChain =
+                FilterChainBuilder.stateless().add(new TransportFilter()).add(
+                        new LDAPServerFilter(this, new LDAPReader(decodeOptions), 0)).build();
 
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections using the provided address and connection options.
-   *
-   * @param address
-   *          The address to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @param options
-   *          The LDAP listener options.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   */
-  public LDAPListenerImpl(final SocketAddress address,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory,
-      final LDAPListenerOptions options) throws IOException
-  {
-    if (options.getTCPNIOTransport() == null)
-    {
-      this.transport = DefaultTCPNIOTransport.getInstance();
+        this.serverConnection = transport.bind(address, options.getBacklog());
+        this.serverConnection.setProcessor(defaultFilterChain);
     }
-    else
-    {
-      this.transport = options.getTCPNIOTransport();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() {
+        try {
+            serverConnection.close().get();
+        } catch (final InterruptedException e) {
+            // Cannot handle here.
+            Thread.currentThread().interrupt();
+        } catch (final Exception e) {
+            // Ignore the exception.
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                StaticUtils.DEBUG_LOG.log(Level.WARNING,
+                        "Exception occurred while closing listener:" + e.getMessage(), e);
+            }
+        }
     }
-    this.connectionFactory = factory;
 
-    final DecodeOptions decodeOptions = new DecodeOptions(options
-        .getDecodeOptions());
-    this.defaultFilterChain = FilterChainBuilder
-        .stateless()
-        .add(new TransportFilter())
-        .add(new LDAPServerFilter(this, new LDAPReader(decodeOptions), 0))
-        .build();
-
-    this.serverConnection = transport.bind(address, options.getBacklog());
-    this.serverConnection.setProcessor(defaultFilterChain);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close()
-  {
-    try
-    {
-      serverConnection.close().get();
+    /**
+     * Returns the address that this LDAP listener is listening on.
+     *
+     * @return The address that this LDAP listener is listening on.
+     */
+    public SocketAddress getSocketAddress() {
+        return serverConnection.getLocalAddress();
     }
-    catch (final InterruptedException e)
-    {
-      // Cannot handle here.
-      Thread.currentThread().interrupt();
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("LDAPListener(");
+        builder.append(getSocketAddress().toString());
+        builder.append(')');
+        return builder.toString();
     }
-    catch (final Exception e)
-    {
-      // Ignore the exception.
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        StaticUtils.DEBUG_LOG.log(Level.WARNING,
-            "Exception occurred while closing listener:" + e.getMessage(), e);
-      }
+
+    ServerConnectionFactory<LDAPClientContext, Integer> getConnectionFactory() {
+        return connectionFactory;
     }
-  }
 
-
-
-  /**
-   * Returns the address that this LDAP listener is listening on.
-   *
-   * @return The address that this LDAP listener is listening on.
-   */
-  public SocketAddress getSocketAddress()
-  {
-    return serverConnection.getLocalAddress();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("LDAPListener(");
-    builder.append(getSocketAddress().toString());
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  ServerConnectionFactory<LDAPClientContext, Integer> getConnectionFactory()
-  {
-    return connectionFactory;
-  }
-
-
-
-  FilterChain getDefaultFilterChain()
-  {
-    return defaultFilterChain;
-  }
+    FilterChain getDefaultFilterChain() {
+        return defaultFilterChain;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPMessageHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPMessageHandler.java
index 9ad3a63..048fc63 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPMessageHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPMessageHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,133 +26,97 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
-
-
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.IntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 /**
  * LDAP message handler interface.
  *
  * @param <P>
- *          A user provided handler parameter.
+ *            A user provided handler parameter.
  */
-interface LDAPMessageHandler<P>
-{
-  void abandonRequest(P param, int messageID, AbandonRequest request)
-      throws UnexpectedRequestException, IOException;
+interface LDAPMessageHandler<P> {
+    void abandonRequest(P param, int messageID, AbandonRequest request)
+            throws UnexpectedRequestException, IOException;
 
+    void addRequest(P param, int messageID, AddRequest request) throws UnexpectedRequestException,
+            IOException;
 
+    void addResult(P param, int messageID, Result result) throws UnexpectedResponseException,
+            IOException;
 
-  void addRequest(P param, int messageID, AddRequest request)
-      throws UnexpectedRequestException, IOException;
+    void bindRequest(P param, int messageID, int version, GenericBindRequest request)
+            throws UnexpectedRequestException, IOException;
 
+    void bindResult(P param, int messageID, BindResult result) throws UnexpectedResponseException,
+            IOException;
 
+    void compareRequest(P param, int messageID, CompareRequest request)
+            throws UnexpectedRequestException, IOException;
 
-  void addResult(P param, int messageID, Result result)
-      throws UnexpectedResponseException, IOException;
+    void compareResult(P param, int messageID, CompareResult result)
+            throws UnexpectedResponseException, IOException;
 
+    void deleteRequest(P param, int messageID, DeleteRequest request)
+            throws UnexpectedRequestException, IOException;
 
+    void deleteResult(P param, int messageID, Result result) throws UnexpectedResponseException,
+            IOException;
 
-  void bindRequest(P param, int messageID, int version,
-      GenericBindRequest request) throws UnexpectedRequestException,
-      IOException;
+    <R extends ExtendedResult> void extendedRequest(P param, int messageID,
+            ExtendedRequest<R> request) throws UnexpectedRequestException, IOException;
 
+    void extendedResult(P param, int messageID, ExtendedResult result)
+            throws UnexpectedResponseException, IOException;
 
+    void intermediateResponse(P param, int messageID, IntermediateResponse response)
+            throws UnexpectedResponseException, IOException;
 
-  void bindResult(P param, int messageID, BindResult result)
-      throws UnexpectedResponseException, IOException;
+    void modifyDNRequest(P param, int messageID, ModifyDNRequest request)
+            throws UnexpectedRequestException, IOException;
 
+    void modifyDNResult(P param, int messageID, Result result) throws UnexpectedResponseException,
+            IOException;
 
+    void modifyRequest(P param, int messageID, ModifyRequest request)
+            throws UnexpectedRequestException, IOException;
 
-  void compareRequest(P param, int messageID, CompareRequest request)
-      throws UnexpectedRequestException, IOException;
+    void modifyResult(P param, int messageID, Result result) throws UnexpectedResponseException,
+            IOException;
 
+    void searchRequest(P param, int messageID, SearchRequest request)
+            throws UnexpectedRequestException, IOException;
 
+    void searchResult(P param, int messageID, Result result) throws UnexpectedResponseException,
+            IOException;
 
-  void compareResult(P param, int messageID, CompareResult result)
-      throws UnexpectedResponseException, IOException;
+    void searchResultEntry(P param, int messageID, SearchResultEntry entry)
+            throws UnexpectedResponseException, IOException;
 
+    void searchResultReference(P param, int messageID, SearchResultReference reference)
+            throws UnexpectedResponseException, IOException;
 
+    void unbindRequest(P param, int messageID, UnbindRequest request)
+            throws UnexpectedRequestException, IOException;
 
-  void deleteRequest(P param, int messageID, DeleteRequest request)
-      throws UnexpectedRequestException, IOException;
-
-
-
-  void deleteResult(P param, int messageID, Result result)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  <R extends ExtendedResult> void extendedRequest(P param, int messageID,
-      ExtendedRequest<R> request) throws UnexpectedRequestException,
-      IOException;
-
-
-
-  void extendedResult(P param, int messageID, ExtendedResult result)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  void intermediateResponse(P param, int messageID,
-      IntermediateResponse response) throws UnexpectedResponseException,
-      IOException;
-
-
-
-  void modifyDNRequest(P param, int messageID, ModifyDNRequest request)
-      throws UnexpectedRequestException, IOException;
-
-
-
-  void modifyDNResult(P param, int messageID, Result result)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  void modifyRequest(P param, int messageID, ModifyRequest request)
-      throws UnexpectedRequestException, IOException;
-
-
-
-  void modifyResult(P param, int messageID, Result result)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  void searchRequest(P param, int messageID, SearchRequest request)
-      throws UnexpectedRequestException, IOException;
-
-
-
-  void searchResult(P param, int messageID, Result result)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  void searchResultEntry(P param, int messageID, SearchResultEntry entry)
-      throws UnexpectedResponseException, IOException;
-
-
-
-  void searchResultReference(P param, int messageID,
-      SearchResultReference reference) throws UnexpectedResponseException,
-      IOException;
-
-
-
-  void unbindRequest(P param, int messageID, UnbindRequest request)
-      throws UnexpectedRequestException, IOException;
-
-
-
-  void unrecognizedMessage(P param, int messageID, byte messageTag,
-      ByteString messageBytes) throws UnsupportedMessageException, IOException;
+    void unrecognizedMessage(P param, int messageID, byte messageTag, ByteString messageBytes)
+            throws UnsupportedMessageException, IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java
index 2ba51f4..e2ee7f3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.*;
 import static org.forgerock.opendj.asn1.ASN1Constants.UNIVERSAL_BOOLEAN_TYPE;
 import static org.forgerock.opendj.asn1.ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE;
@@ -42,1778 +39,1444 @@
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.asn1.ASN1Reader;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RDN;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.GenericControl;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.GenericExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Request;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericIntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Response;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Static methods for decoding LDAP messages.
  */
-final class LDAPReader
-{
-  static SearchResultEntry decodeEntry(final ASN1Reader reader,
-      final DecodeOptions options) throws IOException
-  {
-    Entry entry;
+final class LDAPReader {
+    static SearchResultEntry decodeEntry(final ASN1Reader reader, final DecodeOptions options)
+            throws IOException {
+        Entry entry;
 
-    reader.readStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      DN dn;
-      try
-      {
-        dn = DN.valueOf(dnString, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        throw DecodeException.error(e.getMessageObject());
-      }
-
-      entry = options.getEntryFactory().newEntry(dn);
-      reader.readStartSequence();
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          try
-          {
-            final String ads = reader.readOctetStringAsString();
-            AttributeDescription ad;
-            try
-            {
-              ad = AttributeDescription.valueOf(ads, schema);
-            }
-            catch (final LocalizedIllegalArgumentException e)
-            {
-              throw DecodeException.error(e.getMessageObject());
+        reader.readStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            DN dn;
+            try {
+                dn = DN.valueOf(dnString, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                throw DecodeException.error(e.getMessageObject());
             }
 
-            final Attribute attribute = options.getAttributeFactory()
-                .newAttribute(ad);
-
-            reader.readStartSet();
-            try
-            {
-              while (reader.hasNextElement())
-              {
-                attribute.add(reader.readOctetString());
-              }
-              entry.addAttribute(attribute);
-            }
-            finally
-            {
-              reader.readEndSet();
-            }
-          }
-          finally
-          {
-            reader.readEndSequence();
-          }
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Responses.newSearchResultEntry(entry);
-  }
-
-
-
-  private final DecodeOptions options;
-
-
-
-  LDAPReader(final DecodeOptions options)
-  {
-    this.options = options;
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP message.
-   *
-   * @param <P>
-   *          The type of {@code param}.
-   * @param reader
-   *          The ASN.1 reader.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle a decoded
-   *          message.
-   * @param param
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  <P> void decode(final ASN1Reader reader, final LDAPMessageHandler<P> handler,
-      final P param) throws IOException
-  {
-    reader.readStartSequence();
-    try
-    {
-      final int messageID = (int) reader.readInteger();
-      decodeProtocolOp(reader, messageID, handler, param);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 read as an LDAP abandon
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeAbandonRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    final int msgToAbandon = (int) reader.readInteger(OP_TYPE_ABANDON_REQUEST);
-    final AbandonRequest message = Requests.newAbandonRequest(msgToAbandon);
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.abandonRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP add request
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeAddRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Entry entry;
-
-    reader.readStartSequence(OP_TYPE_ADD_REQUEST);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      final DN dn = decodeDN(dnString, schema);
-      entry = options.getEntryFactory().newEntry(dn);
-
-      reader.readStartSequence();
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          try
-          {
-            final String ads = reader.readOctetStringAsString();
-            final AttributeDescription ad = decodeAttributeDescription(ads,
-                schema);
-            final Attribute attribute = options.getAttributeFactory()
-                .newAttribute(ad);
-
-            reader.readStartSet();
-            try
-            {
-              while (reader.hasNextElement())
-              {
-                attribute.add(reader.readOctetString());
-              }
-              entry.addAttribute(attribute);
-            }
-            finally
-            {
-              reader.readEndSet();
-            }
-          }
-          finally
-          {
-            reader.readEndSequence();
-          }
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    final AddRequest message = Requests.newAddRequest(entry);
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.addRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an add response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeAddResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Result message;
-
-    reader.readStartSequence(OP_TYPE_ADD_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String
-          .format("DECODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID,
-              message));
-    }
-
-    handler.addResult(p, messageID, message);
-  }
-
-
-
-  private AttributeDescription decodeAttributeDescription(
-      final String attributeDescription, final Schema schema)
-      throws DecodeException
-  {
-    try
-    {
-      return AttributeDescription.valueOf(attributeDescription, schema);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      throw DecodeException.error(e.getMessageObject());
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 read as an LDAP bind request
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeBindRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    reader.readStartSequence(OP_TYPE_BIND_REQUEST);
-    try
-    {
-      final int protocolVersion = (int) reader.readInteger();
-      final String authName = reader.readOctetStringAsString();
-      final byte authType = reader.peekType();
-      final byte[] authBytes = reader.readOctetString(authType).toByteArray();
-
-      final GenericBindRequest request = Requests.newGenericBindRequest(
-          authName, authType, authBytes);
-
-      decodeControls(reader, request);
-
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-      {
-        StaticUtils.DEBUG_LOG.finer(String.format(
-            "DECODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)",
-            messageID, request.getAuthenticationType(), request));
-      }
-
-      handler.bindRequest(p, messageID, protocolVersion, request);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a bind response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeBindResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    BindResult message;
-
-    reader.readStartSequence(OP_TYPE_BIND_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newBindResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_SERVER_SASL_CREDENTIALS))
-      {
-        message.setServerSASLCredentials(reader
-            .readOctetString(TYPE_SERVER_SASL_CREDENTIALS));
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP BIND RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.bindResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP compare
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeCompareRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    CompareRequest message;
-
-    reader.readStartSequence(OP_TYPE_COMPARE_REQUEST);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      final DN dn = decodeDN(dnString, schema);
-
-      reader.readStartSequence();
-      try
-      {
-        final String ads = reader.readOctetStringAsString();
-        final AttributeDescription ad = decodeAttributeDescription(ads, schema);
-        final ByteString assertionValue = reader.readOctetString();
-        message = Requests.newCompareRequest(dn, ad, assertionValue);
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.compareRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a compare response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeCompareResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    CompareResult message;
-
-    reader.readStartSequence(OP_TYPE_COMPARE_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newCompareResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.compareResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP control.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param request
-   *          The decoded request to decode controls for.
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private void decodeControl(final ASN1Reader reader, final Request request)
-      throws IOException
-  {
-    String oid;
-    boolean isCritical;
-    ByteString value;
-
-    reader.readStartSequence();
-    try
-    {
-      oid = reader.readOctetStringAsString();
-      isCritical = false;
-      value = null;
-      if (reader.hasNextElement()
-          && (reader.peekType() == UNIVERSAL_BOOLEAN_TYPE))
-      {
-        isCritical = reader.readBoolean();
-      }
-      if (reader.hasNextElement()
-          && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE))
-      {
-        value = reader.readOctetString();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    final Control c = GenericControl.newControl(oid, isCritical, value);
-    request.addControl(c);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP control.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param response
-   *          The decoded message to decode controls for.
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private void decodeControl(final ASN1Reader reader, final Response response)
-      throws IOException
-  {
-    String oid;
-    boolean isCritical;
-    ByteString value;
-
-    reader.readStartSequence();
-    try
-    {
-      oid = reader.readOctetStringAsString();
-      isCritical = false;
-      value = null;
-      if (reader.hasNextElement()
-          && (reader.peekType() == UNIVERSAL_BOOLEAN_TYPE))
-      {
-        isCritical = reader.readBoolean();
-      }
-      if (reader.hasNextElement()
-          && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE))
-      {
-        value = reader.readOctetString();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    final Control c = GenericControl.newControl(oid, isCritical, value);
-    response.addControl(c);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a set of controls.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param request
-   *          The decoded message to decode controls for.
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private void decodeControls(final ASN1Reader reader, final Request request)
-      throws IOException
-  {
-    if (reader.hasNextElement() && (reader.peekType() == TYPE_CONTROL_SEQUENCE))
-    {
-      reader.readStartSequence(TYPE_CONTROL_SEQUENCE);
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          decodeControl(reader, request);
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a set of controls.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param response
-   *          The decoded message to decode controls for.
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private void decodeControls(final ASN1Reader reader, final Response response)
-      throws IOException
-  {
-    if (reader.hasNextElement() && (reader.peekType() == TYPE_CONTROL_SEQUENCE))
-    {
-      reader.readStartSequence(TYPE_CONTROL_SEQUENCE);
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          decodeControl(reader, response);
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP delete
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeDeleteRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    final String dnString = reader
-        .readOctetStringAsString(OP_TYPE_DELETE_REQUEST);
-    final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-    final DN dn = decodeDN(dnString, schema);
-    final DeleteRequest message = Requests.newDeleteRequest(dn);
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.deleteRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a delete response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeDeleteResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Result message;
-
-    reader.readStartSequence(OP_TYPE_DELETE_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.deleteResult(p, messageID, message);
-  }
-
-
-
-  private DN decodeDN(final String dn, final Schema schema)
-      throws DecodeException
-  {
-    try
-    {
-      return DN.valueOf(dn, schema);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      throw DecodeException.error(e.getMessageObject());
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP extended
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeExtendedRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    String oid;
-    ByteString value;
-
-    reader.readStartSequence(OP_TYPE_EXTENDED_REQUEST);
-    try
-    {
-      oid = reader.readOctetStringAsString(TYPE_EXTENDED_REQUEST_OID);
-      value = null;
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_EXTENDED_REQUEST_VALUE))
-      {
-        value = reader.readOctetString(TYPE_EXTENDED_REQUEST_VALUE);
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    final GenericExtendedRequest message = Requests.newGenericExtendedRequest(
-        oid, value);
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.extendedRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a extended response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeExtendedResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-
-    GenericExtendedResult message;
-
-    reader.readStartSequence(OP_TYPE_EXTENDED_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newGenericExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_EXTENDED_RESPONSE_OID))
-      {
-        message.setOID(reader
-            .readOctetStringAsString(TYPE_EXTENDED_RESPONSE_OID));
-      }
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_EXTENDED_RESPONSE_VALUE))
-      {
-        message.setValue(reader.readOctetString(TYPE_EXTENDED_RESPONSE_VALUE));
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.extendedResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP intermediate
-   * response protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeIntermediateResponse(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    GenericIntermediateResponse message;
-
-    reader.readStartSequence(OP_TYPE_INTERMEDIATE_RESPONSE);
-    try
-    {
-      message = Responses.newGenericIntermediateResponse();
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_INTERMEDIATE_RESPONSE_OID))
-      {
-        message.setOID(reader
-            .readOctetStringAsString(TYPE_INTERMEDIATE_RESPONSE_OID));
-      }
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_INTERMEDIATE_RESPONSE_VALUE))
-      {
-        message.setValue(reader
-            .readOctetString(TYPE_INTERMEDIATE_RESPONSE_VALUE));
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)",
-          messageID, message));
-    }
-
-    handler.intermediateResponse(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a modify DN request
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeModifyDNRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    ModifyDNRequest message;
-
-    reader.readStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      final DN dn = decodeDN(dnString, schema);
-
-      final String newRDNString = reader.readOctetStringAsString();
-      final RDN newRDN = decodeRDN(newRDNString, schema);
-
-      message = Requests.newModifyDNRequest(dn, newRDN);
-
-      message.setDeleteOldRDN(reader.readBoolean());
-
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_MODIFY_DN_NEW_SUPERIOR))
-      {
-        final String newSuperiorString = reader
-            .readOctetStringAsString(TYPE_MODIFY_DN_NEW_SUPERIOR);
-        final DN newSuperior = decodeDN(newSuperiorString, schema);
-        message.setNewSuperior(newSuperior);
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.modifyDNRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a modify DN response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeModifyDNResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Result message;
-
-    reader.readStartSequence(OP_TYPE_MODIFY_DN_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.modifyDNResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP modify
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeModifyRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    ModifyRequest message;
-
-    reader.readStartSequence(OP_TYPE_MODIFY_REQUEST);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      final DN dn = decodeDN(dnString, schema);
-      message = Requests.newModifyRequest(dn);
-
-      reader.readStartSequence();
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          try
-          {
-            final int typeIntValue = reader.readEnumerated();
-            final ModificationType type = ModificationType
-                .valueOf(typeIntValue);
-            if (type == null)
-            {
-              throw DecodeException
-                  .error(ERR_LDAP_MODIFICATION_DECODE_INVALID_MOD_TYPE
-                      .get(typeIntValue));
-            }
+            entry = options.getEntryFactory().newEntry(dn);
             reader.readStartSequence();
-            try
-            {
-              final String ads = reader.readOctetStringAsString();
-              final AttributeDescription ad = decodeAttributeDescription(ads,
-                  schema);
-              final Attribute attribute = options.getAttributeFactory()
-                  .newAttribute(ad);
+            try {
+                while (reader.hasNextElement()) {
+                    reader.readStartSequence();
+                    try {
+                        final String ads = reader.readOctetStringAsString();
+                        AttributeDescription ad;
+                        try {
+                            ad = AttributeDescription.valueOf(ads, schema);
+                        } catch (final LocalizedIllegalArgumentException e) {
+                            throw DecodeException.error(e.getMessageObject());
+                        }
 
-              reader.readStartSet();
-              try
-              {
-                while (reader.hasNextElement())
-                {
-                  attribute.add(reader.readOctetString());
+                        final Attribute attribute = options.getAttributeFactory().newAttribute(ad);
+
+                        reader.readStartSet();
+                        try {
+                            while (reader.hasNextElement()) {
+                                attribute.add(reader.readOctetString());
+                            }
+                            entry.addAttribute(attribute);
+                        } finally {
+                            reader.readEndSet();
+                        }
+                    } finally {
+                        reader.readEndSequence();
+                    }
                 }
-                message.addModification(new Modification(type, attribute));
-              }
-              finally
-              {
-                reader.readEndSet();
-              }
+            } finally {
+                reader.readEndSequence();
             }
-            finally
-            {
-              reader.readEndSequence();
-            }
-          }
-          finally
-          {
+        } finally {
             reader.readEndSequence();
-          }
         }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
+
+        return Responses.newSearchResultEntry(entry);
     }
 
-    decodeControls(reader, message);
+    private final DecodeOptions options;
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID,
-          message));
+    LDAPReader(final DecodeOptions options) {
+        this.options = options;
     }
 
-    handler.modifyRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a modify response
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeModifyResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Result message;
-
-    reader.readStartSequence(OP_TYPE_MODIFY_RESPONSE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.modifyResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeProtocolOp(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    final byte type = reader.peekType();
-
-    switch (type)
-    {
-    case OP_TYPE_UNBIND_REQUEST: // 0x42
-      decodeUnbindRequest(reader, messageID, handler, p);
-      break;
-    case 0x43: // 0x43
-    case 0x44: // 0x44
-    case 0x45: // 0x45
-    case 0x46: // 0x46
-    case 0x47: // 0x47
-    case 0x48: // 0x48
-    case 0x49: // 0x49
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_DELETE_REQUEST: // 0x4A
-      decodeDeleteRequest(reader, messageID, handler, p);
-      break;
-    case 0x4B: // 0x4B
-    case 0x4C: // 0x4C
-    case 0x4D: // 0x4D
-    case 0x4E: // 0x4E
-    case 0x4F: // 0x4F
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_ABANDON_REQUEST: // 0x50
-      decodeAbandonRequest(reader, messageID, handler, p);
-      break;
-    case 0x51: // 0x51
-    case 0x52: // 0x52
-    case 0x53: // 0x53
-    case 0x54: // 0x54
-    case 0x55: // 0x55
-    case 0x56: // 0x56
-    case 0x57: // 0x57
-    case 0x58: // 0x58
-    case 0x59: // 0x59
-    case 0x5A: // 0x5A
-    case 0x5B: // 0x5B
-    case 0x5C: // 0x5C
-    case 0x5D: // 0x5D
-    case 0x5E: // 0x5E
-    case 0x5F: // 0x5F
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_BIND_REQUEST: // 0x60
-      decodeBindRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_BIND_RESPONSE: // 0x61
-      decodeBindResult(reader, messageID, handler, p);
-      break;
-    case 0x62: // 0x62
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_SEARCH_REQUEST: // 0x63
-      decodeSearchRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_SEARCH_RESULT_ENTRY: // 0x64
-      decodeSearchResultEntry(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_SEARCH_RESULT_DONE: // 0x65
-      decodeSearchResult(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_MODIFY_REQUEST: // 0x66
-      decodeModifyRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_MODIFY_RESPONSE: // 0x67
-      decodeModifyResult(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_ADD_REQUEST: // 0x68
-      decodeAddRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_ADD_RESPONSE: // 0x69
-      decodeAddResult(reader, messageID, handler, p);
-      break;
-    case 0x6A: // 0x6A
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_DELETE_RESPONSE: // 0x6B
-      decodeDeleteResult(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_MODIFY_DN_REQUEST: // 0x6C
-      decodeModifyDNRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_MODIFY_DN_RESPONSE: // 0x6D
-      decodeModifyDNResult(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_COMPARE_REQUEST: // 0x6E
-      decodeCompareRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_COMPARE_RESPONSE: // 0x6F
-      decodeCompareResult(reader, messageID, handler, p);
-      break;
-    case 0x70: // 0x70
-    case 0x71: // 0x71
-    case 0x72: // 0x72
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_SEARCH_RESULT_REFERENCE: // 0x73
-      decodeSearchResultReference(reader, messageID, handler, p);
-      break;
-    case 0x74: // 0x74
-    case 0x75: // 0x75
-    case 0x76: // 0x76
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    case OP_TYPE_EXTENDED_REQUEST: // 0x77
-      decodeExtendedRequest(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_EXTENDED_RESPONSE: // 0x78
-      decodeExtendedResult(reader, messageID, handler, p);
-      break;
-    case OP_TYPE_INTERMEDIATE_RESPONSE: // 0x79
-      decodeIntermediateResponse(reader, messageID, handler, p);
-      break;
-    default:
-      handler.unrecognizedMessage(p, messageID, type, reader
-          .readOctetString(type));
-      break;
-    }
-  }
-
-
-
-  private RDN decodeRDN(final String rdn, final Schema schema)
-      throws DecodeException
-  {
-    try
-    {
-      return RDN.valueOf(rdn, schema);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      throw DecodeException.error(e.getMessageObject());
-    }
-  }
-
-
-
-  private void decodeResponseReferrals(final ASN1Reader reader,
-      final Result message) throws IOException
-  {
-    if (reader.hasNextElement()
-        && (reader.peekType() == TYPE_REFERRAL_SEQUENCE))
-    {
-      reader.readStartSequence(TYPE_REFERRAL_SEQUENCE);
-      try
-      {
-        // Should have at least 1.
-        do
-        {
-          message.addReferralURI((reader.readOctetStringAsString()));
-        }
-        while (reader.hasNextElement());
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP search
-   * request protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeSearchRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    SearchRequest message;
-
-    reader.readStartSequence(OP_TYPE_SEARCH_REQUEST);
-    try
-    {
-      final String baseDNString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(
-          baseDNString);
-      final DN baseDN = decodeDN(baseDNString, schema);
-
-      final int scopeIntValue = reader.readEnumerated();
-      final SearchScope scope = SearchScope.valueOf(scopeIntValue);
-      if (scope == null)
-      {
-        throw DecodeException
-            .error(ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_SCOPE
-                .get(scopeIntValue));
-      }
-
-      final int dereferencePolicyIntValue = reader.readEnumerated();
-      final DereferenceAliasesPolicy dereferencePolicy = DereferenceAliasesPolicy
-          .valueOf(dereferencePolicyIntValue);
-      if (dereferencePolicy == null)
-      {
-        throw DecodeException
-            .error(ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_DEREF
-                .get(dereferencePolicyIntValue));
-      }
-
-      final int sizeLimit = (int) reader.readInteger();
-      final int timeLimit = (int) reader.readInteger();
-      final boolean typesOnly = reader.readBoolean();
-      final Filter filter = LDAPUtils.decodeFilter(reader);
-
-      message = Requests.newSearchRequest(baseDN, scope, filter);
-      message.setDereferenceAliasesPolicy(dereferencePolicy);
-      try
-      {
-        message.setTimeLimit(timeLimit);
-        message.setSizeLimit(sizeLimit);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        throw DecodeException.error(e.getMessageObject());
-      }
-      message.setTypesOnly(typesOnly);
-
-      reader.readStartSequence();
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          message.addAttribute(reader.readOctetStringAsString());
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID,
-          message));
-    }
-
-    handler.searchRequest(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a search result done
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeSearchResult(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-
-    Result message;
-
-    reader.readStartSequence(OP_TYPE_SEARCH_RESULT_DONE);
-    try
-    {
-      final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
-      final String matchedDN = reader.readOctetStringAsString();
-      final String diagnosticMessage = reader.readOctetStringAsString();
-      message = Responses.newResult(resultCode).setMatchedDN(matchedDN)
-          .setDiagnosticMessage(diagnosticMessage);
-      decodeResponseReferrals(reader, message);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID,
-          message));
-    }
-
-    handler.searchResult(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 reader as an LDAP search
-   * result entry protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeSearchResultEntry(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    Entry entry;
-
-    reader.readStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
-    try
-    {
-      final String dnString = reader.readOctetStringAsString();
-      final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
-      final DN dn = decodeDN(dnString, schema);
-      entry = options.getEntryFactory().newEntry(dn);
-
-      reader.readStartSequence();
-      try
-      {
-        while (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          try
-          {
-            final String ads = reader.readOctetStringAsString();
-            final AttributeDescription ad = decodeAttributeDescription(ads,
-                schema);
-            final Attribute attribute = options.getAttributeFactory()
-                .newAttribute(ad);
-
-            reader.readStartSet();
-            try
-            {
-              while (reader.hasNextElement())
-              {
-                attribute.add(reader.readOctetString());
-              }
-              entry.addAttribute(attribute);
-            }
-            finally
-            {
-              reader.readEndSet();
-            }
-          }
-          finally
-          {
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP message.
+     *
+     * @param <P>
+     *            The type of {@code param}.
+     * @param reader
+     *            The ASN.1 reader.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle a decoded
+     *            message.
+     * @param param
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    <P> void decode(final ASN1Reader reader, final LDAPMessageHandler<P> handler, final P param)
+            throws IOException {
+        reader.readStartSequence();
+        try {
+            final int messageID = (int) reader.readInteger();
+            decodeProtocolOp(reader, messageID, handler, param);
+        } finally {
             reader.readEndSequence();
-          }
         }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
     }
 
-    final SearchResultEntry message = Responses.newSearchResultEntry(entry);
-    decodeControls(reader, message);
+    /**
+     * Decodes the elements from the provided ASN.1 read as an LDAP abandon
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeAbandonRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        final int msgToAbandon = (int) reader.readInteger(OP_TYPE_ABANDON_REQUEST);
+        final AbandonRequest message = Requests.newAbandonRequest(msgToAbandon);
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID,
-          message));
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.abandonRequest(p, messageID, message);
     }
 
-    handler.searchResultEntry(p, messageID, message);
-  }
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP add
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeAddRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Entry entry;
 
+        reader.readStartSequence(OP_TYPE_ADD_REQUEST);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            final DN dn = decodeDN(dnString, schema);
+            entry = options.getEntryFactory().newEntry(dn);
 
+            reader.readStartSequence();
+            try {
+                while (reader.hasNextElement()) {
+                    reader.readStartSequence();
+                    try {
+                        final String ads = reader.readOctetStringAsString();
+                        final AttributeDescription ad = decodeAttributeDescription(ads, schema);
+                        final Attribute attribute = options.getAttributeFactory().newAttribute(ad);
 
-  /**
-   * Decodes the elements from the provided ASN.1 reader as a search result
-   * reference protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeSearchResultReference(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    SearchResultReference message;
+                        reader.readStartSet();
+                        try {
+                            while (reader.hasNextElement()) {
+                                attribute.add(reader.readOctetString());
+                            }
+                            entry.addAttribute(attribute);
+                        } finally {
+                            reader.readEndSet();
+                        }
+                    } finally {
+                        reader.readEndSequence();
+                    }
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
 
-    reader.readStartSequence(OP_TYPE_SEARCH_RESULT_REFERENCE);
-    try
-    {
-      message = Responses.newSearchResultReference(reader
-          .readOctetStringAsString());
-      while (reader.hasNextElement())
-      {
-        message.addURI(reader.readOctetStringAsString());
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
+        final AddRequest message = Requests.newAddRequest(entry);
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.addRequest(p, messageID, message);
     }
 
-    decodeControls(reader, message);
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an add response
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeAddResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Result message;
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)",
-          messageID, message));
+        reader.readStartSequence(OP_TYPE_ADD_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newResult(resultCode).setMatchedDN(matchedDN).setDiagnosticMessage(
+                            diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.addResult(p, messageID, message);
     }
 
-    handler.searchResultReference(p, messageID, message);
-  }
-
-
-
-  /**
-   * Decodes the elements from the provided ASN.1 read as an LDAP unbind request
-   * protocol op.
-   *
-   * @param reader
-   *          The ASN.1 reader.
-   * @param messageID
-   *          The decoded message ID for this message.
-   * @param handler
-   *          The <code>LDAPMessageHandler</code> that will handle this decoded
-   *          message.
-   * @param p
-   *          The parameter to pass into the <code>LDAPMessageHandler</code>
-   * @throws IOException
-   *           If an error occurred while reading bytes to decode.
-   */
-  private <P> void decodeUnbindRequest(final ASN1Reader reader,
-      final int messageID, final LDAPMessageHandler<P> handler, final P p)
-      throws IOException
-  {
-    UnbindRequest message;
-    reader.readNull(OP_TYPE_UNBIND_REQUEST);
-    message = Requests.newUnbindRequest();
-
-    decodeControls(reader, message);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "DECODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID,
-          message));
+    private AttributeDescription decodeAttributeDescription(final String attributeDescription,
+            final Schema schema) throws DecodeException {
+        try {
+            return AttributeDescription.valueOf(attributeDescription, schema);
+        } catch (final LocalizedIllegalArgumentException e) {
+            throw DecodeException.error(e.getMessageObject());
+        }
     }
 
-    handler.unbindRequest(p, messageID, message);
-  }
+    /**
+     * Decodes the elements from the provided ASN.1 read as an LDAP bind request
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeBindRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        reader.readStartSequence(OP_TYPE_BIND_REQUEST);
+        try {
+            final int protocolVersion = (int) reader.readInteger();
+            final String authName = reader.readOctetStringAsString();
+            final byte authType = reader.peekType();
+            final byte[] authBytes = reader.readOctetString(authType).toByteArray();
+
+            final GenericBindRequest request =
+                    Requests.newGenericBindRequest(authName, authType, authBytes);
+
+            decodeControls(reader, request);
+
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+                StaticUtils.DEBUG_LOG.finer(String.format(
+                        "DECODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)", messageID,
+                        request.getAuthenticationType(), request));
+            }
+
+            handler.bindRequest(p, messageID, protocolVersion, request);
+        } finally {
+            reader.readEndSequence();
+        }
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a bind response
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeBindResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        BindResult message;
+
+        reader.readStartSequence(OP_TYPE_BIND_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newBindResult(resultCode).setMatchedDN(matchedDN)
+                            .setDiagnosticMessage(diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_SERVER_SASL_CREDENTIALS)) {
+                message.setServerSASLCredentials(reader
+                        .readOctetString(TYPE_SERVER_SASL_CREDENTIALS));
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP BIND RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.bindResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP compare
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeCompareRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        CompareRequest message;
+
+        reader.readStartSequence(OP_TYPE_COMPARE_REQUEST);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            final DN dn = decodeDN(dnString, schema);
+
+            reader.readStartSequence();
+            try {
+                final String ads = reader.readOctetStringAsString();
+                final AttributeDescription ad = decodeAttributeDescription(ads, schema);
+                final ByteString assertionValue = reader.readOctetString();
+                message = Requests.newCompareRequest(dn, ad, assertionValue);
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.compareRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a compare response
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeCompareResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        CompareResult message;
+
+        reader.readStartSequence(OP_TYPE_COMPARE_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newCompareResult(resultCode).setMatchedDN(matchedDN)
+                            .setDiagnosticMessage(diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.compareResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP control.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param request
+     *            The decoded request to decode controls for.
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private void decodeControl(final ASN1Reader reader, final Request request) throws IOException {
+        String oid;
+        boolean isCritical;
+        ByteString value;
+
+        reader.readStartSequence();
+        try {
+            oid = reader.readOctetStringAsString();
+            isCritical = false;
+            value = null;
+            if (reader.hasNextElement() && (reader.peekType() == UNIVERSAL_BOOLEAN_TYPE)) {
+                isCritical = reader.readBoolean();
+            }
+            if (reader.hasNextElement() && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE)) {
+                value = reader.readOctetString();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        final Control c = GenericControl.newControl(oid, isCritical, value);
+        request.addControl(c);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP control.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param response
+     *            The decoded message to decode controls for.
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private void decodeControl(final ASN1Reader reader, final Response response) throws IOException {
+        String oid;
+        boolean isCritical;
+        ByteString value;
+
+        reader.readStartSequence();
+        try {
+            oid = reader.readOctetStringAsString();
+            isCritical = false;
+            value = null;
+            if (reader.hasNextElement() && (reader.peekType() == UNIVERSAL_BOOLEAN_TYPE)) {
+                isCritical = reader.readBoolean();
+            }
+            if (reader.hasNextElement() && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE)) {
+                value = reader.readOctetString();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        final Control c = GenericControl.newControl(oid, isCritical, value);
+        response.addControl(c);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a set of controls.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param request
+     *            The decoded message to decode controls for.
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private void decodeControls(final ASN1Reader reader, final Request request) throws IOException {
+        if (reader.hasNextElement() && (reader.peekType() == TYPE_CONTROL_SEQUENCE)) {
+            reader.readStartSequence(TYPE_CONTROL_SEQUENCE);
+            try {
+                while (reader.hasNextElement()) {
+                    decodeControl(reader, request);
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        }
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a set of controls.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param response
+     *            The decoded message to decode controls for.
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private void decodeControls(final ASN1Reader reader, final Response response)
+            throws IOException {
+        if (reader.hasNextElement() && (reader.peekType() == TYPE_CONTROL_SEQUENCE)) {
+            reader.readStartSequence(TYPE_CONTROL_SEQUENCE);
+            try {
+                while (reader.hasNextElement()) {
+                    decodeControl(reader, response);
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        }
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP delete
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeDeleteRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        final String dnString = reader.readOctetStringAsString(OP_TYPE_DELETE_REQUEST);
+        final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+        final DN dn = decodeDN(dnString, schema);
+        final DeleteRequest message = Requests.newDeleteRequest(dn);
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.deleteRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a delete response
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeDeleteResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Result message;
+
+        reader.readStartSequence(OP_TYPE_DELETE_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newResult(resultCode).setMatchedDN(matchedDN).setDiagnosticMessage(
+                            diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.deleteResult(p, messageID, message);
+    }
+
+    private DN decodeDN(final String dn, final Schema schema) throws DecodeException {
+        try {
+            return DN.valueOf(dn, schema);
+        } catch (final LocalizedIllegalArgumentException e) {
+            throw DecodeException.error(e.getMessageObject());
+        }
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP extended
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeExtendedRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        String oid;
+        ByteString value;
+
+        reader.readStartSequence(OP_TYPE_EXTENDED_REQUEST);
+        try {
+            oid = reader.readOctetStringAsString(TYPE_EXTENDED_REQUEST_OID);
+            value = null;
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_EXTENDED_REQUEST_VALUE)) {
+                value = reader.readOctetString(TYPE_EXTENDED_REQUEST_VALUE);
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        final GenericExtendedRequest message = Requests.newGenericExtendedRequest(oid, value);
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.extendedRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a extended
+     * response protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeExtendedResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+
+        GenericExtendedResult message;
+
+        reader.readStartSequence(OP_TYPE_EXTENDED_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN)
+                            .setDiagnosticMessage(diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_EXTENDED_RESPONSE_OID)) {
+                message.setOID(reader.readOctetStringAsString(TYPE_EXTENDED_RESPONSE_OID));
+            }
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_EXTENDED_RESPONSE_VALUE)) {
+                message.setValue(reader.readOctetString(TYPE_EXTENDED_RESPONSE_VALUE));
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.extendedResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP
+     * intermediate response protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeIntermediateResponse(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        GenericIntermediateResponse message;
+
+        reader.readStartSequence(OP_TYPE_INTERMEDIATE_RESPONSE);
+        try {
+            message = Responses.newGenericIntermediateResponse();
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_INTERMEDIATE_RESPONSE_OID)) {
+                message.setOID(reader.readOctetStringAsString(TYPE_INTERMEDIATE_RESPONSE_OID));
+            }
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_INTERMEDIATE_RESPONSE_VALUE)) {
+                message.setValue(reader.readOctetString(TYPE_INTERMEDIATE_RESPONSE_VALUE));
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)", messageID,
+                    message));
+        }
+
+        handler.intermediateResponse(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a modify DN
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeModifyDNRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        ModifyDNRequest message;
+
+        reader.readStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            final DN dn = decodeDN(dnString, schema);
+
+            final String newRDNString = reader.readOctetStringAsString();
+            final RDN newRDN = decodeRDN(newRDNString, schema);
+
+            message = Requests.newModifyDNRequest(dn, newRDN);
+
+            message.setDeleteOldRDN(reader.readBoolean());
+
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_MODIFY_DN_NEW_SUPERIOR)) {
+                final String newSuperiorString =
+                        reader.readOctetStringAsString(TYPE_MODIFY_DN_NEW_SUPERIOR);
+                final DN newSuperior = decodeDN(newSuperiorString, schema);
+                message.setNewSuperior(newSuperior);
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.modifyDNRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a modify DN
+     * response protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeModifyDNResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Result message;
+
+        reader.readStartSequence(OP_TYPE_MODIFY_DN_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newResult(resultCode).setMatchedDN(matchedDN).setDiagnosticMessage(
+                            diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.modifyDNResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP modify
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeModifyRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        ModifyRequest message;
+
+        reader.readStartSequence(OP_TYPE_MODIFY_REQUEST);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            final DN dn = decodeDN(dnString, schema);
+            message = Requests.newModifyRequest(dn);
+
+            reader.readStartSequence();
+            try {
+                while (reader.hasNextElement()) {
+                    reader.readStartSequence();
+                    try {
+                        final int typeIntValue = reader.readEnumerated();
+                        final ModificationType type = ModificationType.valueOf(typeIntValue);
+                        if (type == null) {
+                            throw DecodeException
+                                    .error(ERR_LDAP_MODIFICATION_DECODE_INVALID_MOD_TYPE
+                                            .get(typeIntValue));
+                        }
+                        reader.readStartSequence();
+                        try {
+                            final String ads = reader.readOctetStringAsString();
+                            final AttributeDescription ad = decodeAttributeDescription(ads, schema);
+                            final Attribute attribute =
+                                    options.getAttributeFactory().newAttribute(ad);
+
+                            reader.readStartSet();
+                            try {
+                                while (reader.hasNextElement()) {
+                                    attribute.add(reader.readOctetString());
+                                }
+                                message.addModification(new Modification(type, attribute));
+                            } finally {
+                                reader.readEndSet();
+                            }
+                        } finally {
+                            reader.readEndSequence();
+                        }
+                    } finally {
+                        reader.readEndSequence();
+                    }
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.modifyRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a modify response
+     * protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeModifyResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Result message;
+
+        reader.readStartSequence(OP_TYPE_MODIFY_RESPONSE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newResult(resultCode).setMatchedDN(matchedDN).setDiagnosticMessage(
+                            diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.modifyResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP protocol
+     * op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeProtocolOp(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        final byte type = reader.peekType();
+
+        switch (type) {
+        case OP_TYPE_UNBIND_REQUEST: // 0x42
+            decodeUnbindRequest(reader, messageID, handler, p);
+            break;
+        case 0x43: // 0x43
+        case 0x44: // 0x44
+        case 0x45: // 0x45
+        case 0x46: // 0x46
+        case 0x47: // 0x47
+        case 0x48: // 0x48
+        case 0x49: // 0x49
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_DELETE_REQUEST: // 0x4A
+            decodeDeleteRequest(reader, messageID, handler, p);
+            break;
+        case 0x4B: // 0x4B
+        case 0x4C: // 0x4C
+        case 0x4D: // 0x4D
+        case 0x4E: // 0x4E
+        case 0x4F: // 0x4F
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_ABANDON_REQUEST: // 0x50
+            decodeAbandonRequest(reader, messageID, handler, p);
+            break;
+        case 0x51: // 0x51
+        case 0x52: // 0x52
+        case 0x53: // 0x53
+        case 0x54: // 0x54
+        case 0x55: // 0x55
+        case 0x56: // 0x56
+        case 0x57: // 0x57
+        case 0x58: // 0x58
+        case 0x59: // 0x59
+        case 0x5A: // 0x5A
+        case 0x5B: // 0x5B
+        case 0x5C: // 0x5C
+        case 0x5D: // 0x5D
+        case 0x5E: // 0x5E
+        case 0x5F: // 0x5F
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_BIND_REQUEST: // 0x60
+            decodeBindRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_BIND_RESPONSE: // 0x61
+            decodeBindResult(reader, messageID, handler, p);
+            break;
+        case 0x62: // 0x62
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_SEARCH_REQUEST: // 0x63
+            decodeSearchRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_SEARCH_RESULT_ENTRY: // 0x64
+            decodeSearchResultEntry(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_SEARCH_RESULT_DONE: // 0x65
+            decodeSearchResult(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_MODIFY_REQUEST: // 0x66
+            decodeModifyRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_MODIFY_RESPONSE: // 0x67
+            decodeModifyResult(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_ADD_REQUEST: // 0x68
+            decodeAddRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_ADD_RESPONSE: // 0x69
+            decodeAddResult(reader, messageID, handler, p);
+            break;
+        case 0x6A: // 0x6A
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_DELETE_RESPONSE: // 0x6B
+            decodeDeleteResult(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_MODIFY_DN_REQUEST: // 0x6C
+            decodeModifyDNRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_MODIFY_DN_RESPONSE: // 0x6D
+            decodeModifyDNResult(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_COMPARE_REQUEST: // 0x6E
+            decodeCompareRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_COMPARE_RESPONSE: // 0x6F
+            decodeCompareResult(reader, messageID, handler, p);
+            break;
+        case 0x70: // 0x70
+        case 0x71: // 0x71
+        case 0x72: // 0x72
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_SEARCH_RESULT_REFERENCE: // 0x73
+            decodeSearchResultReference(reader, messageID, handler, p);
+            break;
+        case 0x74: // 0x74
+        case 0x75: // 0x75
+        case 0x76: // 0x76
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        case OP_TYPE_EXTENDED_REQUEST: // 0x77
+            decodeExtendedRequest(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_EXTENDED_RESPONSE: // 0x78
+            decodeExtendedResult(reader, messageID, handler, p);
+            break;
+        case OP_TYPE_INTERMEDIATE_RESPONSE: // 0x79
+            decodeIntermediateResponse(reader, messageID, handler, p);
+            break;
+        default:
+            handler.unrecognizedMessage(p, messageID, type, reader.readOctetString(type));
+            break;
+        }
+    }
+
+    private RDN decodeRDN(final String rdn, final Schema schema) throws DecodeException {
+        try {
+            return RDN.valueOf(rdn, schema);
+        } catch (final LocalizedIllegalArgumentException e) {
+            throw DecodeException.error(e.getMessageObject());
+        }
+    }
+
+    private void decodeResponseReferrals(final ASN1Reader reader, final Result message)
+            throws IOException {
+        if (reader.hasNextElement() && (reader.peekType() == TYPE_REFERRAL_SEQUENCE)) {
+            reader.readStartSequence(TYPE_REFERRAL_SEQUENCE);
+            try {
+                // Should have at least 1.
+                do {
+                    message.addReferralURI((reader.readOctetStringAsString()));
+                } while (reader.hasNextElement());
+            } finally {
+                reader.readEndSequence();
+            }
+        }
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP search
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeSearchRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        SearchRequest message;
+
+        reader.readStartSequence(OP_TYPE_SEARCH_REQUEST);
+        try {
+            final String baseDNString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(baseDNString);
+            final DN baseDN = decodeDN(baseDNString, schema);
+
+            final int scopeIntValue = reader.readEnumerated();
+            final SearchScope scope = SearchScope.valueOf(scopeIntValue);
+            if (scope == null) {
+                throw DecodeException.error(ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_SCOPE
+                        .get(scopeIntValue));
+            }
+
+            final int dereferencePolicyIntValue = reader.readEnumerated();
+            final DereferenceAliasesPolicy dereferencePolicy =
+                    DereferenceAliasesPolicy.valueOf(dereferencePolicyIntValue);
+            if (dereferencePolicy == null) {
+                throw DecodeException.error(ERR_LDAP_SEARCH_REQUEST_DECODE_INVALID_DEREF
+                        .get(dereferencePolicyIntValue));
+            }
+
+            final int sizeLimit = (int) reader.readInteger();
+            final int timeLimit = (int) reader.readInteger();
+            final boolean typesOnly = reader.readBoolean();
+            final Filter filter = LDAPUtils.decodeFilter(reader);
+
+            message = Requests.newSearchRequest(baseDN, scope, filter);
+            message.setDereferenceAliasesPolicy(dereferencePolicy);
+            try {
+                message.setTimeLimit(timeLimit);
+                message.setSizeLimit(sizeLimit);
+            } catch (final LocalizedIllegalArgumentException e) {
+                throw DecodeException.error(e.getMessageObject());
+            }
+            message.setTypesOnly(typesOnly);
+
+            reader.readStartSequence();
+            try {
+                while (reader.hasNextElement()) {
+                    message.addAttribute(reader.readOctetStringAsString());
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.searchRequest(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a search result
+     * done protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeSearchResult(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+
+        Result message;
+
+        reader.readStartSequence(OP_TYPE_SEARCH_RESULT_DONE);
+        try {
+            final ResultCode resultCode = ResultCode.valueOf(reader.readEnumerated());
+            final String matchedDN = reader.readOctetStringAsString();
+            final String diagnosticMessage = reader.readOctetStringAsString();
+            message =
+                    Responses.newResult(resultCode).setMatchedDN(matchedDN).setDiagnosticMessage(
+                            diagnosticMessage);
+            decodeResponseReferrals(reader, message);
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID, message));
+        }
+
+        handler.searchResult(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as an LDAP search
+     * result entry protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeSearchResultEntry(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        Entry entry;
+
+        reader.readStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
+        try {
+            final String dnString = reader.readOctetStringAsString();
+            final Schema schema = options.getSchemaResolver().resolveSchema(dnString);
+            final DN dn = decodeDN(dnString, schema);
+            entry = options.getEntryFactory().newEntry(dn);
+
+            reader.readStartSequence();
+            try {
+                while (reader.hasNextElement()) {
+                    reader.readStartSequence();
+                    try {
+                        final String ads = reader.readOctetStringAsString();
+                        final AttributeDescription ad = decodeAttributeDescription(ads, schema);
+                        final Attribute attribute = options.getAttributeFactory().newAttribute(ad);
+
+                        reader.readStartSet();
+                        try {
+                            while (reader.hasNextElement()) {
+                                attribute.add(reader.readOctetString());
+                            }
+                            entry.addAttribute(attribute);
+                        } finally {
+                            reader.readEndSet();
+                        }
+                    } finally {
+                        reader.readEndSequence();
+                    }
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        final SearchResultEntry message = Responses.newSearchResultEntry(entry);
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID, message));
+        }
+
+        handler.searchResultEntry(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 reader as a search result
+     * reference protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeSearchResultReference(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        SearchResultReference message;
+
+        reader.readStartSequence(OP_TYPE_SEARCH_RESULT_REFERENCE);
+        try {
+            message = Responses.newSearchResultReference(reader.readOctetStringAsString());
+            while (reader.hasNextElement()) {
+                message.addURI(reader.readOctetStringAsString());
+            }
+        } finally {
+            reader.readEndSequence();
+        }
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)", messageID,
+                    message));
+        }
+
+        handler.searchResultReference(p, messageID, message);
+    }
+
+    /**
+     * Decodes the elements from the provided ASN.1 read as an LDAP unbind
+     * request protocol op.
+     *
+     * @param reader
+     *            The ASN.1 reader.
+     * @param messageID
+     *            The decoded message ID for this message.
+     * @param handler
+     *            The <code>LDAPMessageHandler</code> that will handle this
+     *            decoded message.
+     * @param p
+     *            The parameter to pass into the <code>LDAPMessageHandler</code>
+     * @throws IOException
+     *             If an error occurred while reading bytes to decode.
+     */
+    private <P> void decodeUnbindRequest(final ASN1Reader reader, final int messageID,
+            final LDAPMessageHandler<P> handler, final P p) throws IOException {
+        UnbindRequest message;
+        reader.readNull(OP_TYPE_UNBIND_REQUEST);
+        message = Requests.newUnbindRequest();
+
+        decodeControls(reader, message);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "DECODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID, message));
+        }
+
+        handler.unbindRequest(p, messageID, message);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPSearchFutureResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPSearchFutureResultImpl.java
index 7dc0669..2c98e0c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPSearchFutureResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPSearchFutureResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.ResultCode;
@@ -40,106 +37,79 @@
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
-
-
 /**
  * Search result future implementation.
  */
-final class LDAPSearchFutureResultImpl extends
-    AbstractLDAPFutureResultImpl<Result> implements SearchResultHandler
-{
+final class LDAPSearchFutureResultImpl extends AbstractLDAPFutureResultImpl<Result> implements
+        SearchResultHandler {
 
-  private SearchResultHandler searchResultHandler;
+    private SearchResultHandler searchResultHandler;
 
-  private final SearchRequest request;
+    private final SearchRequest request;
 
-
-
-  LDAPSearchFutureResultImpl(final int requestID, final SearchRequest request,
-      final SearchResultHandler resultHandler,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final Connection connection)
-  {
-    super(requestID, resultHandler, intermediateResponseHandler, connection);
-    this.request = request;
-    this.searchResultHandler = resultHandler;
-  }
-
-
-
-  public boolean handleEntry(final SearchResultEntry entry)
-  {
-    // FIXME: there's a potential race condition here - the future could
-    // get cancelled between the isDone() call and the handler
-    // invocation. We'd need to add support for intermediate handlers in
-    // the synchronizer.
-    if (!isDone())
-    {
-      updateTimestamp();
-      if (searchResultHandler != null)
-      {
-        if (!searchResultHandler.handleEntry(entry))
-        {
-          searchResultHandler = null;
-        }
-      }
+    LDAPSearchFutureResultImpl(final int requestID, final SearchRequest request,
+            final SearchResultHandler resultHandler,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final Connection connection) {
+        super(requestID, resultHandler, intermediateResponseHandler, connection);
+        this.request = request;
+        this.searchResultHandler = resultHandler;
     }
-    return true;
-  }
 
-
-
-  public boolean handleReference(final SearchResultReference reference)
-  {
-    // FIXME: there's a potential race condition here - the future could
-    // get cancelled between the isDone() call and the handler
-    // invocation. We'd need to add support for intermediate handlers in
-    // the synchronizer.
-    if (!isDone())
-    {
-      updateTimestamp();
-      if (searchResultHandler != null)
-      {
-        if (!searchResultHandler.handleReference(reference))
-        {
-          searchResultHandler = null;
+    public boolean handleEntry(final SearchResultEntry entry) {
+        // FIXME: there's a potential race condition here - the future could
+        // get cancelled between the isDone() call and the handler
+        // invocation. We'd need to add support for intermediate handlers in
+        // the synchronizer.
+        if (!isDone()) {
+            updateTimestamp();
+            if (searchResultHandler != null) {
+                if (!searchResultHandler.handleEntry(entry)) {
+                    searchResultHandler = null;
+                }
+            }
         }
-      }
+        return true;
     }
-    return true;
-  }
 
+    public boolean handleReference(final SearchResultReference reference) {
+        // FIXME: there's a potential race condition here - the future could
+        // get cancelled between the isDone() call and the handler
+        // invocation. We'd need to add support for intermediate handlers in
+        // the synchronizer.
+        if (!isDone()) {
+            updateTimestamp();
+            if (searchResultHandler != null) {
+                if (!searchResultHandler.handleReference(reference)) {
+                    searchResultHandler = null;
+                }
+            }
+        }
+        return true;
+    }
 
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("LDAPSearchFutureResultImpl(");
+        sb.append("request = ");
+        sb.append(request);
+        super.toString(sb);
+        sb.append(")");
+        return sb.toString();
+    }
 
-  @Override
-  public String toString()
-  {
-    final StringBuilder sb = new StringBuilder();
-    sb.append("LDAPSearchFutureResultImpl(");
-    sb.append("request = ");
-    sb.append(request);
-    super.toString(sb);
-    sb.append(")");
-    return sb.toString();
-  }
+    SearchRequest getRequest() {
+        return request;
+    }
 
-
-
-  SearchRequest getRequest()
-  {
-    return request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  Result newErrorResult(final ResultCode resultCode,
-      final String diagnosticMessage, final Throwable cause)
-  {
-    return Responses.newResult(resultCode).setDiagnosticMessage(
-        diagnosticMessage).setCause(cause);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    Result newErrorResult(final ResultCode resultCode, final String diagnosticMessage,
+            final Throwable cause) {
+        return Responses.newResult(resultCode).setDiagnosticMessage(diagnosticMessage).setCause(
+                cause);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java
index d44bfbc..b561b06 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.OID_NOTICE_OF_DISCONNECTION;
 
 import java.io.IOException;
@@ -40,16 +37,45 @@
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LDAPClientContext;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.ServerConnection;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.IntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.glassfish.grizzly.Buffer;
 import org.glassfish.grizzly.Connection;
 import org.glassfish.grizzly.Grizzly;
 import org.glassfish.grizzly.attributes.Attribute;
-import org.glassfish.grizzly.filterchain.*;
+import org.glassfish.grizzly.filterchain.BaseFilter;
 import org.glassfish.grizzly.filterchain.Filter;
+import org.glassfish.grizzly.filterchain.FilterChain;
+import org.glassfish.grizzly.filterchain.FilterChainBuilder;
+import org.glassfish.grizzly.filterchain.FilterChainContext;
+import org.glassfish.grizzly.filterchain.NextAction;
 import org.glassfish.grizzly.ssl.SSLEngineConfigurator;
 import org.glassfish.grizzly.ssl.SSLFilter;
 import org.glassfish.grizzly.ssl.SSLUtils;
@@ -57,1134 +83,777 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Grizzly filter implementation for decoding LDAP requests and handling server
  * side logic for SSL and SASL operations over LDAP.
  */
-final class LDAPServerFilter extends BaseFilter
-{
-  private abstract class AbstractHandler<R extends Result> implements
-      IntermediateResponseHandler, ResultHandler<R>
-  {
-    protected final int messageID;
-    protected final Connection<?> connection;
+final class LDAPServerFilter extends BaseFilter {
+    private abstract class AbstractHandler<R extends Result> implements
+            IntermediateResponseHandler, ResultHandler<R> {
+        protected final int messageID;
+        protected final Connection<?> connection;
 
-
-
-    protected AbstractHandler(final int messageID,
-        final Connection<?> connection)
-    {
-      this.messageID = messageID;
-      this.connection = connection;
-    }
-
-
-
-    @Override
-    public final boolean handleIntermediateResponse(
-        final IntermediateResponse response)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.intermediateResponse(asn1Writer, messageID, response);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-        return false;
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-      return true;
-    }
-  }
-
-
-
-  private final class AddHandler extends AbstractHandler<Result>
-  {
-    private AddHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      handleResult(error.getResult());
-    }
-
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.addResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  private final class BindHandler extends AbstractHandler<BindResult>
-  {
-    private BindHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      final Result result = error.getResult();
-      if (result instanceof BindResult)
-      {
-        handleResult((BindResult) result);
-      }
-      else
-      {
-        final BindResult newResult = Responses.newBindResult(result
-            .getResultCode());
-        newResult.setDiagnosticMessage(result.getDiagnosticMessage());
-        newResult.setMatchedDN(result.getMatchedDN());
-        newResult.setCause(result.getCause());
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
-        }
-        handleResult(newResult);
-      }
-    }
-
-
-
-    @Override
-    public void handleResult(final BindResult result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.bindResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  private final class ClientContextImpl implements LDAPClientContext
-  {
-    private final Connection<?> connection;
-
-    private volatile boolean isClosed = false;
-
-    private ServerConnection<Integer> serverConnection = null;
-
-
-
-    private ClientContextImpl(final Connection<?> connection)
-    {
-      this.connection = connection;
-    }
-
-
-
-    @Override
-    public void disconnect()
-    {
-      LDAPServerFilter.notifyConnectionDisconnected(connection, null, null);
-    }
-
-
-
-    @Override
-    public void disconnect(final ResultCode resultCode, final String message)
-    {
-      Validator.ensureNotNull(resultCode);
-
-      final GenericExtendedResult notification = Responses
-          .newGenericExtendedResult(resultCode)
-          .setOID(OID_NOTICE_OF_DISCONNECTION).setDiagnosticMessage(message);
-      sendUnsolicitedNotification(notification);
-      LDAPServerFilter.notifyConnectionDisconnected(connection, resultCode,
-          message);
-    }
-
-
-
-    @Override
-    public InetSocketAddress getLocalAddress()
-    {
-      return (InetSocketAddress) connection.getLocalAddress();
-    }
-
-
-
-    @Override
-    public InetSocketAddress getPeerAddress()
-    {
-      return (InetSocketAddress) connection.getPeerAddress();
-    }
-
-
-
-    @Override
-    public int getSecurityStrengthFactor()
-    {
-      int ssf = 0;
-      final SSLEngine sslEngine = SSLUtils.getSSLEngine(connection);
-      if (sslEngine != null)
-      {
-        final String cipherString = sslEngine.getSession().getCipherSuite();
-        for (final Map.Entry<String, Integer> mapEntry : CIPHER_KEY_SIZES
-            .entrySet())
-        {
-          if (cipherString.indexOf(mapEntry.getKey()) >= 0)
-          {
-            ssf = mapEntry.getValue();
-            break;
-          }
-        }
-      }
-
-      return ssf;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isClosed()
-    {
-      return isClosed;
-    }
-
-
-
-    @Override
-    public void sendUnsolicitedNotification(final ExtendedResult notification)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.extendedResult(asn1Writer, 0, notification);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        LDAPServerFilter.notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-
-
-
-    @Override
-    public void enableConnectionSecurityLayer(
-        final ConnectionSecurityLayer layer)
-    {
-      synchronized (this)
-      {
-        installFilter(new ConnectionSecurityLayerFilter(layer, connection
-            .getTransport().getMemoryManager()));
-      }
-    }
-
-
-
-    @Override
-    public void enableTLS(final SSLContext sslContext,
-        final String[] protocols, final String[] suites,
-        final boolean wantClientAuth, final boolean needClientAuth)
-    {
-      Validator.ensureNotNull(sslContext);
-      synchronized (this)
-      {
-        if (isTLSEnabled())
-        {
-          throw new IllegalStateException("TLS already enabled");
+        protected AbstractHandler(final int messageID, final Connection<?> connection) {
+            this.messageID = messageID;
+            this.connection = connection;
         }
 
-        SSLEngineConfigurator sslEngineConfigurator =
-            new SSLEngineConfigurator(sslContext, false, false, false);
-        sslEngineConfigurator.setEnabledCipherSuites(suites);
-        sslEngineConfigurator.setEnabledProtocols(protocols);
-        sslEngineConfigurator.setWantClientAuth(wantClientAuth);
-        sslEngineConfigurator.setNeedClientAuth(needClientAuth);
-        installFilter(new SSLFilter(sslEngineConfigurator, null));
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString()
-    {
-      StringBuilder builder = new StringBuilder();
-      builder.append("LDAPClientContext(");
-      builder.append(getLocalAddress());
-      builder.append(',');
-      builder.append(getPeerAddress());
-      builder.append(')');
-      return builder.toString();
-    }
-
-
-
-    private void close()
-    {
-      isClosed = true;
-    }
-
-
-
-    private ServerConnection<Integer> getServerConnection()
-    {
-      return serverConnection;
-    }
-
-
-
-    private void setServerConnection(
-        final ServerConnection<Integer> serverConnection)
-    {
-      this.serverConnection = serverConnection;
-    }
-
-
-
-    /**
-     * Installs a new Grizzly filter (e.g. SSL/SASL) beneath the top-level LDAP
-     * filter.
-     *
-     * @param filter
-     *          The filter to be installed.
-     */
-    private void installFilter(final Filter filter)
-    {
-      // Determine the index where the filter should be added.
-      final FilterChain oldFilterChain = (FilterChain) connection.getProcessor();
-      int filterIndex = oldFilterChain.size() - 1;
-      if (filter instanceof SSLFilter)
-      {
-        // Beneath any ConnectionSecurityLayerFilters if present, otherwise
-        // beneath the LDAP filter.
-        for (int i = oldFilterChain.size() - 2; i >= 0; i--)
-        {
-          if (!(oldFilterChain.get(i) instanceof ConnectionSecurityLayerFilter))
-          {
-            filterIndex = i + 1;
-            break;
-          }
-        }
-      }
-
-      // Create the new filter chain.
-      final FilterChain newFilterChain = FilterChainBuilder.stateless()
-          .addAll(oldFilterChain).add(filterIndex, filter).build();
-      connection.setProcessor(newFilterChain);
-    }
-
-
-
-    /**
-     * Indicates whether or not TLS is enabled this provided connection.
-     *
-     * @return {@code true} if TLS is enabled on this connection, otherwise
-     *         {@code false}.
-     */
-    private boolean isTLSEnabled()
-    {
-      synchronized (this)
-      {
-        final FilterChain currentFilterChain = (FilterChain) connection
-            .getProcessor();
-        for (Filter filter : currentFilterChain)
-        {
-          if (filter instanceof SSLFilter)
-          {
+        @Override
+        public final boolean handleIntermediateResponse(final IntermediateResponse response) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.intermediateResponse(asn1Writer, messageID, response);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+                return false;
+            } finally {
+                asn1Writer.recycle();
+            }
             return true;
-          }
         }
-        return false;
-      }
     }
 
-  }
-
-
-
-  private final class CompareHandler extends AbstractHandler<CompareResult>
-  {
-    private CompareHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      final Result result = error.getResult();
-      if (result instanceof CompareResult)
-      {
-        handleResult((CompareResult) result);
-      }
-      else
-      {
-        final CompareResult newResult = Responses.newCompareResult(result
-            .getResultCode());
-        newResult.setDiagnosticMessage(result.getDiagnosticMessage());
-        newResult.setMatchedDN(result.getMatchedDN());
-        newResult.setCause(result.getCause());
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+    private final class AddHandler extends AbstractHandler<Result> {
+        private AddHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
         }
-        handleResult(newResult);
-      }
-    }
 
-
-
-    @Override
-    public void handleResult(final CompareResult result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.compareResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  private final class DeleteHandler extends AbstractHandler<Result>
-  {
-    private DeleteHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      handleResult(error.getResult());
-    }
-
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.deleteResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  private final class ExtendedHandler<R extends ExtendedResult> extends
-      AbstractHandler<R>
-  {
-    private ExtendedHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      final Result result = error.getResult();
-      if (result instanceof ExtendedResult)
-      {
-        handleResult((ExtendedResult) result);
-      }
-      else
-      {
-        final ExtendedResult newResult = Responses
-            .newGenericExtendedResult(result.getResultCode());
-        newResult.setDiagnosticMessage(result.getDiagnosticMessage());
-        newResult.setMatchedDN(result.getMatchedDN());
-        newResult.setCause(result.getCause());
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            handleResult(error.getResult());
         }
-        handleResult(newResult);
-      }
+
+        @Override
+        public void handleResult(final Result result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.addResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
     }
 
+    private final class BindHandler extends AbstractHandler<BindResult> {
+        private BindHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
 
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            final Result result = error.getResult();
+            if (result instanceof BindResult) {
+                handleResult((BindResult) result);
+            } else {
+                final BindResult newResult = Responses.newBindResult(result.getResultCode());
+                newResult.setDiagnosticMessage(result.getDiagnosticMessage());
+                newResult.setMatchedDN(result.getMatchedDN());
+                newResult.setCause(result.getCause());
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+                handleResult(newResult);
+            }
+        }
+
+        @Override
+        public void handleResult(final BindResult result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.bindResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class ClientContextImpl implements LDAPClientContext {
+        private final Connection<?> connection;
+
+        private volatile boolean isClosed = false;
+
+        private ServerConnection<Integer> serverConnection = null;
+
+        private ClientContextImpl(final Connection<?> connection) {
+            this.connection = connection;
+        }
+
+        @Override
+        public void disconnect() {
+            LDAPServerFilter.notifyConnectionDisconnected(connection, null, null);
+        }
+
+        @Override
+        public void disconnect(final ResultCode resultCode, final String message) {
+            Validator.ensureNotNull(resultCode);
+
+            final GenericExtendedResult notification =
+                    Responses.newGenericExtendedResult(resultCode).setOID(
+                            OID_NOTICE_OF_DISCONNECTION).setDiagnosticMessage(message);
+            sendUnsolicitedNotification(notification);
+            LDAPServerFilter.notifyConnectionDisconnected(connection, resultCode, message);
+        }
+
+        @Override
+        public InetSocketAddress getLocalAddress() {
+            return (InetSocketAddress) connection.getLocalAddress();
+        }
+
+        @Override
+        public InetSocketAddress getPeerAddress() {
+            return (InetSocketAddress) connection.getPeerAddress();
+        }
+
+        @Override
+        public int getSecurityStrengthFactor() {
+            int ssf = 0;
+            final SSLEngine sslEngine = SSLUtils.getSSLEngine(connection);
+            if (sslEngine != null) {
+                final String cipherString = sslEngine.getSession().getCipherSuite();
+                for (final Map.Entry<String, Integer> mapEntry : CIPHER_KEY_SIZES.entrySet()) {
+                    if (cipherString.indexOf(mapEntry.getKey()) >= 0) {
+                        ssf = mapEntry.getValue();
+                        break;
+                    }
+                }
+            }
+
+            return ssf;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean isClosed() {
+            return isClosed;
+        }
+
+        @Override
+        public void sendUnsolicitedNotification(final ExtendedResult notification) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.extendedResult(asn1Writer, 0, notification);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                LDAPServerFilter.notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+
+        @Override
+        public void enableConnectionSecurityLayer(final ConnectionSecurityLayer layer) {
+            synchronized (this) {
+                installFilter(new ConnectionSecurityLayerFilter(layer, connection.getTransport()
+                        .getMemoryManager()));
+            }
+        }
+
+        @Override
+        public void enableTLS(final SSLContext sslContext, final String[] protocols,
+                final String[] suites, final boolean wantClientAuth, final boolean needClientAuth) {
+            Validator.ensureNotNull(sslContext);
+            synchronized (this) {
+                if (isTLSEnabled()) {
+                    throw new IllegalStateException("TLS already enabled");
+                }
+
+                SSLEngineConfigurator sslEngineConfigurator =
+                        new SSLEngineConfigurator(sslContext, false, false, false);
+                sslEngineConfigurator.setEnabledCipherSuites(suites);
+                sslEngineConfigurator.setEnabledProtocols(protocols);
+                sslEngineConfigurator.setWantClientAuth(wantClientAuth);
+                sslEngineConfigurator.setNeedClientAuth(needClientAuth);
+                installFilter(new SSLFilter(sslEngineConfigurator, null));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append("LDAPClientContext(");
+            builder.append(getLocalAddress());
+            builder.append(',');
+            builder.append(getPeerAddress());
+            builder.append(')');
+            return builder.toString();
+        }
+
+        private void close() {
+            isClosed = true;
+        }
+
+        private ServerConnection<Integer> getServerConnection() {
+            return serverConnection;
+        }
+
+        private void setServerConnection(final ServerConnection<Integer> serverConnection) {
+            this.serverConnection = serverConnection;
+        }
+
+        /**
+         * Installs a new Grizzly filter (e.g. SSL/SASL) beneath the top-level
+         * LDAP filter.
+         *
+         * @param filter
+         *            The filter to be installed.
+         */
+        private void installFilter(final Filter filter) {
+            // Determine the index where the filter should be added.
+            final FilterChain oldFilterChain = (FilterChain) connection.getProcessor();
+            int filterIndex = oldFilterChain.size() - 1;
+            if (filter instanceof SSLFilter) {
+                // Beneath any ConnectionSecurityLayerFilters if present,
+                // otherwise
+                // beneath the LDAP filter.
+                for (int i = oldFilterChain.size() - 2; i >= 0; i--) {
+                    if (!(oldFilterChain.get(i) instanceof ConnectionSecurityLayerFilter)) {
+                        filterIndex = i + 1;
+                        break;
+                    }
+                }
+            }
+
+            // Create the new filter chain.
+            final FilterChain newFilterChain =
+                    FilterChainBuilder.stateless().addAll(oldFilterChain).add(filterIndex, filter)
+                            .build();
+            connection.setProcessor(newFilterChain);
+        }
+
+        /**
+         * Indicates whether or not TLS is enabled this provided connection.
+         *
+         * @return {@code true} if TLS is enabled on this connection, otherwise
+         *         {@code false}.
+         */
+        private boolean isTLSEnabled() {
+            synchronized (this) {
+                final FilterChain currentFilterChain = (FilterChain) connection.getProcessor();
+                for (Filter filter : currentFilterChain) {
+                    if (filter instanceof SSLFilter) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        }
+
+    }
+
+    private final class CompareHandler extends AbstractHandler<CompareResult> {
+        private CompareHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            final Result result = error.getResult();
+            if (result instanceof CompareResult) {
+                handleResult((CompareResult) result);
+            } else {
+                final CompareResult newResult = Responses.newCompareResult(result.getResultCode());
+                newResult.setDiagnosticMessage(result.getDiagnosticMessage());
+                newResult.setMatchedDN(result.getMatchedDN());
+                newResult.setCause(result.getCause());
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+                handleResult(newResult);
+            }
+        }
+
+        @Override
+        public void handleResult(final CompareResult result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.compareResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class DeleteHandler extends AbstractHandler<Result> {
+        private DeleteHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            handleResult(error.getResult());
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.deleteResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class ExtendedHandler<R extends ExtendedResult> extends AbstractHandler<R> {
+        private ExtendedHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            final Result result = error.getResult();
+            if (result instanceof ExtendedResult) {
+                handleResult((ExtendedResult) result);
+            } else {
+                final ExtendedResult newResult =
+                        Responses.newGenericExtendedResult(result.getResultCode());
+                newResult.setDiagnosticMessage(result.getDiagnosticMessage());
+                newResult.setMatchedDN(result.getMatchedDN());
+                newResult.setCause(result.getCause());
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+                handleResult(newResult);
+            }
+        }
+
+        @Override
+        public void handleResult(final ExtendedResult result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.extendedResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class ModifyDNHandler extends AbstractHandler<Result> {
+        private ModifyDNHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            handleResult(error.getResult());
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.modifyDNResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class ModifyHandler extends AbstractHandler<Result> {
+        private ModifyHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            handleResult(error.getResult());
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.modifyResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    private final class SearchHandler extends AbstractHandler<Result> implements
+            SearchResultHandler {
+        private SearchHandler(final int messageID, final Connection<?> connection) {
+            super(messageID, connection);
+        }
+
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.searchResultEntry(asn1Writer, messageID, entry);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+                return false;
+            } finally {
+                asn1Writer.recycle();
+            }
+            return true;
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            handleResult(error.getResult());
+        }
+
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.searchResultReference(asn1Writer, messageID, reference);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+                return false;
+            } finally {
+                asn1Writer.recycle();
+            }
+            return true;
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
+            try {
+                LDAP_WRITER.searchResult(asn1Writer, messageID, result);
+                connection.write(asn1Writer.getBuffer(), null);
+            } catch (final IOException ioe) {
+                notifyConnectionException(connection, ioe);
+            } finally {
+                asn1Writer.recycle();
+            }
+        }
+    }
+
+    // Map of cipher phrases to effective key size (bits). Taken from the
+    // following RFCs: 5289, 4346, 3268,4132 and 4162.
+    private static final Map<String, Integer> CIPHER_KEY_SIZES;
+
+    static {
+        CIPHER_KEY_SIZES = new LinkedHashMap<String, Integer>();
+        CIPHER_KEY_SIZES.put("_WITH_AES_256_CBC_", 256);
+        CIPHER_KEY_SIZES.put("_WITH_CAMELLIA_256_CBC_", 256);
+        CIPHER_KEY_SIZES.put("_WITH_AES_256_GCM_", 256);
+        CIPHER_KEY_SIZES.put("_WITH_3DES_EDE_CBC_", 112);
+        CIPHER_KEY_SIZES.put("_WITH_AES_128_GCM_", 128);
+        CIPHER_KEY_SIZES.put("_WITH_SEED_CBC_", 128);
+        CIPHER_KEY_SIZES.put("_WITH_CAMELLIA_128_CBC_", 128);
+        CIPHER_KEY_SIZES.put("_WITH_AES_128_CBC_", 128);
+        CIPHER_KEY_SIZES.put("_WITH_IDEA_CBC_", 128);
+        CIPHER_KEY_SIZES.put("_WITH_DES_CBC_", 56);
+        CIPHER_KEY_SIZES.put("_WITH_RC2_CBC_40_", 40);
+        CIPHER_KEY_SIZES.put("_WITH_RC4_40_", 40);
+        CIPHER_KEY_SIZES.put("_WITH_DES40_CBC_", 40);
+        CIPHER_KEY_SIZES.put("_WITH_NULL_", 0);
+    }
+
+    private static final LDAPWriter LDAP_WRITER = new LDAPWriter();
+
+    private static final Attribute<ClientContextImpl> LDAP_CONNECTION_ATTR =
+            Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPServerConnection");
+
+    private static final Attribute<ASN1BufferReader> LDAP_ASN1_READER_ATTR =
+            Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPASN1Reader");
+
+    private static void notifyConnectionClosed(final Connection<?> connection, final int messageID,
+            final UnbindRequest unbindRequest) {
+        final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.remove(connection);
+        if (clientContext != null) {
+            // Close the connection context.
+            clientContext.close();
+
+            // Notify the server connection: it may be null if disconnect is
+            // invoked
+            // during accept.
+            final ServerConnection<Integer> serverConnection = clientContext.getServerConnection();
+            if (serverConnection != null) {
+                serverConnection.handleConnectionClosed(messageID, unbindRequest);
+            }
+
+            // If this close was a result of an unbind request then the
+            // connection
+            // won't actually be closed yet. To avoid TIME_WAIT TCP state, let
+            // the
+            // client disconnect.
+            if (unbindRequest != null) {
+                return;
+            }
+
+            // Close the connection.
+            try {
+                connection.close();
+            } catch (final IOException e) {
+                StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
+            }
+        }
+    }
+
+    private static void notifyConnectionDisconnected(final Connection<?> connection,
+            final ResultCode resultCode, final String message) {
+        final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.remove(connection);
+        if (clientContext != null) {
+            // Close the connection context.
+            clientContext.close();
+
+            // Notify the server connection: it may be null if disconnect is
+            // invoked
+            // during accept.
+            final ServerConnection<Integer> serverConnection = clientContext.getServerConnection();
+            if (serverConnection != null) {
+                serverConnection.handleConnectionDisconnected(resultCode, message);
+            }
+
+            // Close the connection.
+            try {
+                connection.close();
+            } catch (final IOException e) {
+                StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
+            }
+        }
+    }
+
+    private static void notifyConnectionException(final Connection<?> connection,
+            final Throwable error) {
+        final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.remove(connection);
+        if (clientContext != null) {
+            // Close the connection context.
+            clientContext.close();
+
+            // Notify the server connection: it may be null if disconnect is
+            // invoked
+            // during accept.
+            final ServerConnection<Integer> serverConnection = clientContext.getServerConnection();
+            if (serverConnection != null) {
+                serverConnection.handleConnectionError(error);
+            }
+
+            // Close the connection.
+            try {
+                connection.close();
+            } catch (final IOException e) {
+                StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
+            }
+        }
+    }
+
+    private final AbstractLDAPMessageHandler<FilterChainContext> serverRequestHandler =
+            new AbstractLDAPMessageHandler<FilterChainContext>() {
+                @Override
+                public void abandonRequest(final FilterChainContext ctx, final int messageID,
+                        final AbandonRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        conn.handleAbandon(messageID, request);
+                    }
+                }
+
+                @Override
+                public void addRequest(final FilterChainContext ctx, final int messageID,
+                        final AddRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final AddHandler handler = new AddHandler(messageID, ctx.getConnection());
+                        conn.handleAdd(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void bindRequest(final FilterChainContext ctx, final int messageID,
+                        final int version, final GenericBindRequest bindContext)
+                        throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final BindHandler handler = new BindHandler(messageID, ctx.getConnection());
+                        conn.handleBind(messageID, version, bindContext, handler, handler);
+                    }
+                }
+
+                @Override
+                public void compareRequest(final FilterChainContext ctx, final int messageID,
+                        final CompareRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final CompareHandler handler =
+                                new CompareHandler(messageID, ctx.getConnection());
+                        conn.handleCompare(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void deleteRequest(final FilterChainContext ctx, final int messageID,
+                        final DeleteRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final DeleteHandler handler =
+                                new DeleteHandler(messageID, ctx.getConnection());
+                        conn.handleDelete(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public <R extends ExtendedResult> void extendedRequest(
+                        final FilterChainContext ctx, final int messageID,
+                        final ExtendedRequest<R> request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final ExtendedHandler<R> handler =
+                                new ExtendedHandler<R>(messageID, ctx.getConnection());
+                        conn.handleExtendedRequest(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void modifyDNRequest(final FilterChainContext ctx, final int messageID,
+                        final ModifyDNRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final ModifyDNHandler handler =
+                                new ModifyDNHandler(messageID, ctx.getConnection());
+                        conn.handleModifyDN(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void modifyRequest(final FilterChainContext ctx, final int messageID,
+                        final ModifyRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final ModifyHandler handler =
+                                new ModifyHandler(messageID, ctx.getConnection());
+                        conn.handleModify(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void searchRequest(final FilterChainContext ctx, final int messageID,
+                        final SearchRequest request) throws UnexpectedRequestException {
+                    final ClientContextImpl clientContext =
+                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
+                    if (clientContext != null) {
+                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
+                        final SearchHandler handler =
+                                new SearchHandler(messageID, ctx.getConnection());
+                        conn.handleSearch(messageID, request, handler, handler);
+                    }
+                }
+
+                @Override
+                public void unbindRequest(final FilterChainContext ctx, final int messageID,
+                        final UnbindRequest request) {
+                    notifyConnectionClosed(ctx.getConnection(), messageID, request);
+                }
+
+                @Override
+                public void unrecognizedMessage(final FilterChainContext ctx, final int messageID,
+                        final byte messageTag, final ByteString messageBytes) {
+                    notifyConnectionException(ctx.getConnection(), new UnsupportedMessageException(
+                            messageID, messageTag, messageBytes));
+                }
+            };
+
+    private final int maxASN1ElementSize;
+
+    private final LDAPReader ldapReader;
+
+    private final LDAPListenerImpl listener;
+
+    LDAPServerFilter(final LDAPListenerImpl listener, final LDAPReader ldapReader,
+            final int maxASN1ElementSize) {
+        this.listener = listener;
+        this.ldapReader = ldapReader;
+        this.maxASN1ElementSize = maxASN1ElementSize;
+    }
 
     @Override
-    public void handleResult(final ExtendedResult result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.extendedResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
+    public void exceptionOccurred(final FilterChainContext ctx, final Throwable error) {
+        notifyConnectionException(ctx.getConnection(), error);
     }
-  }
-
-
-
-  private final class ModifyDNHandler extends AbstractHandler<Result>
-  {
-    private ModifyDNHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
 
     @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      handleResult(error.getResult());
+    public NextAction handleAccept(final FilterChainContext ctx) throws IOException {
+        final Connection<?> connection = ctx.getConnection();
+        connection.configureBlocking(true);
+        try {
+            final ClientContextImpl clientContext = new ClientContextImpl(connection);
+            final ServerConnection<Integer> serverConn =
+                    listener.getConnectionFactory().handleAccept(clientContext);
+            clientContext.setServerConnection(serverConn);
+            LDAP_CONNECTION_ATTR.set(connection, clientContext);
+        } catch (final ErrorResultException e) {
+            connection.close();
+        }
+
+        return ctx.getStopAction();
     }
 
-
-
     @Override
-    public void handleResult(final Result result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.modifyDNResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
+    public NextAction handleClose(final FilterChainContext ctx) throws IOException {
+        notifyConnectionClosed(ctx.getConnection(), -1, null);
+        return ctx.getStopAction();
     }
-  }
-
-
-
-  private final class ModifyHandler extends AbstractHandler<Result>
-  {
-    private ModifyHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
 
     @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      handleResult(error.getResult());
+    public NextAction handleRead(final FilterChainContext ctx) throws IOException {
+        final Buffer buffer = (Buffer) ctx.getMessage();
+        ASN1BufferReader asn1Reader = LDAP_ASN1_READER_ATTR.get(ctx.getConnection());
+        if (asn1Reader == null) {
+            asn1Reader =
+                    new ASN1BufferReader(maxASN1ElementSize, ctx.getConnection().getTransport()
+                            .getMemoryManager());
+            LDAP_ASN1_READER_ATTR.set(ctx.getConnection(), asn1Reader);
+        }
+        asn1Reader.appendBytesRead(buffer);
+
+        try {
+            while (asn1Reader.elementAvailable()) {
+                ldapReader.decode(asn1Reader, serverRequestHandler, ctx);
+            }
+        } finally {
+            asn1Reader.disposeBytesRead();
+        }
+
+        return ctx.getStopAction();
     }
-
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.modifyResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  private final class SearchHandler extends AbstractHandler<Result> implements
-      SearchResultHandler
-  {
-    private SearchHandler(final int messageID, final Connection<?> connection)
-    {
-      super(messageID, connection);
-    }
-
-
-
-    @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.searchResultEntry(asn1Writer, messageID, entry);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-        return false;
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-      return true;
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      handleResult(error.getResult());
-    }
-
-
-
-    @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.searchResultReference(asn1Writer, messageID, reference);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-        return false;
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-      return true;
-    }
-
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
-      try
-      {
-        LDAP_WRITER.searchResult(asn1Writer, messageID, result);
-        connection.write(asn1Writer.getBuffer(), null);
-      }
-      catch (final IOException ioe)
-      {
-        notifyConnectionException(connection, ioe);
-      }
-      finally
-      {
-        asn1Writer.recycle();
-      }
-    }
-  }
-
-
-
-  // Map of cipher phrases to effective key size (bits). Taken from the
-  // following RFCs: 5289, 4346, 3268,4132 and 4162.
-  private static final Map<String, Integer> CIPHER_KEY_SIZES;
-
-  static
-  {
-    CIPHER_KEY_SIZES = new LinkedHashMap<String, Integer>();
-    CIPHER_KEY_SIZES.put("_WITH_AES_256_CBC_", 256);
-    CIPHER_KEY_SIZES.put("_WITH_CAMELLIA_256_CBC_", 256);
-    CIPHER_KEY_SIZES.put("_WITH_AES_256_GCM_", 256);
-    CIPHER_KEY_SIZES.put("_WITH_3DES_EDE_CBC_", 112);
-    CIPHER_KEY_SIZES.put("_WITH_AES_128_GCM_", 128);
-    CIPHER_KEY_SIZES.put("_WITH_SEED_CBC_", 128);
-    CIPHER_KEY_SIZES.put("_WITH_CAMELLIA_128_CBC_", 128);
-    CIPHER_KEY_SIZES.put("_WITH_AES_128_CBC_", 128);
-    CIPHER_KEY_SIZES.put("_WITH_IDEA_CBC_", 128);
-    CIPHER_KEY_SIZES.put("_WITH_DES_CBC_", 56);
-    CIPHER_KEY_SIZES.put("_WITH_RC2_CBC_40_", 40);
-    CIPHER_KEY_SIZES.put("_WITH_RC4_40_", 40);
-    CIPHER_KEY_SIZES.put("_WITH_DES40_CBC_", 40);
-    CIPHER_KEY_SIZES.put("_WITH_NULL_", 0);
-  }
-
-  private static final LDAPWriter LDAP_WRITER = new LDAPWriter();
-
-  private static final Attribute<ClientContextImpl> LDAP_CONNECTION_ATTR =
-    Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPServerConnection");
-
-  private static final Attribute<ASN1BufferReader> LDAP_ASN1_READER_ATTR =
-    Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("LDAPASN1Reader");
-
-
-
-  private static void notifyConnectionClosed(final Connection<?> connection,
-      final int messageID, final UnbindRequest unbindRequest)
-  {
-    final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR
-        .remove(connection);
-    if (clientContext != null)
-    {
-      // Close the connection context.
-      clientContext.close();
-
-      // Notify the server connection: it may be null if disconnect is invoked
-      // during accept.
-      final ServerConnection<Integer> serverConnection = clientContext
-          .getServerConnection();
-      if (serverConnection != null)
-      {
-        serverConnection.handleConnectionClosed(messageID, unbindRequest);
-      }
-
-      // If this close was a result of an unbind request then the connection
-      // won't actually be closed yet. To avoid TIME_WAIT TCP state, let the
-      // client disconnect.
-      if (unbindRequest != null)
-      {
-        return;
-      }
-
-      // Close the connection.
-      try
-      {
-        connection.close();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
-      }
-    }
-  }
-
-
-
-  private static void notifyConnectionDisconnected(
-      final Connection<?> connection, final ResultCode resultCode,
-      final String message)
-  {
-    final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR
-        .remove(connection);
-    if (clientContext != null)
-    {
-      // Close the connection context.
-      clientContext.close();
-
-      // Notify the server connection: it may be null if disconnect is invoked
-      // during accept.
-      final ServerConnection<Integer> serverConnection = clientContext
-          .getServerConnection();
-      if (serverConnection != null)
-      {
-        serverConnection.handleConnectionDisconnected(resultCode, message);
-      }
-
-      // Close the connection.
-      try
-      {
-        connection.close();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
-      }
-    }
-  }
-
-
-
-  private static void notifyConnectionException(final Connection<?> connection,
-      final Throwable error)
-  {
-    final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR
-        .remove(connection);
-    if (clientContext != null)
-    {
-      // Close the connection context.
-      clientContext.close();
-
-      // Notify the server connection: it may be null if disconnect is invoked
-      // during accept.
-      final ServerConnection<Integer> serverConnection = clientContext
-          .getServerConnection();
-      if (serverConnection != null)
-      {
-        serverConnection.handleConnectionError(error);
-      }
-
-      // Close the connection.
-      try
-      {
-        connection.close();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.warning("Error closing connection: " + e);
-      }
-    }
-  }
-
-
-
-  private final AbstractLDAPMessageHandler<FilterChainContext> serverRequestHandler =
-    new AbstractLDAPMessageHandler<FilterChainContext>()
-  {
-    @Override
-    public void abandonRequest(final FilterChainContext ctx,
-        final int messageID, final AbandonRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        conn.handleAbandon(messageID, request);
-      }
-    }
-
-
-
-    @Override
-    public void addRequest(final FilterChainContext ctx, final int messageID,
-        final AddRequest request) throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final AddHandler handler = new AddHandler(messageID,
-            ctx.getConnection());
-        conn.handleAdd(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void bindRequest(final FilterChainContext ctx, final int messageID,
-        final int version, final GenericBindRequest bindContext)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final BindHandler handler = new BindHandler(messageID,
-            ctx.getConnection());
-        conn.handleBind(messageID, version, bindContext, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void compareRequest(final FilterChainContext ctx,
-        final int messageID, final CompareRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final CompareHandler handler = new CompareHandler(messageID,
-            ctx.getConnection());
-        conn.handleCompare(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void deleteRequest(final FilterChainContext ctx,
-        final int messageID, final DeleteRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final DeleteHandler handler = new DeleteHandler(messageID,
-            ctx.getConnection());
-        conn.handleDelete(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public <R extends ExtendedResult> void extendedRequest(
-        final FilterChainContext ctx, final int messageID,
-        final ExtendedRequest<R> request) throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final ExtendedHandler<R> handler = new ExtendedHandler<R>(messageID,
-            ctx.getConnection());
-        conn.handleExtendedRequest(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void modifyDNRequest(final FilterChainContext ctx,
-        final int messageID, final ModifyDNRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final ModifyDNHandler handler = new ModifyDNHandler(messageID,
-            ctx.getConnection());
-        conn.handleModifyDN(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void modifyRequest(final FilterChainContext ctx,
-        final int messageID, final ModifyRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final ModifyHandler handler = new ModifyHandler(messageID,
-            ctx.getConnection());
-        conn.handleModify(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void searchRequest(final FilterChainContext ctx,
-        final int messageID, final SearchRequest request)
-        throws UnexpectedRequestException
-    {
-      final ClientContextImpl clientContext = LDAP_CONNECTION_ATTR.get(ctx
-          .getConnection());
-      if (clientContext != null)
-      {
-        final ServerConnection<Integer> conn = clientContext
-            .getServerConnection();
-        final SearchHandler handler = new SearchHandler(messageID,
-            ctx.getConnection());
-        conn.handleSearch(messageID, request, handler, handler);
-      }
-    }
-
-
-
-    @Override
-    public void unbindRequest(final FilterChainContext ctx,
-        final int messageID, final UnbindRequest request)
-    {
-      notifyConnectionClosed(ctx.getConnection(), messageID, request);
-    }
-
-
-
-    @Override
-    public void unrecognizedMessage(final FilterChainContext ctx,
-        final int messageID, final byte messageTag,
-        final ByteString messageBytes)
-    {
-      notifyConnectionException(ctx.getConnection(),
-          new UnsupportedMessageException(messageID, messageTag, messageBytes));
-    }
-  };
-
-  private final int maxASN1ElementSize;
-
-  private final LDAPReader ldapReader;
-
-  private final LDAPListenerImpl listener;
-
-
-
-  LDAPServerFilter(final LDAPListenerImpl listener,
-      final LDAPReader ldapReader, final int maxASN1ElementSize)
-  {
-    this.listener = listener;
-    this.ldapReader = ldapReader;
-    this.maxASN1ElementSize = maxASN1ElementSize;
-  }
-
-
-
-  @Override
-  public void exceptionOccurred(final FilterChainContext ctx,
-      final Throwable error)
-  {
-    notifyConnectionException(ctx.getConnection(), error);
-  }
-
-
-
-  @Override
-  public NextAction handleAccept(final FilterChainContext ctx)
-      throws IOException
-  {
-    final Connection<?> connection = ctx.getConnection();
-    connection.configureBlocking(true);
-    try
-    {
-      final ClientContextImpl clientContext = new ClientContextImpl(connection);
-      final ServerConnection<Integer> serverConn = listener
-          .getConnectionFactory().handleAccept(clientContext);
-      clientContext.setServerConnection(serverConn);
-      LDAP_CONNECTION_ATTR.set(connection, clientContext);
-    }
-    catch (final ErrorResultException e)
-    {
-      connection.close();
-    }
-
-    return ctx.getStopAction();
-  }
-
-
-
-  @Override
-  public NextAction handleClose(final FilterChainContext ctx)
-      throws IOException
-  {
-    notifyConnectionClosed(ctx.getConnection(), -1, null);
-    return ctx.getStopAction();
-  }
-
-
-
-  @Override
-  public NextAction handleRead(final FilterChainContext ctx) throws IOException
-  {
-    final Buffer buffer = (Buffer) ctx.getMessage();
-    ASN1BufferReader asn1Reader = LDAP_ASN1_READER_ATTR
-        .get(ctx.getConnection());
-    if (asn1Reader == null)
-    {
-      asn1Reader = new ASN1BufferReader(maxASN1ElementSize, ctx.getConnection()
-          .getTransport().getMemoryManager());
-      LDAP_ASN1_READER_ATTR.set(ctx.getConnection(), asn1Reader);
-    }
-    asn1Reader.appendBytesRead(buffer);
-
-    try
-    {
-      while (asn1Reader.elementAvailable())
-      {
-        ldapReader.decode(asn1Reader, serverRequestHandler, ctx);
-      }
-    }
-    finally
-    {
-      asn1Reader.disposeBytesRead();
-    }
-
-    return ctx.getStopAction();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPUtils.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPUtils.java
index a549bac..8a8ec1d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPUtils.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.*;
 
 import java.io.IOException;
@@ -38,690 +35,508 @@
 
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.FilterVisitor;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
-
-
 /**
  * Common LDAP utility methods which may be used when implementing new controls
  * and extension.
  */
-public final class LDAPUtils
-{
+public final class LDAPUtils {
 
-  private static final FilterVisitor<IOException, ASN1Writer> ASN1_ENCODER =
-    new FilterVisitor<IOException, ASN1Writer>()
-  {
+    private static final FilterVisitor<IOException, ASN1Writer> ASN1_ENCODER =
+            new FilterVisitor<IOException, ASN1Writer>() {
 
-    public IOException visitAndFilter(final ASN1Writer writer,
-        final List<Filter> subFilters)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_AND);
-        for (final Filter subFilter : subFilters)
-        {
-          final IOException e = subFilter.accept(this, writer);
-          if (e != null)
-          {
-            return e;
-          }
+                public IOException visitAndFilter(final ASN1Writer writer,
+                        final List<Filter> subFilters) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_AND);
+                        for (final Filter subFilter : subFilters) {
+                            final IOException e = subFilter.accept(this, writer);
+                            if (e != null) {
+                                return e;
+                            }
+                        }
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitApproxMatchFilter(final ASN1Writer writer,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_APPROXIMATE);
+                        writer.writeOctetString(attributeDescription);
+                        writer.writeOctetString(assertionValue);
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitEqualityMatchFilter(final ASN1Writer writer,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_EQUALITY);
+                        writer.writeOctetString(attributeDescription);
+                        writer.writeOctetString(assertionValue);
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitExtensibleMatchFilter(final ASN1Writer writer,
+                        final String matchingRule, final String attributeDescription,
+                        final ByteString assertionValue, final boolean dnAttributes) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_EXTENSIBLE_MATCH);
+
+                        if (matchingRule != null) {
+                            writer.writeOctetString(TYPE_MATCHING_RULE_ID, matchingRule);
+                        }
+
+                        if (attributeDescription != null) {
+                            writer.writeOctetString(TYPE_MATCHING_RULE_TYPE, attributeDescription);
+                        }
+
+                        writer.writeOctetString(TYPE_MATCHING_RULE_VALUE, assertionValue);
+
+                        if (dnAttributes) {
+                            writer.writeBoolean(TYPE_MATCHING_RULE_DN_ATTRIBUTES, true);
+                        }
+
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitGreaterOrEqualFilter(final ASN1Writer writer,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_GREATER_OR_EQUAL);
+                        writer.writeOctetString(attributeDescription);
+                        writer.writeOctetString(assertionValue);
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitLessOrEqualFilter(final ASN1Writer writer,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_LESS_OR_EQUAL);
+                        writer.writeOctetString(attributeDescription);
+                        writer.writeOctetString(assertionValue);
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitNotFilter(final ASN1Writer writer, final Filter subFilter) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_NOT);
+                        final IOException e = subFilter.accept(this, writer);
+                        if (e != null) {
+                            return e;
+                        }
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitOrFilter(final ASN1Writer writer,
+                        final List<Filter> subFilters) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_OR);
+                        for (final Filter subFilter : subFilters) {
+                            final IOException e = subFilter.accept(this, writer);
+                            if (e != null) {
+                                return e;
+                            }
+                        }
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitPresentFilter(final ASN1Writer writer,
+                        final String attributeDescription) {
+                    try {
+                        writer.writeOctetString(TYPE_FILTER_PRESENCE, attributeDescription);
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitSubstringsFilter(final ASN1Writer writer,
+                        final String attributeDescription, final ByteString initialSubstring,
+                        final List<ByteString> anySubstrings, final ByteString finalSubstring) {
+                    try {
+                        writer.writeStartSequence(TYPE_FILTER_SUBSTRING);
+                        writer.writeOctetString(attributeDescription);
+
+                        writer.writeStartSequence();
+                        if (initialSubstring != null) {
+                            writer.writeOctetString(TYPE_SUBINITIAL, initialSubstring);
+                        }
+
+                        for (final ByteSequence anySubstring : anySubstrings) {
+                            writer.writeOctetString(TYPE_SUBANY, anySubstring);
+                        }
+
+                        if (finalSubstring != null) {
+                            writer.writeOctetString(TYPE_SUBFINAL, finalSubstring);
+                        }
+                        writer.writeEndSequence();
+
+                        writer.writeEndSequence();
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+
+                public IOException visitUnrecognizedFilter(final ASN1Writer writer,
+                        final byte filterTag, final ByteString filterBytes) {
+                    try {
+                        writer.writeOctetString(filterTag, filterBytes);
+                        return null;
+                    } catch (final IOException e) {
+                        return e;
+                    }
+                }
+            };
+
+    /**
+     * Reads the next ASN.1 element from the provided {@code ASN1Reader} as a
+     * {@code Filter}.
+     *
+     * @param reader
+     *            The {@code ASN1Reader} from which the ASN.1 encoded
+     *            {@code Filter} should be read.
+     * @return The decoded {@code Filter}.
+     * @throws IOException
+     *             If an error occurs while reading from {@code reader}.
+     */
+    public static Filter decodeFilter(final ASN1Reader reader) throws IOException {
+        final byte type = reader.peekType();
+
+        switch (type) {
+        case TYPE_FILTER_AND:
+            return decodeAndFilter(reader);
+
+        case TYPE_FILTER_OR:
+            return decodeOrFilter(reader);
+
+        case TYPE_FILTER_NOT:
+            return decodeNotFilter(reader);
+
+        case TYPE_FILTER_EQUALITY:
+            return decodeEqualityMatchFilter(reader);
+
+        case TYPE_FILTER_GREATER_OR_EQUAL:
+            return decodeGreaterOrEqualMatchFilter(reader);
+
+        case TYPE_FILTER_LESS_OR_EQUAL:
+            return decodeLessOrEqualMatchFilter(reader);
+
+        case TYPE_FILTER_APPROXIMATE:
+            return decodeApproxMatchFilter(reader);
+
+        case TYPE_FILTER_SUBSTRING:
+            return decodeSubstringsFilter(reader);
+
+        case TYPE_FILTER_PRESENCE:
+            return Filter.newPresentFilter(reader.readOctetStringAsString(type));
+
+        case TYPE_FILTER_EXTENSIBLE_MATCH:
+            return decodeExtensibleMatchFilter(reader);
+
+        default:
+            return Filter.newUnrecognizedFilter(type, reader.readOctetString(type));
         }
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
     }
 
-
-
-    public IOException visitApproxMatchFilter(final ASN1Writer writer,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_APPROXIMATE);
-        writer.writeOctetString(attributeDescription);
-        writer.writeOctetString(assertionValue);
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
+    /**
+     * Reads the next ASN.1 element from the provided {@code ASN1Reader} as a
+     * {@code SearchResultEntry}.
+     *
+     * @param reader
+     *            The {@code ASN1Reader} from which the ASN.1 encoded
+     *            {@code SearchResultEntry} should be read.
+     * @param options
+     *            The decode options to use when decoding the entry.
+     * @return The decoded {@code SearchResultEntry}.
+     * @throws IOException
+     *             If an error occurs while reading from {@code reader}.
+     */
+    public static SearchResultEntry decodeSearchResultEntry(final ASN1Reader reader,
+            final DecodeOptions options) throws IOException {
+        return LDAPReader.decodeEntry(reader, options);
     }
 
-
-
-    public IOException visitEqualityMatchFilter(final ASN1Writer writer,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_EQUALITY);
-        writer.writeOctetString(attributeDescription);
-        writer.writeOctetString(assertionValue);
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
+    /**
+     * Writes the ASN.1 encoding of the provided {@code Filter} to the provided
+     * {@code ASN1Writer}.
+     *
+     * @param writer
+     *            The {@code ASN1Writer} to which the ASN.1 encoding of the
+     *            provided {@code Filter} should be written.
+     * @param filter
+     *            The filter to be encoded.
+     * @return The updated {@code ASN1Writer}.
+     * @throws IOException
+     *             If an error occurs while writing to {@code writer}.
+     */
+    public static ASN1Writer encodeFilter(final ASN1Writer writer, final Filter filter)
+            throws IOException {
+        final IOException e = filter.accept(ASN1_ENCODER, writer);
+        if (e != null) {
+            throw e;
+        } else {
+            return writer;
+        }
     }
 
+    /**
+     * Writes the ASN.1 encoding of the provided {@code SearchResultEntry} to
+     * the provided {@code ASN1Writer}.
+     *
+     * @param writer
+     *            The {@code ASN1Writer} to which the ASN.1 encoding of the
+     *            provided {@code SearchResultEntry} should be written.
+     * @param entry
+     *            The Search Result Entry to be encoded.
+     * @return The updated {@code ASN1Writer}.
+     * @throws IOException
+     *             If an error occurs while writing to {@code writer}.
+     */
+    public static ASN1Writer encodeSearchResultEntry(final ASN1Writer writer,
+            final SearchResultEntry entry) throws IOException {
+        // FIXME: this should include Controls.
+        LDAPWriter.encodeEntry(writer, entry);
+        return writer;
+    }
 
+    // Decodes an and filter.
+    private static Filter decodeAndFilter(final ASN1Reader reader) throws IOException {
+        Filter filter;
 
-    public IOException visitExtensibleMatchFilter(final ASN1Writer writer,
-        final String matchingRule, final String attributeDescription,
-        final ByteString assertionValue, final boolean dnAttributes)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_EXTENSIBLE_MATCH);
-
-        if (matchingRule != null)
-        {
-          writer.writeOctetString(TYPE_MATCHING_RULE_ID, matchingRule);
+        reader.readStartSequence(TYPE_FILTER_AND);
+        try {
+            if (reader.hasNextElement()) {
+                final List<Filter> subFilters = new LinkedList<Filter>();
+                do {
+                    subFilters.add(decodeFilter(reader));
+                } while (reader.hasNextElement());
+                filter = Filter.newAndFilter(subFilters);
+            } else {
+                // No sub-filters - this is an RFC 4526 absolute true filter.
+                filter = Filter.getAbsoluteTrueFilter();
+            }
+        } finally {
+            reader.readEndSequence();
         }
 
-        if (attributeDescription != null)
-        {
-          writer
-              .writeOctetString(TYPE_MATCHING_RULE_TYPE, attributeDescription);
+        return filter;
+    }
+
+    // Decodes an approximate match filter.
+    private static Filter decodeApproxMatchFilter(final ASN1Reader reader) throws IOException {
+        String attributeDescription;
+        ByteString assertionValue;
+
+        reader.readStartSequence(TYPE_FILTER_APPROXIMATE);
+        try {
+            attributeDescription = reader.readOctetStringAsString();
+            assertionValue = reader.readOctetString();
+        } finally {
+            reader.readEndSequence();
         }
 
-        writer.writeOctetString(TYPE_MATCHING_RULE_VALUE, assertionValue);
+        return Filter.newApproxMatchFilter(attributeDescription, assertionValue);
+    }
 
-        if (dnAttributes)
-        {
-          writer.writeBoolean(TYPE_MATCHING_RULE_DN_ATTRIBUTES, true);
+    // Decodes an equality match filter.
+    private static Filter decodeEqualityMatchFilter(final ASN1Reader reader) throws IOException {
+        String attributeDescription;
+        ByteString assertionValue;
+
+        reader.readStartSequence(TYPE_FILTER_EQUALITY);
+        try {
+            attributeDescription = reader.readOctetStringAsString();
+            assertionValue = reader.readOctetString();
+        } finally {
+            reader.readEndSequence();
         }
 
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
+        return Filter.newEqualityMatchFilter(attributeDescription, assertionValue);
     }
 
+    // Decodes an extensible match filter.
+    private static Filter decodeExtensibleMatchFilter(final ASN1Reader reader) throws IOException {
+        String matchingRule;
+        String attributeDescription;
+        boolean dnAttributes;
+        ByteString assertionValue;
 
-
-    public IOException visitGreaterOrEqualFilter(final ASN1Writer writer,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_GREATER_OR_EQUAL);
-        writer.writeOctetString(attributeDescription);
-        writer.writeOctetString(assertionValue);
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-
-
-
-    public IOException visitLessOrEqualFilter(final ASN1Writer writer,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_LESS_OR_EQUAL);
-        writer.writeOctetString(attributeDescription);
-        writer.writeOctetString(assertionValue);
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-
-
-
-    public IOException visitNotFilter(final ASN1Writer writer,
-        final Filter subFilter)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_NOT);
-        final IOException e = subFilter.accept(this, writer);
-        if (e != null)
-        {
-          return e;
-        }
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-
-
-
-    public IOException visitOrFilter(final ASN1Writer writer,
-        final List<Filter> subFilters)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_OR);
-        for (final Filter subFilter : subFilters)
-        {
-          final IOException e = subFilter.accept(this, writer);
-          if (e != null)
-          {
-            return e;
-          }
-        }
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-
-
-
-    public IOException visitPresentFilter(final ASN1Writer writer,
-        final String attributeDescription)
-    {
-      try
-      {
-        writer.writeOctetString(TYPE_FILTER_PRESENCE, attributeDescription);
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-
-
-
-    public IOException visitSubstringsFilter(final ASN1Writer writer,
-        final String attributeDescription, final ByteString initialSubstring,
-        final List<ByteString> anySubstrings, final ByteString finalSubstring)
-    {
-      try
-      {
-        writer.writeStartSequence(TYPE_FILTER_SUBSTRING);
-        writer.writeOctetString(attributeDescription);
-
-        writer.writeStartSequence();
-        if (initialSubstring != null)
-        {
-          writer.writeOctetString(TYPE_SUBINITIAL, initialSubstring);
+        reader.readStartSequence(TYPE_FILTER_EXTENSIBLE_MATCH);
+        try {
+            matchingRule = null;
+            if (reader.peekType() == TYPE_MATCHING_RULE_ID) {
+                matchingRule = reader.readOctetStringAsString(TYPE_MATCHING_RULE_ID);
+            }
+            attributeDescription = null;
+            if (reader.peekType() == TYPE_MATCHING_RULE_TYPE) {
+                attributeDescription = reader.readOctetStringAsString(TYPE_MATCHING_RULE_TYPE);
+            }
+            dnAttributes = false;
+            if (reader.hasNextElement() && (reader.peekType() == TYPE_MATCHING_RULE_DN_ATTRIBUTES)) {
+                dnAttributes = reader.readBoolean();
+            }
+            assertionValue = reader.readOctetString(TYPE_MATCHING_RULE_VALUE);
+        } finally {
+            reader.readEndSequence();
         }
 
-        for (final ByteSequence anySubstring : anySubstrings)
-        {
-          writer.writeOctetString(TYPE_SUBANY, anySubstring);
+        return Filter.newExtensibleMatchFilter(matchingRule, attributeDescription, assertionValue,
+                dnAttributes);
+    }
+
+    // Decodes a greater than or equal filter.
+    private static Filter decodeGreaterOrEqualMatchFilter(final ASN1Reader reader)
+            throws IOException {
+        String attributeDescription;
+        ByteString assertionValue;
+
+        reader.readStartSequence(TYPE_FILTER_GREATER_OR_EQUAL);
+        try {
+            attributeDescription = reader.readOctetStringAsString();
+            assertionValue = reader.readOctetString();
+        } finally {
+            reader.readEndSequence();
+        }
+        return Filter.newGreaterOrEqualFilter(attributeDescription, assertionValue);
+    }
+
+    // Decodes a less than or equal filter.
+    private static Filter decodeLessOrEqualMatchFilter(final ASN1Reader reader) throws IOException {
+        String attributeDescription;
+        ByteString assertionValue;
+
+        reader.readStartSequence(TYPE_FILTER_LESS_OR_EQUAL);
+        try {
+            attributeDescription = reader.readOctetStringAsString();
+            assertionValue = reader.readOctetString();
+        } finally {
+            reader.readEndSequence();
         }
 
-        if (finalSubstring != null)
-        {
-          writer.writeOctetString(TYPE_SUBFINAL, finalSubstring);
+        return Filter.newLessOrEqualFilter(attributeDescription, assertionValue);
+    }
+
+    // Decodes a not filter.
+    private static Filter decodeNotFilter(final ASN1Reader reader) throws IOException {
+        Filter subFilter;
+
+        reader.readStartSequence(TYPE_FILTER_NOT);
+        try {
+            subFilter = decodeFilter(reader);
+        } finally {
+            reader.readEndSequence();
         }
-        writer.writeEndSequence();
 
-        writer.writeEndSequence();
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
+        return Filter.newNotFilter(subFilter);
     }
 
+    // Decodes an or filter.
+    private static Filter decodeOrFilter(final ASN1Reader reader) throws IOException {
+        Filter filter;
 
-
-    public IOException visitUnrecognizedFilter(final ASN1Writer writer,
-        final byte filterTag, final ByteString filterBytes)
-    {
-      try
-      {
-        writer.writeOctetString(filterTag, filterBytes);
-        return null;
-      }
-      catch (final IOException e)
-      {
-        return e;
-      }
-    }
-  };
-
-
-
-  /**
-   * Reads the next ASN.1 element from the provided {@code ASN1Reader} as a
-   * {@code Filter}.
-   *
-   * @param reader
-   *          The {@code ASN1Reader} from which the ASN.1 encoded {@code Filter}
-   *          should be read.
-   * @return The decoded {@code Filter}.
-   * @throws IOException
-   *           If an error occurs while reading from {@code reader}.
-   */
-  public static Filter decodeFilter(final ASN1Reader reader) throws IOException
-  {
-    final byte type = reader.peekType();
-
-    switch (type)
-    {
-    case TYPE_FILTER_AND:
-      return decodeAndFilter(reader);
-
-    case TYPE_FILTER_OR:
-      return decodeOrFilter(reader);
-
-    case TYPE_FILTER_NOT:
-      return decodeNotFilter(reader);
-
-    case TYPE_FILTER_EQUALITY:
-      return decodeEqualityMatchFilter(reader);
-
-    case TYPE_FILTER_GREATER_OR_EQUAL:
-      return decodeGreaterOrEqualMatchFilter(reader);
-
-    case TYPE_FILTER_LESS_OR_EQUAL:
-      return decodeLessOrEqualMatchFilter(reader);
-
-    case TYPE_FILTER_APPROXIMATE:
-      return decodeApproxMatchFilter(reader);
-
-    case TYPE_FILTER_SUBSTRING:
-      return decodeSubstringsFilter(reader);
-
-    case TYPE_FILTER_PRESENCE:
-      return Filter.newPresentFilter(reader.readOctetStringAsString(type));
-
-    case TYPE_FILTER_EXTENSIBLE_MATCH:
-      return decodeExtensibleMatchFilter(reader);
-
-    default:
-      return Filter.newUnrecognizedFilter(type, reader.readOctetString(type));
-    }
-  }
-
-
-
-  /**
-   * Reads the next ASN.1 element from the provided {@code ASN1Reader} as a
-   * {@code SearchResultEntry}.
-   *
-   * @param reader
-   *          The {@code ASN1Reader} from which the ASN.1 encoded {@code
-   *          SearchResultEntry} should be read.
-   * @param options
-   *          The decode options to use when decoding the entry.
-   * @return The decoded {@code SearchResultEntry}.
-   * @throws IOException
-   *           If an error occurs while reading from {@code reader}.
-   */
-  public static SearchResultEntry decodeSearchResultEntry(
-      final ASN1Reader reader, final DecodeOptions options) throws IOException
-  {
-    return LDAPReader.decodeEntry(reader, options);
-  }
-
-
-
-  /**
-   * Writes the ASN.1 encoding of the provided {@code Filter} to the provided
-   * {@code ASN1Writer}.
-   *
-   * @param writer
-   *          The {@code ASN1Writer} to which the ASN.1 encoding of the provided
-   *          {@code Filter} should be written.
-   * @param filter
-   *          The filter to be encoded.
-   * @return The updated {@code ASN1Writer}.
-   * @throws IOException
-   *           If an error occurs while writing to {@code writer}.
-   */
-  public static ASN1Writer encodeFilter(final ASN1Writer writer,
-      final Filter filter) throws IOException
-  {
-    final IOException e = filter.accept(ASN1_ENCODER, writer);
-    if (e != null)
-    {
-      throw e;
-    }
-    else
-    {
-      return writer;
-    }
-  }
-
-
-
-  /**
-   * Writes the ASN.1 encoding of the provided {@code SearchResultEntry} to the
-   * provided {@code ASN1Writer}.
-   *
-   * @param writer
-   *          The {@code ASN1Writer} to which the ASN.1 encoding of the provided
-   *          {@code SearchResultEntry} should be written.
-   * @param entry
-   *          The Search Result Entry to be encoded.
-   * @return The updated {@code ASN1Writer}.
-   * @throws IOException
-   *           If an error occurs while writing to {@code writer}.
-   */
-  public static ASN1Writer encodeSearchResultEntry(final ASN1Writer writer,
-      final SearchResultEntry entry) throws IOException
-  {
-    // FIXME: this should include Controls.
-    LDAPWriter.encodeEntry(writer, entry);
-    return writer;
-  }
-
-
-
-  // Decodes an and filter.
-  private static Filter decodeAndFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    Filter filter;
-
-    reader.readStartSequence(TYPE_FILTER_AND);
-    try
-    {
-      if (reader.hasNextElement())
-      {
-        final List<Filter> subFilters = new LinkedList<Filter>();
-        do
-        {
-          subFilters.add(decodeFilter(reader));
+        reader.readStartSequence(TYPE_FILTER_OR);
+        try {
+            if (reader.hasNextElement()) {
+                final List<Filter> subFilters = new LinkedList<Filter>();
+                do {
+                    subFilters.add(decodeFilter(reader));
+                } while (reader.hasNextElement());
+                filter = Filter.newOrFilter(subFilters);
+            } else {
+                // No sub-filters - this is an RFC 4526 absolute false filter.
+                filter = Filter.getAbsoluteFalseFilter();
+            }
+        } finally {
+            reader.readEndSequence();
         }
-        while (reader.hasNextElement());
-        filter = Filter.newAndFilter(subFilters);
-      }
-      else
-      {
-        // No sub-filters - this is an RFC 4526 absolute true filter.
-        filter = Filter.getAbsoluteTrueFilter();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
+
+        return filter;
     }
 
-    return filter;
-  }
+    // Decodes a sub-strings filter.
+    private static Filter decodeSubstringsFilter(final ASN1Reader reader) throws IOException {
+        ByteString initialSubstring = null;
+        List<ByteString> anySubstrings = null;
+        ByteString finalSubstring = null;
+        String attributeDescription;
 
-
-
-  // Decodes an approximate match filter.
-  private static Filter decodeApproxMatchFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    String attributeDescription;
-    ByteString assertionValue;
-
-    reader.readStartSequence(TYPE_FILTER_APPROXIMATE);
-    try
-    {
-      attributeDescription = reader.readOctetStringAsString();
-      assertionValue = reader.readOctetString();
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Filter.newApproxMatchFilter(attributeDescription, assertionValue);
-  }
-
-
-
-  // Decodes an equality match filter.
-  private static Filter decodeEqualityMatchFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    String attributeDescription;
-    ByteString assertionValue;
-
-    reader.readStartSequence(TYPE_FILTER_EQUALITY);
-    try
-    {
-      attributeDescription = reader.readOctetStringAsString();
-      assertionValue = reader.readOctetString();
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Filter.newEqualityMatchFilter(attributeDescription, assertionValue);
-  }
-
-
-
-  // Decodes an extensible match filter.
-  private static Filter decodeExtensibleMatchFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    String matchingRule;
-    String attributeDescription;
-    boolean dnAttributes;
-    ByteString assertionValue;
-
-    reader.readStartSequence(TYPE_FILTER_EXTENSIBLE_MATCH);
-    try
-    {
-      matchingRule = null;
-      if (reader.peekType() == TYPE_MATCHING_RULE_ID)
-      {
-        matchingRule = reader.readOctetStringAsString(TYPE_MATCHING_RULE_ID);
-      }
-      attributeDescription = null;
-      if (reader.peekType() == TYPE_MATCHING_RULE_TYPE)
-      {
-        attributeDescription = reader
-            .readOctetStringAsString(TYPE_MATCHING_RULE_TYPE);
-      }
-      dnAttributes = false;
-      if (reader.hasNextElement()
-          && (reader.peekType() == TYPE_MATCHING_RULE_DN_ATTRIBUTES))
-      {
-        dnAttributes = reader.readBoolean();
-      }
-      assertionValue = reader.readOctetString(TYPE_MATCHING_RULE_VALUE);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Filter.newExtensibleMatchFilter(matchingRule, attributeDescription,
-        assertionValue, dnAttributes);
-  }
-
-
-
-  // Decodes a greater than or equal filter.
-  private static Filter decodeGreaterOrEqualMatchFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    String attributeDescription;
-    ByteString assertionValue;
-
-    reader.readStartSequence(TYPE_FILTER_GREATER_OR_EQUAL);
-    try
-    {
-      attributeDescription = reader.readOctetStringAsString();
-      assertionValue = reader.readOctetString();
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-    return Filter.newGreaterOrEqualFilter(attributeDescription, assertionValue);
-  }
-
-
-
-  // Decodes a less than or equal filter.
-  private static Filter decodeLessOrEqualMatchFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    String attributeDescription;
-    ByteString assertionValue;
-
-    reader.readStartSequence(TYPE_FILTER_LESS_OR_EQUAL);
-    try
-    {
-      attributeDescription = reader.readOctetStringAsString();
-      assertionValue = reader.readOctetString();
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Filter.newLessOrEqualFilter(attributeDescription, assertionValue);
-  }
-
-
-
-  // Decodes a not filter.
-  private static Filter decodeNotFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    Filter subFilter;
-
-    reader.readStartSequence(TYPE_FILTER_NOT);
-    try
-    {
-      subFilter = decodeFilter(reader);
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
-
-    return Filter.newNotFilter(subFilter);
-  }
-
-
-
-  // Decodes an or filter.
-  private static Filter decodeOrFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    Filter filter;
-
-    reader.readStartSequence(TYPE_FILTER_OR);
-    try
-    {
-      if (reader.hasNextElement())
-      {
-        final List<Filter> subFilters = new LinkedList<Filter>();
-        do
-        {
-          subFilters.add(decodeFilter(reader));
+        reader.readStartSequence(TYPE_FILTER_SUBSTRING);
+        try {
+            attributeDescription = reader.readOctetStringAsString();
+            reader.readStartSequence();
+            try {
+                // FIXME: There should be at least one element in this substring
+                // filter sequence.
+                if (reader.peekType() == TYPE_SUBINITIAL) {
+                    initialSubstring = reader.readOctetString(TYPE_SUBINITIAL);
+                }
+                if (reader.hasNextElement() && (reader.peekType() == TYPE_SUBANY)) {
+                    anySubstrings = new LinkedList<ByteString>();
+                    do {
+                        anySubstrings.add(reader.readOctetString(TYPE_SUBANY));
+                    } while (reader.hasNextElement() && (reader.peekType() == TYPE_SUBANY));
+                }
+                if (reader.hasNextElement() && (reader.peekType() == TYPE_SUBFINAL)) {
+                    finalSubstring = reader.readOctetString(TYPE_SUBFINAL);
+                }
+            } finally {
+                reader.readEndSequence();
+            }
+        } finally {
+            reader.readEndSequence();
         }
-        while (reader.hasNextElement());
-        filter = Filter.newOrFilter(subFilters);
-      }
-      else
-      {
-        // No sub-filters - this is an RFC 4526 absolute false filter.
-        filter = Filter.getAbsoluteFalseFilter();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
-    }
 
-    return filter;
-  }
-
-
-
-  // Decodes a sub-strings filter.
-  private static Filter decodeSubstringsFilter(final ASN1Reader reader)
-      throws IOException
-  {
-    ByteString initialSubstring = null;
-    List<ByteString> anySubstrings = null;
-    ByteString finalSubstring = null;
-    String attributeDescription;
-
-    reader.readStartSequence(TYPE_FILTER_SUBSTRING);
-    try
-    {
-      attributeDescription = reader.readOctetStringAsString();
-      reader.readStartSequence();
-      try
-      {
-        // FIXME: There should be at least one element in this substring
-        // filter sequence.
-        if (reader.peekType() == TYPE_SUBINITIAL)
-        {
-          initialSubstring = reader.readOctetString(TYPE_SUBINITIAL);
+        if (anySubstrings == null) {
+            anySubstrings = Collections.emptyList();
         }
-        if (reader.hasNextElement() && (reader.peekType() == TYPE_SUBANY))
-        {
-          anySubstrings = new LinkedList<ByteString>();
-          do
-          {
-            anySubstrings.add(reader.readOctetString(TYPE_SUBANY));
-          }
-          while (reader.hasNextElement() && (reader.peekType() == TYPE_SUBANY));
-        }
-        if (reader.hasNextElement() && (reader.peekType() == TYPE_SUBFINAL))
-        {
-          finalSubstring = reader.readOctetString(TYPE_SUBFINAL);
-        }
-      }
-      finally
-      {
-        reader.readEndSequence();
-      }
-    }
-    finally
-    {
-      reader.readEndSequence();
+
+        return Filter.newSubstringsFilter(attributeDescription, initialSubstring, anySubstrings,
+                finalSubstring);
     }
 
-    if (anySubstrings == null)
-    {
-      anySubstrings = Collections.emptyList();
+    /**
+     * Prevent instantiation.
+     */
+    private LDAPUtils() {
+        // Nothing to do.
     }
-
-    return Filter.newSubstringsFilter(attributeDescription, initialSubstring,
-        anySubstrings, finalSubstring);
-  }
-
-
-
-  /**
-   * Prevent instantiation.
-   */
-  private LDAPUtils()
-  {
-    // Nothing to do.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java
index 7b1d9a1..a1aa9eb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.*;
 
 import java.io.IOException;
@@ -42,637 +39,488 @@
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Modification;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Request;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.IntermediateResponse;
+import org.forgerock.opendj.ldap.responses.Response;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Static methods for encoding LDAP messages.
  */
-final class LDAPWriter implements LDAPMessageHandler<ASN1Writer>
-{
-  public static void encodeControl(final ASN1Writer writer,
-      final Control control) throws IOException
-  {
-    writer.writeStartSequence();
-    writer.writeOctetString(control.getOID());
-    if (control.isCritical())
-    {
-      writer.writeBoolean(control.isCritical());
-    }
-    if (control.getValue() != null)
-    {
-      writer.writeOctetString(control.getValue());
-    }
-    writer.writeEndSequence();
-  }
-
-
-
-  public static void encodeEntry(final ASN1Writer writer,
-      final SearchResultEntry searchResultEntry) throws IOException
-  {
-    writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
-    writer.writeOctetString(searchResultEntry.getName().toString());
-
-    writer.writeStartSequence();
-    for (final Attribute attr : searchResultEntry.getAllAttributes())
-    {
-      encodeAttribute(writer, attr);
-    }
-    writer.writeEndSequence();
-    writer.writeEndSequence();
-  }
-
-
-
-  private static void encodeAttribute(final ASN1Writer writer,
-      final Attribute attribute) throws IOException
-  {
-    writer.writeStartSequence();
-    writer.writeOctetString(attribute.getAttributeDescriptionAsString());
-
-    writer.writeStartSet();
-    for (final ByteString value : attribute)
-    {
-      writer.writeOctetString(value);
-    }
-    writer.writeEndSequence();
-
-    writer.writeEndSequence();
-  }
-
-
-
-  private static void encodeChange(final ASN1Writer writer,
-      final Modification change) throws IOException
-  {
-    writer.writeStartSequence();
-    writer.writeEnumerated(change.getModificationType().intValue());
-    encodeAttribute(writer, change.getAttribute());
-    writer.writeEndSequence();
-  }
-
-
-
-  private static void encodeMessageFooter(final ASN1Writer writer,
-      final Request request) throws IOException
-  {
-    final List<Control> controls = request.getControls();
-    if (!controls.isEmpty())
-    {
-      writer.writeStartSequence(TYPE_CONTROL_SEQUENCE);
-      for (final Control control : controls)
-      {
-        encodeControl(writer, control);
-      }
-      writer.writeEndSequence();
+final class LDAPWriter implements LDAPMessageHandler<ASN1Writer> {
+    public static void encodeControl(final ASN1Writer writer, final Control control)
+            throws IOException {
+        writer.writeStartSequence();
+        writer.writeOctetString(control.getOID());
+        if (control.isCritical()) {
+            writer.writeBoolean(control.isCritical());
+        }
+        if (control.getValue() != null) {
+            writer.writeOctetString(control.getValue());
+        }
+        writer.writeEndSequence();
     }
 
-    writer.writeEndSequence();
-  }
+    public static void encodeEntry(final ASN1Writer writer,
+            final SearchResultEntry searchResultEntry) throws IOException {
+        writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
+        writer.writeOctetString(searchResultEntry.getName().toString());
 
-
-
-  private static void encodeMessageFooter(final ASN1Writer writer,
-      final Response response) throws IOException
-  {
-    final List<Control> controls = response.getControls();
-    if (!controls.isEmpty())
-    {
-      writer.writeStartSequence(TYPE_CONTROL_SEQUENCE);
-      for (final Control control : controls)
-      {
-        encodeControl(writer, control);
-      }
-      writer.writeEndSequence();
+        writer.writeStartSequence();
+        for (final Attribute attr : searchResultEntry.getAllAttributes()) {
+            encodeAttribute(writer, attr);
+        }
+        writer.writeEndSequence();
+        writer.writeEndSequence();
     }
 
-    writer.writeEndSequence();
-  }
+    private static void encodeAttribute(final ASN1Writer writer, final Attribute attribute)
+            throws IOException {
+        writer.writeStartSequence();
+        writer.writeOctetString(attribute.getAttributeDescriptionAsString());
 
+        writer.writeStartSet();
+        for (final ByteString value : attribute) {
+            writer.writeOctetString(value);
+        }
+        writer.writeEndSequence();
 
-
-  private static void encodeMessageHeader(final ASN1Writer writer,
-      final int messageID) throws IOException
-  {
-    writer.writeStartSequence();
-    writer.writeInteger(messageID);
-  }
-
-
-
-  private static void encodeResultFooter(final ASN1Writer writer)
-      throws IOException
-  {
-    writer.writeEndSequence();
-  }
-
-
-
-  private static void encodeResultHeader(final ASN1Writer writer,
-      final byte typeTag, final Result rawMessage) throws IOException
-  {
-    writer.writeStartSequence(typeTag);
-    writer.writeEnumerated(rawMessage.getResultCode().intValue());
-    writer.writeOctetString(rawMessage.getMatchedDN());
-    writer.writeOctetString(rawMessage.getDiagnosticMessage());
-
-    final List<String> referralURIs = rawMessage.getReferralURIs();
-    if (!referralURIs.isEmpty())
-    {
-      writer.writeStartSequence(TYPE_REFERRAL_SEQUENCE);
-      for (final String s : referralURIs)
-      {
-        writer.writeOctetString(s);
-      }
-      writer.writeEndSequence();
-    }
-  }
-
-
-
-  public void abandonRequest(final ASN1Writer writer, final int messageID,
-      final AbandonRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeInteger(OP_TYPE_ABANDON_REQUEST, request.getRequestID());
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void addRequest(final ASN1Writer writer, final int messageID,
-      final AddRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_ADD_REQUEST);
-    writer.writeOctetString(request.getName().toString());
-
-    // Write the attributes
-    writer.writeStartSequence();
-    for (final Attribute attr : request.getAllAttributes())
-    {
-      encodeAttribute(writer, attr);
-    }
-    writer.writeEndSequence();
-
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void addResult(final ASN1Writer writer, final int messageID,
-      final Result result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG
-          .finer(String.format(
-              "ENCODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID,
-              result));
-    }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_ADD_RESPONSE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
-
-
-
-  public void bindRequest(final ASN1Writer writer, final int messageID,
-      final int version, final GenericBindRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)",
-          messageID, request.getAuthenticationType(), request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_BIND_REQUEST);
-
-    writer.writeInteger(version);
-    writer.writeOctetString(request.getName());
-    writer.writeOctetString(request.getAuthenticationType(), request
-        .getAuthenticationValue());
-
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void bindResult(final ASN1Writer writer, final int messageID,
-      final BindResult result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String
-          .format("ENCODE LDAP BIND RESULT(messageID=%d, result=%s)",
-              messageID, result));
-    }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_BIND_RESPONSE, result);
-
-    final ByteString saslCredentials = result.getServerSASLCredentials();
-    if (saslCredentials != null && saslCredentials.length() > 0)
-    {
-      writer.writeOctetString(TYPE_SERVER_SASL_CREDENTIALS, result
-          .getServerSASLCredentials());
+        writer.writeEndSequence();
     }
 
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
-
-
-
-  public void compareRequest(final ASN1Writer writer, final int messageID,
-      final CompareRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
-    writer.writeOctetString(request.getName().toString());
-
-    writer.writeStartSequence();
-    writer.writeOctetString(request.getAttributeDescription().toString());
-    writer.writeOctetString(request.getAssertionValue());
-    writer.writeEndSequence();
-
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void compareResult(final ASN1Writer writer, final int messageID,
-      final CompareResult result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID,
-          result));
-    }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_COMPARE_RESPONSE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
-
-
-
-  public void deleteRequest(final ASN1Writer writer, final int messageID,
-      final DeleteRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeOctetString(OP_TYPE_DELETE_REQUEST, request.getName()
-        .toString());
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void deleteResult(final ASN1Writer writer, final int messageID,
-      final Result result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID,
-          result));
-    }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_DELETE_RESPONSE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
-
-
-
-  public <R extends ExtendedResult> void extendedRequest(
-      final ASN1Writer writer, final int messageID,
-      final ExtendedRequest<R> request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_EXTENDED_REQUEST);
-    writer.writeOctetString(TYPE_EXTENDED_REQUEST_OID, request.getOID());
-
-    final ByteString requestValue = request.getValue();
-    if (requestValue != null)
-    {
-      writer.writeOctetString(TYPE_EXTENDED_REQUEST_VALUE, requestValue);
+    private static void encodeChange(final ASN1Writer writer, final Modification change)
+            throws IOException {
+        writer.writeStartSequence();
+        writer.writeEnumerated(change.getModificationType().intValue());
+        encodeAttribute(writer, change.getAttribute());
+        writer.writeEndSequence();
     }
 
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
+    private static void encodeMessageFooter(final ASN1Writer writer, final Request request)
+            throws IOException {
+        final List<Control> controls = request.getControls();
+        if (!controls.isEmpty()) {
+            writer.writeStartSequence(TYPE_CONTROL_SEQUENCE);
+            for (final Control control : controls) {
+                encodeControl(writer, control);
+            }
+            writer.writeEndSequence();
+        }
 
-
-
-  public void extendedResult(final ASN1Writer writer, final int messageID,
-      final ExtendedResult result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID,
-          result));
-    }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_EXTENDED_RESPONSE, result);
-
-    final String responseName = result.getOID();
-    final ByteString responseValue = result.getValue();
-
-    if (responseName != null)
-    {
-      writer.writeOctetString(TYPE_EXTENDED_RESPONSE_OID, responseName);
+        writer.writeEndSequence();
     }
 
-    if (responseValue != null)
-    {
-      writer.writeOctetString(TYPE_EXTENDED_RESPONSE_VALUE, responseValue);
+    private static void encodeMessageFooter(final ASN1Writer writer, final Response response)
+            throws IOException {
+        final List<Control> controls = response.getControls();
+        if (!controls.isEmpty()) {
+            writer.writeStartSequence(TYPE_CONTROL_SEQUENCE);
+            for (final Control control : controls) {
+                encodeControl(writer, control);
+            }
+            writer.writeEndSequence();
+        }
+
+        writer.writeEndSequence();
     }
 
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
-
-
-
-  public void intermediateResponse(final ASN1Writer writer,
-      final int messageID, final IntermediateResponse response)
-      throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)",
-          messageID, response));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_INTERMEDIATE_RESPONSE);
-
-    final String responseName = response.getOID();
-    final ByteString responseValue = response.getValue();
-
-    if (responseName != null)
-    {
-      writer
-          .writeOctetString(TYPE_INTERMEDIATE_RESPONSE_OID, response.getOID());
+    private static void encodeMessageHeader(final ASN1Writer writer, final int messageID)
+            throws IOException {
+        writer.writeStartSequence();
+        writer.writeInteger(messageID);
     }
 
-    if (responseValue != null)
-    {
-      writer.writeOctetString(TYPE_INTERMEDIATE_RESPONSE_VALUE, response
-          .getValue());
+    private static void encodeResultFooter(final ASN1Writer writer) throws IOException {
+        writer.writeEndSequence();
     }
 
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, response);
-  }
+    private static void encodeResultHeader(final ASN1Writer writer, final byte typeTag,
+            final Result rawMessage) throws IOException {
+        writer.writeStartSequence(typeTag);
+        writer.writeEnumerated(rawMessage.getResultCode().intValue());
+        writer.writeOctetString(rawMessage.getMatchedDN());
+        writer.writeOctetString(rawMessage.getDiagnosticMessage());
 
-
-
-  public void modifyDNRequest(final ASN1Writer writer, final int messageID,
-      final ModifyDNRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID,
-          request));
-    }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
-    writer.writeOctetString(request.getName().toString());
-    writer.writeOctetString(request.getNewRDN().toString());
-    writer.writeBoolean(request.isDeleteOldRDN());
-
-    final DN newSuperior = request.getNewSuperior();
-    if (newSuperior != null)
-    {
-      writer.writeOctetString(TYPE_MODIFY_DN_NEW_SUPERIOR, newSuperior
-          .toString());
+        final List<String> referralURIs = rawMessage.getReferralURIs();
+        if (!referralURIs.isEmpty()) {
+            writer.writeStartSequence(TYPE_REFERRAL_SEQUENCE);
+            for (final String s : referralURIs) {
+                writer.writeOctetString(s);
+            }
+            writer.writeEndSequence();
+        }
     }
 
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void modifyDNResult(final ASN1Writer writer, final int messageID,
-      final Result result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID,
-          result));
+    public void abandonRequest(final ASN1Writer writer, final int messageID,
+            final AbandonRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP ABANDON REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeInteger(OP_TYPE_ABANDON_REQUEST, request.getRequestID());
+        encodeMessageFooter(writer, request);
     }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_MODIFY_DN_RESPONSE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
 
+    public void addRequest(final ASN1Writer writer, final int messageID, final AddRequest request)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP ADD REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_ADD_REQUEST);
+        writer.writeOctetString(request.getName().toString());
 
+        // Write the attributes
+        writer.writeStartSequence();
+        for (final Attribute attr : request.getAllAttributes()) {
+            encodeAttribute(writer, attr);
+        }
+        writer.writeEndSequence();
 
-  public void modifyRequest(final ASN1Writer writer, final int messageID,
-      final ModifyRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID,
-          request));
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
     }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_MODIFY_REQUEST);
-    writer.writeOctetString(request.getName().toString());
 
-    writer.writeStartSequence();
-    for (final Modification change : request.getModifications())
-    {
-      encodeChange(writer, change);
+    public void addResult(final ASN1Writer writer, final int messageID, final Result result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP ADD RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_ADD_RESPONSE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
     }
-    writer.writeEndSequence();
 
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
+    public void bindRequest(final ASN1Writer writer, final int messageID, final int version,
+            final GenericBindRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP BIND REQUEST(messageID=%d, auth=0x%x, request=%s)", messageID,
+                    request.getAuthenticationType(), request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_BIND_REQUEST);
 
+        writer.writeInteger(version);
+        writer.writeOctetString(request.getName());
+        writer.writeOctetString(request.getAuthenticationType(), request.getAuthenticationValue());
 
-
-  public void modifyResult(final ASN1Writer writer, final int messageID,
-      final Result result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID,
-          result));
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
     }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_MODIFY_RESPONSE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
 
+    public void bindResult(final ASN1Writer writer, final int messageID, final BindResult result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP BIND RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_BIND_RESPONSE, result);
 
+        final ByteString saslCredentials = result.getServerSASLCredentials();
+        if (saslCredentials != null && saslCredentials.length() > 0) {
+            writer.writeOctetString(TYPE_SERVER_SASL_CREDENTIALS, result.getServerSASLCredentials());
+        }
 
-  public void searchRequest(final ASN1Writer writer, final int messageID,
-      final SearchRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID,
-          request));
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
     }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_SEARCH_REQUEST);
-    writer.writeOctetString(request.getName().toString());
-    writer.writeEnumerated(request.getScope().intValue());
-    writer.writeEnumerated(request.getDereferenceAliasesPolicy().intValue());
-    writer.writeInteger(request.getSizeLimit());
-    writer.writeInteger(request.getTimeLimit());
-    writer.writeBoolean(request.isTypesOnly());
-    LDAPUtils.encodeFilter(writer, request.getFilter());
 
-    writer.writeStartSequence();
-    for (final String attribute : request.getAttributes())
-    {
-      writer.writeOctetString(attribute);
+    public void compareRequest(final ASN1Writer writer, final int messageID,
+            final CompareRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP COMPARE REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
+        writer.writeOctetString(request.getName().toString());
+
+        writer.writeStartSequence();
+        writer.writeOctetString(request.getAttributeDescription().toString());
+        writer.writeOctetString(request.getAssertionValue());
+        writer.writeEndSequence();
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
     }
-    writer.writeEndSequence();
 
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, request);
-  }
-
-
-
-  public void searchResult(final ASN1Writer writer, final int messageID,
-      final Result result) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID,
-          result));
+    public void compareResult(final ASN1Writer writer, final int messageID,
+            final CompareResult result) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP COMPARE RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_COMPARE_RESPONSE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
     }
-    encodeMessageHeader(writer, messageID);
-    encodeResultHeader(writer, OP_TYPE_SEARCH_RESULT_DONE, result);
-    encodeResultFooter(writer);
-    encodeMessageFooter(writer, result);
-  }
 
-
-
-  public void searchResultEntry(final ASN1Writer writer, final int messageID,
-      final SearchResultEntry entry) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID,
-          entry));
+    public void deleteRequest(final ASN1Writer writer, final int messageID,
+            final DeleteRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP DELETE REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeOctetString(OP_TYPE_DELETE_REQUEST, request.getName().toString());
+        encodeMessageFooter(writer, request);
     }
-    encodeMessageHeader(writer, messageID);
-    encodeEntry(writer, entry);
-    encodeMessageFooter(writer, entry);
-  }
 
-
-
-  public void searchResultReference(final ASN1Writer writer,
-      final int messageID, final SearchResultReference reference)
-      throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)",
-          messageID, reference));
+    public void deleteResult(final ASN1Writer writer, final int messageID, final Result result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP DELETE RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_DELETE_RESPONSE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
     }
-    encodeMessageHeader(writer, messageID);
-    writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_REFERENCE);
-    for (final String url : reference.getURIs())
-    {
-      writer.writeOctetString(url);
+
+    public <R extends ExtendedResult> void extendedRequest(final ASN1Writer writer,
+            final int messageID, final ExtendedRequest<R> request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP EXTENDED REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_EXTENDED_REQUEST);
+        writer.writeOctetString(TYPE_EXTENDED_REQUEST_OID, request.getOID());
+
+        final ByteString requestValue = request.getValue();
+        if (requestValue != null) {
+            writer.writeOctetString(TYPE_EXTENDED_REQUEST_VALUE, requestValue);
+        }
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
     }
-    writer.writeEndSequence();
-    encodeMessageFooter(writer, reference);
-  }
 
+    public void extendedResult(final ASN1Writer writer, final int messageID,
+            final ExtendedResult result) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP EXTENDED RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_EXTENDED_RESPONSE, result);
 
+        final String responseName = result.getOID();
+        final ByteString responseValue = result.getValue();
 
-  public void unbindRequest(final ASN1Writer writer, final int messageID,
-      final UnbindRequest request) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID,
-          request));
+        if (responseName != null) {
+            writer.writeOctetString(TYPE_EXTENDED_RESPONSE_OID, responseName);
+        }
+
+        if (responseValue != null) {
+            writer.writeOctetString(TYPE_EXTENDED_RESPONSE_VALUE, responseValue);
+        }
+
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
     }
-    encodeMessageHeader(writer, messageID);
-    writer.writeNull(OP_TYPE_UNBIND_REQUEST);
-    encodeMessageFooter(writer, request);
-  }
 
+    public void intermediateResponse(final ASN1Writer writer, final int messageID,
+            final IntermediateResponse response) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP INTERMEDIATE RESPONSE(messageID=%d, response=%s)", messageID,
+                    response));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_INTERMEDIATE_RESPONSE);
 
+        final String responseName = response.getOID();
+        final ByteString responseValue = response.getValue();
 
-  public void unrecognizedMessage(final ASN1Writer writer, final int messageID,
-      final byte messageTag, final ByteString messageBytes) throws IOException
-  {
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER))
-    {
-      StaticUtils.DEBUG_LOG.finer(String.format(
-          "ENCODE LDAP UNKNOWN MESSAGE(messageID=%d, messageTag=%s, "
-              + "messageBytes=%s)", messageID, StaticUtils
-              .byteToHex(messageTag), messageBytes.toString()));
+        if (responseName != null) {
+            writer.writeOctetString(TYPE_INTERMEDIATE_RESPONSE_OID, response.getOID());
+        }
+
+        if (responseValue != null) {
+            writer.writeOctetString(TYPE_INTERMEDIATE_RESPONSE_VALUE, response.getValue());
+        }
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, response);
     }
-    encodeMessageHeader(writer, messageID);
-    writer.writeOctetString(messageTag, messageBytes);
-    writer.writeEndSequence();
-  }
+
+    public void modifyDNRequest(final ASN1Writer writer, final int messageID,
+            final ModifyDNRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP MODIFY DN REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
+        writer.writeOctetString(request.getName().toString());
+        writer.writeOctetString(request.getNewRDN().toString());
+        writer.writeBoolean(request.isDeleteOldRDN());
+
+        final DN newSuperior = request.getNewSuperior();
+        if (newSuperior != null) {
+            writer.writeOctetString(TYPE_MODIFY_DN_NEW_SUPERIOR, newSuperior.toString());
+        }
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
+    }
+
+    public void modifyDNResult(final ASN1Writer writer, final int messageID, final Result result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP MODIFY DN RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_MODIFY_DN_RESPONSE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
+    }
+
+    public void modifyRequest(final ASN1Writer writer, final int messageID,
+            final ModifyRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP MODIFY REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_MODIFY_REQUEST);
+        writer.writeOctetString(request.getName().toString());
+
+        writer.writeStartSequence();
+        for (final Modification change : request.getModifications()) {
+            encodeChange(writer, change);
+        }
+        writer.writeEndSequence();
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
+    }
+
+    public void modifyResult(final ASN1Writer writer, final int messageID, final Result result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP MODIFY RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_MODIFY_RESPONSE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
+    }
+
+    public void searchRequest(final ASN1Writer writer, final int messageID,
+            final SearchRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP SEARCH REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_SEARCH_REQUEST);
+        writer.writeOctetString(request.getName().toString());
+        writer.writeEnumerated(request.getScope().intValue());
+        writer.writeEnumerated(request.getDereferenceAliasesPolicy().intValue());
+        writer.writeInteger(request.getSizeLimit());
+        writer.writeInteger(request.getTimeLimit());
+        writer.writeBoolean(request.isTypesOnly());
+        LDAPUtils.encodeFilter(writer, request.getFilter());
+
+        writer.writeStartSequence();
+        for (final String attribute : request.getAttributes()) {
+            writer.writeOctetString(attribute);
+        }
+        writer.writeEndSequence();
+
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, request);
+    }
+
+    public void searchResult(final ASN1Writer writer, final int messageID, final Result result)
+            throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP SEARCH RESULT(messageID=%d, result=%s)", messageID, result));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeResultHeader(writer, OP_TYPE_SEARCH_RESULT_DONE, result);
+        encodeResultFooter(writer);
+        encodeMessageFooter(writer, result);
+    }
+
+    public void searchResultEntry(final ASN1Writer writer, final int messageID,
+            final SearchResultEntry entry) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP SEARCH RESULT ENTRY(messageID=%d, entry=%s)", messageID, entry));
+        }
+        encodeMessageHeader(writer, messageID);
+        encodeEntry(writer, entry);
+        encodeMessageFooter(writer, entry);
+    }
+
+    public void searchResultReference(final ASN1Writer writer, final int messageID,
+            final SearchResultReference reference) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP SEARCH RESULT REFERENCE(messageID=%d, reference=%s)", messageID,
+                    reference));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_REFERENCE);
+        for (final String url : reference.getURIs()) {
+            writer.writeOctetString(url);
+        }
+        writer.writeEndSequence();
+        encodeMessageFooter(writer, reference);
+    }
+
+    public void unbindRequest(final ASN1Writer writer, final int messageID,
+            final UnbindRequest request) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP UNBIND REQUEST(messageID=%d, request=%s)", messageID, request));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeNull(OP_TYPE_UNBIND_REQUEST);
+        encodeMessageFooter(writer, request);
+    }
+
+    public void unrecognizedMessage(final ASN1Writer writer, final int messageID,
+            final byte messageTag, final ByteString messageBytes) throws IOException {
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINER)) {
+            StaticUtils.DEBUG_LOG.finer(String.format(
+                    "ENCODE LDAP UNKNOWN MESSAGE(messageID=%d, messageTag=%s, "
+                            + "messageBytes=%s)", messageID, StaticUtils.byteToHex(messageTag),
+                    messageBytes.toString()));
+        }
+        encodeMessageHeader(writer, messageID);
+        writer.writeOctetString(messageTag, messageBytes);
+        writer.writeEndSequence();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java
index cde7969..207a014 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/TimeoutChecker.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
@@ -37,122 +34,86 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Checks connection for pending requests that have timed out.
  */
-final class TimeoutChecker
-{
-  static final TimeoutChecker INSTANCE = new TimeoutChecker();
+final class TimeoutChecker {
+    static final TimeoutChecker INSTANCE = new TimeoutChecker();
 
-  private final LinkedTransferQueue<LDAPConnection> connections;
-  private transient final ReentrantLock lock;
-  private transient final Condition available;
+    private final LinkedTransferQueue<LDAPConnection> connections;
+    private transient final ReentrantLock lock;
+    private transient final Condition available;
 
+    private TimeoutChecker() {
+        this.connections = new LinkedTransferQueue<LDAPConnection>();
+        this.lock = new ReentrantLock();
+        this.available = lock.newCondition();
 
+        final Thread checkerThread = new Thread("Timeout Checker") {
+            @Override
+            public void run() {
+                StaticUtils.DEBUG_LOG.fine("Timeout Checker Starting");
+                final ReentrantLock lock = TimeoutChecker.this.lock;
+                lock.lock();
+                try {
+                    while (true) {
+                        final long currentTime = System.currentTimeMillis();
+                        long delay = 0;
 
-  private TimeoutChecker()
-  {
-    this.connections = new LinkedTransferQueue<LDAPConnection>();
-    this.lock = new ReentrantLock();
-    this.available = lock.newCondition();
+                        for (final LDAPConnection connection : connections) {
+                            StaticUtils.DEBUG_LOG.finer("Checking connection " + connection
+                                    + " delay = " + delay);
+                            final long newDelay = connection.cancelExpiredRequests(currentTime);
+                            if (newDelay > 0) {
+                                if (delay > 0) {
+                                    delay = Math.min(newDelay, delay);
+                                } else {
+                                    delay = newDelay;
+                                }
+                            }
+                        }
 
-    final Thread checkerThread = new Thread("Timeout Checker")
-    {
-      @Override
-      public void run()
-      {
-        StaticUtils.DEBUG_LOG.fine("Timeout Checker Starting");
-        final ReentrantLock lock = TimeoutChecker.this.lock;
+                        try {
+                            if (delay <= 0) {
+                                StaticUtils.DEBUG_LOG.finer("There are no connections with "
+                                        + "timeout specified. Sleeping");
+                                available.await();
+                            } else {
+                                StaticUtils.DEBUG_LOG.finer("Sleeping for " + delay + "ms");
+                                available.await(delay, TimeUnit.MILLISECONDS);
+                            }
+                        } catch (final InterruptedException e) {
+                            // Just go around again.
+                        }
+                    }
+                } finally {
+                    lock.unlock();
+                }
+            }
+        };
+
+        checkerThread.setDaemon(true);
+        checkerThread.start();
+    }
+
+    void addConnection(final LDAPConnection connection) {
+        final ReentrantLock lock = this.lock;
         lock.lock();
-        try
-        {
-          while (true)
-          {
-            final long currentTime = System.currentTimeMillis();
-            long delay = 0;
-
-            for (final LDAPConnection connection : connections)
-            {
-              StaticUtils.DEBUG_LOG.finer("Checking connection " + connection
-                  + " delay = " + delay);
-              final long newDelay = connection
-                  .cancelExpiredRequests(currentTime);
-              if (newDelay > 0)
-              {
-                if (delay > 0)
-                {
-                  delay = Math.min(newDelay, delay);
-                }
-                else
-                {
-                  delay = newDelay;
-                }
-              }
-            }
-
-            try
-            {
-              if (delay <= 0)
-              {
-                StaticUtils.DEBUG_LOG.finer("There are no connections with "
-                    + "timeout specified. Sleeping");
-                available.await();
-              }
-              else
-              {
-                StaticUtils.DEBUG_LOG.finer("Sleeping for " + delay + "ms");
-                available.await(delay, TimeUnit.MILLISECONDS);
-              }
-            }
-            catch (final InterruptedException e)
-            {
-              // Just go around again.
-            }
-          }
+        try {
+            connections.add(connection);
+            available.signalAll();
+        } finally {
+            lock.unlock();
         }
-        finally
-        {
-          lock.unlock();
+    }
+
+    void removeConnection(final LDAPConnection connection) {
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            connections.remove(connection);
+        } finally {
+            lock.unlock();
         }
-      }
-    };
-
-    checkerThread.setDaemon(true);
-    checkerThread.start();
-  }
-
-
-
-  void addConnection(final LDAPConnection connection)
-  {
-    final ReentrantLock lock = this.lock;
-    lock.lock();
-    try
-    {
-      connections.add(connection);
-      available.signalAll();
     }
-    finally
-    {
-      lock.unlock();
-    }
-  }
-
-
-
-  void removeConnection(final LDAPConnection connection)
-  {
-    final ReentrantLock lock = this.lock;
-    lock.lock();
-    try
-    {
-      connections.remove(connection);
-    }
-    finally
-    {
-      lock.unlock();
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedRequestException.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedRequestException.java
index 00aba18..6405247 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedRequestException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedRequestException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,45 +26,31 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.requests.Request;
 
-
-
 /**
  * Thrown when an expected LDAP request is received.
  */
 @SuppressWarnings("serial")
-final class UnexpectedRequestException extends IOException
-{
-  private final int messageID;
-  private final Request request;
+final class UnexpectedRequestException extends IOException {
+    private final int messageID;
+    private final Request request;
 
+    public UnexpectedRequestException(final int messageID, final Request request) {
+        super(LocalizableMessage.raw("Unexpected LDAP request: id=%d, message=%s", messageID,
+                request).toString());
+        this.messageID = messageID;
+        this.request = request;
+    }
 
+    public int getMessageID() {
+        return messageID;
+    }
 
-  public UnexpectedRequestException(final int messageID, final Request request)
-  {
-    super(LocalizableMessage.raw("Unexpected LDAP request: id=%d, message=%s",
-        messageID, request).toString());
-    this.messageID = messageID;
-    this.request = request;
-  }
-
-
-
-  public int getMessageID()
-  {
-    return messageID;
-  }
-
-
-
-  public Request getRequest()
-  {
-    return request;
-  }
+    public Request getRequest() {
+        return request;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedResponseException.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedResponseException.java
index 0742e86..540b78f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedResponseException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnexpectedResponseException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,46 +26,31 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.responses.Response;
 
-
-
 /**
  * Thrown when an unexpected LDAP response is received.
  */
 @SuppressWarnings("serial")
-final class UnexpectedResponseException extends IOException
-{
-  private final int messageID;
-  private final Response response;
+final class UnexpectedResponseException extends IOException {
+    private final int messageID;
+    private final Response response;
 
+    public UnexpectedResponseException(final int messageID, final Response response) {
+        super(LocalizableMessage.raw("Unexpected LDAP response: id=%d, message=%s", messageID,
+                response).toString());
+        this.messageID = messageID;
+        this.response = response;
+    }
 
+    public int getMessageID() {
+        return messageID;
+    }
 
-  public UnexpectedResponseException(final int messageID,
-      final Response response)
-  {
-    super(LocalizableMessage.raw("Unexpected LDAP response: id=%d, message=%s",
-        messageID, response).toString());
-    this.messageID = messageID;
-    this.response = response;
-  }
-
-
-
-  public int getMessageID()
-  {
-    return messageID;
-  }
-
-
-
-  public Response getResponse()
-  {
-    return response;
-  }
+    public Response getResponse() {
+        return response;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnsupportedMessageException.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnsupportedMessageException.java
index cc585fd..876b115 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnsupportedMessageException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/UnsupportedMessageException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,56 +26,37 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Thrown when an unsupported LDAP message is received.
  */
 @SuppressWarnings("serial")
-final class UnsupportedMessageException extends IOException
-{
-  private final int id;
-  private final byte tag;
-  private final ByteString content;
+final class UnsupportedMessageException extends IOException {
+    private final int id;
+    private final byte tag;
+    private final ByteString content;
 
+    public UnsupportedMessageException(final int id, final byte tag, final ByteString content) {
+        super(LocalizableMessage.raw("Unsupported LDAP message: id=%d, tag=%d, content=%s", id,
+                tag, content).toString());
+        this.id = id;
+        this.tag = tag;
+        this.content = content;
+    }
 
+    public ByteString getContent() {
+        return content;
+    }
 
-  public UnsupportedMessageException(final int id, final byte tag,
-      final ByteString content)
-  {
-    super(LocalizableMessage
-        .raw("Unsupported LDAP message: id=%d, tag=%d, content=%s", id, tag,
-            content).toString());
-    this.id = id;
-    this.tag = tag;
-    this.content = content;
-  }
+    public int getID() {
+        return id;
+    }
 
-
-
-  public ByteString getContent()
-  {
-    return content;
-  }
-
-
-
-  public int getID()
-  {
-    return id;
-  }
-
-
-
-  public byte getTag()
-  {
-    return tag;
-  }
+    public byte getTag() {
+        return tag;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java
index 9b2dd7c..2dd04cc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLEREQ_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLEREQ_CONTROL_HAS_VALUE;
 
@@ -40,152 +37,119 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Sun-defined account usability request control. The OID for this control
  * is 1.3.6.1.4.1.42.2.27.9.5.8, and it does not have a value.
  *
  * @see AccountUsabilityResponseControl
  */
-public final class AccountUsabilityRequestControl implements Control
-{
-  /**
-   * The OID for the account usability request control.
-   */
-  public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.8";
+public final class AccountUsabilityRequestControl implements Control {
+    /**
+     * The OID for the account usability request control.
+     */
+    public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.8";
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final AccountUsabilityRequestControl CRITICAL_INSTANCE =
-    new AccountUsabilityRequestControl(true);
-  private static final AccountUsabilityRequestControl NONCRITICAL_INSTANCE =
-    new AccountUsabilityRequestControl(false);
+    private static final AccountUsabilityRequestControl CRITICAL_INSTANCE =
+            new AccountUsabilityRequestControl(true);
+    private static final AccountUsabilityRequestControl NONCRITICAL_INSTANCE =
+            new AccountUsabilityRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the account usability request
-   * control.
-   */
-  public static final ControlDecoder<AccountUsabilityRequestControl> DECODER =
-    new ControlDecoder<AccountUsabilityRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the account usability request
+     * control.
+     */
+    public static final ControlDecoder<AccountUsabilityRequestControl> DECODER =
+            new ControlDecoder<AccountUsabilityRequestControl>() {
 
-    public AccountUsabilityRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public AccountUsabilityRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof AccountUsabilityRequestControl)
-      {
-        return (AccountUsabilityRequestControl) control;
-      }
+                    if (control instanceof AccountUsabilityRequestControl) {
+                        return (AccountUsabilityRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_ACCTUSABLEREQ_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_ACCTUSABLEREQ_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_ACCTUSABLEREQ_CONTROL_HAS_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_ACCTUSABLEREQ_CONTROL_HAS_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new account usability request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static AccountUsabilityRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    // Prevent direct instantiation.
+    private AccountUsabilityRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new account usability request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static AccountUsabilityRequestControl newControl(
-      final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  // Prevent direct instantiation.
-  private AccountUsabilityRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AccountUsableRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AccountUsableRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java
index f5e547e..80b4c1b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.byteToHex;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_CONTROL_BAD_OID;
@@ -51,8 +48,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Sun-defined account usability response control. The OID for this control
  * is 1.3.6.1.4.1.42.2.27.9.5.8, and it has a value encoded according to the
@@ -73,502 +68,414 @@
  *
  * @see AccountUsabilityRequestControl
  */
-public final class AccountUsabilityResponseControl implements Control
-{
-  /**
-   * The OID for the account usability response control.
-   */
-  public static final String OID = AccountUsabilityRequestControl.OID;
+public final class AccountUsabilityResponseControl implements Control {
+    /**
+     * The OID for the account usability response control.
+     */
+    public static final String OID = AccountUsabilityRequestControl.OID;
 
-  /**
-   * A decoder which can be used for decoding the account usability response
-   * control.
-   */
-  public static final ControlDecoder<AccountUsabilityResponseControl> DECODER =
-    new ControlDecoder<AccountUsabilityResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the account usability response
+     * control.
+     */
+    public static final ControlDecoder<AccountUsabilityResponseControl> DECODER =
+            new ControlDecoder<AccountUsabilityResponseControl>() {
 
-    public AccountUsabilityResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public AccountUsabilityResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof AccountUsabilityResponseControl)
-      {
-        return (AccountUsabilityResponseControl) control;
-      }
+                    if (control instanceof AccountUsabilityResponseControl) {
+                        return (AccountUsabilityResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_ACCTUSABLERES_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_ACCTUSABLERES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_ACCTUSABLERES_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_ACCTUSABLERES_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      try
-      {
-        final ASN1Reader reader = ASN1.getReader(control.getValue());
-        switch (reader.peekType())
-        {
-        case TYPE_SECONDS_BEFORE_EXPIRATION:
-          final int secondsBeforeExpiration = (int) reader.readInteger();
-          return new AccountUsabilityResponseControl(control.isCritical(),
-              true, false, false, false, -1, false, 0, secondsBeforeExpiration);
-        case TYPE_MORE_INFO:
-          boolean isInactive = false;
-          boolean isReset = false;
-          boolean isExpired = false;
-          boolean isLocked = false;
-          int remainingGraceLogins = -1;
-          int secondsBeforeUnlock = 0;
+                    try {
+                        final ASN1Reader reader = ASN1.getReader(control.getValue());
+                        switch (reader.peekType()) {
+                        case TYPE_SECONDS_BEFORE_EXPIRATION:
+                            final int secondsBeforeExpiration = (int) reader.readInteger();
+                            return new AccountUsabilityResponseControl(control.isCritical(), true,
+                                    false, false, false, -1, false, 0, secondsBeforeExpiration);
+                        case TYPE_MORE_INFO:
+                            boolean isInactive = false;
+                            boolean isReset = false;
+                            boolean isExpired = false;
+                            boolean isLocked = false;
+                            int remainingGraceLogins = -1;
+                            int secondsBeforeUnlock = 0;
 
-          reader.readStartSequence();
-          if (reader.hasNextElement() && (reader.peekType() == TYPE_INACTIVE))
-          {
-            isInactive = reader.readBoolean();
-          }
-          if (reader.hasNextElement() && (reader.peekType() == TYPE_RESET))
-          {
-            isReset = reader.readBoolean();
-          }
-          if (reader.hasNextElement() && (reader.peekType() == TYPE_EXPIRED))
-          {
-            isExpired = reader.readBoolean();
-          }
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_REMAINING_GRACE_LOGINS))
-          {
-            remainingGraceLogins = (int) reader.readInteger();
-          }
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_SECONDS_BEFORE_UNLOCK))
-          {
-            isLocked = true;
-            secondsBeforeUnlock = (int) reader.readInteger();
-          }
-          reader.readEndSequence();
+                            reader.readStartSequence();
+                            if (reader.hasNextElement() && (reader.peekType() == TYPE_INACTIVE)) {
+                                isInactive = reader.readBoolean();
+                            }
+                            if (reader.hasNextElement() && (reader.peekType() == TYPE_RESET)) {
+                                isReset = reader.readBoolean();
+                            }
+                            if (reader.hasNextElement() && (reader.peekType() == TYPE_EXPIRED)) {
+                                isExpired = reader.readBoolean();
+                            }
+                            if (reader.hasNextElement()
+                                    && (reader.peekType() == TYPE_REMAINING_GRACE_LOGINS)) {
+                                remainingGraceLogins = (int) reader.readInteger();
+                            }
+                            if (reader.hasNextElement()
+                                    && (reader.peekType() == TYPE_SECONDS_BEFORE_UNLOCK)) {
+                                isLocked = true;
+                                secondsBeforeUnlock = (int) reader.readInteger();
+                            }
+                            reader.readEndSequence();
 
-          return new AccountUsabilityResponseControl(control.isCritical(),
-              false, isInactive, isReset, isExpired, remainingGraceLogins,
-              isLocked, secondsBeforeUnlock, -1);
+                            return new AccountUsabilityResponseControl(control.isCritical(), false,
+                                    isInactive, isReset, isExpired, remainingGraceLogins, isLocked,
+                                    secondsBeforeUnlock, -1);
 
-        default:
-          final LocalizableMessage message = ERR_ACCTUSABLERES_UNKNOWN_VALUE_ELEMENT_TYPE
-              .get(byteToHex(reader.peekType()));
-          throw DecodeException.error(message);
+                        default:
+                            final LocalizableMessage message =
+                                    ERR_ACCTUSABLERES_UNKNOWN_VALUE_ELEMENT_TYPE
+                                            .get(byteToHex(reader.peekType()));
+                            throw DecodeException.error(message);
+                        }
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing(
+                                "AccountUsabilityResponseControl.decodeControl", "decode", e);
+
+                        final LocalizableMessage message =
+                                ERR_ACCTUSABLERES_DECODE_ERROR.get(getExceptionMessage(e));
+                        throw DecodeException.error(message);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * The BER type to use for the seconds before expiration when the account is
+     * available.
+     */
+    private static final byte TYPE_SECONDS_BEFORE_EXPIRATION = (byte) 0x80;
+
+    /**
+     * The BER type to use for the MORE_INFO sequence when the account is not
+     * available.
+     */
+    private static final byte TYPE_MORE_INFO = (byte) 0xA1;
+
+    /**
+     * The BER type to use for the MORE_INFO element that indicates that the
+     * account has been inactivated.
+     */
+    private static final byte TYPE_INACTIVE = (byte) 0x80;
+
+    /**
+     * The BER type to use for the MORE_INFO element that indicates that the
+     * password has been administratively reset.
+     */
+    private static final byte TYPE_RESET = (byte) 0x81;
+
+    /**
+     * The BER type to use for the MORE_INFO element that indicates that the
+     * user's password is expired.
+     */
+    private static final byte TYPE_EXPIRED = (byte) 0x82;
+
+    /**
+     * The BER type to use for the MORE_INFO element that provides the number of
+     * remaining grace logins.
+     */
+    private static final byte TYPE_REMAINING_GRACE_LOGINS = (byte) 0x83;
+
+    /**
+     * The BER type to use for the MORE_INFO element that indicates that the
+     * password has been administratively reset.
+     */
+    private static final byte TYPE_SECONDS_BEFORE_UNLOCK = (byte) 0x84;
+
+    /**
+     * Creates a new account usability response control that may be used to
+     * indicate that the account is not available and provide information about
+     * the underlying reason.
+     *
+     * @param isInactive
+     *            Indicates whether the user's account has been inactivated by
+     *            an administrator.
+     * @param isReset
+     *            Indicates whether the user's password has been reset by an
+     *            administrator.
+     * @param isExpired
+     *            Indicates whether the user's password has expired.
+     * @param remainingGraceLogins
+     *            The number of grace logins remaining. A value of {@code 0}
+     *            indicates that there are none remaining. A value of {@code -1}
+     *            indicates that grace login functionality is not enabled.
+     * @param isLocked
+     *            Indicates whether the user's account is currently locked out.
+     * @param secondsBeforeUnlock
+     *            The length of time in seconds until the account is unlocked. A
+     *            value of {@code -1} indicates that the account will not be
+     *            automatically unlocked and must be reset by an administrator.
+     * @return The new control.
+     */
+    public static AccountUsabilityResponseControl newControl(final boolean isInactive,
+            final boolean isReset, final boolean isExpired, final int remainingGraceLogins,
+            final boolean isLocked, final int secondsBeforeUnlock) {
+        return new AccountUsabilityResponseControl(false, false, isInactive, isReset, isExpired,
+                remainingGraceLogins, isLocked, secondsBeforeUnlock, -1);
+    }
+
+    /**
+     * Creates a new account usability response control that may be used to
+     * indicate that the account is available and provide the number of seconds
+     * until expiration.
+     *
+     * @param secondsBeforeExpiration
+     *            The length of time in seconds until the user's password
+     *            expires, or {@code -1} if the user's password will not expire
+     *            or the expiration time is unknown.
+     * @return The new control.
+     */
+    public static AccountUsabilityResponseControl newControl(final int secondsBeforeExpiration) {
+        return new AccountUsabilityResponseControl(false, true, false, false, false, -1, false, 0,
+                secondsBeforeExpiration);
+    }
+
+    // Indicates whether the user's account is usable.
+    private final boolean isUsable;
+
+    // Indicates whether the user's password is expired.
+    private final boolean isExpired;
+
+    // Indicates whether the user's account is inactive.
+    private final boolean isInactive;
+
+    // Indicates whether the user's account is currently locked.
+    private final boolean isLocked;
+
+    // Indicates whether the user's password has been reset and must be
+    // changed before anything else can be done.
+    private final boolean isReset;
+
+    // The number of remaining grace logins, if available.
+    private final int remainingGraceLogins;
+
+    // The length of time in seconds before the user's password expires,
+    // if available.
+    private final int secondsBeforeExpiration;
+
+    // The length of time before the user's account is unlocked, if
+    // available.
+    private final int secondsBeforeUnlock;
+
+    private final boolean isCritical;
+
+    // Prevent direct instantiation.
+    private AccountUsabilityResponseControl(final boolean isCritical, final boolean isUsable,
+            final boolean isInactive, final boolean isReset, final boolean isExpired,
+            final int remainingGraceLogins, final boolean isLocked, final int secondsBeforeUnlock,
+            final int secondsBeforeExpiration) {
+        this.isCritical = isCritical;
+        this.isUsable = isUsable;
+        this.isInactive = isInactive;
+        this.isReset = isReset;
+        this.isExpired = isExpired;
+        this.remainingGraceLogins = remainingGraceLogins;
+        this.isLocked = isLocked;
+        this.secondsBeforeUnlock = secondsBeforeUnlock;
+        this.secondsBeforeExpiration = secondsBeforeExpiration;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * Returns the number of remaining grace logins for the user. This value is
+     * unreliable if the user's password has not expired.
+     *
+     * @return The number of remaining grace logins for the user, or {@code -1}
+     *         if the grace logins feature is not enabled for the user.
+     */
+    public int getRemainingGraceLogins() {
+        return remainingGraceLogins;
+    }
+
+    /**
+     * Returns the length of time in seconds before the user's password expires.
+     * This value is unreliable if the account is not available.
+     *
+     * @return The length of time in seconds before the user's password expires,
+     *         or {@code -1} if it is unknown or password expiration is not
+     *         enabled for the user.
+     */
+    public int getSecondsBeforeExpiration() {
+        return secondsBeforeExpiration;
+    }
+
+    /**
+     * Returns the length of time in seconds before the user's account is
+     * automatically unlocked. This value is unreliable is the user's account is
+     * not locked.
+     *
+     * @return The length of time in seconds before the user's account is
+     *         automatically unlocked, or {@code -1} if it requires
+     *         administrative action to unlock the account.
+     */
+    public int getSecondsBeforeUnlock() {
+        return secondsBeforeUnlock;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            if (secondsBeforeExpiration < 0) {
+                writer.writeInteger(TYPE_SECONDS_BEFORE_EXPIRATION, secondsBeforeExpiration);
+            } else {
+                writer.writeStartSequence(TYPE_MORE_INFO);
+                if (isInactive) {
+                    writer.writeBoolean(TYPE_INACTIVE, true);
+                }
+
+                if (isReset) {
+                    writer.writeBoolean(TYPE_RESET, true);
+                }
+
+                if (isExpired) {
+                    writer.writeBoolean(TYPE_EXPIRED, true);
+
+                    if (remainingGraceLogins >= 0) {
+                        writer.writeInteger(TYPE_REMAINING_GRACE_LOGINS, remainingGraceLogins);
+                    }
+                }
+
+                if (isLocked) {
+                    writer.writeInteger(TYPE_SECONDS_BEFORE_UNLOCK, secondsBeforeUnlock);
+                }
+                writer.writeEndSequence();
+            }
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing(
-            "AccountUsabilityResponseControl.decodeControl", "decode", e);
-
-        final LocalizableMessage message = ERR_ACCTUSABLERES_DECODE_ERROR
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message);
-      }
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-  };
 
-  /**
-   * The BER type to use for the seconds before expiration when the account is
-   * available.
-   */
-  private static final byte TYPE_SECONDS_BEFORE_EXPIRATION = (byte) 0x80;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO sequence when the account is not
-   * available.
-   */
-  private static final byte TYPE_MORE_INFO = (byte) 0xA1;
+    /**
+     * Returns {@code true} if the user's password has expired.
+     *
+     * @return <CODE>true</CODE> if the user's password has expired, or
+     *         <CODE>false</CODE> if not.
+     */
+    public boolean isExpired() {
+        return isExpired;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO element that indicates that the
-   * account has been inactivated.
-   */
-  private static final byte TYPE_INACTIVE = (byte) 0x80;
+    /**
+     * Returns {@code true} if the user's account has been inactivated by an
+     * administrator.
+     *
+     * @return <CODE>true</CODE> if the user's account has been inactivated by
+     *         an administrator, or <CODE>false</CODE> if not.
+     */
+    public boolean isInactive() {
+        return isInactive;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO element that indicates that the
-   * password has been administratively reset.
-   */
-  private static final byte TYPE_RESET = (byte) 0x81;
+    /**
+     * Returns {@code true} if the user's account is locked for some reason.
+     *
+     * @return <CODE>true</CODE> if the user's account is locked, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    public boolean isLocked() {
+        return isLocked;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO element that indicates that the
-   * user's password is expired.
-   */
-  private static final byte TYPE_EXPIRED = (byte) 0x82;
+    /**
+     * Returns {@code true} if the user's password has been administratively
+     * reset and the user must change that password before any other operations
+     * will be allowed.
+     *
+     * @return <CODE>true</CODE> if the user's password has been
+     *         administratively reset, or <CODE>false</CODE> if not.
+     */
+    public boolean isReset() {
+        return isReset;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO element that provides the number of
-   * remaining grace logins.
-   */
-  private static final byte TYPE_REMAINING_GRACE_LOGINS = (byte) 0x83;
+    /**
+     * Returns {@code true} if the associated user account is available for use.
+     *
+     * @return <CODE>true</CODE> if the associated user account is available, or
+     *         <CODE>false</CODE> if not.
+     */
+    public boolean isUsable() {
+        return isUsable;
+    }
 
-  /**
-   * The BER type to use for the MORE_INFO element that indicates that the
-   * password has been administratively reset.
-   */
-  private static final byte TYPE_SECONDS_BEFORE_UNLOCK = (byte) 0x84;
-
-
-
-  /**
-   * Creates a new account usability response control that may be used to
-   * indicate that the account is not available and provide information about
-   * the underlying reason.
-   *
-   * @param isInactive
-   *          Indicates whether the user's account has been inactivated by an
-   *          administrator.
-   * @param isReset
-   *          Indicates whether the user's password has been reset by an
-   *          administrator.
-   * @param isExpired
-   *          Indicates whether the user's password has expired.
-   * @param remainingGraceLogins
-   *          The number of grace logins remaining. A value of {@code 0}
-   *          indicates that there are none remaining. A value of {@code -1}
-   *          indicates that grace login functionality is not enabled.
-   * @param isLocked
-   *          Indicates whether the user's account is currently locked out.
-   * @param secondsBeforeUnlock
-   *          The length of time in seconds until the account is unlocked. A
-   *          value of {@code -1} indicates that the account will not be
-   *          automatically unlocked and must be reset by an administrator.
-   * @return The new control.
-   */
-  public static AccountUsabilityResponseControl newControl(
-      final boolean isInactive, final boolean isReset, final boolean isExpired,
-      final int remainingGraceLogins, final boolean isLocked,
-      final int secondsBeforeUnlock)
-  {
-    return new AccountUsabilityResponseControl(false, false, isInactive,
-        isReset, isExpired, remainingGraceLogins, isLocked,
-        secondsBeforeUnlock, -1);
-  }
-
-
-
-  /**
-   * Creates a new account usability response control that may be used to
-   * indicate that the account is available and provide the number of seconds
-   * until expiration.
-   *
-   * @param secondsBeforeExpiration
-   *          The length of time in seconds until the user's password expires,
-   *          or {@code -1} if the user's password will not expire or the
-   *          expiration time is unknown.
-   * @return The new control.
-   */
-  public static AccountUsabilityResponseControl newControl(
-      final int secondsBeforeExpiration)
-  {
-    return new AccountUsabilityResponseControl(false, true, false, false,
-        false, -1, false, 0, secondsBeforeExpiration);
-  }
-
-
-
-  // Indicates whether the user's account is usable.
-  private final boolean isUsable;
-
-  // Indicates whether the user's password is expired.
-  private final boolean isExpired;
-
-  // Indicates whether the user's account is inactive.
-  private final boolean isInactive;
-
-  // Indicates whether the user's account is currently locked.
-  private final boolean isLocked;
-
-  // Indicates whether the user's password has been reset and must be
-  // changed before anything else can be done.
-  private final boolean isReset;
-
-  // The number of remaining grace logins, if available.
-  private final int remainingGraceLogins;
-
-  // The length of time in seconds before the user's password expires,
-  // if available.
-  private final int secondsBeforeExpiration;
-
-  // The length of time before the user's account is unlocked, if
-  // available.
-  private final int secondsBeforeUnlock;
-
-  private final boolean isCritical;
-
-
-
-  // Prevent direct instantiation.
-  private AccountUsabilityResponseControl(final boolean isCritical,
-      final boolean isUsable, final boolean isInactive, final boolean isReset,
-      final boolean isExpired, final int remainingGraceLogins,
-      final boolean isLocked, final int secondsBeforeUnlock,
-      final int secondsBeforeExpiration)
-  {
-    this.isCritical = isCritical;
-    this.isUsable = isUsable;
-    this.isInactive = isInactive;
-    this.isReset = isReset;
-    this.isExpired = isExpired;
-    this.remainingGraceLogins = remainingGraceLogins;
-    this.isLocked = isLocked;
-    this.secondsBeforeUnlock = secondsBeforeUnlock;
-    this.secondsBeforeExpiration = secondsBeforeExpiration;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns the number of remaining grace logins for the user. This value is
-   * unreliable if the user's password has not expired.
-   *
-   * @return The number of remaining grace logins for the user, or {@code -1} if
-   *         the grace logins feature is not enabled for the user.
-   */
-  public int getRemainingGraceLogins()
-  {
-    return remainingGraceLogins;
-  }
-
-
-
-  /**
-   * Returns the length of time in seconds before the user's password expires.
-   * This value is unreliable if the account is not available.
-   *
-   * @return The length of time in seconds before the user's password expires,
-   *         or {@code -1} if it is unknown or password expiration is not
-   *         enabled for the user.
-   */
-  public int getSecondsBeforeExpiration()
-  {
-    return secondsBeforeExpiration;
-  }
-
-
-
-  /**
-   * Returns the length of time in seconds before the user's account is
-   * automatically unlocked. This value is unreliable is the user's account is
-   * not locked.
-   *
-   * @return The length of time in seconds before the user's account is
-   *         automatically unlocked, or {@code -1} if it requires administrative
-   *         action to unlock the account.
-   */
-  public int getSecondsBeforeUnlock()
-  {
-    return secondsBeforeUnlock;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      if (secondsBeforeExpiration < 0)
-      {
-        writer.writeInteger(TYPE_SECONDS_BEFORE_EXPIRATION,
-            secondsBeforeExpiration);
-      }
-      else
-      {
-        writer.writeStartSequence(TYPE_MORE_INFO);
-        if (isInactive)
-        {
-          writer.writeBoolean(TYPE_INACTIVE, true);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AccountUsableResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", isUsable=");
+        builder.append(isUsable);
+        if (isUsable) {
+            builder.append(",secondsBeforeExpiration=");
+            builder.append(secondsBeforeExpiration);
+        } else {
+            builder.append(",isInactive=");
+            builder.append(isInactive);
+            builder.append(",isReset=");
+            builder.append(isReset);
+            builder.append(",isExpired=");
+            builder.append(isExpired);
+            builder.append(",remainingGraceLogins=");
+            builder.append(remainingGraceLogins);
+            builder.append(",isLocked=");
+            builder.append(isLocked);
+            builder.append(",secondsBeforeUnlock=");
+            builder.append(secondsBeforeUnlock);
         }
-
-        if (isReset)
-        {
-          writer.writeBoolean(TYPE_RESET, true);
-        }
-
-        if (isExpired)
-        {
-          writer.writeBoolean(TYPE_EXPIRED, true);
-
-          if (remainingGraceLogins >= 0)
-          {
-            writer.writeInteger(TYPE_REMAINING_GRACE_LOGINS,
-                remainingGraceLogins);
-          }
-        }
-
-        if (isLocked)
-        {
-          writer.writeInteger(TYPE_SECONDS_BEFORE_UNLOCK, secondsBeforeUnlock);
-        }
-        writer.writeEndSequence();
-      }
-      return buffer.toByteString();
+        builder.append(")");
+        return builder.toString();
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the user's password has expired.
-   *
-   * @return <CODE>true</CODE> if the user's password has expired, or
-   *         <CODE>false</CODE> if not.
-   */
-  public boolean isExpired()
-  {
-    return isExpired;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the user's account has been inactivated by an
-   * administrator.
-   *
-   * @return <CODE>true</CODE> if the user's account has been inactivated by an
-   *         administrator, or <CODE>false</CODE> if not.
-   */
-  public boolean isInactive()
-  {
-    return isInactive;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the user's account is locked for some reason.
-   *
-   * @return <CODE>true</CODE> if the user's account is locked, or
-   *         <CODE>false</CODE> if it is not.
-   */
-  public boolean isLocked()
-  {
-    return isLocked;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the user's password has been administratively reset
-   * and the user must change that password before any other operations will be
-   * allowed.
-   *
-   * @return <CODE>true</CODE> if the user's password has been administratively
-   *         reset, or <CODE>false</CODE> if not.
-   */
-  public boolean isReset()
-  {
-    return isReset;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the associated user account is available for use.
-   *
-   * @return <CODE>true</CODE> if the associated user account is available, or
-   *         <CODE>false</CODE> if not.
-   */
-  public boolean isUsable()
-  {
-    return isUsable;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AccountUsableResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", isUsable=");
-    builder.append(isUsable);
-    if (isUsable)
-    {
-      builder.append(",secondsBeforeExpiration=");
-      builder.append(secondsBeforeExpiration);
-    }
-    else
-    {
-      builder.append(",isInactive=");
-      builder.append(isInactive);
-      builder.append(",isReset=");
-      builder.append(isReset);
-      builder.append(",isExpired=");
-      builder.append(isExpired);
-      builder.append(",remainingGraceLogins=");
-      builder.append(remainingGraceLogins);
-      builder.append(",isLocked=");
-      builder.append(isLocked);
-      builder.append(",secondsBeforeUnlock=");
-      builder.append(secondsBeforeUnlock);
-    }
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java
index 80932cf..e67b8be 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_REAL_ATTRS_ONLY_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_REAL_ATTRS_ONLY_INVALID_CONTROL_VALUE;
 
@@ -40,153 +37,117 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Sun-defined real attributes only request control. The OID for this
  * control is 2.16.840.1.113730.3.4.17, and it does not have a value.
  */
-public final class RealAttributesOnlyRequestControl implements Control
-{
-  /**
-   * The OID for the real attributes only request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.17";
+public final class RealAttributesOnlyRequestControl implements Control {
+    /**
+     * The OID for the real attributes only request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.17";
 
-  private static final RealAttributesOnlyRequestControl CRITICAL_INSTANCE =
-    new RealAttributesOnlyRequestControl(true);
+    private static final RealAttributesOnlyRequestControl CRITICAL_INSTANCE =
+            new RealAttributesOnlyRequestControl(true);
 
-  private static final RealAttributesOnlyRequestControl NONCRITICAL_INSTANCE =
-    new RealAttributesOnlyRequestControl(false);
+    private static final RealAttributesOnlyRequestControl NONCRITICAL_INSTANCE =
+            new RealAttributesOnlyRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the real attributes only request
-   * control.
-   */
-  public static final ControlDecoder<RealAttributesOnlyRequestControl> DECODER =
-    new ControlDecoder<RealAttributesOnlyRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the real attributes only request
+     * control.
+     */
+    public static final ControlDecoder<RealAttributesOnlyRequestControl> DECODER =
+            new ControlDecoder<RealAttributesOnlyRequestControl>() {
 
-    public RealAttributesOnlyRequestControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public RealAttributesOnlyRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof RealAttributesOnlyRequestControl)
-      {
-        return (RealAttributesOnlyRequestControl) control;
-      }
+                    if (control instanceof RealAttributesOnlyRequestControl) {
+                        return (RealAttributesOnlyRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_REAL_ATTRS_ONLY_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_REAL_ATTRS_ONLY_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_REAL_ATTRS_ONLY_INVALID_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_REAL_ATTRS_ONLY_INVALID_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new real attributes only request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static RealAttributesOnlyRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
+    private final boolean isCritical;
 
-
-    public String getOID()
-    {
-      return OID;
+    private RealAttributesOnlyRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new real attributes only request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static RealAttributesOnlyRequestControl newControl(
-      final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private final boolean isCritical;
-
-
-
-  private RealAttributesOnlyRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("RealAttributesOnlyRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("RealAttributesOnlyRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java
index b7c06a9..9405938 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_VIRTUAL_ATTRS_ONLY_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_VIRTUAL_ATTRS_ONLY_INVALID_CONTROL_VALUE;
 
@@ -40,153 +37,117 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Sun-defined virtual attributes only request control. The OID for this
  * control is 2.16.840.1.113730.3.4.19, and it does not have a value.
  */
-public final class VirtualAttributesOnlyRequestControl implements Control
-{
-  /**
-   * The OID for the virtual attributes only request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.19";
+public final class VirtualAttributesOnlyRequestControl implements Control {
+    /**
+     * The OID for the virtual attributes only request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.19";
 
-  private static final VirtualAttributesOnlyRequestControl CRITICAL_INSTANCE =
-    new VirtualAttributesOnlyRequestControl(true);
+    private static final VirtualAttributesOnlyRequestControl CRITICAL_INSTANCE =
+            new VirtualAttributesOnlyRequestControl(true);
 
-  private static final VirtualAttributesOnlyRequestControl NONCRITICAL_INSTANCE =
-    new VirtualAttributesOnlyRequestControl(false);
+    private static final VirtualAttributesOnlyRequestControl NONCRITICAL_INSTANCE =
+            new VirtualAttributesOnlyRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the virtual attributes only
-   * request control.
-   */
-  public static final ControlDecoder<VirtualAttributesOnlyRequestControl>
-    DECODER = new ControlDecoder<VirtualAttributesOnlyRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the virtual attributes only
+     * request control.
+     */
+    public static final ControlDecoder<VirtualAttributesOnlyRequestControl> DECODER =
+            new ControlDecoder<VirtualAttributesOnlyRequestControl>() {
 
-    public VirtualAttributesOnlyRequestControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public VirtualAttributesOnlyRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof VirtualAttributesOnlyRequestControl)
-      {
-        return (VirtualAttributesOnlyRequestControl) control;
-      }
+                    if (control instanceof VirtualAttributesOnlyRequestControl) {
+                        return (VirtualAttributesOnlyRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_VIRTUAL_ATTRS_ONLY_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_VIRTUAL_ATTRS_ONLY_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_VIRTUAL_ATTRS_ONLY_INVALID_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_VIRTUAL_ATTRS_ONLY_INVALID_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new virtual attributes only request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static VirtualAttributesOnlyRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
+    private final boolean isCritical;
 
-
-    public String getOID()
-    {
-      return OID;
+    private VirtualAttributesOnlyRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new virtual attributes only request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static VirtualAttributesOnlyRequestControl newControl(
-      final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private final boolean isCritical;
-
-
-
-  private VirtualAttributesOnlyRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("VirtualAttributesOnlyRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("VirtualAttributesOnlyRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java
index c128661..df1bafb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package com.forgerock.opendj.ldap.controls;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java
index d2f347c..0f6d272 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -46,208 +43,157 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 
-
-
 /**
  * Get connection ID extended request. This operation can be used to retrieve
  * the client connection ID.
  *
  * @see GetConnectionIDExtendedResult
  */
-public final class GetConnectionIDExtendedRequest
-    extends
-    AbstractExtendedRequest<GetConnectionIDExtendedRequest, GetConnectionIDExtendedResult>
-{
-  private static final class RequestDecoder
-      implements
-      ExtendedRequestDecoder<GetConnectionIDExtendedRequest, GetConnectionIDExtendedResult>
-  {
+public final class GetConnectionIDExtendedRequest extends
+        AbstractExtendedRequest<GetConnectionIDExtendedRequest, GetConnectionIDExtendedResult> {
+    private static final class RequestDecoder implements
+            ExtendedRequestDecoder<GetConnectionIDExtendedRequest, GetConnectionIDExtendedResult> {
 
-    public GetConnectionIDExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      // TODO: Check the OID and that the value is not present.
-      final GetConnectionIDExtendedRequest newRequest = new GetConnectionIDExtendedRequest();
-      for (final Control control : request.getControls())
-      {
-        newRequest.addControl(control);
-      }
-      return newRequest;
+        public GetConnectionIDExtendedRequest decodeExtendedRequest(
+                final ExtendedRequest<?> request, final DecodeOptions options)
+                throws DecodeException {
+            // TODO: Check the OID and that the value is not present.
+            final GetConnectionIDExtendedRequest newRequest = new GetConnectionIDExtendedRequest();
+            for (final Control control : request.getControls()) {
+                newRequest.addControl(control);
+            }
+            return newRequest;
 
+        }
     }
-  }
 
+    private static final class ResultDecoder extends
+            AbstractExtendedResultDecoder<GetConnectionIDExtendedResult> {
+        /**
+         * {@inheritDoc}
+         */
+        public GetConnectionIDExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            if (!resultCode.isExceptional()) {
+                // A successful response must contain a response name and
+                // value.
+                throw new IllegalArgumentException("No response name and value for result code "
+                        + resultCode.intValue());
+            }
+            return GetConnectionIDExtendedResult.newResult(resultCode, -1).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
+        }
 
+        public GetConnectionIDExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            if (result instanceof GetConnectionIDExtendedResult) {
+                return (GetConnectionIDExtendedResult) result;
+            } else {
+                final ResultCode resultCode = result.getResultCode();
+                final ByteString responseValue = result.getValue();
 
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<GetConnectionIDExtendedResult>
-  {
+                if (!resultCode.isExceptional()
+                        && ((responseValue == null) || (responseValue.length() <= 0))) {
+                    throw DecodeException.error(LocalizableMessage.raw("Empty response value"));
+                }
+
+                try {
+                    final ASN1Reader reader = ASN1.getReader(responseValue);
+                    final int connectionID = (int) reader.readInteger();
+                    final GetConnectionIDExtendedResult newResult =
+                            GetConnectionIDExtendedResult.newResult(resultCode, connectionID)
+                                    .setMatchedDN(result.getMatchedDN()).setDiagnosticMessage(
+                                            result.getDiagnosticMessage());
+
+                    for (final Control control : result.getControls()) {
+                        newResult.addControl(control);
+                    }
+
+                    return newResult;
+                } catch (final IOException e) {
+                    throw DecodeException.error(LocalizableMessage
+                            .raw("Error decoding response value"), e);
+                }
+            }
+        }
+    }
+
+    /**
+     * The OID for the extended operation that can be used to get the client
+     * connection ID. It will be both the request and response OID.
+     */
+    public static final String OID = "1.3.6.1.4.1.26027.1.6.2";
+
+    // Singleton.
+    private static final GetConnectionIDExtendedRequest INSTANCE =
+            new GetConnectionIDExtendedRequest();
+
+    /**
+     * A decoder which can be used to decode get connection ID extended
+     * operation requests.
+     */
+    public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
+
+    // No need to expose this.
+    private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
+
+    /**
+     * Creates a new get connection ID extended request.
+     *
+     * @return The new get connection ID extended request.
+     */
+    public static GetConnectionIDExtendedRequest newRequest() {
+        return INSTANCE;
+    }
+
+    // Prevent instantiation.
+    private GetConnectionIDExtendedRequest() {
+        // Nothing to do.
+    }
+
     /**
      * {@inheritDoc}
      */
-    public GetConnectionIDExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      if (!resultCode.isExceptional())
-      {
-        // A successful response must contain a response name and
-        // value.
-        throw new IllegalArgumentException(
-            "No response name and value for result code "
-                + resultCode.intValue());
-      }
-      return GetConnectionIDExtendedResult.newResult(resultCode, -1)
-          .setMatchedDN(matchedDN).setDiagnosticMessage(diagnosticMessage);
+    @Override
+    public String getOID() {
+        return OID;
     }
 
-
-
-    public GetConnectionIDExtendedResult decodeExtendedResult(
-        final ExtendedResult result, final DecodeOptions options)
-        throws DecodeException
-    {
-      if (result instanceof GetConnectionIDExtendedResult)
-      {
-        return (GetConnectionIDExtendedResult) result;
-      }
-      else
-      {
-        final ResultCode resultCode = result.getResultCode();
-        final ByteString responseValue = result.getValue();
-
-        if (!resultCode.isExceptional()
-            && ((responseValue == null) || (responseValue.length() <= 0)))
-        {
-          throw DecodeException.error(LocalizableMessage
-              .raw("Empty response value"));
-        }
-
-        try
-        {
-          final ASN1Reader reader = ASN1.getReader(responseValue);
-          final int connectionID = (int) reader.readInteger();
-          final GetConnectionIDExtendedResult newResult = GetConnectionIDExtendedResult
-              .newResult(resultCode, connectionID).setMatchedDN(
-                  result.getMatchedDN()).setDiagnosticMessage(
-                  result.getDiagnosticMessage());
-
-          for (final Control control : result.getControls())
-          {
-            newResult.addControl(control);
-          }
-
-          return newResult;
-        }
-        catch (final IOException e)
-        {
-          throw DecodeException.error(LocalizableMessage
-              .raw("Error decoding response value"), e);
-        }
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<GetConnectionIDExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return false;
+    }
 
-  /**
-   * The OID for the extended operation that can be used to get the client
-   * connection ID. It will be both the request and response OID.
-   */
-  public static final String OID = "1.3.6.1.4.1.26027.1.6.2";
-
-  // Singleton.
-  private static final GetConnectionIDExtendedRequest INSTANCE =
-    new GetConnectionIDExtendedRequest();
-
-  /**
-   * A decoder which can be used to decode get connection ID extended operation
-   * requests.
-   */
-  public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
-
-  // No need to expose this.
-  private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
-
-
-
-  /**
-   * Creates a new get connection ID extended request.
-   *
-   * @return The new get connection ID extended request.
-   */
-  public static GetConnectionIDExtendedRequest newRequest()
-  {
-    return INSTANCE;
-  }
-
-
-
-  // Prevent instantiation.
-  private GetConnectionIDExtendedRequest()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<GetConnectionIDExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GetConnectionIDExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GetConnectionIDExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java
index ee40f6d..25adf4c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.asn1.ASN1;
@@ -41,143 +38,113 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
 /**
  * Get connection ID extended result.
  *
  * @see GetConnectionIDExtendedRequest
  */
 public final class GetConnectionIDExtendedResult extends
-    AbstractExtendedResult<GetConnectionIDExtendedResult>
-{
-  /**
-   * Creates a new get connection ID extended result.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param connectionID
-   *          The client connection ID.
-   * @return The new get connection ID extended result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static GetConnectionIDExtendedResult newResult(
-      final ResultCode resultCode, final int connectionID)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new GetConnectionIDExtendedResult(resultCode, connectionID);
-  }
-
-
-
-  private int connectionID;
-
-
-
-  private GetConnectionIDExtendedResult(final ResultCode resultCode,
-      final int connectionID)
-  {
-    super(resultCode);
-    this.connectionID = connectionID;
-  }
-
-
-
-  /**
-   * Returns the client connection ID.
-   *
-   * @return The client connection ID.
-   */
-  public int getConnectionID()
-  {
-    return connectionID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return GetConnectionIDExtendedRequest.OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder(6);
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-
-    try
-    {
-      writer.writeInteger(connectionID);
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+        AbstractExtendedResult<GetConnectionIDExtendedResult> {
+    /**
+     * Creates a new get connection ID extended result.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param connectionID
+     *            The client connection ID.
+     * @return The new get connection ID extended result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static GetConnectionIDExtendedResult newResult(final ResultCode resultCode,
+            final int connectionID) {
+        Validator.ensureNotNull(resultCode);
+        return new GetConnectionIDExtendedResult(resultCode, connectionID);
     }
 
-    return buffer.toByteString();
-  }
+    private int connectionID;
 
+    private GetConnectionIDExtendedResult(final ResultCode resultCode, final int connectionID) {
+        super(resultCode);
+        this.connectionID = connectionID;
+    }
 
+    /**
+     * Returns the client connection ID.
+     *
+     * @return The client connection ID.
+     */
+    public int getConnectionID() {
+        return connectionID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return GetConnectionIDExtendedRequest.OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder(6);
+        final ASN1Writer writer = ASN1.getWriter(buffer);
 
+        try {
+            writer.writeInteger(connectionID);
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
 
-  /**
-   * Sets the client connection ID.
-   *
-   * @param connectionID
-   *          The client connection ID.
-   * @return This get connection ID result.
-   */
-  public GetConnectionIDExtendedResult setConnectionID(final int connectionID)
-  {
-    this.connectionID = connectionID;
-    return this;
-  }
+        return buffer.toByteString();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * Sets the client connection ID.
+     *
+     * @param connectionID
+     *            The client connection ID.
+     * @return This get connection ID result.
+     */
+    public GetConnectionIDExtendedResult setConnectionID(final int connectionID) {
+        this.connectionID = connectionID;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GetConnectionIDExtendedResponse(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", responseName=");
-    builder.append(getOID());
-    builder.append(", connectionID=");
-    builder.append(connectionID);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GetConnectionIDExtendedResponse(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", responseName=");
+        builder.append(getOID());
+        builder.append(", connectionID=");
+        builder.append(connectionID);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java
index 401b5d8..5b3a38e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_GET_SYMMETRIC_KEY_NO_VALUE;
 
@@ -38,7 +35,11 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.requests.AbstractExtendedRequest;
 import org.forgerock.opendj.ldap.requests.ExtendedRequest;
@@ -50,287 +51,221 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Get symmetric key extended request.
  */
 public final class GetSymmetricKeyExtendedRequest extends
-    AbstractExtendedRequest<GetSymmetricKeyExtendedRequest, ExtendedResult>
-{
-  private static final class RequestDecoder implements
-      ExtendedRequestDecoder<GetSymmetricKeyExtendedRequest, ExtendedResult>
-  {
+        AbstractExtendedRequest<GetSymmetricKeyExtendedRequest, ExtendedResult> {
+    private static final class RequestDecoder implements
+            ExtendedRequestDecoder<GetSymmetricKeyExtendedRequest, ExtendedResult> {
 
-    public GetSymmetricKeyExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      final ByteString requestValue = request.getValue();
-      if (requestValue == null)
-      {
-        // The request must always have a value.
-        final LocalizableMessage message = ERR_GET_SYMMETRIC_KEY_NO_VALUE.get();
-        throw DecodeException.error(message);
-      }
+        public GetSymmetricKeyExtendedRequest decodeExtendedRequest(
+                final ExtendedRequest<?> request, final DecodeOptions options)
+                throws DecodeException {
+            final ByteString requestValue = request.getValue();
+            if (requestValue == null) {
+                // The request must always have a value.
+                final LocalizableMessage message = ERR_GET_SYMMETRIC_KEY_NO_VALUE.get();
+                throw DecodeException.error(message);
+            }
 
-      String requestSymmetricKey = null;
-      String instanceKeyID = null;
+            String requestSymmetricKey = null;
+            String instanceKeyID = null;
 
-      try
-      {
-        final ASN1Reader reader = ASN1.getReader(requestValue);
-        reader.readStartSequence();
-        if (reader.hasNextElement()
-            && (reader.peekType() == TYPE_SYMMETRIC_KEY_ELEMENT))
-        {
-          requestSymmetricKey = reader.readOctetStringAsString();
+            try {
+                final ASN1Reader reader = ASN1.getReader(requestValue);
+                reader.readStartSequence();
+                if (reader.hasNextElement() && (reader.peekType() == TYPE_SYMMETRIC_KEY_ELEMENT)) {
+                    requestSymmetricKey = reader.readOctetStringAsString();
+                }
+                if (reader.hasNextElement() && (reader.peekType() == TYPE_INSTANCE_KEY_ID_ELEMENT)) {
+                    instanceKeyID = reader.readOctetStringAsString();
+                }
+                reader.readEndSequence();
+
+                final GetSymmetricKeyExtendedRequest newRequest =
+                        new GetSymmetricKeyExtendedRequest().setRequestSymmetricKey(
+                                requestSymmetricKey).setInstanceKeyID(instanceKeyID);
+
+                for (final Control control : request.getControls()) {
+                    newRequest.addControl(control);
+                }
+
+                return newRequest;
+            } catch (final IOException ae) {
+                StaticUtils.DEBUG_LOG.throwing("GetSymmetricKeyRequest.Operation", "decodeRequest",
+                        ae);
+
+                final LocalizableMessage message =
+                        ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get(ae.getMessage());
+                throw DecodeException.error(message, ae);
+            }
         }
-        if (reader.hasNextElement()
-            && (reader.peekType() == TYPE_INSTANCE_KEY_ID_ELEMENT))
-        {
-          instanceKeyID = reader.readOctetStringAsString();
-        }
-        reader.readEndSequence();
+    }
 
-        final GetSymmetricKeyExtendedRequest newRequest = new GetSymmetricKeyExtendedRequest()
-            .setRequestSymmetricKey(requestSymmetricKey).setInstanceKeyID(
-                instanceKeyID);
+    private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> {
 
-        for (final Control control : request.getControls())
-        {
-          newRequest.addControl(control);
+        public ExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
         }
 
-        return newRequest;
-      }
-      catch (final IOException ae)
-      {
-        StaticUtils.DEBUG_LOG.throwing("GetSymmetricKeyRequest.Operation",
-            "decodeRequest", ae);
-
-        final LocalizableMessage message = ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION
-            .get(ae.getMessage());
-        throw DecodeException.error(message, ae);
-      }
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<ExtendedResult>
-  {
-
-    public ExtendedResult newExtendedErrorResult(final ResultCode resultCode,
-        final String matchedDN, final String diagnosticMessage)
-    {
-      return Responses.newGenericExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
+        public ExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            return result;
+        }
     }
 
+    /**
+     * The request OID for the get symmetric key extended operation.
+     */
+    public static final String OID = "1.3.6.1.4.1.26027.1.6.3";
 
+    /**
+     * The BER type value for the symmetric key element of the operation value.
+     */
+    private static final byte TYPE_SYMMETRIC_KEY_ELEMENT = (byte) 0x80;
 
-    public ExtendedResult decodeExtendedResult(final ExtendedResult result,
-        final DecodeOptions options) throws DecodeException
-    {
-      return result;
-    }
-  }
+    /**
+     * The BER type value for the instance key ID element of the operation
+     * value.
+     */
+    private static final byte TYPE_INSTANCE_KEY_ID_ELEMENT = (byte) 0x81;
 
+    /**
+     * A decoder which can be used to decode get symmetric key extended
+     * operation requests.
+     */
+    public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
 
+    // No need to expose this.
+    private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
 
-  /**
-   * The request OID for the get symmetric key extended operation.
-   */
-  public static final String OID = "1.3.6.1.4.1.26027.1.6.3";
-
-  /**
-   * The BER type value for the symmetric key element of the operation value.
-   */
-  private static final byte TYPE_SYMMETRIC_KEY_ELEMENT = (byte) 0x80;
-
-  /**
-   * The BER type value for the instance key ID element of the operation value.
-   */
-  private static final byte TYPE_INSTANCE_KEY_ID_ELEMENT = (byte) 0x81;
-
-  /**
-   * A decoder which can be used to decode get symmetric key extended operation
-   * requests.
-   */
-  public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
-
-  // No need to expose this.
-  private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
-
-
-
-  /**
-   * Creates a new get symmetric key extended request.
-   *
-   * @return The new get symmetric key extended request.
-   */
-  public static GetSymmetricKeyExtendedRequest newRequest()
-  {
-    return new GetSymmetricKeyExtendedRequest();
-  }
-
-
-
-  private String requestSymmetricKey = null;
-
-  private String instanceKeyID = null;
-
-
-
-  // Instantiation via factory.
-  private GetSymmetricKeyExtendedRequest()
-  {
-
-  }
-
-
-
-  /**
-   * Returns the instance key ID.
-   *
-   * @return The instance key ID.
-   */
-  public String getInstanceKeyID()
-  {
-    return instanceKeyID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns the request symmetric key.
-   *
-   * @return The request symmetric key.
-   */
-  public String getRequestSymmetricKey()
-  {
-    return requestSymmetricKey;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<ExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-
-    try
-    {
-      writer.writeStartSequence();
-      if (requestSymmetricKey != null)
-      {
-        writer
-            .writeOctetString(TYPE_SYMMETRIC_KEY_ELEMENT, requestSymmetricKey);
-      }
-      if (instanceKeyID != null)
-      {
-        writer.writeOctetString(TYPE_INSTANCE_KEY_ID_ELEMENT, instanceKeyID);
-      }
-      writer.writeEndSequence();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+    /**
+     * Creates a new get symmetric key extended request.
+     *
+     * @return The new get symmetric key extended request.
+     */
+    public static GetSymmetricKeyExtendedRequest newRequest() {
+        return new GetSymmetricKeyExtendedRequest();
     }
 
-    return buffer.toByteString();
-  }
+    private String requestSymmetricKey = null;
 
+    private String instanceKeyID = null;
 
+    // Instantiation via factory.
+    private GetSymmetricKeyExtendedRequest() {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
+    }
 
+    /**
+     * Returns the instance key ID.
+     *
+     * @return The instance key ID.
+     */
+    public String getInstanceKeyID() {
+        return instanceKeyID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * Sets the instance key ID.
-   *
-   * @param instanceKeyID
-   *          The instance key ID.
-   * @return This get symmetric key request.
-   */
-  public GetSymmetricKeyExtendedRequest setInstanceKeyID(
-      final String instanceKeyID)
-  {
-    this.instanceKeyID = instanceKeyID;
-    return this;
-  }
+    /**
+     * Returns the request symmetric key.
+     *
+     * @return The request symmetric key.
+     */
+    public String getRequestSymmetricKey() {
+        return requestSymmetricKey;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<ExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
 
-  /**
-   * Sets the request symmetric key.
-   *
-   * @param requestSymmetricKey
-   *          The request symmetric key.
-   * @return This get symmetric key request.
-   */
-  public GetSymmetricKeyExtendedRequest setRequestSymmetricKey(
-      final String requestSymmetricKey)
-  {
-    this.requestSymmetricKey = requestSymmetricKey;
-    return this;
-  }
+        try {
+            writer.writeStartSequence();
+            if (requestSymmetricKey != null) {
+                writer.writeOctetString(TYPE_SYMMETRIC_KEY_ELEMENT, requestSymmetricKey);
+            }
+            if (instanceKeyID != null) {
+                writer.writeOctetString(TYPE_INSTANCE_KEY_ID_ELEMENT, instanceKeyID);
+            }
+            writer.writeEndSequence();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
 
+        return buffer.toByteString();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GetSymmetricKeyExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", requestSymmetricKey=");
-    builder.append(requestSymmetricKey);
-    builder.append(", instanceKeyID=");
-    builder.append(instanceKeyID);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * Sets the instance key ID.
+     *
+     * @param instanceKeyID
+     *            The instance key ID.
+     * @return This get symmetric key request.
+     */
+    public GetSymmetricKeyExtendedRequest setInstanceKeyID(final String instanceKeyID) {
+        this.instanceKeyID = instanceKeyID;
+        return this;
+    }
+
+    /**
+     * Sets the request symmetric key.
+     *
+     * @param requestSymmetricKey
+     *            The request symmetric key.
+     * @return This get symmetric key request.
+     */
+    public GetSymmetricKeyExtendedRequest setRequestSymmetricKey(final String requestSymmetricKey) {
+        this.requestSymmetricKey = requestSymmetricKey;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GetSymmetricKeyExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", requestSymmetricKey=");
+        builder.append(requestSymmetricKey);
+        builder.append(", instanceKeyID=");
+        builder.append(instanceKeyID);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java
index c75c67c..ccfffbc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.formatAsGeneralizedTime;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWPSTATE_EXTOP_DECODE_FAILURE;
@@ -46,7 +43,12 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.requests.AbstractExtendedRequest;
 import org.forgerock.opendj.ldap.requests.ExtendedRequest;
@@ -57,8 +59,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class implements an LDAP extended operation that can be used to query
  * and update elements of the Directory Server password policy state for a given
@@ -125,1018 +125,741 @@
  * set*, add*, remove*, or clear* operation).
  */
 public final class PasswordPolicyStateExtendedRequest
-    extends
-    AbstractExtendedRequest<PasswordPolicyStateExtendedRequest, PasswordPolicyStateExtendedResult>
-    implements PasswordPolicyStateOperationContainer
-{
-  private static final class MultiValueOperation implements
-      PasswordPolicyStateOperation
-  {
-    private final PasswordPolicyStateOperationType property;
+        extends
+        AbstractExtendedRequest<PasswordPolicyStateExtendedRequest, PasswordPolicyStateExtendedResult>
+        implements PasswordPolicyStateOperationContainer {
+    private static final class MultiValueOperation implements PasswordPolicyStateOperation {
+        private final PasswordPolicyStateOperationType property;
 
-    private final List<ByteString> values;
+        private final List<ByteString> values;
 
+        private MultiValueOperation(final PasswordPolicyStateOperationType property,
+                final ByteString value) {
+            this.property = property;
+            this.values = Collections.singletonList(value);
+        }
 
+        private MultiValueOperation(final PasswordPolicyStateOperationType property,
+                final List<ByteString> values) {
+            this.property = property;
+            this.values = values;
+        }
 
-    private MultiValueOperation(
-        final PasswordPolicyStateOperationType property, final ByteString value)
-    {
-      this.property = property;
-      this.values = Collections.singletonList(value);
+        public PasswordPolicyStateOperationType getOperationType() {
+            return property;
+        }
+
+        public Iterable<ByteString> getValues() {
+            return values;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return property.toString() + ": " + values;
+        }
     }
 
+    private static final class RequestDecoder
+            implements
+            ExtendedRequestDecoder<PasswordPolicyStateExtendedRequest, PasswordPolicyStateExtendedResult> {
 
+        public PasswordPolicyStateExtendedRequest decodeExtendedRequest(
+                final ExtendedRequest<?> request, final DecodeOptions options)
+                throws DecodeException {
+            final ByteString requestValue = request.getValue();
 
-    private MultiValueOperation(
-        final PasswordPolicyStateOperationType property,
-        final List<ByteString> values)
-    {
-      this.property = property;
-      this.values = values;
+            if ((requestValue == null) || (requestValue.length() <= 0)) {
+                throw DecodeException.error(ERR_PWPSTATE_EXTOP_NO_REQUEST_VALUE.get());
+            }
+
+            try {
+                final ASN1Reader reader = ASN1.getReader(requestValue);
+                reader.readStartSequence();
+
+                // Read the target user DN
+                final PasswordPolicyStateExtendedRequest newRequest =
+                        new PasswordPolicyStateExtendedRequest(reader.readOctetStringAsString());
+
+                decodeOperations(reader, newRequest);
+                reader.readEndSequence();
+
+                for (final Control control : request.getControls()) {
+                    newRequest.addControl(control);
+                }
+
+                return newRequest;
+            } catch (final IOException ioe) {
+                final LocalizableMessage message =
+                        ERR_PWPSTATE_EXTOP_DECODE_FAILURE.get(getExceptionMessage(ioe));
+                throw DecodeException.error(message, ioe);
+            }
+        }
     }
 
+    private static final class ResultDecoder extends
+            AbstractExtendedResultDecoder<PasswordPolicyStateExtendedResult> {
 
+        /**
+         * {@inheritDoc}
+         */
+        public PasswordPolicyStateExtendedResult newExtendedErrorResult(
+                final ResultCode resultCode, final String matchedDN, final String diagnosticMessage) {
+            if (!resultCode.isExceptional()) {
+                // A successful response must contain a response name and
+                // value.
+                throw new IllegalArgumentException("No response name and value for result code "
+                        + resultCode.intValue());
+            }
 
-    public PasswordPolicyStateOperationType getOperationType()
-    {
-      return property;
+            return new PasswordPolicyStateExtendedResult(resultCode, (String) null).setMatchedDN(
+                    matchedDN).setDiagnosticMessage(diagnosticMessage);
+        }
+
+        public PasswordPolicyStateExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            final ResultCode resultCode = result.getResultCode();
+            final ByteString responseValue = result.getValue();
+
+            if (!resultCode.isExceptional()
+                    && ((responseValue == null) || (responseValue.length() <= 0))) {
+                throw DecodeException.error(ERR_PWPSTATE_EXTOP_NO_REQUEST_VALUE.get());
+            }
+
+            try {
+                final ASN1Reader reader = ASN1.getReader(responseValue);
+                reader.readStartSequence();
+
+                // Read the target user DN
+                final PasswordPolicyStateExtendedResult newResult =
+                        new PasswordPolicyStateExtendedResult(resultCode, reader
+                                .readOctetStringAsString()).setMatchedDN(result.getMatchedDN())
+                                .setDiagnosticMessage(result.getDiagnosticMessage());
+
+                decodeOperations(reader, newResult);
+                reader.readEndSequence();
+
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+
+                return newResult;
+            } catch (final IOException ioe) {
+                final LocalizableMessage message =
+                        ERR_PWPSTATE_EXTOP_DECODE_FAILURE.get(getExceptionMessage(ioe));
+                throw DecodeException.error(message, ioe);
+            }
+        }
     }
 
+    /**
+     * The OID for the password policy state extended operation (both the
+     * request and response types).
+     */
+    public static final String OID = "1.3.6.1.4.1.26027.1.6.1";
 
+    private final String targetUser;
 
-    public Iterable<ByteString> getValues()
-    {
-      return values;
+    private final List<PasswordPolicyStateOperation> operations =
+            new ArrayList<PasswordPolicyStateOperation>();
+
+    static final String PASSWORD_POLICY_DN_NAME = "Password Policy DN";
+
+    static final String ACCOUNT_DISABLED_STATE_NAME = "Account Disabled State";
+
+    static final String ACCOUNT_EXPIRATION_TIME_NAME = "Account Expiration Time";
+
+    static final String SECONDS_UNTIL_ACCOUNT_EXPIRATION_NAME = "Seconds Until Account Expiration";
+
+    static final String PASSWORD_CHANGED_TIME_NAME = "Password Changed Time";
+
+    static final String PASSWORD_EXPIRATION_WARNED_TIME_NAME = "Password Expiration Warned Time";
+
+    static final String SECONDS_UNTIL_PASSWORD_EXPIRATION_NAME =
+            "Seconds Until Password Expiration";
+
+    static final String SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING_NAME =
+            "Seconds Until Password Expiration Warning";
+
+    static final String AUTHENTICATION_FAILURE_TIMES_NAME = "Authentication Failure Times";
+
+    static final String SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK_NAME =
+            "Seconds Until Authentication Failure Unlock";
+
+    static final String REMAINING_AUTHENTICATION_FAILURE_COUNT_NAME =
+            "Remaining Authentication Failure Count";
+
+    static final String LAST_LOGIN_TIME_NAME = "Last Login Time";
+
+    static final String SECONDS_UNTIL_IDLE_LOCKOUT_NAME = "Seconds Until Idle Lockout";
+
+    static final String PASSWORD_RESET_STATE_NAME = "Password Reset State";
+
+    static final String SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT_NAME =
+            "Seconds Until Password Reset Lockout";
+
+    static final String GRACE_LOGIN_USE_TIMES_NAME = "Grace Login Use Times";
+
+    static final String REMAINING_GRACE_LOGIN_COUNT_NAME = "Remaining Grace Login Count";
+
+    static final String PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME =
+            "Password Changed By Required Time";
+
+    static final String SECONDS_UNTIL_REQUIRED_CHANGE_TIME_NAME =
+            "Seconds Until Required Change Time";
+
+    static final String PASSWORD_HISTORY_NAME = "Password History";
+
+    /**
+     * A decoder which can be used to decode password policy state extended
+     * operation requests.
+     */
+    public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
+
+    // No need to expose this.
+    private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
+
+    static ByteString encode(final String targetUser,
+            final List<PasswordPolicyStateOperation> operations) {
+        final ByteStringBuilder buffer = new ByteStringBuilder(6);
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+
+        try {
+            writer.writeStartSequence();
+            writer.writeOctetString(targetUser);
+            if (!operations.isEmpty()) {
+                writer.writeStartSequence();
+                for (final PasswordPolicyStateOperation operation : operations) {
+                    writer.writeStartSequence();
+                    writer.writeEnumerated(operation.getOperationType().ordinal());
+                    if (operation.getValues() != null) {
+                        writer.writeStartSequence();
+                        for (final ByteString value : operation.getValues()) {
+                            writer.writeOctetString(value);
+                        }
+                        writer.writeEndSequence();
+                    }
+                    writer.writeEndSequence();
+                }
+                writer.writeEndSequence();
+            }
+            writer.writeEndSequence();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+
+        return buffer.toByteString();
     }
 
+    private static void decodeOperations(final ASN1Reader reader,
+            final PasswordPolicyStateOperationContainer container) throws IOException,
+            DecodeException {
+        // See if we have operations
+        if (reader.hasNextElement()) {
+            reader.readStartSequence();
+            int opType;
+            PasswordPolicyStateOperationType type;
+            while (reader.hasNextElement()) {
+                reader.readStartSequence();
+                // Read the opType
+                opType = reader.readEnumerated();
+                try {
+                    type = PasswordPolicyStateOperationType.values()[opType];
+                } catch (final IndexOutOfBoundsException iobe) {
+                    throw DecodeException.error(ERR_PWPSTATE_EXTOP_UNKNOWN_OP_TYPE.get(String
+                            .valueOf(opType)), iobe);
+                }
 
+                // See if we have any values
+                if (reader.hasNextElement()) {
+                    reader.readStartSequence();
+                    final ArrayList<ByteString> values = new ArrayList<ByteString>();
+                    while (reader.hasNextElement()) {
+                        values.add(reader.readOctetString());
+                    }
+                    reader.readEndSequence();
+                    container.addOperation(new MultiValueOperation(type, values));
+                } else {
+                    container.addOperation(type);
+                }
+                reader.readEndSequence();
+            }
+            reader.readEndSequence();
+        }
+    }
+
+    /**
+     * Creates a new password policy state extended request using the provided
+     * user name.
+     *
+     * @param targetUser
+     *            The name of the user.
+     */
+    public PasswordPolicyStateExtendedRequest(final DN targetUser) {
+        Validator.ensureNotNull(targetUser);
+        this.targetUser = targetUser.toString();
+    }
+
+    /**
+     * Creates a new password policy state extended request using the provided
+     * user name.
+     *
+     * @param targetUser
+     *            The name of the user.
+     */
+    public PasswordPolicyStateExtendedRequest(final String targetUser) {
+        Validator.ensureNotNull(targetUser);
+        this.targetUser = targetUser;
+    }
+
+    /**
+     * Adds the provided authentication failure time to this request.
+     *
+     * @param date
+     *            The authentication failure time.
+     */
+    public void addAuthenticationFailureTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.ADD_AUTHENTICATION_FAILURE_TIMES);
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.ADD_AUTHENTICATION_FAILURE_TIMES, ByteString
+                            .valueOf(formatAsGeneralizedTime(date))));
+        }
+    }
+
+    /**
+     * Adds the provided grace login use time to this request.
+     *
+     * @param date
+     *            The grace login use time.
+     */
+    public void addGraceLoginUseTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.ADD_GRACE_LOGIN_USE_TIME);
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.ADD_GRACE_LOGIN_USE_TIME, ByteString
+                            .valueOf(formatAsGeneralizedTime(date))));
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addOperation(final PasswordPolicyStateOperation operation) {
+        operations.add(operation);
+    }
+
+    /**
+     * Clears the account disabled state.
+     */
+    public void clearAccountDisabledState() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_DISABLED_STATE);
+    }
+
+    /**
+     * Clears the account expiration time.
+     */
+    public void clearAccountExpirationTime() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_EXPIRATION_TIME);
+    }
+
+    /**
+     * Clears the authentication failure times.
+     */
+    public void clearAuthenticationFailureTimes() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_AUTHENTICATION_FAILURE_TIMES);
+    }
+
+    /**
+     * Clears the grace login use times.
+     */
+    public void clearGraceLoginUseTimes() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_GRACE_LOGIN_USE_TIMES);
+    }
+
+    /**
+     * Clears the last login time.
+     */
+    public void clearLastLoginTime() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_LAST_LOGIN_TIME);
+    }
+
+    /**
+     * Clears the password changed by required time.
+     */
+    public void clearPasswordChangedByRequiredTime() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME);
+    }
+
+    /**
+     * Clears the password changed time.
+     */
+    public void clearPasswordChangedTime() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_TIME);
+    }
+
+    /**
+     * Clears the password expiration warned time.
+     */
+    public void clearPasswordExpirationWarnedTime() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_EXPIRATION_WARNED_TIME);
+    }
+
+    /**
+     * Clears the password history.
+     */
+    public void clearPasswordHistory() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_HISTORY);
+    }
+
+    /**
+     * Clears the password reset state.
+     */
+    public void clearPasswordResetState() {
+        operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_RESET_STATE);
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public String toString()
-    {
-      return property.toString() + ": " + values;
+    public String getOID() {
+        return OID;
     }
-  }
-
-
-
-  private static final class RequestDecoder
-      implements
-      ExtendedRequestDecoder<PasswordPolicyStateExtendedRequest, PasswordPolicyStateExtendedResult>
-  {
-
-    public PasswordPolicyStateExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      final ByteString requestValue = request.getValue();
-
-      if ((requestValue == null) || (requestValue.length() <= 0))
-      {
-        throw DecodeException.error(ERR_PWPSTATE_EXTOP_NO_REQUEST_VALUE.get());
-      }
-
-      try
-      {
-        final ASN1Reader reader = ASN1.getReader(requestValue);
-        reader.readStartSequence();
-
-        // Read the target user DN
-        final PasswordPolicyStateExtendedRequest newRequest =
-          new PasswordPolicyStateExtendedRequest(
-              reader.readOctetStringAsString());
-
-        decodeOperations(reader, newRequest);
-        reader.readEndSequence();
-
-        for (final Control control : request.getControls())
-        {
-          newRequest.addControl(control);
-        }
-
-        return newRequest;
-      }
-      catch (final IOException ioe)
-      {
-        final LocalizableMessage message = ERR_PWPSTATE_EXTOP_DECODE_FAILURE
-            .get(getExceptionMessage(ioe));
-        throw DecodeException.error(message, ioe);
-      }
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<PasswordPolicyStateExtendedResult>
-  {
 
     /**
      * {@inheritDoc}
      */
-    public PasswordPolicyStateExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      if (!resultCode.isExceptional())
-      {
-        // A successful response must contain a response name and
-        // value.
-        throw new IllegalArgumentException(
-            "No response name and value for result code "
-                + resultCode.intValue());
-      }
-
-      return new PasswordPolicyStateExtendedResult(resultCode, (String) null)
-          .setMatchedDN(matchedDN).setDiagnosticMessage(diagnosticMessage);
+    public Iterable<PasswordPolicyStateOperation> getOperations() {
+        return operations;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<PasswordPolicyStateExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return encode(targetUser, operations);
+    }
 
-    public PasswordPolicyStateExtendedResult decodeExtendedResult(
-        final ExtendedResult result, final DecodeOptions options)
-        throws DecodeException
-    {
-      final ResultCode resultCode = result.getResultCode();
-      final ByteString responseValue = result.getValue();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
-      if (!resultCode.isExceptional()
-          && ((responseValue == null) || (responseValue.length() <= 0)))
-      {
-        throw DecodeException.error(ERR_PWPSTATE_EXTOP_NO_REQUEST_VALUE.get());
-      }
+    /**
+     * Returns the account disabled state.
+     */
+    public void requestAccountDisabledState() {
+        operations.add(PasswordPolicyStateOperationType.GET_ACCOUNT_DISABLED_STATE);
+    }
 
-      try
-      {
-        final ASN1Reader reader = ASN1.getReader(responseValue);
-        reader.readStartSequence();
+    /**
+     * Returns the account expiration time.
+     */
+    public void requestAccountExpirationTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_ACCOUNT_EXPIRATION_TIME);
+    }
 
-        // Read the target user DN
-        final PasswordPolicyStateExtendedResult newResult = new PasswordPolicyStateExtendedResult(
-            resultCode, reader.readOctetStringAsString()).setMatchedDN(
-            result.getMatchedDN()).setDiagnosticMessage(
-            result.getDiagnosticMessage());
+    /**
+     * Returns the authentication failure times.
+     */
+    public void requestAuthenticationFailureTimes() {
+        operations.add(PasswordPolicyStateOperationType.GET_AUTHENTICATION_FAILURE_TIMES);
+    }
 
-        decodeOperations(reader, newResult);
-        reader.readEndSequence();
+    /**
+     * Returns the grace login use times.
+     */
+    public void requestGraceLoginUseTimes() {
+        operations.add(PasswordPolicyStateOperationType.GET_GRACE_LOGIN_USE_TIMES);
+    }
 
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+    /**
+     * Returns the last login time.
+     */
+    public void requestLastLoginTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_LAST_LOGIN_TIME);
+    }
+
+    /**
+     * Returns the password changed by required time.
+     */
+    public void requestPasswordChangedByRequiredTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_BY_REQUIRED_TIME);
+    }
+
+    /**
+     * Returns the password changed time.
+     */
+    public void requestPasswordChangedTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_TIME);
+    }
+
+    /**
+     * Returns the password expiration warned time.
+     */
+    public void requestPasswordExpirationWarnedTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_EXPIRATION_WARNED_TIME);
+    }
+
+    /**
+     * Returns the password history.
+     */
+    public void requestPasswordHistory() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_HISTORY);
+    }
+
+    /**
+     * Returns the password policy DN.
+     */
+    public void requestPasswordPolicyDN() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_POLICY_DN);
+    }
+
+    /**
+     * Returns the password reset state.
+     */
+    public void requestPasswordResetState() {
+        operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_RESET_STATE);
+    }
+
+    /**
+     * Returns the remaining authentication failure count.
+     */
+    public void requestRemainingAuthenticationFailureCount() {
+        operations.add(PasswordPolicyStateOperationType.GET_REMAINING_AUTHENTICATION_FAILURE_COUNT);
+    }
+
+    /**
+     * Returns the remaining grace login count.
+     */
+    public void requestRemainingGraceLoginCount() {
+        operations.add(PasswordPolicyStateOperationType.GET_REMAINING_GRACE_LOGIN_COUNT);
+    }
+
+    /**
+     * Returns the seconds until account expiration.
+     */
+    public void requestSecondsUntilAccountExpiration() {
+        operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION);
+    }
+
+    /**
+     * Returns the seconds until authentication failure unlock.
+     */
+    public void requestSecondsUntilAuthenticationFailureUnlock() {
+        operations
+                .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK);
+    }
+
+    /**
+     * Returns the seconds until idle lockout.
+     */
+    public void requestSecondsUntilIdleLockout() {
+        operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_IDLE_LOCKOUT);
+    }
+
+    /**
+     * Returns the seconds until password expiration.
+     */
+    public void requestSecondsUntilPasswordExpiration() {
+        operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION);
+    }
+
+    /**
+     * Returns the seconds until password expiration warning.
+     */
+    public void requestSecondsUntilPasswordExpirationWarning() {
+        operations
+                .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING);
+    }
+
+    /**
+     * Returns the seconds until password reset lockout.
+     */
+    public void requestSecondsUntilPasswordResetLockout() {
+        operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT);
+    }
+
+    /**
+     * Returns the seconds until required change time.
+     */
+    public void requestSecondsUntilRequiredChangeTime() {
+        operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME);
+    }
+
+    /**
+     * Sets the account disabled state.
+     *
+     * @param state
+     *            The account disabled state.
+     */
+    public void setAccountDisabledState(final boolean state) {
+        operations.add(new MultiValueOperation(
+                PasswordPolicyStateOperationType.SET_ACCOUNT_DISABLED_STATE, ByteString
+                        .valueOf(String.valueOf(state))));
+    }
+
+    /**
+     * Sets the account expiration time.
+     *
+     * @param date
+     *            The account expiration time.
+     */
+    public void setAccountExpirationTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_ACCOUNT_EXPIRATION_TIME);
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_ACCOUNT_EXPIRATION_TIME, ByteString
+                            .valueOf(formatAsGeneralizedTime(date))));
         }
-
-        return newResult;
-      }
-      catch (final IOException ioe)
-      {
-        final LocalizableMessage message = ERR_PWPSTATE_EXTOP_DECODE_FAILURE
-            .get(getExceptionMessage(ioe));
-        throw DecodeException.error(message, ioe);
-      }
     }
-  }
 
-
-
-  /**
-   * The OID for the password policy state extended operation (both the request
-   * and response types).
-   */
-  public static final String OID = "1.3.6.1.4.1.26027.1.6.1";
-
-  private final String targetUser;
-
-  private final List<PasswordPolicyStateOperation> operations =
-    new ArrayList<PasswordPolicyStateOperation>();
-
-  static final String PASSWORD_POLICY_DN_NAME = "Password Policy DN";
-
-  static final String ACCOUNT_DISABLED_STATE_NAME = "Account Disabled State";
-
-  static final String ACCOUNT_EXPIRATION_TIME_NAME = "Account Expiration Time";
-
-  static final String SECONDS_UNTIL_ACCOUNT_EXPIRATION_NAME =
-    "Seconds Until Account Expiration";
-
-  static final String PASSWORD_CHANGED_TIME_NAME = "Password Changed Time";
-
-  static final String PASSWORD_EXPIRATION_WARNED_TIME_NAME =
-    "Password Expiration Warned Time";
-
-  static final String SECONDS_UNTIL_PASSWORD_EXPIRATION_NAME =
-    "Seconds Until Password Expiration";
-
-  static final String SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING_NAME =
-    "Seconds Until Password Expiration Warning";
-
-  static final String AUTHENTICATION_FAILURE_TIMES_NAME =
-    "Authentication Failure Times";
-
-  static final String SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK_NAME =
-    "Seconds Until Authentication Failure Unlock";
-
-  static final String REMAINING_AUTHENTICATION_FAILURE_COUNT_NAME =
-    "Remaining Authentication Failure Count";
-
-  static final String LAST_LOGIN_TIME_NAME = "Last Login Time";
-
-  static final String SECONDS_UNTIL_IDLE_LOCKOUT_NAME =
-    "Seconds Until Idle Lockout";
-
-  static final String PASSWORD_RESET_STATE_NAME = "Password Reset State";
-
-  static final String SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT_NAME =
-    "Seconds Until Password Reset Lockout";
-
-  static final String GRACE_LOGIN_USE_TIMES_NAME = "Grace Login Use Times";
-
-  static final String REMAINING_GRACE_LOGIN_COUNT_NAME =
-    "Remaining Grace Login Count";
-
-  static final String PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME =
-    "Password Changed By Required Time";
-
-  static final String SECONDS_UNTIL_REQUIRED_CHANGE_TIME_NAME =
-    "Seconds Until Required Change Time";
-
-  static final String PASSWORD_HISTORY_NAME = "Password History";
-
-  /**
-   * A decoder which can be used to decode password policy state extended
-   * operation requests.
-   */
-  public static final RequestDecoder REQUEST_DECODER = new RequestDecoder();
-
-  // No need to expose this.
-  private static final ResultDecoder RESULT_DECODER = new ResultDecoder();
-
-
-
-  static ByteString encode(final String targetUser,
-      final List<PasswordPolicyStateOperation> operations)
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder(6);
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeOctetString(targetUser);
-      if (!operations.isEmpty())
-      {
-        writer.writeStartSequence();
-        for (final PasswordPolicyStateOperation operation : operations)
-        {
-          writer.writeStartSequence();
-          writer.writeEnumerated(operation.getOperationType().ordinal());
-          if (operation.getValues() != null)
-          {
-            writer.writeStartSequence();
-            for (final ByteString value : operation.getValues())
-            {
-              writer.writeOctetString(value);
+    /**
+     * Sets the authentication failure times.
+     *
+     * @param dates
+     *            The authentication failure times.
+     */
+    public void setAuthenticationFailureTimes(final Date... dates) {
+        if (dates == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_AUTHENTICATION_FAILURE_TIMES);
+        } else {
+            final ArrayList<ByteString> times = new ArrayList<ByteString>(dates.length);
+            for (final Date date : dates) {
+                times.add(ByteString.valueOf(formatAsGeneralizedTime(date)));
             }
-            writer.writeEndSequence();
-          }
-          writer.writeEndSequence();
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_AUTHENTICATION_FAILURE_TIMES, times));
         }
-        writer.writeEndSequence();
-      }
-      writer.writeEndSequence();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
     }
 
-    return buffer.toByteString();
-  }
-
-
-
-  private static void decodeOperations(final ASN1Reader reader,
-      final PasswordPolicyStateOperationContainer container)
-      throws IOException, DecodeException
-  {
-    // See if we have operations
-    if (reader.hasNextElement())
-    {
-      reader.readStartSequence();
-      int opType;
-      PasswordPolicyStateOperationType type;
-      while (reader.hasNextElement())
-      {
-        reader.readStartSequence();
-        // Read the opType
-        opType = reader.readEnumerated();
-        try
-        {
-          type = PasswordPolicyStateOperationType.values()[opType];
+    /**
+     * Sets the grace login use times.
+     *
+     * @param dates
+     *            The grace login use times.
+     */
+    public void setGraceLoginUseTimes(final Date... dates) {
+        if (dates == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_GRACE_LOGIN_USE_TIMES);
+        } else {
+            final ArrayList<ByteString> times = new ArrayList<ByteString>(dates.length);
+            for (final Date date : dates) {
+                times.add(ByteString.valueOf(formatAsGeneralizedTime(date)));
+            }
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_GRACE_LOGIN_USE_TIMES, times));
         }
-        catch (final IndexOutOfBoundsException iobe)
-        {
-          throw DecodeException.error(ERR_PWPSTATE_EXTOP_UNKNOWN_OP_TYPE
-              .get(String.valueOf(opType)), iobe);
+    }
+
+    /**
+     * Sets the last login time.
+     *
+     * @param date
+     *            The last login time.
+     */
+    public void setLastLoginTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_LAST_LOGIN_TIME);
+
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_LAST_LOGIN_TIME, ByteString
+                            .valueOf(formatAsGeneralizedTime(date))));
         }
+    }
 
-        // See if we have any values
-        if (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          final ArrayList<ByteString> values = new ArrayList<ByteString>();
-          while (reader.hasNextElement())
-          {
-            values.add(reader.readOctetString());
-          }
-          reader.readEndSequence();
-          container.addOperation(new MultiValueOperation(type, values));
+    /**
+     * Sets the password changed by required time.
+     *
+     * @param state
+     *            The password changed by required time.
+     */
+    public void setPasswordChangedByRequiredTime(final boolean state) {
+        operations.add(new MultiValueOperation(
+                PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_BY_REQUIRED_TIME, ByteString
+                        .valueOf(String.valueOf(state))));
+    }
+
+    /**
+     * Sets the password changed time.
+     *
+     * @param date
+     *            The password changed time.
+     */
+    public void setPasswordChangedTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_TIME);
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_TIME, ByteString
+                            .valueOf(formatAsGeneralizedTime(date))));
         }
-        else
-        {
-          container.addOperation(type);
+    }
+
+    /**
+     * Sets the password expiration warned time.
+     *
+     * @param date
+     *            The password expiration warned time.
+     */
+    public void setPasswordExpirationWarnedTime(final Date date) {
+        if (date == null) {
+            operations.add(PasswordPolicyStateOperationType.SET_PASSWORD_EXPIRATION_WARNED_TIME);
+
+        } else {
+            operations.add(new MultiValueOperation(
+                    PasswordPolicyStateOperationType.SET_PASSWORD_EXPIRATION_WARNED_TIME,
+                    ByteString.valueOf(formatAsGeneralizedTime(date))));
         }
-        reader.readEndSequence();
-      }
-      reader.readEndSequence();
     }
-  }
 
-
-
-  /**
-   * Creates a new password policy state extended request using the provided
-   * user name.
-   *
-   * @param targetUser
-   *          The name of the user.
-   */
-  public PasswordPolicyStateExtendedRequest(final DN targetUser)
-  {
-    Validator.ensureNotNull(targetUser);
-    this.targetUser = targetUser.toString();
-  }
-
-
-
-  /**
-   * Creates a new password policy state extended request using the provided
-   * user name.
-   *
-   * @param targetUser
-   *          The name of the user.
-   */
-  public PasswordPolicyStateExtendedRequest(final String targetUser)
-  {
-    Validator.ensureNotNull(targetUser);
-    this.targetUser = targetUser;
-  }
-
-
-
-  /**
-   * Adds the provided authentication failure time to this request.
-   *
-   * @param date
-   *          The authentication failure time.
-   */
-  public void addAuthenticationFailureTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.ADD_AUTHENTICATION_FAILURE_TIMES);
+    /**
+     * Sets the password reset state.
+     *
+     * @param state
+     *            The password reset state.
+     */
+    public void setPasswordResetState(final boolean state) {
+        operations.add(new MultiValueOperation(
+                PasswordPolicyStateOperationType.SET_PASSWORD_RESET_STATE, ByteString
+                        .valueOf(String.valueOf(state))));
     }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.ADD_AUTHENTICATION_FAILURE_TIMES,
-          ByteString.valueOf(formatAsGeneralizedTime(date))));
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordPolicyStateExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", targetUser=");
+        builder.append(targetUser);
+        builder.append(", operations=");
+        builder.append(operations);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
     }
-  }
-
-
-
-  /**
-   * Adds the provided grace login use time to this request.
-   *
-   * @param date
-   *          The grace login use time.
-   */
-  public void addGraceLoginUseTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations.add(PasswordPolicyStateOperationType.ADD_GRACE_LOGIN_USE_TIME);
-    }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.ADD_GRACE_LOGIN_USE_TIME, ByteString
-              .valueOf(formatAsGeneralizedTime(date))));
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void addOperation(final PasswordPolicyStateOperation operation)
-  {
-    operations.add(operation);
-  }
-
-
-
-  /**
-   * Clears the account disabled state.
-   */
-  public void clearAccountDisabledState()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_DISABLED_STATE);
-  }
-
-
-
-  /**
-   * Clears the account expiration time.
-   */
-  public void clearAccountExpirationTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_EXPIRATION_TIME);
-  }
-
-
-
-  /**
-   * Clears the authentication failure times.
-   */
-  public void clearAuthenticationFailureTimes()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_AUTHENTICATION_FAILURE_TIMES);
-  }
-
-
-
-  /**
-   * Clears the grace login use times.
-   */
-  public void clearGraceLoginUseTimes()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_GRACE_LOGIN_USE_TIMES);
-  }
-
-
-
-  /**
-   * Clears the last login time.
-   */
-  public void clearLastLoginTime()
-  {
-    operations.add(PasswordPolicyStateOperationType.CLEAR_LAST_LOGIN_TIME);
-  }
-
-
-
-  /**
-   * Clears the password changed by required time.
-   */
-  public void clearPasswordChangedByRequiredTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME);
-  }
-
-
-
-  /**
-   * Clears the password changed time.
-   */
-  public void clearPasswordChangedTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_TIME);
-  }
-
-
-
-  /**
-   * Clears the password expiration warned time.
-   */
-  public void clearPasswordExpirationWarnedTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_EXPIRATION_WARNED_TIME);
-  }
-
-
-
-  /**
-   * Clears the password history.
-   */
-  public void clearPasswordHistory()
-  {
-    operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_HISTORY);
-  }
-
-
-
-  /**
-   * Clears the password reset state.
-   */
-  public void clearPasswordResetState()
-  {
-    operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_RESET_STATE);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<PasswordPolicyStateOperation> getOperations()
-  {
-    return operations;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<PasswordPolicyStateExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return encode(targetUser, operations);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Returns the account disabled state.
-   */
-  public void requestAccountDisabledState()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_ACCOUNT_DISABLED_STATE);
-  }
-
-
-
-  /**
-   * Returns the account expiration time.
-   */
-  public void requestAccountExpirationTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_ACCOUNT_EXPIRATION_TIME);
-  }
-
-
-
-  /**
-   * Returns the authentication failure times.
-   */
-  public void requestAuthenticationFailureTimes()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_AUTHENTICATION_FAILURE_TIMES);
-  }
-
-
-
-  /**
-   * Returns the grace login use times.
-   */
-  public void requestGraceLoginUseTimes()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_GRACE_LOGIN_USE_TIMES);
-  }
-
-
-
-  /**
-   * Returns the last login time.
-   */
-  public void requestLastLoginTime()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_LAST_LOGIN_TIME);
-  }
-
-
-
-  /**
-   * Returns the password changed by required time.
-   */
-  public void requestPasswordChangedByRequiredTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_BY_REQUIRED_TIME);
-  }
-
-
-
-  /**
-   * Returns the password changed time.
-   */
-  public void requestPasswordChangedTime()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_TIME);
-  }
-
-
-
-  /**
-   * Returns the password expiration warned time.
-   */
-  public void requestPasswordExpirationWarnedTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_PASSWORD_EXPIRATION_WARNED_TIME);
-  }
-
-
-
-  /**
-   * Returns the password history.
-   */
-  public void requestPasswordHistory()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_HISTORY);
-  }
-
-
-
-  /**
-   * Returns the password policy DN.
-   */
-  public void requestPasswordPolicyDN()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_POLICY_DN);
-  }
-
-
-
-  /**
-   * Returns the password reset state.
-   */
-  public void requestPasswordResetState()
-  {
-    operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_RESET_STATE);
-  }
-
-
-
-  /**
-   * Returns the remaining authentication failure count.
-   */
-  public void requestRemainingAuthenticationFailureCount()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_REMAINING_AUTHENTICATION_FAILURE_COUNT);
-  }
-
-
-
-  /**
-   * Returns the remaining grace login count.
-   */
-  public void requestRemainingGraceLoginCount()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_REMAINING_GRACE_LOGIN_COUNT);
-  }
-
-
-
-  /**
-   * Returns the seconds until account expiration.
-   */
-  public void requestSecondsUntilAccountExpiration()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION);
-  }
-
-
-
-  /**
-   * Returns the seconds until authentication failure unlock.
-   */
-  public void requestSecondsUntilAuthenticationFailureUnlock()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK);
-  }
-
-
-
-  /**
-   * Returns the seconds until idle lockout.
-   */
-  public void requestSecondsUntilIdleLockout()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_IDLE_LOCKOUT);
-  }
-
-
-
-  /**
-   * Returns the seconds until password expiration.
-   */
-  public void requestSecondsUntilPasswordExpiration()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION);
-  }
-
-
-
-  /**
-   * Returns the seconds until password expiration warning.
-   */
-  public void requestSecondsUntilPasswordExpirationWarning()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING);
-  }
-
-
-
-  /**
-   * Returns the seconds until password reset lockout.
-   */
-  public void requestSecondsUntilPasswordResetLockout()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT);
-  }
-
-
-
-  /**
-   * Returns the seconds until required change time.
-   */
-  public void requestSecondsUntilRequiredChangeTime()
-  {
-    operations
-        .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME);
-  }
-
-
-
-  /**
-   * Sets the account disabled state.
-   *
-   * @param state
-   *          The account disabled state.
-   */
-  public void setAccountDisabledState(final boolean state)
-  {
-    operations.add(new MultiValueOperation(
-        PasswordPolicyStateOperationType.SET_ACCOUNT_DISABLED_STATE, ByteString
-            .valueOf(String.valueOf(state))));
-  }
-
-
-
-  /**
-   * Sets the account expiration time.
-   *
-   * @param date
-   *          The account expiration time.
-   */
-  public void setAccountExpirationTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.SET_ACCOUNT_EXPIRATION_TIME);
-    }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_ACCOUNT_EXPIRATION_TIME,
-          ByteString.valueOf(formatAsGeneralizedTime(date))));
-    }
-  }
-
-
-
-  /**
-   * Sets the authentication failure times.
-   *
-   * @param dates
-   *          The authentication failure times.
-   */
-  public void setAuthenticationFailureTimes(final Date... dates)
-  {
-    if (dates == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.SET_AUTHENTICATION_FAILURE_TIMES);
-    }
-    else
-    {
-      final ArrayList<ByteString> times = new ArrayList<ByteString>(
-          dates.length);
-      for (final Date date : dates)
-      {
-        times.add(ByteString.valueOf(formatAsGeneralizedTime(date)));
-      }
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_AUTHENTICATION_FAILURE_TIMES,
-          times));
-    }
-  }
-
-
-
-  /**
-   * Sets the grace login use times.
-   *
-   * @param dates
-   *          The grace login use times.
-   */
-  public void setGraceLoginUseTimes(final Date... dates)
-  {
-    if (dates == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.SET_GRACE_LOGIN_USE_TIMES);
-    }
-    else
-    {
-      final ArrayList<ByteString> times = new ArrayList<ByteString>(
-          dates.length);
-      for (final Date date : dates)
-      {
-        times.add(ByteString.valueOf(formatAsGeneralizedTime(date)));
-      }
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_GRACE_LOGIN_USE_TIMES, times));
-    }
-  }
-
-
-
-  /**
-   * Sets the last login time.
-   *
-   * @param date
-   *          The last login time.
-   */
-  public void setLastLoginTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations.add(PasswordPolicyStateOperationType.SET_LAST_LOGIN_TIME);
-
-    }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_LAST_LOGIN_TIME, ByteString
-              .valueOf(formatAsGeneralizedTime(date))));
-    }
-  }
-
-
-
-  /**
-   * Sets the password changed by required time.
-   *
-   * @param state
-   *          The password changed by required time.
-   */
-  public void setPasswordChangedByRequiredTime(final boolean state)
-  {
-    operations.add(new MultiValueOperation(
-        PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_BY_REQUIRED_TIME,
-        ByteString.valueOf(String.valueOf(state))));
-  }
-
-
-
-  /**
-   * Sets the password changed time.
-   *
-   * @param date
-   *          The password changed time.
-   */
-  public void setPasswordChangedTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_TIME);
-    }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_PASSWORD_CHANGED_TIME,
-          ByteString.valueOf(formatAsGeneralizedTime(date))));
-    }
-  }
-
-
-
-  /**
-   * Sets the password expiration warned time.
-   *
-   * @param date
-   *          The password expiration warned time.
-   */
-  public void setPasswordExpirationWarnedTime(final Date date)
-  {
-    if (date == null)
-    {
-      operations
-          .add(PasswordPolicyStateOperationType.SET_PASSWORD_EXPIRATION_WARNED_TIME);
-
-    }
-    else
-    {
-      operations.add(new MultiValueOperation(
-          PasswordPolicyStateOperationType.SET_PASSWORD_EXPIRATION_WARNED_TIME,
-          ByteString.valueOf(formatAsGeneralizedTime(date))));
-    }
-  }
-
-
-
-  /**
-   * Sets the password reset state.
-   *
-   * @param state
-   *          The password reset state.
-   */
-  public void setPasswordResetState(final boolean state)
-  {
-    operations.add(new MultiValueOperation(
-        PasswordPolicyStateOperationType.SET_PASSWORD_RESET_STATE, ByteString
-            .valueOf(String.valueOf(state))));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordPolicyStateExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", targetUser=");
-    builder.append(targetUser);
-    builder.append(", operations=");
-    builder.append(operations);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java
index 824f465..eae5979 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -37,135 +34,106 @@
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.responses.AbstractExtendedResult;
 
-
-
 /**
  * The password policy state extended result.
  */
 public final class PasswordPolicyStateExtendedResult extends
-    AbstractExtendedResult<PasswordPolicyStateExtendedResult> implements
-    PasswordPolicyStateOperationContainer
-{
-  private final String targetUser;
+        AbstractExtendedResult<PasswordPolicyStateExtendedResult> implements
+        PasswordPolicyStateOperationContainer {
+    private final String targetUser;
 
-  private final List<PasswordPolicyStateOperation> operations =
-    new ArrayList<PasswordPolicyStateOperation>();
+    private final List<PasswordPolicyStateOperation> operations =
+            new ArrayList<PasswordPolicyStateOperation>();
 
+    /**
+     * Creates a new password policy state extended result with the provided
+     * result code and target user.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param targetUser
+     *            The user name.
+     */
+    public PasswordPolicyStateExtendedResult(final ResultCode resultCode, final DN targetUser) {
+        this(resultCode, String.valueOf(targetUser));
+    }
 
+    /**
+     * Creates a new password policy state extended result with the provided
+     * result code and target user.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param targetUser
+     *            The user name.
+     */
+    public PasswordPolicyStateExtendedResult(final ResultCode resultCode, final String targetUser) {
+        super(resultCode);
+        this.targetUser = targetUser;
+    }
 
-  /**
-   * Creates a new password policy state extended result with the provided
-   * result code and target user.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param targetUser
-   *          The user name.
-   */
-  public PasswordPolicyStateExtendedResult(final ResultCode resultCode,
-      final DN targetUser)
-  {
-    this(resultCode, String.valueOf(targetUser));
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public void addOperation(final PasswordPolicyStateOperation operation) {
+        operations.add(operation);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        // No response name defined.
+        return PasswordPolicyStateExtendedRequest.OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<PasswordPolicyStateOperation> getOperations() {
+        return operations;
+    }
 
-  /**
-   * Creates a new password policy state extended result with the provided
-   * result code and target user.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param targetUser
-   *          The user name.
-   */
-  public PasswordPolicyStateExtendedResult(final ResultCode resultCode,
-      final String targetUser)
-  {
-    super(resultCode);
-    this.targetUser = targetUser;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return PasswordPolicyStateExtendedRequest.encode(targetUser, operations);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public void addOperation(final PasswordPolicyStateOperation operation)
-  {
-    operations.add(operation);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    // No response name defined.
-    return PasswordPolicyStateExtendedRequest.OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<PasswordPolicyStateOperation> getOperations()
-  {
-    return operations;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return PasswordPolicyStateExtendedRequest.encode(targetUser, operations);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordPolicyStateExtendedResponse(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", responseName=");
-    builder.append(getOID());
-    builder.append(", targetUser=");
-    builder.append(targetUser);
-    builder.append(", operations=");
-    builder.append(operations);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordPolicyStateExtendedResponse(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", responseName=");
+        builder.append(getOID());
+        builder.append(", targetUser=");
+        builder.append(targetUser);
+        builder.append(", operations=");
+        builder.append(operations);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java
index a5f0583..f965c18 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,30 +26,23 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Password policy state operation.
  */
-public interface PasswordPolicyStateOperation
-{
-  /**
-   * Returns the type of operation.
-   *
-   * @return The type of operation.
-   */
-  PasswordPolicyStateOperationType getOperationType();
+public interface PasswordPolicyStateOperation {
+    /**
+     * Returns the type of operation.
+     *
+     * @return The type of operation.
+     */
+    PasswordPolicyStateOperationType getOperationType();
 
-
-
-  /**
-   * Returns the operation values.
-   *
-   * @return The operation values.
-   */
-  Iterable<ByteString> getValues();
+    /**
+     * Returns the operation values.
+     *
+     * @return The operation values.
+     */
+    Iterable<ByteString> getValues();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java
index 7255b9f..cc295e1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,27 +26,22 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 /**
  * Password policy state operation container.
  */
-interface PasswordPolicyStateOperationContainer
-{
-  /**
-   * Adds an operation to this container.
-   *
-   * @param operation
-   *          The operation to be added.
-   */
-  void addOperation(PasswordPolicyStateOperation operation);
+interface PasswordPolicyStateOperationContainer {
+    /**
+     * Adds an operation to this container.
+     *
+     * @param operation
+     *            The operation to be added.
+     */
+    void addOperation(PasswordPolicyStateOperation operation);
 
-
-
-  /**
-   * Returns the operations in this container.
-   *
-   * @return The operations in this container.
-   */
-  Iterable<PasswordPolicyStateOperation> getOperations();
+    /**
+     * Returns the operations in this container.
+     *
+     * @return The operations in this container.
+     */
+    Iterable<PasswordPolicyStateOperation> getOperations();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java
index c6ebf3c..01ea4ff 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,297 +26,261 @@
 
 package com.forgerock.opendj.ldap.extensions;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Password policy state operation type.
  */
-public enum PasswordPolicyStateOperationType implements
-    PasswordPolicyStateOperation
-{
-  /**
-   * Get password policy DN operation.
-   */
-  GET_PASSWORD_POLICY_DN(
-      PasswordPolicyStateExtendedRequest.PASSWORD_POLICY_DN_NAME),
+public enum PasswordPolicyStateOperationType implements PasswordPolicyStateOperation {
+    /**
+     * Get password policy DN operation.
+     */
+    GET_PASSWORD_POLICY_DN(PasswordPolicyStateExtendedRequest.PASSWORD_POLICY_DN_NAME),
 
-  /**
-   * Get account disabled state operation.
-   */
-  GET_ACCOUNT_DISABLED_STATE(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
+    /**
+     * Get account disabled state operation.
+     */
+    GET_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
 
-  /**
-   * Set account disabled state operation.
-   */
-  SET_ACCOUNT_DISABLED_STATE(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
+    /**
+     * Set account disabled state operation.
+     */
+    SET_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
 
-  /**
-   * Clear account disabled state operation.
-   */
-  CLEAR_ACCOUNT_DISABLED_STATE(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
+    /**
+     * Clear account disabled state operation.
+     */
+    CLEAR_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME),
 
-  /**
-   * Get account expiration time operation.
-   */
-  GET_ACCOUNT_EXPIRATION_TIME(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
+    /**
+     * Get account expiration time operation.
+     */
+    GET_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
 
-  /**
-   * Set account expiration time operation.
-   */
-  SET_ACCOUNT_EXPIRATION_TIME(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
+    /**
+     * Set account expiration time operation.
+     */
+    SET_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
 
-  /**
-   * Clear account expiration time operation.
-   */
-  CLEAR_ACCOUNT_EXPIRATION_TIME(
-      PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
+    /**
+     * Clear account expiration time operation.
+     */
+    CLEAR_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME),
 
-  /**
-   * Get seconds until account expiration operation.
-   */
-  GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_ACCOUNT_EXPIRATION_NAME),
+    /**
+     * Get seconds until account expiration operation.
+     */
+    GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_ACCOUNT_EXPIRATION_NAME),
 
-  /**
-   * Get password changed time operation.
-   */
-  GET_PASSWORD_CHANGED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
+    /**
+     * Get password changed time operation.
+     */
+    GET_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
 
-  /**
-   * Set password changed time operation.
-   */
-  SET_PASSWORD_CHANGED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
+    /**
+     * Set password changed time operation.
+     */
+    SET_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
 
-  /**
-   * Clear password changed time operation.
-   */
-  CLEAR_PASSWORD_CHANGED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
+    /**
+     * Clear password changed time operation.
+     */
+    CLEAR_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME),
 
-  /**
-   * Get password expiration warned time operation.
-   */
-  GET_PASSWORD_EXPIRATION_WARNED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
+    /**
+     * Get password expiration warned time operation.
+     */
+    GET_PASSWORD_EXPIRATION_WARNED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
 
-  /**
-   * Set password expiration warned time operation.
-   */
-  SET_PASSWORD_EXPIRATION_WARNED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
+    /**
+     * Set password expiration warned time operation.
+     */
+    SET_PASSWORD_EXPIRATION_WARNED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
 
-  /**
-   * Clear password expiration warned time operation.
-   */
-  CLEAR_PASSWORD_EXPIRATION_WARNED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
+    /**
+     * Clear password expiration warned time operation.
+     */
+    CLEAR_PASSWORD_EXPIRATION_WARNED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME),
 
-  /**
-   * Get seconds until password expiration operation.
-   */
-  GET_SECONDS_UNTIL_PASSWORD_EXPIRATION(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_NAME),
+    /**
+     * Get seconds until password expiration operation.
+     */
+    GET_SECONDS_UNTIL_PASSWORD_EXPIRATION(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_NAME),
 
-  /**
-   * Get seconds until password expiration warning operation.
-   */
-  GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING_NAME),
+    /**
+     * Get seconds until password expiration warning operation.
+     */
+    GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING_NAME),
 
-  /**
-   * Get authentication failure times operation.
-   */
-  GET_AUTHENTICATION_FAILURE_TIMES(
-      PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
+    /**
+     * Get authentication failure times operation.
+     */
+    GET_AUTHENTICATION_FAILURE_TIMES(
+            PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
 
-  /**
-   * Add authentication failure times operation.
-   */
-  ADD_AUTHENTICATION_FAILURE_TIMES(
-      PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
+    /**
+     * Add authentication failure times operation.
+     */
+    ADD_AUTHENTICATION_FAILURE_TIMES(
+            PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
 
-  /**
-   * Set authentication failure times operation.
-   */
-  SET_AUTHENTICATION_FAILURE_TIMES(
-      PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
+    /**
+     * Set authentication failure times operation.
+     */
+    SET_AUTHENTICATION_FAILURE_TIMES(
+            PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
 
-  /**
-   * Clear authentication failure times operation.
-   */
-  CLEAR_AUTHENTICATION_FAILURE_TIMES(
-      PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
+    /**
+     * Clear authentication failure times operation.
+     */
+    CLEAR_AUTHENTICATION_FAILURE_TIMES(
+            PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME),
 
-  /**
-   * Get seconds until authentication failure unlock operation.
-   */
-  GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK_NAME),
+    /**
+     * Get seconds until authentication failure unlock operation.
+     */
+    GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK_NAME),
 
-  /**
-   * Get remaining authentication failure count operation.
-   */
-  GET_REMAINING_AUTHENTICATION_FAILURE_COUNT(
-      PasswordPolicyStateExtendedRequest.REMAINING_AUTHENTICATION_FAILURE_COUNT_NAME),
+    /**
+     * Get remaining authentication failure count operation.
+     */
+    GET_REMAINING_AUTHENTICATION_FAILURE_COUNT(
+            PasswordPolicyStateExtendedRequest.REMAINING_AUTHENTICATION_FAILURE_COUNT_NAME),
 
-  /**
-   * Get last login time operation.
-   */
-  GET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
+    /**
+     * Get last login time operation.
+     */
+    GET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
 
-  /**
-   * Set last login time operation.
-   */
-  SET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
+    /**
+     * Set last login time operation.
+     */
+    SET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
 
-  /**
-   * Clear last login time operation.
-   */
-  CLEAR_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
+    /**
+     * Clear last login time operation.
+     */
+    CLEAR_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME),
 
-  /**
-   * Get seconds until idle lockout operation.
-   */
-  GET_SECONDS_UNTIL_IDLE_LOCKOUT(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_IDLE_LOCKOUT_NAME),
+    /**
+     * Get seconds until idle lockout operation.
+     */
+    GET_SECONDS_UNTIL_IDLE_LOCKOUT(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_IDLE_LOCKOUT_NAME),
 
-  /**
-   * Get password reset state operation.
-   */
-  GET_PASSWORD_RESET_STATE(
-      PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
+    /**
+     * Get password reset state operation.
+     */
+    GET_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
 
-  /**
-   * Set password reset state operation.
-   */
-  SET_PASSWORD_RESET_STATE(
-      PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
+    /**
+     * Set password reset state operation.
+     */
+    SET_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
 
-  /**
-   * Clear password reset state operation.
-   */
-  CLEAR_PASSWORD_RESET_STATE(
-      PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
+    /**
+     * Clear password reset state operation.
+     */
+    CLEAR_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME),
 
-  /**
-   * Get seconds until password reset lockout operation.
-   */
-  GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT_NAME),
+    /**
+     * Get seconds until password reset lockout operation.
+     */
+    GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT_NAME),
 
-  /**
-   * Get grace login use times operation.
-   */
-  GET_GRACE_LOGIN_USE_TIMES(
-      PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
+    /**
+     * Get grace login use times operation.
+     */
+    GET_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
 
-  /**
-   * Add grace login use times operation.
-   */
-  ADD_GRACE_LOGIN_USE_TIME(
-      PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
+    /**
+     * Add grace login use times operation.
+     */
+    ADD_GRACE_LOGIN_USE_TIME(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
 
-  /**
-   * Set grace login use times operation.
-   */
-  SET_GRACE_LOGIN_USE_TIMES(
-      PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
+    /**
+     * Set grace login use times operation.
+     */
+    SET_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
 
-  /**
-   * Clear grace login use times operation.
-   */
-  CLEAR_GRACE_LOGIN_USE_TIMES(
-      PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
+    /**
+     * Clear grace login use times operation.
+     */
+    CLEAR_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME),
 
-  /**
-   * Get remaining grace login count operation.
-   */
-  GET_REMAINING_GRACE_LOGIN_COUNT(
-      PasswordPolicyStateExtendedRequest.REMAINING_GRACE_LOGIN_COUNT_NAME),
+    /**
+     * Get remaining grace login count operation.
+     */
+    GET_REMAINING_GRACE_LOGIN_COUNT(
+            PasswordPolicyStateExtendedRequest.REMAINING_GRACE_LOGIN_COUNT_NAME),
 
-  /**
-   * Get password changed by required time operation.
-   */
-  GET_PASSWORD_CHANGED_BY_REQUIRED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
+    /**
+     * Get password changed by required time operation.
+     */
+    GET_PASSWORD_CHANGED_BY_REQUIRED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
 
-  /**
-   * Set password changed by required time operation.
-   */
-  SET_PASSWORD_CHANGED_BY_REQUIRED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
+    /**
+     * Set password changed by required time operation.
+     */
+    SET_PASSWORD_CHANGED_BY_REQUIRED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
 
-  /**
-   * Clear password changed by required time operation.
-   */
-  CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME(
-      PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
+    /**
+     * Clear password changed by required time operation.
+     */
+    CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME(
+            PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME),
 
-  /**
-   * Get seconds until required change time operation.
-   */
-  GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME(
-      PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_REQUIRED_CHANGE_TIME_NAME),
+    /**
+     * Get seconds until required change time operation.
+     */
+    GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME(
+            PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_REQUIRED_CHANGE_TIME_NAME),
 
-  /**
-   * Get password history operation.
-   */
-  GET_PASSWORD_HISTORY(PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME),
+    /**
+     * Get password history operation.
+     */
+    GET_PASSWORD_HISTORY(PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME),
 
-  /**
-   * Clear password history operation.
-   */
-  CLEAR_PASSWORD_HISTORY(
-      PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME);
+    /**
+     * Clear password history operation.
+     */
+    CLEAR_PASSWORD_HISTORY(PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME);
 
-  private String propertyName;
+    private String propertyName;
 
+    private PasswordPolicyStateOperationType(final String propertyName) {
+        this.propertyName = propertyName;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordPolicyStateOperationType getOperationType() {
+        return this;
+    }
 
-  private PasswordPolicyStateOperationType(final String propertyName)
-  {
-    this.propertyName = propertyName;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<ByteString> getValues() {
+        return null;
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordPolicyStateOperationType getOperationType()
-  {
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<ByteString> getValues()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return propertyName;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return propertyName;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java
index 9e6a420..7bc9d56 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package com.forgerock.opendj.ldap.extensions;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/package-info.java
index f7d74f4..291d032 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package com.forgerock.opendj.ldap;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java
index 30b471d..cb5b6df 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 /**
  * A {@code ASCIICharProp} provides fast access to ASCII character properties.
  * In particular, the ability to query whether or not a character is a letter, a
@@ -39,376 +36,300 @@
  * The methods in this class do not perform memory allocations nor calculations
  * and so can be used safely in high performance situations.
  */
-public final class ASCIICharProp implements Comparable<ASCIICharProp>
-{
-  private final char c;
+public final class ASCIICharProp implements Comparable<ASCIICharProp> {
+    private final char c;
 
-  private final char upperCaseChar;
+    private final char upperCaseChar;
 
-  private final char lowerCaseChar;
+    private final char lowerCaseChar;
 
-  private final boolean isUpperCaseChar;
+    private final boolean isUpperCaseChar;
 
-  private final boolean isLowerCaseChar;
+    private final boolean isLowerCaseChar;
 
-  private final boolean isDigit;
+    private final boolean isDigit;
 
-  private final boolean isLetter;
+    private final boolean isLetter;
 
-  private final boolean isKeyChar;
+    private final boolean isKeyChar;
 
-  private final boolean isCompatKeyChar;
+    private final boolean isCompatKeyChar;
 
-  private final boolean isHexChar;
+    private final boolean isHexChar;
 
-  private final int hexValue;
+    private final int hexValue;
 
-  private final int decimalValue;
+    private final int decimalValue;
 
-  private final String stringValue;
+    private final String stringValue;
 
-  private static final ASCIICharProp[] CHAR_PROPS = new ASCIICharProp[128];
+    private static final ASCIICharProp[] CHAR_PROPS = new ASCIICharProp[128];
 
-  static
-  {
-    for (int i = 0; i < 128; i++)
-    {
-      CHAR_PROPS[i] = new ASCIICharProp((char) i);
+    static {
+        for (int i = 0; i < 128; i++) {
+            CHAR_PROPS[i] = new ASCIICharProp((char) i);
+        }
     }
-  }
 
-
-
-  /**
-   * Returns the character properties for the provided ASCII character. If a
-   * non-ASCII character is provided then this method returns {@code null}.
-   *
-   * @param c
-   *          The ASCII character.
-   * @return The character properties for the provided ASCII character, or
-   *         {@code null} if {@code c} is greater than {@code \u007F} .
-   */
-  public static ASCIICharProp valueOf(final char c)
-  {
-    if (c < 128)
-    {
-      return CHAR_PROPS[c];
+    /**
+     * Returns the character properties for the provided ASCII character. If a
+     * non-ASCII character is provided then this method returns {@code null}.
+     *
+     * @param c
+     *            The ASCII character.
+     * @return The character properties for the provided ASCII character, or
+     *         {@code null} if {@code c} is greater than {@code \u007F} .
+     */
+    public static ASCIICharProp valueOf(final char c) {
+        if (c < 128) {
+            return CHAR_PROPS[c];
+        } else {
+            return null;
+        }
     }
-    else
-    {
-      return null;
+
+    /**
+     * Returns the character properties for the provided ASCII character. If a
+     * non-ASCII character is provided then this method returns {@code null}.
+     *
+     * @param c
+     *            The ASCII character.
+     * @return The character properties for the provided ASCII character, or
+     *         {@code null} if {@code c} is less than zero or greater than
+     *         {@code \u007F} .
+     */
+    public static ASCIICharProp valueOf(final int c) {
+        if (c >= 0 && c < 128) {
+            return CHAR_PROPS[c];
+        } else {
+            return null;
+        }
     }
-  }
 
+    private ASCIICharProp(final char c) {
+        this.c = c;
+        this.stringValue = new String(new char[] { c });
 
-
-  /**
-   * Returns the character properties for the provided ASCII character. If a
-   * non-ASCII character is provided then this method returns {@code null}.
-   *
-   * @param c
-   *          The ASCII character.
-   * @return The character properties for the provided ASCII character, or
-   *         {@code null} if {@code c} is less than zero or greater than {@code
-   *         \u007F} .
-   */
-  public static ASCIICharProp valueOf(final int c)
-  {
-    if (c >= 0 && c < 128)
-    {
-      return CHAR_PROPS[c];
+        if (c >= 'a' && c <= 'z') {
+            this.upperCaseChar = (char) (c - 32);
+            this.lowerCaseChar = c;
+            this.isUpperCaseChar = false;
+            this.isLowerCaseChar = true;
+            this.isDigit = false;
+            this.isLetter = true;
+            this.isKeyChar = true;
+            this.isCompatKeyChar = true;
+            this.decimalValue = -1;
+            if (c >= 'a' && c <= 'f') {
+                this.isHexChar = true;
+                this.hexValue = c - 87;
+            } else {
+                this.isHexChar = false;
+                this.hexValue = -1;
+            }
+        } else if (c >= 'A' && c <= 'Z') {
+            this.upperCaseChar = c;
+            this.lowerCaseChar = (char) (c + 32);
+            this.isUpperCaseChar = true;
+            this.isLowerCaseChar = false;
+            this.isDigit = false;
+            this.isLetter = true;
+            this.isKeyChar = true;
+            this.isCompatKeyChar = true;
+            this.decimalValue = -1;
+            if (c >= 'A' && c <= 'F') {
+                this.isHexChar = true;
+                this.hexValue = c - 55;
+            } else {
+                this.isHexChar = false;
+                this.hexValue = -1;
+            }
+        } else if (c >= '0' && c <= '9') {
+            this.upperCaseChar = c;
+            this.lowerCaseChar = c;
+            this.isUpperCaseChar = false;
+            this.isLowerCaseChar = false;
+            this.isDigit = true;
+            this.isLetter = false;
+            this.isKeyChar = true;
+            this.isCompatKeyChar = true;
+            this.isHexChar = true;
+            this.hexValue = c - 48;
+            this.decimalValue = c - 48;
+        } else {
+            this.upperCaseChar = c;
+            this.lowerCaseChar = c;
+            this.isUpperCaseChar = false;
+            this.isLowerCaseChar = false;
+            this.isDigit = false;
+            this.isLetter = false;
+            this.isKeyChar = c == '-';
+            this.isCompatKeyChar = (c == '-') || (c == '.') || (c == '_');
+            this.isHexChar = false;
+            this.hexValue = -1;
+            this.decimalValue = -1;
+        }
     }
-    else
-    {
-      return null;
+
+    /**
+     * Returns the char value associated with this {@code ASCIICharProp}.
+     *
+     * @return The char value associated with this {@code ASCIICharProp}.
+     */
+    public char charValue() {
+        return c;
     }
-  }
 
-
-
-  private ASCIICharProp(final char c)
-  {
-    this.c = c;
-    this.stringValue = new String(new char[] { c });
-
-    if (c >= 'a' && c <= 'z')
-    {
-      this.upperCaseChar = (char) (c - 32);
-      this.lowerCaseChar = c;
-      this.isUpperCaseChar = false;
-      this.isLowerCaseChar = true;
-      this.isDigit = false;
-      this.isLetter = true;
-      this.isKeyChar = true;
-      this.isCompatKeyChar = true;
-      this.decimalValue = -1;
-      if (c >= 'a' && c <= 'f')
-      {
-        this.isHexChar = true;
-        this.hexValue = c - 87;
-      }
-      else
-      {
-        this.isHexChar = false;
-        this.hexValue = -1;
-      }
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final ASCIICharProp o) {
+        return c - o.c;
     }
-    else if (c >= 'A' && c <= 'Z')
-    {
-      this.upperCaseChar = c;
-      this.lowerCaseChar = (char) (c + 32);
-      this.isUpperCaseChar = true;
-      this.isLowerCaseChar = false;
-      this.isDigit = false;
-      this.isLetter = true;
-      this.isKeyChar = true;
-      this.isCompatKeyChar = true;
-      this.decimalValue = -1;
-      if (c >= 'A' && c <= 'F')
-      {
-        this.isHexChar = true;
-        this.hexValue = c - 55;
-      }
-      else
-      {
-        this.isHexChar = false;
-        this.hexValue = -1;
-      }
+
+    /**
+     * Returns the decimal value associated with this {@code ASCIICharProp}, or
+     * {@code -1} if the value is not a decimal digit.
+     *
+     * @return The decimal value associated with this {@code ASCIICharProp}, or
+     *         {@code -1} if the value is not a decimal digit.
+     */
+    public int decimalValue() {
+        return decimalValue;
     }
-    else if (c >= '0' && c <= '9')
-    {
-      this.upperCaseChar = c;
-      this.lowerCaseChar = c;
-      this.isUpperCaseChar = false;
-      this.isLowerCaseChar = false;
-      this.isDigit = true;
-      this.isLetter = false;
-      this.isKeyChar = true;
-      this.isCompatKeyChar = true;
-      this.isHexChar = true;
-      this.hexValue = c - 48;
-      this.decimalValue = c - 48;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        return this == obj;
     }
-    else
-    {
-      this.upperCaseChar = c;
-      this.lowerCaseChar = c;
-      this.isUpperCaseChar = false;
-      this.isLowerCaseChar = false;
-      this.isDigit = false;
-      this.isLetter = false;
-      this.isKeyChar = c == '-';
-      this.isCompatKeyChar = (c == '-') || (c == '.') || (c == '_');
-      this.isHexChar = false;
-      this.hexValue = -1;
-      this.decimalValue = -1;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return c;
     }
-  }
 
+    /**
+     * Returns the hexadecimal value associated with this {@code ASCIICharProp}
+     * , or {@code -1} if the value is not a hexadecimal digit.
+     *
+     * @return The hexadecimal value associated with this {@code ASCIICharProp}
+     *         , or {@code -1} if the value is not a hexadecimal digit.
+     */
+    public int hexValue() {
+        return hexValue;
+    }
 
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is a decimal digit.
+     *
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is a decimal digit.
+     */
+    public boolean isDigit() {
+        return isDigit;
+    }
 
-  /**
-   * Returns the char value associated with this {@code ASCIICharProp}.
-   *
-   * @return The char value associated with this {@code ASCIICharProp}.
-   */
-  public char charValue()
-  {
-    return c;
-  }
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is a hexadecimal digit.
+     *
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is a hexadecimal digit.
+     */
+    public boolean isHexDigit() {
+        return isHexChar;
+    }
 
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is a {@code keychar} as defined in RFC 4512. A
+     * {@code keychar} is a letter, a digit, or a hyphen. When
+     * {@code allowCompatChars} is {@code true} the following illegal characters
+     * will be permitted:
+     *
+     * <pre>
+     * USCORE  = %x5F ; underscore ("_")
+     * DOT     = %x2E ; period (".")
+     * </pre>
+     *
+     * @param allowCompatChars
+     *            {@code true} if certain illegal characters should be allowed
+     *            for compatibility reasons.
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is a {@code keychar}.
+     */
+    public boolean isKeyChar(final boolean allowCompatChars) {
+        return allowCompatChars ? isCompatKeyChar : isKeyChar;
+    }
 
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is a letter.
+     *
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is a letter.
+     */
+    public boolean isLetter() {
+        return isLetter;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final ASCIICharProp o)
-  {
-    return c - o.c;
-  }
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is a lower-case character.
+     *
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is a lower-case character.
+     */
+    public boolean isLowerCase() {
+        return isLowerCaseChar;
+    }
 
+    /**
+     * Indicates whether or not the char value associated with this
+     * {@code ASCIICharProp} is an upper-case character.
+     *
+     * @return {@code true} if the char value associated with this
+     *         {@code ASCIICharProp} is an upper-case character.
+     */
+    public boolean isUpperCase() {
+        return isUpperCaseChar;
+    }
 
+    /**
+     * Returns the lower-case char value associated with this
+     * {@code ASCIICharProp}.
+     *
+     * @return The lower-case char value associated with this
+     *         {@code ASCIICharProp}.
+     */
+    public char toLowerCase() {
+        return lowerCaseChar;
+    }
 
-  /**
-   * Returns the decimal value associated with this {@code ASCIICharProp}, or
-   * {@code -1} if the value is not a decimal digit.
-   *
-   * @return The decimal value associated with this {@code ASCIICharProp}, or
-   *         {@code -1} if the value is not a decimal digit.
-   */
-  public int decimalValue()
-  {
-    return decimalValue;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return stringValue;
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    return this == obj;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return c;
-  }
-
-
-
-  /**
-   * Returns the hexadecimal value associated with this {@code ASCIICharProp} ,
-   * or {@code -1} if the value is not a hexadecimal digit.
-   *
-   * @return The hexadecimal value associated with this {@code ASCIICharProp} ,
-   *         or {@code -1} if the value is not a hexadecimal digit.
-   */
-  public int hexValue()
-  {
-    return hexValue;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this {@code
-   * ASCIICharProp} is a decimal digit.
-   *
-   * @return {@code true} if the char value associated with this {@code
-   *         ASCIICharProp} is a decimal digit.
-   */
-  public boolean isDigit()
-  {
-    return isDigit;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this {@code
-   * ASCIICharProp} is a hexadecimal digit.
-   *
-   * @return {@code true} if the char value associated with this {@code
-   *         ASCIICharProp} is a hexadecimal digit.
-   */
-  public boolean isHexDigit()
-  {
-    return isHexChar;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this
-   * {@code ASCIICharProp} is a {@code keychar} as defined in RFC 4512. A
-   * {@code keychar} is a letter, a digit, or a hyphen. When
-   * {@code allowCompatChars} is {@code true} the following illegal characters
-   * will be permitted:
-   *
-   * <pre>
-   * USCORE  = %x5F ; underscore ("_")
-   * DOT     = %x2E ; period (".")
-   * </pre>
-   *
-   * @param allowCompatChars
-   *          {@code true} if certain illegal characters should be allowed for
-   *          compatibility reasons.
-   * @return {@code true} if the char value associated with this
-   *         {@code ASCIICharProp} is a {@code keychar}.
-   */
-  public boolean isKeyChar(final boolean allowCompatChars)
-  {
-    return allowCompatChars ? isCompatKeyChar : isKeyChar;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this {@code
-   * ASCIICharProp} is a letter.
-   *
-   * @return {@code true} if the char value associated with this {@code
-   *         ASCIICharProp} is a letter.
-   */
-  public boolean isLetter()
-  {
-    return isLetter;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this {@code
-   * ASCIICharProp} is a lower-case character.
-   *
-   * @return {@code true} if the char value associated with this {@code
-   *         ASCIICharProp} is a lower-case character.
-   */
-  public boolean isLowerCase()
-  {
-    return isLowerCaseChar;
-  }
-
-
-
-  /**
-   * Indicates whether or not the char value associated with this {@code
-   * ASCIICharProp} is an upper-case character.
-   *
-   * @return {@code true} if the char value associated with this {@code
-   *         ASCIICharProp} is an upper-case character.
-   */
-  public boolean isUpperCase()
-  {
-    return isUpperCaseChar;
-  }
-
-
-
-  /**
-   * Returns the lower-case char value associated with this {@code
-   * ASCIICharProp}.
-   *
-   * @return The lower-case char value associated with this {@code
-   *         ASCIICharProp}.
-   */
-  public char toLowerCase()
-  {
-    return lowerCaseChar;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return stringValue;
-  }
-
-
-
-  /**
-   * Returns the upper-case char value associated with this {@code
-   * ASCIICharProp}.
-   *
-   * @return The upper-case char value associated with this {@code
-   *         ASCIICharProp}.
-   */
-  public char toUpperCase()
-  {
-    return upperCaseChar;
-  }
+    /**
+     * Returns the upper-case char value associated with this
+     * {@code ASCIICharProp}.
+     *
+     * @return The upper-case char value associated with this
+     *         {@code ASCIICharProp}.
+     */
+    public char toUpperCase() {
+        return upperCaseChar;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/AsynchronousFutureResult.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/AsynchronousFutureResult.java
index c1fd084..370a27d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/AsynchronousFutureResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/AsynchronousFutureResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,17 +26,17 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.locks.AbstractQueuedSynchronizer;
 
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.CancelledResultException;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
 
 /**
  * This class provides a skeletal implementation of the {@code FutureResult}
@@ -64,418 +63,315 @@
  * </ul>
  *
  * @param <M>
- *          The type of result returned by this completion future.
+ *            The type of result returned by this completion future.
  */
-public class AsynchronousFutureResult<M> implements FutureResult<M>,
-    ResultHandler<M>
-{
-  @SuppressWarnings("serial")
-  private final class Sync extends AbstractQueuedSynchronizer
-  {
-    // State value representing the initial state before a result has
-    // been received.
-    private static final int WAITING = 0;
+public class AsynchronousFutureResult<M> implements FutureResult<M>, ResultHandler<M> {
+    @SuppressWarnings("serial")
+    private final class Sync extends AbstractQueuedSynchronizer {
+        // State value representing the initial state before a result has
+        // been received.
+        private static final int WAITING = 0;
 
-    // State value representing that a result has been received and is
-    // being processed.
-    private static final int PENDING = 1;
+        // State value representing that a result has been received and is
+        // being processed.
+        private static final int PENDING = 1;
 
-    // State value representing that the request was cancelled.
-    private static final int CANCELLED = 2;
+        // State value representing that the request was cancelled.
+        private static final int CANCELLED = 2;
 
-    // State value representing that the request has failed.
-    private static final int FAIL = 3;
+        // State value representing that the request has failed.
+        private static final int FAIL = 3;
 
-    // State value representing that the request has succeeded.
-    private static final int SUCCESS = 4;
+        // State value representing that the request has succeeded.
+        private static final int SUCCESS = 4;
 
-    // These do not need to be volatile since their values are published
-    // by updating the state after they are set and reading the state
-    // immediately before they are read.
-    private ErrorResultException errorResult = null;
+        // These do not need to be volatile since their values are published
+        // by updating the state after they are set and reading the state
+        // immediately before they are read.
+        private ErrorResultException errorResult = null;
 
-    private M result = null;
+        private M result = null;
 
+        /**
+         * Allow all threads to acquire if future has completed.
+         */
+        @Override
+        protected int tryAcquireShared(final int ignore) {
+            return innerIsDone() ? 1 : -1;
+        }
 
+        /**
+         * Signal that the future has completed and threads waiting on get() can
+         * be released.
+         */
+        @Override
+        protected boolean tryReleaseShared(final int finalState) {
+            // Ensures that errorResult/result is published.
+            setState(finalState);
+            return true;
+        }
+
+        boolean innerCancel(final boolean mayInterruptIfRunning) {
+            if (!isCancelable() || !setStatePending()) {
+                return false;
+            }
+
+            // Perform implementation defined cancellation.
+            ErrorResultException errorResult = handleCancelRequest(mayInterruptIfRunning);
+            if (errorResult == null) {
+                errorResult = newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
+            }
+            this.errorResult = errorResult;
+
+            try {
+                // Invoke error result completion handler.
+                if (handler != null) {
+                    handler.handleErrorResult(errorResult);
+                }
+            } finally {
+                releaseShared(CANCELLED); // Publishes errorResult.
+            }
+
+            return true;
+        }
+
+        M innerGet() throws ErrorResultException, InterruptedException {
+            acquireSharedInterruptibly(0);
+            return get0();
+        }
+
+        M innerGet(final long nanosTimeout) throws ErrorResultException, TimeoutException,
+                InterruptedException {
+            if (!tryAcquireSharedNanos(0, nanosTimeout)) {
+                throw new TimeoutException();
+            } else {
+                return get0();
+            }
+        }
+
+        boolean innerIsCancelled() {
+            return getState() == CANCELLED;
+        }
+
+        boolean innerIsDone() {
+            return getState() > 1;
+        }
+
+        void innerSetErrorResult(final ErrorResultException errorResult) {
+            if (setStatePending()) {
+                this.errorResult = errorResult;
+
+                try {
+                    // Invoke error result completion handler.
+                    if (handler != null) {
+                        handler.handleErrorResult(errorResult);
+                    }
+                } finally {
+                    releaseShared(FAIL); // Publishes errorResult.
+                }
+            }
+        }
+
+        void innerSetResult(final M result) {
+            if (setStatePending()) {
+                this.result = result;
+
+                try {
+                    // Invoke result completion handler.
+                    if (handler != null) {
+                        handler.handleResult(result);
+                    }
+                } finally {
+                    releaseShared(SUCCESS); // Publishes result.
+                }
+            }
+        }
+
+        private M get0() throws ErrorResultException {
+            if (errorResult != null) {
+                // State must be FAILED or CANCELLED.
+                throw errorResult;
+            } else {
+                // State must be SUCCESS.
+                return result;
+            }
+        }
+
+        private boolean setStatePending() {
+            for (;;) {
+                final int s = getState();
+                if (s != WAITING) {
+                    return false;
+                }
+                if (compareAndSetState(s, PENDING)) {
+                    return true;
+                }
+            }
+        }
+    }
+
+    private final Sync sync = new Sync();
+
+    private final ResultHandler<? super M> handler;
+
+    private final int requestID;
 
     /**
-     * Allow all threads to acquire if future has completed.
+     * Creates a new asynchronous future result with the provided result handler
+     * and a request ID of -1.
+     *
+     * @param handler
+     *            A result handler which will be forwarded the result or error
+     *            when it arrives, may be {@code null}.
      */
-    @Override
-    protected int tryAcquireShared(final int ignore)
-    {
-      return innerIsDone() ? 1 : -1;
+    public AsynchronousFutureResult(final ResultHandler<? super M> handler) {
+        this(handler, -1);
     }
 
-
-
     /**
-     * Signal that the future has completed and threads waiting on get() can be
-     * released.
+     * Creates a new asynchronous future result with the provided result handler
+     * and request ID.
+     *
+     * @param handler
+     *            A result handler which will be forwarded the result or error
+     *            when it arrives, may be {@code null}.
+     * @param requestID
+     *            The request ID which will be returned by the default
+     *            implementation of {@link #getRequestID}.
+     */
+    public AsynchronousFutureResult(final ResultHandler<? super M> handler, final int requestID) {
+        this.handler = handler;
+        this.requestID = requestID;
+    }
+
+    /**
+     * {@inheritDoc}
      */
     @Override
-    protected boolean tryReleaseShared(final int finalState)
-    {
-      // Ensures that errorResult/result is published.
-      setState(finalState);
-      return true;
+    public final boolean cancel(final boolean mayInterruptIfRunning) {
+        return sync.innerCancel(mayInterruptIfRunning);
     }
 
-
-
-    boolean innerCancel(final boolean mayInterruptIfRunning)
-    {
-      if (!isCancelable() || !setStatePending())
-      {
-        return false;
-      }
-
-      // Perform implementation defined cancellation.
-      ErrorResultException errorResult = handleCancelRequest(mayInterruptIfRunning);
-      if (errorResult == null)
-      {
-        errorResult = newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
-      }
-      this.errorResult = errorResult;
-
-      try
-      {
-        // Invoke error result completion handler.
-        if (handler != null)
-        {
-          handler.handleErrorResult(errorResult);
-        }
-      }
-      finally
-      {
-        releaseShared(CANCELLED); // Publishes errorResult.
-      }
-
-      return true;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final M get() throws ErrorResultException, InterruptedException {
+        return sync.innerGet();
     }
 
-
-
-    M innerGet() throws ErrorResultException, InterruptedException
-    {
-      acquireSharedInterruptibly(0);
-      return get0();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final M get(final long timeout, final TimeUnit unit) throws ErrorResultException,
+            TimeoutException, InterruptedException {
+        return sync.innerGet(unit.toNanos(timeout));
     }
 
-
-
-    M innerGet(final long nanosTimeout) throws ErrorResultException,
-        TimeoutException, InterruptedException
-    {
-      if (!tryAcquireSharedNanos(0, nanosTimeout))
-      {
-        throw new TimeoutException();
-      }
-      else
-      {
-        return get0();
-      }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation returns the request ID passed in during
+     * construction, or -1 if none was provided.
+     */
+    @Override
+    public int getRequestID() {
+        return requestID;
     }
 
-
-
-    boolean innerIsCancelled()
-    {
-      return getState() == CANCELLED;
+    /**
+     * Sets the error result associated with this future. If ({@code isDone() ==
+     * true}) then the error result will be ignored, otherwise the result
+     * handler will be invoked if one was provided and, on return, any threads
+     * waiting on {@link #get} will be released and the provided error result
+     * will be thrown.
+     *
+     * @param errorResult
+     *            The error result.
+     */
+    @Override
+    public final void handleErrorResult(final ErrorResultException errorResult) {
+        sync.innerSetErrorResult(errorResult);
     }
 
-
-
-    boolean innerIsDone()
-    {
-      return getState() > 1;
+    /**
+     * Sets the result associated with this future. If ({@code isDone() == true}
+     * ) then the result will be ignored, otherwise the result handler will be
+     * invoked if one was provided and, on return, any threads waiting on
+     * {@link #get} will be released and the provided result will be returned.
+     *
+     * @param result
+     *            The result.
+     */
+    @Override
+    public final void handleResult(final M result) {
+        sync.innerSetResult(result);
     }
 
-
-
-    void innerSetErrorResult(final ErrorResultException errorResult)
-    {
-      if (setStatePending())
-      {
-        this.errorResult = errorResult;
-
-        try
-        {
-          // Invoke error result completion handler.
-          if (handler != null)
-          {
-            handler.handleErrorResult(errorResult);
-          }
-        }
-        finally
-        {
-          releaseShared(FAIL); // Publishes errorResult.
-        }
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final boolean isCancelled() {
+        return sync.innerIsCancelled();
     }
 
-
-
-    void innerSetResult(final M result)
-    {
-      if (setStatePending())
-      {
-        this.result = result;
-
-        try
-        {
-          // Invoke result completion handler.
-          if (handler != null)
-          {
-            handler.handleResult(result);
-          }
-        }
-        finally
-        {
-          releaseShared(SUCCESS); // Publishes result.
-        }
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final boolean isDone() {
+        return sync.innerIsDone();
     }
 
-
-
-    private M get0() throws ErrorResultException
-    {
-      if (errorResult != null)
-      {
-        // State must be FAILED or CANCELLED.
-        throw errorResult;
-      }
-      else
-      {
-        // State must be SUCCESS.
-        return result;
-      }
+    /**
+     * Invoked when {@link #cancel} is called and {@code isDone() == false} and
+     * immediately before any threads waiting on {@link #get} are released.
+     * Implementations may choose to return a custom error result if needed or
+     * return {@code null} if the following default error result is acceptable:
+     *
+     * <pre>
+     * Result result = Responses.newResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
+     * </pre>
+     *
+     * In addition, implementations may perform other cleanup, for example, by
+     * issuing an LDAP abandon request. The default implementation is to do
+     * nothing.
+     *
+     * @param mayInterruptIfRunning
+     *            {@code true} if the thread executing executing the response
+     *            handler should be interrupted; otherwise, in-progress response
+     *            handlers are allowed to complete.
+     * @return The custom error result, or {@code null} if the default is
+     *         acceptable.
+     */
+    protected ErrorResultException handleCancelRequest(final boolean mayInterruptIfRunning) {
+        // Do nothing by default.
+        return null;
     }
 
-
-
-    private boolean setStatePending()
-    {
-      for (;;)
-      {
-        final int s = getState();
-        if (s != WAITING)
-        {
-          return false;
-        }
-        if (compareAndSetState(s, PENDING))
-        {
-          return true;
-        }
-      }
+    /**
+     * Indicates whether this future result can be canceled.
+     *
+     * @return {@code true} if this future result is cancelable or {@code false}
+     *         otherwise.
+     */
+    protected boolean isCancelable() {
+        // Return true by default.
+        return true;
     }
-  }
 
-
-
-  private final Sync sync = new Sync();
-
-  private final ResultHandler<? super M> handler;
-
-  private final int requestID;
-
-
-
-  /**
-   * Creates a new asynchronous future result with the provided result handler
-   * and a request ID of -1.
-   *
-   * @param handler
-   *          A result handler which will be forwarded the result or error when
-   *          it arrives, may be {@code null}.
-   */
-  public AsynchronousFutureResult(final ResultHandler<? super M> handler)
-  {
-    this(handler, -1);
-  }
-
-
-
-  /**
-   * Creates a new asynchronous future result with the provided result handler
-   * and request ID.
-   *
-   * @param handler
-   *          A result handler which will be forwarded the result or error when
-   *          it arrives, may be {@code null}.
-   * @param requestID
-   *          The request ID which will be returned by the default
-   *          implementation of {@link #getRequestID}.
-   */
-  public AsynchronousFutureResult(final ResultHandler<? super M> handler,
-      final int requestID)
-  {
-    this.handler = handler;
-    this.requestID = requestID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final boolean cancel(final boolean mayInterruptIfRunning)
-  {
-    return sync.innerCancel(mayInterruptIfRunning);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final M get() throws ErrorResultException, InterruptedException
-  {
-    return sync.innerGet();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final M get(final long timeout, final TimeUnit unit)
-      throws ErrorResultException, TimeoutException, InterruptedException
-  {
-    return sync.innerGet(unit.toNanos(timeout));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation returns the request ID passed in during
-   * construction, or -1 if none was provided.
-   */
-  @Override
-  public int getRequestID()
-  {
-    return requestID;
-  }
-
-
-
-  /**
-   * Sets the error result associated with this future. If ({@code isDone() ==
-   * true}) then the error result will be ignored, otherwise the result handler
-   * will be invoked if one was provided and, on return, any threads waiting on
-   * {@link #get} will be released and the provided error result will be thrown.
-   *
-   * @param errorResult
-   *          The error result.
-   */
-  @Override
-  public final void handleErrorResult(final ErrorResultException errorResult)
-  {
-    sync.innerSetErrorResult(errorResult);
-  }
-
-
-
-  /**
-   * Sets the result associated with this future. If ({@code isDone() == true})
-   * then the result will be ignored, otherwise the result handler will be
-   * invoked if one was provided and, on return, any threads waiting on
-   * {@link #get} will be released and the provided result will be returned.
-   *
-   * @param result
-   *          The result.
-   */
-  @Override
-  public final void handleResult(final M result)
-  {
-    sync.innerSetResult(result);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final boolean isCancelled()
-  {
-    return sync.innerIsCancelled();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final boolean isDone()
-  {
-    return sync.innerIsDone();
-  }
-
-
-
-  /**
-   * Invoked when {@link #cancel} is called and {@code isDone() == false} and
-   * immediately before any threads waiting on {@link #get} are released.
-   * Implementations may choose to return a custom error result if needed or
-   * return {@code null} if the following default error result is acceptable:
-   *
-   * <pre>
-   * Result result = Responses.newResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
-   * </pre>
-   *
-   * In addition, implementations may perform other cleanup, for example, by
-   * issuing an LDAP abandon request. The default implementation is to do
-   * nothing.
-   *
-   * @param mayInterruptIfRunning
-   *          {@code true} if the thread executing executing the response
-   *          handler should be interrupted; otherwise, in-progress response
-   *          handlers are allowed to complete.
-   * @return The custom error result, or {@code null} if the default is
-   *         acceptable.
-   */
-  protected ErrorResultException handleCancelRequest(
-      final boolean mayInterruptIfRunning)
-  {
-    // Do nothing by default.
-    return null;
-  }
-
-
-
-  /**
-   * Indicates whether this future result can be canceled.
-   *
-   * @return {@code true} if this future result is cancelable or {@code false}
-   *         otherwise.
-   */
-  protected boolean isCancelable()
-  {
-    // Return true by default.
-    return true;
-  }
-
-
-
-  /**
-   * Appends a string representation of this future's state to the provided
-   * builder.
-   *
-   * @param sb
-   *          The string builder.
-   */
-  protected void toString(final StringBuilder sb)
-  {
-    sb.append(" state = ");
-    sb.append(sync);
-  }
+    /**
+     * Appends a string representation of this future's state to the provided
+     * builder.
+     *
+     * @param sb
+     *            The string builder.
+     */
+    protected void toString(final StringBuilder sb) {
+        sb.append(" state = ");
+        sb.append(sync);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Base64.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Base64.java
index 71f0e64..c2f7ec3 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Base64.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Base64.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package com.forgerock.opendj.util;
 
-
-
 import static com.forgerock.opendj.util.Validator.ensureNotNull;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_BASE64_DECODE_INVALID_CHARACTER;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_BASE64_DECODE_INVALID_LENGTH;
@@ -39,348 +36,325 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 
-
-
 /**
  * This class provides methods for performing base64 encoding and decoding.
  * Base64 is a mechanism for encoding binary data in ASCII form by converting
  * sets of three bytes with eight significant bits each to sets of four bytes
  * with six significant bits each.
  */
-public final class Base64
-{
-  /**
-   * The set of characters that may be used in base64-encoded values.
-   */
-  private static final char[] BASE64_ALPHABET = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-      + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/").toCharArray();
+public final class Base64 {
+    /**
+     * The set of characters that may be used in base64-encoded values.
+     */
+    private static final char[] BASE64_ALPHABET = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/").toCharArray();
 
+    /**
+     * Decodes the provided base64 encoded data.
+     *
+     * @param base64
+     *            The base64 encoded data.
+     * @return The decoded data.
+     * @throws LocalizedIllegalArgumentException
+     *             If a problem occurs while attempting to decode {@code base64}
+     *             .
+     * @throws NullPointerException
+     *             If {@code base64} was {@code null}.
+     */
+    public static ByteString decode(final String base64) {
+        ensureNotNull(base64);
 
-
-  /**
-   * Decodes the provided base64 encoded data.
-   *
-   * @param base64
-   *          The base64 encoded data.
-   * @return The decoded data.
-   * @throws LocalizedIllegalArgumentException
-   *           If a problem occurs while attempting to decode {@code base64}.
-   * @throws NullPointerException
-   *           If {@code base64} was {@code null}.
-   */
-  public static ByteString decode(final String base64)
-  {
-    ensureNotNull(base64);
-
-    // The encoded value must have length that is a multiple of four
-    // bytes.
-    final int length = base64.length();
-    if ((length % 4) != 0)
-    {
-      final LocalizableMessage message = ERR_BASE64_DECODE_INVALID_LENGTH
-          .get(base64);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    final ByteStringBuilder builder = new ByteStringBuilder(length);
-    for (int i = 0; i < length; i += 4)
-    {
-      boolean append = true;
-      int value = 0;
-
-      for (int j = 0; j < 4; j++)
-      {
-        switch (base64.charAt(i + j))
-        {
-        case 'A':
-          value <<= 6;
-          break;
-        case 'B':
-          value = (value << 6) | 0x01;
-          break;
-        case 'C':
-          value = (value << 6) | 0x02;
-          break;
-        case 'D':
-          value = (value << 6) | 0x03;
-          break;
-        case 'E':
-          value = (value << 6) | 0x04;
-          break;
-        case 'F':
-          value = (value << 6) | 0x05;
-          break;
-        case 'G':
-          value = (value << 6) | 0x06;
-          break;
-        case 'H':
-          value = (value << 6) | 0x07;
-          break;
-        case 'I':
-          value = (value << 6) | 0x08;
-          break;
-        case 'J':
-          value = (value << 6) | 0x09;
-          break;
-        case 'K':
-          value = (value << 6) | 0x0A;
-          break;
-        case 'L':
-          value = (value << 6) | 0x0B;
-          break;
-        case 'M':
-          value = (value << 6) | 0x0C;
-          break;
-        case 'N':
-          value = (value << 6) | 0x0D;
-          break;
-        case 'O':
-          value = (value << 6) | 0x0E;
-          break;
-        case 'P':
-          value = (value << 6) | 0x0F;
-          break;
-        case 'Q':
-          value = (value << 6) | 0x10;
-          break;
-        case 'R':
-          value = (value << 6) | 0x11;
-          break;
-        case 'S':
-          value = (value << 6) | 0x12;
-          break;
-        case 'T':
-          value = (value << 6) | 0x13;
-          break;
-        case 'U':
-          value = (value << 6) | 0x14;
-          break;
-        case 'V':
-          value = (value << 6) | 0x15;
-          break;
-        case 'W':
-          value = (value << 6) | 0x16;
-          break;
-        case 'X':
-          value = (value << 6) | 0x17;
-          break;
-        case 'Y':
-          value = (value << 6) | 0x18;
-          break;
-        case 'Z':
-          value = (value << 6) | 0x19;
-          break;
-        case 'a':
-          value = (value << 6) | 0x1A;
-          break;
-        case 'b':
-          value = (value << 6) | 0x1B;
-          break;
-        case 'c':
-          value = (value << 6) | 0x1C;
-          break;
-        case 'd':
-          value = (value << 6) | 0x1D;
-          break;
-        case 'e':
-          value = (value << 6) | 0x1E;
-          break;
-        case 'f':
-          value = (value << 6) | 0x1F;
-          break;
-        case 'g':
-          value = (value << 6) | 0x20;
-          break;
-        case 'h':
-          value = (value << 6) | 0x21;
-          break;
-        case 'i':
-          value = (value << 6) | 0x22;
-          break;
-        case 'j':
-          value = (value << 6) | 0x23;
-          break;
-        case 'k':
-          value = (value << 6) | 0x24;
-          break;
-        case 'l':
-          value = (value << 6) | 0x25;
-          break;
-        case 'm':
-          value = (value << 6) | 0x26;
-          break;
-        case 'n':
-          value = (value << 6) | 0x27;
-          break;
-        case 'o':
-          value = (value << 6) | 0x28;
-          break;
-        case 'p':
-          value = (value << 6) | 0x29;
-          break;
-        case 'q':
-          value = (value << 6) | 0x2A;
-          break;
-        case 'r':
-          value = (value << 6) | 0x2B;
-          break;
-        case 's':
-          value = (value << 6) | 0x2C;
-          break;
-        case 't':
-          value = (value << 6) | 0x2D;
-          break;
-        case 'u':
-          value = (value << 6) | 0x2E;
-          break;
-        case 'v':
-          value = (value << 6) | 0x2F;
-          break;
-        case 'w':
-          value = (value << 6) | 0x30;
-          break;
-        case 'x':
-          value = (value << 6) | 0x31;
-          break;
-        case 'y':
-          value = (value << 6) | 0x32;
-          break;
-        case 'z':
-          value = (value << 6) | 0x33;
-          break;
-        case '0':
-          value = (value << 6) | 0x34;
-          break;
-        case '1':
-          value = (value << 6) | 0x35;
-          break;
-        case '2':
-          value = (value << 6) | 0x36;
-          break;
-        case '3':
-          value = (value << 6) | 0x37;
-          break;
-        case '4':
-          value = (value << 6) | 0x38;
-          break;
-        case '5':
-          value = (value << 6) | 0x39;
-          break;
-        case '6':
-          value = (value << 6) | 0x3A;
-          break;
-        case '7':
-          value = (value << 6) | 0x3B;
-          break;
-        case '8':
-          value = (value << 6) | 0x3C;
-          break;
-        case '9':
-          value = (value << 6) | 0x3D;
-          break;
-        case '+':
-          value = (value << 6) | 0x3E;
-          break;
-        case '/':
-          value = (value << 6) | 0x3F;
-          break;
-        case '=':
-          append = false;
-          switch (j)
-          {
-          case 2:
-            builder.append((byte) ((value >>> 4) & 0xFF));
-            break;
-          case 3:
-            builder.append((byte) ((value >>> 10) & 0xFF));
-            builder.append((byte) ((value >>> 2) & 0xFF));
-            break;
-          }
-          break;
-        default:
-          final LocalizableMessage message = ERR_BASE64_DECODE_INVALID_CHARACTER
-              .get(base64, base64.charAt(i + j));
-          throw new LocalizedIllegalArgumentException(message);
+        // The encoded value must have length that is a multiple of four
+        // bytes.
+        final int length = base64.length();
+        if ((length % 4) != 0) {
+            final LocalizableMessage message = ERR_BASE64_DECODE_INVALID_LENGTH.get(base64);
+            throw new LocalizedIllegalArgumentException(message);
         }
 
-        if (!append)
-        {
-          break;
+        final ByteStringBuilder builder = new ByteStringBuilder(length);
+        for (int i = 0; i < length; i += 4) {
+            boolean append = true;
+            int value = 0;
+
+            for (int j = 0; j < 4; j++) {
+                switch (base64.charAt(i + j)) {
+                case 'A':
+                    value <<= 6;
+                    break;
+                case 'B':
+                    value = (value << 6) | 0x01;
+                    break;
+                case 'C':
+                    value = (value << 6) | 0x02;
+                    break;
+                case 'D':
+                    value = (value << 6) | 0x03;
+                    break;
+                case 'E':
+                    value = (value << 6) | 0x04;
+                    break;
+                case 'F':
+                    value = (value << 6) | 0x05;
+                    break;
+                case 'G':
+                    value = (value << 6) | 0x06;
+                    break;
+                case 'H':
+                    value = (value << 6) | 0x07;
+                    break;
+                case 'I':
+                    value = (value << 6) | 0x08;
+                    break;
+                case 'J':
+                    value = (value << 6) | 0x09;
+                    break;
+                case 'K':
+                    value = (value << 6) | 0x0A;
+                    break;
+                case 'L':
+                    value = (value << 6) | 0x0B;
+                    break;
+                case 'M':
+                    value = (value << 6) | 0x0C;
+                    break;
+                case 'N':
+                    value = (value << 6) | 0x0D;
+                    break;
+                case 'O':
+                    value = (value << 6) | 0x0E;
+                    break;
+                case 'P':
+                    value = (value << 6) | 0x0F;
+                    break;
+                case 'Q':
+                    value = (value << 6) | 0x10;
+                    break;
+                case 'R':
+                    value = (value << 6) | 0x11;
+                    break;
+                case 'S':
+                    value = (value << 6) | 0x12;
+                    break;
+                case 'T':
+                    value = (value << 6) | 0x13;
+                    break;
+                case 'U':
+                    value = (value << 6) | 0x14;
+                    break;
+                case 'V':
+                    value = (value << 6) | 0x15;
+                    break;
+                case 'W':
+                    value = (value << 6) | 0x16;
+                    break;
+                case 'X':
+                    value = (value << 6) | 0x17;
+                    break;
+                case 'Y':
+                    value = (value << 6) | 0x18;
+                    break;
+                case 'Z':
+                    value = (value << 6) | 0x19;
+                    break;
+                case 'a':
+                    value = (value << 6) | 0x1A;
+                    break;
+                case 'b':
+                    value = (value << 6) | 0x1B;
+                    break;
+                case 'c':
+                    value = (value << 6) | 0x1C;
+                    break;
+                case 'd':
+                    value = (value << 6) | 0x1D;
+                    break;
+                case 'e':
+                    value = (value << 6) | 0x1E;
+                    break;
+                case 'f':
+                    value = (value << 6) | 0x1F;
+                    break;
+                case 'g':
+                    value = (value << 6) | 0x20;
+                    break;
+                case 'h':
+                    value = (value << 6) | 0x21;
+                    break;
+                case 'i':
+                    value = (value << 6) | 0x22;
+                    break;
+                case 'j':
+                    value = (value << 6) | 0x23;
+                    break;
+                case 'k':
+                    value = (value << 6) | 0x24;
+                    break;
+                case 'l':
+                    value = (value << 6) | 0x25;
+                    break;
+                case 'm':
+                    value = (value << 6) | 0x26;
+                    break;
+                case 'n':
+                    value = (value << 6) | 0x27;
+                    break;
+                case 'o':
+                    value = (value << 6) | 0x28;
+                    break;
+                case 'p':
+                    value = (value << 6) | 0x29;
+                    break;
+                case 'q':
+                    value = (value << 6) | 0x2A;
+                    break;
+                case 'r':
+                    value = (value << 6) | 0x2B;
+                    break;
+                case 's':
+                    value = (value << 6) | 0x2C;
+                    break;
+                case 't':
+                    value = (value << 6) | 0x2D;
+                    break;
+                case 'u':
+                    value = (value << 6) | 0x2E;
+                    break;
+                case 'v':
+                    value = (value << 6) | 0x2F;
+                    break;
+                case 'w':
+                    value = (value << 6) | 0x30;
+                    break;
+                case 'x':
+                    value = (value << 6) | 0x31;
+                    break;
+                case 'y':
+                    value = (value << 6) | 0x32;
+                    break;
+                case 'z':
+                    value = (value << 6) | 0x33;
+                    break;
+                case '0':
+                    value = (value << 6) | 0x34;
+                    break;
+                case '1':
+                    value = (value << 6) | 0x35;
+                    break;
+                case '2':
+                    value = (value << 6) | 0x36;
+                    break;
+                case '3':
+                    value = (value << 6) | 0x37;
+                    break;
+                case '4':
+                    value = (value << 6) | 0x38;
+                    break;
+                case '5':
+                    value = (value << 6) | 0x39;
+                    break;
+                case '6':
+                    value = (value << 6) | 0x3A;
+                    break;
+                case '7':
+                    value = (value << 6) | 0x3B;
+                    break;
+                case '8':
+                    value = (value << 6) | 0x3C;
+                    break;
+                case '9':
+                    value = (value << 6) | 0x3D;
+                    break;
+                case '+':
+                    value = (value << 6) | 0x3E;
+                    break;
+                case '/':
+                    value = (value << 6) | 0x3F;
+                    break;
+                case '=':
+                    append = false;
+                    switch (j) {
+                    case 2:
+                        builder.append((byte) ((value >>> 4) & 0xFF));
+                        break;
+                    case 3:
+                        builder.append((byte) ((value >>> 10) & 0xFF));
+                        builder.append((byte) ((value >>> 2) & 0xFF));
+                        break;
+                    }
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            ERR_BASE64_DECODE_INVALID_CHARACTER.get(base64, base64.charAt(i + j));
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                if (!append) {
+                    break;
+                }
+            }
+
+            if (append) {
+                builder.append((byte) ((value >>> 16) & 0xFF));
+                builder.append((byte) ((value >>> 8) & 0xFF));
+                builder.append((byte) (value & 0xFF));
+            } else {
+                break;
+            }
         }
-      }
 
-      if (append)
-      {
-        builder.append((byte) ((value >>> 16) & 0xFF));
-        builder.append((byte) ((value >>> 8) & 0xFF));
-        builder.append((byte) (value & 0xFF));
-      }
-      else
-      {
-        break;
-      }
+        return builder.toByteString();
     }
 
-    return builder.toByteString();
-  }
+    /**
+     * Encodes the provided data as a base64 string.
+     *
+     * @param bytes
+     *            The data to be encoded.
+     * @return The base64 encoded representation of {@code bytes}.
+     * @throws NullPointerException
+     *             If {@code bytes} was {@code null}.
+     */
+    public static String encode(final ByteSequence bytes) {
+        ensureNotNull(bytes);
 
+        final StringBuilder buffer = new StringBuilder(4 * bytes.length() / 3);
 
+        int pos = 0;
+        final int iterations = bytes.length() / 3;
+        for (int i = 0; i < iterations; i++) {
+            final int value =
+                    ((bytes.byteAt(pos++) & 0xFF) << 16) | ((bytes.byteAt(pos++) & 0xFF) << 8)
+                            | (bytes.byteAt(pos++) & 0xFF);
 
-  /**
-   * Encodes the provided data as a base64 string.
-   *
-   * @param bytes
-   *          The data to be encoded.
-   * @return The base64 encoded representation of {@code bytes}.
-   * @throws NullPointerException
-   *           If {@code bytes} was {@code null}.
-   */
-  public static String encode(final ByteSequence bytes)
-  {
-    ensureNotNull(bytes);
+            buffer.append(BASE64_ALPHABET[(value >>> 18) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[(value >>> 12) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[(value >>> 6) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[value & 0x3F]);
+        }
 
-    final StringBuilder buffer = new StringBuilder(4 * bytes.length() / 3);
+        switch (bytes.length() % 3) {
+        case 1:
+            buffer.append(BASE64_ALPHABET[(bytes.byteAt(pos) >>> 2) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[(bytes.byteAt(pos) << 4) & 0x3F]);
+            buffer.append("==");
+            break;
+        case 2:
+            final int value = ((bytes.byteAt(pos++) & 0xFF) << 8) | (bytes.byteAt(pos) & 0xFF);
+            buffer.append(BASE64_ALPHABET[(value >>> 10) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[(value >>> 4) & 0x3F]);
+            buffer.append(BASE64_ALPHABET[(value << 2) & 0x3F]);
+            buffer.append("=");
+            break;
+        }
 
-    int pos = 0;
-    final int iterations = bytes.length() / 3;
-    for (int i = 0; i < iterations; i++)
-    {
-      final int value = ((bytes.byteAt(pos++) & 0xFF) << 16)
-          | ((bytes.byteAt(pos++) & 0xFF) << 8) | (bytes.byteAt(pos++) & 0xFF);
-
-      buffer.append(BASE64_ALPHABET[(value >>> 18) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[(value >>> 12) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[(value >>> 6) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[value & 0x3F]);
+        return buffer.toString();
     }
 
-    switch (bytes.length() % 3)
-    {
-    case 1:
-      buffer.append(BASE64_ALPHABET[(bytes.byteAt(pos) >>> 2) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[(bytes.byteAt(pos) << 4) & 0x3F]);
-      buffer.append("==");
-      break;
-    case 2:
-      final int value = ((bytes.byteAt(pos++) & 0xFF) << 8)
-          | (bytes.byteAt(pos) & 0xFF);
-      buffer.append(BASE64_ALPHABET[(value >>> 10) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[(value >>> 4) & 0x3F]);
-      buffer.append(BASE64_ALPHABET[(value << 2) & 0x3F]);
-      buffer.append("=");
-      break;
+    /**
+     * Prevent instance creation.
+     */
+    private Base64() {
+        // No implementation required.
     }
-
-    return buffer.toString();
-  }
-
-
-
-  /**
-   * Prevent instance creation.
-   */
-  private Base64()
-  {
-    // No implementation required.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ByteSequenceOutputStream.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ByteSequenceOutputStream.java
index 15cf733..b7fb85c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ByteSequenceOutputStream.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ByteSequenceOutputStream.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,119 +25,89 @@
  */
 package com.forgerock.opendj.util;
 
-
-
 import java.io.IOException;
 import java.io.OutputStream;
 
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 
-
-
 /**
  * An adapter class that allows writing to an byte string builder with the
  * outputstream interface.
  */
-public final class ByteSequenceOutputStream extends OutputStream
-{
+public final class ByteSequenceOutputStream extends OutputStream {
 
-  private final ByteStringBuilder buffer;
+    private final ByteStringBuilder buffer;
 
+    /**
+     * Creates a new byte string builder output stream.
+     *
+     * @param buffer
+     *            The underlying byte string builder.
+     */
+    public ByteSequenceOutputStream(final ByteStringBuilder buffer) {
+        this.buffer = buffer;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() throws IOException {
+        buffer.clear();
+    }
 
-  /**
-   * Creates a new byte string builder output stream.
-   *
-   * @param buffer
-   *          The underlying byte string builder.
-   */
-  public ByteSequenceOutputStream(final ByteStringBuilder buffer)
-  {
-    this.buffer = buffer;
-  }
+    /**
+     * Gets the length of the underlying byte string builder.
+     *
+     * @return The length of the underlying byte string builder.
+     */
+    public int length() {
+        return buffer.length();
+    }
 
+    /**
+     * Resets this output stream such that the underlying byte string builder is
+     * empty.
+     */
+    public void reset() {
+        buffer.clear();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void write(final byte[] bytes) throws IOException {
+        buffer.append(bytes);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close() throws IOException
-  {
-    buffer.clear();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void write(final byte[] bytes, final int i, final int i1) throws IOException {
+        buffer.append(bytes, i, i1);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void write(final int i) throws IOException {
+        buffer.append(((byte) (i & 0xFF)));
+    }
 
-
-  /**
-   * Gets the length of the underlying byte string builder.
-   *
-   * @return The length of the underlying byte string builder.
-   */
-  public int length()
-  {
-    return buffer.length();
-  }
-
-
-
-  /**
-   * Resets this output stream such that the underlying byte string builder is
-   * empty.
-   */
-  public void reset()
-  {
-    buffer.clear();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void write(final byte[] bytes) throws IOException
-  {
-    buffer.append(bytes);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void write(final byte[] bytes, final int i, final int i1)
-      throws IOException
-  {
-    buffer.append(bytes, i, i1);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void write(final int i) throws IOException
-  {
-    buffer.append(((byte) (i & 0xFF)));
-  }
-
-
-
-  /**
-   * Writes the content of the underlying byte string builder to the provided
-   * output stream.
-   *
-   * @param stream
-   *          The output stream.
-   * @throws IOException
-   *           If an I/O error occurs. In particular, an {@code IOException} is
-   *           thrown if the output stream is closed.
-   */
-  public void writeTo(final OutputStream stream) throws IOException
-  {
-    buffer.copyTo(stream);
-  }
+    /**
+     * Writes the content of the underlying byte string builder to the provided
+     * output stream.
+     *
+     * @param stream
+     *            The output stream.
+     * @throws IOException
+     *             If an I/O error occurs. In particular, an {@code IOException}
+     *             is thrown if the output stream is closed.
+     */
+    public void writeTo(final OutputStream stream) throws IOException {
+        buffer.copyTo(stream);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
index 69c2c3c..0c3774e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Collections2.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,481 +26,376 @@
 
 package com.forgerock.opendj.util;
 
-
-
-import java.util.*;
-
-
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
 
 /**
  * Additional {@code Collection} based utility methods.
  */
-public final class Collections2
-{
-  private static class TransformedCollection<M, N, P, C extends Collection<M>>
-      extends AbstractCollection<N> implements Collection<N>
-  {
+public final class Collections2 {
+    private static class TransformedCollection<M, N, P, C extends Collection<M>> extends
+            AbstractCollection<N> implements Collection<N> {
 
-    protected final C collection;
+        protected final C collection;
 
-    protected final Function<? super M, ? extends N, P> funcMtoN;
+        protected final Function<? super M, ? extends N, P> funcMtoN;
 
-    protected final Function<? super N, ? extends M, P> funcNtoM;
+        protected final Function<? super N, ? extends M, P> funcNtoM;
 
-    protected final P p;
+        protected final P p;
 
-
-
-    protected TransformedCollection(final C collection,
-        final Function<? super M, ? extends N, P> funcMtoN,
-        final Function<? super N, ? extends M, P> funcNtoM, final P p)
-    {
-      this.collection = collection;
-      this.funcMtoN = funcMtoN;
-      this.funcNtoM = funcNtoM;
-      this.p = p;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean add(final N e)
-    {
-      return collection.add(funcNtoM.apply(e, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void clear()
-    {
-      collection.clear();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public boolean contains(final Object o)
-    {
-      final N tmp = (N) o;
-      return collection.contains(funcNtoM.apply(tmp, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isEmpty()
-    {
-      return collection.isEmpty();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Iterator<N> iterator()
-    {
-      return Iterators.transformedIterator(collection.iterator(), funcMtoN, p);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public boolean remove(final Object o)
-    {
-      final N tmp = (N) o;
-      return collection.remove(funcNtoM.apply(tmp, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int size()
-    {
-      return collection.size();
-    }
-
-  }
-
-
-
-  private static final class TransformedList<M, N, P> extends
-      TransformedCollection<M, N, P, List<M>> implements List<N>
-  {
-
-    private TransformedList(final List<M> list,
-        final Function<? super M, ? extends N, P> funcMtoN,
-        final Function<? super N, ? extends M, P> funcNtoM, final P p)
-    {
-      super(list, funcMtoN, funcNtoM, p);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void add(final int index, final N element)
-    {
-      collection.add(index, funcNtoM.apply(element, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean addAll(final int index, final Collection<? extends N> c)
-    {
-      // We cannot transform c here due to type-safety.
-      boolean result = false;
-      for (final N e : c)
-      {
-        result |= add(e);
-      }
-      return result;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public N get(final int index)
-    {
-      return funcMtoN.apply(collection.get(index), p);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public int indexOf(final Object o)
-    {
-      final N tmp = (N) o;
-      return collection.indexOf(funcNtoM.apply(tmp, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public int lastIndexOf(final Object o)
-    {
-      final N tmp = (N) o;
-      return collection.lastIndexOf(funcNtoM.apply(tmp, p));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ListIterator<N> listIterator()
-    {
-      return listIterator(0);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ListIterator<N> listIterator(final int index)
-    {
-      final ListIterator<M> iterator = collection.listIterator(index);
-      return new ListIterator<N>()
-      {
-
-        @Override
-        public void add(final N e)
-        {
-          iterator.add(funcNtoM.apply(e, p));
+        protected TransformedCollection(final C collection,
+                final Function<? super M, ? extends N, P> funcMtoN,
+                final Function<? super N, ? extends M, P> funcNtoM, final P p) {
+            this.collection = collection;
+            this.funcMtoN = funcMtoN;
+            this.funcNtoM = funcNtoM;
+            this.p = p;
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public boolean hasNext()
-        {
-          return iterator.hasNext();
+        public boolean add(final N e) {
+            return collection.add(funcNtoM.apply(e, p));
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public boolean hasPrevious()
-        {
-          return iterator.hasPrevious();
+        public void clear() {
+            collection.clear();
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public N next()
-        {
-          return funcMtoN.apply(iterator.next(), p);
+        @SuppressWarnings("unchecked")
+        public boolean contains(final Object o) {
+            final N tmp = (N) o;
+            return collection.contains(funcNtoM.apply(tmp, p));
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public int nextIndex()
-        {
-          return iterator.nextIndex();
+        public boolean isEmpty() {
+            return collection.isEmpty();
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public N previous()
-        {
-          return funcMtoN.apply(iterator.previous(), p);
+        public Iterator<N> iterator() {
+            return Iterators.transformedIterator(collection.iterator(), funcMtoN, p);
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public int previousIndex()
-        {
-          return iterator.previousIndex();
+        @SuppressWarnings("unchecked")
+        public boolean remove(final Object o) {
+            final N tmp = (N) o;
+            return collection.remove(funcNtoM.apply(tmp, p));
         }
 
-
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public void remove()
-        {
-          iterator.remove();
+        public int size() {
+            return collection.size();
         }
 
-
-
-        @Override
-        public void set(final N e)
-        {
-          iterator.set(funcNtoM.apply(e, p));
-        }
-
-      };
     }
 
+    private static final class TransformedList<M, N, P> extends
+            TransformedCollection<M, N, P, List<M>> implements List<N> {
 
+        private TransformedList(final List<M> list,
+                final Function<? super M, ? extends N, P> funcMtoN,
+                final Function<? super N, ? extends M, P> funcNtoM, final P p) {
+            super(list, funcMtoN, funcNtoM, p);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void add(final int index, final N element) {
+            collection.add(index, funcNtoM.apply(element, p));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean addAll(final int index, final Collection<? extends N> c) {
+            // We cannot transform c here due to type-safety.
+            boolean result = false;
+            for (final N e : c) {
+                result |= add(e);
+            }
+            return result;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public N get(final int index) {
+            return funcMtoN.apply(collection.get(index), p);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        @SuppressWarnings("unchecked")
+        public int indexOf(final Object o) {
+            final N tmp = (N) o;
+            return collection.indexOf(funcNtoM.apply(tmp, p));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        @SuppressWarnings("unchecked")
+        public int lastIndexOf(final Object o) {
+            final N tmp = (N) o;
+            return collection.lastIndexOf(funcNtoM.apply(tmp, p));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public ListIterator<N> listIterator() {
+            return listIterator(0);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public ListIterator<N> listIterator(final int index) {
+            final ListIterator<M> iterator = collection.listIterator(index);
+            return new ListIterator<N>() {
+
+                @Override
+                public void add(final N e) {
+                    iterator.add(funcNtoM.apply(e, p));
+                }
+
+                @Override
+                public boolean hasNext() {
+                    return iterator.hasNext();
+                }
+
+                @Override
+                public boolean hasPrevious() {
+                    return iterator.hasPrevious();
+                }
+
+                @Override
+                public N next() {
+                    return funcMtoN.apply(iterator.next(), p);
+                }
+
+                @Override
+                public int nextIndex() {
+                    return iterator.nextIndex();
+                }
+
+                @Override
+                public N previous() {
+                    return funcMtoN.apply(iterator.previous(), p);
+                }
+
+                @Override
+                public int previousIndex() {
+                    return iterator.previousIndex();
+                }
+
+                @Override
+                public void remove() {
+                    iterator.remove();
+                }
+
+                @Override
+                public void set(final N e) {
+                    iterator.set(funcNtoM.apply(e, p));
+                }
+
+            };
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public N remove(final int index) {
+            return funcMtoN.apply(collection.remove(index), p);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public N set(final int index, final N element) {
+            final M result = collection.set(index, funcNtoM.apply(element, p));
+            return funcMtoN.apply(result, p);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public List<N> subList(final int fromIndex, final int toIndex) {
+            final List<M> subList = collection.subList(fromIndex, toIndex);
+            return new TransformedList<M, N, P>(subList, funcMtoN, funcNtoM, p);
+        }
+
+    }
 
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code collection} whose values have been mapped to
+     * elements of type {@code N} using {@code funcMtoN}. The returned
+     * collection supports all operations.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code collection}.
+     * @param <N>
+     *            The type of elements contained in the returned collection.
+     * @param <P>
+     *            The type of the additional parameter to the function's
+     *            {@code apply} method. Use {@link java.lang.Void} for functions
+     *            that do not need an additional parameter.
+     * @param collection
+     *            The collection to be transformed.
+     * @param funcMtoN
+     *            A function which maps values of type {@code M} to values of
+     *            type {@code N}. This function will be used when retrieving
+     *            values from {@code collection}.
+     * @param funcNtoM
+     *            A function which maps values of type {@code N} to values of
+     *            type {@code M}. This function will be used when performing
+     *            queries and adding values to {@code collection} .
+     * @param p
+     *            A predicate specified parameter.
+     * @return A view of {@code collection} whose values have been mapped to
+     *         elements of type {@code N} using {@code funcMtoN}.
      */
-    @Override
-    public N remove(final int index)
-    {
-      return funcMtoN.apply(collection.remove(index), p);
+    public static <M, N, P> Collection<N> transformedCollection(final Collection<M> collection,
+            final Function<? super M, ? extends N, P> funcMtoN,
+            final Function<? super N, ? extends M, P> funcNtoM, final P p) {
+        return new TransformedCollection<M, N, P, Collection<M>>(collection, funcMtoN, funcNtoM, p);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code collection} whose values have been mapped to
+     * elements of type {@code N} using {@code funcMtoN}. The returned
+     * collection supports all operations.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code collection}.
+     * @param <N>
+     *            The type of elements contained in the returned collection.
+     * @param collection
+     *            The collection to be transformed.
+     * @param funcMtoN
+     *            A function which maps values of type {@code M} to values of
+     *            type {@code N}. This function will be used when retrieving
+     *            values from {@code collection}.
+     * @param funcNtoM
+     *            A function which maps values of type {@code N} to values of
+     *            type {@code M}. This function will be used when performing
+     *            queries and adding values to {@code collection} .
+     * @return A view of {@code collection} whose values have been mapped to
+     *         elements of type {@code N} using {@code funcMtoN}.
      */
-    @Override
-    public N set(final int index, final N element)
-    {
-      final M result = collection.set(index, funcNtoM.apply(element, p));
-      return funcMtoN.apply(result, p);
+    public static <M, N> Collection<N> transformedCollection(final Collection<M> collection,
+            final Function<? super M, ? extends N, Void> funcMtoN,
+            final Function<? super N, ? extends M, Void> funcNtoM) {
+        return new TransformedCollection<M, N, Void, Collection<M>>(collection, funcMtoN, funcNtoM,
+                null);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code list} whose values have been mapped to elements
+     * of type {@code N} using {@code funcMtoN}. The returned list supports all
+     * operations.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code list}.
+     * @param <N>
+     *            The type of elements contained in the returned list.
+     * @param <P>
+     *            The type of the additional parameter to the function's
+     *            {@code apply} method. Use {@link java.lang.Void} for functions
+     *            that do not need an additional parameter.
+     * @param list
+     *            The list to be transformed.
+     * @param funcMtoN
+     *            A function which maps values of type {@code M} to values of
+     *            type {@code N}. This function will be used when retrieving
+     *            values from {@code list}.
+     * @param funcNtoM
+     *            A function which maps values of type {@code N} to values of
+     *            type {@code M}. This function will be used when performing
+     *            queries and adding values to {@code list} .
+     * @param p
+     *            A predicate specified parameter.
+     * @return A view of {@code list} whose values have been mapped to elements
+     *         of type {@code N} using {@code funcMtoN}.
      */
-    @Override
-    public List<N> subList(final int fromIndex, final int toIndex)
-    {
-      final List<M> subList = collection.subList(fromIndex, toIndex);
-      return new TransformedList<M, N, P>(subList, funcMtoN, funcNtoM, p);
+    public static <M, N, P> List<N> transformedList(final List<M> list,
+            final Function<? super M, ? extends N, P> funcMtoN,
+            final Function<? super N, ? extends M, P> funcNtoM, final P p) {
+        return new TransformedList<M, N, P>(list, funcMtoN, funcNtoM, p);
     }
 
-  }
+    /**
+     * Returns a view of {@code list} whose values have been mapped to elements
+     * of type {@code N} using {@code funcMtoN}. The returned list supports all
+     * operations.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code list}.
+     * @param <N>
+     *            The type of elements contained in the returned list.
+     * @param list
+     *            The list to be transformed.
+     * @param funcMtoN
+     *            A function which maps values of type {@code M} to values of
+     *            type {@code N}. This function will be used when retrieving
+     *            values from {@code list}.
+     * @param funcNtoM
+     *            A function which maps values of type {@code N} to values of
+     *            type {@code M}. This function will be used when performing
+     *            queries and adding values to {@code list} .
+     * @return A view of {@code list} whose values have been mapped to elements
+     *         of type {@code N} using {@code funcMtoN}.
+     */
+    public static <M, N> List<N> transformedList(final List<M> list,
+            final Function<? super M, ? extends N, Void> funcMtoN,
+            final Function<? super N, ? extends M, Void> funcNtoM) {
+        return new TransformedList<M, N, Void>(list, funcMtoN, funcNtoM, null);
+    }
 
-
-
-  /**
-   * Returns a view of {@code collection} whose values have been mapped to
-   * elements of type {@code N} using {@code funcMtoN}. The returned collection
-   * supports all operations.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code collection}.
-   * @param <N>
-   *          The type of elements contained in the returned collection.
-   * @param <P>
-   *          The type of the additional parameter to the function's
-   *          {@code apply} method. Use {@link java.lang.Void} for functions
-   *          that do not need an additional parameter.
-   * @param collection
-   *          The collection to be transformed.
-   * @param funcMtoN
-   *          A function which maps values of type {@code M} to values of type
-   *          {@code N}. This function will be used when retrieving values from
-   *          {@code collection}.
-   * @param funcNtoM
-   *          A function which maps values of type {@code N} to values of type
-   *          {@code M}. This function will be used when performing queries and
-   *          adding values to {@code collection} .
-   * @param p
-   *          A predicate specified parameter.
-   * @return A view of {@code collection} whose values have been mapped to
-   *         elements of type {@code N} using {@code funcMtoN}.
-   */
-  public static <M, N, P> Collection<N> transformedCollection(
-      final Collection<M> collection,
-      final Function<? super M, ? extends N, P> funcMtoN,
-      final Function<? super N, ? extends M, P> funcNtoM, final P p)
-  {
-    return new TransformedCollection<M, N, P, Collection<M>>(collection,
-        funcMtoN, funcNtoM, p);
-  }
-
-
-
-  /**
-   * Returns a view of {@code collection} whose values have been mapped to
-   * elements of type {@code N} using {@code funcMtoN}. The returned collection
-   * supports all operations.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code collection}.
-   * @param <N>
-   *          The type of elements contained in the returned collection.
-   * @param collection
-   *          The collection to be transformed.
-   * @param funcMtoN
-   *          A function which maps values of type {@code M} to values of type
-   *          {@code N}. This function will be used when retrieving values from
-   *          {@code collection}.
-   * @param funcNtoM
-   *          A function which maps values of type {@code N} to values of type
-   *          {@code M}. This function will be used when performing queries and
-   *          adding values to {@code collection} .
-   * @return A view of {@code collection} whose values have been mapped to
-   *         elements of type {@code N} using {@code funcMtoN}.
-   */
-  public static <M, N> Collection<N> transformedCollection(
-      final Collection<M> collection,
-      final Function<? super M, ? extends N, Void> funcMtoN,
-      final Function<? super N, ? extends M, Void> funcNtoM)
-  {
-    return new TransformedCollection<M, N, Void, Collection<M>>(collection,
-        funcMtoN, funcNtoM, null);
-  }
-
-
-
-  /**
-   * Returns a view of {@code list} whose values have been mapped to elements of
-   * type {@code N} using {@code funcMtoN}. The returned list supports all
-   * operations.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code list}.
-   * @param <N>
-   *          The type of elements contained in the returned list.
-   * @param <P>
-   *          The type of the additional parameter to the function's
-   *          {@code apply} method. Use {@link java.lang.Void} for functions
-   *          that do not need an additional parameter.
-   * @param list
-   *          The list to be transformed.
-   * @param funcMtoN
-   *          A function which maps values of type {@code M} to values of type
-   *          {@code N}. This function will be used when retrieving values from
-   *          {@code list}.
-   * @param funcNtoM
-   *          A function which maps values of type {@code N} to values of type
-   *          {@code M}. This function will be used when performing queries and
-   *          adding values to {@code list} .
-   * @param p
-   *          A predicate specified parameter.
-   * @return A view of {@code list} whose values have been mapped to elements of
-   *         type {@code N} using {@code funcMtoN}.
-   */
-  public static <M, N, P> List<N> transformedList(final List<M> list,
-      final Function<? super M, ? extends N, P> funcMtoN,
-      final Function<? super N, ? extends M, P> funcNtoM, final P p)
-  {
-    return new TransformedList<M, N, P>(list, funcMtoN, funcNtoM, p);
-  }
-
-
-
-  /**
-   * Returns a view of {@code list} whose values have been mapped to elements of
-   * type {@code N} using {@code funcMtoN}. The returned list supports all
-   * operations.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code list}.
-   * @param <N>
-   *          The type of elements contained in the returned list.
-   * @param list
-   *          The list to be transformed.
-   * @param funcMtoN
-   *          A function which maps values of type {@code M} to values of type
-   *          {@code N}. This function will be used when retrieving values from
-   *          {@code list}.
-   * @param funcNtoM
-   *          A function which maps values of type {@code N} to values of type
-   *          {@code M}. This function will be used when performing queries and
-   *          adding values to {@code list} .
-   * @return A view of {@code list} whose values have been mapped to elements of
-   *         type {@code N} using {@code funcMtoN}.
-   */
-  public static <M, N> List<N> transformedList(final List<M> list,
-      final Function<? super M, ? extends N, Void> funcMtoN,
-      final Function<? super N, ? extends M, Void> funcNtoM)
-  {
-    return new TransformedList<M, N, Void>(list, funcMtoN, funcNtoM, null);
-  }
-
-
-
-  // Prevent instantiation
-  private Collections2()
-  {
-    // Do nothing.
-  }
+    // Prevent instantiation
+    private Collections2() {
+        // Do nothing.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/CompletedFutureResult.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/CompletedFutureResult.java
index 047eb5c..1dd5d32 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/CompletedFutureResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/CompletedFutureResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,169 +27,130 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.FutureResult;
 
-
-
 /**
  * An implementation of {@code FutureResult} which can be used in cases where
  * the result is known in advance, for example, if the result is obtained
  * synchronously.
  *
  * @param <S>
- *          The type of result returned by this future.
+ *            The type of result returned by this future.
  */
-public final class CompletedFutureResult<S> implements FutureResult<S>
-{
-  private final S result;
+public final class CompletedFutureResult<S> implements FutureResult<S> {
+    private final S result;
 
-  private final ErrorResultException errorResult;
+    private final ErrorResultException errorResult;
 
-  private final int requestID;
+    private final int requestID;
 
-
-
-  /**
-   * Creates a new completed future which will throw the provided error result
-   * and request ID of {@code -1}.
-   *
-   * @param errorResult
-   *          The error result.
-   * @throws NullPointerException
-   *           If {@code errorResult} was {@code null}.
-   */
-  public CompletedFutureResult(final ErrorResultException errorResult)
-  {
-    this(errorResult, -1);
-  }
-
-
-
-  /**
-   * Creates a new completed future which will throw the provided error result
-   * and request ID.
-   *
-   * @param errorResult
-   *          The error result.
-   * @param requestID
-   *          The request ID.
-   * @throws NullPointerException
-   *           If {@code errorResult} was {@code null}.
-   */
-  public CompletedFutureResult(final ErrorResultException errorResult,
-      final int requestID)
-  {
-    Validator.ensureNotNull(errorResult);
-    this.result = null;
-    this.errorResult = errorResult;
-    this.requestID = requestID;
-  }
-
-
-
-  /**
-   * Creates a new completed future which will return the provided result and
-   * request ID of {@code -1}.
-   *
-   * @param result
-   *          The result, which may be {@code null}.
-   */
-  public CompletedFutureResult(final S result)
-  {
-    this(result, -1);
-  }
-
-
-
-  /**
-   * Creates a new completed future which will return the provided result and
-   * request ID.
-   *
-   * @param result
-   *          The result, which may be {@code null}.
-   * @param requestID
-   *          The request ID.
-   */
-  public CompletedFutureResult(final S result, final int requestID)
-  {
-    this.result = result;
-    this.errorResult = null;
-    this.requestID = requestID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean cancel(final boolean mayInterruptIfRunning)
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public S get() throws ErrorResultException, InterruptedException
-  {
-    if (errorResult == null)
-    {
-      // May be null.
-      return result;
+    /**
+     * Creates a new completed future which will throw the provided error result
+     * and request ID of {@code -1}.
+     *
+     * @param errorResult
+     *            The error result.
+     * @throws NullPointerException
+     *             If {@code errorResult} was {@code null}.
+     */
+    public CompletedFutureResult(final ErrorResultException errorResult) {
+        this(errorResult, -1);
     }
-    else
-    {
-      throw errorResult;
+
+    /**
+     * Creates a new completed future which will throw the provided error result
+     * and request ID.
+     *
+     * @param errorResult
+     *            The error result.
+     * @param requestID
+     *            The request ID.
+     * @throws NullPointerException
+     *             If {@code errorResult} was {@code null}.
+     */
+    public CompletedFutureResult(final ErrorResultException errorResult, final int requestID) {
+        Validator.ensureNotNull(errorResult);
+        this.result = null;
+        this.errorResult = errorResult;
+        this.requestID = requestID;
     }
-  }
 
+    /**
+     * Creates a new completed future which will return the provided result and
+     * request ID of {@code -1}.
+     *
+     * @param result
+     *            The result, which may be {@code null}.
+     */
+    public CompletedFutureResult(final S result) {
+        this(result, -1);
+    }
 
+    /**
+     * Creates a new completed future which will return the provided result and
+     * request ID.
+     *
+     * @param result
+     *            The result, which may be {@code null}.
+     * @param requestID
+     *            The request ID.
+     */
+    public CompletedFutureResult(final S result, final int requestID) {
+        this.result = result;
+        this.errorResult = null;
+        this.requestID = requestID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public S get(final long timeout, final TimeUnit unit)
-      throws ErrorResultException, TimeoutException, InterruptedException
-  {
-    return get();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean cancel(final boolean mayInterruptIfRunning) {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public S get() throws ErrorResultException, InterruptedException {
+        if (errorResult == null) {
+            // May be null.
+            return result;
+        } else {
+            throw errorResult;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public S get(final long timeout, final TimeUnit unit) throws ErrorResultException,
+            TimeoutException, InterruptedException {
+        return get();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public int getRequestID()
-  {
-    return requestID;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int getRequestID() {
+        return requestID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled() {
+        return false;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCancelled()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isDone()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDone() {
+        return true;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
index 3a9a338..ed16252 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,669 +27,533 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionEventListener;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.forgerock.opendj.ldif.ConnectionEntryReader;
 
-
-
 /**
  * A base class from which connection decorators may be easily implemented. The
  * default implementation of each method is to delegate to the decorated
  * connection.
  */
-public abstract class ConnectionDecorator implements Connection
-{
-  /**
-   * The decorated connection.
-   */
-  protected final Connection connection;
+public abstract class ConnectionDecorator implements Connection {
+    /**
+     * The decorated connection.
+     */
+    protected final Connection connection;
 
+    /**
+     * Creates a new connection decorator.
+     *
+     * @param connection
+     *            The connection to be decorated.
+     */
+    protected ConnectionDecorator(final Connection connection) {
+        Validator.ensureNotNull(connection);
+        this.connection = connection;
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Void> abandonAsync(final AbandonRequest request) {
+        return connection.abandonAsync(request);
+    }
 
-  /**
-   * Creates a new connection decorator.
-   *
-   * @param connection
-   *          The connection to be decorated.
-   */
-  protected ConnectionDecorator(final Connection connection)
-  {
-    Validator.ensureNotNull(connection);
-    this.connection = connection;
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result add(final AddRequest request) throws ErrorResultException, InterruptedException {
+        return connection.add(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result add(final Entry entry) throws ErrorResultException, InterruptedException {
+        return connection.add(entry);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result add(final String... ldifLines) throws ErrorResultException, InterruptedException {
+        return connection.add(ldifLines);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Void> abandonAsync(final AbandonRequest request)
-  {
-    return connection.abandonAsync(request);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Result> addAsync(final AddRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        return connection.addAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public void addConnectionEventListener(final ConnectionEventListener listener) {
+        connection.addConnectionEventListener(listener);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public BindResult bind(final BindRequest request) throws ErrorResultException,
+            InterruptedException {
+        return connection.bind(request);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result add(final AddRequest request) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.add(request);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public BindResult bind(final String name, final char[] password) throws ErrorResultException,
+            InterruptedException {
+        return connection.bind(name, password);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<BindResult> bindAsync(final BindRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super BindResult> resultHandler) {
+        return connection.bindAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public void close() {
+        connection.close();
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result add(final Entry entry) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.add(entry);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public void close(final UnbindRequest request, final String reason) {
+        connection.close(request, reason);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public CompareResult compare(final CompareRequest request) throws ErrorResultException,
+            InterruptedException {
+        return connection.compare(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public CompareResult compare(final String name, final String attributeDescription,
+            final String assertionValue) throws ErrorResultException, InterruptedException {
+        return connection.compare(name, attributeDescription, assertionValue);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result add(final String... ldifLines) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.add(ldifLines);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<CompareResult> compareAsync(final CompareRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super CompareResult> resultHandler) {
+        return connection.compareAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result delete(final DeleteRequest request) throws ErrorResultException,
+            InterruptedException {
+        return connection.delete(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result delete(final String name) throws ErrorResultException, InterruptedException {
+        return connection.delete(name);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Result> addAsync(final AddRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    return connection.addAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Result> deleteAsync(final DeleteRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        return connection.deleteAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request)
+            throws ErrorResultException, InterruptedException {
+        return connection.extendedRequest(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
+            final IntermediateResponseHandler handler) throws ErrorResultException,
+            InterruptedException {
+        return connection.extendedRequest(request, handler);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public void addConnectionEventListener(final ConnectionEventListener listener)
-  {
-    connection.addConnectionEventListener(listener);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public GenericExtendedResult extendedRequest(final String requestName,
+            final ByteString requestValue) throws ErrorResultException, InterruptedException {
+        return connection.extendedRequest(requestName, requestValue);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
+            final ExtendedRequest<R> request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super R> resultHandler) {
+        return connection.extendedRequestAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public boolean isClosed() {
+        return connection.isClosed();
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public BindResult bind(final BindRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.bind(request);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public boolean isValid() {
+        return connection.isValid();
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result modify(final ModifyRequest request) throws ErrorResultException,
+            InterruptedException {
+        return connection.modify(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result modify(final String... ldifLines) throws ErrorResultException,
+            InterruptedException {
+        return connection.modify(ldifLines);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public BindResult bind(final String name, final char[] password)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.bind(name, password);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Result> modifyAsync(final ModifyRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        return connection.modifyAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException,
+            InterruptedException {
+        return connection.modifyDN(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result modifyDN(final String name, final String newRDN) throws ErrorResultException,
+            InterruptedException {
+        return connection.modifyDN(name, newRDN);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<BindResult> bindAsync(final BindRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super BindResult> resultHandler)
-  {
-    return connection.bindAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final ResultHandler<? super Result> resultHandler) {
+        return connection.modifyDNAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public SearchResultEntry readEntry(final DN name, final String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException {
+        return connection.readEntry(name, attributeDescriptions);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public SearchResultEntry readEntry(final String name, final String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException {
+        return connection.readEntry(name, attributeDescriptions);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public void close()
-  {
-    connection.close();
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
+            final Collection<String> attributeDescriptions,
+            final ResultHandler<? super SearchResultEntry> handler) {
+        return connection.readEntryAsync(name, attributeDescriptions, handler);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public void removeConnectionEventListener(final ConnectionEventListener listener) {
+        connection.removeConnectionEventListener(listener);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public ConnectionEntryReader search(final SearchRequest request) {
+        return connection.search(request);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public void close(final UnbindRequest request, final String reason)
-  {
-    connection.close(request, reason);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result search(final SearchRequest request,
+            final Collection<? super SearchResultEntry> entries) throws ErrorResultException,
+            InterruptedException {
+        return connection.search(request, entries);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result search(final SearchRequest request,
+            final Collection<? super SearchResultEntry> entries,
+            final Collection<? super SearchResultReference> references)
+            throws ErrorResultException, InterruptedException {
+        return connection.search(request, entries, references);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public Result search(final SearchRequest request, final SearchResultHandler handler)
+            throws ErrorResultException, InterruptedException {
+        return connection.search(request, handler);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public CompareResult compare(final CompareRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.compare(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public CompareResult compare(final String name,
-      final String attributeDescription, final String assertionValue)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.compare(name, attributeDescription, assertionValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<CompareResult> compareAsync(final CompareRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super CompareResult> resultHandler)
-  {
-    return connection.compareAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result delete(final DeleteRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.delete(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result delete(final String name) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.delete(name);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Result> deleteAsync(final DeleteRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    return connection.deleteAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public <R extends ExtendedResult> R extendedRequest(
-      final ExtendedRequest<R> request) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.extendedRequest(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public <R extends ExtendedResult> R extendedRequest(
-      final ExtendedRequest<R> request,
-      final IntermediateResponseHandler handler) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.extendedRequest(request, handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public GenericExtendedResult extendedRequest(final String requestName,
-      final ByteString requestValue) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.extendedRequest(requestName, requestValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-      final ExtendedRequest<R> request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super R> resultHandler)
-  {
-    return connection.extendedRequestAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public boolean isClosed()
-  {
-    return connection.isClosed();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public boolean isValid()
-  {
-    return connection.isValid();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result modify(final ModifyRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.modify(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result modify(final String... ldifLines) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.modify(ldifLines);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Result> modifyAsync(final ModifyRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    return connection.modifyAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result modifyDN(final ModifyDNRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.modifyDN(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result modifyDN(final String name, final String newRDN)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.modifyDN(name, newRDN);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final ResultHandler<? super Result> resultHandler)
-  {
-    return connection.modifyDNAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public SearchResultEntry readEntry(final DN name,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.readEntry(name, attributeDescriptions);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public SearchResultEntry readEntry(final String name,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.readEntry(name, attributeDescriptions);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
-      final Collection<String> attributeDescriptions,
-      final ResultHandler<? super SearchResultEntry> handler)
-  {
-    return connection.readEntryAsync(name, attributeDescriptions, handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public void removeConnectionEventListener(
-      final ConnectionEventListener listener)
-  {
-    connection.removeConnectionEventListener(listener);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public ConnectionEntryReader search(final SearchRequest request)
-  {
-    return connection.search(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final Collection<? super SearchResultEntry> entries)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.search(request, entries);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final Collection<? super SearchResultEntry> entries,
-      final Collection<? super SearchResultReference> references)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.search(request, entries, references);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final SearchResultHandler handler) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.search(request, handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public ConnectionEntryReader search(final String baseObject,
-      final SearchScope scope, final String filter,
-      final String... attributeDescriptions)
-  {
-    return connection.search(baseObject, scope, filter, attributeDescriptions);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<Result> searchAsync(final SearchRequest request,
-      final IntermediateResponseHandler intermediateResponseHandler,
-      final SearchResultHandler resultHandler)
-  {
-    return connection.searchAsync(request, intermediateResponseHandler,
-        resultHandler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public SearchResultEntry searchSingleEntry(final SearchRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    return connection.searchSingleEntry(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public SearchResultEntry searchSingleEntry(final String baseObject,
-      final SearchScope scope, final String filter,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    return connection.searchSingleEntry(baseObject, scope, filter,
-        attributeDescriptions);
-  }
-
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public ConnectionEntryReader search(final String baseObject, final SearchScope scope,
+            final String filter, final String... attributeDescriptions) {
+        return connection.search(baseObject, scope, filter, attributeDescriptions);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<Result> searchAsync(final SearchRequest request,
+            final IntermediateResponseHandler intermediateResponseHandler,
+            final SearchResultHandler resultHandler) {
+        return connection.searchAsync(request, intermediateResponseHandler, resultHandler);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public FutureResult<SearchResultEntry> searchSingleEntryAsync(
-      final SearchRequest request,
-      final ResultHandler<? super SearchResultEntry> handler)
-  {
-    return connection.searchSingleEntryAsync(request, handler);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public SearchResultEntry searchSingleEntry(final SearchRequest request)
+            throws ErrorResultException, InterruptedException {
+        return connection.searchSingleEntry(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public SearchResultEntry searchSingleEntry(final String baseObject, final SearchScope scope,
+            final String filter, final String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException {
+        return connection.searchSingleEntry(baseObject, scope, filter, attributeDescriptions);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public FutureResult<SearchResultEntry> searchSingleEntryAsync(final SearchRequest request,
+            final ResultHandler<? super SearchResultEntry> handler) {
+        return connection.searchSingleEntryAsync(request, handler);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to delegate.
-   */
-  @Override
-  public String toString()
-  {
-    return connection.toString();
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to delegate.
+     */
+    @Override
+    public String toString() {
+        return connection.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java
index a63760b..363b984 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Function.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,32 +26,29 @@
 
 package com.forgerock.opendj.util;
 
-
-
 /**
  * Functions transform input values of type {@code M} to output values of type
  * {@code N}.
  *
  * @param <M>
- *          The type of input values transformed by this function.
+ *            The type of input values transformed by this function.
  * @param <N>
- *          The type of output values return by this function.
+ *            The type of output values return by this function.
  * @param <P>
- *          The type of the additional parameter to this function's {@code
- *          apply} method. Use {@link java.lang.Void} for functions that do not
- *          need an additional parameter.
+ *            The type of the additional parameter to this function's
+ *            {@code apply} method. Use {@link java.lang.Void} for functions
+ *            that do not need an additional parameter.
  */
-public interface Function<M, N, P>
-{
-  /**
-   * Applies this function to the provided input value of type {@code M} ,
-   * returning an output value of type {@code N}.
-   *
-   * @param value
-   *          The value to be transformed.
-   * @param p
-   *          A function specified parameter.
-   * @return The result of the transformation.
-   */
-  N apply(M value, P p);
+public interface Function<M, N, P> {
+    /**
+     * Applies this function to the provided input value of type {@code M} ,
+     * returning an output value of type {@code N}.
+     *
+     * @param value
+     *            The value to be transformed.
+     * @param p
+     *            A function specified parameter.
+     * @return The result of the transformation.
+     */
+    N apply(M value, P p);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java
index 34351ad..8fb41d3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Functions.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,369 +26,293 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.schema.Schema;
 
-
-
 /**
  * Common {@link Function} implementations.
  */
-public final class Functions
-{
+public final class Functions {
 
-  private static final class FixedFunction<M, N, P> implements
-      Function<M, N, Void>
-  {
-    private final Function<M, N, P> function;
+    private static final class FixedFunction<M, N, P> implements Function<M, N, Void> {
+        private final Function<M, N, P> function;
 
-    private final P parameter;
+        private final P parameter;
 
+        private FixedFunction(final Function<M, N, P> function, final P p) {
+            this.function = function;
+            this.parameter = p;
+        }
 
+        /**
+         * {@inheritDoc}
+         */
+        public N apply(final M value, final Void p) {
+            return function.apply(value, parameter);
+        }
 
-    private FixedFunction(final Function<M, N, P> function, final P p)
-    {
-      this.function = function;
-      this.parameter = p;
     }
 
+    private static final Function<ByteString, AttributeDescription, Schema> BYTESTRING_TO_ATTRIBUTE_DESCRIPTION =
+            new Function<ByteString, AttributeDescription, Schema>() {
 
+                public AttributeDescription apply(final ByteString value, final Schema p) {
+                    // FIXME: what should we do if parsing fails?
+                    return AttributeDescription.valueOf(value.toString(), p);
+                }
+            };
+
+    private static final Function<ByteString, Boolean, Void> BYTESTRING_TO_BOOLEAN =
+            new Function<ByteString, Boolean, Void>() {
+
+                public Boolean apply(final ByteString value, final Void p) {
+                    final String valueString = StaticUtils.toLowerCase(value.toString());
+
+                    if (valueString.equals("true") || valueString.equals("yes")
+                            || valueString.equals("on") || valueString.equals("1")) {
+                        return Boolean.TRUE;
+                    } else if (valueString.equals("false") || valueString.equals("no")
+                            || valueString.equals("off") || valueString.equals("0")) {
+                        return Boolean.FALSE;
+                    } else {
+                        throw new NumberFormatException("Invalid boolean value \"" + valueString
+                                + "\"");
+                    }
+                }
+            };
+
+    private static final Function<ByteString, DN, Schema> BYTESTRING_TO_DN =
+            new Function<ByteString, DN, Schema>() {
+
+                public DN apply(final ByteString value, final Schema p) {
+                    // FIXME: what should we do if parsing fails?
+
+                    // FIXME: we should have a ByteString valueOf
+                    // implementation.
+                    return DN.valueOf(value.toString(), p);
+                }
+            };
+
+    private static final Function<ByteString, Integer, Void> BYTESTRING_TO_INTEGER =
+            new Function<ByteString, Integer, Void>() {
+
+                public Integer apply(final ByteString value, final Void p) {
+                    // We do not use ByteString.toInt() as we are string based.
+                    return Integer.valueOf(value.toString());
+                }
+            };
+
+    private static final Function<ByteString, Long, Void> BYTESTRING_TO_LONG =
+            new Function<ByteString, Long, Void>() {
+
+                public Long apply(final ByteString value, final Void p) {
+                    // We do not use ByteString.toLong() as we are string based.
+                    return Long.valueOf(value.toString());
+                }
+            };
+
+    private static final Function<ByteString, String, Void> BYTESTRING_TO_STRING =
+            new Function<ByteString, String, Void>() {
+
+                public String apply(final ByteString value, final Void p) {
+                    return value.toString();
+                }
+            };
+
+    private static final Function<Object, ByteString, Void> OBJECT_TO_BYTESTRING =
+            new Function<Object, ByteString, Void>() {
+
+                public ByteString apply(final Object value, final Void p) {
+                    return ByteString.valueOf(value);
+                }
+            };
+
+    private static final Function<String, String, Void> NORMALIZE_STRING =
+            new Function<String, String, Void>() {
+
+                public String apply(final String value, final Void p) {
+                    return StaticUtils.toLowerCase(value).trim();
+                }
+            };
+
+    private static final Function<Object, Object, Void> IDENTITY =
+            new Function<Object, Object, Void>() {
+
+                public Object apply(Object value, Void p) {
+                    return value;
+                }
+
+            };
 
     /**
-     * {@inheritDoc}
+     * Returns a function which which always invokes {@code function} with
+     * {@code p}.
+     *
+     * @param <M>
+     *            The type of input values transformed by this function.
+     * @param <N>
+     *            The type of output values return by this function.
+     * @param <P>
+     *            The type of the additional parameter to this function's
+     *            {@code apply} method. Use {@link java.lang.Void} for functions
+     *            that do not need an additional parameter.
+     * @param function
+     *            The function to wrap.
+     * @param p
+     *            The parameter which will always be passed to {@code function}.
+     * @return A function which which always invokes {@code function} with
+     *         {@code p}.
      */
-    public N apply(final M value, final Void p)
-    {
-      return function.apply(value, parameter);
+    public static <M, N, P> Function<M, N, Void> fixedFunction(final Function<M, N, P> function,
+            final P p) {
+        return new FixedFunction<M, N, P>(function, p);
     }
 
-  }
-
-
-
-  private static final Function<ByteString, AttributeDescription, Schema>
-    BYTESTRING_TO_ATTRIBUTE_DESCRIPTION =
-      new Function<ByteString, AttributeDescription, Schema>()
-  {
-
-    public AttributeDescription apply(final ByteString value, final Schema p)
-    {
-      // FIXME: what should we do if parsing fails?
-      return AttributeDescription.valueOf(value.toString(), p);
-    }
-  };
-
-  private static final Function<ByteString, Boolean, Void>
-    BYTESTRING_TO_BOOLEAN = new Function<ByteString, Boolean, Void>()
-  {
-
-    public Boolean apply(final ByteString value, final Void p)
-    {
-      final String valueString = StaticUtils.toLowerCase(value.toString());
-
-      if (valueString.equals("true") || valueString.equals("yes")
-          || valueString.equals("on") || valueString.equals("1"))
-      {
-        return Boolean.TRUE;
-      }
-      else if (valueString.equals("false") || valueString.equals("no")
-          || valueString.equals("off") || valueString.equals("0"))
-      {
-        return Boolean.FALSE;
-      }
-      else
-      {
-        throw new NumberFormatException("Invalid boolean value \""
-            + valueString + "\"");
-      }
-    }
-  };
-
-  private static final Function<ByteString, DN, Schema> BYTESTRING_TO_DN =
-    new Function<ByteString, DN, Schema>()
-  {
-
-    public DN apply(final ByteString value, final Schema p)
-    {
-      // FIXME: what should we do if parsing fails?
-
-      // FIXME: we should have a ByteString valueOf implementation.
-      return DN.valueOf(value.toString(), p);
-    }
-  };
-
-  private static final Function<ByteString, Integer, Void>
-    BYTESTRING_TO_INTEGER = new Function<ByteString, Integer, Void>()
-  {
-
-    public Integer apply(final ByteString value, final Void p)
-    {
-      // We do not use ByteString.toInt() as we are string based.
-      return Integer.valueOf(value.toString());
-    }
-  };
-
-  private static final Function<ByteString, Long, Void> BYTESTRING_TO_LONG =
-    new Function<ByteString, Long, Void>()
-  {
-
-    public Long apply(final ByteString value, final Void p)
-    {
-      // We do not use ByteString.toLong() as we are string based.
-      return Long.valueOf(value.toString());
-    }
-  };
-
-  private static final Function<ByteString, String, Void> BYTESTRING_TO_STRING =
-    new Function<ByteString, String, Void>()
-  {
-
-    public String apply(final ByteString value, final Void p)
-    {
-      return value.toString();
-    }
-  };
-
-  private static final Function<Object, ByteString, Void> OBJECT_TO_BYTESTRING =
-    new Function<Object, ByteString, Void>()
-  {
-
-    public ByteString apply(final Object value, final Void p)
-    {
-      return ByteString.valueOf(value);
-    }
-  };
-
-  private static final Function<String, String, Void> NORMALIZE_STRING =
-    new Function<String, String, Void>()
-  {
-
-    public String apply(final String value, final Void p)
-    {
-      return StaticUtils.toLowerCase(value).trim();
-    }
-  };
-
-  private static final Function<Object, Object, Void> IDENTITY =
-    new Function<Object, Object, Void>()
-  {
-
-    public Object apply(Object value, Void p)
-    {
-      return value;
+    /**
+     * Returns a function which always returns the value that it was provided
+     * with.
+     *
+     * @param <M>
+     *            The type of values transformed by this function.
+     * @return A function which always returns the value that it was provided
+     *         with.
+     */
+    @SuppressWarnings("unchecked")
+    public static <M> Function<M, M, Void> identityFunction() {
+        return (Function<M, M, Void>) IDENTITY;
     }
 
-  };
+    /**
+     * Returns a function which converts a {@code String} to lower case using
+     * {@link StaticUtils#toLowerCase} and then trims it.
+     *
+     * @return A function which converts a {@code String} to lower case using
+     *         {@link StaticUtils#toLowerCase} and then trims it.
+     */
+    public static Function<String, String, Void> normalizeString() {
+        return NORMALIZE_STRING;
+    }
 
+    /**
+     * Returns a function which converts an {@code Object} to a
+     * {@code ByteString} using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @return A function which converts an {@code Object} to a
+     *         {@code ByteString} .
+     */
+    public static Function<Object, ByteString, Void> objectToByteString() {
+        return OBJECT_TO_BYTESTRING;
+    }
 
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as an {@code AttributeDescription} using the default
+     * schema. Invalid values will result in a
+     * {@code LocalizedIllegalArgumentException}.
+     *
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as an {@code AttributeDescription}.
+     */
+    public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription() {
+        return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, Schema.getDefaultSchema());
+    }
 
-  /**
-   * Returns a function which which always invokes {@code function} with {@code
-   * p}.
-   *
-   * @param <M>
-   *          The type of input values transformed by this function.
-   * @param <N>
-   *          The type of output values return by this function.
-   * @param <P>
-   *          The type of the additional parameter to this function's {@code
-   *          apply} method. Use {@link java.lang.Void} for functions that do
-   *          not need an additional parameter.
-   * @param function
-   *          The function to wrap.
-   * @param p
-   *          The parameter which will always be passed to {@code function}.
-   * @return A function which which always invokes {@code function} with {@code
-   *         p}.
-   */
-  public static <M, N, P> Function<M, N, Void> fixedFunction(
-      final Function<M, N, P> function, final P p)
-  {
-    return new FixedFunction<M, N, P>(function, p);
-  }
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as an {@code AttributeDescription} using the provided
+     * schema. Invalid values will result in a
+     * {@code LocalizedIllegalArgumentException}.
+     *
+     * @param schema
+     *            The schema to use for decoding attribute descriptions.
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as an {@code AttributeDescription}.
+     */
+    public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription(
+            final Schema schema) {
+        return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, schema);
+    }
 
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} to a {@code Boolean}. The function will accept the
+     * values {@code 0}, {@code false}, {@code no}, {@code off}, {@code 1},
+     * {@code true}, {@code yes}, {@code on}. All other values will result in a
+     * {@code NumberFormatException}.
+     *
+     * @return A function which transforms a {@code ByteString} to a
+     *         {@code Boolean}.
+     */
+    public static Function<ByteString, Boolean, Void> valueToBoolean() {
+        return BYTESTRING_TO_BOOLEAN;
+    }
 
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as a {@code DN} using the default schema. Invalid
+     * values will result in a {@code LocalizedIllegalArgumentException}.
+     *
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as an {@code DN}.
+     */
+    public static Function<ByteString, DN, Void> valueToDN() {
+        return fixedFunction(BYTESTRING_TO_DN, Schema.getDefaultSchema());
+    }
 
-  /**
-   * Returns a function which always returns the value that it was provided
-   * with.
-   *
-   * @param <M>
-   *          The type of values transformed by this function.
-   * @return A function which always returns the value that it was provided
-   *         with.
-   */
-  @SuppressWarnings("unchecked")
-  public static <M> Function<M, M, Void> identityFunction()
-  {
-    return (Function<M, M, Void>) IDENTITY;
-  }
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as a {@code DN} using the provided schema. Invalid
+     * values will result in a {@code LocalizedIllegalArgumentException}.
+     *
+     * @param schema
+     *            The schema to use for decoding DNs.
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as an {@code DN}.
+     */
+    public static Function<ByteString, DN, Void> valueToDN(final Schema schema) {
+        return fixedFunction(BYTESTRING_TO_DN, schema);
+    }
 
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as an {@code Integer}. Invalid values will result in a
+     * {@code NumberFormatException}.
+     *
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as an {@code Integer}.
+     */
+    public static Function<ByteString, Integer, Void> valueToInteger() {
+        return BYTESTRING_TO_INTEGER;
+    }
 
+    /**
+     * Returns a function which parses the string representation of a
+     * {@code ByteString} as a {@code Long}. Invalid values will result in a
+     * {@code NumberFormatException}.
+     *
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as a {@code Long}.
+     */
+    public static Function<ByteString, Long, Void> valueToLong() {
+        return BYTESTRING_TO_LONG;
+    }
 
-  /**
-   * Returns a function which converts a {@code String} to lower case using
-   * {@link StaticUtils#toLowerCase} and then trims it.
-   *
-   * @return A function which converts a {@code String} to lower case using
-   *         {@link StaticUtils#toLowerCase} and then trims it.
-   */
-  public static Function<String, String, Void> normalizeString()
-  {
-    return NORMALIZE_STRING;
-  }
+    /**
+     * Returns a function which parses a {@code ByteString} as a UTF-8 encoded
+     * {@code String}.
+     *
+     * @return A function which parses the string representation of a
+     *         {@code ByteString} as a UTF-8 encoded {@code String}.
+     */
+    public static Function<ByteString, String, Void> valueToString() {
+        return BYTESTRING_TO_STRING;
+    }
 
-
-
-  /**
-   * Returns a function which converts an {@code Object} to a {@code ByteString}
-   * using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @return A function which converts an {@code Object} to a {@code ByteString}
-   *         .
-   */
-  public static Function<Object, ByteString, Void> objectToByteString()
-  {
-    return OBJECT_TO_BYTESTRING;
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as an {@code AttributeDescription} using the default schema.
-   * Invalid values will result in a {@code LocalizedIllegalArgumentException}.
-   *
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as an {@code AttributeDescription}.
-   */
-  public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription()
-  {
-    return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, Schema
-        .getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as an {@code AttributeDescription} using the provided schema.
-   * Invalid values will result in a {@code LocalizedIllegalArgumentException}.
-   *
-   * @param schema
-   *          The schema to use for decoding attribute descriptions.
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as an {@code AttributeDescription}.
-   */
-  public static Function<ByteString, AttributeDescription, Void> valueToAttributeDescription(
-      final Schema schema)
-  {
-    return fixedFunction(BYTESTRING_TO_ATTRIBUTE_DESCRIPTION, schema);
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} to a {@code Boolean}. The function will accept the values
-   * {@code 0}, {@code false}, {@code no}, {@code off}, {@code 1}, {@code true},
-   * {@code yes}, {@code on}. All other values will result in a {@code
-   * NumberFormatException}.
-   *
-   * @return A function which transforms a {@code ByteString} to a {@code
-   *         Boolean}.
-   */
-  public static Function<ByteString, Boolean, Void> valueToBoolean()
-  {
-    return BYTESTRING_TO_BOOLEAN;
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as a {@code DN} using the default schema. Invalid values will
-   * result in a {@code LocalizedIllegalArgumentException}.
-   *
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as an {@code DN}.
-   */
-  public static Function<ByteString, DN, Void> valueToDN()
-  {
-    return fixedFunction(BYTESTRING_TO_DN, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as a {@code DN} using the provided schema. Invalid values will
-   * result in a {@code LocalizedIllegalArgumentException}.
-   *
-   * @param schema
-   *          The schema to use for decoding DNs.
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as an {@code DN}.
-   */
-  public static Function<ByteString, DN, Void> valueToDN(final Schema schema)
-  {
-    return fixedFunction(BYTESTRING_TO_DN, schema);
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as an {@code Integer}. Invalid values will result in a {@code
-   * NumberFormatException}.
-   *
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as an {@code Integer}.
-   */
-  public static Function<ByteString, Integer, Void> valueToInteger()
-  {
-    return BYTESTRING_TO_INTEGER;
-  }
-
-
-
-  /**
-   * Returns a function which parses the string representation of a {@code
-   * ByteString} as a {@code Long}. Invalid values will result in a {@code
-   * NumberFormatException}.
-   *
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as a {@code Long}.
-   */
-  public static Function<ByteString, Long, Void> valueToLong()
-  {
-    return BYTESTRING_TO_LONG;
-  }
-
-
-
-  /**
-   * Returns a function which parses a {@code ByteString} as a UTF-8 encoded
-   * {@code String}.
-   *
-   * @return A function which parses the string representation of a {@code
-   *         ByteString} as a UTF-8 encoded {@code String}.
-   */
-  public static Function<ByteString, String, Void> valueToString()
-  {
-    return BYTESTRING_TO_STRING;
-  }
-
-
-
-  // Prevent instantiation
-  private Functions()
-  {
-    // Do nothing.
-  }
+    // Prevent instantiation
+    private Functions() {
+        // Do nothing.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/FutureResultTransformer.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/FutureResultTransformer.java
index a47fa1e..c68229d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/FutureResultTransformer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/FutureResultTransformer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
@@ -36,208 +33,156 @@
 import org.forgerock.opendj.ldap.FutureResult;
 import org.forgerock.opendj.ldap.ResultHandler;
 
-
-
 /**
  * An implementation of the {@code FutureResult} interface which transforms the
  * result of an asynchronous operation from one type to another. The
  * implementation ensures that the transformed is computed only once.
  *
  * @param <M>
- *          The type of the inner result.
+ *            The type of the inner result.
  * @param <N>
- *          The type of the outer result.
+ *            The type of the outer result.
  */
-public abstract class FutureResultTransformer<M, N> implements FutureResult<N>,
-    ResultHandler<M>
-{
+public abstract class FutureResultTransformer<M, N> implements FutureResult<N>, ResultHandler<M> {
 
-  private final ResultHandler<? super N> handler;
+    private final ResultHandler<? super N> handler;
 
-  private volatile FutureResult<? extends M> future = null;
+    private volatile FutureResult<? extends M> future = null;
 
-  // These do not need to be volatile since the future acts as a memory
-  // barrier.
-  private N transformedResult = null;
+    // These do not need to be volatile since the future acts as a memory
+    // barrier.
+    private N transformedResult = null;
 
-  private ErrorResultException transformedErrorResult = null;
+    private ErrorResultException transformedErrorResult = null;
 
-
-
-  /**
-   * Creates a new result transformer which will transform the results of an
-   * inner asynchronous request.
-   *
-   * @param handler
-   *          The outer result handler.
-   */
-  protected FutureResultTransformer(final ResultHandler<? super N> handler)
-  {
-    this.handler = handler;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean cancel(final boolean mayInterruptIfRunning)
-  {
-    return future.cancel(mayInterruptIfRunning);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final N get() throws ErrorResultException, InterruptedException
-  {
-    future.get();
-
-    // The handlers are guaranteed to have been invoked at this point.
-    return get0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final N get(final long timeout, final TimeUnit unit)
-      throws ErrorResultException, TimeoutException, InterruptedException
-  {
-    future.get(timeout, unit);
-
-    // The handlers are guaranteed to have been invoked at this point.
-    return get0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final int getRequestID()
-  {
-    return future.getRequestID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final void handleErrorResult(final ErrorResultException error)
-  {
-    transformedErrorResult = transformErrorResult(error);
-    if (handler != null)
-    {
-      handler.handleErrorResult(transformedErrorResult);
+    /**
+     * Creates a new result transformer which will transform the results of an
+     * inner asynchronous request.
+     *
+     * @param handler
+     *            The outer result handler.
+     */
+    protected FutureResultTransformer(final ResultHandler<? super N> handler) {
+        this.handler = handler;
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final void handleResult(final M result)
-  {
-    try
-    {
-      transformedResult = transformResult(result);
-      if (handler != null)
-      {
-        handler.handleResult(transformedResult);
-      }
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean cancel(final boolean mayInterruptIfRunning) {
+        return future.cancel(mayInterruptIfRunning);
     }
-    catch (final ErrorResultException e)
-    {
-      transformedErrorResult = e;
-      if (handler != null)
-      {
-        handler.handleErrorResult(transformedErrorResult);
-      }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final N get() throws ErrorResultException, InterruptedException {
+        future.get();
+
+        // The handlers are guaranteed to have been invoked at this point.
+        return get0();
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final N get(final long timeout, final TimeUnit unit) throws ErrorResultException,
+            TimeoutException, InterruptedException {
+        future.get(timeout, unit);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isCancelled()
-  {
-    return future.isCancelled();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isDone()
-  {
-    return future.isDone();
-  }
-
-
-
-  /**
-   * Sets the inner future for this result transformer. This must be done before
-   * this future is published.
-   *
-   * @param future
-   *          The inner future.
-   */
-  public final void setFutureResult(final FutureResult<? extends M> future)
-  {
-    this.future = future;
-  }
-
-
-
-  /**
-   * Transforms the inner error result to an outer error result. The default
-   * implementation is to return the inner error result.
-   *
-   * @param errorResult
-   *          The inner error result.
-   * @return The outer error result.
-   */
-  protected ErrorResultException transformErrorResult(
-      final ErrorResultException errorResult)
-  {
-    return errorResult;
-  }
-
-
-
-  /**
-   * Transforms the inner result to an outer result, possibly throwing an
-   * {@code ErrorResultException} if the transformation fails for some reason.
-   *
-   * @param result
-   *          The inner result.
-   * @return The outer result.
-   * @throws ErrorResultException
-   *           If the transformation fails for some reason.
-   */
-  protected abstract N transformResult(M result) throws ErrorResultException;
-
-
-
-  private N get0() throws ErrorResultException
-  {
-    if (transformedErrorResult != null)
-    {
-      throw transformedErrorResult;
+        // The handlers are guaranteed to have been invoked at this point.
+        return get0();
     }
-    else
-    {
-      return transformedResult;
+
+    /**
+     * {@inheritDoc}
+     */
+    public final int getRequestID() {
+        return future.getRequestID();
     }
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final void handleErrorResult(final ErrorResultException error) {
+        transformedErrorResult = transformErrorResult(error);
+        if (handler != null) {
+            handler.handleErrorResult(transformedErrorResult);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final void handleResult(final M result) {
+        try {
+            transformedResult = transformResult(result);
+            if (handler != null) {
+                handler.handleResult(transformedResult);
+            }
+        } catch (final ErrorResultException e) {
+            transformedErrorResult = e;
+            if (handler != null) {
+                handler.handleErrorResult(transformedErrorResult);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isCancelled() {
+        return future.isCancelled();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isDone() {
+        return future.isDone();
+    }
+
+    /**
+     * Sets the inner future for this result transformer. This must be done
+     * before this future is published.
+     *
+     * @param future
+     *            The inner future.
+     */
+    public final void setFutureResult(final FutureResult<? extends M> future) {
+        this.future = future;
+    }
+
+    /**
+     * Transforms the inner error result to an outer error result. The default
+     * implementation is to return the inner error result.
+     *
+     * @param errorResult
+     *            The inner error result.
+     * @return The outer error result.
+     */
+    protected ErrorResultException transformErrorResult(final ErrorResultException errorResult) {
+        return errorResult;
+    }
+
+    /**
+     * Transforms the inner result to an outer result, possibly throwing an
+     * {@code ErrorResultException} if the transformation fails for some reason.
+     *
+     * @param result
+     *            The inner result.
+     * @return The outer result.
+     * @throws ErrorResultException
+     *             If the transformation fails for some reason.
+     */
+    protected abstract N transformResult(M result) throws ErrorResultException;
+
+    private N get0() throws ErrorResultException {
+        if (transformedErrorResult != null) {
+            throw transformedErrorResult;
+        } else {
+            return transformedResult;
+        }
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
index 0f6d677..a02151b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterables.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,367 +26,283 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.Iterator;
 
-
-
 /**
  * Utility methods for manipulating {@link Iterable}s.
  */
-public final class Iterables
-{
-  private static final class ArrayIterable<M> implements Iterable<M>
-  {
+public final class Iterables {
+    private static final class ArrayIterable<M> implements Iterable<M> {
 
-    private final M[] a;
+        private final M[] a;
 
+        // Constructed via factory methods.
+        private ArrayIterable(final M[] a) {
+            this.a = a;
+        }
 
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<M> iterator() {
+            return Iterators.arrayIterator(a);
+        }
 
-    // Constructed via factory methods.
-    private ArrayIterable(final M[] a)
-    {
-      this.a = a;
     }
 
+    private static final class EmptyIterable<M> implements Iterable<M> {
 
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<M> iterator() {
+            return Iterators.emptyIterator();
+        }
+
+    }
+
+    private static final class FilteredIterable<M, P> implements Iterable<M> {
+
+        private final Iterable<M> iterable;
+        private final P parameter;
+        private final Predicate<? super M, P> predicate;
+
+        // Constructed via factory methods.
+        private FilteredIterable(final Iterable<M> iterable,
+                final Predicate<? super M, P> predicate, final P p) {
+            this.iterable = iterable;
+            this.predicate = predicate;
+            this.parameter = p;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<M> iterator() {
+            return Iterators.filteredIterator(iterable.iterator(), predicate, parameter);
+        }
+
+    }
+
+    private static final class SingletonIterable<M> implements Iterable<M> {
+
+        private final M value;
+
+        // Constructed via factory methods.
+        private SingletonIterable(final M value) {
+            this.value = value;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<M> iterator() {
+            return Iterators.singletonIterator(value);
+        }
+
+    }
+
+    private static final class TransformedIterable<M, N, P> implements Iterable<N> {
+
+        private final Function<? super M, ? extends N, P> function;
+        private final Iterable<M> iterable;
+        private final P parameter;
+
+        // Constructed via factory methods.
+        private TransformedIterable(final Iterable<M> iterable,
+                final Function<? super M, ? extends N, P> function, final P p) {
+            this.iterable = iterable;
+            this.function = function;
+            this.parameter = p;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<N> iterator() {
+            return Iterators.transformedIterator(iterable.iterator(), function, parameter);
+        }
+
+    }
+
+    private static final class UnmodifiableIterable<M> implements Iterable<M> {
+
+        private final Iterable<M> iterable;
+
+        // Constructed via factory methods.
+        private UnmodifiableIterable(final Iterable<M> iterable) {
+            this.iterable = iterable;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Iterator<M> iterator() {
+            return Iterators.unmodifiableIterator(iterable.iterator());
+        }
+
+    }
+
+    private static final Iterable<Object> EMPTY_ITERABLE = new EmptyIterable<Object>();
 
     /**
-     * {@inheritDoc}
+     * Returns an iterable containing the elements of {@code a}. The returned
+     * iterable's iterator does not support element removal via the
+     * {@code remove()} method.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code a}.
+     * @param a
+     *            The array of elements.
+     * @return An iterable containing the elements of {@code a}.
      */
-    public Iterator<M> iterator()
-    {
-      return Iterators.arrayIterator(a);
+    public static <M> Iterable<M> arrayIterable(final M[] a) {
+        return new ArrayIterable<M>(a);
     }
 
-  }
-
-
-
-  private static final class EmptyIterable<M> implements Iterable<M>
-  {
-
     /**
-     * {@inheritDoc}
+     * Returns an immutable empty iterable.
+     *
+     * @param <M>
+     *            The required type of the empty iterable.
+     * @return An immutable empty iterable.
      */
-    public Iterator<M> iterator()
-    {
-      return Iterators.emptyIterator();
+    @SuppressWarnings("unchecked")
+    public static <M> Iterable<M> emptyIterable() {
+        return (Iterable<M>) EMPTY_ITERABLE;
     }
 
-  }
-
-
-
-  private static final class FilteredIterable<M, P> implements Iterable<M>
-  {
-
-    private final Iterable<M> iterable;
-    private final P parameter;
-    private final Predicate<? super M, P> predicate;
-
-
-
-    // Constructed via factory methods.
-    private FilteredIterable(final Iterable<M> iterable,
-        final Predicate<? super M, P> predicate, final P p)
-    {
-      this.iterable = iterable;
-      this.predicate = predicate;
-      this.parameter = p;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns a filtered view of {@code iterable} containing only those
+     * elements which match {@code predicate}. The returned iterable's iterator
+     * supports element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterable}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterable}.
+     * @param <P>
+     *            The type of the additional parameter to the predicate's
+     *            {@code matches} method. Use {@link java.lang.Void} for
+     *            predicates that do not need an additional parameter.
+     * @param iterable
+     *            The iterable to be filtered.
+     * @param predicate
+     *            The predicate.
+     * @param p
+     *            A predicate specified parameter.
+     * @return A filtered view of {@code iterable} containing only those
+     *         elements which match {@code predicate}.
      */
-    public Iterator<M> iterator()
-    {
-      return Iterators.filteredIterator(iterable.iterator(), predicate, parameter);
+    public static <M, P> Iterable<M> filteredIterable(final Iterable<M> iterable,
+            final Predicate<? super M, P> predicate, final P p) {
+        return new FilteredIterable<M, P>(iterable, predicate, p);
     }
 
-  }
-
-
-
-  private static final class SingletonIterable<M> implements Iterable<M>
-  {
-
-    private final M value;
-
-
-
-    // Constructed via factory methods.
-    private SingletonIterable(final M value)
-    {
-      this.value = value;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns a filtered view of {@code iterable} containing only those
+     * elements which match {@code predicate}. The returned iterable's iterator
+     * supports element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterable}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterable}.
+     * @param iterable
+     *            The iterable to be filtered.
+     * @param predicate
+     *            The predicate.
+     * @return A filtered view of {@code iterable} containing only those
+     *         elements which match {@code predicate}.
      */
-    public Iterator<M> iterator()
-    {
-      return Iterators.singletonIterator(value);
+    public static <M> Iterable<M> filteredIterable(final Iterable<M> iterable,
+            final Predicate<? super M, Void> predicate) {
+        return new FilteredIterable<M, Void>(iterable, predicate, null);
     }
 
-  }
-
-
-
-  private static final class TransformedIterable<M, N, P> implements
-      Iterable<N>
-  {
-
-    private final Function<? super M, ? extends N, P> function;
-    private final Iterable<M> iterable;
-    private final P parameter;
-
-
-
-    // Constructed via factory methods.
-    private TransformedIterable(final Iterable<M> iterable,
-        final Function<? super M, ? extends N, P> function, final P p)
-    {
-      this.iterable = iterable;
-      this.function = function;
-      this.parameter = p;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns an iterable containing the single element {@code value}. The
+     * returned iterable's iterator does not support element removal via the
+     * {@code remove()} method.
+     *
+     * @param <M>
+     *            The type of the single element {@code value}.
+     * @param value
+     *            The single element.
+     * @return An iterable containing the single element {@code value}.
      */
-    public Iterator<N> iterator()
-    {
-      return Iterators.transformedIterator(iterable.iterator(), function, parameter);
+    public static <M> Iterable<M> singletonIterable(final M value) {
+        return new SingletonIterable<M>(value);
     }
 
-  }
-
-
-
-  private static final class UnmodifiableIterable<M> implements Iterable<M>
-  {
-
-    private final Iterable<M> iterable;
-
-
-
-    // Constructed via factory methods.
-    private UnmodifiableIterable(final Iterable<M> iterable)
-    {
-      this.iterable = iterable;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code iterable} whose values have been mapped to
+     * elements of type {@code N} using {@code function}. The returned
+     * iterable's iterator supports element removal via the {@code remove()}
+     * method subject to any constraints imposed by {@code iterable}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterable}.
+     * @param <N>
+     *            The type of elements contained in the returned iterable.
+     * @param <P>
+     *            The type of the additional parameter to the function's
+     *            {@code apply} method. Use {@link java.lang.Void} for functions
+     *            that do not need an additional parameter.
+     * @param iterable
+     *            The iterable to be transformed.
+     * @param function
+     *            The function.
+     * @param p
+     *            A predicate specified parameter.
+     * @return A view of {@code iterable} whose values have been mapped to
+     *         elements of type {@code N} using {@code function}.
      */
-    public Iterator<M> iterator()
-    {
-      return Iterators.unmodifiableIterator(iterable.iterator());
+    public static <M, N, P> Iterable<N> transformedIterable(final Iterable<M> iterable,
+            final Function<? super M, ? extends N, P> function, final P p) {
+        return new TransformedIterable<M, N, P>(iterable, function, p);
     }
 
-  }
+    /**
+     * Returns a view of {@code iterable} whose values have been mapped to
+     * elements of type {@code N} using {@code function}. The returned
+     * iterable's iterator supports element removal via the {@code remove()}
+     * method subject to any constraints imposed by {@code iterable}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterable}.
+     * @param <N>
+     *            The type of elements contained in the returned iterable.
+     * @param iterable
+     *            The iterable to be transformed.
+     * @param function
+     *            The function.
+     * @return A view of {@code iterable} whose values have been mapped to
+     *         elements of type {@code N} using {@code function}.
+     */
+    public static <M, N> Iterable<N> transformedIterable(final Iterable<M> iterable,
+            final Function<? super M, ? extends N, Void> function) {
+        return new TransformedIterable<M, N, Void>(iterable, function, null);
+    }
 
+    /**
+     * Returns a read-only view of {@code iterable} whose iterator does not
+     * support element removal via the {@code remove()}. Attempts to use the
+     * {@code remove()} method will result in a
+     * {@code UnsupportedOperationException}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterable}.
+     * @param iterable
+     *            The iterable to be made read-only.
+     * @return A read-only view of {@code iterable} whose iterator does not
+     *         support element removal via the {@code remove()}.
+     */
+    public static <M> Iterable<M> unmodifiableIterable(final Iterable<M> iterable) {
+        return new UnmodifiableIterable<M>(iterable);
+    }
 
-
-  private static final Iterable<Object> EMPTY_ITERABLE = new EmptyIterable<Object>();
-
-
-
-  /**
-   * Returns an iterable containing the elements of {@code a}. The returned
-   * iterable's iterator does not support element removal via the
-   * {@code remove()} method.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code a}.
-   * @param a
-   *          The array of elements.
-   * @return An iterable containing the elements of {@code a}.
-   */
-  public static <M> Iterable<M> arrayIterable(final M[] a)
-  {
-    return new ArrayIterable<M>(a);
-  }
-
-
-
-  /**
-   * Returns an immutable empty iterable.
-   *
-   * @param <M>
-   *          The required type of the empty iterable.
-   * @return An immutable empty iterable.
-   */
-  @SuppressWarnings("unchecked")
-  public static <M> Iterable<M> emptyIterable()
-  {
-    return (Iterable<M>) EMPTY_ITERABLE;
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code iterable} containing only those elements
-   * which match {@code predicate}. The returned iterable's iterator supports
-   * element removal via the {@code remove()} method subject to any constraints
-   * imposed by {@code iterable}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterable}.
-   * @param <P>
-   *          The type of the additional parameter to the predicate's
-   *          {@code matches} method. Use {@link java.lang.Void} for predicates
-   *          that do not need an additional parameter.
-   * @param iterable
-   *          The iterable to be filtered.
-   * @param predicate
-   *          The predicate.
-   * @param p
-   *          A predicate specified parameter.
-   * @return A filtered view of {@code iterable} containing only those elements
-   *         which match {@code predicate}.
-   */
-  public static <M, P> Iterable<M> filteredIterable(final Iterable<M> iterable,
-      final Predicate<? super M, P> predicate, final P p)
-  {
-    return new FilteredIterable<M, P>(iterable, predicate, p);
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code iterable} containing only those elements
-   * which match {@code predicate}. The returned iterable's iterator supports
-   * element removal via the {@code remove()} method subject to any constraints
-   * imposed by {@code iterable}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterable}.
-   * @param iterable
-   *          The iterable to be filtered.
-   * @param predicate
-   *          The predicate.
-   * @return A filtered view of {@code iterable} containing only those elements
-   *         which match {@code predicate}.
-   */
-  public static <M> Iterable<M> filteredIterable(final Iterable<M> iterable,
-      final Predicate<? super M, Void> predicate)
-  {
-    return new FilteredIterable<M, Void>(iterable, predicate, null);
-  }
-
-
-
-  /**
-   * Returns an iterable containing the single element {@code value}. The
-   * returned iterable's iterator does not support element removal via the
-   * {@code remove()} method.
-   *
-   * @param <M>
-   *          The type of the single element {@code value}.
-   * @param value
-   *          The single element.
-   * @return An iterable containing the single element {@code value}.
-   */
-  public static <M> Iterable<M> singletonIterable(final M value)
-  {
-    return new SingletonIterable<M>(value);
-  }
-
-
-
-  /**
-   * Returns a view of {@code iterable} whose values have been mapped to
-   * elements of type {@code N} using {@code function}. The returned iterable's
-   * iterator supports element removal via the {@code remove()} method subject
-   * to any constraints imposed by {@code iterable}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterable}.
-   * @param <N>
-   *          The type of elements contained in the returned iterable.
-   * @param <P>
-   *          The type of the additional parameter to the function's
-   *          {@code apply} method. Use {@link java.lang.Void} for functions
-   *          that do not need an additional parameter.
-   * @param iterable
-   *          The iterable to be transformed.
-   * @param function
-   *          The function.
-   * @param p
-   *          A predicate specified parameter.
-   * @return A view of {@code iterable} whose values have been mapped to
-   *         elements of type {@code N} using {@code function}.
-   */
-  public static <M, N, P> Iterable<N> transformedIterable(
-      final Iterable<M> iterable,
-      final Function<? super M, ? extends N, P> function, final P p)
-  {
-    return new TransformedIterable<M, N, P>(iterable, function, p);
-  }
-
-
-
-  /**
-   * Returns a view of {@code iterable} whose values have been mapped to
-   * elements of type {@code N} using {@code function}. The returned iterable's
-   * iterator supports element removal via the {@code remove()} method subject
-   * to any constraints imposed by {@code iterable}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterable}.
-   * @param <N>
-   *          The type of elements contained in the returned iterable.
-   * @param iterable
-   *          The iterable to be transformed.
-   * @param function
-   *          The function.
-   * @return A view of {@code iterable} whose values have been mapped to
-   *         elements of type {@code N} using {@code function}.
-   */
-  public static <M, N> Iterable<N> transformedIterable(
-      final Iterable<M> iterable,
-      final Function<? super M, ? extends N, Void> function)
-  {
-    return new TransformedIterable<M, N, Void>(iterable, function, null);
-  }
-
-
-
-  /**
-   * Returns a read-only view of {@code iterable} whose iterator does not
-   * support element removal via the {@code remove()}. Attempts to use the
-   * {@code remove()} method will result in a
-   * {@code UnsupportedOperationException}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterable}.
-   * @param iterable
-   *          The iterable to be made read-only.
-   * @return A read-only view of {@code iterable} whose iterator does not
-   *         support element removal via the {@code remove()}.
-   */
-  public static <M> Iterable<M> unmodifiableIterable(final Iterable<M> iterable)
-  {
-    return new UnmodifiableIterable<M>(iterable);
-  }
-
-
-
-  // Prevent instantiation
-  private Iterables()
-  {
-    // Do nothing.
-  }
+    // Prevent instantiation
+    private Iterables() {
+        // Do nothing.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
index 0080e5e..d36925f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Iterators.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,521 +26,391 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
-
-
 /**
  * Utility methods for manipulating {@link Iterator}s.
  */
-public final class Iterators
-{
-  private static final class ArrayIterator<M> implements Iterator<M>
-  {
-    private int i = 0;
-    private final M[] a;
+public final class Iterators {
+    private static final class ArrayIterator<M> implements Iterator<M> {
+        private int i = 0;
+        private final M[] a;
 
-
-
-    // Constructed via factory methods.
-    private ArrayIterator(final M[] a)
-    {
-      this.a = a;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasNext()
-    {
-      return i < a.length;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public M next()
-    {
-      if (hasNext())
-      {
-        return a[i++];
-      }
-      else
-      {
-        throw new NoSuchElementException();
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void remove()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-  };
-
-
-
-  private static final class EmptyIterator<M> implements Iterator<M>
-  {
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasNext()
-    {
-      return false;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public M next()
-    {
-      throw new NoSuchElementException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void remove()
-    {
-      throw new UnsupportedOperationException();
-    }
-  }
-
-
-
-  private static final class FilteredIterator<M, P> implements Iterator<M>
-  {
-
-    private boolean hasNextMustIterate = true;
-    private final Iterator<M> iterator;
-    private M next = null;
-
-    private final P parameter;
-    private final Predicate<? super M, P> predicate;
-
-
-
-    // Constructed via factory methods.
-    private FilteredIterator(final Iterator<M> iterator,
-        final Predicate<? super M, P> predicate, final P p)
-    {
-      this.iterator = iterator;
-      this.predicate = predicate;
-      this.parameter = p;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasNext()
-    {
-      if (hasNextMustIterate)
-      {
-        hasNextMustIterate = false;
-        while (iterator.hasNext())
-        {
-          next = iterator.next();
-          if (predicate.matches(next, parameter))
-          {
-            return true;
-          }
+        // Constructed via factory methods.
+        private ArrayIterator(final M[] a) {
+            this.a = a;
         }
-        next = null;
-        return false;
-      }
-      else
-      {
-        return next != null;
-      }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return i < a.length;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public M next() {
+            if (hasNext()) {
+                return a[i++];
+            } else {
+                throw new NoSuchElementException();
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    };
+
+    private static final class EmptyIterator<M> implements Iterator<M> {
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return false;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public M next() {
+            throw new NoSuchElementException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
     }
 
+    private static final class FilteredIterator<M, P> implements Iterator<M> {
 
+        private boolean hasNextMustIterate = true;
+        private final Iterator<M> iterator;
+        private M next = null;
+
+        private final P parameter;
+        private final Predicate<? super M, P> predicate;
+
+        // Constructed via factory methods.
+        private FilteredIterator(final Iterator<M> iterator,
+                final Predicate<? super M, P> predicate, final P p) {
+            this.iterator = iterator;
+            this.predicate = predicate;
+            this.parameter = p;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            if (hasNextMustIterate) {
+                hasNextMustIterate = false;
+                while (iterator.hasNext()) {
+                    next = iterator.next();
+                    if (predicate.matches(next, parameter)) {
+                        return true;
+                    }
+                }
+                next = null;
+                return false;
+            } else {
+                return next != null;
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public M next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            hasNextMustIterate = true;
+            return next;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            iterator.remove();
+        }
+
+    }
+
+    private static final class SingletonIterator<M> implements Iterator<M> {
+        private M value;
+
+        // Constructed via factory methods.
+        private SingletonIterator(final M value) {
+            this.value = value;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return value != null;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public M next() {
+            if (value != null) {
+                final M tmp = value;
+                value = null;
+                return tmp;
+            } else {
+                throw new NoSuchElementException();
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+    private static final class TransformedIterator<M, N, P> implements Iterator<N> {
+
+        private final Function<? super M, ? extends N, P> function;
+        private final Iterator<M> iterator;
+        private final P parameter;
+
+        // Constructed via factory methods.
+        private TransformedIterator(final Iterator<M> iterator,
+                final Function<? super M, ? extends N, P> function, final P p) {
+            this.iterator = iterator;
+            this.function = function;
+            this.parameter = p;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return iterator.hasNext();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public N next() {
+            return function.apply(iterator.next(), parameter);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            iterator.remove();
+        }
+
+    }
+
+    private static final class UnmodifiableIterator<M> implements Iterator<M> {
+        private final Iterator<M> iterator;
+
+        private UnmodifiableIterator(final Iterator<M> iterator) {
+            this.iterator = iterator;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return iterator.hasNext();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public M next() {
+            return iterator.next();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private static final Iterator<Object> EMPTY_ITERATOR = new EmptyIterator<Object>();
 
     /**
-     * {@inheritDoc}
+     * Returns an iterator over the elements contained in {@code a}. The
+     * returned iterator does not support element removal via the
+     * {@code remove()} method.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code a}.
+     * @param a
+     *            The array of elements to be returned by the iterator.
+     * @return An iterator over the elements contained in {@code a}.
      */
-    public M next()
-    {
-      if (!hasNext())
-      {
-        throw new NoSuchElementException();
-      }
-      hasNextMustIterate = true;
-      return next;
+    public static <M> Iterator<M> arrayIterator(final M[] a) {
+        return new ArrayIterator<M>(a);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns an immutable empty iterator.
+     *
+     * @param <M>
+     *            The required type of the empty iterator.
+     * @return An immutable empty iterator.
      */
-    public void remove()
-    {
-      iterator.remove();
+    @SuppressWarnings("unchecked")
+    public static <M> Iterator<M> emptyIterator() {
+        return (Iterator<M>) EMPTY_ITERATOR;
     }
 
-  }
-
-
-
-  private static final class SingletonIterator<M> implements Iterator<M>
-  {
-    private M value;
-
-
-
-    // Constructed via factory methods.
-    private SingletonIterator(final M value)
-    {
-      this.value = value;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns a filtered view of {@code iterator} containing only those
+     * elements which match {@code predicate}. The returned iterator supports
+     * element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterator}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterator}.
+     * @param <P>
+     *            The type of the additional parameter to the predicate's
+     *            {@code matches} method. Use {@link java.lang.Void} for
+     *            predicates that do not need an additional parameter.
+     * @param iterator
+     *            The iterator to be filtered.
+     * @param predicate
+     *            The predicate.
+     * @param p
+     *            A predicate specified parameter.
+     * @return A filtered view of {@code iterator} containing only those
+     *         elements which match {@code predicate}.
      */
-    public boolean hasNext()
-    {
-      return value != null;
+    public static <M, P> Iterator<M> filteredIterator(final Iterator<M> iterator,
+            final Predicate<? super M, P> predicate, final P p) {
+        return new FilteredIterator<M, P>(iterator, predicate, p);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns a filtered view of {@code iterator} containing only those
+     * elements which match {@code predicate}. The returned iterator supports
+     * element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterator}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterator}.
+     * @param iterator
+     *            The iterator to be filtered.
+     * @param predicate
+     *            The predicate.
+     * @return A filtered view of {@code iterator} containing only those
+     *         elements which match {@code predicate}.
      */
-    public M next()
-    {
-      if (value != null)
-      {
-        final M tmp = value;
-        value = null;
-        return tmp;
-      }
-      else
-      {
-        throw new NoSuchElementException();
-      }
+    public static <M> Iterator<M> filteredIterator(final Iterator<M> iterator,
+            final Predicate<? super M, Void> predicate) {
+        return new FilteredIterator<M, Void>(iterator, predicate, null);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns an iterator containing the single element {@code value}. The
+     * returned iterator does not support element removal via the
+     * {@code remove()} method.
+     *
+     * @param <M>
+     *            The type of the single element {@code value}.
+     * @param value
+     *            The single element to be returned by the iterator.
+     * @return An iterator containing the single element {@code value}.
      */
-    public void remove()
-    {
-      throw new UnsupportedOperationException();
+    public static <M> Iterator<M> singletonIterator(final M value) {
+        return new SingletonIterator<M>(value);
     }
 
-  }
-
-
-
-  private static final class TransformedIterator<M, N, P> implements
-      Iterator<N>
-  {
-
-    private final Function<? super M, ? extends N, P> function;
-    private final Iterator<M> iterator;
-    private final P parameter;
-
-
-
-    // Constructed via factory methods.
-    private TransformedIterator(final Iterator<M> iterator,
-        final Function<? super M, ? extends N, P> function, final P p)
-    {
-      this.iterator = iterator;
-      this.function = function;
-      this.parameter = p;
-    }
-
-
-
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code iterator} whose values have been mapped to
+     * elements of type {@code N} using {@code function}. The returned iterator
+     * supports element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterator}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterator}.
+     * @param <N>
+     *            The type of elements contained in the returned iterator.
+     * @param <P>
+     *            The type of the additional parameter to the function's
+     *            {@code apply} method. Use {@link java.lang.Void} for functions
+     *            that do not need an additional parameter.
+     * @param iterator
+     *            The iterator to be transformed.
+     * @param function
+     *            The function.
+     * @param p
+     *            A predicate specified parameter.
+     * @return A view of {@code iterator} whose values have been mapped to
+     *         elements of type {@code N} using {@code function}.
      */
-    public boolean hasNext()
-    {
-      return iterator.hasNext();
+    public static <M, N, P> Iterator<N> transformedIterator(final Iterator<M> iterator,
+            final Function<? super M, ? extends N, P> function, final P p) {
+        return new TransformedIterator<M, N, P>(iterator, function, p);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns a view of {@code iterator} whose values have been mapped to
+     * elements of type {@code N} using {@code function}. The returned iterator
+     * supports element removal via the {@code remove()} method subject to any
+     * constraints imposed by {@code iterator}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterator}.
+     * @param <N>
+     *            The type of elements contained in the returned iterator.
+     * @param iterator
+     *            The iterator to be transformed.
+     * @param function
+     *            The function.
+     * @return A view of {@code iterator} whose values have been mapped to
+     *         elements of type {@code N} using {@code function}.
      */
-    public N next()
-    {
-      return function.apply(iterator.next(), parameter);
+    public static <M, N> Iterator<N> transformedIterator(final Iterator<M> iterator,
+            final Function<? super M, ? extends N, Void> function) {
+        return new TransformedIterator<M, N, Void>(iterator, function, null);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns a read-only view of {@code iterator} which does not support
+     * element removal via the {@code remove()}. Attempts to use the
+     * {@code remove()} method will result in a
+     * {@code UnsupportedOperationException}.
+     *
+     * @param <M>
+     *            The type of elements contained in {@code iterator}.
+     * @param iterator
+     *            The iterator to be made read-only.
+     * @return A read-only view of {@code iterator} which does not support
+     *         element removal via the {@code remove()}.
      */
-    public void remove()
-    {
-      iterator.remove();
+    public static <M> Iterator<M> unmodifiableIterator(final Iterator<M> iterator) {
+        return new UnmodifiableIterator<M>(iterator);
     }
 
-  }
-
-
-
-  private static final class UnmodifiableIterator<M> implements Iterator<M>
-  {
-    private final Iterator<M> iterator;
-
-
-
-    private UnmodifiableIterator(final Iterator<M> iterator)
-    {
-      this.iterator = iterator;
+    // Prevent instantiation
+    private Iterators() {
+        // Do nothing.
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasNext()
-    {
-      return iterator.hasNext();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public M next()
-    {
-      return iterator.next();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void remove()
-    {
-      throw new UnsupportedOperationException();
-    }
-  }
-
-
-
-  private static final Iterator<Object> EMPTY_ITERATOR = new EmptyIterator<Object>();
-
-
-
-  /**
-   * Returns an iterator over the elements contained in {@code a}. The returned
-   * iterator does not support element removal via the {@code remove()} method.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code a}.
-   * @param a
-   *          The array of elements to be returned by the iterator.
-   * @return An iterator over the elements contained in {@code a}.
-   */
-  public static <M> Iterator<M> arrayIterator(final M[] a)
-  {
-    return new ArrayIterator<M>(a);
-  }
-
-
-
-  /**
-   * Returns an immutable empty iterator.
-   *
-   * @param <M>
-   *          The required type of the empty iterator.
-   * @return An immutable empty iterator.
-   */
-  @SuppressWarnings("unchecked")
-  public static <M> Iterator<M> emptyIterator()
-  {
-    return (Iterator<M>) EMPTY_ITERATOR;
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code iterator} containing only those elements
-   * which match {@code predicate}. The returned iterator supports element
-   * removal via the {@code remove()} method subject to any constraints imposed
-   * by {@code iterator}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterator}.
-   * @param <P>
-   *          The type of the additional parameter to the predicate's
-   *          {@code matches} method. Use {@link java.lang.Void} for predicates
-   *          that do not need an additional parameter.
-   * @param iterator
-   *          The iterator to be filtered.
-   * @param predicate
-   *          The predicate.
-   * @param p
-   *          A predicate specified parameter.
-   * @return A filtered view of {@code iterator} containing only those elements
-   *         which match {@code predicate}.
-   */
-  public static <M, P> Iterator<M> filteredIterator(final Iterator<M> iterator,
-      final Predicate<? super M, P> predicate, final P p)
-  {
-    return new FilteredIterator<M, P>(iterator, predicate, p);
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code iterator} containing only those elements
-   * which match {@code predicate}. The returned iterator supports element
-   * removal via the {@code remove()} method subject to any constraints imposed
-   * by {@code iterator}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterator}.
-   * @param iterator
-   *          The iterator to be filtered.
-   * @param predicate
-   *          The predicate.
-   * @return A filtered view of {@code iterator} containing only those elements
-   *         which match {@code predicate}.
-   */
-  public static <M> Iterator<M> filteredIterator(final Iterator<M> iterator,
-      final Predicate<? super M, Void> predicate)
-  {
-    return new FilteredIterator<M, Void>(iterator, predicate, null);
-  }
-
-
-
-  /**
-   * Returns an iterator containing the single element {@code value}. The
-   * returned iterator does not support element removal via the {@code remove()}
-   * method.
-   *
-   * @param <M>
-   *          The type of the single element {@code value}.
-   * @param value
-   *          The single element to be returned by the iterator.
-   * @return An iterator containing the single element {@code value}.
-   */
-  public static <M> Iterator<M> singletonIterator(final M value)
-  {
-    return new SingletonIterator<M>(value);
-  }
-
-
-
-  /**
-   * Returns a view of {@code iterator} whose values have been mapped to
-   * elements of type {@code N} using {@code function}. The returned iterator
-   * supports element removal via the {@code remove()} method subject to any
-   * constraints imposed by {@code iterator}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterator}.
-   * @param <N>
-   *          The type of elements contained in the returned iterator.
-   * @param <P>
-   *          The type of the additional parameter to the function's
-   *          {@code apply} method. Use {@link java.lang.Void} for functions
-   *          that do not need an additional parameter.
-   * @param iterator
-   *          The iterator to be transformed.
-   * @param function
-   *          The function.
-   * @param p
-   *          A predicate specified parameter.
-   * @return A view of {@code iterator} whose values have been mapped to
-   *         elements of type {@code N} using {@code function}.
-   */
-  public static <M, N, P> Iterator<N> transformedIterator(
-      final Iterator<M> iterator,
-      final Function<? super M, ? extends N, P> function, final P p)
-  {
-    return new TransformedIterator<M, N, P>(iterator, function, p);
-  }
-
-
-
-  /**
-   * Returns a view of {@code iterator} whose values have been mapped to
-   * elements of type {@code N} using {@code function}. The returned iterator
-   * supports element removal via the {@code remove()} method subject to any
-   * constraints imposed by {@code iterator}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterator}.
-   * @param <N>
-   *          The type of elements contained in the returned iterator.
-   * @param iterator
-   *          The iterator to be transformed.
-   * @param function
-   *          The function.
-   * @return A view of {@code iterator} whose values have been mapped to
-   *         elements of type {@code N} using {@code function}.
-   */
-  public static <M, N> Iterator<N> transformedIterator(
-      final Iterator<M> iterator,
-      final Function<? super M, ? extends N, Void> function)
-  {
-    return new TransformedIterator<M, N, Void>(iterator, function, null);
-  }
-
-
-
-  /**
-   * Returns a read-only view of {@code iterator} which does not support element
-   * removal via the {@code remove()}. Attempts to use the {@code remove()}
-   * method will result in a {@code UnsupportedOperationException}.
-   *
-   * @param <M>
-   *          The type of elements contained in {@code iterator}.
-   * @param iterator
-   *          The iterator to be made read-only.
-   * @return A read-only view of {@code iterator} which does not support element
-   *         removal via the {@code remove()}.
-   */
-  public static <M> Iterator<M> unmodifiableIterator(final Iterator<M> iterator)
-  {
-    return new UnmodifiableIterator<M>(iterator);
-  }
-
-
-
-  // Prevent instantiation
-  private Iterators()
-  {
-    // Do nothing.
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Predicate.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Predicate.java
index 0ad2df6..888d53a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Predicate.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Predicate.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,31 +26,28 @@
 
 package com.forgerock.opendj.util;
 
-
-
 /**
  * Predicates transform input values of type {@code M} to a boolean output value
  * and are typically used for performing filtering.
  *
  * @param <M>
- *          The type of input values matched by this predicate.
+ *            The type of input values matched by this predicate.
  * @param <P>
- *          The type of the additional parameter to this predicate's {@code
- *          matches} method. Use {@link java.lang.Void} for predicates that do
- *          not need an additional parameter.
+ *            The type of the additional parameter to this predicate's
+ *            {@code matches} method. Use {@link java.lang.Void} for predicates
+ *            that do not need an additional parameter.
  */
-public interface Predicate<M, P>
-{
-  /**
-   * Indicates whether or not this predicate matches the provided input value of
-   * type {@code M}.
-   *
-   * @param value
-   *          The input value for which to make the determination.
-   * @param p
-   *          A predicate specified parameter.
-   * @return {@code true} if this predicate matches {@code value}, otherwise
-   *         {@code false}.
-   */
-  boolean matches(M value, P p);
+public interface Predicate<M, P> {
+    /**
+     * Indicates whether or not this predicate matches the provided input value
+     * of type {@code M}.
+     *
+     * @param value
+     *            The input value for which to make the determination.
+     * @param p
+     *            A predicate specified parameter.
+     * @return {@code true} if this predicate matches {@code value}, otherwise
+     *         {@code false}.
+     */
+    boolean matches(M value, P p);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/RecursiveFutureResult.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/RecursiveFutureResult.java
index a39a6d5..db39636 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/RecursiveFutureResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/RecursiveFutureResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
@@ -37,8 +34,6 @@
 import org.forgerock.opendj.ldap.FutureResult;
 import org.forgerock.opendj.ldap.ResultHandler;
 
-
-
 /**
  * An implementation of the {@code FutureResult} interface which can be used to
  * combine a sequence of two asynchronous operations into a single future
@@ -47,228 +42,169 @@
  * operation.
  *
  * @param <M>
- *          The type of the inner result.
+ *            The type of the inner result.
  * @param <N>
- *          The type of the outer result.
+ *            The type of the outer result.
  */
-public abstract class RecursiveFutureResult<M, N> implements FutureResult<N>,
-    ResultHandler<M>
-{
-  private final class FutureResultImpl extends AsynchronousFutureResult<N>
-  {
-    private FutureResultImpl(final ResultHandler<? super N> handler)
-    {
-      super(handler);
+public abstract class RecursiveFutureResult<M, N> implements FutureResult<N>, ResultHandler<M> {
+    private final class FutureResultImpl extends AsynchronousFutureResult<N> {
+        private FutureResultImpl(final ResultHandler<? super N> handler) {
+            super(handler);
+        }
+
+        public int getRequestID() {
+            if (innerFuture instanceof FutureResult<?>) {
+                final FutureResult<?> tmp = (FutureResult<?>) innerFuture;
+                return tmp.getRequestID();
+            } else {
+                return -1;
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected ErrorResultException handleCancelRequest(final boolean mayInterruptIfRunning) {
+            innerFuture.cancel(mayInterruptIfRunning);
+            if (outerFuture != null) {
+                outerFuture.cancel(mayInterruptIfRunning);
+            }
+            return null;
+        }
+
     }
 
+    private final FutureResultImpl impl;
 
+    private volatile Future<?> innerFuture = null;
 
-    public int getRequestID()
-    {
-      if (innerFuture instanceof FutureResult<?>)
-      {
-        final FutureResult<?> tmp = (FutureResult<?>) innerFuture;
-        return tmp.getRequestID();
-      }
-      else
-      {
-        return -1;
-      }
+    // This does not need to be volatile since the inner future acts as a
+    // memory barrier.
+    private FutureResult<? extends N> outerFuture = null;
+
+    /**
+     * Creates a new asynchronous result chain which will chain an outer
+     * asynchronous request once the inner asynchronous request completes.
+     *
+     * @param handler
+     *            The outer result handler.
+     */
+    protected RecursiveFutureResult(final ResultHandler<? super N> handler) {
+        this.impl = new FutureResultImpl(handler);
     }
 
-
-
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected ErrorResultException handleCancelRequest(
-        final boolean mayInterruptIfRunning)
-    {
-      innerFuture.cancel(mayInterruptIfRunning);
-      if (outerFuture != null)
-      {
-        outerFuture.cancel(mayInterruptIfRunning);
-      }
-      return null;
+    public final boolean cancel(final boolean mayInterruptIfRunning) {
+        return impl.cancel(mayInterruptIfRunning);
     }
 
-  }
-
-
-
-  private final FutureResultImpl impl;
-
-  private volatile Future<?> innerFuture = null;
-
-  // This does not need to be volatile since the inner future acts as a
-  // memory barrier.
-  private FutureResult<? extends N> outerFuture = null;
-
-
-
-  /**
-   * Creates a new asynchronous result chain which will chain an outer
-   * asynchronous request once the inner asynchronous request completes.
-   *
-   * @param handler
-   *          The outer result handler.
-   */
-  protected RecursiveFutureResult(final ResultHandler<? super N> handler)
-  {
-    this.impl = new FutureResultImpl(handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean cancel(final boolean mayInterruptIfRunning)
-  {
-    return impl.cancel(mayInterruptIfRunning);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final N get() throws ErrorResultException, InterruptedException
-  {
-    return impl.get();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final N get(final long timeout, final TimeUnit unit)
-      throws ErrorResultException, TimeoutException, InterruptedException
-  {
-    return impl.get(timeout, unit);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final int getRequestID()
-  {
-    return impl.getRequestID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final void handleErrorResult(final ErrorResultException error)
-  {
-    try
-    {
-      outerFuture = chainErrorResult(error, impl);
+    /**
+     * {@inheritDoc}
+     */
+    public final N get() throws ErrorResultException, InterruptedException {
+        return impl.get();
     }
-    catch (final ErrorResultException e)
-    {
-      impl.handleErrorResult(e);
+
+    /**
+     * {@inheritDoc}
+     */
+    public final N get(final long timeout, final TimeUnit unit) throws ErrorResultException,
+            TimeoutException, InterruptedException {
+        return impl.get(timeout, unit);
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final void handleResult(final M result)
-  {
-    try
-    {
-      outerFuture = chainResult(result, impl);
+    /**
+     * {@inheritDoc}
+     */
+    public final int getRequestID() {
+        return impl.getRequestID();
     }
-    catch (final ErrorResultException e)
-    {
-      impl.handleErrorResult(e);
+
+    /**
+     * {@inheritDoc}
+     */
+    public final void handleErrorResult(final ErrorResultException error) {
+        try {
+            outerFuture = chainErrorResult(error, impl);
+        } catch (final ErrorResultException e) {
+            impl.handleErrorResult(e);
+        }
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final void handleResult(final M result) {
+        try {
+            outerFuture = chainResult(result, impl);
+        } catch (final ErrorResultException e) {
+            impl.handleErrorResult(e);
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isCancelled() {
+        return impl.isCancelled();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isCancelled()
-  {
-    return impl.isCancelled();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isDone() {
+        return impl.isDone();
+    }
 
+    /**
+     * Sets the inner future for this result chain. This must be done before
+     * this future is published.
+     *
+     * @param future
+     *            The inner future.
+     */
+    public final void setFutureResult(final Future<?> future) {
+        this.innerFuture = future;
+    }
 
+    /**
+     * Invokes the outer request based on the error result of the inner request
+     * and returns a future representing the result of the outer request.
+     * <p>
+     * The default implementation is to terminate further processing by
+     * re-throwing the inner error result.
+     *
+     * @param innerError
+     *            The error result of the inner request.
+     * @param handler
+     *            The result handler to be used for the outer request.
+     * @return A future representing the result of the outer request.
+     * @throws ErrorResultException
+     *             If the outer request could not be invoked and processing
+     *             should terminate.
+     */
+    protected FutureResult<? extends N> chainErrorResult(final ErrorResultException innerError,
+            final ResultHandler<? super N> handler) throws ErrorResultException {
+        throw innerError;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isDone()
-  {
-    return impl.isDone();
-  }
-
-
-
-  /**
-   * Sets the inner future for this result chain. This must be done before this
-   * future is published.
-   *
-   * @param future
-   *          The inner future.
-   */
-  public final void setFutureResult(final Future<?> future)
-  {
-    this.innerFuture = future;
-  }
-
-
-
-  /**
-   * Invokes the outer request based on the error result of the inner request
-   * and returns a future representing the result of the outer request.
-   * <p>
-   * The default implementation is to terminate further processing by
-   * re-throwing the inner error result.
-   *
-   * @param innerError
-   *          The error result of the inner request.
-   * @param handler
-   *          The result handler to be used for the outer request.
-   * @return A future representing the result of the outer request.
-   * @throws ErrorResultException
-   *           If the outer request could not be invoked and processing should
-   *           terminate.
-   */
-  protected FutureResult<? extends N> chainErrorResult(
-      final ErrorResultException innerError,
-      final ResultHandler<? super N> handler) throws ErrorResultException
-  {
-    throw innerError;
-  }
-
-
-
-  /**
-   * Invokes the outer request based on the result of the inner request and
-   * returns a future representing the result of the outer request.
-   *
-   * @param innerResult
-   *          The result of the inner request.
-   * @param handler
-   *          The result handler to be used for the outer request.
-   * @return A future representing the result of the outer request.
-   * @throws ErrorResultException
-   *           If the outer request could not be invoked and processing should
-   *           terminate.
-   */
-  protected abstract FutureResult<? extends N> chainResult(M innerResult,
-      ResultHandler<? super N> handler) throws ErrorResultException;
+    /**
+     * Invokes the outer request based on the result of the inner request and
+     * returns a future representing the result of the outer request.
+     *
+     * @param innerResult
+     *            The result of the inner request.
+     * @param handler
+     *            The result handler to be used for the outer request.
+     * @return A future representing the result of the outer request.
+     * @throws ErrorResultException
+     *             If the outer request could not be invoked and processing
+     *             should terminate.
+     */
+    protected abstract FutureResult<? extends N> chainResult(M innerResult,
+            ResultHandler<? super N> handler) throws ErrorResultException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java
index a1603eb..f0837ff 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,194 +25,147 @@
  */
 package com.forgerock.opendj.util;
 
-
-
 import java.io.IOException;
 import java.io.InputStream;
 
-
-
 /**
  * An implementation of input stream that enforces an read size limit.
  */
-public class SizeLimitInputStream extends InputStream
-{
-  private int bytesRead;
-  private int markBytesRead;
-  private final int readLimit;
-  private final InputStream parentStream;
+public class SizeLimitInputStream extends InputStream {
+    private int bytesRead;
+    private int markBytesRead;
+    private final int readLimit;
+    private final InputStream parentStream;
 
-
-
-  /**
-   * Creates a new a new size limit input stream.
-   *
-   * @param parentStream
-   *          The parent stream.
-   * @param readLimit
-   *          The size limit.
-   */
-  public SizeLimitInputStream(final InputStream parentStream,
-      final int readLimit)
-  {
-    this.parentStream = parentStream;
-    this.readLimit = readLimit;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int available() throws IOException
-  {
-    final int streamAvail = parentStream.available();
-    final int limitedAvail = readLimit - bytesRead;
-    return limitedAvail < streamAvail ? limitedAvail : streamAvail;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close() throws IOException
-  {
-    parentStream.close();
-  }
-
-
-
-  /**
-   * Retrieves the number of bytes read from this stream.
-   *
-   * @return The number of bytes read from this stream.
-   */
-  public int getBytesRead()
-  {
-    return bytesRead;
-  }
-
-
-
-  /**
-   * Retrieves the size limit of this stream.
-   *
-   * @return The size limit of this stream.
-   */
-  public int getSizeLimit()
-  {
-    return readLimit;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public synchronized void mark(final int readlimit)
-  {
-    parentStream.mark(readlimit);
-    markBytesRead = bytesRead;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean markSupported()
-  {
-    return parentStream.markSupported();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int read() throws IOException
-  {
-    if (bytesRead >= readLimit)
-    {
-      return -1;
+    /**
+     * Creates a new a new size limit input stream.
+     *
+     * @param parentStream
+     *            The parent stream.
+     * @param readLimit
+     *            The size limit.
+     */
+    public SizeLimitInputStream(final InputStream parentStream, final int readLimit) {
+        this.parentStream = parentStream;
+        this.readLimit = readLimit;
     }
 
-    final int b = parentStream.read();
-    if (b != -1)
-    {
-      ++bytesRead;
-    }
-    return b;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int read(final byte b[], final int off, int len) throws IOException
-  {
-    if (off < 0 || len < 0 || off + len > b.length)
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int available() throws IOException {
+        final int streamAvail = parentStream.available();
+        final int limitedAvail = readLimit - bytesRead;
+        return limitedAvail < streamAvail ? limitedAvail : streamAvail;
     }
 
-    if (len == 0)
-    {
-      return 0;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() throws IOException {
+        parentStream.close();
     }
 
-    if (bytesRead >= readLimit)
-    {
-      return -1;
+    /**
+     * Retrieves the number of bytes read from this stream.
+     *
+     * @return The number of bytes read from this stream.
+     */
+    public int getBytesRead() {
+        return bytesRead;
     }
 
-    if (bytesRead + len > readLimit)
-    {
-      len = readLimit - bytesRead;
+    /**
+     * Retrieves the size limit of this stream.
+     *
+     * @return The size limit of this stream.
+     */
+    public int getSizeLimit() {
+        return readLimit;
     }
 
-    final int readLen = parentStream.read(b, off, len);
-    if (readLen > 0)
-    {
-      bytesRead += readLen;
-    }
-    return readLen;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public synchronized void reset() throws IOException
-  {
-    parentStream.reset();
-    bytesRead = markBytesRead;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public long skip(long n) throws IOException
-  {
-    if (bytesRead + n > readLimit)
-    {
-      n = readLimit - bytesRead;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public synchronized void mark(final int readlimit) {
+        parentStream.mark(readlimit);
+        markBytesRead = bytesRead;
     }
 
-    bytesRead += n;
-    return parentStream.skip(n);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean markSupported() {
+        return parentStream.markSupported();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int read() throws IOException {
+        if (bytesRead >= readLimit) {
+            return -1;
+        }
+
+        final int b = parentStream.read();
+        if (b != -1) {
+            ++bytesRead;
+        }
+        return b;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int read(final byte[] b, final int off, int len) throws IOException {
+        if (off < 0 || len < 0 || off + len > b.length) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        if (len == 0) {
+            return 0;
+        }
+
+        if (bytesRead >= readLimit) {
+            return -1;
+        }
+
+        if (bytesRead + len > readLimit) {
+            len = readLimit - bytesRead;
+        }
+
+        final int readLen = parentStream.read(b, off, len);
+        if (readLen > 0) {
+            bytesRead += readLen;
+        }
+        return readLen;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public synchronized void reset() throws IOException {
+        parentStream.reset();
+        bytesRead = markBytesRead;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long skip(long n) throws IOException {
+        if (bytesRead + n > readLimit) {
+            n = readLimit - bytesRead;
+        }
+
+        bytesRead += n;
+        return parentStream.skip(n);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
index 6edb99e..d892bf3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_HEX_DECODE_INVALID_CHARACTER;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_HEX_DECODE_INVALID_LENGTH;
 
@@ -38,7 +35,14 @@
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.text.ParseException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.TimeZone;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ThreadFactory;
@@ -55,2280 +59,2087 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 
-
-
 /**
  * Common utility methods.
  */
-public final class StaticUtils
-{
-  /**
-   * The debug logger which should be used by the SDK.
-   */
-  public static final Logger DEBUG_LOG = Logger.getLogger("org.forgerock.opendj.ldap");
+public final class StaticUtils {
+    /**
+     * The debug logger which should be used by the SDK.
+     */
+    public static final Logger DEBUG_LOG = Logger.getLogger("org.forgerock.opendj.ldap");
 
-  /**
-   * The end-of-line character for this platform.
-   */
-  public static final String EOL = System.getProperty("line.separator");
+    /**
+     * The end-of-line character for this platform.
+     */
+    public static final String EOL = System.getProperty("line.separator");
 
-  /**
-   * A zero-length byte array.
-   */
-  public static final byte[] EMPTY_BYTES = new byte[0];
+    /**
+     * A zero-length byte array.
+     */
+    public static final byte[] EMPTY_BYTES = new byte[0];
 
-  // The name of the time zone for universal coordinated time (UTC).
-  private static final String TIME_ZONE_UTC = "UTC";
+    // The name of the time zone for universal coordinated time (UTC).
+    private static final String TIME_ZONE_UTC = "UTC";
 
-  // UTC TimeZone is assumed to never change over JVM lifetime
-  private static final TimeZone TIME_ZONE_UTC_OBJ = TimeZone
-      .getTimeZone(TIME_ZONE_UTC);
+    // UTC TimeZone is assumed to never change over JVM lifetime
+    private static final TimeZone TIME_ZONE_UTC_OBJ = TimeZone.getTimeZone(TIME_ZONE_UTC);
 
-  private static ScheduledExecutorService defaultScheduler = null;
+    private static ScheduledExecutorService defaultScheduler = null;
 
-  private static final Object DEFAULT_SCHEDULER_LOCK = new Object();
+    private static final Object DEFAULT_SCHEDULER_LOCK = new Object();
 
-
-
-  /**
-   * Retrieves a string representation of the provided byte in hexadecimal.
-   *
-   * @param b
-   *          The byte for which to retrieve the hexadecimal string
-   *          representation.
-   * @return The string representation of the provided byte in hexadecimal.
-   */
-  public static String byteToHex(final byte b)
-  {
-    switch (b & 0xFF)
-    {
-    case 0x00:
-      return "00";
-    case 0x01:
-      return "01";
-    case 0x02:
-      return "02";
-    case 0x03:
-      return "03";
-    case 0x04:
-      return "04";
-    case 0x05:
-      return "05";
-    case 0x06:
-      return "06";
-    case 0x07:
-      return "07";
-    case 0x08:
-      return "08";
-    case 0x09:
-      return "09";
-    case 0x0A:
-      return "0A";
-    case 0x0B:
-      return "0B";
-    case 0x0C:
-      return "0C";
-    case 0x0D:
-      return "0D";
-    case 0x0E:
-      return "0E";
-    case 0x0F:
-      return "0F";
-    case 0x10:
-      return "10";
-    case 0x11:
-      return "11";
-    case 0x12:
-      return "12";
-    case 0x13:
-      return "13";
-    case 0x14:
-      return "14";
-    case 0x15:
-      return "15";
-    case 0x16:
-      return "16";
-    case 0x17:
-      return "17";
-    case 0x18:
-      return "18";
-    case 0x19:
-      return "19";
-    case 0x1A:
-      return "1A";
-    case 0x1B:
-      return "1B";
-    case 0x1C:
-      return "1C";
-    case 0x1D:
-      return "1D";
-    case 0x1E:
-      return "1E";
-    case 0x1F:
-      return "1F";
-    case 0x20:
-      return "20";
-    case 0x21:
-      return "21";
-    case 0x22:
-      return "22";
-    case 0x23:
-      return "23";
-    case 0x24:
-      return "24";
-    case 0x25:
-      return "25";
-    case 0x26:
-      return "26";
-    case 0x27:
-      return "27";
-    case 0x28:
-      return "28";
-    case 0x29:
-      return "29";
-    case 0x2A:
-      return "2A";
-    case 0x2B:
-      return "2B";
-    case 0x2C:
-      return "2C";
-    case 0x2D:
-      return "2D";
-    case 0x2E:
-      return "2E";
-    case 0x2F:
-      return "2F";
-    case 0x30:
-      return "30";
-    case 0x31:
-      return "31";
-    case 0x32:
-      return "32";
-    case 0x33:
-      return "33";
-    case 0x34:
-      return "34";
-    case 0x35:
-      return "35";
-    case 0x36:
-      return "36";
-    case 0x37:
-      return "37";
-    case 0x38:
-      return "38";
-    case 0x39:
-      return "39";
-    case 0x3A:
-      return "3A";
-    case 0x3B:
-      return "3B";
-    case 0x3C:
-      return "3C";
-    case 0x3D:
-      return "3D";
-    case 0x3E:
-      return "3E";
-    case 0x3F:
-      return "3F";
-    case 0x40:
-      return "40";
-    case 0x41:
-      return "41";
-    case 0x42:
-      return "42";
-    case 0x43:
-      return "43";
-    case 0x44:
-      return "44";
-    case 0x45:
-      return "45";
-    case 0x46:
-      return "46";
-    case 0x47:
-      return "47";
-    case 0x48:
-      return "48";
-    case 0x49:
-      return "49";
-    case 0x4A:
-      return "4A";
-    case 0x4B:
-      return "4B";
-    case 0x4C:
-      return "4C";
-    case 0x4D:
-      return "4D";
-    case 0x4E:
-      return "4E";
-    case 0x4F:
-      return "4F";
-    case 0x50:
-      return "50";
-    case 0x51:
-      return "51";
-    case 0x52:
-      return "52";
-    case 0x53:
-      return "53";
-    case 0x54:
-      return "54";
-    case 0x55:
-      return "55";
-    case 0x56:
-      return "56";
-    case 0x57:
-      return "57";
-    case 0x58:
-      return "58";
-    case 0x59:
-      return "59";
-    case 0x5A:
-      return "5A";
-    case 0x5B:
-      return "5B";
-    case 0x5C:
-      return "5C";
-    case 0x5D:
-      return "5D";
-    case 0x5E:
-      return "5E";
-    case 0x5F:
-      return "5F";
-    case 0x60:
-      return "60";
-    case 0x61:
-      return "61";
-    case 0x62:
-      return "62";
-    case 0x63:
-      return "63";
-    case 0x64:
-      return "64";
-    case 0x65:
-      return "65";
-    case 0x66:
-      return "66";
-    case 0x67:
-      return "67";
-    case 0x68:
-      return "68";
-    case 0x69:
-      return "69";
-    case 0x6A:
-      return "6A";
-    case 0x6B:
-      return "6B";
-    case 0x6C:
-      return "6C";
-    case 0x6D:
-      return "6D";
-    case 0x6E:
-      return "6E";
-    case 0x6F:
-      return "6F";
-    case 0x70:
-      return "70";
-    case 0x71:
-      return "71";
-    case 0x72:
-      return "72";
-    case 0x73:
-      return "73";
-    case 0x74:
-      return "74";
-    case 0x75:
-      return "75";
-    case 0x76:
-      return "76";
-    case 0x77:
-      return "77";
-    case 0x78:
-      return "78";
-    case 0x79:
-      return "79";
-    case 0x7A:
-      return "7A";
-    case 0x7B:
-      return "7B";
-    case 0x7C:
-      return "7C";
-    case 0x7D:
-      return "7D";
-    case 0x7E:
-      return "7E";
-    case 0x7F:
-      return "7F";
-    case 0x80:
-      return "80";
-    case 0x81:
-      return "81";
-    case 0x82:
-      return "82";
-    case 0x83:
-      return "83";
-    case 0x84:
-      return "84";
-    case 0x85:
-      return "85";
-    case 0x86:
-      return "86";
-    case 0x87:
-      return "87";
-    case 0x88:
-      return "88";
-    case 0x89:
-      return "89";
-    case 0x8A:
-      return "8A";
-    case 0x8B:
-      return "8B";
-    case 0x8C:
-      return "8C";
-    case 0x8D:
-      return "8D";
-    case 0x8E:
-      return "8E";
-    case 0x8F:
-      return "8F";
-    case 0x90:
-      return "90";
-    case 0x91:
-      return "91";
-    case 0x92:
-      return "92";
-    case 0x93:
-      return "93";
-    case 0x94:
-      return "94";
-    case 0x95:
-      return "95";
-    case 0x96:
-      return "96";
-    case 0x97:
-      return "97";
-    case 0x98:
-      return "98";
-    case 0x99:
-      return "99";
-    case 0x9A:
-      return "9A";
-    case 0x9B:
-      return "9B";
-    case 0x9C:
-      return "9C";
-    case 0x9D:
-      return "9D";
-    case 0x9E:
-      return "9E";
-    case 0x9F:
-      return "9F";
-    case 0xA0:
-      return "A0";
-    case 0xA1:
-      return "A1";
-    case 0xA2:
-      return "A2";
-    case 0xA3:
-      return "A3";
-    case 0xA4:
-      return "A4";
-    case 0xA5:
-      return "A5";
-    case 0xA6:
-      return "A6";
-    case 0xA7:
-      return "A7";
-    case 0xA8:
-      return "A8";
-    case 0xA9:
-      return "A9";
-    case 0xAA:
-      return "AA";
-    case 0xAB:
-      return "AB";
-    case 0xAC:
-      return "AC";
-    case 0xAD:
-      return "AD";
-    case 0xAE:
-      return "AE";
-    case 0xAF:
-      return "AF";
-    case 0xB0:
-      return "B0";
-    case 0xB1:
-      return "B1";
-    case 0xB2:
-      return "B2";
-    case 0xB3:
-      return "B3";
-    case 0xB4:
-      return "B4";
-    case 0xB5:
-      return "B5";
-    case 0xB6:
-      return "B6";
-    case 0xB7:
-      return "B7";
-    case 0xB8:
-      return "B8";
-    case 0xB9:
-      return "B9";
-    case 0xBA:
-      return "BA";
-    case 0xBB:
-      return "BB";
-    case 0xBC:
-      return "BC";
-    case 0xBD:
-      return "BD";
-    case 0xBE:
-      return "BE";
-    case 0xBF:
-      return "BF";
-    case 0xC0:
-      return "C0";
-    case 0xC1:
-      return "C1";
-    case 0xC2:
-      return "C2";
-    case 0xC3:
-      return "C3";
-    case 0xC4:
-      return "C4";
-    case 0xC5:
-      return "C5";
-    case 0xC6:
-      return "C6";
-    case 0xC7:
-      return "C7";
-    case 0xC8:
-      return "C8";
-    case 0xC9:
-      return "C9";
-    case 0xCA:
-      return "CA";
-    case 0xCB:
-      return "CB";
-    case 0xCC:
-      return "CC";
-    case 0xCD:
-      return "CD";
-    case 0xCE:
-      return "CE";
-    case 0xCF:
-      return "CF";
-    case 0xD0:
-      return "D0";
-    case 0xD1:
-      return "D1";
-    case 0xD2:
-      return "D2";
-    case 0xD3:
-      return "D3";
-    case 0xD4:
-      return "D4";
-    case 0xD5:
-      return "D5";
-    case 0xD6:
-      return "D6";
-    case 0xD7:
-      return "D7";
-    case 0xD8:
-      return "D8";
-    case 0xD9:
-      return "D9";
-    case 0xDA:
-      return "DA";
-    case 0xDB:
-      return "DB";
-    case 0xDC:
-      return "DC";
-    case 0xDD:
-      return "DD";
-    case 0xDE:
-      return "DE";
-    case 0xDF:
-      return "DF";
-    case 0xE0:
-      return "E0";
-    case 0xE1:
-      return "E1";
-    case 0xE2:
-      return "E2";
-    case 0xE3:
-      return "E3";
-    case 0xE4:
-      return "E4";
-    case 0xE5:
-      return "E5";
-    case 0xE6:
-      return "E6";
-    case 0xE7:
-      return "E7";
-    case 0xE8:
-      return "E8";
-    case 0xE9:
-      return "E9";
-    case 0xEA:
-      return "EA";
-    case 0xEB:
-      return "EB";
-    case 0xEC:
-      return "EC";
-    case 0xED:
-      return "ED";
-    case 0xEE:
-      return "EE";
-    case 0xEF:
-      return "EF";
-    case 0xF0:
-      return "F0";
-    case 0xF1:
-      return "F1";
-    case 0xF2:
-      return "F2";
-    case 0xF3:
-      return "F3";
-    case 0xF4:
-      return "F4";
-    case 0xF5:
-      return "F5";
-    case 0xF6:
-      return "F6";
-    case 0xF7:
-      return "F7";
-    case 0xF8:
-      return "F8";
-    case 0xF9:
-      return "F9";
-    case 0xFA:
-      return "FA";
-    case 0xFB:
-      return "FB";
-    case 0xFC:
-      return "FC";
-    case 0xFD:
-      return "FD";
-    case 0xFE:
-      return "FE";
-    case 0xFF:
-      return "FF";
-    default:
-      return "??";
-    }
-  }
-
-
-
-  /**
-   * Retrieves a string representation of the provided byte in hexadecimal.
-   *
-   * @param b
-   *          The byte for which to retrieve the hexadecimal string
-   *          representation.
-   * @return The string representation of the provided byte in hexadecimal using
-   *         lowercase characters.
-   */
-  public static String byteToLowerHex(final byte b)
-  {
-    switch (b & 0xFF)
-    {
-    case 0x00:
-      return "00";
-    case 0x01:
-      return "01";
-    case 0x02:
-      return "02";
-    case 0x03:
-      return "03";
-    case 0x04:
-      return "04";
-    case 0x05:
-      return "05";
-    case 0x06:
-      return "06";
-    case 0x07:
-      return "07";
-    case 0x08:
-      return "08";
-    case 0x09:
-      return "09";
-    case 0x0A:
-      return "0a";
-    case 0x0B:
-      return "0b";
-    case 0x0C:
-      return "0c";
-    case 0x0D:
-      return "0d";
-    case 0x0E:
-      return "0e";
-    case 0x0F:
-      return "0f";
-    case 0x10:
-      return "10";
-    case 0x11:
-      return "11";
-    case 0x12:
-      return "12";
-    case 0x13:
-      return "13";
-    case 0x14:
-      return "14";
-    case 0x15:
-      return "15";
-    case 0x16:
-      return "16";
-    case 0x17:
-      return "17";
-    case 0x18:
-      return "18";
-    case 0x19:
-      return "19";
-    case 0x1A:
-      return "1a";
-    case 0x1B:
-      return "1b";
-    case 0x1C:
-      return "1c";
-    case 0x1D:
-      return "1d";
-    case 0x1E:
-      return "1e";
-    case 0x1F:
-      return "1f";
-    case 0x20:
-      return "20";
-    case 0x21:
-      return "21";
-    case 0x22:
-      return "22";
-    case 0x23:
-      return "23";
-    case 0x24:
-      return "24";
-    case 0x25:
-      return "25";
-    case 0x26:
-      return "26";
-    case 0x27:
-      return "27";
-    case 0x28:
-      return "28";
-    case 0x29:
-      return "29";
-    case 0x2A:
-      return "2a";
-    case 0x2B:
-      return "2b";
-    case 0x2C:
-      return "2c";
-    case 0x2D:
-      return "2d";
-    case 0x2E:
-      return "2e";
-    case 0x2F:
-      return "2f";
-    case 0x30:
-      return "30";
-    case 0x31:
-      return "31";
-    case 0x32:
-      return "32";
-    case 0x33:
-      return "33";
-    case 0x34:
-      return "34";
-    case 0x35:
-      return "35";
-    case 0x36:
-      return "36";
-    case 0x37:
-      return "37";
-    case 0x38:
-      return "38";
-    case 0x39:
-      return "39";
-    case 0x3A:
-      return "3a";
-    case 0x3B:
-      return "3b";
-    case 0x3C:
-      return "3c";
-    case 0x3D:
-      return "3d";
-    case 0x3E:
-      return "3e";
-    case 0x3F:
-      return "3f";
-    case 0x40:
-      return "40";
-    case 0x41:
-      return "41";
-    case 0x42:
-      return "42";
-    case 0x43:
-      return "43";
-    case 0x44:
-      return "44";
-    case 0x45:
-      return "45";
-    case 0x46:
-      return "46";
-    case 0x47:
-      return "47";
-    case 0x48:
-      return "48";
-    case 0x49:
-      return "49";
-    case 0x4A:
-      return "4a";
-    case 0x4B:
-      return "4b";
-    case 0x4C:
-      return "4c";
-    case 0x4D:
-      return "4d";
-    case 0x4E:
-      return "4e";
-    case 0x4F:
-      return "4f";
-    case 0x50:
-      return "50";
-    case 0x51:
-      return "51";
-    case 0x52:
-      return "52";
-    case 0x53:
-      return "53";
-    case 0x54:
-      return "54";
-    case 0x55:
-      return "55";
-    case 0x56:
-      return "56";
-    case 0x57:
-      return "57";
-    case 0x58:
-      return "58";
-    case 0x59:
-      return "59";
-    case 0x5A:
-      return "5a";
-    case 0x5B:
-      return "5b";
-    case 0x5C:
-      return "5c";
-    case 0x5D:
-      return "5d";
-    case 0x5E:
-      return "5e";
-    case 0x5F:
-      return "5f";
-    case 0x60:
-      return "60";
-    case 0x61:
-      return "61";
-    case 0x62:
-      return "62";
-    case 0x63:
-      return "63";
-    case 0x64:
-      return "64";
-    case 0x65:
-      return "65";
-    case 0x66:
-      return "66";
-    case 0x67:
-      return "67";
-    case 0x68:
-      return "68";
-    case 0x69:
-      return "69";
-    case 0x6A:
-      return "6a";
-    case 0x6B:
-      return "6b";
-    case 0x6C:
-      return "6c";
-    case 0x6D:
-      return "6d";
-    case 0x6E:
-      return "6e";
-    case 0x6F:
-      return "6f";
-    case 0x70:
-      return "70";
-    case 0x71:
-      return "71";
-    case 0x72:
-      return "72";
-    case 0x73:
-      return "73";
-    case 0x74:
-      return "74";
-    case 0x75:
-      return "75";
-    case 0x76:
-      return "76";
-    case 0x77:
-      return "77";
-    case 0x78:
-      return "78";
-    case 0x79:
-      return "79";
-    case 0x7A:
-      return "7a";
-    case 0x7B:
-      return "7b";
-    case 0x7C:
-      return "7c";
-    case 0x7D:
-      return "7d";
-    case 0x7E:
-      return "7e";
-    case 0x7F:
-      return "7f";
-    case 0x80:
-      return "80";
-    case 0x81:
-      return "81";
-    case 0x82:
-      return "82";
-    case 0x83:
-      return "83";
-    case 0x84:
-      return "84";
-    case 0x85:
-      return "85";
-    case 0x86:
-      return "86";
-    case 0x87:
-      return "87";
-    case 0x88:
-      return "88";
-    case 0x89:
-      return "89";
-    case 0x8A:
-      return "8a";
-    case 0x8B:
-      return "8b";
-    case 0x8C:
-      return "8c";
-    case 0x8D:
-      return "8d";
-    case 0x8E:
-      return "8e";
-    case 0x8F:
-      return "8f";
-    case 0x90:
-      return "90";
-    case 0x91:
-      return "91";
-    case 0x92:
-      return "92";
-    case 0x93:
-      return "93";
-    case 0x94:
-      return "94";
-    case 0x95:
-      return "95";
-    case 0x96:
-      return "96";
-    case 0x97:
-      return "97";
-    case 0x98:
-      return "98";
-    case 0x99:
-      return "99";
-    case 0x9A:
-      return "9a";
-    case 0x9B:
-      return "9b";
-    case 0x9C:
-      return "9c";
-    case 0x9D:
-      return "9d";
-    case 0x9E:
-      return "9e";
-    case 0x9F:
-      return "9f";
-    case 0xA0:
-      return "a0";
-    case 0xA1:
-      return "a1";
-    case 0xA2:
-      return "a2";
-    case 0xA3:
-      return "a3";
-    case 0xA4:
-      return "a4";
-    case 0xA5:
-      return "a5";
-    case 0xA6:
-      return "a6";
-    case 0xA7:
-      return "a7";
-    case 0xA8:
-      return "a8";
-    case 0xA9:
-      return "a9";
-    case 0xAA:
-      return "aa";
-    case 0xAB:
-      return "ab";
-    case 0xAC:
-      return "ac";
-    case 0xAD:
-      return "ad";
-    case 0xAE:
-      return "ae";
-    case 0xAF:
-      return "af";
-    case 0xB0:
-      return "b0";
-    case 0xB1:
-      return "b1";
-    case 0xB2:
-      return "b2";
-    case 0xB3:
-      return "b3";
-    case 0xB4:
-      return "b4";
-    case 0xB5:
-      return "b5";
-    case 0xB6:
-      return "b6";
-    case 0xB7:
-      return "b7";
-    case 0xB8:
-      return "b8";
-    case 0xB9:
-      return "b9";
-    case 0xBA:
-      return "ba";
-    case 0xBB:
-      return "bb";
-    case 0xBC:
-      return "bc";
-    case 0xBD:
-      return "bd";
-    case 0xBE:
-      return "be";
-    case 0xBF:
-      return "bf";
-    case 0xC0:
-      return "c0";
-    case 0xC1:
-      return "c1";
-    case 0xC2:
-      return "c2";
-    case 0xC3:
-      return "c3";
-    case 0xC4:
-      return "c4";
-    case 0xC5:
-      return "c5";
-    case 0xC6:
-      return "c6";
-    case 0xC7:
-      return "c7";
-    case 0xC8:
-      return "c8";
-    case 0xC9:
-      return "c9";
-    case 0xCA:
-      return "ca";
-    case 0xCB:
-      return "cb";
-    case 0xCC:
-      return "cc";
-    case 0xCD:
-      return "cd";
-    case 0xCE:
-      return "ce";
-    case 0xCF:
-      return "cf";
-    case 0xD0:
-      return "d0";
-    case 0xD1:
-      return "d1";
-    case 0xD2:
-      return "d2";
-    case 0xD3:
-      return "d3";
-    case 0xD4:
-      return "d4";
-    case 0xD5:
-      return "d5";
-    case 0xD6:
-      return "d6";
-    case 0xD7:
-      return "d7";
-    case 0xD8:
-      return "d8";
-    case 0xD9:
-      return "d9";
-    case 0xDA:
-      return "da";
-    case 0xDB:
-      return "db";
-    case 0xDC:
-      return "dc";
-    case 0xDD:
-      return "dd";
-    case 0xDE:
-      return "de";
-    case 0xDF:
-      return "df";
-    case 0xE0:
-      return "e0";
-    case 0xE1:
-      return "e1";
-    case 0xE2:
-      return "e2";
-    case 0xE3:
-      return "e3";
-    case 0xE4:
-      return "e4";
-    case 0xE5:
-      return "e5";
-    case 0xE6:
-      return "e6";
-    case 0xE7:
-      return "e7";
-    case 0xE8:
-      return "e8";
-    case 0xE9:
-      return "e9";
-    case 0xEA:
-      return "ea";
-    case 0xEB:
-      return "eb";
-    case 0xEC:
-      return "ec";
-    case 0xED:
-      return "ed";
-    case 0xEE:
-      return "ee";
-    case 0xEF:
-      return "ef";
-    case 0xF0:
-      return "f0";
-    case 0xF1:
-      return "f1";
-    case 0xF2:
-      return "f2";
-    case 0xF3:
-      return "f3";
-    case 0xF4:
-      return "f4";
-    case 0xF5:
-      return "f5";
-    case 0xF6:
-      return "f6";
-    case 0xF7:
-      return "f7";
-    case 0xF8:
-      return "f8";
-    case 0xF9:
-      return "f9";
-    case 0xFA:
-      return "fa";
-    case 0xFB:
-      return "fb";
-    case 0xFC:
-      return "fc";
-    case 0xFD:
-      return "fd";
-    case 0xFE:
-      return "fe";
-    case 0xFF:
-      return "ff";
-    default:
-      return "??";
-    }
-  }
-
-
-
-  /**
-   * Attempts to compress the data in the provided source array into the given
-   * destination array. If the compressed data will fit into the destination
-   * array, then this method will return the number of bytes of compressed data
-   * in the array. Otherwise, it will return -1 to indicate that the compression
-   * was not successful. Note that if -1 is returned, then the data in the
-   * destination array should be considered invalid.
-   *
-   * @param src
-   *          The array containing the raw data to compress.
-   * @param srcOff
-   *          The start offset of the source data.
-   * @param srcLen
-   *          The maximum number of source data bytes to compress.
-   * @param dst
-   *          The array into which the compressed data should be written.
-   * @param dstOff
-   *          The start offset of the compressed data.
-   * @param dstLen
-   *          The maximum number of bytes of compressed data.
-   * @return The number of bytes of compressed data, or -1 if it was not
-   *         possible to actually compress the data.
-   */
-  public static int compress(final byte[] src, final int srcOff,
-      final int srcLen, final byte[] dst, final int dstOff, final int dstLen)
-  {
-    final Deflater deflater = new Deflater();
-    try
-    {
-      deflater.setInput(src, srcOff, srcLen);
-      deflater.finish();
-
-      final int compressedLength = deflater.deflate(dst, dstOff, dstLen);
-      if (deflater.finished())
-      {
-        return compressedLength;
-      }
-      else
-      {
-        return -1;
-      }
-    }
-    finally
-    {
-      deflater.end();
-    }
-  }
-
-
-
-  /**
-   * Attempts to compress the data in the provided byte sequence into the
-   * provided byte string builder. Note that if compression was not successful,
-   * then the byte string builder will be left unchanged.
-   *
-   * @param input
-   *          The source data to be compressed.
-   * @param output
-   *          The destination buffer to which the compressed data will be
-   *          appended.
-   * @return <code>true</code> if compression was successful or
-   *         <code>false</code> otherwise.
-   */
-  public static boolean compress(final ByteSequence input,
-      final ByteStringBuilder output)
-  {
-    final byte[] inputBytes = input.toByteArray();
-    final byte[] outputBytes = new byte[inputBytes.length];
-
-    final int compressedSize = compress(inputBytes, 0, inputBytes.length,
-        outputBytes, 0, outputBytes.length);
-
-    if (compressedSize != -1)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-      {
-        StaticUtils.DEBUG_LOG.fine(String.format("Compression %d/%d%n",
-            compressedSize, inputBytes.length));
-      }
-
-      output.append(outputBytes, 0, compressedSize);
-      return true;
-    }
-
-    return false;
-  }
-
-
-
-  /**
-   * Returns a string containing provided date formatted using the generalized
-   * time syntax.
-   *
-   * @param date
-   *          The date to be formated.
-   * @return The string containing provided date formatted using the generalized
-   *         time syntax.
-   * @throws NullPointerException
-   *           If {@code date} was {@code null}.
-   */
-  public static String formatAsGeneralizedTime(final Date date)
-  {
-    return formatAsGeneralizedTime(date.getTime());
-  }
-
-
-
-  /**
-   * Returns a string containing provided date formatted using the generalized
-   * time syntax.
-   *
-   * @param date
-   *          The date to be formated.
-   * @return The string containing provided date formatted using the generalized
-   *         time syntax.
-   * @throws IllegalArgumentException
-   *           If {@code date} was invalid.
-   */
-  public static String formatAsGeneralizedTime(final long date)
-  {
-    // Generalized time has the format yyyyMMddHHmmss.SSS'Z'
-
-    // Do this in a thread-safe non-synchronized fashion.
-    // (Simple)DateFormat is neither fast nor thread-safe.
-
-    final StringBuilder sb = new StringBuilder(19);
-
-    final GregorianCalendar calendar = new GregorianCalendar(TIME_ZONE_UTC_OBJ);
-    calendar.setLenient(false);
-    calendar.setTimeInMillis(date);
-
-    // Format the year yyyy.
-    int n = calendar.get(Calendar.YEAR);
-    if (n < 0)
-    {
-      final IllegalArgumentException e = new IllegalArgumentException(
-          "Year cannot be < 0:" + n);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "format", e);
-      throw e;
-    }
-    else if (n < 10)
-    {
-      sb.append("000");
-    }
-    else if (n < 100)
-    {
-      sb.append("00");
-    }
-    else if (n < 1000)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the month MM.
-    n = calendar.get(Calendar.MONTH) + 1;
-    if (n < 10)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the day dd.
-    n = calendar.get(Calendar.DAY_OF_MONTH);
-    if (n < 10)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the hour HH.
-    n = calendar.get(Calendar.HOUR_OF_DAY);
-    if (n < 10)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the minute mm.
-    n = calendar.get(Calendar.MINUTE);
-    if (n < 10)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the seconds ss.
-    n = calendar.get(Calendar.SECOND);
-    if (n < 10)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the milli-seconds.
-    sb.append('.');
-    n = calendar.get(Calendar.MILLISECOND);
-    if (n < 10)
-    {
-      sb.append("00");
-    }
-    else if (n < 100)
-    {
-      sb.append("0");
-    }
-    sb.append(n);
-
-    // Format the timezone (always Z).
-    sb.append('Z');
-
-    return sb.toString();
-  }
-
-
-
-  /**
-   * Construct a byte array containing the UTF-8 encoding of the provided
-   * character array.
-   *
-   * @param chars
-   *          The character array to convert to a UTF-8 byte array.
-   * @return A byte array containing the UTF-8 encoding of the provided
-   *         character array.
-   */
-  public static byte[] getBytes(final char[] chars)
-  {
-    final Charset utf8 = Charset.forName("UTF-8");
-    final ByteBuffer buffer = utf8.encode(CharBuffer.wrap(chars));
-    final byte[] bytes = new byte[buffer.remaining()];
-    buffer.get(bytes);
-    return bytes;
-  }
-
-
-
-  /**
-   * Construct a byte array containing the UTF-8 encoding of the provided
-   * string. This is significantly faster than calling
-   * {@link String#getBytes(String)} for ASCII strings.
-   *
-   * @param s
-   *          The string to convert to a UTF-8 byte array.
-   * @return Returns a byte array containing the UTF-8 encoding of the provided
-   *         string.
-   */
-  public static byte[] getBytes(final String s)
-  {
-    if (s == null)
-    {
-      return null;
-    }
-
-    try
-    {
-      char c;
-      final int length = s.length();
-      final byte[] returnArray = new byte[length];
-      for (int i = 0; i < length; i++)
-      {
-        c = s.charAt(i);
-        returnArray[i] = (byte) (c & 0x0000007F);
-        if (c != returnArray[i])
-        {
-          return s.getBytes("UTF-8");
+    /**
+     * Retrieves a string representation of the provided byte in hexadecimal.
+     *
+     * @param b
+     *            The byte for which to retrieve the hexadecimal string
+     *            representation.
+     * @return The string representation of the provided byte in hexadecimal.
+     */
+    public static String byteToHex(final byte b) {
+        switch (b & 0xFF) {
+        case 0x00:
+            return "00";
+        case 0x01:
+            return "01";
+        case 0x02:
+            return "02";
+        case 0x03:
+            return "03";
+        case 0x04:
+            return "04";
+        case 0x05:
+            return "05";
+        case 0x06:
+            return "06";
+        case 0x07:
+            return "07";
+        case 0x08:
+            return "08";
+        case 0x09:
+            return "09";
+        case 0x0A:
+            return "0A";
+        case 0x0B:
+            return "0B";
+        case 0x0C:
+            return "0C";
+        case 0x0D:
+            return "0D";
+        case 0x0E:
+            return "0E";
+        case 0x0F:
+            return "0F";
+        case 0x10:
+            return "10";
+        case 0x11:
+            return "11";
+        case 0x12:
+            return "12";
+        case 0x13:
+            return "13";
+        case 0x14:
+            return "14";
+        case 0x15:
+            return "15";
+        case 0x16:
+            return "16";
+        case 0x17:
+            return "17";
+        case 0x18:
+            return "18";
+        case 0x19:
+            return "19";
+        case 0x1A:
+            return "1A";
+        case 0x1B:
+            return "1B";
+        case 0x1C:
+            return "1C";
+        case 0x1D:
+            return "1D";
+        case 0x1E:
+            return "1E";
+        case 0x1F:
+            return "1F";
+        case 0x20:
+            return "20";
+        case 0x21:
+            return "21";
+        case 0x22:
+            return "22";
+        case 0x23:
+            return "23";
+        case 0x24:
+            return "24";
+        case 0x25:
+            return "25";
+        case 0x26:
+            return "26";
+        case 0x27:
+            return "27";
+        case 0x28:
+            return "28";
+        case 0x29:
+            return "29";
+        case 0x2A:
+            return "2A";
+        case 0x2B:
+            return "2B";
+        case 0x2C:
+            return "2C";
+        case 0x2D:
+            return "2D";
+        case 0x2E:
+            return "2E";
+        case 0x2F:
+            return "2F";
+        case 0x30:
+            return "30";
+        case 0x31:
+            return "31";
+        case 0x32:
+            return "32";
+        case 0x33:
+            return "33";
+        case 0x34:
+            return "34";
+        case 0x35:
+            return "35";
+        case 0x36:
+            return "36";
+        case 0x37:
+            return "37";
+        case 0x38:
+            return "38";
+        case 0x39:
+            return "39";
+        case 0x3A:
+            return "3A";
+        case 0x3B:
+            return "3B";
+        case 0x3C:
+            return "3C";
+        case 0x3D:
+            return "3D";
+        case 0x3E:
+            return "3E";
+        case 0x3F:
+            return "3F";
+        case 0x40:
+            return "40";
+        case 0x41:
+            return "41";
+        case 0x42:
+            return "42";
+        case 0x43:
+            return "43";
+        case 0x44:
+            return "44";
+        case 0x45:
+            return "45";
+        case 0x46:
+            return "46";
+        case 0x47:
+            return "47";
+        case 0x48:
+            return "48";
+        case 0x49:
+            return "49";
+        case 0x4A:
+            return "4A";
+        case 0x4B:
+            return "4B";
+        case 0x4C:
+            return "4C";
+        case 0x4D:
+            return "4D";
+        case 0x4E:
+            return "4E";
+        case 0x4F:
+            return "4F";
+        case 0x50:
+            return "50";
+        case 0x51:
+            return "51";
+        case 0x52:
+            return "52";
+        case 0x53:
+            return "53";
+        case 0x54:
+            return "54";
+        case 0x55:
+            return "55";
+        case 0x56:
+            return "56";
+        case 0x57:
+            return "57";
+        case 0x58:
+            return "58";
+        case 0x59:
+            return "59";
+        case 0x5A:
+            return "5A";
+        case 0x5B:
+            return "5B";
+        case 0x5C:
+            return "5C";
+        case 0x5D:
+            return "5D";
+        case 0x5E:
+            return "5E";
+        case 0x5F:
+            return "5F";
+        case 0x60:
+            return "60";
+        case 0x61:
+            return "61";
+        case 0x62:
+            return "62";
+        case 0x63:
+            return "63";
+        case 0x64:
+            return "64";
+        case 0x65:
+            return "65";
+        case 0x66:
+            return "66";
+        case 0x67:
+            return "67";
+        case 0x68:
+            return "68";
+        case 0x69:
+            return "69";
+        case 0x6A:
+            return "6A";
+        case 0x6B:
+            return "6B";
+        case 0x6C:
+            return "6C";
+        case 0x6D:
+            return "6D";
+        case 0x6E:
+            return "6E";
+        case 0x6F:
+            return "6F";
+        case 0x70:
+            return "70";
+        case 0x71:
+            return "71";
+        case 0x72:
+            return "72";
+        case 0x73:
+            return "73";
+        case 0x74:
+            return "74";
+        case 0x75:
+            return "75";
+        case 0x76:
+            return "76";
+        case 0x77:
+            return "77";
+        case 0x78:
+            return "78";
+        case 0x79:
+            return "79";
+        case 0x7A:
+            return "7A";
+        case 0x7B:
+            return "7B";
+        case 0x7C:
+            return "7C";
+        case 0x7D:
+            return "7D";
+        case 0x7E:
+            return "7E";
+        case 0x7F:
+            return "7F";
+        case 0x80:
+            return "80";
+        case 0x81:
+            return "81";
+        case 0x82:
+            return "82";
+        case 0x83:
+            return "83";
+        case 0x84:
+            return "84";
+        case 0x85:
+            return "85";
+        case 0x86:
+            return "86";
+        case 0x87:
+            return "87";
+        case 0x88:
+            return "88";
+        case 0x89:
+            return "89";
+        case 0x8A:
+            return "8A";
+        case 0x8B:
+            return "8B";
+        case 0x8C:
+            return "8C";
+        case 0x8D:
+            return "8D";
+        case 0x8E:
+            return "8E";
+        case 0x8F:
+            return "8F";
+        case 0x90:
+            return "90";
+        case 0x91:
+            return "91";
+        case 0x92:
+            return "92";
+        case 0x93:
+            return "93";
+        case 0x94:
+            return "94";
+        case 0x95:
+            return "95";
+        case 0x96:
+            return "96";
+        case 0x97:
+            return "97";
+        case 0x98:
+            return "98";
+        case 0x99:
+            return "99";
+        case 0x9A:
+            return "9A";
+        case 0x9B:
+            return "9B";
+        case 0x9C:
+            return "9C";
+        case 0x9D:
+            return "9D";
+        case 0x9E:
+            return "9E";
+        case 0x9F:
+            return "9F";
+        case 0xA0:
+            return "A0";
+        case 0xA1:
+            return "A1";
+        case 0xA2:
+            return "A2";
+        case 0xA3:
+            return "A3";
+        case 0xA4:
+            return "A4";
+        case 0xA5:
+            return "A5";
+        case 0xA6:
+            return "A6";
+        case 0xA7:
+            return "A7";
+        case 0xA8:
+            return "A8";
+        case 0xA9:
+            return "A9";
+        case 0xAA:
+            return "AA";
+        case 0xAB:
+            return "AB";
+        case 0xAC:
+            return "AC";
+        case 0xAD:
+            return "AD";
+        case 0xAE:
+            return "AE";
+        case 0xAF:
+            return "AF";
+        case 0xB0:
+            return "B0";
+        case 0xB1:
+            return "B1";
+        case 0xB2:
+            return "B2";
+        case 0xB3:
+            return "B3";
+        case 0xB4:
+            return "B4";
+        case 0xB5:
+            return "B5";
+        case 0xB6:
+            return "B6";
+        case 0xB7:
+            return "B7";
+        case 0xB8:
+            return "B8";
+        case 0xB9:
+            return "B9";
+        case 0xBA:
+            return "BA";
+        case 0xBB:
+            return "BB";
+        case 0xBC:
+            return "BC";
+        case 0xBD:
+            return "BD";
+        case 0xBE:
+            return "BE";
+        case 0xBF:
+            return "BF";
+        case 0xC0:
+            return "C0";
+        case 0xC1:
+            return "C1";
+        case 0xC2:
+            return "C2";
+        case 0xC3:
+            return "C3";
+        case 0xC4:
+            return "C4";
+        case 0xC5:
+            return "C5";
+        case 0xC6:
+            return "C6";
+        case 0xC7:
+            return "C7";
+        case 0xC8:
+            return "C8";
+        case 0xC9:
+            return "C9";
+        case 0xCA:
+            return "CA";
+        case 0xCB:
+            return "CB";
+        case 0xCC:
+            return "CC";
+        case 0xCD:
+            return "CD";
+        case 0xCE:
+            return "CE";
+        case 0xCF:
+            return "CF";
+        case 0xD0:
+            return "D0";
+        case 0xD1:
+            return "D1";
+        case 0xD2:
+            return "D2";
+        case 0xD3:
+            return "D3";
+        case 0xD4:
+            return "D4";
+        case 0xD5:
+            return "D5";
+        case 0xD6:
+            return "D6";
+        case 0xD7:
+            return "D7";
+        case 0xD8:
+            return "D8";
+        case 0xD9:
+            return "D9";
+        case 0xDA:
+            return "DA";
+        case 0xDB:
+            return "DB";
+        case 0xDC:
+            return "DC";
+        case 0xDD:
+            return "DD";
+        case 0xDE:
+            return "DE";
+        case 0xDF:
+            return "DF";
+        case 0xE0:
+            return "E0";
+        case 0xE1:
+            return "E1";
+        case 0xE2:
+            return "E2";
+        case 0xE3:
+            return "E3";
+        case 0xE4:
+            return "E4";
+        case 0xE5:
+            return "E5";
+        case 0xE6:
+            return "E6";
+        case 0xE7:
+            return "E7";
+        case 0xE8:
+            return "E8";
+        case 0xE9:
+            return "E9";
+        case 0xEA:
+            return "EA";
+        case 0xEB:
+            return "EB";
+        case 0xEC:
+            return "EC";
+        case 0xED:
+            return "ED";
+        case 0xEE:
+            return "EE";
+        case 0xEF:
+            return "EF";
+        case 0xF0:
+            return "F0";
+        case 0xF1:
+            return "F1";
+        case 0xF2:
+            return "F2";
+        case 0xF3:
+            return "F3";
+        case 0xF4:
+            return "F4";
+        case 0xF5:
+            return "F5";
+        case 0xF6:
+            return "F6";
+        case 0xF7:
+            return "F7";
+        case 0xF8:
+            return "F8";
+        case 0xF9:
+            return "F9";
+        case 0xFA:
+            return "FA";
+        case 0xFB:
+            return "FB";
+        case 0xFC:
+            return "FC";
+        case 0xFD:
+            return "FD";
+        case 0xFE:
+            return "FE";
+        case 0xFF:
+            return "FF";
+        default:
+            return "??";
         }
-      }
-
-      return returnArray;
     }
-    catch (final Exception e)
-    {
-      DEBUG_LOG.warning("Unable to encode UTF-8 string " + s);
 
-      return s.getBytes();
+    /**
+     * Retrieves a string representation of the provided byte in hexadecimal.
+     *
+     * @param b
+     *            The byte for which to retrieve the hexadecimal string
+     *            representation.
+     * @return The string representation of the provided byte in hexadecimal
+     *         using lowercase characters.
+     */
+    public static String byteToLowerHex(final byte b) {
+        switch (b & 0xFF) {
+        case 0x00:
+            return "00";
+        case 0x01:
+            return "01";
+        case 0x02:
+            return "02";
+        case 0x03:
+            return "03";
+        case 0x04:
+            return "04";
+        case 0x05:
+            return "05";
+        case 0x06:
+            return "06";
+        case 0x07:
+            return "07";
+        case 0x08:
+            return "08";
+        case 0x09:
+            return "09";
+        case 0x0A:
+            return "0a";
+        case 0x0B:
+            return "0b";
+        case 0x0C:
+            return "0c";
+        case 0x0D:
+            return "0d";
+        case 0x0E:
+            return "0e";
+        case 0x0F:
+            return "0f";
+        case 0x10:
+            return "10";
+        case 0x11:
+            return "11";
+        case 0x12:
+            return "12";
+        case 0x13:
+            return "13";
+        case 0x14:
+            return "14";
+        case 0x15:
+            return "15";
+        case 0x16:
+            return "16";
+        case 0x17:
+            return "17";
+        case 0x18:
+            return "18";
+        case 0x19:
+            return "19";
+        case 0x1A:
+            return "1a";
+        case 0x1B:
+            return "1b";
+        case 0x1C:
+            return "1c";
+        case 0x1D:
+            return "1d";
+        case 0x1E:
+            return "1e";
+        case 0x1F:
+            return "1f";
+        case 0x20:
+            return "20";
+        case 0x21:
+            return "21";
+        case 0x22:
+            return "22";
+        case 0x23:
+            return "23";
+        case 0x24:
+            return "24";
+        case 0x25:
+            return "25";
+        case 0x26:
+            return "26";
+        case 0x27:
+            return "27";
+        case 0x28:
+            return "28";
+        case 0x29:
+            return "29";
+        case 0x2A:
+            return "2a";
+        case 0x2B:
+            return "2b";
+        case 0x2C:
+            return "2c";
+        case 0x2D:
+            return "2d";
+        case 0x2E:
+            return "2e";
+        case 0x2F:
+            return "2f";
+        case 0x30:
+            return "30";
+        case 0x31:
+            return "31";
+        case 0x32:
+            return "32";
+        case 0x33:
+            return "33";
+        case 0x34:
+            return "34";
+        case 0x35:
+            return "35";
+        case 0x36:
+            return "36";
+        case 0x37:
+            return "37";
+        case 0x38:
+            return "38";
+        case 0x39:
+            return "39";
+        case 0x3A:
+            return "3a";
+        case 0x3B:
+            return "3b";
+        case 0x3C:
+            return "3c";
+        case 0x3D:
+            return "3d";
+        case 0x3E:
+            return "3e";
+        case 0x3F:
+            return "3f";
+        case 0x40:
+            return "40";
+        case 0x41:
+            return "41";
+        case 0x42:
+            return "42";
+        case 0x43:
+            return "43";
+        case 0x44:
+            return "44";
+        case 0x45:
+            return "45";
+        case 0x46:
+            return "46";
+        case 0x47:
+            return "47";
+        case 0x48:
+            return "48";
+        case 0x49:
+            return "49";
+        case 0x4A:
+            return "4a";
+        case 0x4B:
+            return "4b";
+        case 0x4C:
+            return "4c";
+        case 0x4D:
+            return "4d";
+        case 0x4E:
+            return "4e";
+        case 0x4F:
+            return "4f";
+        case 0x50:
+            return "50";
+        case 0x51:
+            return "51";
+        case 0x52:
+            return "52";
+        case 0x53:
+            return "53";
+        case 0x54:
+            return "54";
+        case 0x55:
+            return "55";
+        case 0x56:
+            return "56";
+        case 0x57:
+            return "57";
+        case 0x58:
+            return "58";
+        case 0x59:
+            return "59";
+        case 0x5A:
+            return "5a";
+        case 0x5B:
+            return "5b";
+        case 0x5C:
+            return "5c";
+        case 0x5D:
+            return "5d";
+        case 0x5E:
+            return "5e";
+        case 0x5F:
+            return "5f";
+        case 0x60:
+            return "60";
+        case 0x61:
+            return "61";
+        case 0x62:
+            return "62";
+        case 0x63:
+            return "63";
+        case 0x64:
+            return "64";
+        case 0x65:
+            return "65";
+        case 0x66:
+            return "66";
+        case 0x67:
+            return "67";
+        case 0x68:
+            return "68";
+        case 0x69:
+            return "69";
+        case 0x6A:
+            return "6a";
+        case 0x6B:
+            return "6b";
+        case 0x6C:
+            return "6c";
+        case 0x6D:
+            return "6d";
+        case 0x6E:
+            return "6e";
+        case 0x6F:
+            return "6f";
+        case 0x70:
+            return "70";
+        case 0x71:
+            return "71";
+        case 0x72:
+            return "72";
+        case 0x73:
+            return "73";
+        case 0x74:
+            return "74";
+        case 0x75:
+            return "75";
+        case 0x76:
+            return "76";
+        case 0x77:
+            return "77";
+        case 0x78:
+            return "78";
+        case 0x79:
+            return "79";
+        case 0x7A:
+            return "7a";
+        case 0x7B:
+            return "7b";
+        case 0x7C:
+            return "7c";
+        case 0x7D:
+            return "7d";
+        case 0x7E:
+            return "7e";
+        case 0x7F:
+            return "7f";
+        case 0x80:
+            return "80";
+        case 0x81:
+            return "81";
+        case 0x82:
+            return "82";
+        case 0x83:
+            return "83";
+        case 0x84:
+            return "84";
+        case 0x85:
+            return "85";
+        case 0x86:
+            return "86";
+        case 0x87:
+            return "87";
+        case 0x88:
+            return "88";
+        case 0x89:
+            return "89";
+        case 0x8A:
+            return "8a";
+        case 0x8B:
+            return "8b";
+        case 0x8C:
+            return "8c";
+        case 0x8D:
+            return "8d";
+        case 0x8E:
+            return "8e";
+        case 0x8F:
+            return "8f";
+        case 0x90:
+            return "90";
+        case 0x91:
+            return "91";
+        case 0x92:
+            return "92";
+        case 0x93:
+            return "93";
+        case 0x94:
+            return "94";
+        case 0x95:
+            return "95";
+        case 0x96:
+            return "96";
+        case 0x97:
+            return "97";
+        case 0x98:
+            return "98";
+        case 0x99:
+            return "99";
+        case 0x9A:
+            return "9a";
+        case 0x9B:
+            return "9b";
+        case 0x9C:
+            return "9c";
+        case 0x9D:
+            return "9d";
+        case 0x9E:
+            return "9e";
+        case 0x9F:
+            return "9f";
+        case 0xA0:
+            return "a0";
+        case 0xA1:
+            return "a1";
+        case 0xA2:
+            return "a2";
+        case 0xA3:
+            return "a3";
+        case 0xA4:
+            return "a4";
+        case 0xA5:
+            return "a5";
+        case 0xA6:
+            return "a6";
+        case 0xA7:
+            return "a7";
+        case 0xA8:
+            return "a8";
+        case 0xA9:
+            return "a9";
+        case 0xAA:
+            return "aa";
+        case 0xAB:
+            return "ab";
+        case 0xAC:
+            return "ac";
+        case 0xAD:
+            return "ad";
+        case 0xAE:
+            return "ae";
+        case 0xAF:
+            return "af";
+        case 0xB0:
+            return "b0";
+        case 0xB1:
+            return "b1";
+        case 0xB2:
+            return "b2";
+        case 0xB3:
+            return "b3";
+        case 0xB4:
+            return "b4";
+        case 0xB5:
+            return "b5";
+        case 0xB6:
+            return "b6";
+        case 0xB7:
+            return "b7";
+        case 0xB8:
+            return "b8";
+        case 0xB9:
+            return "b9";
+        case 0xBA:
+            return "ba";
+        case 0xBB:
+            return "bb";
+        case 0xBC:
+            return "bc";
+        case 0xBD:
+            return "bd";
+        case 0xBE:
+            return "be";
+        case 0xBF:
+            return "bf";
+        case 0xC0:
+            return "c0";
+        case 0xC1:
+            return "c1";
+        case 0xC2:
+            return "c2";
+        case 0xC3:
+            return "c3";
+        case 0xC4:
+            return "c4";
+        case 0xC5:
+            return "c5";
+        case 0xC6:
+            return "c6";
+        case 0xC7:
+            return "c7";
+        case 0xC8:
+            return "c8";
+        case 0xC9:
+            return "c9";
+        case 0xCA:
+            return "ca";
+        case 0xCB:
+            return "cb";
+        case 0xCC:
+            return "cc";
+        case 0xCD:
+            return "cd";
+        case 0xCE:
+            return "ce";
+        case 0xCF:
+            return "cf";
+        case 0xD0:
+            return "d0";
+        case 0xD1:
+            return "d1";
+        case 0xD2:
+            return "d2";
+        case 0xD3:
+            return "d3";
+        case 0xD4:
+            return "d4";
+        case 0xD5:
+            return "d5";
+        case 0xD6:
+            return "d6";
+        case 0xD7:
+            return "d7";
+        case 0xD8:
+            return "d8";
+        case 0xD9:
+            return "d9";
+        case 0xDA:
+            return "da";
+        case 0xDB:
+            return "db";
+        case 0xDC:
+            return "dc";
+        case 0xDD:
+            return "dd";
+        case 0xDE:
+            return "de";
+        case 0xDF:
+            return "df";
+        case 0xE0:
+            return "e0";
+        case 0xE1:
+            return "e1";
+        case 0xE2:
+            return "e2";
+        case 0xE3:
+            return "e3";
+        case 0xE4:
+            return "e4";
+        case 0xE5:
+            return "e5";
+        case 0xE6:
+            return "e6";
+        case 0xE7:
+            return "e7";
+        case 0xE8:
+            return "e8";
+        case 0xE9:
+            return "e9";
+        case 0xEA:
+            return "ea";
+        case 0xEB:
+            return "eb";
+        case 0xEC:
+            return "ec";
+        case 0xED:
+            return "ed";
+        case 0xEE:
+            return "ee";
+        case 0xEF:
+            return "ef";
+        case 0xF0:
+            return "f0";
+        case 0xF1:
+            return "f1";
+        case 0xF2:
+            return "f2";
+        case 0xF3:
+            return "f3";
+        case 0xF4:
+            return "f4";
+        case 0xF5:
+            return "f5";
+        case 0xF6:
+            return "f6";
+        case 0xF7:
+            return "f7";
+        case 0xF8:
+            return "f8";
+        case 0xF9:
+            return "f9";
+        case 0xFA:
+            return "fa";
+        case 0xFB:
+            return "fb";
+        case 0xFC:
+            return "fc";
+        case 0xFD:
+            return "fd";
+        case 0xFE:
+            return "fe";
+        case 0xFF:
+            return "ff";
+        default:
+            return "??";
+        }
     }
-  }
 
+    /**
+     * Attempts to compress the data in the provided source array into the given
+     * destination array. If the compressed data will fit into the destination
+     * array, then this method will return the number of bytes of compressed
+     * data in the array. Otherwise, it will return -1 to indicate that the
+     * compression was not successful. Note that if -1 is returned, then the
+     * data in the destination array should be considered invalid.
+     *
+     * @param src
+     *            The array containing the raw data to compress.
+     * @param srcOff
+     *            The start offset of the source data.
+     * @param srcLen
+     *            The maximum number of source data bytes to compress.
+     * @param dst
+     *            The array into which the compressed data should be written.
+     * @param dstOff
+     *            The start offset of the compressed data.
+     * @param dstLen
+     *            The maximum number of bytes of compressed data.
+     * @return The number of bytes of compressed data, or -1 if it was not
+     *         possible to actually compress the data.
+     */
+    public static int compress(final byte[] src, final int srcOff, final int srcLen,
+            final byte[] dst, final int dstOff, final int dstLen) {
+        final Deflater deflater = new Deflater();
+        try {
+            deflater.setInput(src, srcOff, srcLen);
+            deflater.finish();
 
-
-  /**
-   * Returns the default scheduler which should be used by the SDK.
-   *
-   * @return The default scheduler.
-   */
-  public static ScheduledExecutorService getDefaultScheduler()
-  {
-    synchronized (DEFAULT_SCHEDULER_LOCK)
-    {
-      if (defaultScheduler == null)
-      {
-        final ThreadFactory factory = newThreadFactory(null,
-            "OpenDJ SDK Default Scheduler", true);
-        defaultScheduler = Executors.newSingleThreadScheduledExecutor(factory);
-      }
+            final int compressedLength = deflater.deflate(dst, dstOff, dstLen);
+            if (deflater.finished()) {
+                return compressedLength;
+            } else {
+                return -1;
+            }
+        } finally {
+            deflater.end();
+        }
     }
-    return defaultScheduler;
-  }
 
+    /**
+     * Attempts to compress the data in the provided byte sequence into the
+     * provided byte string builder. Note that if compression was not
+     * successful, then the byte string builder will be left unchanged.
+     *
+     * @param input
+     *            The source data to be compressed.
+     * @param output
+     *            The destination buffer to which the compressed data will be
+     *            appended.
+     * @return <code>true</code> if compression was successful or
+     *         <code>false</code> otherwise.
+     */
+    public static boolean compress(final ByteSequence input, final ByteStringBuilder output) {
+        final byte[] inputBytes = input.toByteArray();
+        final byte[] outputBytes = new byte[inputBytes.length];
 
+        final int compressedSize =
+                compress(inputBytes, 0, inputBytes.length, outputBytes, 0, outputBytes.length);
 
-  /**
-   * Retrieves the best human-readable message for the provided exception. For
-   * exceptions defined in the OpenDJ project, it will attempt to use the
-   * message (combining it with the message ID if available). For some
-   * exceptions that use encapsulation (e.g., InvocationTargetException), it
-   * will be unwrapped and the cause will be treated. For all others, the
-   *
-   * @param t
-   *          The {@code Throwable} object for which to retrieve the message.
-   * @return The human-readable message generated for the provided exception.
-   */
-  public static LocalizableMessage getExceptionMessage(final Throwable t)
-  {
-    if (t instanceof LocalizableException)
-    {
-      final LocalizableException ie = (LocalizableException) t;
-      return ie.getMessageObject();
+        if (compressedSize != -1) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                StaticUtils.DEBUG_LOG.fine(String.format("Compression %d/%d%n", compressedSize,
+                        inputBytes.length));
+            }
+
+            output.append(outputBytes, 0, compressedSize);
+            return true;
+        }
+
+        return false;
     }
-    else if (t instanceof NullPointerException)
-    {
-      final StackTraceElement[] stackElements = t.getStackTrace();
 
-      final LocalizableMessageBuilder message = new LocalizableMessageBuilder();
-      message.append("NullPointerException(");
-      message.append(stackElements[0].getFileName());
-      message.append(":");
-      message.append(stackElements[0].getLineNumber());
-      message.append(")");
-      return message.toMessage();
+    /**
+     * Returns a string containing provided date formatted using the generalized
+     * time syntax.
+     *
+     * @param date
+     *            The date to be formated.
+     * @return The string containing provided date formatted using the
+     *         generalized time syntax.
+     * @throws NullPointerException
+     *             If {@code date} was {@code null}.
+     */
+    public static String formatAsGeneralizedTime(final Date date) {
+        return formatAsGeneralizedTime(date.getTime());
     }
-    else if (t instanceof InvocationTargetException && t.getCause() != null)
-    {
-      return getExceptionMessage(t.getCause());
+
+    /**
+     * Returns a string containing provided date formatted using the generalized
+     * time syntax.
+     *
+     * @param date
+     *            The date to be formated.
+     * @return The string containing provided date formatted using the
+     *         generalized time syntax.
+     * @throws IllegalArgumentException
+     *             If {@code date} was invalid.
+     */
+    public static String formatAsGeneralizedTime(final long date) {
+        // Generalized time has the format yyyyMMddHHmmss.SSS'Z'
+
+        // Do this in a thread-safe non-synchronized fashion.
+        // (Simple)DateFormat is neither fast nor thread-safe.
+
+        final StringBuilder sb = new StringBuilder(19);
+
+        final GregorianCalendar calendar = new GregorianCalendar(TIME_ZONE_UTC_OBJ);
+        calendar.setLenient(false);
+        calendar.setTimeInMillis(date);
+
+        // Format the year yyyy.
+        int n = calendar.get(Calendar.YEAR);
+        if (n < 0) {
+            final IllegalArgumentException e =
+                    new IllegalArgumentException("Year cannot be < 0:" + n);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "format", e);
+            throw e;
+        } else if (n < 10) {
+            sb.append("000");
+        } else if (n < 100) {
+            sb.append("00");
+        } else if (n < 1000) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the month MM.
+        n = calendar.get(Calendar.MONTH) + 1;
+        if (n < 10) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the day dd.
+        n = calendar.get(Calendar.DAY_OF_MONTH);
+        if (n < 10) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the hour HH.
+        n = calendar.get(Calendar.HOUR_OF_DAY);
+        if (n < 10) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the minute mm.
+        n = calendar.get(Calendar.MINUTE);
+        if (n < 10) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the seconds ss.
+        n = calendar.get(Calendar.SECOND);
+        if (n < 10) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the milli-seconds.
+        sb.append('.');
+        n = calendar.get(Calendar.MILLISECOND);
+        if (n < 10) {
+            sb.append("00");
+        } else if (n < 100) {
+            sb.append("0");
+        }
+        sb.append(n);
+
+        // Format the timezone (always Z).
+        sb.append('Z');
+
+        return sb.toString();
     }
-    else
-    {
-      final StringBuilder message = new StringBuilder();
 
-      final String className = t.getClass().getName();
-      final int periodPos = className.lastIndexOf('.');
-      if (periodPos > 0)
-      {
-        message.append(className.substring(periodPos + 1));
-      }
-      else
-      {
-        message.append(className);
-      }
+    /**
+     * Construct a byte array containing the UTF-8 encoding of the provided
+     * character array.
+     *
+     * @param chars
+     *            The character array to convert to a UTF-8 byte array.
+     * @return A byte array containing the UTF-8 encoding of the provided
+     *         character array.
+     */
+    public static byte[] getBytes(final char[] chars) {
+        final Charset utf8 = Charset.forName("UTF-8");
+        final ByteBuffer buffer = utf8.encode(CharBuffer.wrap(chars));
+        final byte[] bytes = new byte[buffer.remaining()];
+        buffer.get(bytes);
+        return bytes;
+    }
 
-      message.append("(");
-      if (t.getMessage() == null)
-      {
-        final StackTraceElement[] stackElements = t.getStackTrace();
-        message.append(stackElements[0].getFileName());
-        message.append(":");
-        message.append(stackElements[0].getLineNumber());
+    /**
+     * Construct a byte array containing the UTF-8 encoding of the provided
+     * string. This is significantly faster than calling
+     * {@link String#getBytes(String)} for ASCII strings.
+     *
+     * @param s
+     *            The string to convert to a UTF-8 byte array.
+     * @return Returns a byte array containing the UTF-8 encoding of the
+     *         provided string.
+     */
+    public static byte[] getBytes(final String s) {
+        if (s == null) {
+            return null;
+        }
 
-        // FIXME Temporary to debug issue 2256.
-        if (t instanceof IllegalStateException)
-        {
-          for (int i = 1; i < stackElements.length; i++)
-          {
-            message.append(' ');
-            message.append(stackElements[i].getFileName());
+        try {
+            char c;
+            final int length = s.length();
+            final byte[] returnArray = new byte[length];
+            for (int i = 0; i < length; i++) {
+                c = s.charAt(i);
+                returnArray[i] = (byte) (c & 0x0000007F);
+                if (c != returnArray[i]) {
+                    return s.getBytes("UTF-8");
+                }
+            }
+
+            return returnArray;
+        } catch (final Exception e) {
+            DEBUG_LOG.warning("Unable to encode UTF-8 string " + s);
+
+            return s.getBytes();
+        }
+    }
+
+    /**
+     * Returns the default scheduler which should be used by the SDK.
+     *
+     * @return The default scheduler.
+     */
+    public static ScheduledExecutorService getDefaultScheduler() {
+        synchronized (DEFAULT_SCHEDULER_LOCK) {
+            if (defaultScheduler == null) {
+                final ThreadFactory factory =
+                        newThreadFactory(null, "OpenDJ SDK Default Scheduler", true);
+                defaultScheduler = Executors.newSingleThreadScheduledExecutor(factory);
+            }
+        }
+        return defaultScheduler;
+    }
+
+    /**
+     * Retrieves the best human-readable message for the provided exception. For
+     * exceptions defined in the OpenDJ project, it will attempt to use the
+     * message (combining it with the message ID if available). For some
+     * exceptions that use encapsulation (e.g., InvocationTargetException), it
+     * will be unwrapped and the cause will be treated. For all others, the
+     *
+     * @param t
+     *            The {@code Throwable} object for which to retrieve the
+     *            message.
+     * @return The human-readable message generated for the provided exception.
+     */
+    public static LocalizableMessage getExceptionMessage(final Throwable t) {
+        if (t instanceof LocalizableException) {
+            final LocalizableException ie = (LocalizableException) t;
+            return ie.getMessageObject();
+        } else if (t instanceof NullPointerException) {
+            final StackTraceElement[] stackElements = t.getStackTrace();
+
+            final LocalizableMessageBuilder message = new LocalizableMessageBuilder();
+            message.append("NullPointerException(");
+            message.append(stackElements[0].getFileName());
             message.append(":");
-            message.append(stackElements[i].getLineNumber());
-          }
+            message.append(stackElements[0].getLineNumber());
+            message.append(")");
+            return message.toMessage();
+        } else if (t instanceof InvocationTargetException && t.getCause() != null) {
+            return getExceptionMessage(t.getCause());
+        } else {
+            final StringBuilder message = new StringBuilder();
+
+            final String className = t.getClass().getName();
+            final int periodPos = className.lastIndexOf('.');
+            if (periodPos > 0) {
+                message.append(className.substring(periodPos + 1));
+            } else {
+                message.append(className);
+            }
+
+            message.append("(");
+            if (t.getMessage() == null) {
+                final StackTraceElement[] stackElements = t.getStackTrace();
+                message.append(stackElements[0].getFileName());
+                message.append(":");
+                message.append(stackElements[0].getLineNumber());
+
+                // FIXME Temporary to debug issue 2256.
+                if (t instanceof IllegalStateException) {
+                    for (int i = 1; i < stackElements.length; i++) {
+                        message.append(' ');
+                        message.append(stackElements[i].getFileName());
+                        message.append(":");
+                        message.append(stackElements[i].getLineNumber());
+                    }
+                }
+            } else {
+                message.append(t.getMessage());
+            }
+
+            message.append(")");
+
+            return LocalizableMessage.raw(message.toString());
         }
-      }
-      else
-      {
-        message.append(t.getMessage());
-      }
-
-      message.append(")");
-
-      return LocalizableMessage.raw(message.toString());
-    }
-  }
-
-
-
-  /**
-   * Converts the provided hexadecimal string to a byte array.
-   *
-   * @param hexString
-   *          The hexadecimal string to convert to a byte array.
-   * @return The byte array containing the binary representation of the provided
-   *         hex string.
-   * @throws java.text.ParseException
-   *           If the provided string contains invalid hexadecimal digits or
-   *           does not contain an even number of digits.
-   */
-  public static byte[] hexStringToByteArray(final String hexString)
-      throws ParseException
-  {
-    int length;
-    if (hexString == null || (length = hexString.length()) == 0)
-    {
-      return new byte[0];
     }
 
-    if (length % 2 != 0)
-    {
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH
-          .get(hexString);
-      throw new ParseException(message.toString(), 0);
-    }
-
-    final int arrayLength = length / 2;
-    final byte[] returnArray = new byte[arrayLength];
-    for (int i = 0; i < arrayLength; i++)
-    {
-      returnArray[i] = hexToByte(hexString.charAt(i * 2), hexString
-          .charAt(i * 2 + 1));
-    }
-
-    return returnArray;
-  }
-
-
-
-  /**
-   * Converts the provided pair of characters to a byte.
-   *
-   * @param c1
-   *          The first hexadecimal character.
-   * @param c2
-   *          The second hexadecimal character.
-   * @return The byte containing the binary representation of the provided hex
-   *         characters.
-   * @throws ParseException
-   *           If the provided string contains invalid hexadecimal digits or
-   *           does not contain an even number of digits.
-   */
-  public static byte hexToByte(final char c1, final char c2)
-      throws ParseException
-  {
-    byte b;
-    switch (c1)
-    {
-    case '0':
-      b = 0x00;
-      break;
-    case '1':
-      b = 0x10;
-      break;
-    case '2':
-      b = 0x20;
-      break;
-    case '3':
-      b = 0x30;
-      break;
-    case '4':
-      b = 0x40;
-      break;
-    case '5':
-      b = 0x50;
-      break;
-    case '6':
-      b = 0x60;
-      break;
-    case '7':
-      b = 0x70;
-      break;
-    case '8':
-      b = (byte) 0x80;
-      break;
-    case '9':
-      b = (byte) 0x90;
-      break;
-    case 'A':
-    case 'a':
-      b = (byte) 0xA0;
-      break;
-    case 'B':
-    case 'b':
-      b = (byte) 0xB0;
-      break;
-    case 'C':
-    case 'c':
-      b = (byte) 0xC0;
-      break;
-    case 'D':
-    case 'd':
-      b = (byte) 0xD0;
-      break;
-    case 'E':
-    case 'e':
-      b = (byte) 0xE0;
-      break;
-    case 'F':
-    case 'f':
-      b = (byte) 0xF0;
-      break;
-    default:
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_CHARACTER.get(
-          new String(new char[] { c1, c2 }), c1);
-      throw new ParseException(message.toString(), 0);
-    }
-
-    switch (c2)
-    {
-    case '0':
-      // No action required.
-      break;
-    case '1':
-      b |= 0x01;
-      break;
-    case '2':
-      b |= 0x02;
-      break;
-    case '3':
-      b |= 0x03;
-      break;
-    case '4':
-      b |= 0x04;
-      break;
-    case '5':
-      b |= 0x05;
-      break;
-    case '6':
-      b |= 0x06;
-      break;
-    case '7':
-      b |= 0x07;
-      break;
-    case '8':
-      b |= 0x08;
-      break;
-    case '9':
-      b |= 0x09;
-      break;
-    case 'A':
-    case 'a':
-      b |= 0x0A;
-      break;
-    case 'B':
-    case 'b':
-      b |= 0x0B;
-      break;
-    case 'C':
-    case 'c':
-      b |= 0x0C;
-      break;
-    case 'D':
-    case 'd':
-      b |= 0x0D;
-      break;
-    case 'E':
-    case 'e':
-      b |= 0x0E;
-      break;
-    case 'F':
-    case 'f':
-      b |= 0x0F;
-      break;
-    default:
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_CHARACTER.get(
-          new String(new char[] { c1, c2 }), c1);
-      throw new ParseException(message.toString(), 0);
-    }
-
-    return b;
-  }
-
-
-
-  /**
-   * Indicates whether the provided character is an ASCII alphabetic character.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided value is an uppercase or
-   *         lowercase ASCII alphabetic character, or <CODE>false</CODE> if it
-   *         is not.
-   */
-  public static boolean isAlpha(final char c)
-  {
-    final ASCIICharProp cp = ASCIICharProp.valueOf(c);
-    return cp != null ? cp.isLetter() : false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided character is a numeric digit.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided character represents a numeric
-   *         digit, or <CODE>false</CODE> if not.
-   */
-  public static boolean isDigit(final char c)
-  {
-    final ASCIICharProp cp = ASCIICharProp.valueOf(c);
-    return cp != null ? cp.isDigit() : false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided character is a hexadecimal digit.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided character represents a
-   *         hexadecimal digit, or <CODE>false</CODE> if not.
-   */
-  public static boolean isHexDigit(final char c)
-  {
-    final ASCIICharProp cp = ASCIICharProp.valueOf(c);
-    return cp != null ? cp.isHexDigit() : false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided character is a keychar.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @param allowCompatChars
-   *          {@code true} if certain illegal characters should be allowed for
-   *          compatibility reasons.
-   * @return <CODE>true</CODE> if the provided character represents a
-   *         keychar, or <CODE>false</CODE> if not.
-   */
-  public static boolean isKeyChar(final char c, final boolean allowCompatChars)
-  {
-    final ASCIICharProp cp = ASCIICharProp.valueOf(c);
-    return cp != null ? cp.isKeyChar(allowCompatChars) : false;
-  }
-
-
-
-  /**
-   * Returns a string whose content is the string representation of the objects
-   * contained in the provided collection concatenated together using the
-   * provided separator.
-   *
-   * @param c
-   *          The collection whose elements are to be joined.
-   * @param separator
-   *          The separator string.
-   * @return A string whose content is the string representation of the objects
-   *         contained in the provided collection concatenated together using
-   *         the provided separator.
-   * @throws NullPointerException
-   *           If {@code c} or {@code separator} were {@code null}.
-   */
-  public static String joinCollection(Collection<?> c, String separator)
-  {
-    Validator.ensureNotNull(c, separator);
-
-    switch (c.size())
-    {
-    case 0:
-      return "";
-    case 1:
-      return String.valueOf(c.iterator().next());
-    default:
-      StringBuilder builder = new StringBuilder();
-      Iterator<?> i = c.iterator();
-      builder.append(i.next());
-      while (i.hasNext())
-      {
-        builder.append(separator);
-        builder.append(i.next());
-      }
-      String s = builder.toString();
-      return s;
-    }
-  }
-
-
-
-
-  /**
-   * Creates a new thread factory which will create threads using the specified
-   * thread group, naming template, and daemon status.
-   *
-   * @param group
-   *          The thread group, which may be {@code null}.
-   * @param nameTemplate
-   *          The thread name format string which may contain a "%d" format
-   *          option which will be substituted with the thread count.
-   * @param isDaemon
-   *          Indicates whether or not threads should be daemon threads.
-   * @return The new thread factory.
-   */
-  public static ThreadFactory newThreadFactory(final ThreadGroup group,
-      final String nameTemplate, final boolean isDaemon)
-  {
-    return new ThreadFactory()
-    {
-      private final AtomicInteger count = new AtomicInteger();
-
-
-
-      public Thread newThread(Runnable r)
-      {
-        final String name = String
-            .format(nameTemplate, count.getAndIncrement());
-        final Thread t = new Thread(group, r, name);
-        t.setDaemon(isDaemon);
-        return t;
-      }
-    };
-  }
-
-
-  /**
-   * Returns a string representation of the contents of the provided byte
-   * sequence using hexadecimal characters and a space between each byte.
-   *
-   * @param bytes
-   *          The byte sequence.
-   * @return A string representation of the contents of the provided byte
-   *         sequence using hexadecimal characters.
-   */
-  public static String toHex(final ByteSequence bytes)
-  {
-    return toHex(bytes, new StringBuilder((bytes.length() - 1) * 3 + 2))
-        .toString();
-  }
-
-
-
-  /**
-   * Appends the string representation of the contents of the provided byte
-   * sequence to a string builder using hexadecimal characters and a space
-   * between each byte.
-   *
-   * @param bytes
-   *          The byte sequence.
-   * @param builder
-   *          The string builder to which the hexadecimal representation of
-   *          {@code bytes} should be appended.
-   * @return The string builder.
-   */
-  public static StringBuilder toHex(final ByteSequence bytes,
-      final StringBuilder builder)
-  {
-    final int length = bytes.length();
-    builder.ensureCapacity(builder.length() + (length - 1) * 3 + 2);
-    builder.append(StaticUtils.byteToHex(bytes.byteAt(0)));
-    for (int i = 1; i < length; i++)
-    {
-      builder.append(" ");
-      builder.append(StaticUtils.byteToHex(bytes.byteAt(i)));
-    }
-    return builder;
-  }
-
-
-
-  /**
-   * Appends a string representation of the data in the provided byte sequence
-   * to the given string builder using the specified indent.
-   * <p>
-   * The data will be formatted with sixteen hex bytes in a row followed by the
-   * ASCII representation, then wrapping to a new line as necessary. The state
-   * of the byte buffer is not changed.
-   *
-   * @param bytes
-   *          The byte sequence.
-   * @param builder
-   *          The string builder to which the information is to be appended.
-   * @param indent
-   *          The number of spaces to indent the output.
-   * @return The string builder.
-   */
-  public static StringBuilder toHexPlusAscii(final ByteSequence bytes,
-      final StringBuilder builder, final int indent)
-  {
-    final StringBuilder indentBuf = new StringBuilder(indent);
-    for (int i = 0; i < indent; i++)
-    {
-      indentBuf.append(' ');
-    }
-
-    final int length = bytes.length();
-    int pos = 0;
-    while (length - pos >= 16)
-    {
-      final StringBuilder asciiBuf = new StringBuilder(17);
-
-      byte currentByte = bytes.byteAt(pos);
-      builder.append(indentBuf);
-      builder.append(StaticUtils.byteToHex(currentByte));
-      asciiBuf.append(byteToASCII(currentByte));
-      pos++;
-
-      for (int i = 1; i < 16; i++, pos++)
-      {
-        currentByte = bytes.byteAt(pos);
-        builder.append(' ');
-        builder.append(StaticUtils.byteToHex(currentByte));
-        asciiBuf.append(byteToASCII(currentByte));
-
-        if (i == 7)
-        {
-          builder.append("  ");
-          asciiBuf.append(' ');
-        }
-      }
-
-      builder.append("  ");
-      builder.append(asciiBuf);
-      builder.append(EOL);
-    }
-
-    final int remaining = length - pos;
-    if (remaining > 0)
-    {
-      final StringBuilder asciiBuf = new StringBuilder(remaining + 1);
-
-      byte currentByte = bytes.byteAt(pos);
-      builder.append(indentBuf);
-      builder.append(StaticUtils.byteToHex(currentByte));
-      asciiBuf.append(byteToASCII(currentByte));
-      pos++;
-
-      for (int i = 1; i < 16; i++, pos++)
-      {
-        builder.append(' ');
-
-        if (i < remaining)
-        {
-          currentByte = bytes.byteAt(pos);
-          builder.append(StaticUtils.byteToHex(currentByte));
-          asciiBuf.append(byteToASCII(currentByte));
-        }
-        else
-        {
-          builder.append("  ");
+    /**
+     * Converts the provided hexadecimal string to a byte array.
+     *
+     * @param hexString
+     *            The hexadecimal string to convert to a byte array.
+     * @return The byte array containing the binary representation of the
+     *         provided hex string.
+     * @throws java.text.ParseException
+     *             If the provided string contains invalid hexadecimal digits or
+     *             does not contain an even number of digits.
+     */
+    public static byte[] hexStringToByteArray(final String hexString) throws ParseException {
+        int length;
+        if (hexString == null || (length = hexString.length()) == 0) {
+            return new byte[0];
         }
 
-        if (i == 7)
-        {
-          builder.append("  ");
-
-          if (i < remaining)
-          {
-            asciiBuf.append(' ');
-          }
+        if (length % 2 != 0) {
+            final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH.get(hexString);
+            throw new ParseException(message.toString(), 0);
         }
-      }
 
-      builder.append("  ");
-      builder.append(asciiBuf);
-      builder.append(EOL);
+        final int arrayLength = length / 2;
+        final byte[] returnArray = new byte[arrayLength];
+        for (int i = 0; i < arrayLength; i++) {
+            returnArray[i] = hexToByte(hexString.charAt(i * 2), hexString.charAt(i * 2 + 1));
+        }
+
+        return returnArray;
     }
 
-    return builder;
-  }
+    /**
+     * Converts the provided pair of characters to a byte.
+     *
+     * @param c1
+     *            The first hexadecimal character.
+     * @param c2
+     *            The second hexadecimal character.
+     * @return The byte containing the binary representation of the provided hex
+     *         characters.
+     * @throws ParseException
+     *             If the provided string contains invalid hexadecimal digits or
+     *             does not contain an even number of digits.
+     */
+    public static byte hexToByte(final char c1, final char c2) throws ParseException {
+        byte b;
+        switch (c1) {
+        case '0':
+            b = 0x00;
+            break;
+        case '1':
+            b = 0x10;
+            break;
+        case '2':
+            b = 0x20;
+            break;
+        case '3':
+            b = 0x30;
+            break;
+        case '4':
+            b = 0x40;
+            break;
+        case '5':
+            b = 0x50;
+            break;
+        case '6':
+            b = 0x60;
+            break;
+        case '7':
+            b = 0x70;
+            break;
+        case '8':
+            b = (byte) 0x80;
+            break;
+        case '9':
+            b = (byte) 0x90;
+            break;
+        case 'A':
+        case 'a':
+            b = (byte) 0xA0;
+            break;
+        case 'B':
+        case 'b':
+            b = (byte) 0xB0;
+            break;
+        case 'C':
+        case 'c':
+            b = (byte) 0xC0;
+            break;
+        case 'D':
+        case 'd':
+            b = (byte) 0xD0;
+            break;
+        case 'E':
+        case 'e':
+            b = (byte) 0xE0;
+            break;
+        case 'F':
+        case 'f':
+            b = (byte) 0xF0;
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_HEX_DECODE_INVALID_CHARACTER.get(new String(new char[] { c1, c2 }), c1);
+            throw new ParseException(message.toString(), 0);
+        }
 
+        switch (c2) {
+        case '0':
+            // No action required.
+            break;
+        case '1':
+            b |= 0x01;
+            break;
+        case '2':
+            b |= 0x02;
+            break;
+        case '3':
+            b |= 0x03;
+            break;
+        case '4':
+            b |= 0x04;
+            break;
+        case '5':
+            b |= 0x05;
+            break;
+        case '6':
+            b |= 0x06;
+            break;
+        case '7':
+            b |= 0x07;
+            break;
+        case '8':
+            b |= 0x08;
+            break;
+        case '9':
+            b |= 0x09;
+            break;
+        case 'A':
+        case 'a':
+            b |= 0x0A;
+            break;
+        case 'B':
+        case 'b':
+            b |= 0x0B;
+            break;
+        case 'C':
+        case 'c':
+            b |= 0x0C;
+            break;
+        case 'D':
+        case 'd':
+            b |= 0x0D;
+            break;
+        case 'E':
+        case 'e':
+            b |= 0x0E;
+            break;
+        case 'F':
+        case 'f':
+            b |= 0x0F;
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_HEX_DECODE_INVALID_CHARACTER.get(new String(new char[] { c1, c2 }), c1);
+            throw new ParseException(message.toString(), 0);
+        }
 
+        return b;
+    }
 
-  /**
-   * Appends a lowercase string representation of the contents of the given byte
-   * array to the provided buffer. This implementation presumes that the
-   * provided string will contain only ASCII characters and is optimized for
-   * that case. However, if a non-ASCII character is encountered it will fall
-   * back on a more expensive algorithm that will work properly for non-ASCII
-   * characters.
-   *
-   * @param b
-   *          The byte array for which to obtain the lowercase string
-   *          representation.
-   * @param builder
-   *          The buffer to which the lowercase form of the string should be
-   *          appended.
-   * @return The updated {@code StringBuilder}.
-   */
-  public static StringBuilder toLowerCase(final ByteSequence b,
-      final StringBuilder builder)
-  {
-    Validator.ensureNotNull(b, builder);
+    /**
+     * Indicates whether the provided character is an ASCII alphabetic
+     * character.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided value is an uppercase or
+     *         lowercase ASCII alphabetic character, or <CODE>false</CODE> if it
+     *         is not.
+     */
+    public static boolean isAlpha(final char c) {
+        final ASCIICharProp cp = ASCIICharProp.valueOf(c);
+        return cp != null ? cp.isLetter() : false;
+    }
 
-    // FIXME: What locale should we use for non-ASCII characters? I
-    // think we should use default to the Unicode StringPrep.
+    /**
+     * Indicates whether the provided character is a numeric digit.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided character represents a numeric
+     *         digit, or <CODE>false</CODE> if not.
+     */
+    public static boolean isDigit(final char c) {
+        final ASCIICharProp cp = ASCIICharProp.valueOf(c);
+        return cp != null ? cp.isDigit() : false;
+    }
 
-    final int origBufferLen = builder.length();
-    final int length = b.length();
+    /**
+     * Indicates whether the provided character is a hexadecimal digit.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided character represents a
+     *         hexadecimal digit, or <CODE>false</CODE> if not.
+     */
+    public static boolean isHexDigit(final char c) {
+        final ASCIICharProp cp = ASCIICharProp.valueOf(c);
+        return cp != null ? cp.isHexDigit() : false;
+    }
 
-    for (int i = 0; i < length; i++)
-    {
-      final int c = b.byteAt(i);
+    /**
+     * Indicates whether the provided character is a keychar.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @param allowCompatChars
+     *            {@code true} if certain illegal characters should be allowed
+     *            for compatibility reasons.
+     * @return <CODE>true</CODE> if the provided character represents a keychar,
+     *         or <CODE>false</CODE> if not.
+     */
+    public static boolean isKeyChar(final char c, final boolean allowCompatChars) {
+        final ASCIICharProp cp = ASCIICharProp.valueOf(c);
+        return cp != null ? cp.isKeyChar(allowCompatChars) : false;
+    }
 
-      if (c < 0)
-      {
-        builder.replace(origBufferLen, builder.length(), b.toString()
-            .toLowerCase(Locale.ENGLISH));
+    /**
+     * Returns a string whose content is the string representation of the
+     * objects contained in the provided collection concatenated together using
+     * the provided separator.
+     *
+     * @param c
+     *            The collection whose elements are to be joined.
+     * @param separator
+     *            The separator string.
+     * @return A string whose content is the string representation of the
+     *         objects contained in the provided collection concatenated
+     *         together using the provided separator.
+     * @throws NullPointerException
+     *             If {@code c} or {@code separator} were {@code null}.
+     */
+    public static String joinCollection(Collection<?> c, String separator) {
+        Validator.ensureNotNull(c, separator);
+
+        switch (c.size()) {
+        case 0:
+            return "";
+        case 1:
+            return String.valueOf(c.iterator().next());
+        default:
+            StringBuilder builder = new StringBuilder();
+            Iterator<?> i = c.iterator();
+            builder.append(i.next());
+            while (i.hasNext()) {
+                builder.append(separator);
+                builder.append(i.next());
+            }
+            String s = builder.toString();
+            return s;
+        }
+    }
+
+    /**
+     * Creates a new thread factory which will create threads using the
+     * specified thread group, naming template, and daemon status.
+     *
+     * @param group
+     *            The thread group, which may be {@code null}.
+     * @param nameTemplate
+     *            The thread name format string which may contain a "%d" format
+     *            option which will be substituted with the thread count.
+     * @param isDaemon
+     *            Indicates whether or not threads should be daemon threads.
+     * @return The new thread factory.
+     */
+    public static ThreadFactory newThreadFactory(final ThreadGroup group,
+            final String nameTemplate, final boolean isDaemon) {
+        return new ThreadFactory() {
+            private final AtomicInteger count = new AtomicInteger();
+
+            public Thread newThread(Runnable r) {
+                final String name = String.format(nameTemplate, count.getAndIncrement());
+                final Thread t = new Thread(group, r, name);
+                t.setDaemon(isDaemon);
+                return t;
+            }
+        };
+    }
+
+    /**
+     * Returns a string representation of the contents of the provided byte
+     * sequence using hexadecimal characters and a space between each byte.
+     *
+     * @param bytes
+     *            The byte sequence.
+     * @return A string representation of the contents of the provided byte
+     *         sequence using hexadecimal characters.
+     */
+    public static String toHex(final ByteSequence bytes) {
+        return toHex(bytes, new StringBuilder((bytes.length() - 1) * 3 + 2)).toString();
+    }
+
+    /**
+     * Appends the string representation of the contents of the provided byte
+     * sequence to a string builder using hexadecimal characters and a space
+     * between each byte.
+     *
+     * @param bytes
+     *            The byte sequence.
+     * @param builder
+     *            The string builder to which the hexadecimal representation of
+     *            {@code bytes} should be appended.
+     * @return The string builder.
+     */
+    public static StringBuilder toHex(final ByteSequence bytes, final StringBuilder builder) {
+        final int length = bytes.length();
+        builder.ensureCapacity(builder.length() + (length - 1) * 3 + 2);
+        builder.append(StaticUtils.byteToHex(bytes.byteAt(0)));
+        for (int i = 1; i < length; i++) {
+            builder.append(" ");
+            builder.append(StaticUtils.byteToHex(bytes.byteAt(i)));
+        }
         return builder;
-      }
-
-      // At this point 0 <= 'c' <= 128.
-      final ASCIICharProp cp = ASCIICharProp.valueOf(c);
-      builder.append(cp.toLowerCase());
     }
 
-    return builder;
-  }
-
-
-
-  /**
-   * Retrieves a lower-case representation of the given string. This
-   * implementation presumes that the provided string will contain only ASCII
-   * characters and is optimized for that case. However, if a non-ASCII
-   * character is encountered it will fall back on a more expensive algorithm
-   * that will work properly for non-ASCII characters.
-   *
-   * @param s
-   *          The string for which to obtain the lower-case representation.
-   * @return The lower-case representation of the given string.
-   */
-  public static String toLowerCase(final String s)
-  {
-    Validator.ensureNotNull(s);
-
-    // FIXME: What locale should we use for non-ASCII characters? I
-    // think we should use default to the Unicode StringPrep.
-
-    // This code is optimized for the case where the input string 's'
-    // has already been converted to lowercase.
-    final int length = s.length();
-    int i = 0;
-    ASCIICharProp cp = null;
-
-    // Scan for non lowercase ASCII.
-    while (i < length)
-    {
-      cp = ASCIICharProp.valueOf(s.charAt(i));
-      if (cp == null || cp.isUpperCase())
-      {
-        break;
-      }
-      i++;
-    }
-
-    if (i == length)
-    {
-      // String was already lowercase ASCII.
-      return s;
-    }
-
-    // Found non lowercase ASCII.
-    final StringBuilder builder = new StringBuilder(length);
-    builder.append(s, 0, i);
-
-    if (cp != null)
-    {
-      // Upper-case ASCII.
-      builder.append(cp.toLowerCase());
-      i++;
-      while (i < length)
-      {
-        cp = ASCIICharProp.valueOf(s.charAt(i));
-        if (cp == null)
-        {
-          break;
+    /**
+     * Appends a string representation of the data in the provided byte sequence
+     * to the given string builder using the specified indent.
+     * <p>
+     * The data will be formatted with sixteen hex bytes in a row followed by
+     * the ASCII representation, then wrapping to a new line as necessary. The
+     * state of the byte buffer is not changed.
+     *
+     * @param bytes
+     *            The byte sequence.
+     * @param builder
+     *            The string builder to which the information is to be appended.
+     * @param indent
+     *            The number of spaces to indent the output.
+     * @return The string builder.
+     */
+    public static StringBuilder toHexPlusAscii(final ByteSequence bytes,
+            final StringBuilder builder, final int indent) {
+        final StringBuilder indentBuf = new StringBuilder(indent);
+        for (int i = 0; i < indent; i++) {
+            indentBuf.append(' ');
         }
-        builder.append(cp.toLowerCase());
-        i++;
-      }
-    }
 
-    if (i < length)
-    {
-      builder.append(s.substring(i).toLowerCase(Locale.ENGLISH));
-    }
+        final int length = bytes.length();
+        int pos = 0;
+        while (length - pos >= 16) {
+            final StringBuilder asciiBuf = new StringBuilder(17);
 
-    return builder.toString();
-  }
+            byte currentByte = bytes.byteAt(pos);
+            builder.append(indentBuf);
+            builder.append(StaticUtils.byteToHex(currentByte));
+            asciiBuf.append(byteToASCII(currentByte));
+            pos++;
 
+            for (int i = 1; i < 16; i++, pos++) {
+                currentByte = bytes.byteAt(pos);
+                builder.append(' ');
+                builder.append(StaticUtils.byteToHex(currentByte));
+                asciiBuf.append(byteToASCII(currentByte));
 
+                if (i == 7) {
+                    builder.append("  ");
+                    asciiBuf.append(' ');
+                }
+            }
 
-  /**
-   * Appends a lower-case representation of the given string to the provided
-   * buffer. This implementation presumes that the provided string will contain
-   * only ASCII characters and is optimized for that case. However, if a
-   * non-ASCII character is encountered it will fall back on a more expensive
-   * algorithm that will work properly for non-ASCII characters.
-   *
-   * @param s
-   *          The string for which to obtain the lower-case representation.
-   * @param builder
-   *          The {@code StringBuilder} to which the lower-case form of the
-   *          string should be appended.
-   * @return The updated {@code StringBuilder}.
-   */
-  public static StringBuilder toLowerCase(final String s,
-      final StringBuilder builder)
-  {
-    Validator.ensureNotNull(s, builder);
+            builder.append("  ");
+            builder.append(asciiBuf);
+            builder.append(EOL);
+        }
 
-    // FIXME: What locale should we use for non-ASCII characters? I
-    // think we should use default to the Unicode StringPrep.
+        final int remaining = length - pos;
+        if (remaining > 0) {
+            final StringBuilder asciiBuf = new StringBuilder(remaining + 1);
 
-    final int length = s.length();
-    builder.ensureCapacity(builder.length() + length);
+            byte currentByte = bytes.byteAt(pos);
+            builder.append(indentBuf);
+            builder.append(StaticUtils.byteToHex(currentByte));
+            asciiBuf.append(byteToASCII(currentByte));
+            pos++;
 
-    for (int i = 0; i < length; i++)
-    {
-      final ASCIICharProp cp = ASCIICharProp.valueOf(s.charAt(i));
-      if (cp != null)
-      {
-        builder.append(cp.toLowerCase());
-      }
-      else
-      {
-        // Non-ASCII.
-        builder.append(s.substring(i).toLowerCase(Locale.ENGLISH));
+            for (int i = 1; i < 16; i++, pos++) {
+                builder.append(' ');
+
+                if (i < remaining) {
+                    currentByte = bytes.byteAt(pos);
+                    builder.append(StaticUtils.byteToHex(currentByte));
+                    asciiBuf.append(byteToASCII(currentByte));
+                } else {
+                    builder.append("  ");
+                }
+
+                if (i == 7) {
+                    builder.append("  ");
+
+                    if (i < remaining) {
+                        asciiBuf.append(' ');
+                    }
+                }
+            }
+
+            builder.append("  ");
+            builder.append(asciiBuf);
+            builder.append(EOL);
+        }
+
         return builder;
-      }
     }
 
-    return builder;
-  }
+    /**
+     * Appends a lowercase string representation of the contents of the given
+     * byte array to the provided buffer. This implementation presumes that the
+     * provided string will contain only ASCII characters and is optimized for
+     * that case. However, if a non-ASCII character is encountered it will fall
+     * back on a more expensive algorithm that will work properly for non-ASCII
+     * characters.
+     *
+     * @param b
+     *            The byte array for which to obtain the lowercase string
+     *            representation.
+     * @param builder
+     *            The buffer to which the lowercase form of the string should be
+     *            appended.
+     * @return The updated {@code StringBuilder}.
+     */
+    public static StringBuilder toLowerCase(final ByteSequence b, final StringBuilder builder) {
+        Validator.ensureNotNull(b, builder);
 
+        // FIXME: What locale should we use for non-ASCII characters? I
+        // think we should use default to the Unicode StringPrep.
 
+        final int origBufferLen = builder.length();
+        final int length = b.length();
 
-  /**
-   * Attempts to uncompress the data in the provided source array into the given
-   * destination array. If the uncompressed data will fit into the given
-   * destination array, then this method will return the number of bytes of
-   * uncompressed data written into the destination buffer. Otherwise, it will
-   * return a negative value to indicate that the destination buffer was not
-   * large enough. The absolute value of that negative return value will
-   * indicate the buffer size required to fully decompress the data. Note that
-   * if a negative value is returned, then the data in the destination array
-   * should be considered invalid.
-   *
-   * @param src
-   *          The array containing the raw data to compress.
-   * @param srcOff
-   *          The start offset of the source data.
-   * @param srcLen
-   *          The maximum number of source data bytes to compress.
-   * @param dst
-   *          The array into which the compressed data should be written.
-   * @param dstOff
-   *          The start offset of the compressed data.
-   * @param dstLen
-   *          The maximum number of bytes of compressed data.
-   * @return A positive value containing the number of bytes of uncompressed
-   *         data written into the destination buffer, or a negative value whose
-   *         absolute value is the size of the destination buffer required to
-   *         fully decompress the provided data.
-   * @throws java.util.zip.DataFormatException
-   *           If a problem occurs while attempting to uncompress the data.
-   */
-  public static int uncompress(final byte[] src, final int srcOff,
-      final int srcLen, final byte[] dst, final int dstOff, final int dstLen)
-      throws DataFormatException
-  {
-    final Inflater inflater = new Inflater();
-    try
-    {
-      inflater.setInput(src, srcOff, srcLen);
+        for (int i = 0; i < length; i++) {
+            final int c = b.byteAt(i);
 
-      final int decompressedLength = inflater.inflate(dst, dstOff, dstLen);
-      if (inflater.finished())
-      {
-        return decompressedLength;
-      }
-      else
-      {
-        int totalLength = decompressedLength;
+            if (c < 0) {
+                builder.replace(origBufferLen, builder.length(), b.toString().toLowerCase(
+                        Locale.ENGLISH));
+                return builder;
+            }
 
-        while (!inflater.finished())
-        {
-          totalLength += inflater.inflate(dst, dstOff, dstLen);
+            // At this point 0 <= 'c' <= 128.
+            final ASCIICharProp cp = ASCIICharProp.valueOf(c);
+            builder.append(cp.toLowerCase());
         }
 
-        return -totalLength;
-      }
-    }
-    finally
-    {
-      inflater.end();
-    }
-  }
-
-
-
-  /**
-   * Attempts to uncompress the data in the provided byte sequence into the
-   * provided byte string builder. Note that if uncompression was not
-   * successful, then the data in the destination buffer should be considered
-   * invalid.
-   *
-   * @param input
-   *          The source data to be uncompressed.
-   * @param output
-   *          The destination buffer to which the uncompressed data will be
-   *          appended.
-   * @param uncompressedSize
-   *          The uncompressed size of the data if known or 0 otherwise.
-   * @return <code>true</code> if decompression was successful or
-   *         <code>false</code> otherwise.
-   * @throws java.util.zip.DataFormatException
-   *           If a problem occurs while attempting to uncompress the data.
-   */
-  public static boolean uncompress(final ByteSequence input,
-      final ByteStringBuilder output, final int uncompressedSize)
-      throws DataFormatException
-  {
-    final byte[] inputBytes = input.toByteArray();
-    byte[] outputBytes = new byte[uncompressedSize > 0 ? uncompressedSize : 0];
-
-    int decompressResult = uncompress(inputBytes, 0, inputBytes.length,
-        outputBytes, 0, outputBytes.length);
-
-    if (decompressResult < 0)
-    {
-      // The destination buffer wasn't big enough. Resize and retry.
-      outputBytes = new byte[-decompressResult];
-      decompressResult = uncompress(inputBytes, 0, inputBytes.length,
-          outputBytes, 0, outputBytes.length);
+        return builder;
     }
 
-    if (decompressResult >= 0)
-    {
-      // It was successful.
-      output.append(outputBytes, 0, decompressResult);
-      return true;
+    /**
+     * Retrieves a lower-case representation of the given string. This
+     * implementation presumes that the provided string will contain only ASCII
+     * characters and is optimized for that case. However, if a non-ASCII
+     * character is encountered it will fall back on a more expensive algorithm
+     * that will work properly for non-ASCII characters.
+     *
+     * @param s
+     *            The string for which to obtain the lower-case representation.
+     * @return The lower-case representation of the given string.
+     */
+    public static String toLowerCase(final String s) {
+        Validator.ensureNotNull(s);
+
+        // FIXME: What locale should we use for non-ASCII characters? I
+        // think we should use default to the Unicode StringPrep.
+
+        // This code is optimized for the case where the input string 's'
+        // has already been converted to lowercase.
+        final int length = s.length();
+        int i = 0;
+        ASCIICharProp cp = null;
+
+        // Scan for non lowercase ASCII.
+        while (i < length) {
+            cp = ASCIICharProp.valueOf(s.charAt(i));
+            if (cp == null || cp.isUpperCase()) {
+                break;
+            }
+            i++;
+        }
+
+        if (i == length) {
+            // String was already lowercase ASCII.
+            return s;
+        }
+
+        // Found non lowercase ASCII.
+        final StringBuilder builder = new StringBuilder(length);
+        builder.append(s, 0, i);
+
+        if (cp != null) {
+            // Upper-case ASCII.
+            builder.append(cp.toLowerCase());
+            i++;
+            while (i < length) {
+                cp = ASCIICharProp.valueOf(s.charAt(i));
+                if (cp == null) {
+                    break;
+                }
+                builder.append(cp.toLowerCase());
+                i++;
+            }
+        }
+
+        if (i < length) {
+            builder.append(s.substring(i).toLowerCase(Locale.ENGLISH));
+        }
+
+        return builder.toString();
     }
 
-    // Still unsuccessful. Give up.
-    return false;
-  }
+    /**
+     * Appends a lower-case representation of the given string to the provided
+     * buffer. This implementation presumes that the provided string will
+     * contain only ASCII characters and is optimized for that case. However, if
+     * a non-ASCII character is encountered it will fall back on a more
+     * expensive algorithm that will work properly for non-ASCII characters.
+     *
+     * @param s
+     *            The string for which to obtain the lower-case representation.
+     * @param builder
+     *            The {@code StringBuilder} to which the lower-case form of the
+     *            string should be appended.
+     * @return The updated {@code StringBuilder}.
+     */
+    public static StringBuilder toLowerCase(final String s, final StringBuilder builder) {
+        Validator.ensureNotNull(s, builder);
 
+        // FIXME: What locale should we use for non-ASCII characters? I
+        // think we should use default to the Unicode StringPrep.
 
+        final int length = s.length();
+        builder.ensureCapacity(builder.length() + length);
 
-  /**
-   * Returns a copy of the provided byte array.
-   *
-   * @param bytes
-   *          The byte array to be copied.
-   * @return A copy of the provided byte array.
-   */
-  public static byte[] copyOfBytes(final byte[] bytes)
-  {
-    return Arrays.copyOf(bytes, bytes.length);
-  }
+        for (int i = 0; i < length; i++) {
+            final ASCIICharProp cp = ASCIICharProp.valueOf(s.charAt(i));
+            if (cp != null) {
+                builder.append(cp.toLowerCase());
+            } else {
+                // Non-ASCII.
+                builder.append(s.substring(i).toLowerCase(Locale.ENGLISH));
+                return builder;
+            }
+        }
 
-
-
-  /**
-   * Retrieves the printable ASCII representation of the provided byte.
-   *
-   * @param b
-   *          The byte for which to retrieve the printable ASCII representation.
-   * @return The printable ASCII representation of the provided byte, or a space
-   *         if the provided byte does not have printable ASCII representation.
-   */
-  private static char byteToASCII(final byte b)
-  {
-    if (b >= 32 && b <= 126)
-    {
-      return (char) b;
+        return builder;
     }
 
-    return ' ';
-  }
+    /**
+     * Attempts to uncompress the data in the provided source array into the
+     * given destination array. If the uncompressed data will fit into the given
+     * destination array, then this method will return the number of bytes of
+     * uncompressed data written into the destination buffer. Otherwise, it will
+     * return a negative value to indicate that the destination buffer was not
+     * large enough. The absolute value of that negative return value will
+     * indicate the buffer size required to fully decompress the data. Note that
+     * if a negative value is returned, then the data in the destination array
+     * should be considered invalid.
+     *
+     * @param src
+     *            The array containing the raw data to compress.
+     * @param srcOff
+     *            The start offset of the source data.
+     * @param srcLen
+     *            The maximum number of source data bytes to compress.
+     * @param dst
+     *            The array into which the compressed data should be written.
+     * @param dstOff
+     *            The start offset of the compressed data.
+     * @param dstLen
+     *            The maximum number of bytes of compressed data.
+     * @return A positive value containing the number of bytes of uncompressed
+     *         data written into the destination buffer, or a negative value
+     *         whose absolute value is the size of the destination buffer
+     *         required to fully decompress the provided data.
+     * @throws java.util.zip.DataFormatException
+     *             If a problem occurs while attempting to uncompress the data.
+     */
+    public static int uncompress(final byte[] src, final int srcOff, final int srcLen,
+            final byte[] dst, final int dstOff, final int dstLen) throws DataFormatException {
+        final Inflater inflater = new Inflater();
+        try {
+            inflater.setInput(src, srcOff, srcLen);
 
+            final int decompressedLength = inflater.inflate(dst, dstOff, dstLen);
+            if (inflater.finished()) {
+                return decompressedLength;
+            } else {
+                int totalLength = decompressedLength;
 
+                while (!inflater.finished()) {
+                    totalLength += inflater.inflate(dst, dstOff, dstLen);
+                }
 
-  // Prevent instantiation.
-  private StaticUtils()
-  {
-    // No implementation required.
-  }
+                return -totalLength;
+            }
+        } finally {
+            inflater.end();
+        }
+    }
+
+    /**
+     * Attempts to uncompress the data in the provided byte sequence into the
+     * provided byte string builder. Note that if uncompression was not
+     * successful, then the data in the destination buffer should be considered
+     * invalid.
+     *
+     * @param input
+     *            The source data to be uncompressed.
+     * @param output
+     *            The destination buffer to which the uncompressed data will be
+     *            appended.
+     * @param uncompressedSize
+     *            The uncompressed size of the data if known or 0 otherwise.
+     * @return <code>true</code> if decompression was successful or
+     *         <code>false</code> otherwise.
+     * @throws java.util.zip.DataFormatException
+     *             If a problem occurs while attempting to uncompress the data.
+     */
+    public static boolean uncompress(final ByteSequence input, final ByteStringBuilder output,
+            final int uncompressedSize) throws DataFormatException {
+        final byte[] inputBytes = input.toByteArray();
+        byte[] outputBytes = new byte[uncompressedSize > 0 ? uncompressedSize : 0];
+
+        int decompressResult =
+                uncompress(inputBytes, 0, inputBytes.length, outputBytes, 0, outputBytes.length);
+
+        if (decompressResult < 0) {
+            // The destination buffer wasn't big enough. Resize and retry.
+            outputBytes = new byte[-decompressResult];
+            decompressResult =
+                    uncompress(inputBytes, 0, inputBytes.length, outputBytes, 0, outputBytes.length);
+        }
+
+        if (decompressResult >= 0) {
+            // It was successful.
+            output.append(outputBytes, 0, decompressResult);
+            return true;
+        }
+
+        // Still unsuccessful. Give up.
+        return false;
+    }
+
+    /**
+     * Returns a copy of the provided byte array.
+     *
+     * @param bytes
+     *            The byte array to be copied.
+     * @return A copy of the provided byte array.
+     */
+    public static byte[] copyOfBytes(final byte[] bytes) {
+        return Arrays.copyOf(bytes, bytes.length);
+    }
+
+    /**
+     * Retrieves the printable ASCII representation of the provided byte.
+     *
+     * @param b
+     *            The byte for which to retrieve the printable ASCII
+     *            representation.
+     * @return The printable ASCII representation of the provided byte, or a
+     *         space if the provided byte does not have printable ASCII
+     *         representation.
+     */
+    private static char byteToASCII(final byte b) {
+        if (b >= 32 && b <= 126) {
+            return (char) b;
+        }
+
+        return ' ';
+    }
+
+    // Prevent instantiation.
+    private StaticUtils() {
+        // No implementation required.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java
index 2375bd0..1e0000e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.util;
 
-
-
 import static com.forgerock.opendj.util.Validator.ensureNotNull;
 
 import java.text.Normalizer;
@@ -37,551 +34,498 @@
 
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the "stringprep" profile as defined in RFC 4518. It must
  * be used by all the matching rules that support unicode characters. For a
  * complete list of such rules, refer to Section 4.2, RFC 4517.
  */
-public final class StringPrepProfile
-{
-  /**
-   * A Table defining the mapped code-points as per RFC 3454.
-   */
-  private static final class MappingTable
-  {
-    // Set of chars which are deleted from the incoming value.
-    private final static HashSet<Character> MAP_2_NULL = new HashSet<Character>();
+public final class StringPrepProfile {
+    /**
+     * A Table defining the mapped code-points as per RFC 3454.
+     */
+    private static final class MappingTable {
+        // Set of chars which are deleted from the incoming value.
+        private final static HashSet<Character> MAP_2_NULL = new HashSet<Character>();
 
-    // Set of chars which are replaced by a SPACE when found.
-    private final static HashSet<Character> MAP_2_SPACE = new HashSet<Character>();
+        // Set of chars which are replaced by a SPACE when found.
+        private final static HashSet<Character> MAP_2_SPACE = new HashSet<Character>();
 
-    // Table for case-folding. Map of Character and String containing
-    // uppercase and lowercase value as the key-value pair.
-    private final static HashMap<Character, String> CASE_MAP_TABLE =
-      new HashMap<Character, String>();
+        // Table for case-folding. Map of Character and String containing
+        // uppercase and lowercase value as the key-value pair.
+        private final static HashMap<Character, String> CASE_MAP_TABLE =
+                new HashMap<Character, String>();
 
-    static
-    {
-      // Appendix B.1 RFC 3454.
-      final char[][] mapped2null = new char[][] { { '\u0000', '\u0008' },
-          { '\u000E', '\u001F' }, { '\u007F', '\u0084' },
-          { '\u0086', '\u009F' }, { '\u00AD' }, { '\u034F' }, { '\u06DD' },
-          { '\u070F' }, { '\u1806' }, { '\u180B', '\u180E' },
-          { '\u200C', '\u200F' }, { '\u202A', '\u202E' },
-          { '\u2060', '\u2063' }, { '\u206A', '\u206F' },
-          { '\uFE00', '\uFE0F' }, { '\uFEFF' }, { '\uFFF9', '\uFFFC' } };
+        static {
+            // Appendix B.1 RFC 3454.
+            final char[][] mapped2null =
+                    new char[][] { { '\u0000', '\u0008' }, { '\u000E', '\u001F' },
+                        { '\u007F', '\u0084' }, { '\u0086', '\u009F' }, { '\u00AD' }, { '\u034F' },
+                        { '\u06DD' }, { '\u070F' }, { '\u1806' }, { '\u180B', '\u180E' },
+                        { '\u200C', '\u200F' }, { '\u202A', '\u202E' }, { '\u2060', '\u2063' },
+                        { '\u206A', '\u206F' }, { '\uFE00', '\uFE0F' }, { '\uFEFF' },
+                        { '\uFFF9', '\uFFFC' } };
 
-      for (final char[] element : mapped2null)
-      {
-        if (element.length == 1)
-        {
-          MAP_2_NULL.add(element[0]);
+            for (final char[] element : mapped2null) {
+                if (element.length == 1) {
+                    MAP_2_NULL.add(element[0]);
+                } else {
+                    // Contains a range of values.
+                    for (char c = element[0]; c <= element[1]; c++) {
+                        MAP_2_NULL.add(c);
+                    }
+                }
+            }
+
+            final char[] mapped2Space =
+                    new char[] { '\u0009', 0xA, '\u000B', '\u000C', 0xD, '\u0085', '\u00A0',
+                        '\u1680', '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005',
+                        '\u2006', '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029',
+                        '\u202F', '\u205F', '\u3000' };
+
+            for (final char c : mapped2Space) {
+                MAP_2_SPACE.add(c);
+            }
+
+            // Appendix B.2 RFC 3454.
+            // Build an uppercase array and a lowercase array and create a map
+            // of both
+            // values.
+            final char[] upperCaseArr =
+                    new char[] { '\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046',
+                        '\u0047', '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+                        '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053', '\u0054',
+                        '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A', '\u00B5',
+                        '\u00C0', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5', '\u00C6',
+                        '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB', '\u00CC', '\u00CD',
+                        '\u00CE', '\u00CF', '\u00D0', '\u00D1', '\u00D2', '\u00D3', '\u00D4',
+                        '\u00D5', '\u00D6', '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC',
+                        '\u00DD', '\u00DE', '\u00DF', '\u0100', '\u0102', '\u0104', '\u0106',
+                        '\u0108', '\u010A', '\u010C', '\u010E', '\u0110', '\u0112', '\u0114',
+                        '\u0116', '\u0118', '\u011A', '\u011C', '\u011E', '\u0120', '\u0122',
+                        '\u0124', '\u0126', '\u0128', '\u012A', '\u012C', '\u012E', '\u0130',
+                        '\u0132', '\u0134', '\u0136', '\u0139', '\u013B', '\u013D', '\u013F',
+                        '\u0141', '\u0143', '\u0145', '\u0147', '\u0149', '\u014A', '\u014C',
+                        '\u014E', '\u0150', '\u0152', '\u0154', '\u0156', '\u0158', '\u015A',
+                        '\u015C', '\u015E', '\u0160', '\u0162', '\u0164', '\u0166', '\u0168',
+                        '\u016A', '\u016C', '\u016E', '\u0170', '\u0172', '\u0174', '\u0176',
+                        '\u0178', '\u0179', '\u017B', '\u017D', '\u017F', '\u0181', '\u0182',
+                        '\u0184', '\u0186', '\u0187', '\u0189', '\u018A', '\u018B', '\u018E',
+                        '\u018F', '\u0190', '\u0191', '\u0193', '\u0194', '\u0196', '\u0197',
+                        '\u0198', '\u019C', '\u019D', '\u019F', '\u01A0', '\u01A2', '\u01A4',
+                        '\u01A6', '\u01A7', '\u01A9', '\u01AC', '\u01AE', '\u01AF', '\u01B1',
+                        '\u01B2', '\u01B3', '\u01B5', '\u01B7', '\u01B8', '\u01BC', '\u01C4',
+                        '\u01C5', '\u01C7', '\u01C8', '\u01CA', '\u01CB', '\u01CD', '\u01CF',
+                        '\u01D1', '\u01D3', '\u01D5', '\u01D7', '\u01D9', '\u01DB', '\u01DE',
+                        '\u01E0', '\u01E2', '\u01E4', '\u01E6', '\u01E8', '\u01EA', '\u01EC',
+                        '\u01EE', '\u01F0', '\u01F1', '\u01F2', '\u01F4', '\u01F6', '\u01F7',
+                        '\u01F8', '\u01FA', '\u01FC', '\u01FE', '\u0200', '\u0202', '\u0204',
+                        '\u0206', '\u0208', '\u020A', '\u020C', '\u020E', '\u0210', '\u0212',
+                        '\u0214', '\u0216', '\u0218', '\u021A', '\u021C', '\u021E', '\u0220',
+                        '\u0222', '\u0224', '\u0226', '\u0228', '\u022A', '\u022C', '\u022E',
+                        '\u0230', '\u0232', '\u0345', '\u037A', '\u0386', '\u0388', '\u0389',
+                        '\u038A', '\u038C', '\u038E', '\u038F', '\u0390', '\u0391', '\u0392',
+                        '\u0393', '\u0394', '\u0395', '\u0396', '\u0397', '\u0398', '\u0399',
+                        '\u039A', '\u039B', '\u039C', '\u039D', '\u039E', '\u039F', '\u03A0',
+                        '\u03A1', '\u03A3', '\u03A4', '\u03A5', '\u03A6', '\u03A7', '\u03A8',
+                        '\u03A9', '\u03AA', '\u03AB', '\u03B0', '\u03C2', '\u03D0', '\u03D1',
+                        '\u03D2', '\u03D3', '\u03D4', '\u03D5', '\u03D6', '\u03D8', '\u03DA',
+                        '\u03DC', '\u03DE', '\u03E0', '\u03E2', '\u03E4', '\u03E6', '\u03E8',
+                        '\u03EA', '\u03EC', '\u03EE', '\u03F0', '\u03F1', '\u03F2', '\u03F4',
+                        '\u03F5', '\u0400', '\u0401', '\u0402', '\u0403', '\u0404', '\u0405',
+                        '\u0406', '\u0407', '\u0408', '\u0409', '\u040A', '\u040B', '\u040C',
+                        '\u040D', '\u040E', '\u040F', '\u0410', '\u0411', '\u0412', '\u0413',
+                        '\u0414', '\u0415', '\u0416', '\u0417', '\u0418', '\u0419', '\u041A',
+                        '\u041B', '\u041C', '\u041D', '\u041E', '\u041F', '\u0420', '\u0421',
+                        '\u0422', '\u0423', '\u0424', '\u0425', '\u0426', '\u0427', '\u0428',
+                        '\u0429', '\u042A', '\u042B', '\u042C', '\u042D', '\u042E', '\u042F',
+                        '\u0460', '\u0462', '\u0464', '\u0466', '\u0468', '\u046A', '\u046C',
+                        '\u046E', '\u0470', '\u0472', '\u0474', '\u0476', '\u0478', '\u047A',
+                        '\u047C', '\u047E', '\u0480', '\u048A', '\u048C', '\u048E', '\u0490',
+                        '\u0492', '\u0494', '\u0496', '\u0498', '\u049A', '\u049C', '\u049E',
+                        '\u04A0', '\u04A2', '\u04A4', '\u04A6', '\u04A8', '\u04AA', '\u04AC',
+                        '\u04AE', '\u04B0', '\u04B2', '\u04B4', '\u04B6', '\u04B8', '\u04BA',
+                        '\u04BC', '\u04BE', '\u04C1', '\u04C3', '\u04C5', '\u04C7', '\u04C9',
+                        '\u04CB', '\u04CD', '\u04D0', '\u04D2', '\u04D4', '\u04D6', '\u04D8',
+                        '\u04DA', '\u04DC', '\u04DE', '\u04E0', '\u04E2', '\u04E4', '\u04E6',
+                        '\u04E8', '\u04EA', '\u04EC', '\u04EE', '\u04F0', '\u04F2', '\u04F4',
+                        '\u04F8', '\u0500', '\u0502', '\u0504', '\u0506', '\u0508', '\u050A',
+                        '\u050C', '\u050E', '\u0531', '\u0532', '\u0533', '\u0534', '\u0535',
+                        '\u0536', '\u0537', '\u0538', '\u0539', '\u053A', '\u053B', '\u053C',
+                        '\u053D', '\u053E', '\u053F', '\u0540', '\u0541', '\u0542', '\u0543',
+                        '\u0544', '\u0545', '\u0546', '\u0547', '\u0548', '\u0549', '\u054A',
+                        '\u054B', '\u054C', '\u054D', '\u054E', '\u054F', '\u0550', '\u0551',
+                        '\u0552', '\u0553', '\u0554', '\u0555', '\u0556', '\u0587', '\u1E00',
+                        '\u1E02', '\u1E04', '\u1E06', '\u1E08', '\u1E0A', '\u1E0C', '\u1E0E',
+                        '\u1E10', '\u1E12', '\u1E14', '\u1E16', '\u1E18', '\u1E1A', '\u1E1C',
+                        '\u1E1E', '\u1E20', '\u1E22', '\u1E24', '\u1E26', '\u1E28', '\u1E2A',
+                        '\u1E2C', '\u1E2E', '\u1E30', '\u1E32', '\u1E34', '\u1E36', '\u1E38',
+                        '\u1E3A', '\u1E3C', '\u1E3E', '\u1E40', '\u1E42', '\u1E44', '\u1E46',
+                        '\u1E48', '\u1E4A', '\u1E4C', '\u1E4E', '\u1E50', '\u1E52', '\u1E54',
+                        '\u1E56', '\u1E58', '\u1E5A', '\u1E5C', '\u1E5E', '\u1E60', '\u1E62',
+                        '\u1E64', '\u1E66', '\u1E68', '\u1E6A', '\u1E6C', '\u1E6E', '\u1E70',
+                        '\u1E72', '\u1E74', '\u1E76', '\u1E78', '\u1E7A', '\u1E7C', '\u1E7E',
+                        '\u1E80', '\u1E82', '\u1E84', '\u1E86', '\u1E88', '\u1E8A', '\u1E8C',
+                        '\u1E8E', '\u1E90', '\u1E92', '\u1E94', '\u1E96', '\u1E97', '\u1E98',
+                        '\u1E99', '\u1E9A', '\u1E9B', '\u1EA0', '\u1EA2', '\u1EA4', '\u1EA6',
+                        '\u1EA8', '\u1EAA', '\u1EAC', '\u1EAE', '\u1EB0', '\u1EB2', '\u1EB4',
+                        '\u1EB6', '\u1EB8', '\u1EBA', '\u1EBC', '\u1EBE', '\u1EC0', '\u1EC2',
+                        '\u1EC4', '\u1EC6', '\u1EC8', '\u1ECA', '\u1ECC', '\u1ECE', '\u1ED0',
+                        '\u1ED2', '\u1ED4', '\u1ED6', '\u1ED8', '\u1EDA', '\u1EDC', '\u1EDE',
+                        '\u1EE0', '\u1EE2', '\u1EE4', '\u1EE6', '\u1EE8', '\u1EEA', '\u1EEC',
+                        '\u1EEE', '\u1EF0', '\u1EF2', '\u1EF4', '\u1EF6', '\u1EF8', '\u1F08',
+                        '\u1F09', '\u1F0A', '\u1F0B', '\u1F0C', '\u1F0D', '\u1F0E', '\u1F0F',
+                        '\u1F18', '\u1F19', '\u1F1A', '\u1F1B', '\u1F1C', '\u1F1D', '\u1F28',
+                        '\u1F29', '\u1F2A', '\u1F2B', '\u1F2C', '\u1F2D', '\u1F2E', '\u1F2F',
+                        '\u1F38', '\u1F39', '\u1F3A', '\u1F3B', '\u1F3C', '\u1F3D', '\u1F3E',
+                        '\u1F3F', '\u1F48', '\u1F49', '\u1F4A', '\u1F4B', '\u1F4C', '\u1F4D',
+                        '\u1F50', '\u1F52', '\u1F54', '\u1F56', '\u1F59', '\u1F5B', '\u1F5D',
+                        '\u1F5F', '\u1F68', '\u1F69', '\u1F6A', '\u1F6B', '\u1F6C', '\u1F6D',
+                        '\u1F6E', '\u1F6F', '\u1F80', '\u1F81', '\u1F82', '\u1F83', '\u1F84',
+                        '\u1F85', '\u1F86', '\u1F87', '\u1F88', '\u1F89', '\u1F8A', '\u1F8B',
+                        '\u1F8C', '\u1F8D', '\u1F8E', '\u1F8F', '\u1F90', '\u1F91', '\u1F92',
+                        '\u1F93', '\u1F94', '\u1F95', '\u1F96', '\u1F97', '\u1F98', '\u1F99',
+                        '\u1F9A', '\u1F9B', '\u1F9C', '\u1F9D', '\u1F9E', '\u1F9F', '\u1FA0',
+                        '\u1FA1', '\u1FA2', '\u1FA3', '\u1FA4', '\u1FA5', '\u1FA6', '\u1FA7',
+                        '\u1FA8', '\u1FA9', '\u1FAA', '\u1FAB', '\u1FAC', '\u1FAD', '\u1FAE',
+                        '\u1FAF', '\u1FB2', '\u1FB3', '\u1FB4', '\u1FB6', '\u1FB7', '\u1FB8',
+                        '\u1FB9', '\u1FBA', '\u1FBB', '\u1FBC', '\u1FBE', '\u1FC2', '\u1FC3',
+                        '\u1FC4', '\u1FC6', '\u1FC7', '\u1FC8', '\u1FC9', '\u1FCA', '\u1FCB',
+                        '\u1FCC', '\u1FD2', '\u1FD3', '\u1FD6', '\u1FD7', '\u1FD8', '\u1FD9',
+                        '\u1FDA', '\u1FDB', '\u1FE2', '\u1FE3', '\u1FE4', '\u1FE6', '\u1FE7',
+                        '\u1FE8', '\u1FE9', '\u1FEA', '\u1FEB', '\u1FEC', '\u1FF2', '\u1FF3',
+                        '\u1FF4', '\u1FF6', '\u1FF7', '\u1FF8', '\u1FF9', '\u1FFA', '\u1FFB',
+                        '\u1FFC', '\u20A8', '\u2102', '\u2103', '\u2107', '\u2109', '\u210B',
+                        '\u210C', '\u210D', '\u2110', '\u2111', '\u2112', '\u2115', '\u2116',
+                        '\u2119', '\u211A', '\u211B', '\u211C', '\u211D', '\u2120', '\u2121',
+                        '\u2122', '\u2124', '\u2126', '\u2128', '\u212A', '\u212B', '\u212C',
+                        '\u212D', '\u2130', '\u2131', '\u2133', '\u213E', '\u213F', '\u2145',
+                        '\u2160', '\u2161', '\u2162', '\u2163', '\u2164', '\u2165', '\u2166',
+                        '\u2167', '\u2168', '\u2169', '\u216A', '\u216B', '\u216C', '\u216D',
+                        '\u216E', '\u216F', '\u24B6', '\u24B7', '\u24B8', '\u24B9', '\u24BA',
+                        '\u24BB', '\u24BC', '\u24BD', '\u24BE', '\u24BF', '\u24C0', '\u24C1',
+                        '\u24C2', '\u24C3', '\u24C4', '\u24C5', '\u24C6', '\u24C7', '\u24C8',
+                        '\u24C9', '\u24CA', '\u24CB', '\u24CC', '\u24CD', '\u24CE', '\u24CF',
+                        '\u3371', '\u3373', '\u3375', '\u3380', '\u3381', '\u3382', '\u3383',
+                        '\u3384', '\u3385', '\u3386', '\u3387', '\u338A', '\u338B', '\u338C',
+                        '\u3390', '\u3391', '\u3392', '\u3393', '\u3394', '\u33A9', '\u33AA',
+                        '\u33AB', '\u33AC', '\u33B4', '\u33B5', '\u33B6', '\u33B7', '\u33B8',
+                        '\u33B9', '\u33BA', '\u33BB', '\u33BC', '\u33BD', '\u33BE', '\u33BF',
+                        '\u33C0', '\u33C1', '\u33C3', '\u33C6', '\u33C7', '\u33C8', '\u33C9',
+                        '\u33CB', '\u33CD', '\u33CE', '\u33D7', '\u33D9', '\u33DA', '\u33DC',
+                        '\u33DD', '\uFB00', '\uFB01', '\uFB02', '\uFB03', '\uFB04', '\uFB05',
+                        '\uFB06', '\uFB13', '\uFB14', '\uFB15', '\uFB16', '\uFB17', '\uFF21',
+                        '\uFF22', '\uFF23', '\uFF24', '\uFF25', '\uFF26', '\uFF27', '\uFF28',
+                        '\uFF29', '\uFF2A', '\uFF2B', '\uFF2C', '\uFF2D', '\uFF2E', '\uFF2F',
+                        '\uFF30', '\uFF31', '\uFF32', '\uFF33', '\uFF34', '\uFF35', '\uFF36',
+                        '\uFF37', '\uFF38', '\uFF39', '\uFF3A' };
+            final String[] lowerCaseFoldedArr =
+                    new String[] { "\u0061", "\u0062", "\u0063", "\u0064", "\u0065", "\u0066",
+                        "\u0067", "\u0068", "\u0069", "\u006A", "\u006B", "\u006C", "\u006D",
+                        "\u006E", "\u006F", "\u0070", "\u0071", "\u0072", "\u0073", "\u0074",
+                        "\u0075", "\u0076", "\u0077", "\u0078", "\u0079", "\u007A", "\u03BC",
+                        "\u00E0", "\u00E1", "\u00E2", "\u00E3", "\u00E4", "\u00E5", "\u00E6",
+                        "\u00E7", "\u00E8", "\u00E9", "\u00EA", "\u00EB", "\u00EC", "\u00ED",
+                        "\u00EE", "\u00EF", "\u00F0", "\u00F1", "\u00F2", "\u00F3", "\u00F4",
+                        "\u00F5", "\u00F6", "\u00F8", "\u00F9", "\u00FA", "\u00FB", "\u00FC",
+                        "\u00FD", "\u00FE", "\u0073\u0073", "\u0101", "\u0103", "\u0105", "\u0107",
+                        "\u0109", "\u010B", "\u010D", "\u010F", "\u0111", "\u0113", "\u0115",
+                        "\u0117", "\u0119", "\u011B", "\u011D", "\u011F", "\u0121", "\u0123",
+                        "\u0125", "\u0127", "\u0129", "\u012B", "\u012D", "\u012F", "\u0069\u0307",
+                        "\u0133", "\u0135", "\u0137", "\u013A", "\u013C", "\u013E", "\u0140",
+                        "\u0142", "\u0144", "\u0146", "\u0148", "\u02BC\u006E", "\u014B", "\u014D",
+                        "\u014F", "\u0151", "\u0153", "\u0155", "\u0157", "\u0159", "\u015B",
+                        "\u015D", "\u015F", "\u0161", "\u0163", "\u0165", "\u0167", "\u0169",
+                        "\u016B", "\u016D", "\u016F", "\u0171", "\u0173", "\u0175", "\u0177",
+                        "\u00FF", "\u017A", "\u017C", "\u017E", "\u0073", "\u0253", "\u0183",
+                        "\u0185", "\u0254", "\u0188", "\u0256", "\u0257", "\u018C", "\u01DD",
+                        "\u0259", "\u025B", "\u0192", "\u0260", "\u0263", "\u0269", "\u0268",
+                        "\u0199", "\u026F", "\u0272", "\u0275", "\u01A1", "\u01A3", "\u01A5",
+                        "\u0280", "\u01A8", "\u0283", "\u01AD", "\u0288", "\u01B0", "\u028A",
+                        "\u028B", "\u01B4", "\u01B6", "\u0292", "\u01B9", "\u01BD", "\u01C6",
+                        "\u01C6", "\u01C9", "\u01C9", "\u01CC", "\u01CC", "\u01CE", "\u01D0",
+                        "\u01D2", "\u01D4", "\u01D6", "\u01D8", "\u01DA", "\u01DC", "\u01DF",
+                        "\u01E1", "\u01E3", "\u01E5", "\u01E7", "\u01E9", "\u01EB", "\u01ED",
+                        "\u01EF", "\u006A\u030C", "\u01F3", "\u01F3", "\u01F5", "\u0195", "\u01BF",
+                        "\u01F9", "\u01FB", "\u01FD", "\u01FF", "\u0201", "\u0203", "\u0205",
+                        "\u0207", "\u0209", "\u020B", "\u020D", "\u020F", "\u0211", "\u0213",
+                        "\u0215", "\u0217", "\u0219", "\u021B", "\u021D", "\u021F", "\u019E",
+                        "\u0223", "\u0225", "\u0227", "\u0229", "\u022B", "\u022D", "\u022F",
+                        "\u0231", "\u0233", "\u03B9", "\u0020\u03B9", "\u03AC", "\u03AD", "\u03AE",
+                        "\u03AF", "\u03CC", "\u03CD", "\u03CE", "\u03B9\u0308\u0301", "\u03B1",
+                        "\u03B2", "\u03B3", "\u03B4", "\u03B5", "\u03B6", "\u03B7", "\u03B8",
+                        "\u03B9", "\u03BA", "\u03BB", "\u03BC", "\u03BD", "\u03BE", "\u03BF",
+                        "\u03C0", "\u03C1", "\u03C3", "\u03C4", "\u03C5", "\u03C6", "\u03C7",
+                        "\u03C8", "\u03C9", "\u03CA", "\u03CB", "\u03C5\u0308\u0301", "\u03C3",
+                        "\u03B2", "\u03B8", "\u03C5", "\u03CD", "\u03CB", "\u03C6", "\u03C0",
+                        "\u03D9", "\u03DB", "\u03DD", "\u03DF", "\u03E1", "\u03E3", "\u03E5",
+                        "\u03E7", "\u03E9", "\u03EB", "\u03ED", "\u03EF", "\u03BA", "\u03C1",
+                        "\u03C3", "\u03B8", "\u03B5", "\u0450", "\u0451", "\u0452", "\u0453",
+                        "\u0454", "\u0455", "\u0456", "\u0457", "\u0458", "\u0459", "\u045A",
+                        "\u045B", "\u045C", "\u045D", "\u045E", "\u045F", "\u0430", "\u0431",
+                        "\u0432", "\u0433", "\u0434", "\u0435", "\u0436", "\u0437", "\u0438",
+                        "\u0439", "\u043A", "\u043B", "\u043C", "\u043D", "\u043E", "\u043F",
+                        "\u0440", "\u0441", "\u0442", "\u0443", "\u0444", "\u0445", "\u0446",
+                        "\u0447", "\u0448", "\u0449", "\u044A", "\u044B", "\u044C", "\u044D",
+                        "\u044E", "\u044F", "\u0461", "\u0463", "\u0465", "\u0467", "\u0469",
+                        "\u046B", "\u046D", "\u046F", "\u0471", "\u0473", "\u0475", "\u0477",
+                        "\u0479", "\u047B", "\u047D", "\u047F", "\u0481", "\u048B", "\u048D",
+                        "\u048F", "\u0491", "\u0493", "\u0495", "\u0497", "\u0499", "\u049B",
+                        "\u049D", "\u049F", "\u04A1", "\u04A3", "\u04A5", "\u04A7", "\u04A9",
+                        "\u04AB", "\u04AD", "\u04AF", "\u04B1", "\u04B3", "\u04B5", "\u04B7",
+                        "\u04B9", "\u04BB", "\u04BD", "\u04BF", "\u04C2", "\u04C4", "\u04C6",
+                        "\u04C8", "\u04CA", "\u04CC", "\u04CE", "\u04D1", "\u04D3", "\u04D5",
+                        "\u04D7", "\u04D9", "\u04DB", "\u04DD", "\u04DF", "\u04E1", "\u04E3",
+                        "\u04E5", "\u04E7", "\u04E9", "\u04EB", "\u04ED", "\u04EF", "\u04F1",
+                        "\u04F3", "\u04F5", "\u04F9", "\u0501", "\u0503", "\u0505", "\u0507",
+                        "\u0509", "\u050B", "\u050D", "\u050F", "\u0561", "\u0562", "\u0563",
+                        "\u0564", "\u0565", "\u0566", "\u0567", "\u0568", "\u0569", "\u056A",
+                        "\u056B", "\u056C", "\u056D", "\u056E", "\u056F", "\u0570", "\u0571",
+                        "\u0572", "\u0573", "\u0574", "\u0575", "\u0576", "\u0577", "\u0578",
+                        "\u0579", "\u057A", "\u057B", "\u057C", "\u057D", "\u057E", "\u057F",
+                        "\u0580", "\u0581", "\u0582", "\u0583", "\u0584", "\u0585", "\u0586",
+                        "\u0565\u0582", "\u1E01", "\u1E03", "\u1E05", "\u1E07", "\u1E09", "\u1E0B",
+                        "\u1E0D", "\u1E0F", "\u1E11", "\u1E13", "\u1E15", "\u1E17", "\u1E19",
+                        "\u1E1B", "\u1E1D", "\u1E1F", "\u1E21", "\u1E23", "\u1E25", "\u1E27",
+                        "\u1E29", "\u1E2B", "\u1E2D", "\u1E2F", "\u1E31", "\u1E33", "\u1E35",
+                        "\u1E37", "\u1E39", "\u1E3B", "\u1E3D", "\u1E3F", "\u1E41", "\u1E43",
+                        "\u1E45", "\u1E47", "\u1E49", "\u1E4B", "\u1E4D", "\u1E4F", "\u1E51",
+                        "\u1E53", "\u1E55", "\u1E57", "\u1E59", "\u1E5B", "\u1E5D", "\u1E5F",
+                        "\u1E61", "\u1E63", "\u1E65", "\u1E67", "\u1E69", "\u1E6B", "\u1E6D",
+                        "\u1E6F", "\u1E71", "\u1E73", "\u1E75", "\u1E77", "\u1E79", "\u1E7B",
+                        "\u1E7D", "\u1E7F", "\u1E81", "\u1E83", "\u1E85", "\u1E87", "\u1E89",
+                        "\u1E8B", "\u1E8D", "\u1E8F", "\u1E91", "\u1E93", "\u1E95", "\u0068\u0331",
+                        "\u0074\u0308", "\u0077\u030A", "\u0079\u030A", "\u0061\u02BE", "\u1E61",
+                        "\u1EA1", "\u1EA3", "\u1EA5", "\u1EA7", "\u1EA9", "\u1EAB", "\u1EAD",
+                        "\u1EAF", "\u1EB1", "\u1EB3", "\u1EB5", "\u1EB7", "\u1EB9", "\u1EBB",
+                        "\u1EBD", "\u1EBF", "\u1EC1", "\u1EC3", "\u1EC5", "\u1EC7", "\u1EC9",
+                        "\u1ECB", "\u1ECD", "\u1ECF", "\u1ED1", "\u1ED3", "\u1ED5", "\u1ED7",
+                        "\u1ED9", "\u1EDB", "\u1EDD", "\u1EDF", "\u1EE1", "\u1EE3", "\u1EE5",
+                        "\u1EE7", "\u1EE9", "\u1EEB", "\u1EED", "\u1EEF", "\u1EF1", "\u1EF3",
+                        "\u1EF5", "\u1EF7", "\u1EF9", "\u1F00", "\u1F01", "\u1F02", "\u1F03",
+                        "\u1F04", "\u1F05", "\u1F06", "\u1F07", "\u1F10", "\u1F11", "\u1F12",
+                        "\u1F13", "\u1F14", "\u1F15", "\u1F20", "\u1F21", "\u1F22", "\u1F23",
+                        "\u1F24", "\u1F25", "\u1F26", "\u1F27", "\u1F30", "\u1F31", "\u1F32",
+                        "\u1F33", "\u1F34", "\u1F35", "\u1F36", "\u1F37", "\u1F40", "\u1F41",
+                        "\u1F42", "\u1F43", "\u1F44", "\u1F45", "\u03C5\u0313",
+                        "\u03C5\u0313\u0300", "\u03C5\u0313\u0301", "\u03C5\u0313\u0342", "\u1F51",
+                        "\u1F53", "\u1F55", "\u1F57", "\u1F60", "\u1F61", "\u1F62", "\u1F63",
+                        "\u1F64", "\u1F65", "\u1F66", "\u1F67", "\u1F00\u03B9", "\u1F01\u03B9",
+                        "\u1F02\u03B9", "\u1F03\u03B9", "\u1F04\u03B9", "\u1F05\u03B9",
+                        "\u1F06\u03B9", "\u1F07\u03B9", "\u1F00\u03B9", "\u1F01\u03B9",
+                        "\u1F02\u03B9", "\u1F03\u03B9", "\u1F04\u03B9", "\u1F05\u03B9",
+                        "\u1F06\u03B9", "\u1F07\u03B9", "\u1F20\u03B9", "\u1F21\u03B9",
+                        "\u1F22\u03B9", "\u1F23\u03B9", "\u1F24\u03B9", "\u1F25\u03B9",
+                        "\u1F26\u03B9", "\u1F27\u03B9", "\u1F20\u03B9", "\u1F21\u03B9",
+                        "\u1F22\u03B9", "\u1F23\u03B9", "\u1F24\u03B9", "\u1F25\u03B9",
+                        "\u1F26\u03B9", "\u1F27\u03B9", "\u1F60\u03B9", "\u1F61\u03B9",
+                        "\u1F62\u03B9", "\u1F63\u03B9", "\u1F64\u03B9", "\u1F65\u03B9",
+                        "\u1F66\u03B9", "\u1F67\u03B9", "\u1F60\u03B9", "\u1F61\u03B9",
+                        "\u1F62\u03B9", "\u1F63\u03B9", "\u1F64\u03B9", "\u1F65\u03B9",
+                        "\u1F66\u03B9", "\u1F67\u03B9", "\u1F70\u03B9", "\u03B1\u03B9",
+                        "\u03AC\u03B9", "\u03B1\u0342", "\u03B1\u0342\u03B9", "\u1FB0", "\u1FB1",
+                        "\u1F70", "\u1F71", "\u03B1\u03B9", "\u03B9", "\u1F74\u03B9",
+                        "\u03B7\u03B9", "\u03AE\u03B9", "\u03B7\u0342", "\u03B7\u0342\u03B9",
+                        "\u1F72", "\u1F73", "\u1F74", "\u1F75", "\u03B7\u03B9",
+                        "\u03B9\u0308\u0300", "\u03B9\u0308\u0301", "\u03B9\u0342",
+                        "\u03B9\u0308\u0342", "\u1FD0", "\u1FD1", "\u1F76", "\u1F77",
+                        "\u03C5\u0308\u0300", "\u03C5\u0308\u0301", "\u03C1\u0313", "\u03C5\u0342",
+                        "\u03C5\u0308\u0342", "\u1FE0", "\u1FE1", "\u1F7A", "\u1F7B", "\u1FE5",
+                        "\u1F7C\u03B9", "\u03C9\u03B9", "\u03CE\u03B9", "\u03C9\u0342",
+                        "\u03C9\u0342\u03B9", "\u1F78", "\u1F79", "\u1F7C", "\u1F7D",
+                        "\u03C9\u03B9", "\u0072\u0073", "\u0063", "\u00B0\u0063", "\u025B",
+                        "\u00B0\u0066", "\u0068", "\u0068", "\u0068", "\u0069", "\u0069", "\u006C",
+                        "\u006E", "\u006E\u006F", "\u0070", "\u0071", "\u0072", "\u0072", "\u0072",
+                        "\u0073\u006D", "\u0074\u0065\u006C", "\u0074\u006D", "\u007A", "\u03C9",
+                        "\u007A", "\u006B", "\u00E5", "\u0062", "\u0063", "\u0065", "\u0066",
+                        "\u006D", "\u03B3", "\u03C0", "\u0064", "\u2170", "\u2171", "\u2172",
+                        "\u2173", "\u2174", "\u2175", "\u2176", "\u2177", "\u2178", "\u2179",
+                        "\u217A", "\u217B", "\u217C", "\u217D", "\u217E", "\u217F", "\u24D0",
+                        "\u24D1", "\u24D2", "\u24D3", "\u24D4", "\u24D5", "\u24D6", "\u24D7",
+                        "\u24D8", "\u24D9", "\u24DA", "\u24DB", "\u24DC", "\u24DD", "\u24DE",
+                        "\u24DF", "\u24E0", "\u24E1", "\u24E2", "\u24E3", "\u24E4", "\u24E5",
+                        "\u24E6", "\u24E7", "\u24E8", "\u24E9", "\u0068\u0070\u0061",
+                        "\u0061\u0075", "\u006F\u0076", "\u0070\u0061", "\u006E\u0061",
+                        "\u03BC\u0061", "\u006D\u0061", "\u006B\u0061", "\u006B\u0062",
+                        "\u006D\u0062", "\u0067\u0062", "\u0070\u0066", "\u006E\u0066",
+                        "\u03BC\u0066", "\u0068\u007A", "\u006B\u0068\u007A", "\u006D\u0068\u007A",
+                        "\u0067\u0068\u007A", "\u0074\u0068\u007A", "\u0070\u0061",
+                        "\u006B\u0070\u0061", "\u006D\u0070\u0061", "\u0067\u0070\u0061",
+                        "\u0070\u0076", "\u006E\u0076", "\u03BC\u0076", "\u006D\u0076",
+                        "\u006B\u0076", "\u006D\u0076", "\u0070\u0077", "\u006E\u0077",
+                        "\u03BC\u0077", "\u006D\u0077", "\u006B\u0077", "\u006D\u0077",
+                        "\u006B\u03C9", "\u006D\u03C9", "\u0062\u0071", "\u0063\u2215\u006B\u0067",
+                        "\u0063\u006F\u002E", "\u0064\u0062", "\u0067\u0079", "\u0068\u0070",
+                        "\u006B\u006B", "\u006B\u006D", "\u0070\u0068", "\u0070\u0070\u006D",
+                        "\u0070\u0072", "\u0073\u0076", "\u0077\u0062", "\u0066\u0066",
+                        "\u0066\u0069", "\u0066\u006C", "\u0066\u0066\u0069", "\u0066\u0066\u006C",
+                        "\u0073\u0074", "\u0073\u0074", "\u0574\u0576", "\u0574\u0565",
+                        "\u0574\u056B", "\u057E\u0576", "\u0574\u056D", "\uFF41", "\uFF42",
+                        "\uFF43", "\uFF44", "\uFF45", "\uFF46", "\uFF47", "\uFF48", "\uFF49",
+                        "\uFF4A", "\uFF4B", "\uFF4C", "\uFF4D", "\uFF4E", "\uFF4F", "\uFF50",
+                        "\uFF51", "\uFF52", "\uFF53", "\uFF54", "\uFF55", "\uFF56", "\uFF57",
+                        "\uFF58", "\uFF59", "\uFF5A" };
+            for (int count = 0; count < upperCaseArr.length; count++) {
+                CASE_MAP_TABLE.put(upperCaseArr[count], lowerCaseFoldedArr[count]);
+            }
         }
-        else
-        {
-          // Contains a range of values.
-          for (char c = element[0]; c <= element[1]; c++)
-          {
-            MAP_2_NULL.add(c);
-          }
+
+        // Gets the mapped String.
+        private static void map(final StringBuilder buffer, final ByteSequence sequence,
+                final boolean trim, final boolean foldCase) {
+            final String value = sequence.toString();
+            for (int i = 0; i < value.length(); i++) {
+                final char c = value.charAt(i);
+                if (MAP_2_NULL.contains(c)) {
+                    continue;
+                }
+
+                if (MAP_2_SPACE.contains(c)) {
+                    final int buffLen = buffer.length();
+                    if (trim && buffLen == 0 || buffLen > 0
+                            && buffer.charAt(buffLen - 1) == SPACE_CHAR) {
+                        /**
+                         * Do not map this character into a space if: a .
+                         * trimming is wanted and this was the first char. b.
+                         * The last character was a space.
+                         **/
+                        continue;
+                    }
+                    buffer.append(SPACE_CHAR);
+                    continue;
+                }
+
+                if (foldCase) {
+                    final String mapping = CASE_MAP_TABLE.get(c);
+                    if (mapping != null) {
+                        buffer.append(mapping);
+                        continue;
+                    }
+                }
+                // It came here so no match was found.
+                buffer.append(c);
+            }
         }
-      }
 
-      final char[] mapped2Space = new char[] { '\u0009', 0xA, '\u000B',
-          '\u000C', 0xD, '\u0085', '\u00A0', '\u1680', '\u2000', '\u2001',
-          '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', '\u2007', '\u2008',
-          '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', '\u205F', '\u3000' };
-
-      for (final char c : mapped2Space)
-      {
-        MAP_2_SPACE.add(c);
-      }
-
-      // Appendix B.2 RFC 3454.
-      // Build an uppercase array and a lowercase array and create a map
-      // of both
-      // values.
-      final char[] upperCaseArr = new char[] { '\u0041', '\u0042', '\u0043',
-          '\u0044', '\u0045', '\u0046', '\u0047', '\u0048', '\u0049', '\u004A',
-          '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050', '\u0051',
-          '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', '\u0058',
-          '\u0059', '\u005A', '\u00B5', '\u00C0', '\u00C1', '\u00C2', '\u00C3',
-          '\u00C4', '\u00C5', '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA',
-          '\u00CB', '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u00D0', '\u00D1',
-          '\u00D2', '\u00D3', '\u00D4', '\u00D5', '\u00D6', '\u00D8', '\u00D9',
-          '\u00DA', '\u00DB', '\u00DC', '\u00DD', '\u00DE', '\u00DF', '\u0100',
-          '\u0102', '\u0104', '\u0106', '\u0108', '\u010A', '\u010C', '\u010E',
-          '\u0110', '\u0112', '\u0114', '\u0116', '\u0118', '\u011A', '\u011C',
-          '\u011E', '\u0120', '\u0122', '\u0124', '\u0126', '\u0128', '\u012A',
-          '\u012C', '\u012E', '\u0130', '\u0132', '\u0134', '\u0136', '\u0139',
-          '\u013B', '\u013D', '\u013F', '\u0141', '\u0143', '\u0145', '\u0147',
-          '\u0149', '\u014A', '\u014C', '\u014E', '\u0150', '\u0152', '\u0154',
-          '\u0156', '\u0158', '\u015A', '\u015C', '\u015E', '\u0160', '\u0162',
-          '\u0164', '\u0166', '\u0168', '\u016A', '\u016C', '\u016E', '\u0170',
-          '\u0172', '\u0174', '\u0176', '\u0178', '\u0179', '\u017B', '\u017D',
-          '\u017F', '\u0181', '\u0182', '\u0184', '\u0186', '\u0187', '\u0189',
-          '\u018A', '\u018B', '\u018E', '\u018F', '\u0190', '\u0191', '\u0193',
-          '\u0194', '\u0196', '\u0197', '\u0198', '\u019C', '\u019D', '\u019F',
-          '\u01A0', '\u01A2', '\u01A4', '\u01A6', '\u01A7', '\u01A9', '\u01AC',
-          '\u01AE', '\u01AF', '\u01B1', '\u01B2', '\u01B3', '\u01B5', '\u01B7',
-          '\u01B8', '\u01BC', '\u01C4', '\u01C5', '\u01C7', '\u01C8', '\u01CA',
-          '\u01CB', '\u01CD', '\u01CF', '\u01D1', '\u01D3', '\u01D5', '\u01D7',
-          '\u01D9', '\u01DB', '\u01DE', '\u01E0', '\u01E2', '\u01E4', '\u01E6',
-          '\u01E8', '\u01EA', '\u01EC', '\u01EE', '\u01F0', '\u01F1', '\u01F2',
-          '\u01F4', '\u01F6', '\u01F7', '\u01F8', '\u01FA', '\u01FC', '\u01FE',
-          '\u0200', '\u0202', '\u0204', '\u0206', '\u0208', '\u020A', '\u020C',
-          '\u020E', '\u0210', '\u0212', '\u0214', '\u0216', '\u0218', '\u021A',
-          '\u021C', '\u021E', '\u0220', '\u0222', '\u0224', '\u0226', '\u0228',
-          '\u022A', '\u022C', '\u022E', '\u0230', '\u0232', '\u0345', '\u037A',
-          '\u0386', '\u0388', '\u0389', '\u038A', '\u038C', '\u038E', '\u038F',
-          '\u0390', '\u0391', '\u0392', '\u0393', '\u0394', '\u0395', '\u0396',
-          '\u0397', '\u0398', '\u0399', '\u039A', '\u039B', '\u039C', '\u039D',
-          '\u039E', '\u039F', '\u03A0', '\u03A1', '\u03A3', '\u03A4', '\u03A5',
-          '\u03A6', '\u03A7', '\u03A8', '\u03A9', '\u03AA', '\u03AB', '\u03B0',
-          '\u03C2', '\u03D0', '\u03D1', '\u03D2', '\u03D3', '\u03D4', '\u03D5',
-          '\u03D6', '\u03D8', '\u03DA', '\u03DC', '\u03DE', '\u03E0', '\u03E2',
-          '\u03E4', '\u03E6', '\u03E8', '\u03EA', '\u03EC', '\u03EE', '\u03F0',
-          '\u03F1', '\u03F2', '\u03F4', '\u03F5', '\u0400', '\u0401', '\u0402',
-          '\u0403', '\u0404', '\u0405', '\u0406', '\u0407', '\u0408', '\u0409',
-          '\u040A', '\u040B', '\u040C', '\u040D', '\u040E', '\u040F', '\u0410',
-          '\u0411', '\u0412', '\u0413', '\u0414', '\u0415', '\u0416', '\u0417',
-          '\u0418', '\u0419', '\u041A', '\u041B', '\u041C', '\u041D', '\u041E',
-          '\u041F', '\u0420', '\u0421', '\u0422', '\u0423', '\u0424', '\u0425',
-          '\u0426', '\u0427', '\u0428', '\u0429', '\u042A', '\u042B', '\u042C',
-          '\u042D', '\u042E', '\u042F', '\u0460', '\u0462', '\u0464', '\u0466',
-          '\u0468', '\u046A', '\u046C', '\u046E', '\u0470', '\u0472', '\u0474',
-          '\u0476', '\u0478', '\u047A', '\u047C', '\u047E', '\u0480', '\u048A',
-          '\u048C', '\u048E', '\u0490', '\u0492', '\u0494', '\u0496', '\u0498',
-          '\u049A', '\u049C', '\u049E', '\u04A0', '\u04A2', '\u04A4', '\u04A6',
-          '\u04A8', '\u04AA', '\u04AC', '\u04AE', '\u04B0', '\u04B2', '\u04B4',
-          '\u04B6', '\u04B8', '\u04BA', '\u04BC', '\u04BE', '\u04C1', '\u04C3',
-          '\u04C5', '\u04C7', '\u04C9', '\u04CB', '\u04CD', '\u04D0', '\u04D2',
-          '\u04D4', '\u04D6', '\u04D8', '\u04DA', '\u04DC', '\u04DE', '\u04E0',
-          '\u04E2', '\u04E4', '\u04E6', '\u04E8', '\u04EA', '\u04EC', '\u04EE',
-          '\u04F0', '\u04F2', '\u04F4', '\u04F8', '\u0500', '\u0502', '\u0504',
-          '\u0506', '\u0508', '\u050A', '\u050C', '\u050E', '\u0531', '\u0532',
-          '\u0533', '\u0534', '\u0535', '\u0536', '\u0537', '\u0538', '\u0539',
-          '\u053A', '\u053B', '\u053C', '\u053D', '\u053E', '\u053F', '\u0540',
-          '\u0541', '\u0542', '\u0543', '\u0544', '\u0545', '\u0546', '\u0547',
-          '\u0548', '\u0549', '\u054A', '\u054B', '\u054C', '\u054D', '\u054E',
-          '\u054F', '\u0550', '\u0551', '\u0552', '\u0553', '\u0554', '\u0555',
-          '\u0556', '\u0587', '\u1E00', '\u1E02', '\u1E04', '\u1E06', '\u1E08',
-          '\u1E0A', '\u1E0C', '\u1E0E', '\u1E10', '\u1E12', '\u1E14', '\u1E16',
-          '\u1E18', '\u1E1A', '\u1E1C', '\u1E1E', '\u1E20', '\u1E22', '\u1E24',
-          '\u1E26', '\u1E28', '\u1E2A', '\u1E2C', '\u1E2E', '\u1E30', '\u1E32',
-          '\u1E34', '\u1E36', '\u1E38', '\u1E3A', '\u1E3C', '\u1E3E', '\u1E40',
-          '\u1E42', '\u1E44', '\u1E46', '\u1E48', '\u1E4A', '\u1E4C', '\u1E4E',
-          '\u1E50', '\u1E52', '\u1E54', '\u1E56', '\u1E58', '\u1E5A', '\u1E5C',
-          '\u1E5E', '\u1E60', '\u1E62', '\u1E64', '\u1E66', '\u1E68', '\u1E6A',
-          '\u1E6C', '\u1E6E', '\u1E70', '\u1E72', '\u1E74', '\u1E76', '\u1E78',
-          '\u1E7A', '\u1E7C', '\u1E7E', '\u1E80', '\u1E82', '\u1E84', '\u1E86',
-          '\u1E88', '\u1E8A', '\u1E8C', '\u1E8E', '\u1E90', '\u1E92', '\u1E94',
-          '\u1E96', '\u1E97', '\u1E98', '\u1E99', '\u1E9A', '\u1E9B', '\u1EA0',
-          '\u1EA2', '\u1EA4', '\u1EA6', '\u1EA8', '\u1EAA', '\u1EAC', '\u1EAE',
-          '\u1EB0', '\u1EB2', '\u1EB4', '\u1EB6', '\u1EB8', '\u1EBA', '\u1EBC',
-          '\u1EBE', '\u1EC0', '\u1EC2', '\u1EC4', '\u1EC6', '\u1EC8', '\u1ECA',
-          '\u1ECC', '\u1ECE', '\u1ED0', '\u1ED2', '\u1ED4', '\u1ED6', '\u1ED8',
-          '\u1EDA', '\u1EDC', '\u1EDE', '\u1EE0', '\u1EE2', '\u1EE4', '\u1EE6',
-          '\u1EE8', '\u1EEA', '\u1EEC', '\u1EEE', '\u1EF0', '\u1EF2', '\u1EF4',
-          '\u1EF6', '\u1EF8', '\u1F08', '\u1F09', '\u1F0A', '\u1F0B', '\u1F0C',
-          '\u1F0D', '\u1F0E', '\u1F0F', '\u1F18', '\u1F19', '\u1F1A', '\u1F1B',
-          '\u1F1C', '\u1F1D', '\u1F28', '\u1F29', '\u1F2A', '\u1F2B', '\u1F2C',
-          '\u1F2D', '\u1F2E', '\u1F2F', '\u1F38', '\u1F39', '\u1F3A', '\u1F3B',
-          '\u1F3C', '\u1F3D', '\u1F3E', '\u1F3F', '\u1F48', '\u1F49', '\u1F4A',
-          '\u1F4B', '\u1F4C', '\u1F4D', '\u1F50', '\u1F52', '\u1F54', '\u1F56',
-          '\u1F59', '\u1F5B', '\u1F5D', '\u1F5F', '\u1F68', '\u1F69', '\u1F6A',
-          '\u1F6B', '\u1F6C', '\u1F6D', '\u1F6E', '\u1F6F', '\u1F80', '\u1F81',
-          '\u1F82', '\u1F83', '\u1F84', '\u1F85', '\u1F86', '\u1F87', '\u1F88',
-          '\u1F89', '\u1F8A', '\u1F8B', '\u1F8C', '\u1F8D', '\u1F8E', '\u1F8F',
-          '\u1F90', '\u1F91', '\u1F92', '\u1F93', '\u1F94', '\u1F95', '\u1F96',
-          '\u1F97', '\u1F98', '\u1F99', '\u1F9A', '\u1F9B', '\u1F9C', '\u1F9D',
-          '\u1F9E', '\u1F9F', '\u1FA0', '\u1FA1', '\u1FA2', '\u1FA3', '\u1FA4',
-          '\u1FA5', '\u1FA6', '\u1FA7', '\u1FA8', '\u1FA9', '\u1FAA', '\u1FAB',
-          '\u1FAC', '\u1FAD', '\u1FAE', '\u1FAF', '\u1FB2', '\u1FB3', '\u1FB4',
-          '\u1FB6', '\u1FB7', '\u1FB8', '\u1FB9', '\u1FBA', '\u1FBB', '\u1FBC',
-          '\u1FBE', '\u1FC2', '\u1FC3', '\u1FC4', '\u1FC6', '\u1FC7', '\u1FC8',
-          '\u1FC9', '\u1FCA', '\u1FCB', '\u1FCC', '\u1FD2', '\u1FD3', '\u1FD6',
-          '\u1FD7', '\u1FD8', '\u1FD9', '\u1FDA', '\u1FDB', '\u1FE2', '\u1FE3',
-          '\u1FE4', '\u1FE6', '\u1FE7', '\u1FE8', '\u1FE9', '\u1FEA', '\u1FEB',
-          '\u1FEC', '\u1FF2', '\u1FF3', '\u1FF4', '\u1FF6', '\u1FF7', '\u1FF8',
-          '\u1FF9', '\u1FFA', '\u1FFB', '\u1FFC', '\u20A8', '\u2102', '\u2103',
-          '\u2107', '\u2109', '\u210B', '\u210C', '\u210D', '\u2110', '\u2111',
-          '\u2112', '\u2115', '\u2116', '\u2119', '\u211A', '\u211B', '\u211C',
-          '\u211D', '\u2120', '\u2121', '\u2122', '\u2124', '\u2126', '\u2128',
-          '\u212A', '\u212B', '\u212C', '\u212D', '\u2130', '\u2131', '\u2133',
-          '\u213E', '\u213F', '\u2145', '\u2160', '\u2161', '\u2162', '\u2163',
-          '\u2164', '\u2165', '\u2166', '\u2167', '\u2168', '\u2169', '\u216A',
-          '\u216B', '\u216C', '\u216D', '\u216E', '\u216F', '\u24B6', '\u24B7',
-          '\u24B8', '\u24B9', '\u24BA', '\u24BB', '\u24BC', '\u24BD', '\u24BE',
-          '\u24BF', '\u24C0', '\u24C1', '\u24C2', '\u24C3', '\u24C4', '\u24C5',
-          '\u24C6', '\u24C7', '\u24C8', '\u24C9', '\u24CA', '\u24CB', '\u24CC',
-          '\u24CD', '\u24CE', '\u24CF', '\u3371', '\u3373', '\u3375', '\u3380',
-          '\u3381', '\u3382', '\u3383', '\u3384', '\u3385', '\u3386', '\u3387',
-          '\u338A', '\u338B', '\u338C', '\u3390', '\u3391', '\u3392', '\u3393',
-          '\u3394', '\u33A9', '\u33AA', '\u33AB', '\u33AC', '\u33B4', '\u33B5',
-          '\u33B6', '\u33B7', '\u33B8', '\u33B9', '\u33BA', '\u33BB', '\u33BC',
-          '\u33BD', '\u33BE', '\u33BF', '\u33C0', '\u33C1', '\u33C3', '\u33C6',
-          '\u33C7', '\u33C8', '\u33C9', '\u33CB', '\u33CD', '\u33CE', '\u33D7',
-          '\u33D9', '\u33DA', '\u33DC', '\u33DD', '\uFB00', '\uFB01', '\uFB02',
-          '\uFB03', '\uFB04', '\uFB05', '\uFB06', '\uFB13', '\uFB14', '\uFB15',
-          '\uFB16', '\uFB17', '\uFF21', '\uFF22', '\uFF23', '\uFF24', '\uFF25',
-          '\uFF26', '\uFF27', '\uFF28', '\uFF29', '\uFF2A', '\uFF2B', '\uFF2C',
-          '\uFF2D', '\uFF2E', '\uFF2F', '\uFF30', '\uFF31', '\uFF32', '\uFF33',
-          '\uFF34', '\uFF35', '\uFF36', '\uFF37', '\uFF38', '\uFF39', '\uFF3A' };
-      final String[] lowerCaseFoldedArr = new String[] { "\u0061", "\u0062",
-          "\u0063", "\u0064", "\u0065", "\u0066", "\u0067", "\u0068", "\u0069",
-          "\u006A", "\u006B", "\u006C", "\u006D", "\u006E", "\u006F", "\u0070",
-          "\u0071", "\u0072", "\u0073", "\u0074", "\u0075", "\u0076", "\u0077",
-          "\u0078", "\u0079", "\u007A", "\u03BC", "\u00E0", "\u00E1", "\u00E2",
-          "\u00E3", "\u00E4", "\u00E5", "\u00E6", "\u00E7", "\u00E8", "\u00E9",
-          "\u00EA", "\u00EB", "\u00EC", "\u00ED", "\u00EE", "\u00EF", "\u00F0",
-          "\u00F1", "\u00F2", "\u00F3", "\u00F4", "\u00F5", "\u00F6", "\u00F8",
-          "\u00F9", "\u00FA", "\u00FB", "\u00FC", "\u00FD", "\u00FE",
-          "\u0073\u0073", "\u0101", "\u0103", "\u0105", "\u0107", "\u0109",
-          "\u010B", "\u010D", "\u010F", "\u0111", "\u0113", "\u0115", "\u0117",
-          "\u0119", "\u011B", "\u011D", "\u011F", "\u0121", "\u0123", "\u0125",
-          "\u0127", "\u0129", "\u012B", "\u012D", "\u012F", "\u0069\u0307",
-          "\u0133", "\u0135", "\u0137", "\u013A", "\u013C", "\u013E", "\u0140",
-          "\u0142", "\u0144", "\u0146", "\u0148", "\u02BC\u006E", "\u014B",
-          "\u014D", "\u014F", "\u0151", "\u0153", "\u0155", "\u0157", "\u0159",
-          "\u015B", "\u015D", "\u015F", "\u0161", "\u0163", "\u0165", "\u0167",
-          "\u0169", "\u016B", "\u016D", "\u016F", "\u0171", "\u0173", "\u0175",
-          "\u0177", "\u00FF", "\u017A", "\u017C", "\u017E", "\u0073", "\u0253",
-          "\u0183", "\u0185", "\u0254", "\u0188", "\u0256", "\u0257", "\u018C",
-          "\u01DD", "\u0259", "\u025B", "\u0192", "\u0260", "\u0263", "\u0269",
-          "\u0268", "\u0199", "\u026F", "\u0272", "\u0275", "\u01A1", "\u01A3",
-          "\u01A5", "\u0280", "\u01A8", "\u0283", "\u01AD", "\u0288", "\u01B0",
-          "\u028A", "\u028B", "\u01B4", "\u01B6", "\u0292", "\u01B9", "\u01BD",
-          "\u01C6", "\u01C6", "\u01C9", "\u01C9", "\u01CC", "\u01CC", "\u01CE",
-          "\u01D0", "\u01D2", "\u01D4", "\u01D6", "\u01D8", "\u01DA", "\u01DC",
-          "\u01DF", "\u01E1", "\u01E3", "\u01E5", "\u01E7", "\u01E9", "\u01EB",
-          "\u01ED", "\u01EF", "\u006A\u030C", "\u01F3", "\u01F3", "\u01F5",
-          "\u0195", "\u01BF", "\u01F9", "\u01FB", "\u01FD", "\u01FF", "\u0201",
-          "\u0203", "\u0205", "\u0207", "\u0209", "\u020B", "\u020D", "\u020F",
-          "\u0211", "\u0213", "\u0215", "\u0217", "\u0219", "\u021B", "\u021D",
-          "\u021F", "\u019E", "\u0223", "\u0225", "\u0227", "\u0229", "\u022B",
-          "\u022D", "\u022F", "\u0231", "\u0233", "\u03B9", "\u0020\u03B9",
-          "\u03AC", "\u03AD", "\u03AE", "\u03AF", "\u03CC", "\u03CD", "\u03CE",
-          "\u03B9\u0308\u0301", "\u03B1", "\u03B2", "\u03B3", "\u03B4",
-          "\u03B5", "\u03B6", "\u03B7", "\u03B8", "\u03B9", "\u03BA", "\u03BB",
-          "\u03BC", "\u03BD", "\u03BE", "\u03BF", "\u03C0", "\u03C1", "\u03C3",
-          "\u03C4", "\u03C5", "\u03C6", "\u03C7", "\u03C8", "\u03C9", "\u03CA",
-          "\u03CB", "\u03C5\u0308\u0301", "\u03C3", "\u03B2", "\u03B8",
-          "\u03C5", "\u03CD", "\u03CB", "\u03C6", "\u03C0", "\u03D9", "\u03DB",
-          "\u03DD", "\u03DF", "\u03E1", "\u03E3", "\u03E5", "\u03E7", "\u03E9",
-          "\u03EB", "\u03ED", "\u03EF", "\u03BA", "\u03C1", "\u03C3", "\u03B8",
-          "\u03B5", "\u0450", "\u0451", "\u0452", "\u0453", "\u0454", "\u0455",
-          "\u0456", "\u0457", "\u0458", "\u0459", "\u045A", "\u045B", "\u045C",
-          "\u045D", "\u045E", "\u045F", "\u0430", "\u0431", "\u0432", "\u0433",
-          "\u0434", "\u0435", "\u0436", "\u0437", "\u0438", "\u0439", "\u043A",
-          "\u043B", "\u043C", "\u043D", "\u043E", "\u043F", "\u0440", "\u0441",
-          "\u0442", "\u0443", "\u0444", "\u0445", "\u0446", "\u0447", "\u0448",
-          "\u0449", "\u044A", "\u044B", "\u044C", "\u044D", "\u044E", "\u044F",
-          "\u0461", "\u0463", "\u0465", "\u0467", "\u0469", "\u046B", "\u046D",
-          "\u046F", "\u0471", "\u0473", "\u0475", "\u0477", "\u0479", "\u047B",
-          "\u047D", "\u047F", "\u0481", "\u048B", "\u048D", "\u048F", "\u0491",
-          "\u0493", "\u0495", "\u0497", "\u0499", "\u049B", "\u049D", "\u049F",
-          "\u04A1", "\u04A3", "\u04A5", "\u04A7", "\u04A9", "\u04AB", "\u04AD",
-          "\u04AF", "\u04B1", "\u04B3", "\u04B5", "\u04B7", "\u04B9", "\u04BB",
-          "\u04BD", "\u04BF", "\u04C2", "\u04C4", "\u04C6", "\u04C8", "\u04CA",
-          "\u04CC", "\u04CE", "\u04D1", "\u04D3", "\u04D5", "\u04D7", "\u04D9",
-          "\u04DB", "\u04DD", "\u04DF", "\u04E1", "\u04E3", "\u04E5", "\u04E7",
-          "\u04E9", "\u04EB", "\u04ED", "\u04EF", "\u04F1", "\u04F3", "\u04F5",
-          "\u04F9", "\u0501", "\u0503", "\u0505", "\u0507", "\u0509", "\u050B",
-          "\u050D", "\u050F", "\u0561", "\u0562", "\u0563", "\u0564", "\u0565",
-          "\u0566", "\u0567", "\u0568", "\u0569", "\u056A", "\u056B", "\u056C",
-          "\u056D", "\u056E", "\u056F", "\u0570", "\u0571", "\u0572", "\u0573",
-          "\u0574", "\u0575", "\u0576", "\u0577", "\u0578", "\u0579", "\u057A",
-          "\u057B", "\u057C", "\u057D", "\u057E", "\u057F", "\u0580", "\u0581",
-          "\u0582", "\u0583", "\u0584", "\u0585", "\u0586", "\u0565\u0582",
-          "\u1E01", "\u1E03", "\u1E05", "\u1E07", "\u1E09", "\u1E0B", "\u1E0D",
-          "\u1E0F", "\u1E11", "\u1E13", "\u1E15", "\u1E17", "\u1E19", "\u1E1B",
-          "\u1E1D", "\u1E1F", "\u1E21", "\u1E23", "\u1E25", "\u1E27", "\u1E29",
-          "\u1E2B", "\u1E2D", "\u1E2F", "\u1E31", "\u1E33", "\u1E35", "\u1E37",
-          "\u1E39", "\u1E3B", "\u1E3D", "\u1E3F", "\u1E41", "\u1E43", "\u1E45",
-          "\u1E47", "\u1E49", "\u1E4B", "\u1E4D", "\u1E4F", "\u1E51", "\u1E53",
-          "\u1E55", "\u1E57", "\u1E59", "\u1E5B", "\u1E5D", "\u1E5F", "\u1E61",
-          "\u1E63", "\u1E65", "\u1E67", "\u1E69", "\u1E6B", "\u1E6D", "\u1E6F",
-          "\u1E71", "\u1E73", "\u1E75", "\u1E77", "\u1E79", "\u1E7B", "\u1E7D",
-          "\u1E7F", "\u1E81", "\u1E83", "\u1E85", "\u1E87", "\u1E89", "\u1E8B",
-          "\u1E8D", "\u1E8F", "\u1E91", "\u1E93", "\u1E95", "\u0068\u0331",
-          "\u0074\u0308", "\u0077\u030A", "\u0079\u030A", "\u0061\u02BE",
-          "\u1E61", "\u1EA1", "\u1EA3", "\u1EA5", "\u1EA7", "\u1EA9", "\u1EAB",
-          "\u1EAD", "\u1EAF", "\u1EB1", "\u1EB3", "\u1EB5", "\u1EB7", "\u1EB9",
-          "\u1EBB", "\u1EBD", "\u1EBF", "\u1EC1", "\u1EC3", "\u1EC5", "\u1EC7",
-          "\u1EC9", "\u1ECB", "\u1ECD", "\u1ECF", "\u1ED1", "\u1ED3", "\u1ED5",
-          "\u1ED7", "\u1ED9", "\u1EDB", "\u1EDD", "\u1EDF", "\u1EE1", "\u1EE3",
-          "\u1EE5", "\u1EE7", "\u1EE9", "\u1EEB", "\u1EED", "\u1EEF", "\u1EF1",
-          "\u1EF3", "\u1EF5", "\u1EF7", "\u1EF9", "\u1F00", "\u1F01", "\u1F02",
-          "\u1F03", "\u1F04", "\u1F05", "\u1F06", "\u1F07", "\u1F10", "\u1F11",
-          "\u1F12", "\u1F13", "\u1F14", "\u1F15", "\u1F20", "\u1F21", "\u1F22",
-          "\u1F23", "\u1F24", "\u1F25", "\u1F26", "\u1F27", "\u1F30", "\u1F31",
-          "\u1F32", "\u1F33", "\u1F34", "\u1F35", "\u1F36", "\u1F37", "\u1F40",
-          "\u1F41", "\u1F42", "\u1F43", "\u1F44", "\u1F45", "\u03C5\u0313",
-          "\u03C5\u0313\u0300", "\u03C5\u0313\u0301", "\u03C5\u0313\u0342",
-          "\u1F51", "\u1F53", "\u1F55", "\u1F57", "\u1F60", "\u1F61", "\u1F62",
-          "\u1F63", "\u1F64", "\u1F65", "\u1F66", "\u1F67", "\u1F00\u03B9",
-          "\u1F01\u03B9", "\u1F02\u03B9", "\u1F03\u03B9", "\u1F04\u03B9",
-          "\u1F05\u03B9", "\u1F06\u03B9", "\u1F07\u03B9", "\u1F00\u03B9",
-          "\u1F01\u03B9", "\u1F02\u03B9", "\u1F03\u03B9", "\u1F04\u03B9",
-          "\u1F05\u03B9", "\u1F06\u03B9", "\u1F07\u03B9", "\u1F20\u03B9",
-          "\u1F21\u03B9", "\u1F22\u03B9", "\u1F23\u03B9", "\u1F24\u03B9",
-          "\u1F25\u03B9", "\u1F26\u03B9", "\u1F27\u03B9", "\u1F20\u03B9",
-          "\u1F21\u03B9", "\u1F22\u03B9", "\u1F23\u03B9", "\u1F24\u03B9",
-          "\u1F25\u03B9", "\u1F26\u03B9", "\u1F27\u03B9", "\u1F60\u03B9",
-          "\u1F61\u03B9", "\u1F62\u03B9", "\u1F63\u03B9", "\u1F64\u03B9",
-          "\u1F65\u03B9", "\u1F66\u03B9", "\u1F67\u03B9", "\u1F60\u03B9",
-          "\u1F61\u03B9", "\u1F62\u03B9", "\u1F63\u03B9", "\u1F64\u03B9",
-          "\u1F65\u03B9", "\u1F66\u03B9", "\u1F67\u03B9", "\u1F70\u03B9",
-          "\u03B1\u03B9", "\u03AC\u03B9", "\u03B1\u0342", "\u03B1\u0342\u03B9",
-          "\u1FB0", "\u1FB1", "\u1F70", "\u1F71", "\u03B1\u03B9", "\u03B9",
-          "\u1F74\u03B9", "\u03B7\u03B9", "\u03AE\u03B9", "\u03B7\u0342",
-          "\u03B7\u0342\u03B9", "\u1F72", "\u1F73", "\u1F74", "\u1F75",
-          "\u03B7\u03B9", "\u03B9\u0308\u0300", "\u03B9\u0308\u0301",
-          "\u03B9\u0342", "\u03B9\u0308\u0342", "\u1FD0", "\u1FD1", "\u1F76",
-          "\u1F77", "\u03C5\u0308\u0300", "\u03C5\u0308\u0301", "\u03C1\u0313",
-          "\u03C5\u0342", "\u03C5\u0308\u0342", "\u1FE0", "\u1FE1", "\u1F7A",
-          "\u1F7B", "\u1FE5", "\u1F7C\u03B9", "\u03C9\u03B9", "\u03CE\u03B9",
-          "\u03C9\u0342", "\u03C9\u0342\u03B9", "\u1F78", "\u1F79", "\u1F7C",
-          "\u1F7D", "\u03C9\u03B9", "\u0072\u0073", "\u0063", "\u00B0\u0063",
-          "\u025B", "\u00B0\u0066", "\u0068", "\u0068", "\u0068", "\u0069",
-          "\u0069", "\u006C", "\u006E", "\u006E\u006F", "\u0070", "\u0071",
-          "\u0072", "\u0072", "\u0072", "\u0073\u006D", "\u0074\u0065\u006C",
-          "\u0074\u006D", "\u007A", "\u03C9", "\u007A", "\u006B", "\u00E5",
-          "\u0062", "\u0063", "\u0065", "\u0066", "\u006D", "\u03B3", "\u03C0",
-          "\u0064", "\u2170", "\u2171", "\u2172", "\u2173", "\u2174", "\u2175",
-          "\u2176", "\u2177", "\u2178", "\u2179", "\u217A", "\u217B", "\u217C",
-          "\u217D", "\u217E", "\u217F", "\u24D0", "\u24D1", "\u24D2", "\u24D3",
-          "\u24D4", "\u24D5", "\u24D6", "\u24D7", "\u24D8", "\u24D9", "\u24DA",
-          "\u24DB", "\u24DC", "\u24DD", "\u24DE", "\u24DF", "\u24E0", "\u24E1",
-          "\u24E2", "\u24E3", "\u24E4", "\u24E5", "\u24E6", "\u24E7", "\u24E8",
-          "\u24E9", "\u0068\u0070\u0061", "\u0061\u0075", "\u006F\u0076",
-          "\u0070\u0061", "\u006E\u0061", "\u03BC\u0061", "\u006D\u0061",
-          "\u006B\u0061", "\u006B\u0062", "\u006D\u0062", "\u0067\u0062",
-          "\u0070\u0066", "\u006E\u0066", "\u03BC\u0066", "\u0068\u007A",
-          "\u006B\u0068\u007A", "\u006D\u0068\u007A", "\u0067\u0068\u007A",
-          "\u0074\u0068\u007A", "\u0070\u0061", "\u006B\u0070\u0061",
-          "\u006D\u0070\u0061", "\u0067\u0070\u0061", "\u0070\u0076",
-          "\u006E\u0076", "\u03BC\u0076", "\u006D\u0076", "\u006B\u0076",
-          "\u006D\u0076", "\u0070\u0077", "\u006E\u0077", "\u03BC\u0077",
-          "\u006D\u0077", "\u006B\u0077", "\u006D\u0077", "\u006B\u03C9",
-          "\u006D\u03C9", "\u0062\u0071", "\u0063\u2215\u006B\u0067",
-          "\u0063\u006F\u002E", "\u0064\u0062", "\u0067\u0079", "\u0068\u0070",
-          "\u006B\u006B", "\u006B\u006D", "\u0070\u0068", "\u0070\u0070\u006D",
-          "\u0070\u0072", "\u0073\u0076", "\u0077\u0062", "\u0066\u0066",
-          "\u0066\u0069", "\u0066\u006C", "\u0066\u0066\u0069",
-          "\u0066\u0066\u006C", "\u0073\u0074", "\u0073\u0074", "\u0574\u0576",
-          "\u0574\u0565", "\u0574\u056B", "\u057E\u0576", "\u0574\u056D",
-          "\uFF41", "\uFF42", "\uFF43", "\uFF44", "\uFF45", "\uFF46", "\uFF47",
-          "\uFF48", "\uFF49", "\uFF4A", "\uFF4B", "\uFF4C", "\uFF4D", "\uFF4E",
-          "\uFF4F", "\uFF50", "\uFF51", "\uFF52", "\uFF53", "\uFF54", "\uFF55",
-          "\uFF56", "\uFF57", "\uFF58", "\uFF59", "\uFF5A" };
-      for (int count = 0; count < upperCaseArr.length; count++)
-      {
-        CASE_MAP_TABLE.put(upperCaseArr[count], lowerCaseFoldedArr[count]);
-      }
+        private MappingTable() {
+            // Prevent instantiation.
+        }
     }
 
+    /**
+     * Defines SPACE character.
+     */
+    private static final char SPACE_CHAR = '\u0020';
 
+    /**
+     * Indicates whether case should be folded during string preparation.
+     */
+    public static final boolean CASE_FOLD = true;
 
-    // Gets the mapped String.
-    private static void map(final StringBuilder buffer,
-        final ByteSequence sequence, final boolean trim, final boolean foldCase)
-    {
-      final String value = sequence.toString();
-      for (int i = 0; i < value.length(); i++)
-      {
-        final char c = value.charAt(i);
-        if (MAP_2_NULL.contains(c))
-        {
-          continue;
+    /**
+     * Indicates whether case should not be folded during string preparation.
+     */
+    public static final boolean NO_CASE_FOLD = false;
+
+    /**
+     * Indicates whether leading and trailing spaces should be trimmed during
+     * string preparation.
+     */
+    public static final boolean TRIM = true;
+
+    /**
+     * Prepares an attribute or assertion value as per stringprep algorithm
+     * defined in RFC 4518.
+     *
+     * @param buffer
+     *            The buffer to which the prepared form of the string should be
+     *            appended.
+     * @param sequence
+     *            The {@link org.forgerock.opendj.ldap.ByteSequence} that needs
+     *            preparation.
+     * @param trim
+     *            Indicates whether leading and trailing spaces should be
+     *            omitted from the string representation.
+     * @param foldCase
+     *            Indicates whether the case will be folded during mapping.
+     * @see <a href="http://www.rfc-editor.org/rfc/rfc4518.txt">
+     *      Internationalized String Preparation</a>
+     */
+    public static void prepareUnicode(final StringBuilder buffer, final ByteSequence sequence,
+            final boolean trim, final boolean foldCase) {
+        ensureNotNull(buffer);
+        ensureNotNull(sequence);
+        // Optimize in the case of purely ascii characters which is the most
+        // common case.
+        final int length = sequence.length();
+        for (int i = 0; i < length; i++) {
+            if ((sequence.byteAt(i) & 0x7F) != sequence.byteAt(i)) {
+                // Map the attribute value.
+                map(buffer, sequence.subSequence(i, length), trim, foldCase);
+                // Normalize the attribute value.
+                String normalizedForm = Normalizer.normalize(buffer, Form.NFKD);
+                buffer.setLength(0);
+                buffer.append(normalizedForm);
+                break;
+            }
+            int buffLen = buffer.length();
+            switch (sequence.byteAt(i)) {
+            case ' ':
+                if (trim && buffLen == 0 || buffLen > 0 && buffer.charAt(buffLen - 1) == SPACE_CHAR) {
+                    break;
+                }
+                buffer.append(' ');
+                break;
+            default:
+                final byte b = sequence.byteAt(i);
+                // Perform mapping.
+                if (b >= '\u0009' && b < '\u000E') {
+                    // These characters are mapped to a SPACE.
+                    buffLen = buffer.length();
+                    if (trim && buffLen == 0 || buffLen > 0 && buffer.charAt(buffLen - 1) == ' ') {
+                        /**
+                         * Do not map this character into a space if: a .
+                         * trimming is desired and this was the leading char. b.
+                         * The last character was a space.
+                         **/
+                        break;
+                    } else {
+                        buffer.append(SPACE_CHAR);
+                    }
+                } else if (b >= '\u0000' && b <= '\u0008' || b >= '\u000E' && b <= '\u001F'
+                        || b == '\u007F') {
+                    // These characters are mapped to nothing and hence not
+                    // copied
+                    // over..
+                    break;
+                } else if (foldCase && b >= 65 && b <= 90) {
+                    // If case-folding is allowed then map to the lower case.
+                    buffer.append((char) (b + 32));
+                } else {
+                    buffer.append((char) b);
+                }
+                break;
+            }
         }
-
-        if (MAP_2_SPACE.contains(c))
-        {
-          final int buffLen = buffer.length();
-          if (trim && buffLen == 0 || buffLen > 0
-              && buffer.charAt(buffLen - 1) == SPACE_CHAR)
-          {
-            /**
-             * Do not map this character into a space if: a . trimming is wanted
-             * and this was the first char. b. The last character was a space.
-             **/
-            continue;
-          }
-          buffer.append(SPACE_CHAR);
-          continue;
+        if (trim) {
+            // Strip off any trailing spaces.
+            for (int i = buffer.length() - 1; i > 0; i--) {
+                if (buffer.charAt(i) == SPACE_CHAR) {
+                    buffer.delete(i, i + 1);
+                } else {
+                    break;
+                }
+            }
         }
-
-        if (foldCase)
-        {
-          final String mapping = CASE_MAP_TABLE.get(c);
-          if (mapping != null)
-          {
-            buffer.append(mapping);
-            continue;
-          }
-        }
-        // It came here so no match was found.
-        buffer.append(c);
-      }
     }
 
-
-
-    private MappingTable()
-    {
-      // Prevent instantiation.
+    // Checks each character and replaces it with its mapping.
+    private static void map(final StringBuilder buffer, final ByteSequence value,
+            final boolean trim, final boolean foldCase) {
+        MappingTable.map(buffer, value, trim, foldCase);
     }
-  }
 
-
-
-  /**
-   * Defines SPACE character.
-   */
-  private static final char SPACE_CHAR = '\u0020';
-
-  /**
-   * Indicates whether case should be folded during string preparation.
-   */
-  public static final boolean CASE_FOLD = true;
-
-  /**
-   * Indicates whether case should not be folded during string preparation.
-   */
-  public static final boolean NO_CASE_FOLD = false;
-
-  /**
-   * Indicates whether leading and trailing spaces should be trimmed during
-   * string preparation.
-   */
-  public static final boolean TRIM = true;
-
-
-
-  /**
-   * Prepares an attribute or assertion value as per stringprep algorithm
-   * defined in RFC 4518.
-   *
-   * @param buffer
-   *          The buffer to which the prepared form of the string should be
-   *          appended.
-   * @param sequence
-   *          The {@link org.forgerock.opendj.ldap.ByteSequence} that needs preparation.
-   * @param trim
-   *          Indicates whether leading and trailing spaces should be omitted
-   *          from the string representation.
-   * @param foldCase
-   *          Indicates whether the case will be folded during mapping.
-   * @see <a href="http://www.rfc-editor.org/rfc/rfc4518.txt"> Internationalized
-   *      String Preparation</a>
-   */
-  public static void prepareUnicode(final StringBuilder buffer,
-      final ByteSequence sequence, final boolean trim, final boolean foldCase)
-  {
-    ensureNotNull(buffer);
-    ensureNotNull(sequence);
-    // Optimize in the case of purely ascii characters which is the most
-    // common case.
-    final int length = sequence.length();
-    for (int i = 0; i < length; i++)
-    {
-      if ((sequence.byteAt(i) & 0x7F) != sequence.byteAt(i))
-      {
-        // Map the attribute value.
-        map(buffer, sequence.subSequence(i, length), trim, foldCase);
-        // Normalize the attribute value.
-        String normalizedForm = Normalizer.normalize(buffer, Form.NFKD);
-        buffer.setLength(0);
-        buffer.append(normalizedForm);
-        break;
-      }
-      int buffLen = buffer.length();
-      switch (sequence.byteAt(i))
-      {
-      case ' ':
-        if (trim && buffLen == 0 || buffLen > 0
-            && buffer.charAt(buffLen - 1) == SPACE_CHAR)
-        {
-          break;
-        }
-        buffer.append(' ');
-        break;
-      default:
-        final byte b = sequence.byteAt(i);
-        // Perform mapping.
-        if (b >= '\u0009' && b < '\u000E')
-        {
-          // These characters are mapped to a SPACE.
-          buffLen = buffer.length();
-          if (trim && buffLen == 0 || buffLen > 0
-              && buffer.charAt(buffLen - 1) == ' ')
-          {
-            /**
-             * Do not map this character into a space if: a . trimming is
-             * desired and this was the leading char. b. The last character was
-             * a space.
-             **/
-            break;
-          }
-          else
-          {
-            buffer.append(SPACE_CHAR);
-          }
-        }
-        else if (b >= '\u0000' && b <= '\u0008' || b >= '\u000E'
-            && b <= '\u001F' || b == '\u007F')
-        {
-          // These characters are mapped to nothing and hence not copied
-          // over..
-          break;
-        }
-        else if (foldCase && b >= 65 && b <= 90)
-        {
-          // If case-folding is allowed then map to the lower case.
-          buffer.append((char) (b + 32));
-        }
-        else
-        {
-          buffer.append((char) b);
-        }
-        break;
-      }
+    // Prevent instantiation.
+    private StringPrepProfile() {
+        // Nothing to do.
     }
-    if (trim)
-    {
-      // Strip off any trailing spaces.
-      for (int i = buffer.length() - 1; i > 0; i--)
-      {
-        if (buffer.charAt(i) == SPACE_CHAR)
-        {
-          buffer.delete(i, i + 1);
-        }
-        else
-        {
-          break;
-        }
-      }
-    }
-  }
-
-
-
-  // Checks each character and replaces it with its mapping.
-  private static void map(final StringBuilder buffer, final ByteSequence value,
-      final boolean trim, final boolean foldCase)
-  {
-    MappingTable.map(buffer, value, trim, foldCase);
-  }
-
-
-
-  // Prevent instantiation.
-  private StringPrepProfile()
-  {
-    // Nothing to do.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SubstringReader.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SubstringReader.java
index 2938a4b..362e8b5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SubstringReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/SubstringReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,158 +27,125 @@
 
 package com.forgerock.opendj.util;
 
-
-
 /**
  * A sub-string reader.
  */
-public class SubstringReader
-{
-  // The source string.
-  private final String source;
-  // The current position.
-  private int pos;
-  // The marked position.
-  private int mark;
-  // The length of the source.
-  private final int length;
+public class SubstringReader {
+    // The source string.
+    private final String source;
+    // The current position.
+    private int pos;
+    // The marked position.
+    private int mark;
+    // The length of the source.
+    private final int length;
 
-
-
-  /**
-   * Creates an instance of SubstringReader.
-   *
-   * @param s
-   *          the source of the reader.
-   */
-  public SubstringReader(final String s)
-  {
-    Validator.ensureNotNull(s);
-    source = s;
-    length = s.length();
-    pos = 0;
-    mark = 0;
-  }
-
-
-
-  /**
-   * Returns the source string.
-   *
-   * @return source string.
-   */
-  public String getString()
-  {
-    return source;
-  }
-
-
-
-  /**
-   * Marks the present position in the stream. Subsequent calls to reset() will
-   * reposition the stream to this point.
-   */
-  public void mark()
-  {
-    mark = pos;
-  }
-
-
-
-  /**
-   * Returns the current position of the reader.
-   *
-   * @return current position of the reader.
-   */
-  public int pos()
-  {
-    return pos;
-  }
-
-
-
-  /**
-   * Attempts to read a character from the current position. The caller must
-   * ensure that the source string has the data available from the current
-   * position.
-   *
-   * @return The character at the current position.
-   * @throws StringIndexOutOfBoundsException If there is no more data
-   *            available to read.
-   */
-  public char read()
-  {
-    if (pos >= length)
-    {
-      throw new StringIndexOutOfBoundsException();
+    /**
+     * Creates an instance of SubstringReader.
+     *
+     * @param s
+     *            the source of the reader.
+     */
+    public SubstringReader(final String s) {
+        Validator.ensureNotNull(s);
+        source = s;
+        length = s.length();
+        pos = 0;
+        mark = 0;
     }
-    return source.charAt(pos++);
-  }
 
-
-
-  /**
-   * Attempts to read a substring of the specified length from the current
-   * position. The caller must ensure that the requested length is within the
-   * bounds i.e. the requested length from the current position should not
-   * exceed the length of the source string.
-   *
-   * @param length
-   *          The number of characters to read.
-   * @return The substring.
-   * @throws StringIndexOutOfBoundsException If the length exceeds the
-   *            allowed length.
-   */
-  public String read(final int length)
-  {
-    if (length > this.length || pos + length > this.length)
-    {
-      throw new StringIndexOutOfBoundsException();
+    /**
+     * Returns the source string.
+     *
+     * @return source string.
+     */
+    public String getString() {
+        return source;
     }
-    final String substring = source.substring(pos, pos + length);
-    pos += length;
-    return substring;
-  }
 
-
-
-  /**
-   * Returns the remaining length of the available data.
-   *
-   * @return remaining length.
-   */
-  public int remaining()
-  {
-    return length - pos;
-  }
-
-
-
-  /**
-   * Resets the stream to the most recent mark, or to the beginning of the
-   * string if it has never been marked.
-   */
-  public void reset()
-  {
-    pos = mark;
-  }
-
-
-
-  /**
-   * Skips the whitespace characters and advances the reader to the next non
-   * whitespace character.
-   *
-   * @return number of whitespace characters skipped.
-   */
-  public int skipWhitespaces()
-  {
-    int skipped = 0;
-    while (pos < length && source.charAt(pos) == ' ')
-    {
-      skipped++;
-      pos++;
+    /**
+     * Marks the present position in the stream. Subsequent calls to reset()
+     * will reposition the stream to this point.
+     */
+    public void mark() {
+        mark = pos;
     }
-    return skipped;
-  }
+
+    /**
+     * Returns the current position of the reader.
+     *
+     * @return current position of the reader.
+     */
+    public int pos() {
+        return pos;
+    }
+
+    /**
+     * Attempts to read a character from the current position. The caller must
+     * ensure that the source string has the data available from the current
+     * position.
+     *
+     * @return The character at the current position.
+     * @throws StringIndexOutOfBoundsException
+     *             If there is no more data available to read.
+     */
+    public char read() {
+        if (pos >= length) {
+            throw new StringIndexOutOfBoundsException();
+        }
+        return source.charAt(pos++);
+    }
+
+    /**
+     * Attempts to read a substring of the specified length from the current
+     * position. The caller must ensure that the requested length is within the
+     * bounds i.e. the requested length from the current position should not
+     * exceed the length of the source string.
+     *
+     * @param length
+     *            The number of characters to read.
+     * @return The substring.
+     * @throws StringIndexOutOfBoundsException
+     *             If the length exceeds the allowed length.
+     */
+    public String read(final int length) {
+        if (length > this.length || pos + length > this.length) {
+            throw new StringIndexOutOfBoundsException();
+        }
+        final String substring = source.substring(pos, pos + length);
+        pos += length;
+        return substring;
+    }
+
+    /**
+     * Returns the remaining length of the available data.
+     *
+     * @return remaining length.
+     */
+    public int remaining() {
+        return length - pos;
+    }
+
+    /**
+     * Resets the stream to the most recent mark, or to the beginning of the
+     * string if it has never been marked.
+     */
+    public void reset() {
+        pos = mark;
+    }
+
+    /**
+     * Skips the whitespace characters and advances the reader to the next non
+     * whitespace character.
+     *
+     * @return number of whitespace characters skipped.
+     */
+    public int skipWhitespaces() {
+        int skipped = 0;
+        while (pos < length && source.charAt(pos) == ' ') {
+            skipped++;
+            pos++;
+        }
+        return skipped;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
index c300e16..ae1a727 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,183 +27,150 @@
 
 package com.forgerock.opendj.util;
 
-
-
 /**
  * Common methods for validating method arguments.
  */
-public final class Validator
-{
+public final class Validator {
 
-  /**
-   * Throws a {@code NullPointerException} if any of the provided arguments are
-   * {@code null}.
-   *
-   * @param objects
-   *          The objects to test.
-   * @throws NullPointerException
-   *           If any of the provided arguments are {@code null}.
-   */
-  public static void ensureNotNull(final Object... objects)
-  {
-    for (final Object o : objects)
-    {
-      if (o == null)
-      {
-        throw new NullPointerException();
-      }
+    /**
+     * Throws a {@code NullPointerException} if any of the provided arguments
+     * are {@code null}.
+     *
+     * @param objects
+     *            The objects to test.
+     * @throws NullPointerException
+     *             If any of the provided arguments are {@code null}.
+     */
+    public static void ensureNotNull(final Object... objects) {
+        for (final Object o : objects) {
+            if (o == null) {
+                throw new NullPointerException();
+            }
+        }
     }
-  }
 
-
-
-  /**
-   * Throws a {@code NullPointerException} if any of the provided arguments are
-   * {@code null}.
-   *
-   * @param o1
-   *          The first object to test.
-   * @param o2
-   *          The second object to test.
-   * @throws NullPointerException
-   *           If any of the provided arguments are {@code null}.
-   */
-  public static void ensureNotNull(final Object o1, final Object o2)
-  {
-    if (o1 == null || o2 == null)
-    {
-      throw new NullPointerException();
+    /**
+     * Throws a {@code NullPointerException} if any of the provided arguments
+     * are {@code null}.
+     *
+     * @param o1
+     *            The first object to test.
+     * @param o2
+     *            The second object to test.
+     * @throws NullPointerException
+     *             If any of the provided arguments are {@code null}.
+     */
+    public static void ensureNotNull(final Object o1, final Object o2) {
+        if (o1 == null || o2 == null) {
+            throw new NullPointerException();
+        }
     }
-  }
 
-
-
-  /**
-   * Throws a {@code NullPointerException} if any of the provided arguments are
-   * {@code null}.
-   *
-   * @param o1
-   *          The first object to test.
-   * @param o2
-   *          The second object to test.
-   * @param o3
-   *          The third object to test.
-   * @throws NullPointerException
-   *           If any of the provided arguments are {@code null}.
-   */
-  public static void ensureNotNull(final Object o1, final Object o2,
-      final Object o3)
-  {
-    if (o1 == null || o2 == null || o3 == null)
-    {
-      throw new NullPointerException();
+    /**
+     * Throws a {@code NullPointerException} if any of the provided arguments
+     * are {@code null}.
+     *
+     * @param o1
+     *            The first object to test.
+     * @param o2
+     *            The second object to test.
+     * @param o3
+     *            The third object to test.
+     * @throws NullPointerException
+     *             If any of the provided arguments are {@code null}.
+     */
+    public static void ensureNotNull(final Object o1, final Object o2, final Object o3) {
+        if (o1 == null || o2 == null || o3 == null) {
+            throw new NullPointerException();
+        }
     }
-  }
 
-
-
-  /**
-   * Throws a {@code NullPointerException} if any of the provided arguments are
-   * {@code null}.
-   *
-   * @param o1
-   *          The first object to test.
-   * @param o2
-   *          The second object to test.
-   * @param o3
-   *          The third object to test.
-   * @param o4
-   *          The fourth object to test.
-   * @throws NullPointerException
-   *           If any of the provided arguments are {@code null}.
-   */
-  public static void ensureNotNull(final Object o1, final Object o2,
-      final Object o3, final Object o4)
-  {
-    if (o1 == null || o2 == null || o3 == null || o4 == null)
-    {
-      throw new NullPointerException();
+    /**
+     * Throws a {@code NullPointerException} if any of the provided arguments
+     * are {@code null}.
+     *
+     * @param o1
+     *            The first object to test.
+     * @param o2
+     *            The second object to test.
+     * @param o3
+     *            The third object to test.
+     * @param o4
+     *            The fourth object to test.
+     * @throws NullPointerException
+     *             If any of the provided arguments are {@code null}.
+     */
+    public static void ensureNotNull(final Object o1, final Object o2, final Object o3,
+            final Object o4) {
+        if (o1 == null || o2 == null || o3 == null || o4 == null) {
+            throw new NullPointerException();
+        }
     }
-  }
 
-
-
-  /**
-   * Throws a {@code NullPointerException} if any of the provided arguments are
-   * {@code null}.
-   *
-   * @param o1
-   *          The first object to test.
-   * @param o2
-   *          The second object to test.
-   * @param o3
-   *          The third object to test.
-   * @param o4
-   *          The fourth object to test.
-   * @param o5
-   *          The fifth object to test.
-   * @throws NullPointerException
-   *           If any of the provided arguments are {@code null}.
-   */
-  public static void ensureNotNull(final Object o1, final Object o2,
-      final Object o3, final Object o4, final Object o5)
-  {
-    if (o1 == null || o2 == null || o3 == null || o4 == null || o5 == null)
-    {
-      throw new NullPointerException();
+    /**
+     * Throws a {@code NullPointerException} if any of the provided arguments
+     * are {@code null}.
+     *
+     * @param o1
+     *            The first object to test.
+     * @param o2
+     *            The second object to test.
+     * @param o3
+     *            The third object to test.
+     * @param o4
+     *            The fourth object to test.
+     * @param o5
+     *            The fifth object to test.
+     * @throws NullPointerException
+     *             If any of the provided arguments are {@code null}.
+     */
+    public static void ensureNotNull(final Object o1, final Object o2, final Object o3,
+            final Object o4, final Object o5) {
+        if (o1 == null || o2 == null || o3 == null || o4 == null || o5 == null) {
+            throw new NullPointerException();
+        }
     }
-  }
 
-
-
-  /**
-   * Throws a {@code NullPointerException} if the provided argument is {@code
-   * null}. This method returns a reference to its single parameter so that it
-   * can be easily used in constructors.
-   *
-   * @param <T>
-   *          The type of {@code o1}.
-   * @param o1
-   *          The object to test.
-   * @return A reference to {@code o1}.
-   * @throws NullPointerException
-   *           If the provided argument is {@code null}.
-   */
-  public static <T> T ensureNotNull(final T o1)
-  {
-    if (o1 == null)
-    {
-      throw new NullPointerException();
+    /**
+     * Throws a {@code NullPointerException} if the provided argument is
+     * {@code null}. This method returns a reference to its single parameter so
+     * that it can be easily used in constructors.
+     *
+     * @param <T>
+     *            The type of {@code o1}.
+     * @param o1
+     *            The object to test.
+     * @return A reference to {@code o1}.
+     * @throws NullPointerException
+     *             If the provided argument is {@code null}.
+     */
+    public static <T> T ensureNotNull(final T o1) {
+        if (o1 == null) {
+            throw new NullPointerException();
+        }
+        return o1;
     }
-    return o1;
-  }
 
-
-
-  /**
-   * Throws an {@code IllegalArgumentException} if the provided condition is
-   * {@code false}.
-   *
-   * @param condition
-   *          The condition, which must be {@code true} to avoid an exception.
-   * @param message
-   *          The error message to include in the exception if it is thrown.
-   * @throws IllegalArgumentException
-   *           If {@code condition} was {@code false}.
-   */
-  public static void ensureTrue(final boolean condition, final String message)
-  {
-    if (!condition)
-    {
-      throw new IllegalArgumentException(message);
+    /**
+     * Throws an {@code IllegalArgumentException} if the provided condition is
+     * {@code false}.
+     *
+     * @param condition
+     *            The condition, which must be {@code true} to avoid an
+     *            exception.
+     * @param message
+     *            The error message to include in the exception if it is thrown.
+     * @throws IllegalArgumentException
+     *             If {@code condition} was {@code false}.
+     */
+    public static void ensureTrue(final boolean condition, final String message) {
+        if (!condition) {
+            throw new IllegalArgumentException(message);
+        }
     }
-  }
 
-
-
-  // Prevent instantiation.
-  private Validator()
-  {
-    // No implementation required.
-  }
+    // Prevent instantiation.
+    private Validator() {
+        // No implementation required.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/package-info.java
index 41d8e38..8626357 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package com.forgerock.opendj.util;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
index c37cbbc..3063245 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
 import java.io.InputStream;
 import java.io.OutputStream;
 
@@ -39,8 +36,6 @@
 
 import com.forgerock.opendj.util.ByteSequenceOutputStream;
 
-
-
 /**
  * This class contains various static factory methods for creating ASN.1 readers
  * and writers.
@@ -48,179 +43,142 @@
  * @see ASN1Reader
  * @see ASN1Writer
  */
-public final class ASN1
-{
+public final class ASN1 {
 
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte array and having
-   * an unlimited maximum BER element size.
-   *
-   * @param array
-   *          The byte array to use.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final byte[] array)
-  {
-    return getReader(array, 0);
-  }
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte array and
+     * having an unlimited maximum BER element size.
+     *
+     * @param array
+     *            The byte array to use.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final byte[] array) {
+        return getReader(array, 0);
+    }
 
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte array and
+     * having a user defined maximum BER element size.
+     *
+     * @param array
+     *            The byte array to use.
+     * @param maxElementSize
+     *            The maximum BER element size, or {@code 0} to indicate that
+     *            there is no limit.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final byte[] array, final int maxElementSize) {
+        return getReader(ByteString.wrap(array), maxElementSize);
+    }
 
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte sequence and
+     * having an unlimited maximum BER element size.
+     *
+     * @param sequence
+     *            The byte sequence to use.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final ByteSequence sequence) {
+        return getReader(sequence, 0);
+    }
 
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte array and having
-   * a user defined maximum BER element size.
-   *
-   * @param array
-   *          The byte array to use.
-   * @param maxElementSize
-   *          The maximum BER element size, or {@code 0} to indicate that there
-   *          is no limit.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final byte[] array,
-      final int maxElementSize)
-  {
-    return getReader(ByteString.wrap(array), maxElementSize);
-  }
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte sequence and
+     * having a user defined maximum BER element size.
+     *
+     * @param sequence
+     *            The byte sequence to use.
+     * @param maxElementSize
+     *            The maximum BER element size, or {@code 0} to indicate that
+     *            there is no limit.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final ByteSequence sequence, final int maxElementSize) {
+        return new ASN1ByteSequenceReader(sequence.asReader(), maxElementSize);
+    }
 
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte sequence reader
+     * and having an unlimited maximum BER element size.
+     *
+     * @param reader
+     *            The byte sequence reader to use.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final ByteSequenceReader reader) {
+        return getReader(reader, 0);
+    }
 
+    /**
+     * Returns an ASN.1 reader whose source is the provided byte sequence reader
+     * and having a user defined maximum BER element size.
+     *
+     * @param reader
+     *            The byte sequence reader to use.
+     * @param maxElementSize
+     *            The maximum BER element size, or {@code 0} to indicate that
+     *            there is no limit.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final ByteSequenceReader reader, final int maxElementSize) {
+        return new ASN1ByteSequenceReader(reader, maxElementSize);
+    }
 
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte sequence and
-   * having an unlimited maximum BER element size.
-   *
-   * @param sequence
-   *          The byte sequence to use.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final ByteSequence sequence)
-  {
-    return getReader(sequence, 0);
-  }
+    /**
+     * Returns an ASN.1 reader whose source is the provided input stream and
+     * having an unlimited maximum BER element size.
+     *
+     * @param stream
+     *            The input stream to use.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final InputStream stream) {
+        return getReader(stream, 0);
+    }
 
+    /**
+     * Returns an ASN.1 reader whose source is the provided input stream and
+     * having a user defined maximum BER element size.
+     *
+     * @param stream
+     *            The input stream to use.
+     * @param maxElementSize
+     *            The maximum BER element size, or {@code 0} to indicate that
+     *            there is no limit.
+     * @return The new ASN.1 reader.
+     */
+    public static ASN1Reader getReader(final InputStream stream, final int maxElementSize) {
+        return new ASN1InputStreamReader(stream, maxElementSize);
+    }
 
+    /**
+     * Returns an ASN.1 writer whose destination is the provided byte string
+     * builder.
+     *
+     * @param builder
+     *            The byte string builder to use.
+     * @return The new ASN.1 writer.
+     */
+    public static ASN1Writer getWriter(final ByteStringBuilder builder) {
+        final ByteSequenceOutputStream outputStream = new ByteSequenceOutputStream(builder);
+        return getWriter(outputStream);
+    }
 
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte sequence and
-   * having a user defined maximum BER element size.
-   *
-   * @param sequence
-   *          The byte sequence to use.
-   * @param maxElementSize
-   *          The maximum BER element size, or {@code 0} to indicate that there
-   *          is no limit.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final ByteSequence sequence,
-      final int maxElementSize)
-  {
-    return new ASN1ByteSequenceReader(sequence.asReader(), maxElementSize);
-  }
+    /**
+     * Returns an ASN.1 writer whose destination is the provided output stream.
+     *
+     * @param stream
+     *            The output stream to use.
+     * @return The new ASN.1 writer.
+     */
+    public static ASN1Writer getWriter(final OutputStream stream) {
+        return new ASN1OutputStreamWriter(stream);
+    }
 
-
-
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte sequence reader
-   * and having an unlimited maximum BER element size.
-   *
-   * @param reader
-   *          The byte sequence reader to use.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final ByteSequenceReader reader)
-  {
-    return getReader(reader, 0);
-  }
-
-
-
-  /**
-   * Returns an ASN.1 reader whose source is the provided byte sequence reader
-   * and having a user defined maximum BER element size.
-   *
-   * @param reader
-   *          The byte sequence reader to use.
-   * @param maxElementSize
-   *          The maximum BER element size, or {@code 0} to indicate that there
-   *          is no limit.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final ByteSequenceReader reader,
-      final int maxElementSize)
-  {
-    return new ASN1ByteSequenceReader(reader, maxElementSize);
-  }
-
-
-
-  /**
-   * Returns an ASN.1 reader whose source is the provided input stream and
-   * having an unlimited maximum BER element size.
-   *
-   * @param stream
-   *          The input stream to use.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final InputStream stream)
-  {
-    return getReader(stream, 0);
-  }
-
-
-
-  /**
-   * Returns an ASN.1 reader whose source is the provided input stream and
-   * having a user defined maximum BER element size.
-   *
-   * @param stream
-   *          The input stream to use.
-   * @param maxElementSize
-   *          The maximum BER element size, or {@code 0} to indicate that there
-   *          is no limit.
-   * @return The new ASN.1 reader.
-   */
-  public static ASN1Reader getReader(final InputStream stream,
-      final int maxElementSize)
-  {
-    return new ASN1InputStreamReader(stream, maxElementSize);
-  }
-
-
-
-  /**
-   * Returns an ASN.1 writer whose destination is the provided byte string
-   * builder.
-   *
-   * @param builder
-   *          The byte string builder to use.
-   * @return The new ASN.1 writer.
-   */
-  public static ASN1Writer getWriter(final ByteStringBuilder builder)
-  {
-    final ByteSequenceOutputStream outputStream = new ByteSequenceOutputStream(
-        builder);
-    return getWriter(outputStream);
-  }
-
-
-
-  /**
-   * Returns an ASN.1 writer whose destination is the provided output stream.
-   *
-   * @param stream
-   *          The output stream to use.
-   * @return The new ASN.1 writer.
-   */
-  public static ASN1Writer getWriter(final OutputStream stream)
-  {
-    return new ASN1OutputStreamWriter(stream);
-  }
-
-
-
-  // Prevent instantiation.
-  private ASN1()
-  {
-    // Nothing to do.
-  }
+    // Prevent instantiation.
+    private ASN1() {
+        // Nothing to do.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java
index b02393c..6eeb6bd 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
 import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_TYPE;
 import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_VALUE_BYTES;
@@ -47,521 +44,409 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An ASN.1 reader that reads from a {@link ByteSequenceReader}.
  */
-final class ASN1ByteSequenceReader extends AbstractASN1Reader implements
-    ASN1Reader
-{
+final class ASN1ByteSequenceReader extends AbstractASN1Reader implements ASN1Reader {
 
-  private int state = ELEMENT_READ_STATE_NEED_TYPE;
+    private int state = ELEMENT_READ_STATE_NEED_TYPE;
 
-  private byte peekType = 0;
+    private byte peekType = 0;
 
-  private int peekLength = -1;
+    private int peekLength = -1;
 
-  private final int maxElementSize;
+    private final int maxElementSize;
 
-  private ByteSequenceReader reader;
+    private ByteSequenceReader reader;
 
-  private final LinkedList<ByteSequenceReader> readerStack;
+    private final LinkedList<ByteSequenceReader> readerStack;
 
-
-
-  /**
-   * Creates a new ASN1 reader whose source is the provided byte sequence reader
-   * and having a user defined maximum BER element size.
-   *
-   * @param reader
-   *          The byte sequence reader to be read.
-   * @param maxElementSize
-   *          The maximum BER element size, or <code>0</code> to indicate that
-   *          there is no limit.
-   */
-  ASN1ByteSequenceReader(final ByteSequenceReader reader,
-      final int maxElementSize)
-  {
-    this.reader = reader;
-    this.readerStack = new LinkedList<ByteSequenceReader>();
-    this.maxElementSize = maxElementSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close() throws IOException
-  {
-    readerStack.clear();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean elementAvailable() throws IOException
-  {
-    if ((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false))
-    {
-      return false;
-    }
-    if ((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
-        && !needFirstLengthByteState(false))
-    {
-      return false;
+    /**
+     * Creates a new ASN1 reader whose source is the provided byte sequence
+     * reader and having a user defined maximum BER element size.
+     *
+     * @param reader
+     *            The byte sequence reader to be read.
+     * @param maxElementSize
+     *            The maximum BER element size, or <code>0</code> to indicate
+     *            that there is no limit.
+     */
+    ASN1ByteSequenceReader(final ByteSequenceReader reader, final int maxElementSize) {
+        this.reader = reader;
+        this.readerStack = new LinkedList<ByteSequenceReader>();
+        this.maxElementSize = maxElementSize;
     }
 
-    return peekLength <= reader.remaining();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasNextElement() throws IOException
-  {
-    return (state != ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(false);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int peekLength() throws IOException
-  {
-    peekType();
-
-    if (state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
-    {
-      needFirstLengthByteState(true);
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        readerStack.clear();
     }
 
-    return peekLength;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean elementAvailable() throws IOException {
+        if ((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false)) {
+            return false;
+        }
+        if ((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
+                && !needFirstLengthByteState(false)) {
+            return false;
+        }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte peekType() throws IOException
-  {
-    if (state == ELEMENT_READ_STATE_NEED_TYPE)
-    {
-      // Read just the type.
-      if (reader.remaining() <= 0)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-      final int type = reader.get();
-
-      peekType = (byte) type;
-      state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+        return peekLength <= reader.remaining();
     }
 
-    return peekType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean readBoolean() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength != 1)
-    {
-      final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasNextElement() throws IOException {
+        return (state != ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(false);
     }
 
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_BOOLEAN_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-    final int readByte = reader.get();
+    /**
+     * {@inheritDoc}
+     */
+    public int peekLength() throws IOException {
+        peekType();
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return readByte != 0x00;
-  }
+        if (state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE) {
+            needFirstLengthByteState(true);
+        }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSequence() throws IOException
-  {
-    if (readerStack.isEmpty())
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED
-          .get();
-      throw new IllegalStateException(message.toString());
+        return peekLength;
     }
 
-    if ((reader.remaining() > 0)
-        && StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-    {
-      StaticUtils.DEBUG_LOG.fine("Ignoring " + reader.remaining()
-          + " unused trailing bytes in " + "ASN.1 SEQUENCE");
+    /**
+     * {@inheritDoc}
+     */
+    public byte peekType() throws IOException {
+        if (state == ELEMENT_READ_STATE_NEED_TYPE) {
+            // Read just the type.
+            if (reader.remaining() <= 0) {
+                final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+            final int type = reader.get();
+
+            peekType = (byte) type;
+            state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+        }
+
+        return peekType;
     }
 
-    reader = readerStack.removeFirst();
+    /**
+     * {@inheritDoc}
+     */
+    public boolean readBoolean() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
+        if (peekLength != 1) {
+            final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readEndSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int readEnumerated() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 4))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    // From an implementation point of view, an enumerated value is
-    // equivalent to an integer.
-    return (int) readInteger();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public long readInteger() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 8))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-    if (peekLength > 4)
-    {
-      long longValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message = ERR_ASN1_BOOLEAN_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
         final int readByte = reader.get();
-        if ((i == 0) && (readByte < 0))
-        {
-          longValue = 0xFFFFFFFFFFFFFFFFL;
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return readByte != 0x00;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSequence() throws IOException {
+        if (readerStack.isEmpty()) {
+            final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get();
+            throw new IllegalStateException(message.toString());
         }
-        longValue = (longValue << 8) | (readByte & 0xFF);
-      }
 
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return longValue;
-    }
-    else
-    {
-      int intValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
-        final int readByte = reader.get();
-        if ((i == 0) && (readByte < 0))
-        {
-          intValue = 0xFFFFFFFF;
+        if ((reader.remaining() > 0) && StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+            StaticUtils.DEBUG_LOG.fine("Ignoring " + reader.remaining()
+                    + " unused trailing bytes in " + "ASN.1 SEQUENCE");
         }
-        intValue = (intValue << 8) | (readByte & 0xFF);
-      }
 
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return intValue;
-    }
-  }
+        reader = readerStack.removeFirst();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readNull() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    // Make sure that the decoded length is exactly zero byte.
-    if (peekLength != 0)
-    {
-      final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
     }
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString readOctetString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readEndSequence();
     }
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return reader.getByteString(peekLength);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int readEnumerated() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder readOctetString(final ByteStringBuilder builder)
-      throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    // Copy the value.
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-    builder.append(reader, peekLength);
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return builder;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String readOctetStringAsString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return reader.getString(peekLength);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSequence() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_SET_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    final ByteSequenceReader subByteString = reader.getByteSequence(peekLength)
-        .asReader();
-    readerStack.addFirst(reader);
-    reader = subByteString;
-
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readStartSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Reader skipElement() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (reader.remaining() < peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_SKIP_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    reader.skip(peekLength);
-    return this;
-  }
-
-
-
-  /**
-   * Internal helper method reading the first length bytes and transition to the
-   * next state if successful.
-   *
-   * @param throwEofException
-   *          <code>true</code> to throw an exception when the end of the
-   *          sequence is encountered.
-   * @return <code>true</code> if the length bytes was successfully read
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  private boolean needFirstLengthByteState(final boolean throwEofException)
-      throws IOException
-  {
-    if (reader.remaining() <= 0)
-    {
-      if (throwEofException)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-      return false;
-    }
-    int readByte = reader.get();
-    peekLength = (readByte & 0x7F);
-    if (peekLength != readByte)
-    {
-      int lengthBytesNeeded = peekLength;
-      if (lengthBytesNeeded > 4)
-      {
-        final LocalizableMessage message = ERR_ASN1_INVALID_NUM_LENGTH_BYTES
-            .get(lengthBytesNeeded);
-        throw DecodeException.fatalError(message);
-      }
-
-      peekLength = 0x00;
-      if (reader.remaining() < lengthBytesNeeded)
-      {
-        if (throwEofException)
-        {
-          final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTES
-              .get(lengthBytesNeeded);
-          throw DecodeException.fatalError(message);
+        if ((peekLength < 1) || (peekLength > 4)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
         }
-        return false;
-      }
 
-      while (lengthBytesNeeded > 0)
-      {
-        readByte = reader.get();
-        peekLength = (peekLength << 8) | (readByte & 0xFF);
-        lengthBytesNeeded--;
-      }
+        // From an implementation point of view, an enumerated value is
+        // equivalent to an integer.
+        return (int) readInteger();
     }
 
-    // Make sure that the element is not larger than the maximum allowed
-    // message size.
-    if ((maxElementSize > 0) && (peekLength > maxElementSize))
-    {
-      final LocalizableMessage message = ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
-          .get(peekLength, maxElementSize);
-      throw DecodeException.fatalError(message);
+    /**
+     * {@inheritDoc}
+     */
+    public long readInteger() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if ((peekLength < 1) || (peekLength > 8)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+        if (peekLength > 4) {
+            long longValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = reader.get();
+                if ((i == 0) && (readByte < 0)) {
+                    longValue = 0xFFFFFFFFFFFFFFFFL;
+                }
+                longValue = (longValue << 8) | (readByte & 0xFF);
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return longValue;
+        } else {
+            int intValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = reader.get();
+                if ((i == 0) && (readByte < 0)) {
+                    intValue = 0xFFFFFFFF;
+                }
+                intValue = (intValue << 8) | (readByte & 0xFF);
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return intValue;
+        }
     }
-    state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
-    return true;
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void readNull() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
+        // Make sure that the decoded length is exactly zero byte.
+        if (peekLength != 0) {
+            final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
 
-  /**
-   * Internal helper method reading the ASN.1 type byte and transition to the
-   * next state if successful.
-   *
-   * @param throwEofException
-   *          <code>true</code> to throw an exception when the end of the
-   *          sequence is encountered.
-   * @return <code>true</code> if the type byte was successfully read
-   * @throws IOException
-   *           If an error occurs while trying to decode an ASN1 element.
-   */
-  private boolean needTypeState(final boolean throwEofException)
-      throws IOException
-  {
-    // Read just the type.
-    if (reader.remaining() <= 0)
-    {
-      if (throwEofException)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-      return false;
+        state = ELEMENT_READ_STATE_NEED_TYPE;
     }
-    final int type = reader.get();
 
-    peekType = (byte) type;
-    state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString readOctetString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message =
+                    ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return reader.getByteString(peekLength);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        // Copy the value.
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message =
+                    ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+        builder.append(reader, peekLength);
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return builder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String readOctetStringAsString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message =
+                    ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return reader.getString(peekLength);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSequence() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message =
+                    ERR_ASN1_SEQUENCE_SET_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        final ByteSequenceReader subByteString = reader.getByteSequence(peekLength).asReader();
+        readerStack.addFirst(reader);
+        reader = subByteString;
+
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readStartSequence();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Reader skipElement() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (reader.remaining() < peekLength) {
+            final LocalizableMessage message = ERR_ASN1_SKIP_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        reader.skip(peekLength);
+        return this;
+    }
+
+    /**
+     * Internal helper method reading the first length bytes and transition to
+     * the next state if successful.
+     *
+     * @param throwEofException
+     *            <code>true</code> to throw an exception when the end of the
+     *            sequence is encountered.
+     * @return <code>true</code> if the length bytes was successfully read
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    private boolean needFirstLengthByteState(final boolean throwEofException) throws IOException {
+        if (reader.remaining() <= 0) {
+            if (throwEofException) {
+                final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+            return false;
+        }
+        int readByte = reader.get();
+        peekLength = (readByte & 0x7F);
+        if (peekLength != readByte) {
+            int lengthBytesNeeded = peekLength;
+            if (lengthBytesNeeded > 4) {
+                final LocalizableMessage message =
+                        ERR_ASN1_INVALID_NUM_LENGTH_BYTES.get(lengthBytesNeeded);
+                throw DecodeException.fatalError(message);
+            }
+
+            peekLength = 0x00;
+            if (reader.remaining() < lengthBytesNeeded) {
+                if (throwEofException) {
+                    final LocalizableMessage message =
+                            ERR_ASN1_TRUNCATED_LENGTH_BYTES.get(lengthBytesNeeded);
+                    throw DecodeException.fatalError(message);
+                }
+                return false;
+            }
+
+            while (lengthBytesNeeded > 0) {
+                readByte = reader.get();
+                peekLength = (peekLength << 8) | (readByte & 0xFF);
+                lengthBytesNeeded--;
+            }
+        }
+
+        // Make sure that the element is not larger than the maximum allowed
+        // message size.
+        if ((maxElementSize > 0) && (peekLength > maxElementSize)) {
+            final LocalizableMessage message =
+                    ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
+                            .get(peekLength, maxElementSize);
+            throw DecodeException.fatalError(message);
+        }
+        state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
+        return true;
+    }
+
+    /**
+     * Internal helper method reading the ASN.1 type byte and transition to the
+     * next state if successful.
+     *
+     * @param throwEofException
+     *            <code>true</code> to throw an exception when the end of the
+     *            sequence is encountered.
+     * @return <code>true</code> if the type byte was successfully read
+     * @throws IOException
+     *             If an error occurs while trying to decode an ASN1 element.
+     */
+    private boolean needTypeState(final boolean throwEofException) throws IOException {
+        // Read just the type.
+        if (reader.remaining() <= 0) {
+            if (throwEofException) {
+                final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+            return false;
+        }
+        final int type = reader.get();
+
+        peekType = (byte) type;
+        state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Constants.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Constants.java
index 74f22c1..41d4967 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Constants.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Constants.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,144 +25,138 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 /**
  * This class defines a number of constants that may be used when interacting
  * with ASN.1 elements.
  */
-public final class ASN1Constants
-{
+public final class ASN1Constants {
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be the BER type for a new element.
-   */
-  static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be the BER type for a new element.
+     */
+    static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be the first byte for the element length.
-   */
-  static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be the first byte for the element length.
+     */
+    static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be additional bytes of a multi-byte length.
-   */
-  static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be additional bytes of a multi-byte length.
+     */
+    static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
 
-  /**
-   * The ASN.1 element decoding state that indicates that the next byte read
-   * should be applied to the value of the element.
-   */
-  static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
+    /**
+     * The ASN.1 element decoding state that indicates that the next byte read
+     * should be applied to the value of the element.
+     */
+    static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
 
-  /**
-   * The BER type that is assigned to the universal Boolean element.
-   */
-  public static final byte UNIVERSAL_BOOLEAN_TYPE = 0x01;
+    /**
+     * The BER type that is assigned to the universal Boolean element.
+     */
+    public static final byte UNIVERSAL_BOOLEAN_TYPE = 0x01;
 
-  /**
-   * The BER type that is assigned to the universal integer type.
-   */
-  public static final byte UNIVERSAL_INTEGER_TYPE = 0x02;
+    /**
+     * The BER type that is assigned to the universal integer type.
+     */
+    public static final byte UNIVERSAL_INTEGER_TYPE = 0x02;
 
-  /**
-   * The BER type that is assigned to the universal octet string type.
-   */
-  public static final byte UNIVERSAL_OCTET_STRING_TYPE = 0x04;
+    /**
+     * The BER type that is assigned to the universal octet string type.
+     */
+    public static final byte UNIVERSAL_OCTET_STRING_TYPE = 0x04;
 
-  /**
-   * The BER type that is assigned to the universal null type.
-   */
-  public static final byte UNIVERSAL_NULL_TYPE = 0x05;
+    /**
+     * The BER type that is assigned to the universal null type.
+     */
+    public static final byte UNIVERSAL_NULL_TYPE = 0x05;
 
-  /**
-   * The BER type that is assigned to the universal enumerated type.
-   */
-  public static final byte UNIVERSAL_ENUMERATED_TYPE = 0x0A;
+    /**
+     * The BER type that is assigned to the universal enumerated type.
+     */
+    public static final byte UNIVERSAL_ENUMERATED_TYPE = 0x0A;
 
-  /**
-   * The BER type that is assigned to the universal sequence type.
-   */
-  public static final byte UNIVERSAL_SEQUENCE_TYPE = 0x30;
+    /**
+     * The BER type that is assigned to the universal sequence type.
+     */
+    public static final byte UNIVERSAL_SEQUENCE_TYPE = 0x30;
 
-  /**
-   * The BER type that is assigned to the universal set type.
-   */
-  public static final byte UNIVERSAL_SET_TYPE = 0x31;
+    /**
+     * The BER type that is assigned to the universal set type.
+     */
+    public static final byte UNIVERSAL_SET_TYPE = 0x31;
 
-  /**
-   * The byte array that will be used for ASN.1 elements with no value.
-   */
-  static final byte[] NO_VALUE = new byte[0];
+    /**
+     * The byte array that will be used for ASN.1 elements with no value.
+     */
+    static final byte[] NO_VALUE = new byte[0];
 
-  /**
-   * The bitmask that can be ANDed with the BER type to zero out all bits except
-   * those used in the class.
-   */
-  static final byte TYPE_MASK_ALL_BUT_CLASS = (byte) 0xC0;
+    /**
+     * The bitmask that can be ANDed with the BER type to zero out all bits
+     * except those used in the class.
+     */
+    static final byte TYPE_MASK_ALL_BUT_CLASS = (byte) 0xC0;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is in the universal class.
-   */
-  static final byte TYPE_MASK_UNIVERSAL = 0x00;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is in the universal class.
+     */
+    static final byte TYPE_MASK_UNIVERSAL = 0x00;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is in the application-specific class.
-   */
-  static final byte TYPE_MASK_APPLICATION = 0x40;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is in the application-specific class.
+     */
+    static final byte TYPE_MASK_APPLICATION = 0x40;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is in the context-specific class.
-   */
-  static final byte TYPE_MASK_CONTEXT = (byte) 0x80;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is in the context-specific class.
+     */
+    static final byte TYPE_MASK_CONTEXT = (byte) 0x80;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is in the private class.
-   */
-  static final byte TYPE_MASK_PRIVATE = (byte) 0xC0;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is in the private class.
+     */
+    static final byte TYPE_MASK_PRIVATE = (byte) 0xC0;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to zero out all bits except
-   * the primitive/constructed bit.
-   */
-  static final byte TYPE_MASK_ALL_BUT_PC = (byte) 0x20;
+    /**
+     * The bitmask that can be ANDed with the BER type to zero out all bits
+     * except the primitive/constructed bit.
+     */
+    static final byte TYPE_MASK_ALL_BUT_PC = (byte) 0x20;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is a primitive.
-   */
-  static final byte TYPE_MASK_PRIMITIVE = 0x00;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is a primitive.
+     */
+    static final byte TYPE_MASK_PRIMITIVE = 0x00;
 
-  /**
-   * The bitmask that can be ANDed with the BER type to determine if the element
-   * is constructed.
-   */
-  static final byte TYPE_MASK_CONSTRUCTED = 0x20;
+    /**
+     * The bitmask that can be ANDed with the BER type to determine if the
+     * element is constructed.
+     */
+    static final byte TYPE_MASK_CONSTRUCTED = 0x20;
 
-  /**
-   * The byte array containing the pre-encoded ASN.1 encoding for a boolean
-   * value of "false".
-   */
-  public static final byte BOOLEAN_VALUE_FALSE = 0x00;
+    /**
+     * The byte array containing the pre-encoded ASN.1 encoding for a boolean
+     * value of "false".
+     */
+    public static final byte BOOLEAN_VALUE_FALSE = 0x00;
 
-  /**
-   * The byte array containing the pre-encoded ASN.1 encoding for a boolean
-   * value of "false".
-   */
-  public static final byte BOOLEAN_VALUE_TRUE = (byte) 0xFF;
+    /**
+     * The byte array containing the pre-encoded ASN.1 encoding for a boolean
+     * value of "false".
+     */
+    public static final byte BOOLEAN_VALUE_TRUE = (byte) 0xFF;
 
-
-
-  // Prevent instantiation.
-  private ASN1Constants()
-  {
-    // Nothing to do.
-  }
+    // Prevent instantiation.
+    private ASN1Constants() {
+        // Nothing to do.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java
index b98198e..b88c07f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1InputStreamReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,9 +27,10 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
-import static org.forgerock.opendj.asn1.ASN1Constants.*;
+import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_TYPE;
+import static org.forgerock.opendj.asn1.ASN1Constants.ELEMENT_READ_STATE_NEED_VALUE_BYTES;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
@@ -46,739 +46,596 @@
 import com.forgerock.opendj.util.SizeLimitInputStream;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An ASN1Reader that reads from an input stream.
  */
-final class ASN1InputStreamReader extends AbstractASN1Reader implements
-    ASN1Reader
-{
-  private int state = ELEMENT_READ_STATE_NEED_TYPE;
+final class ASN1InputStreamReader extends AbstractASN1Reader implements ASN1Reader {
+    private int state = ELEMENT_READ_STATE_NEED_TYPE;
 
-  private byte peekType = 0;
+    private byte peekType = 0;
 
-  private int peekLength = -1;
+    private int peekLength = -1;
 
-  private int lengthBytesNeeded = 0;
+    private int lengthBytesNeeded = 0;
 
-  private final int maxElementSize;
+    private final int maxElementSize;
 
-  private InputStream in;
+    private InputStream in;
 
-  private final LinkedList<InputStream> streamStack;
+    private final LinkedList<InputStream> streamStack;
 
-  private byte[] buffer;
+    private byte[] buffer;
 
-
-
-  /**
-   * Creates a new ASN1 reader whose source is the provided input stream and
-   * having a user defined maximum BER element size.
-   *
-   * @param stream
-   *          The input stream to be read.
-   * @param maxElementSize
-   *          The maximum BER element size, or <code>0</code> to indicate that
-   *          there is no limit.
-   */
-  ASN1InputStreamReader(final InputStream stream, final int maxElementSize)
-  {
-    this.in = stream;
-    this.streamStack = new LinkedList<InputStream>();
-    this.buffer = new byte[512];
-    this.maxElementSize = maxElementSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close() throws IOException
-  {
-    // Calling close of SizeLimitInputStream should close the parent
-    // stream.
-    in.close();
-    streamStack.clear();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean elementAvailable() throws IOException
-  {
-    if ((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false, false))
-    {
-      return false;
-    }
-    if ((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
-        && !needFirstLengthByteState(false, false))
-    {
-      return false;
-    }
-    if ((state == ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
-        && !needAdditionalLengthBytesState(false, false))
-    {
-      return false;
+    /**
+     * Creates a new ASN1 reader whose source is the provided input stream and
+     * having a user defined maximum BER element size.
+     *
+     * @param stream
+     *            The input stream to be read.
+     * @param maxElementSize
+     *            The maximum BER element size, or <code>0</code> to indicate
+     *            that there is no limit.
+     */
+    ASN1InputStreamReader(final InputStream stream, final int maxElementSize) {
+        this.in = stream;
+        this.streamStack = new LinkedList<InputStream>();
+        this.buffer = new byte[512];
+        this.maxElementSize = maxElementSize;
     }
 
-    return peekLength <= in.available();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasNextElement() throws IOException
-  {
-    if (!streamStack.isEmpty())
-    {
-      // We are reading a sub sequence. Return true as long as we
-      // haven't exhausted the size limit for the sub sequence sub input
-      // stream.
-      final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
-      return (subSq.getSizeLimit() - subSq.getBytesRead() > 0);
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        // Calling close of SizeLimitInputStream should close the parent
+        // stream.
+        in.close();
+        streamStack.clear();
     }
 
-    return (state != ELEMENT_READ_STATE_NEED_TYPE)
-        || needTypeState(true, false);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int peekLength() throws IOException
-  {
-    peekType();
-
-    switch (state)
-    {
-    case ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE:
-      needFirstLengthByteState(true, true);
-      break;
-
-    case ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES:
-      needAdditionalLengthBytesState(true, true);
-    }
-
-    return peekLength;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte peekType() throws IOException
-  {
-    if (state == ELEMENT_READ_STATE_NEED_TYPE)
-    {
-      needTypeState(true, true);
-    }
-
-    return peekType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean readBoolean() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength != 1)
-    {
-      final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    final int readByte = in.read();
-    if (readByte == -1)
-    {
-      final LocalizableMessage message = ERR_ASN1_BOOLEAN_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType,
-          peekLength, String.valueOf(readByte != 0x00)));
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return readByte != 0x00;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSequence() throws IOException
-  {
-    if (streamStack.isEmpty())
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED
-          .get();
-      throw new IllegalStateException(message.toString());
-    }
-
-    // Ignore all unused trailing components.
-    final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
-    if (subSq.getSizeLimit() - subSq.getBytesRead() > 0)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-      {
-        StaticUtils.DEBUG_LOG.fine(String.format(
-            "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE", subSq
-                .getSizeLimit()
-                - subSq.getBytesRead()));
-      }
-
-      subSq.skip(subSq.getSizeLimit() - subSq.getBytesRead());
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
-    }
-
-    in = streamStack.removeFirst();
-
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readEndSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readEndSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int readEnumerated() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 4))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    // From an implementation point of view, an enumerated value is
-    // equivalent to an integer.
-    return (int) readInteger();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public long readInteger() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if ((peekLength < 1) || (peekLength > 8))
-    {
-      final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-
-    if (peekLength > 4)
-    {
-      long longValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
-        final int readByte = in.read();
-        if (readByte == -1)
-        {
-          final LocalizableMessage message = ERR_ASN1_INTEGER_TRUNCATED_VALUE
-              .get(peekLength);
-          throw DecodeException.fatalError(message);
+    /**
+     * {@inheritDoc}
+     */
+    public boolean elementAvailable() throws IOException {
+        if ((state == ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false, false)) {
+            return false;
         }
-        if ((i == 0) && (((byte) readByte) < 0))
-        {
-          longValue = 0xFFFFFFFFFFFFFFFFL;
+        if ((state == ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
+                && !needFirstLengthByteState(false, false)) {
+            return false;
         }
-        longValue = (longValue << 8) | (readByte & 0xFF);
-      }
-
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return longValue;
-    }
-    else
-    {
-      int intValue = 0;
-      for (int i = 0; i < peekLength; i++)
-      {
-        final int readByte = in.read();
-        if (readByte == -1)
-        {
-          final LocalizableMessage message = ERR_ASN1_INTEGER_TRUNCATED_VALUE
-              .get(peekLength);
-          throw DecodeException.fatalError(message);
+        if ((state == ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
+                && !needAdditionalLengthBytesState(false, false)) {
+            return false;
         }
-        if ((i == 0) && (((byte) readByte) < 0))
-        {
-          intValue = 0xFFFFFFFF;
+
+        return peekLength <= in.available();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasNextElement() throws IOException {
+        if (!streamStack.isEmpty()) {
+            // We are reading a sub sequence. Return true as long as we
+            // haven't exhausted the size limit for the sub sequence sub input
+            // stream.
+            final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
+            return (subSq.getSizeLimit() - subSq.getBytesRead() > 0);
         }
-        intValue = (intValue << 8) | (readByte & 0xFF);
-      }
 
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType,
-            peekLength, intValue));
-      }
-
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return intValue;
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readNull() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    // Make sure that the decoded length is exactly zero byte.
-    if (peekLength != 0)
-    {
-      final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
+        return (state != ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(true, false);
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 NULL(type=0x%x, length=%d)", peekType, peekLength));
-    }
+    /**
+     * {@inheritDoc}
+     */
+    public int peekLength() throws IOException {
+        peekType();
 
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
+        switch (state) {
+        case ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE:
+            needFirstLengthByteState(true, true);
+            break;
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString readOctetString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return ByteString.empty();
-    }
-
-    // Copy the value and construct the element to return.
-    final byte[] value = new byte[peekLength];
-    int bytesNeeded = peekLength;
-    int bytesRead;
-    while (bytesNeeded > 0)
-    {
-      bytesRead = in.read(value, peekLength - bytesNeeded, bytesNeeded);
-      if (bytesRead < 0)
-      {
-        final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-            .get(peekLength);
-        throw DecodeException.fatalError(message);
-      }
-
-      bytesNeeded -= bytesRead;
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG
-          .finest(String.format("READ ASN.1 OCTETSTRING(type=0x%x, length=%d)",
-              peekType, peekLength));
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return ByteString.wrap(value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder readOctetString(final ByteStringBuilder builder)
-      throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return builder;
-    }
-
-    // Copy the value and construct the element to return.
-    int bytesNeeded = peekLength;
-    int bytesRead;
-    while (bytesNeeded > 0)
-    {
-      bytesRead = builder.append(in, bytesNeeded);
-      if (bytesRead < 0)
-      {
-        final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-            .get(peekLength);
-        throw DecodeException.fatalError(message);
-      }
-      bytesNeeded -= bytesRead;
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG
-          .finest(String.format("READ ASN.1 OCTETSTRING(type=0x%x, length=%d)",
-              peekType, peekLength));
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return builder;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String readOctetStringAsString() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    if (peekLength == 0)
-    {
-      state = ELEMENT_READ_STATE_NEED_TYPE;
-      return "";
-    }
-
-    // Resize the temp buffer if needed
-    if (peekLength > buffer.length)
-    {
-      buffer = new byte[peekLength];
-    }
-
-    int bytesNeeded = peekLength;
-    int bytesRead;
-    while (bytesNeeded > 0)
-    {
-      bytesRead = in.read(buffer, peekLength - bytesNeeded, bytesNeeded);
-      if (bytesRead < 0)
-      {
-        final LocalizableMessage message = ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE
-            .get(peekLength);
-        throw DecodeException.fatalError(message);
-      }
-      bytesNeeded -= bytesRead;
-    }
-
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-
-    String str;
-    try
-    {
-      str = new String(buffer, 0, peekLength, "UTF-8");
-    }
-    catch (final Exception e)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        StaticUtils.DEBUG_LOG.warning("Unable to decode ASN.1 OCTETSTRING "
-            + "bytes as UTF-8 string: " + e.toString());
-      }
-
-      str = new String(buffer, 0, peekLength);
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType,
-          peekLength, str));
-    }
-
-    return str;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSequence() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    final SizeLimitInputStream subStream = new SizeLimitInputStream(in,
-        peekLength);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType,
-          peekLength));
-    }
-
-    streamStack.addFirst(in);
-    in = subStream;
-
-    // Reset the state
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSet() throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    readStartSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Reader skipElement() throws IOException
-  {
-    // Read the header if haven't done so already
-    peekLength();
-
-    final long bytesSkipped = in.skip(peekLength);
-    if (bytesSkipped != peekLength)
-    {
-      final LocalizableMessage message = ERR_ASN1_SKIP_TRUNCATED_VALUE
-          .get(peekLength);
-      throw DecodeException.fatalError(message);
-    }
-    state = ELEMENT_READ_STATE_NEED_TYPE;
-    return this;
-  }
-
-
-
-  /**
-   * Internal helper method reading the additional ASN.1 length bytes and
-   * transition to the next state if successful.
-   *
-   * @param isBlocking
-   *          <code>true</code> to block if the type byte is not available or
-   *          <code>false</code> to check for availability first.
-   * @param throwEofException
-   *          <code>true</code> to throw an exception when an EOF is encountered
-   *          or <code>false</code> to return false.
-   * @return <code>true</code> if the length bytes was successfully read.
-   * @throws IOException
-   *           If an error occurs while reading from the stream.
-   */
-  private boolean needAdditionalLengthBytesState(final boolean isBlocking,
-      final boolean throwEofException) throws IOException
-  {
-    if (!isBlocking && (in.available() < lengthBytesNeeded))
-    {
-      return false;
-    }
-
-    int readByte;
-    while (lengthBytesNeeded > 0)
-    {
-      readByte = in.read();
-      if (readByte == -1)
-      {
-        state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
-        if (throwEofException)
-        {
-          final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTES
-              .get(lengthBytesNeeded);
-          throw DecodeException.fatalError(message);
+        case ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES:
+            needAdditionalLengthBytesState(true, true);
         }
-        return false;
-      }
-      peekLength = (peekLength << 8) | (readByte & 0xFF);
-      lengthBytesNeeded--;
+
+        return peekLength;
     }
 
-    // Make sure that the element is not larger than the maximum allowed
-    // message size.
-    if ((maxElementSize > 0) && (peekLength > maxElementSize))
-    {
-      final LocalizableMessage message = ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
-          .get(peekLength, maxElementSize);
-      throw DecodeException.fatalError(message);
-    }
-    state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public byte peekType() throws IOException {
+        if (state == ELEMENT_READ_STATE_NEED_TYPE) {
+            needTypeState(true, true);
+        }
 
-
-
-  /**
-   * Internal helper method reading the first length bytes and transition to the
-   * next state if successful.
-   *
-   * @param isBlocking
-   *          <code>true</code> to block if the type byte is not available or
-   *          <code>false</code> to check for availability first.
-   * @param throwEofException
-   *          <code>true</code> to throw an exception when an EOF is encountered
-   *          or <code>false</code> to return false.
-   * @return <code>true</code> if the length bytes was successfully read
-   * @throws IOException
-   *           If an error occurs while reading from the stream.
-   */
-  private boolean needFirstLengthByteState(final boolean isBlocking,
-      final boolean throwEofException) throws IOException
-  {
-    if (!isBlocking && (in.available() <= 0))
-    {
-      return false;
+        return peekType;
     }
 
-    int readByte = in.read();
-    if (readByte == -1)
-    {
-      if (throwEofException)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-      return false;
-    }
-    peekLength = (readByte & 0x7F);
-    if (peekLength != readByte)
-    {
-      lengthBytesNeeded = peekLength;
-      if (lengthBytesNeeded > 4)
-      {
-        final LocalizableMessage message = ERR_ASN1_INVALID_NUM_LENGTH_BYTES
-            .get(lengthBytesNeeded);
-        throw DecodeException.fatalError(message);
-      }
-      peekLength = 0x00;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean readBoolean() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
 
-      if (!isBlocking && (in.available() < lengthBytesNeeded))
-      {
-        state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
-        return false;
-      }
-
-      while (lengthBytesNeeded > 0)
-      {
-        readByte = in.read();
-        if (readByte == -1)
-        {
-          state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
-          if (throwEofException)
-          {
-            final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTES
-                .get(lengthBytesNeeded);
+        if (peekLength != 1) {
+            final LocalizableMessage message = ERR_ASN1_BOOLEAN_INVALID_LENGTH.get(peekLength);
             throw DecodeException.fatalError(message);
-          }
-          return false;
         }
-        peekLength = (peekLength << 8) | (readByte & 0xFF);
-        lengthBytesNeeded--;
-      }
+
+        final int readByte = in.read();
+        if (readByte == -1) {
+            final LocalizableMessage message = ERR_ASN1_BOOLEAN_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", peekType, peekLength,
+                    String.valueOf(readByte != 0x00)));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return readByte != 0x00;
     }
 
-    // Make sure that the element is not larger than the maximum allowed
-    // message size.
-    if ((maxElementSize > 0) && (peekLength > maxElementSize))
-    {
-      final LocalizableMessage message = ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
-          .get(peekLength, maxElementSize);
-      throw DecodeException.fatalError(message);
-    }
-    state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSequence() throws IOException {
+        if (streamStack.isEmpty()) {
+            final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get();
+            throw new IllegalStateException(message.toString());
+        }
 
+        // Ignore all unused trailing components.
+        final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
+        if (subSq.getSizeLimit() - subSq.getBytesRead() > 0) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                StaticUtils.DEBUG_LOG.fine(String.format(
+                        "Ignoring %d unused trailing bytes in ASN.1 SEQUENCE", subSq.getSizeLimit()
+                                - subSq.getBytesRead()));
+            }
 
+            subSq.skip(subSq.getSizeLimit() - subSq.getBytesRead());
+        }
 
-  /**
-   * Internal helper method reading the ASN.1 type byte and transition to the
-   * next state if successful.
-   *
-   * @param isBlocking
-   *          <code>true</code> to block if the type byte is not available or
-   *          <code>false</code> to check for availability first.
-   * @param throwEofException
-   *          <code>true</code> to throw an exception when an EOF is encountered
-   *          or <code>false</code> to return false.
-   * @return <code>true</code> if the type byte was successfully read
-   * @throws IOException
-   *           If an error occurs while reading from the stream.
-   */
-  private boolean needTypeState(final boolean isBlocking,
-      final boolean throwEofException) throws IOException
-  {
-    // Read just the type.
-    if (!isBlocking && (in.available() <= 0))
-    {
-      return false;
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 END SEQUENCE"));
+        }
+
+        in = streamStack.removeFirst();
+
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
     }
 
-    final int type = in.read();
-    if (type == -1)
-    {
-      if (throwEofException)
-      {
-        final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
-        throw DecodeException.fatalError(message);
-      }
-      return false;
+    /**
+     * {@inheritDoc}
+     */
+    public void readEndSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readEndSequence();
     }
 
-    peekType = (byte) type;
-    state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int readEnumerated() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if ((peekLength < 1) || (peekLength > 4)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        // From an implementation point of view, an enumerated value is
+        // equivalent to an integer.
+        return (int) readInteger();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long readInteger() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if ((peekLength < 1) || (peekLength > 8)) {
+            final LocalizableMessage message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        if (peekLength > 4) {
+            long longValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = in.read();
+                if (readByte == -1) {
+                    final LocalizableMessage message =
+                            ERR_ASN1_INTEGER_TRUNCATED_VALUE.get(peekLength);
+                    throw DecodeException.fatalError(message);
+                }
+                if ((i == 0) && (((byte) readByte) < 0)) {
+                    longValue = 0xFFFFFFFFFFFFFFFFL;
+                }
+                longValue = (longValue << 8) | (readByte & 0xFF);
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return longValue;
+        } else {
+            int intValue = 0;
+            for (int i = 0; i < peekLength; i++) {
+                final int readByte = in.read();
+                if (readByte == -1) {
+                    final LocalizableMessage message =
+                            ERR_ASN1_INTEGER_TRUNCATED_VALUE.get(peekLength);
+                    throw DecodeException.fatalError(message);
+                }
+                if ((i == 0) && (((byte) readByte) < 0)) {
+                    intValue = 0xFFFFFFFF;
+                }
+                intValue = (intValue << 8) | (readByte & 0xFF);
+            }
+
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "READ ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", peekType, peekLength,
+                        intValue));
+            }
+
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return intValue;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readNull() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        // Make sure that the decoded length is exactly zero byte.
+        if (peekLength != 0) {
+            final LocalizableMessage message = ERR_ASN1_NULL_INVALID_LENGTH.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("READ ASN.1 NULL(type=0x%x, length=%d)",
+                    peekType, peekLength));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString readOctetString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return ByteString.empty();
+        }
+
+        // Copy the value and construct the element to return.
+        final byte[] value = new byte[peekLength];
+        int bytesNeeded = peekLength;
+        int bytesRead;
+        while (bytesNeeded > 0) {
+            bytesRead = in.read(value, peekLength - bytesNeeded, bytesNeeded);
+            if (bytesRead < 0) {
+                final LocalizableMessage message =
+                        ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+                throw DecodeException.fatalError(message);
+            }
+
+            bytesNeeded -= bytesRead;
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return ByteString.wrap(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return builder;
+        }
+
+        // Copy the value and construct the element to return.
+        int bytesNeeded = peekLength;
+        int bytesRead;
+        while (bytesNeeded > 0) {
+            bytesRead = builder.append(in, bytesNeeded);
+            if (bytesRead < 0) {
+                final LocalizableMessage message =
+                        ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+                throw DecodeException.fatalError(message);
+            }
+            bytesNeeded -= bytesRead;
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return builder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String readOctetStringAsString() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        if (peekLength == 0) {
+            state = ELEMENT_READ_STATE_NEED_TYPE;
+            return "";
+        }
+
+        // Resize the temp buffer if needed
+        if (peekLength > buffer.length) {
+            buffer = new byte[peekLength];
+        }
+
+        int bytesNeeded = peekLength;
+        int bytesRead;
+        while (bytesNeeded > 0) {
+            bytesRead = in.read(buffer, peekLength - bytesNeeded, bytesNeeded);
+            if (bytesRead < 0) {
+                final LocalizableMessage message =
+                        ERR_ASN1_OCTET_STRING_TRUNCATED_VALUE.get(peekLength);
+                throw DecodeException.fatalError(message);
+            }
+            bytesNeeded -= bytesRead;
+        }
+
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+
+        String str;
+        try {
+            str = new String(buffer, 0, peekLength, "UTF-8");
+        } catch (final Exception e) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                StaticUtils.DEBUG_LOG.warning("Unable to decode ASN.1 OCTETSTRING "
+                        + "bytes as UTF-8 string: " + e.toString());
+            }
+
+            str = new String(buffer, 0, peekLength);
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 OCTETSTRING(type=0x%x, length=%d, value=%s)", peekType, peekLength,
+                    str));
+        }
+
+        return str;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSequence() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        final SizeLimitInputStream subStream = new SizeLimitInputStream(in, peekLength);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "READ ASN.1 START SEQUENCE(type=0x%x, length=%d)", peekType, peekLength));
+        }
+
+        streamStack.addFirst(in);
+        in = subStream;
+
+        // Reset the state
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSet() throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        readStartSequence();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Reader skipElement() throws IOException {
+        // Read the header if haven't done so already
+        peekLength();
+
+        final long bytesSkipped = in.skip(peekLength);
+        if (bytesSkipped != peekLength) {
+            final LocalizableMessage message = ERR_ASN1_SKIP_TRUNCATED_VALUE.get(peekLength);
+            throw DecodeException.fatalError(message);
+        }
+        state = ELEMENT_READ_STATE_NEED_TYPE;
+        return this;
+    }
+
+    /**
+     * Internal helper method reading the additional ASN.1 length bytes and
+     * transition to the next state if successful.
+     *
+     * @param isBlocking
+     *            <code>true</code> to block if the type byte is not available
+     *            or <code>false</code> to check for availability first.
+     * @param throwEofException
+     *            <code>true</code> to throw an exception when an EOF is
+     *            encountered or <code>false</code> to return false.
+     * @return <code>true</code> if the length bytes was successfully read.
+     * @throws IOException
+     *             If an error occurs while reading from the stream.
+     */
+    private boolean needAdditionalLengthBytesState(final boolean isBlocking,
+            final boolean throwEofException) throws IOException {
+        if (!isBlocking && (in.available() < lengthBytesNeeded)) {
+            return false;
+        }
+
+        int readByte;
+        while (lengthBytesNeeded > 0) {
+            readByte = in.read();
+            if (readByte == -1) {
+                state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+                if (throwEofException) {
+                    final LocalizableMessage message =
+                            ERR_ASN1_TRUNCATED_LENGTH_BYTES.get(lengthBytesNeeded);
+                    throw DecodeException.fatalError(message);
+                }
+                return false;
+            }
+            peekLength = (peekLength << 8) | (readByte & 0xFF);
+            lengthBytesNeeded--;
+        }
+
+        // Make sure that the element is not larger than the maximum allowed
+        // message size.
+        if ((maxElementSize > 0) && (peekLength > maxElementSize)) {
+            final LocalizableMessage message =
+                    ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
+                            .get(peekLength, maxElementSize);
+            throw DecodeException.fatalError(message);
+        }
+        state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
+        return true;
+    }
+
+    /**
+     * Internal helper method reading the first length bytes and transition to
+     * the next state if successful.
+     *
+     * @param isBlocking
+     *            <code>true</code> to block if the type byte is not available
+     *            or <code>false</code> to check for availability first.
+     * @param throwEofException
+     *            <code>true</code> to throw an exception when an EOF is
+     *            encountered or <code>false</code> to return false.
+     * @return <code>true</code> if the length bytes was successfully read
+     * @throws IOException
+     *             If an error occurs while reading from the stream.
+     */
+    private boolean needFirstLengthByteState(final boolean isBlocking,
+            final boolean throwEofException) throws IOException {
+        if (!isBlocking && (in.available() <= 0)) {
+            return false;
+        }
+
+        int readByte = in.read();
+        if (readByte == -1) {
+            if (throwEofException) {
+                final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+            return false;
+        }
+        peekLength = (readByte & 0x7F);
+        if (peekLength != readByte) {
+            lengthBytesNeeded = peekLength;
+            if (lengthBytesNeeded > 4) {
+                final LocalizableMessage message =
+                        ERR_ASN1_INVALID_NUM_LENGTH_BYTES.get(lengthBytesNeeded);
+                throw DecodeException.fatalError(message);
+            }
+            peekLength = 0x00;
+
+            if (!isBlocking && (in.available() < lengthBytesNeeded)) {
+                state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+                return false;
+            }
+
+            while (lengthBytesNeeded > 0) {
+                readByte = in.read();
+                if (readByte == -1) {
+                    state = ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES;
+                    if (throwEofException) {
+                        final LocalizableMessage message =
+                                ERR_ASN1_TRUNCATED_LENGTH_BYTES.get(lengthBytesNeeded);
+                        throw DecodeException.fatalError(message);
+                    }
+                    return false;
+                }
+                peekLength = (peekLength << 8) | (readByte & 0xFF);
+                lengthBytesNeeded--;
+            }
+        }
+
+        // Make sure that the element is not larger than the maximum allowed
+        // message size.
+        if ((maxElementSize > 0) && (peekLength > maxElementSize)) {
+            final LocalizableMessage message =
+                    ERR_LDAP_CLIENT_DECODE_MAX_REQUEST_SIZE_EXCEEDED
+                            .get(peekLength, maxElementSize);
+            throw DecodeException.fatalError(message);
+        }
+        state = ELEMENT_READ_STATE_NEED_VALUE_BYTES;
+        return true;
+    }
+
+    /**
+     * Internal helper method reading the ASN.1 type byte and transition to the
+     * next state if successful.
+     *
+     * @param isBlocking
+     *            <code>true</code> to block if the type byte is not available
+     *            or <code>false</code> to check for availability first.
+     * @param throwEofException
+     *            <code>true</code> to throw an exception when an EOF is
+     *            encountered or <code>false</code> to return false.
+     * @return <code>true</code> if the type byte was successfully read
+     * @throws IOException
+     *             If an error occurs while reading from the stream.
+     */
+    private boolean needTypeState(final boolean isBlocking, final boolean throwEofException)
+            throws IOException {
+        // Read just the type.
+        if (!isBlocking && (in.available() <= 0)) {
+            return false;
+        }
+
+        final int type = in.read();
+        if (type == -1) {
+            if (throwEofException) {
+                final LocalizableMessage message = ERR_ASN1_TRUCATED_TYPE_BYTE.get();
+                throw DecodeException.fatalError(message);
+            }
+            return false;
+        }
+
+        peekType = (byte) type;
+        state = ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE;
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java
index 369c293..2245810 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.BOOLEAN_VALUE_FALSE;
 import static org.forgerock.opendj.asn1.ASN1Constants.BOOLEAN_VALUE_TRUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED;
@@ -45,518 +42,390 @@
 import com.forgerock.opendj.util.ByteSequenceOutputStream;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An ASN1Writer implementation that outputs to an outputstream.
  */
-final class ASN1OutputStreamWriter extends AbstractASN1Writer implements
-    ASN1Writer
-{
-  private final OutputStream rootStream;
-  private OutputStream out;
-  private final ArrayList<ByteSequenceOutputStream> streamStack;
-  private int stackDepth;
+final class ASN1OutputStreamWriter extends AbstractASN1Writer implements ASN1Writer {
+    private final OutputStream rootStream;
+    private OutputStream out;
+    private final ArrayList<ByteSequenceOutputStream> streamStack;
+    private int stackDepth;
 
-
-
-  /**
-   * Creates a new ASN.1 output stream reader.
-   *
-   * @param stream
-   *          The underlying output stream.
-   */
-  ASN1OutputStreamWriter(final OutputStream stream)
-  {
-    this.out = stream;
-    this.rootStream = stream;
-    this.streamStack = new ArrayList<ByteSequenceOutputStream>();
-    this.stackDepth = -1;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close() throws IOException
-  {
-    while (stackDepth >= 0)
-    {
-      writeEndSequence();
-    }
-    rootStream.flush();
-
-    streamStack.clear();
-    rootStream.close();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void flush() throws IOException
-  {
-    rootStream.flush();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeBoolean(final byte type, final boolean booleanValue)
-      throws IOException
-  {
-    out.write(type);
-    writeLength(1);
-    out.write(booleanValue ? BOOLEAN_VALUE_TRUE : BOOLEAN_VALUE_FALSE);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1,
-          String.valueOf(booleanValue)));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEndSequence() throws IOException
-  {
-    if (stackDepth < 0)
-    {
-      final LocalizableMessage message = ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED
-          .get();
-      throw new IllegalStateException(message.toString());
+    /**
+     * Creates a new ASN.1 output stream reader.
+     *
+     * @param stream
+     *            The underlying output stream.
+     */
+    ASN1OutputStreamWriter(final OutputStream stream) {
+        this.out = stream;
+        this.rootStream = stream;
+        this.streamStack = new ArrayList<ByteSequenceOutputStream>();
+        this.stackDepth = -1;
     }
 
-    final ByteSequenceOutputStream childStream = streamStack.get(stackDepth);
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        while (stackDepth >= 0) {
+            writeEndSequence();
+        }
+        rootStream.flush();
 
-    // Decrement the stack depth and get the parent stream
-    --stackDepth;
-
-    final OutputStream parentStream = stackDepth < 0 ? rootStream : streamStack
-        .get(stackDepth);
-
-    // Switch to parent stream and reset the sub-stream
-    out = parentStream;
-
-    // Write the length and contents of the sub-stream
-    writeLength(childStream.length());
-    childStream.writeTo(parentStream);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 END SEQUENCE(length=%d)", childStream.length()));
+        streamStack.clear();
+        rootStream.close();
     }
 
-    childStream.reset();
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEndSet() throws IOException
-  {
-    return writeEndSequence();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEnumerated(final byte type, final int intValue)
-      throws IOException
-  {
-    return writeInteger(type, intValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final byte type, final int intValue)
-      throws IOException
-  {
-    out.write(type);
-    if (((intValue < 0) && ((intValue & 0xFFFFFF80) == 0xFFFFFF80))
-        || ((intValue & 0x0000007F) == intValue))
-    {
-      writeLength(1);
-      out.write((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1,
-            intValue));
-      }
-    }
-    else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
-        || ((intValue & 0x00007FFF) == intValue))
-    {
-      writeLength(2);
-      out.write((byte) ((intValue >> 8) & 0xFF));
-      out.write((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2,
-            intValue));
-      }
-    }
-    else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
-        || ((intValue & 0x007FFFFF) == intValue))
-    {
-      writeLength(3);
-      out.write((byte) ((intValue >> 16) & 0xFF));
-      out.write((byte) ((intValue >> 8) & 0xFF));
-      out.write((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3,
-            intValue));
-      }
-    }
-    else
-    {
-      writeLength(4);
-      out.write((byte) ((intValue >> 24) & 0xFF));
-      out.write((byte) ((intValue >> 16) & 0xFF));
-      out.write((byte) ((intValue >> 8) & 0xFF));
-      out.write((byte) (intValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4,
-            intValue));
-      }
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final byte type, final long longValue)
-      throws IOException
-  {
-    out.write(type);
-    if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L))
-        || ((longValue & 0x000000000000007FL) == longValue))
-    {
-      writeLength(1);
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
-        || ((longValue & 0x0000000000007FFFL) == longValue))
-    {
-      writeLength(2);
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
-        || ((longValue & 0x00000000007FFFFFL) == longValue))
-    {
-      writeLength(3);
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
-        || ((longValue & 0x000000007FFFFFFFL) == longValue))
-    {
-      writeLength(4);
-      out.write((byte) ((longValue >> 24) & 0xFF));
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
-        || ((longValue & 0x0000007FFFFFFFFFL) == longValue))
-    {
-      writeLength(5);
-      out.write((byte) ((longValue >> 32) & 0xFF));
-      out.write((byte) ((longValue >> 24) & 0xFF));
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
-        || ((longValue & 0x00007FFFFFFFFFFFL) == longValue))
-    {
-      writeLength(6);
-      out.write((byte) ((longValue >> 40) & 0xFF));
-      out.write((byte) ((longValue >> 32) & 0xFF));
-      out.write((byte) ((longValue >> 24) & 0xFF));
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6,
-            longValue));
-      }
-    }
-    else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
-        || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue))
-    {
-      writeLength(7);
-      out.write((byte) ((longValue >> 48) & 0xFF));
-      out.write((byte) ((longValue >> 40) & 0xFF));
-      out.write((byte) ((longValue >> 32) & 0xFF));
-      out.write((byte) ((longValue >> 24) & 0xFF));
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7,
-            longValue));
-      }
-    }
-    else
-    {
-      writeLength(8);
-      out.write((byte) ((longValue >> 56) & 0xFF));
-      out.write((byte) ((longValue >> 48) & 0xFF));
-      out.write((byte) ((longValue >> 40) & 0xFF));
-      out.write((byte) ((longValue >> 32) & 0xFF));
-      out.write((byte) ((longValue >> 24) & 0xFF));
-      out.write((byte) ((longValue >> 16) & 0xFF));
-      out.write((byte) ((longValue >> 8) & 0xFF));
-      out.write((byte) (longValue & 0xFF));
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-      {
-        StaticUtils.DEBUG_LOG.finest(String.format(
-            "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8,
-            longValue));
-      }
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeNull(final byte type) throws IOException
-  {
-    out.write(type);
-    writeLength(0);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 NULL(type=0x%x, length=%d)", type, 0));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final byte[] value,
-      final int offset, final int length) throws IOException
-  {
-    out.write(type);
-    writeLength(length);
-    out.write(value, offset, length);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final ByteSequence value)
-      throws IOException
-  {
-    out.write(type);
-    writeLength(value.length());
-    value.copyTo(out);
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String
-          .format("WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value
-              .length()));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte type, final String value)
-      throws IOException
-  {
-    out.write(type);
-
-    if (value == null)
-    {
-      writeLength(0);
-      return this;
+    /**
+     * {@inheritDoc}
+     */
+    public void flush() throws IOException {
+        rootStream.flush();
     }
 
-    final byte[] bytes = StaticUtils.getBytes(value);
-    writeLength(bytes.length);
-    out.write(bytes);
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) throws IOException {
+        out.write(type);
+        writeLength(1);
+        out.write(booleanValue ? BOOLEAN_VALUE_TRUE : BOOLEAN_VALUE_FALSE);
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
-          bytes.length, value));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSequence(final byte type) throws IOException
-  {
-    // Write the type in current stream switch to next sub-stream
-    out.write(type);
-
-    // Increment the stack depth and get the sub-stream from the stack
-    ++stackDepth;
-
-    // Make sure we have a cached sub-stream at this depth
-    if (stackDepth >= streamStack.size())
-    {
-      final ByteSequenceOutputStream subStream = new ByteSequenceOutputStream(
-          new ByteStringBuilder());
-      streamStack.add(subStream);
-      out = subStream;
-    }
-    else
-    {
-      out = streamStack.get(stackDepth);
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 BOOLEAN(type=0x%x, length=%d, value=%s)", type, 1, String
+                            .valueOf(booleanValue)));
+        }
+        return this;
     }
 
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
-    {
-      StaticUtils.DEBUG_LOG.finest(String.format(
-          "WRITE ASN.1 START SEQUENCE(type=0x%x)", type));
-    }
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEndSequence() throws IOException {
+        if (stackDepth < 0) {
+            final LocalizableMessage message = ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED.get();
+            throw new IllegalStateException(message.toString());
+        }
 
+        final ByteSequenceOutputStream childStream = streamStack.get(stackDepth);
 
+        // Decrement the stack depth and get the parent stream
+        --stackDepth;
 
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSet(final byte type) throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    return writeStartSequence(type);
-  }
+        final OutputStream parentStream = stackDepth < 0 ? rootStream : streamStack.get(stackDepth);
 
+        // Switch to parent stream and reset the sub-stream
+        out = parentStream;
 
+        // Write the length and contents of the sub-stream
+        writeLength(childStream.length());
+        childStream.writeTo(parentStream);
 
-  /**
-   * Writes the provided value for use as the length of an ASN.1 element.
-   *
-   * @param length
-   *          The length to encode for use in an ASN.1 element.
-   * @throws IOException
-   *           if an error occurs while writing.
-   */
-  private void writeLength(final int length) throws IOException
-  {
-    if (length < 128)
-    {
-      out.write((byte) length);
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 END SEQUENCE(length=%d)",
+                    childStream.length()));
+        }
+
+        childStream.reset();
+        return this;
     }
-    else if ((length & 0x000000FF) == length)
-    {
-      out.write((byte) 0x81);
-      out.write((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEndSet() throws IOException {
+        return writeEndSequence();
     }
-    else if ((length & 0x0000FFFF) == length)
-    {
-      out.write((byte) 0x82);
-      out.write((byte) ((length >> 8) & 0xFF));
-      out.write((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEnumerated(final byte type, final int intValue) throws IOException {
+        return writeInteger(type, intValue);
     }
-    else if ((length & 0x00FFFFFF) == length)
-    {
-      out.write((byte) 0x83);
-      out.write((byte) ((length >> 16) & 0xFF));
-      out.write((byte) ((length >> 8) & 0xFF));
-      out.write((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final byte type, final int intValue) throws IOException {
+        out.write(type);
+        if (((intValue < 0) && ((intValue & 0xFFFFFF80) == 0xFFFFFF80))
+                || ((intValue & 0x0000007F) == intValue)) {
+            writeLength(1);
+            out.write((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, intValue));
+            }
+        } else if (((intValue < 0) && ((intValue & 0xFFFF8000) == 0xFFFF8000))
+                || ((intValue & 0x00007FFF) == intValue)) {
+            writeLength(2);
+            out.write((byte) ((intValue >> 8) & 0xFF));
+            out.write((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, intValue));
+            }
+        } else if (((intValue < 0) && ((intValue & 0xFF800000) == 0xFF800000))
+                || ((intValue & 0x007FFFFF) == intValue)) {
+            writeLength(3);
+            out.write((byte) ((intValue >> 16) & 0xFF));
+            out.write((byte) ((intValue >> 8) & 0xFF));
+            out.write((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, intValue));
+            }
+        } else {
+            writeLength(4);
+            out.write((byte) ((intValue >> 24) & 0xFF));
+            out.write((byte) ((intValue >> 16) & 0xFF));
+            out.write((byte) ((intValue >> 8) & 0xFF));
+            out.write((byte) (intValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, intValue));
+            }
+        }
+        return this;
     }
-    else
-    {
-      out.write((byte) 0x84);
-      out.write((byte) ((length >> 24) & 0xFF));
-      out.write((byte) ((length >> 16) & 0xFF));
-      out.write((byte) ((length >> 8) & 0xFF));
-      out.write((byte) (length & 0xFF));
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final byte type, final long longValue) throws IOException {
+        out.write(type);
+        if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L))
+                || ((longValue & 0x000000000000007FL) == longValue)) {
+            writeLength(1);
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 1, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFF8000L) == 0xFFFFFFFFFFFF8000L))
+                || ((longValue & 0x0000000000007FFFL) == longValue)) {
+            writeLength(2);
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 2, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFFFF800000L) == 0xFFFFFFFFFF800000L))
+                || ((longValue & 0x00000000007FFFFFL) == longValue)) {
+            writeLength(3);
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 3, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFFFF80000000L) == 0xFFFFFFFF80000000L))
+                || ((longValue & 0x000000007FFFFFFFL) == longValue)) {
+            writeLength(4);
+            out.write((byte) ((longValue >> 24) & 0xFF));
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 4, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFFFF8000000000L) == 0xFFFFFF8000000000L))
+                || ((longValue & 0x0000007FFFFFFFFFL) == longValue)) {
+            writeLength(5);
+            out.write((byte) ((longValue >> 32) & 0xFF));
+            out.write((byte) ((longValue >> 24) & 0xFF));
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 5, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFFFF800000000000L) == 0xFFFF800000000000L))
+                || ((longValue & 0x00007FFFFFFFFFFFL) == longValue)) {
+            writeLength(6);
+            out.write((byte) ((longValue >> 40) & 0xFF));
+            out.write((byte) ((longValue >> 32) & 0xFF));
+            out.write((byte) ((longValue >> 24) & 0xFF));
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 6, longValue));
+            }
+        } else if (((longValue < 0) && ((longValue & 0xFF80000000000000L) == 0xFF80000000000000L))
+                || ((longValue & 0x007FFFFFFFFFFFFFL) == longValue)) {
+            writeLength(7);
+            out.write((byte) ((longValue >> 48) & 0xFF));
+            out.write((byte) ((longValue >> 40) & 0xFF));
+            out.write((byte) ((longValue >> 32) & 0xFF));
+            out.write((byte) ((longValue >> 24) & 0xFF));
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 7, longValue));
+            }
+        } else {
+            writeLength(8);
+            out.write((byte) ((longValue >> 56) & 0xFF));
+            out.write((byte) ((longValue >> 48) & 0xFF));
+            out.write((byte) ((longValue >> 40) & 0xFF));
+            out.write((byte) ((longValue >> 32) & 0xFF));
+            out.write((byte) ((longValue >> 24) & 0xFF));
+            out.write((byte) ((longValue >> 16) & 0xFF));
+            out.write((byte) ((longValue >> 8) & 0xFF));
+            out.write((byte) (longValue & 0xFF));
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+                StaticUtils.DEBUG_LOG.finest(String.format(
+                        "WRITE ASN.1 INTEGER(type=0x%x, length=%d, value=%d)", type, 8, longValue));
+            }
+        }
+        return this;
     }
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeNull(final byte type) throws IOException {
+        out.write(type);
+        writeLength(0);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 NULL(type=0x%x, length=%d)",
+                    type, 0));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final byte[] value, final int offset,
+            final int length) throws IOException {
+        out.write(type);
+        writeLength(length);
+        out.write(value, offset, length);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, length));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final ByteSequence value)
+            throws IOException {
+        out.write(type);
+        writeLength(value.length());
+        value.copyTo(out);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d)", type, value.length()));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte type, final String value) throws IOException {
+        out.write(type);
+
+        if (value == null) {
+            writeLength(0);
+            return this;
+        }
+
+        final byte[] bytes = StaticUtils.getBytes(value);
+        writeLength(bytes.length);
+        out.write(bytes);
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format(
+                    "WRITE ASN.1 OCTETSTRING(type=0x%x, length=%d, " + "value=%s)", type,
+                    bytes.length, value));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSequence(final byte type) throws IOException {
+        // Write the type in current stream switch to next sub-stream
+        out.write(type);
+
+        // Increment the stack depth and get the sub-stream from the stack
+        ++stackDepth;
+
+        // Make sure we have a cached sub-stream at this depth
+        if (stackDepth >= streamStack.size()) {
+            final ByteSequenceOutputStream subStream =
+                    new ByteSequenceOutputStream(new ByteStringBuilder());
+            streamStack.add(subStream);
+            out = subStream;
+        } else {
+            out = streamStack.get(stackDepth);
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST)) {
+            StaticUtils.DEBUG_LOG.finest(String.format("WRITE ASN.1 START SEQUENCE(type=0x%x)",
+                    type));
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSet(final byte type) throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        return writeStartSequence(type);
+    }
+
+    /**
+     * Writes the provided value for use as the length of an ASN.1 element.
+     *
+     * @param length
+     *            The length to encode for use in an ASN.1 element.
+     * @throws IOException
+     *             if an error occurs while writing.
+     */
+    private void writeLength(final int length) throws IOException {
+        if (length < 128) {
+            out.write((byte) length);
+        } else if ((length & 0x000000FF) == length) {
+            out.write((byte) 0x81);
+            out.write((byte) (length & 0xFF));
+        } else if ((length & 0x0000FFFF) == length) {
+            out.write((byte) 0x82);
+            out.write((byte) ((length >> 8) & 0xFF));
+            out.write((byte) (length & 0xFF));
+        } else if ((length & 0x00FFFFFF) == length) {
+            out.write((byte) 0x83);
+            out.write((byte) ((length >> 16) & 0xFF));
+            out.write((byte) ((length >> 8) & 0xFF));
+            out.write((byte) (length & 0xFF));
+        } else {
+            out.write((byte) 0x84);
+            out.write((byte) ((length >> 24) & 0xFF));
+            out.write((byte) ((length >> 16) & 0xFF));
+            out.write((byte) ((length >> 8) & 0xFF));
+            out.write((byte) (length & 0xFF));
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Reader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Reader.java
index 5bac8a1..77af69a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Reader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Reader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
 import java.io.Closeable;
 import java.io.IOException;
 
@@ -37,395 +34,344 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * An interface for decoding ASN.1 elements from a data source.
  * <p>
  * Methods for creating {@link ASN1Reader}s are provided in the {@link ASN1}
  * class.
  */
-public interface ASN1Reader extends Closeable
-{
+public interface ASN1Reader extends Closeable {
 
-  /**
-   * Closes this ASN.1 reader.
-   *
-   * @throws IOException
-   *           If an error occurs while closing.
-   */
-  void close() throws IOException;
+    /**
+     * Closes this ASN.1 reader.
+     *
+     * @throws IOException
+     *             If an error occurs while closing.
+     */
+    void close() throws IOException;
 
+    /**
+     * Indicates whether or not the next element can be read without blocking.
+     *
+     * @return {@code true} if a complete element is available or {@code false}
+     *         otherwise.
+     * @throws DecodeException
+     *             If the available data was not valid ASN.1.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean elementAvailable() throws DecodeException, IOException;
 
+    /**
+     * Indicates whether or not the current stream, sequence, or set contains
+     * another element. Note that this method may return {@code true} even if a
+     * previous call to {@link #elementAvailable} returned {@code false},
+     * indicating that the current set or sequence contains another element but
+     * an attempt to read that element may block. This method will block if
+     * there is not enough data available to make the determination (typically
+     * only the next element's type is required).
+     *
+     * @return {@code true} if the current stream, sequence, or set contains
+     *         another element, or {@code false} if the end of the stream,
+     *         sequence, or set has been reached.
+     * @throws DecodeException
+     *             If the available data was not valid ASN.1.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean hasNextElement() throws DecodeException, IOException;
 
-  /**
-   * Indicates whether or not the next element can be read without blocking.
-   *
-   * @return {@code true} if a complete element is available or {@code false}
-   *         otherwise.
-   * @throws DecodeException
-   *           If the available data was not valid ASN.1.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean elementAvailable() throws DecodeException, IOException;
+    /**
+     * Returns the data length of the next element without actually reading it.
+     *
+     * @return The data length of the next element, or {@code -1} if the end of
+     *         the stream, sequence, or set has been reached.
+     * @throws DecodeException
+     *             If the available data was not valid ASN.1.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    int peekLength() throws DecodeException, IOException;
 
+    /**
+     * Returns the type of the next element without actually reading it.
+     *
+     * @return The type of the next element, or {@code -1} if the end of the
+     *         stream, sequence, or set has been reached.
+     * @throws DecodeException
+     *             If the available data was not valid ASN.1.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    byte peekType() throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a boolean having the Universal Boolean ASN.1
+     * type tag.
+     *
+     * @return The decoded boolean value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as a boolean.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean readBoolean() throws DecodeException, IOException;
 
-  /**
-   * Indicates whether or not the current stream, sequence, or set contains
-   * another element. Note that this method may return {@code true} even if a
-   * previous call to {@link #elementAvailable} returned {@code false},
-   * indicating that the current set or sequence contains another element but an
-   * attempt to read that element may block. This method will block if there is
-   * not enough data available to make the determination (typically only the
-   * next element's type is required).
-   *
-   * @return {@code true} if the current stream, sequence, or set contains
-   *         another element, or {@code false} if the end of the stream,
-   *         sequence, or set has been reached.
-   * @throws DecodeException
-   *           If the available data was not valid ASN.1.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean hasNextElement() throws DecodeException, IOException;
+    /**
+     * Reads the next element as a boolean having the provided type tag.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @return The decoded boolean value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as a boolean.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean readBoolean(byte type) throws DecodeException, IOException;
 
+    /**
+     * Finishes reading a sequence and discards any unread elements.
+     *
+     * @throws DecodeException
+     *             If an error occurs while advancing to the end of the
+     *             sequence.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     * @throws IllegalStateException
+     *             If there is no sequence being read.
+     */
+    void readEndSequence() throws DecodeException, IOException;
 
+    /**
+     * Finishes reading a set and discards any unread elements.
+     *
+     * @throws DecodeException
+     *             If an error occurs while advancing to the end of the set.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     * @throws IllegalStateException
+     *             If there is no set being read.
+     */
+    void readEndSet() throws DecodeException, IOException;
 
-  /**
-   * Returns the data length of the next element without actually reading it.
-   *
-   * @return The data length of the next element, or {@code -1} if the end of
-   *         the stream, sequence, or set has been reached.
-   * @throws DecodeException
-   *           If the available data was not valid ASN.1.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  int peekLength() throws DecodeException, IOException;
+    /**
+     * Reads the next element as an enumerated having the Universal Enumerated
+     * ASN.1 type tag.
+     *
+     * @return The decoded enumerated value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an enumerated value.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    int readEnumerated() throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as an enumerated having the provided type tag.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @return The decoded enumerated value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an enumerated value.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    int readEnumerated(byte type) throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as an integer having the Universal Integer ASN.1
+     * type tag.
+     *
+     * @return The decoded integer value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an integer.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    long readInteger() throws DecodeException, IOException;
 
-  /**
-   * Returns the type of the next element without actually reading it.
-   *
-   * @return The type of the next element, or {@code -1} if the end of the
-   *         stream, sequence, or set has been reached.
-   * @throws DecodeException
-   *           If the available data was not valid ASN.1.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  byte peekType() throws DecodeException, IOException;
+    /**
+     * Reads the next element as an integer having the provided type tag.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @return The decoded integer value.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an integer.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    long readInteger(byte type) throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a null element having the Universal Null ASN.1
+     * type tag.
+     *
+     * @throws DecodeException
+     *             If the element cannot be decoded as a null element.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readNull() throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a null element having the provided type tag.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @throws DecodeException
+     *             If the element cannot be decoded as a null element.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readNull(byte type) throws DecodeException, IOException;
 
-  /**
-   * Reads the next element as a boolean having the Universal Boolean ASN.1 type
-   * tag.
-   *
-   * @return The decoded boolean value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as a boolean.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean readBoolean() throws DecodeException, IOException;
+    /**
+     * Reads the next element as an octet string having the Universal Octet
+     * String ASN.1 type tag.
+     *
+     * @return The decoded octet string represented using a {@link ByteString}.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    ByteString readOctetString() throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as an octet string having the provided type tag.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @return The decoded octet string represented using a {@link ByteString}.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    ByteString readOctetString(byte type) throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as an octet string having the provided type tag
+     * and appends it to the provided {@link ByteStringBuilder}.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @param builder
+     *            The {@link ByteStringBuilder} to append the octet string to.
+     * @return A reference to {@code builder}.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    ByteStringBuilder readOctetString(byte type, ByteStringBuilder builder) throws DecodeException,
+            IOException;
 
-  /**
-   * Reads the next element as a boolean having the provided type tag.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @return The decoded boolean value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as a boolean.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean readBoolean(byte type) throws DecodeException, IOException;
+    /**
+     * Reads the next element as an octet string having the Universal Octet
+     * String ASN.1 type tag and appends it to the provided
+     * {@link ByteStringBuilder}.
+     *
+     * @param builder
+     *            The {@link ByteStringBuilder} to append the octet string to.
+     * @return A reference to {@code builder}.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    ByteStringBuilder readOctetString(ByteStringBuilder builder) throws DecodeException,
+            IOException;
 
+    /**
+     * Reads the next element as an octet string having the Universal Octet
+     * String ASN.1 type tag and decodes the value as a UTF-8 encoded string.
+     *
+     * @return The decoded octet string as a UTF-8 encoded string.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    String readOctetStringAsString() throws DecodeException, IOException;
 
-
-  /**
-   * Finishes reading a sequence and discards any unread elements.
-   *
-   * @throws DecodeException
-   *           If an error occurs while advancing to the end of the sequence.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   * @throws IllegalStateException
-   *           If there is no sequence being read.
-   */
-  void readEndSequence() throws DecodeException, IOException;
-
-
-
-  /**
-   * Finishes reading a set and discards any unread elements.
-   *
-   * @throws DecodeException
-   *           If an error occurs while advancing to the end of the set.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   * @throws IllegalStateException
-   *           If there is no set being read.
-   */
-  void readEndSet() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an enumerated having the Universal Enumerated
-   * ASN.1 type tag.
-   *
-   * @return The decoded enumerated value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an enumerated value.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  int readEnumerated() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an enumerated having the provided type tag.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @return The decoded enumerated value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an enumerated value.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  int readEnumerated(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an integer having the Universal Integer ASN.1
-   * type tag.
-   *
-   * @return The decoded integer value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an integer.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  long readInteger() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an integer having the provided type tag.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @return The decoded integer value.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an integer.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  long readInteger(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as a null element having the Universal Null ASN.1
-   * type tag.
-   *
-   * @throws DecodeException
-   *           If the element cannot be decoded as a null element.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readNull() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as a null element having the provided type tag.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @throws DecodeException
-   *           If the element cannot be decoded as a null element.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readNull(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the Universal Octet String
-   * ASN.1 type tag.
-   *
-   * @return The decoded octet string represented using a {@link ByteString}.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  ByteString readOctetString() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the provided type tag.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @return The decoded octet string represented using a {@link ByteString}.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  ByteString readOctetString(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the provided type tag and
-   * appends it to the provided {@link ByteStringBuilder}.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @param builder
-   *          The {@link ByteStringBuilder} to append the octet string to.
-   * @return A reference to {@code builder}.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  ByteStringBuilder readOctetString(byte type, ByteStringBuilder builder)
-      throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the Universal Octet String
-   * ASN.1 type tag and appends it to the provided {@link ByteStringBuilder}.
-   *
-   * @param builder
-   *          The {@link ByteStringBuilder} to append the octet string to.
-   * @return A reference to {@code builder}.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  ByteStringBuilder readOctetString(ByteStringBuilder builder)
-      throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the Universal Octet String
-   * ASN.1 type tag and decodes the value as a UTF-8 encoded string.
-   *
-   * @return The decoded octet string as a UTF-8 encoded string.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  String readOctetStringAsString() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as an octet string having the provided type tag and
-   * decodes the value as a UTF-8 encoded string.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @return The decoded octet string as a UTF-8 encoded string.
-   * @throws DecodeException
-   *           If the element cannot be decoded as an octet string.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  String readOctetStringAsString(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as a sequence having the Universal Sequence ASN.1
-   * type tag. All further reads will read the elements in the sequence until
-   * {@link #readEndSequence()} is called.
-   *
-   * @throws DecodeException
-   *           If the element cannot be decoded as a sequence.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readStartSequence() throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as a sequence having the provided type tag. All
-   * further reads will read the elements in the sequence until
-   * {@link #readEndSequence()} is called.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @throws DecodeException
-   *           If the element cannot be decoded as a sequence.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readStartSequence(byte type) throws DecodeException, IOException;
-
-
-
-  /**
-   * Reads the next element as a set having the Universal Set ASN.1 type tag.
-   * All further reads will read the elements in the set until
-   * {@link #readEndSet()} is called.
-   *
-   * @throws DecodeException
-   *           If the element cannot be decoded as a set.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readStartSet() throws DecodeException, IOException;
-
+    /**
+     * Reads the next element as an octet string having the provided type tag
+     * and decodes the value as a UTF-8 encoded string.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @return The decoded octet string as a UTF-8 encoded string.
+     * @throws DecodeException
+     *             If the element cannot be decoded as an octet string.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    String readOctetStringAsString(byte type) throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a sequence having the Universal Sequence ASN.1
+     * type tag. All further reads will read the elements in the sequence until
+     * {@link #readEndSequence()} is called.
+     *
+     * @throws DecodeException
+     *             If the element cannot be decoded as a sequence.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readStartSequence() throws DecodeException, IOException;
 
-  /**
-   * Reads the next element as a set having the provided type tag. All further
-   * reads will read the elements in the set until {@link #readEndSet()} is
-   * called.
-   *
-   * @param type
-   *          The expected type tag of the element.
-   * @throws DecodeException
-   *           If the element cannot be decoded as a set.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  void readStartSet(byte type) throws DecodeException, IOException;
+    /**
+     * Reads the next element as a sequence having the provided type tag. All
+     * further reads will read the elements in the sequence until
+     * {@link #readEndSequence()} is called.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @throws DecodeException
+     *             If the element cannot be decoded as a sequence.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readStartSequence(byte type) throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a set having the Universal Set ASN.1 type tag.
+     * All further reads will read the elements in the set until
+     * {@link #readEndSet()} is called.
+     *
+     * @throws DecodeException
+     *             If the element cannot be decoded as a set.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readStartSet() throws DecodeException, IOException;
 
+    /**
+     * Reads the next element as a set having the provided type tag. All further
+     * reads will read the elements in the set until {@link #readEndSet()} is
+     * called.
+     *
+     * @param type
+     *            The expected type tag of the element.
+     * @throws DecodeException
+     *             If the element cannot be decoded as a set.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    void readStartSet(byte type) throws DecodeException, IOException;
 
-  /**
-   * Skips the next element without decoding it.
-   *
-   * @return A reference to this ASN.1 reader.
-   * @throws DecodeException
-   *           If the next element could not be skipped.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  ASN1Reader skipElement() throws DecodeException, IOException;
+    /**
+     * Skips the next element without decoding it.
+     *
+     * @return A reference to this ASN.1 reader.
+     * @throws DecodeException
+     *             If the next element could not be skipped.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    ASN1Reader skipElement() throws DecodeException, IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Writer.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Writer.java
index 4e81377..f103a21 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Writer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1Writer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,395 +26,339 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import java.io.Closeable;
 import java.io.Flushable;
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * An interface for encoding ASN.1 elements to a data source.
  * <p>
  * Methods for creating {@link ASN1Writer}s are provided in the {@link ASN1}
  * class.
  */
-public interface ASN1Writer extends Closeable, Flushable
-{
+public interface ASN1Writer extends Closeable, Flushable {
 
-  /**
-   * Closes this ASN.1 writer, flushing it first. Closing a previously closed
-   * ASN.1 writer has no effect. Any unfinished sequences and/or sets will be
-   * ended.
-   *
-   * @throws IOException
-   *           If an error occurs while closing.
-   */
-  void close() throws IOException;
+    /**
+     * Closes this ASN.1 writer, flushing it first. Closing a previously closed
+     * ASN.1 writer has no effect. Any unfinished sequences and/or sets will be
+     * ended.
+     *
+     * @throws IOException
+     *             If an error occurs while closing.
+     */
+    void close() throws IOException;
 
+    /**
+     * Flushes this ASN.1 writer so that any buffered elements are written
+     * immediately to their intended destination. Then, if that destination is
+     * another byte stream, flush it. Thus one {@code flush()} invocation will
+     * flush all the buffers in a chain of streams.
+     * <p>
+     * If the intended destination of this stream is an abstraction provided by
+     * the underlying operating system, for example a file, then flushing the
+     * stream guarantees only that bytes previously written to the stream are
+     * passed to the operating system for writing; it does not guarantee that
+     * they are actually written to a physical device such as a disk drive.
+     *
+     * @throws IOException
+     *             If an error occurs while flushing.
+     */
+    void flush() throws IOException;
 
+    /**
+     * Writes a boolean element using the Universal Boolean ASN.1 type tag.
+     *
+     * @param value
+     *            The boolean value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeBoolean(boolean value) throws IOException;
 
-  /**
-   * Flushes this ASN.1 writer so that any buffered elements are written
-   * immediately to their intended destination. Then, if that destination is
-   * another byte stream, flush it. Thus one {@code flush()} invocation will
-   * flush all the buffers in a chain of streams.
-   * <p>
-   * If the intended destination of this stream is an abstraction provided by
-   * the underlying operating system, for example a file, then flushing the
-   * stream guarantees only that bytes previously written to the stream are
-   * passed to the operating system for writing; it does not guarantee that they
-   * are actually written to a physical device such as a disk drive.
-   *
-   * @throws IOException
-   *           If an error occurs while flushing.
-   */
-  void flush() throws IOException;
+    /**
+     * Writes a boolean element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The boolean value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeBoolean(byte type, boolean value) throws IOException;
 
+    /**
+     * Finishes writing a sequence element.
+     *
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     * @throws IllegalStateException
+     *             If there is no sequence being written.
+     */
+    ASN1Writer writeEndSequence() throws IOException;
 
+    /**
+     * Finishes writing a set element.
+     *
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     * @throws IllegalStateException
+     *             If there is no set being written.
+     */
+    ASN1Writer writeEndSet() throws IOException;
 
-  /**
-   * Writes a boolean element using the Universal Boolean ASN.1 type tag.
-   *
-   * @param value
-   *          The boolean value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeBoolean(boolean value) throws IOException;
+    /**
+     * Writes an enumerated element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The enumerated value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeEnumerated(byte type, int value) throws IOException;
 
+    /**
+     * Writes an enumerated element using the Universal Enumerated ASN.1 type
+     * tag.
+     *
+     * @param value
+     *            The enumerated value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeEnumerated(int value) throws IOException;
 
+    /**
+     * Writes an integer element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The integer value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeInteger(byte type, int value) throws IOException;
 
-  /**
-   * Writes a boolean element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The boolean value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeBoolean(byte type, boolean value) throws IOException;
+    /**
+     * Writes an integer element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The integer value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeInteger(byte type, long value) throws IOException;
 
+    /**
+     * Writes an integer element using the Universal Integer ASN.1 type tag.
+     *
+     * @param value
+     *            The integer value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeInteger(int value) throws IOException;
 
+    /**
+     * Writes an integer element using the Universal Integer ASN.1 type tag.
+     *
+     * @param value
+     *            The integer value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeInteger(long value) throws IOException;
 
-  /**
-   * Finishes writing a sequence element.
-   *
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   * @throws IllegalStateException
-   *           If there is no sequence being written.
-   */
-  ASN1Writer writeEndSequence() throws IOException;
+    /**
+     * Writes a null element using the Universal Null ASN.1 type tag.
+     *
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeNull() throws IOException;
 
+    /**
+     * Writes a null element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeNull(byte type) throws IOException;
 
+    /**
+     * Writes an octet string element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The byte array containing the octet string data.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte type, byte[] value) throws IOException;
 
-  /**
-   * Finishes writing a set element.
-   *
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   * @throws IllegalStateException
-   *           If there is no set being written.
-   */
-  ASN1Writer writeEndSet() throws IOException;
+    /**
+     * Writes an octet string element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The byte array containing the octet string data.
+     * @param offset
+     *            The offset in the byte array.
+     * @param length
+     *            The number of bytes to write.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte type, byte[] value, int offset, int length) throws IOException;
 
+    /**
+     * Writes an octet string element using the provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The octet string value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte type, ByteSequence value) throws IOException;
 
+    /**
+     * Writes a string as a UTF-8 encoded octet string element using the
+     * provided type tag.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @param value
+     *            The string to be written as a UTF-8 encoded octet string.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte type, String value) throws IOException;
 
-  /**
-   * Writes an enumerated element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The enumerated value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeEnumerated(byte type, int value) throws IOException;
+    /**
+     * Writes an octet string element using the Universal Octet String ASN.1
+     * type tag.
+     *
+     * @param value
+     *            The byte array containing the octet string data.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte[] value) throws IOException;
 
+    /**
+     * Writes an octet string element using the Universal Octet String ASN.1
+     * type tag.
+     *
+     * @param value
+     *            The byte array containing the octet string data.
+     * @param offset
+     *            The offset in the byte array.
+     * @param length
+     *            The number of bytes to write.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(byte[] value, int offset, int length) throws IOException;
 
-
-  /**
-   * Writes an enumerated element using the Universal Enumerated ASN.1 type tag.
-   *
-   * @param value
-   *          The enumerated value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeEnumerated(int value) throws IOException;
-
-
-
-  /**
-   * Writes an integer element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The integer value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeInteger(byte type, int value) throws IOException;
-
-
-
-  /**
-   * Writes an integer element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The integer value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeInteger(byte type, long value) throws IOException;
-
-
-
-  /**
-   * Writes an integer element using the Universal Integer ASN.1 type tag.
-   *
-   * @param value
-   *          The integer value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeInteger(int value) throws IOException;
-
-
-
-  /**
-   * Writes an integer element using the Universal Integer ASN.1 type tag.
-   *
-   * @param value
-   *          The integer value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeInteger(long value) throws IOException;
-
-
-
-  /**
-   * Writes a null element using the Universal Null ASN.1 type tag.
-   *
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeNull() throws IOException;
-
-
-
-  /**
-   * Writes a null element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeNull(byte type) throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The byte array containing the octet string data.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte type, byte[] value) throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The byte array containing the octet string data.
-   * @param offset
-   *          The offset in the byte array.
-   * @param length
-   *          The number of bytes to write.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte type, byte[] value, int offset, int length)
-      throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the provided type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The octet string value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte type, ByteSequence value) throws IOException;
-
-
-
-  /**
-   * Writes a string as a UTF-8 encoded octet string element using the provided
-   * type tag.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @param value
-   *          The string to be written as a UTF-8 encoded octet string.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte type, String value) throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the Universal Octet String ASN.1 type
-   * tag.
-   *
-   * @param value
-   *          The byte array containing the octet string data.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte[] value) throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the Universal Octet String ASN.1 type
-   * tag.
-   *
-   * @param value
-   *          The byte array containing the octet string data.
-   * @param offset
-   *          The offset in the byte array.
-   * @param length
-   *          The number of bytes to write.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(byte[] value, int offset, int length)
-      throws IOException;
-
-
-
-  /**
-   * Writes an octet string element using the Universal Octet String ASN.1 type
-   * tag.
-   *
-   * @param value
-   *          The octet string value.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(ByteSequence value) throws IOException;
-
-
-
-  /**
-   * Writes a string as a UTF-8 encoded octet string element using the Universal
-   * Octet String ASN.1 type tag.
-   *
-   * @param value
-   *          The string to be written as a UTF-8 encoded octet string.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeOctetString(String value) throws IOException;
-
-
-
-  /**
-   * Writes a sequence element using the Universal Sequence ASN.1 type tag. All
-   * further writes will append elements to the sequence until
-   * {@link #writeEndSequence} is called.
-   *
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeStartSequence() throws IOException;
-
-
-
-  /**
-   * Writes a sequence element using the provided type tag. All further writes
-   * will append elements to the sequence until {@link #writeEndSequence} is
-   * called.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeStartSequence(byte type) throws IOException;
-
+    /**
+     * Writes an octet string element using the Universal Octet String ASN.1
+     * type tag.
+     *
+     * @param value
+     *            The octet string value.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(ByteSequence value) throws IOException;
 
+    /**
+     * Writes a string as a UTF-8 encoded octet string element using the
+     * Universal Octet String ASN.1 type tag.
+     *
+     * @param value
+     *            The string to be written as a UTF-8 encoded octet string.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeOctetString(String value) throws IOException;
 
-  /**
-   * Writes a set element using the Universal Set ASN.1 type tag. All further
-   * writes will append elements to the set until {@link #writeEndSet} is
-   * called.
-   *
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeStartSet() throws IOException;
+    /**
+     * Writes a sequence element using the Universal Sequence ASN.1 type tag.
+     * All further writes will append elements to the sequence until
+     * {@link #writeEndSequence} is called.
+     *
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeStartSequence() throws IOException;
 
+    /**
+     * Writes a sequence element using the provided type tag. All further writes
+     * will append elements to the sequence until {@link #writeEndSequence} is
+     * called.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeStartSequence(byte type) throws IOException;
 
+    /**
+     * Writes a set element using the Universal Set ASN.1 type tag. All further
+     * writes will append elements to the set until {@link #writeEndSet} is
+     * called.
+     *
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeStartSet() throws IOException;
 
-  /**
-   * Writes a set element using the provided type tag. All further writes will
-   * append elements to the set until {@link #writeEndSet} is called.
-   *
-   * @param type
-   *          The type tag of the element.
-   * @return A reference to this ASN.1 writer.
-   * @throws IOException
-   *           If an error occurs while writing the element.
-   */
-  ASN1Writer writeStartSet(byte type) throws IOException;
+    /**
+     * Writes a set element using the provided type tag. All further writes will
+     * append elements to the set until {@link #writeEndSet} is called.
+     *
+     * @param type
+     *            The type tag of the element.
+     * @return A reference to this ASN.1 writer.
+     * @throws IOException
+     *             If an error occurs while writing the element.
+     */
+    ASN1Writer writeStartSet(byte type) throws IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Reader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Reader.java
index 1d11cf8..36fa325 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Reader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Reader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.*;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ASN1_UNEXPECTED_TAG;
 
@@ -39,172 +36,128 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * An abstract {@code ASN1Reader} which can be used as the basis for
  * implementing new ASN1 reader implementations.
  */
-public abstract class AbstractASN1Reader implements ASN1Reader
-{
-  /**
-   * Creates a new abstract ASN.1 reader.
-   */
-  protected AbstractASN1Reader()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean readBoolean(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_BOOLEAN_TYPE;
+public abstract class AbstractASN1Reader implements ASN1Reader {
+    /**
+     * Creates a new abstract ASN.1 reader.
+     */
+    protected AbstractASN1Reader() {
+        // No implementation required.
     }
-    checkType(type);
-    return readBoolean();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int readEnumerated(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_ENUMERATED_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean readBoolean(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_BOOLEAN_TYPE;
+        }
+        checkType(type);
+        return readBoolean();
     }
-    checkType(type);
-    return readEnumerated();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public long readInteger(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_INTEGER_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public int readEnumerated(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_ENUMERATED_TYPE;
+        }
+        checkType(type);
+        return readEnumerated();
     }
-    checkType(type);
-    return readInteger();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readNull(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_NULL_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public long readInteger(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_INTEGER_TYPE;
+        }
+        checkType(type);
+        return readInteger();
     }
-    checkType(type);
-    readNull();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString readOctetString(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_OCTET_STRING_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public void readNull(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_NULL_TYPE;
+        }
+        checkType(type);
+        readNull();
     }
-    checkType(type);
-    return readOctetString();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder readOctetString(byte type,
-      final ByteStringBuilder builder) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_OCTET_STRING_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString readOctetString(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_OCTET_STRING_TYPE;
+        }
+        checkType(type);
+        return readOctetString();
     }
-    checkType(type);
-    readOctetString(builder);
-    return builder;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String readOctetStringAsString(byte type) throws IOException
-  {
-    // We could cache the UTF-8 CharSet if performance proves to be an
-    // issue.
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_OCTET_STRING_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder readOctetString(byte type, final ByteStringBuilder builder)
+            throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_OCTET_STRING_TYPE;
+        }
+        checkType(type);
+        readOctetString(builder);
+        return builder;
     }
-    checkType(type);
-    return readOctetStringAsString();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSequence(byte type) throws IOException
-  {
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_SEQUENCE_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public String readOctetStringAsString(byte type) throws IOException {
+        // We could cache the UTF-8 CharSet if performance proves to be an
+        // issue.
+        if (type == 0x00) {
+            type = UNIVERSAL_OCTET_STRING_TYPE;
+        }
+        checkType(type);
+        return readOctetStringAsString();
     }
-    checkType(type);
-    readStartSequence();
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void readStartSet(byte type) throws IOException
-  {
-    // From an implementation point of view, a set is equivalent to a
-    // sequence.
-    if (type == 0x00)
-    {
-      type = UNIVERSAL_SET_TYPE;
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSequence(byte type) throws IOException {
+        if (type == 0x00) {
+            type = UNIVERSAL_SEQUENCE_TYPE;
+        }
+        checkType(type);
+        readStartSequence();
     }
-    checkType(type);
-    readStartSet();
-  }
 
-
-
-  private void checkType(final byte expectedType) throws IOException
-  {
-    if (peekType() != expectedType)
-    {
-      final LocalizableMessage message = ERR_ASN1_UNEXPECTED_TAG.get(
-          expectedType, peekType());
-      throw DecodeException.fatalError(message);
+    /**
+     * {@inheritDoc}
+     */
+    public void readStartSet(byte type) throws IOException {
+        // From an implementation point of view, a set is equivalent to a
+        // sequence.
+        if (type == 0x00) {
+            type = UNIVERSAL_SET_TYPE;
+        }
+        checkType(type);
+        readStartSet();
     }
-  }
+
+    private void checkType(final byte expectedType) throws IOException {
+        if (peekType() != expectedType) {
+            final LocalizableMessage message =
+                    ERR_ASN1_UNEXPECTED_TAG.get(expectedType, peekType());
+            throw DecodeException.fatalError(message);
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Writer.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Writer.java
index 2bc4029..7d113de 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Writer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/AbstractASN1Writer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,152 +26,108 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.*;
 
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * An abstract {@code ASN1Writer} which can be used as the basis for
  * implementing new ASN1 writer implementations.
  */
-public abstract class AbstractASN1Writer implements ASN1Writer
-{
+public abstract class AbstractASN1Writer implements ASN1Writer {
 
-  /**
-   * Creates a new abstract ASN.1 writer.
-   */
-  protected AbstractASN1Writer()
-  {
-    // No implementation required.
-  }
+    /**
+     * Creates a new abstract ASN.1 writer.
+     */
+    protected AbstractASN1Writer() {
+        // No implementation required.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeBoolean(final boolean value) throws IOException {
+        return writeBoolean(UNIVERSAL_BOOLEAN_TYPE, value);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeEnumerated(final int value) throws IOException {
+        return writeEnumerated(UNIVERSAL_ENUMERATED_TYPE, value);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeBoolean(final boolean value) throws IOException
-  {
-    return writeBoolean(UNIVERSAL_BOOLEAN_TYPE, value);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final int value) throws IOException {
+        return writeInteger(UNIVERSAL_INTEGER_TYPE, value);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeInteger(final long value) throws IOException {
+        return writeInteger(UNIVERSAL_INTEGER_TYPE, value);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeNull() throws IOException {
+        return writeNull(UNIVERSAL_NULL_TYPE);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeEnumerated(final int value) throws IOException
-  {
-    return writeEnumerated(UNIVERSAL_ENUMERATED_TYPE, value);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(byte type, byte[] value) throws IOException {
+        return writeOctetString(type, value, 0, value.length);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(byte[] value) throws IOException {
+        return writeOctetString(value, 0, value.length);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final byte[] value, final int offset, final int length)
+            throws IOException {
+        return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value, offset, length);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final int value) throws IOException
-  {
-    return writeInteger(UNIVERSAL_INTEGER_TYPE, value);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final ByteSequence value) throws IOException {
+        return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeOctetString(final String value) throws IOException {
+        return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSequence() throws IOException {
+        return writeStartSequence(UNIVERSAL_SEQUENCE_TYPE);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeInteger(final long value) throws IOException
-  {
-    return writeInteger(UNIVERSAL_INTEGER_TYPE, value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeNull() throws IOException
-  {
-    return writeNull(UNIVERSAL_NULL_TYPE);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(byte type, byte[] value)
-      throws IOException
-  {
-    return writeOctetString(type, value, 0, value.length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(byte[] value) throws IOException
-  {
-    return writeOctetString(value, 0, value.length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final byte[] value, final int offset,
-      final int length) throws IOException
-  {
-    return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value, offset, length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final ByteSequence value)
-      throws IOException
-  {
-    return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeOctetString(final String value) throws IOException
-  {
-    return writeOctetString(UNIVERSAL_OCTET_STRING_TYPE, value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSequence() throws IOException
-  {
-    return writeStartSequence(UNIVERSAL_SEQUENCE_TYPE);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ASN1Writer writeStartSet() throws IOException
-  {
-    return writeStartSet(UNIVERSAL_SET_TYPE);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ASN1Writer writeStartSet() throws IOException {
+        return writeStartSet(UNIVERSAL_SET_TYPE);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/package-info.java
index 065916d..150b2af 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -35,5 +34,3 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AVA.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AVA.java
index abb2891..e738b90 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AVA.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AVA.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.*;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
@@ -37,14 +34,16 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.schema.*;
+import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.Syntax;
+import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An attribute value assertion (AVA) as defined in RFC 4512 section 2.3
  * consists of an attribute description with zero options and an attribute
@@ -62,916 +61,740 @@
  *      Lightweight Directory Access Protocol (LDAP): Directory Information
  *      Models </a>
  */
-public final class AVA implements Comparable<AVA>
-{
-  /**
-   * Parses the provided LDAP string representation of an AVA using the default
-   * schema.
-   *
-   * @param ava
-   *          The LDAP string representation of an AVA.
-   * @return The parsed RDN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ava} is not a valid LDAP string representation of a
-   *           AVA.
-   * @throws NullPointerException
-   *           If {@code ava} was {@code null}.
-   */
-  public static AVA valueOf(final String ava)
-  {
-    return valueOf(ava, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of an AVA using the provided
-   * schema.
-   *
-   * @param ava
-   *          The LDAP string representation of a AVA.
-   * @param schema
-   *          The schema to use when parsing the AVA.
-   * @return The parsed AVA.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ava} is not a valid LDAP string representation of a
-   *           AVA.
-   * @throws NullPointerException
-   *           If {@code ava} or {@code schema} was {@code null}.
-   */
-  public static AVA valueOf(final String ava, final Schema schema)
-  {
-    final SubstringReader reader = new SubstringReader(ava);
-    try
-    {
-      return decode(reader, schema);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_RDN_TYPE_NOT_FOUND.get(ava,
-          e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(message);
-    }
-  }
-
-
-
-  static AVA decode(final SubstringReader reader, final Schema schema)
-  {
-    // Skip over any spaces at the beginning.
-    reader.skipWhitespaces();
-
-    if (reader.remaining() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_NO_NAME
-          .get(reader.getString());
-      throw new LocalizedIllegalArgumentException(message);
+public final class AVA implements Comparable<AVA> {
+    /**
+     * Parses the provided LDAP string representation of an AVA using the
+     * default schema.
+     *
+     * @param ava
+     *            The LDAP string representation of an AVA.
+     * @return The parsed RDN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ava} is not a valid LDAP string representation of a
+     *             AVA.
+     * @throws NullPointerException
+     *             If {@code ava} was {@code null}.
+     */
+    public static AVA valueOf(final String ava) {
+        return valueOf(ava, Schema.getDefaultSchema());
     }
 
-    final AttributeType attribute = readAttributeName(reader, schema);
-
-    // Skip over any spaces if we have.
-    reader.skipWhitespaces();
-
-    // Make sure that we're not at the end of the DN string because
-    // that would be invalid.
-    if (reader.remaining() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_END_WITH_ATTR_NAME
-          .get(reader.getString(), attribute.getNameOrOID());
-      throw new LocalizedIllegalArgumentException(message);
+    /**
+     * Parses the provided LDAP string representation of an AVA using the
+     * provided schema.
+     *
+     * @param ava
+     *            The LDAP string representation of a AVA.
+     * @param schema
+     *            The schema to use when parsing the AVA.
+     * @return The parsed AVA.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ava} is not a valid LDAP string representation of a
+     *             AVA.
+     * @throws NullPointerException
+     *             If {@code ava} or {@code schema} was {@code null}.
+     */
+    public static AVA valueOf(final String ava, final Schema schema) {
+        final SubstringReader reader = new SubstringReader(ava);
+        try {
+            return decode(reader, schema);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_RDN_TYPE_NOT_FOUND.get(ava, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(message);
+        }
     }
 
-    // The next character must be an equal sign. If it is not, then
-    // that's an error.
-    char c;
-    if ((c = reader.read()) != '=')
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_NO_EQUAL.get(
-          reader.getString(), attribute.getNameOrOID(), c);
-      throw new LocalizedIllegalArgumentException(message);
+    static AVA decode(final SubstringReader reader, final Schema schema) {
+        // Skip over any spaces at the beginning.
+        reader.skipWhitespaces();
+
+        if (reader.remaining() == 0) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DN_ATTR_NO_NAME.get(reader.getString());
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        final AttributeType attribute = readAttributeName(reader, schema);
+
+        // Skip over any spaces if we have.
+        reader.skipWhitespaces();
+
+        // Make sure that we're not at the end of the DN string because
+        // that would be invalid.
+        if (reader.remaining() == 0) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DN_END_WITH_ATTR_NAME.get(reader.getString(), attribute
+                            .getNameOrOID());
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // The next character must be an equal sign. If it is not, then
+        // that's an error.
+        char c;
+        if ((c = reader.read()) != '=') {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DN_NO_EQUAL
+                            .get(reader.getString(), attribute.getNameOrOID(), c);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Skip over any spaces after the equal sign.
+        reader.skipWhitespaces();
+
+        // Parse the value for this RDN component.
+        final ByteString value = readAttributeValue(reader);
+
+        return new AVA(attribute, value);
     }
 
-    // Skip over any spaces after the equal sign.
-    reader.skipWhitespaces();
+    private static void appendHexChars(final SubstringReader reader,
+            final StringBuilder valueBuffer, final StringBuilder hexBuffer) throws DecodeException {
+        final int length = hexBuffer.length();
+        if (length == 0) {
+            return;
+        }
 
-    // Parse the value for this RDN component.
-    final ByteString value = readAttributeValue(reader);
-
-    return new AVA(attribute, value);
-  }
-
-
-
-  private static void appendHexChars(final SubstringReader reader,
-      final StringBuilder valueBuffer, final StringBuilder hexBuffer)
-      throws DecodeException
-  {
-    final int length = hexBuffer.length();
-    if (length == 0)
-    {
-      return;
-    }
-
-    if ((length % 2) != 0)
-    {
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH
-          .get(hexBuffer);
-      throw DecodeException.error(message);
-    }
-
-    int pos = 0;
-    final int arrayLength = (length / 2);
-    final byte[] hexArray = new byte[arrayLength];
-    for (int i = 0; i < arrayLength; i++)
-    {
-      switch (hexBuffer.charAt(pos++))
-      {
-      case '0':
-        hexArray[i] = 0x00;
-        break;
-      case '1':
-        hexArray[i] = 0x10;
-        break;
-      case '2':
-        hexArray[i] = 0x20;
-        break;
-      case '3':
-        hexArray[i] = 0x30;
-        break;
-      case '4':
-        hexArray[i] = 0x40;
-        break;
-      case '5':
-        hexArray[i] = 0x50;
-        break;
-      case '6':
-        hexArray[i] = 0x60;
-        break;
-      case '7':
-        hexArray[i] = 0x70;
-        break;
-      case '8':
-        hexArray[i] = (byte) 0x80;
-        break;
-      case '9':
-        hexArray[i] = (byte) 0x90;
-        break;
-      case 'A':
-      case 'a':
-        hexArray[i] = (byte) 0xA0;
-        break;
-      case 'B':
-      case 'b':
-        hexArray[i] = (byte) 0xB0;
-        break;
-      case 'C':
-      case 'c':
-        hexArray[i] = (byte) 0xC0;
-        break;
-      case 'D':
-      case 'd':
-        hexArray[i] = (byte) 0xD0;
-        break;
-      case 'E':
-      case 'e':
-        hexArray[i] = (byte) 0xE0;
-        break;
-      case 'F':
-      case 'f':
-        hexArray[i] = (byte) 0xF0;
-        break;
-      default:
-        final LocalizableMessage message = ERR_HEX_DECODE_INVALID_CHARACTER
-            .get(hexBuffer, hexBuffer.charAt(pos - 1));
-        throw DecodeException.error(message);
-      }
-
-      switch (hexBuffer.charAt(pos++))
-      {
-      case '0':
-        // No action required.
-        break;
-      case '1':
-        hexArray[i] |= 0x01;
-        break;
-      case '2':
-        hexArray[i] |= 0x02;
-        break;
-      case '3':
-        hexArray[i] |= 0x03;
-        break;
-      case '4':
-        hexArray[i] |= 0x04;
-        break;
-      case '5':
-        hexArray[i] |= 0x05;
-        break;
-      case '6':
-        hexArray[i] |= 0x06;
-        break;
-      case '7':
-        hexArray[i] |= 0x07;
-        break;
-      case '8':
-        hexArray[i] |= 0x08;
-        break;
-      case '9':
-        hexArray[i] |= 0x09;
-        break;
-      case 'A':
-      case 'a':
-        hexArray[i] |= 0x0A;
-        break;
-      case 'B':
-      case 'b':
-        hexArray[i] |= 0x0B;
-        break;
-      case 'C':
-      case 'c':
-        hexArray[i] |= 0x0C;
-        break;
-      case 'D':
-      case 'd':
-        hexArray[i] |= 0x0D;
-        break;
-      case 'E':
-      case 'e':
-        hexArray[i] |= 0x0E;
-        break;
-      case 'F':
-      case 'f':
-        hexArray[i] |= 0x0F;
-        break;
-      default:
-        final LocalizableMessage message = ERR_HEX_DECODE_INVALID_CHARACTER
-            .get(hexBuffer, hexBuffer.charAt(pos - 1));
-        throw DecodeException.error(message);
-      }
-    }
-    try
-    {
-      valueBuffer.append(new String(hexArray, "UTF-8"));
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE
-          .get(reader.getString(), String.valueOf(e));
-      throw DecodeException.error(message);
-    }
-    // Clean up the hex buffer.
-    hexBuffer.setLength(0);
-  }
-
-
-
-  private static ByteString delimitAndEvaluateEscape(
-      final SubstringReader reader) throws DecodeException
-  {
-    char c = '\u0000';
-    final StringBuilder valueBuffer = new StringBuilder();
-    final StringBuilder hexBuffer = new StringBuilder();
-    reader.skipWhitespaces();
-
-    boolean escaped = false;
-    while (reader.remaining() > 0)
-    {
-      c = reader.read();
-      if (escaped)
-      {
-        // This character is escaped.
-        if (isHexDigit(c))
-        {
-          // Unicode characters.
-          if (!(reader.remaining() > 0))
-          {
-            final LocalizableMessage msg = ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID
-                .get(reader.getString());
-            throw DecodeException.error(msg);
-          }
-
-          // Check the next byte for hex.
-          final char c2 = reader.read();
-          if (isHexDigit(c2))
-          {
-            hexBuffer.append(c);
-            hexBuffer.append(c2);
-            // We may be at the end.
-            if (reader.remaining() == 0)
-            {
-              appendHexChars(reader, valueBuffer, hexBuffer);
-            }
-          }
-          else
-          {
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID
-                .get(reader.getString());
+        if ((length % 2) != 0) {
+            final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH.get(hexBuffer);
             throw DecodeException.error(message);
-          }
         }
-        else
-        {
-          appendHexChars(reader, valueBuffer, hexBuffer);
-          valueBuffer.append(c);
+
+        int pos = 0;
+        final int arrayLength = (length / 2);
+        final byte[] hexArray = new byte[arrayLength];
+        for (int i = 0; i < arrayLength; i++) {
+            switch (hexBuffer.charAt(pos++)) {
+            case '0':
+                hexArray[i] = 0x00;
+                break;
+            case '1':
+                hexArray[i] = 0x10;
+                break;
+            case '2':
+                hexArray[i] = 0x20;
+                break;
+            case '3':
+                hexArray[i] = 0x30;
+                break;
+            case '4':
+                hexArray[i] = 0x40;
+                break;
+            case '5':
+                hexArray[i] = 0x50;
+                break;
+            case '6':
+                hexArray[i] = 0x60;
+                break;
+            case '7':
+                hexArray[i] = 0x70;
+                break;
+            case '8':
+                hexArray[i] = (byte) 0x80;
+                break;
+            case '9':
+                hexArray[i] = (byte) 0x90;
+                break;
+            case 'A':
+            case 'a':
+                hexArray[i] = (byte) 0xA0;
+                break;
+            case 'B':
+            case 'b':
+                hexArray[i] = (byte) 0xB0;
+                break;
+            case 'C':
+            case 'c':
+                hexArray[i] = (byte) 0xC0;
+                break;
+            case 'D':
+            case 'd':
+                hexArray[i] = (byte) 0xD0;
+                break;
+            case 'E':
+            case 'e':
+                hexArray[i] = (byte) 0xE0;
+                break;
+            case 'F':
+            case 'f':
+                hexArray[i] = (byte) 0xF0;
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_HEX_DECODE_INVALID_CHARACTER.get(hexBuffer, hexBuffer.charAt(pos - 1));
+                throw DecodeException.error(message);
+            }
+
+            switch (hexBuffer.charAt(pos++)) {
+            case '0':
+                // No action required.
+                break;
+            case '1':
+                hexArray[i] |= 0x01;
+                break;
+            case '2':
+                hexArray[i] |= 0x02;
+                break;
+            case '3':
+                hexArray[i] |= 0x03;
+                break;
+            case '4':
+                hexArray[i] |= 0x04;
+                break;
+            case '5':
+                hexArray[i] |= 0x05;
+                break;
+            case '6':
+                hexArray[i] |= 0x06;
+                break;
+            case '7':
+                hexArray[i] |= 0x07;
+                break;
+            case '8':
+                hexArray[i] |= 0x08;
+                break;
+            case '9':
+                hexArray[i] |= 0x09;
+                break;
+            case 'A':
+            case 'a':
+                hexArray[i] |= 0x0A;
+                break;
+            case 'B':
+            case 'b':
+                hexArray[i] |= 0x0B;
+                break;
+            case 'C':
+            case 'c':
+                hexArray[i] |= 0x0C;
+                break;
+            case 'D':
+            case 'd':
+                hexArray[i] |= 0x0D;
+                break;
+            case 'E':
+            case 'e':
+                hexArray[i] |= 0x0E;
+                break;
+            case 'F':
+            case 'f':
+                hexArray[i] |= 0x0F;
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_HEX_DECODE_INVALID_CHARACTER.get(hexBuffer, hexBuffer.charAt(pos - 1));
+                throw DecodeException.error(message);
+            }
         }
-        escaped = false;
-      }
-      else if (c == 0x5C) // The backslash character
-      {
-        // We found an escape.
-        escaped = true;
-      }
-      else
-      {
-        // Check for delimited chars.
-        if (c == '+' || c == ',' || c == ';')
-        {
-          reader.reset();
-          // Return what we have got here so far.
-          appendHexChars(reader, valueBuffer, hexBuffer);
-          return ByteString.valueOf(valueBuffer.toString());
+        try {
+            valueBuffer.append(new String(hexArray, "UTF-8"));
+        } catch (final Exception e) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), String
+                            .valueOf(e));
+            throw DecodeException.error(message);
         }
-        // It is definitely not a delimiter at this point.
-        appendHexChars(reader, valueBuffer, hexBuffer);
-        valueBuffer.append(c);
-        // reader.mark();
-      }
-      reader.mark();
+        // Clean up the hex buffer.
+        hexBuffer.setLength(0);
     }
 
-    reader.reset();
-    return ByteString.valueOf(valueBuffer.toString());
-  }
+    private static ByteString delimitAndEvaluateEscape(final SubstringReader reader)
+            throws DecodeException {
+        char c = '\u0000';
+        final StringBuilder valueBuffer = new StringBuilder();
+        final StringBuilder hexBuffer = new StringBuilder();
+        reader.skipWhitespaces();
 
-
-
-  private static AttributeType readAttributeName(final SubstringReader reader,
-      final Schema schema)
-  {
-    int length = 1;
-    reader.mark();
-
-    // The next character must be either numeric (for an OID) or
-    // alphabetic (for an attribute description).
-    char c = reader.read();
-    if (isDigit(c))
-    {
-      boolean lastWasPeriod = false;
-      while (reader.remaining() > 0)
-      {
-        c = reader.read();
-
-        if (c == '=' || c == ' ')
-        {
-          // This signals the end of the OID.
-          break;
-        }
-        else if (c == '.')
-        {
-          if (lastWasPeriod)
-          {
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR
-                .get(reader.getString(), c, reader.pos() - 1);
-            throw new LocalizedIllegalArgumentException(message);
-          }
-          else
-          {
-            lastWasPeriod = true;
-          }
-        }
-        else if (!isDigit(c))
-        {
-          // This must have been an illegal character.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR
-              .get(reader.getString(), c, reader.pos() - 1);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-        else
-        {
-          lastWasPeriod = false;
-        }
-        length++;
-      }
-    }
-    else if (isAlpha(c))
-    {
-      // This must be an attribute description. In this case, we will
-      // only accept alphabetic characters, numeric digits, and the hyphen.
-      while (reader.remaining() > 0)
-      {
-        c = reader.read();
-
-        if (c == '=' || c == ' ')
-        {
-          // This signals the end of the OID.
-          break;
-        }
-        else if (!isAlpha(c) && !isDigit(c) && c != '-')
-        {
-          // This is an illegal character.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR
-              .get(reader.getString(), c, reader.pos() - 1);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-
-        length++;
-      }
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR
-          .get(reader.getString(), c, reader.pos() - 1);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    reader.reset();
-
-    // Return the position of the first non-space character after the
-    // token.
-
-    return schema.getAttributeType(reader.read(length));
-  }
-
-
-
-  private static ByteString readAttributeValue(final SubstringReader reader)
-  {
-    // All leading spaces have already been stripped so we can start
-    // reading the value. However, it may be empty so check for that.
-    if (reader.remaining() == 0)
-    {
-      return ByteString.empty();
-    }
-
-    reader.mark();
-
-    // Look at the first character. If it is an octothorpe (#), then
-    // that means that the value should be a hex string.
-    char c = reader.read();
-    int length = 0;
-    if (c == '#')
-    {
-      // The first two characters must be hex characters.
-      reader.mark();
-      if (reader.remaining() < 2)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT
-            .get(reader.getString());
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      for (int i = 0; i < 2; i++)
-      {
-        c = reader.read();
-        if (isHexDigit(c))
-        {
-          length++;
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT
-              .get(reader.getString(), c);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
-
-      // The rest of the value must be a multiple of two hex
-      // characters. The end of the value may be designated by the
-      // end of the DN, a comma or semicolon, or a space.
-      while (reader.remaining() > 0)
-      {
-        c = reader.read();
-        if (isHexDigit(c))
-        {
-          length++;
-
-          if (reader.remaining() > 0)
-          {
+        boolean escaped = false;
+        while (reader.remaining() > 0) {
             c = reader.read();
-            if (isHexDigit(c))
-            {
-              length++;
-            }
-            else
-            {
-              final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT
-                  .get(reader.getString(), c);
-              throw new LocalizedIllegalArgumentException(message);
-            }
-          }
-          else
-          {
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT
-                .get(reader.getString());
-            throw new LocalizedIllegalArgumentException(message);
-          }
-        }
-        else if ((c == ' ') || (c == ',') || (c == ';'))
-        {
-          // This denotes the end of the value.
-          break;
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT
-              .get(reader.getString(), c);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
+            if (escaped) {
+                // This character is escaped.
+                if (isHexDigit(c)) {
+                    // Unicode characters.
+                    if (!(reader.remaining() > 0)) {
+                        final LocalizableMessage msg =
+                                ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID
+                                        .get(reader.getString());
+                        throw DecodeException.error(msg);
+                    }
 
-      // At this point, we should have a valid hex string. Convert it
-      // to a byte array and set that as the value of the provided
-      // octet string.
-      try
-      {
+                    // Check the next byte for hex.
+                    final char c2 = reader.read();
+                    if (isHexDigit(c2)) {
+                        hexBuffer.append(c);
+                        hexBuffer.append(c2);
+                        // We may be at the end.
+                        if (reader.remaining() == 0) {
+                            appendHexChars(reader, valueBuffer, hexBuffer);
+                        }
+                    } else {
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID
+                                        .get(reader.getString());
+                        throw DecodeException.error(message);
+                    }
+                } else {
+                    appendHexChars(reader, valueBuffer, hexBuffer);
+                    valueBuffer.append(c);
+                }
+                escaped = false;
+            } else if (c == 0x5C /* The backslash character */) {
+                // We found an escape.
+                escaped = true;
+            } else {
+                // Check for delimited chars.
+                if (c == '+' || c == ',' || c == ';') {
+                    reader.reset();
+                    // Return what we have got here so far.
+                    appendHexChars(reader, valueBuffer, hexBuffer);
+                    return ByteString.valueOf(valueBuffer.toString());
+                }
+                // It is definitely not a delimiter at this point.
+                appendHexChars(reader, valueBuffer, hexBuffer);
+                valueBuffer.append(c);
+                // reader.mark();
+            }
+            reader.mark();
+        }
+
         reader.reset();
-        return ByteString.wrap(hexStringToByteArray(reader.read(length)));
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE
-            .get(reader.getString(), String.valueOf(e));
-        throw new LocalizedIllegalArgumentException(message);
-      }
+        return ByteString.valueOf(valueBuffer.toString());
     }
 
-    // If the first character is a quotation mark, then the value
-    // should continue until the corresponding closing quotation mark.
-    else if (c == '"')
-    {
-      reader.mark();
-      while (true)
-      {
-        if (reader.remaining() <= 0)
-        {
-          // We hit the end of the AVA before the closing quote.
-          // That's an error.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_UNMATCHED_QUOTE
-              .get(reader.getString());
-          throw new LocalizedIllegalArgumentException(message);
-        }
+    private static AttributeType readAttributeName(final SubstringReader reader, final Schema schema) {
+        int length = 1;
+        reader.mark();
 
-        if (reader.read() == '"')
-        {
-          // This is the end of the value.
-          break;
-        }
-        length++;
-      }
-      reader.reset();
-      final ByteString retString = ByteString.valueOf(reader.read(length));
-      reader.read();
-      return retString;
-    }
+        // The next character must be either numeric (for an OID) or
+        // alphabetic (for an attribute description).
+        char c = reader.read();
+        if (isDigit(c)) {
+            boolean lastWasPeriod = false;
+            while (reader.remaining() > 0) {
+                c = reader.read();
 
-    // Otherwise, use general parsing to find the end of the value.
-    else
-    {
-      reader.reset();
-      ByteString bytes;
-      try
-      {
-        bytes = delimitAndEvaluateEscape(reader);
-      }
-      catch (final DecodeException e)
-      {
-        throw new LocalizedIllegalArgumentException(e.getMessageObject());
-      }
-      if (bytes.length() == 0)
-      {
-        // We don't allow an empty attribute value.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DN_INVALID_REQUIRES_ESCAPE_CHAR
-            .get(reader.getString(), reader.pos());
-        throw new LocalizedIllegalArgumentException(message);
-      }
-      return bytes;
-    }
-  }
-
-
-
-  private final AttributeType attributeType;
-
-  private final ByteString attributeValue;
-
-  // Cached normalized value using equality matching rule.
-  private ByteString equalityNormalizedAttributeValue = null;
-
-  // Cached normalized value using ordering matching rule.
-  private ByteString orderingNormalizedAttributeValue = null;
-
-
-
-  /**
-   * Creates a new attribute value assertion (AVA) using the provided attribute
-   * type and value.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param attributeValue
-   *          The attribute value.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code attributeValue} was
-   *           {@code null}.
-   */
-  public AVA(final AttributeType attributeType, final ByteString attributeValue)
-  {
-    Validator.ensureNotNull(attributeType, attributeValue);
-
-    this.attributeType = attributeType;
-    this.attributeValue = attributeValue;
-  }
-
-
-
-  /**
-   * Creates a new attribute value assertion (AVA) using the provided attribute
-   * type and value decoded using the default schema.
-   * <p>
-   * If {@code attributeValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param attributeValue
-   *          The attribute value.
-   * @throws UnknownSchemaElementException
-   *           If {@code attributeType} was not found in the default schema.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code attributeValue} was
-   *           {@code null}.
-   */
-  public AVA(final String attributeType, final Object attributeValue)
-  {
-    Validator.ensureNotNull(attributeType, attributeValue);
-
-    this.attributeType = Schema.getDefaultSchema().getAttributeType(
-        attributeType);
-    this.attributeValue = ByteString.valueOf(attributeValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int compareTo(final AVA ava)
-  {
-    final int result = attributeType.compareTo(ava.attributeType);
-    if (result != 0)
-    {
-      return result > 0 ? 1 : -1;
-    }
-
-    final ByteString normalizedValue = getOrderingNormalizedValue();
-    final ByteString otherNormalizedValue = ava.getOrderingNormalizedValue();
-    final MatchingRule rule = attributeType.getOrderingMatchingRule();
-    if (rule != null)
-    {
-      final Comparator<ByteSequence> comparator = rule.comparator();
-      return comparator.compare(normalizedValue, otherNormalizedValue);
-    }
-    else
-    {
-      return normalizedValue.compareTo(otherNormalizedValue);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
-    }
-    else if (obj instanceof AVA)
-    {
-      final AVA ava = (AVA) obj;
-
-      if (!attributeType.equals(ava.attributeType))
-      {
-        return false;
-      }
-
-      final ByteString normalizedValue = getEqualityNormalizedValue();
-      final ByteString otherNormalizedValue = ava.getEqualityNormalizedValue();
-      final MatchingRule rule = attributeType.getEqualityMatchingRule();
-      if (rule != null)
-      {
-        final Comparator<ByteSequence> comparator = rule.comparator();
-        return comparator.compare(normalizedValue, otherNormalizedValue) != 0 ? false
-            : true;
-      }
-      else
-      {
-        return normalizedValue.equals(otherNormalizedValue);
-      }
-    }
-    else
-    {
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Returns the attribute type associated with this AVA.
-   *
-   * @return The attribute type associated with this AVA.
-   */
-  public AttributeType getAttributeType()
-  {
-    return attributeType;
-  }
-
-
-
-  /**
-   * Returns the attribute value associated with this AVA.
-   *
-   * @return The attribute value associated with this AVA.
-   */
-  public ByteString getAttributeValue()
-  {
-    return attributeValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return attributeType.hashCode() * 31
-        + getEqualityNormalizedValue().hashCode();
-  }
-
-
-
-  /**
-   * Returns a single valued attribute having the same attribute type and value
-   * as this AVA.
-   *
-   * @return A single valued attribute having the same attribute type and value
-   *         as this AVA.
-   */
-  public Attribute toAttribute()
-  {
-    AttributeDescription ad = AttributeDescription.create(attributeType);
-    return new LinkedAttribute(ad, attributeValue);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    return toString(builder).toString();
-  }
-
-
-
-  StringBuilder toString(final StringBuilder builder)
-  {
-    if (!attributeType.getNames().iterator().hasNext())
-    {
-      builder.append(attributeType.getOID());
-      builder.append("=#");
-      StaticUtils.toHex(attributeValue, builder);
-    }
-    else
-    {
-      final String name = attributeType.getNameOrOID();
-      builder.append(name);
-      builder.append("=");
-
-      final Syntax syntax = attributeType.getSyntax();
-      if (!syntax.isHumanReadable())
-      {
-        builder.append("#");
-        StaticUtils.toHex(attributeValue, builder);
-      }
-      else
-      {
-        final String str = attributeValue.toString();
-        if (str.length() == 0)
-        {
-          return builder;
-        }
-        char c = str.charAt(0);
-        int startPos = 0;
-        if ((c == ' ') || (c == '#'))
-        {
-          builder.append('\\');
-          builder.append(c);
-          startPos = 1;
-        }
-        final int length = str.length();
-        for (int si = startPos; si < length; si++)
-        {
-          c = str.charAt(si);
-          if (c < ' ')
-          {
-            for (final byte b : getBytes(String.valueOf(c)))
-            {
-              builder.append('\\');
-              builder.append(StaticUtils.byteToLowerHex(b));
+                if (c == '=' || c == ' ') {
+                    // This signals the end of the OID.
+                    break;
+                } else if (c == '.') {
+                    if (lastWasPeriod) {
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c,
+                                        reader.pos() - 1);
+                        throw new LocalizedIllegalArgumentException(message);
+                    } else {
+                        lastWasPeriod = true;
+                    }
+                } else if (!isDigit(c)) {
+                    // This must have been an illegal character.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, reader
+                                    .pos() - 1);
+                    throw new LocalizedIllegalArgumentException(message);
+                } else {
+                    lastWasPeriod = false;
+                }
+                length++;
             }
-          }
-          else
-          {
-            if ((c == ' ' && si == length - 1)
-                || (c == '"' || c == '+' || c == ',' || c == ';' || c == '<'
-                    || c == '=' || c == '>' || c == '\\' || c == '\u0000'))
-            {
-              builder.append('\\');
+        } else if (isAlpha(c)) {
+            // This must be an attribute description. In this case, we will
+            // only accept alphabetic characters, numeric digits, and the
+            // hyphen.
+            while (reader.remaining() > 0) {
+                c = reader.read();
+
+                if (c == '=' || c == ' ') {
+                    // This signals the end of the OID.
+                    break;
+                } else if (!isAlpha(c) && !isDigit(c) && c != '-') {
+                    // This is an illegal character.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, reader
+                                    .pos() - 1);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                length++;
             }
-            builder.append(c);
-          }
+        } else {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c,
+                            reader.pos() - 1);
+            throw new LocalizedIllegalArgumentException(message);
         }
-      }
-    }
-    return builder;
-  }
 
+        reader.reset();
 
+        // Return the position of the first non-space character after the
+        // token.
 
-  private ByteString getEqualityNormalizedValue()
-  {
-    final ByteString normalizedValue = equalityNormalizedAttributeValue;
-
-    if (normalizedValue != null)
-    {
-      return normalizedValue;
+        return schema.getAttributeType(reader.read(length));
     }
 
-    final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
-    if (matchingRule != null)
-    {
-      try
-      {
-        equalityNormalizedAttributeValue = matchingRule
-            .normalizeAttributeValue(attributeValue);
-      }
-      catch (final DecodeException de)
-      {
-        // Unable to normalize, so default to byte-wise comparison.
-        equalityNormalizedAttributeValue = attributeValue;
-      }
-    }
-    else
-    {
-      // No matching rule, so default to byte-wise comparison.
-      equalityNormalizedAttributeValue = attributeValue;
+    private static ByteString readAttributeValue(final SubstringReader reader) {
+        // All leading spaces have already been stripped so we can start
+        // reading the value. However, it may be empty so check for that.
+        if (reader.remaining() == 0) {
+            return ByteString.empty();
+        }
+
+        reader.mark();
+
+        // Look at the first character. If it is an octothorpe (#), then
+        // that means that the value should be a hex string.
+        char c = reader.read();
+        int length = 0;
+        if (c == '#') {
+            // The first two characters must be hex characters.
+            reader.mark();
+            if (reader.remaining() < 2) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString());
+                throw new LocalizedIllegalArgumentException(message);
+            }
+
+            for (int i = 0; i < 2; i++) {
+                c = reader.read();
+                if (isHexDigit(c)) {
+                    length++;
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
+
+            // The rest of the value must be a multiple of two hex
+            // characters. The end of the value may be designated by the
+            // end of the DN, a comma or semicolon, or a space.
+            while (reader.remaining() > 0) {
+                c = reader.read();
+                if (isHexDigit(c)) {
+                    length++;
+
+                    if (reader.remaining() > 0) {
+                        c = reader.read();
+                        if (isHexDigit(c)) {
+                            length++;
+                        } else {
+                            final LocalizableMessage message =
+                                    ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c);
+                            throw new LocalizedIllegalArgumentException(message);
+                        }
+                    } else {
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString());
+                        throw new LocalizedIllegalArgumentException(message);
+                    }
+                } else if ((c == ' ') || (c == ',') || (c == ';')) {
+                    // This denotes the end of the value.
+                    break;
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
+
+            // At this point, we should have a valid hex string. Convert it
+            // to a byte array and set that as the value of the provided
+            // octet string.
+            try {
+                reader.reset();
+                return ByteString.wrap(hexStringToByteArray(reader.read(length)));
+            } catch (final Exception e) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), String
+                                .valueOf(e));
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        } else if (c == '"') {
+            // If the first character is a quotation mark, then the value
+            // should continue until the corresponding closing quotation mark.
+            reader.mark();
+            while (true) {
+                if (reader.remaining() <= 0) {
+                    // We hit the end of the AVA before the closing quote.
+                    // That's an error.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DN_UNMATCHED_QUOTE.get(reader.getString());
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                if (reader.read() == '"') {
+                    // This is the end of the value.
+                    break;
+                }
+                length++;
+            }
+            reader.reset();
+            final ByteString retString = ByteString.valueOf(reader.read(length));
+            reader.read();
+            return retString;
+        } else {
+            // Otherwise, use general parsing to find the end of the value.
+            reader.reset();
+            ByteString bytes;
+            try {
+                bytes = delimitAndEvaluateEscape(reader);
+            } catch (final DecodeException e) {
+                throw new LocalizedIllegalArgumentException(e.getMessageObject());
+            }
+            if (bytes.length() == 0) {
+                // We don't allow an empty attribute value.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DN_INVALID_REQUIRES_ESCAPE_CHAR.get(reader.getString(),
+                                reader.pos());
+                throw new LocalizedIllegalArgumentException(message);
+            }
+            return bytes;
+        }
     }
 
-    return equalityNormalizedAttributeValue;
-  }
+    private final AttributeType attributeType;
 
+    private final ByteString attributeValue;
 
+    // Cached normalized value using equality matching rule.
+    private ByteString equalityNormalizedAttributeValue = null;
 
-  private ByteString getOrderingNormalizedValue()
-  {
-    final ByteString normalizedValue = orderingNormalizedAttributeValue;
+    // Cached normalized value using ordering matching rule.
+    private ByteString orderingNormalizedAttributeValue = null;
 
-    if (normalizedValue != null)
-    {
-      return normalizedValue;
+    /**
+     * Creates a new attribute value assertion (AVA) using the provided
+     * attribute type and value.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param attributeValue
+     *            The attribute value.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code attributeValue} was
+     *             {@code null}.
+     */
+    public AVA(final AttributeType attributeType, final ByteString attributeValue) {
+        Validator.ensureNotNull(attributeType, attributeValue);
+
+        this.attributeType = attributeType;
+        this.attributeValue = attributeValue;
     }
 
-    final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
-    if (matchingRule != null)
-    {
-      try
-      {
-        orderingNormalizedAttributeValue = matchingRule
-            .normalizeAttributeValue(attributeValue);
-      }
-      catch (final DecodeException de)
-      {
-        // Unable to normalize, so default to equality matching.
-        orderingNormalizedAttributeValue = getEqualityNormalizedValue();
-      }
-    }
-    else
-    {
-      // No matching rule, so default to equality matching.
-      orderingNormalizedAttributeValue = getEqualityNormalizedValue();
+    /**
+     * Creates a new attribute value assertion (AVA) using the provided
+     * attribute type and value decoded using the default schema.
+     * <p>
+     * If {@code attributeValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param attributeValue
+     *            The attribute value.
+     * @throws UnknownSchemaElementException
+     *             If {@code attributeType} was not found in the default schema.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code attributeValue} was
+     *             {@code null}.
+     */
+    public AVA(final String attributeType, final Object attributeValue) {
+        Validator.ensureNotNull(attributeType, attributeValue);
+
+        this.attributeType = Schema.getDefaultSchema().getAttributeType(attributeType);
+        this.attributeValue = ByteString.valueOf(attributeValue);
     }
 
-    return orderingNormalizedAttributeValue;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int compareTo(final AVA ava) {
+        final int result = attributeType.compareTo(ava.attributeType);
+        if (result != 0) {
+            return result > 0 ? 1 : -1;
+        }
+
+        final ByteString normalizedValue = getOrderingNormalizedValue();
+        final ByteString otherNormalizedValue = ava.getOrderingNormalizedValue();
+        final MatchingRule rule = attributeType.getOrderingMatchingRule();
+        if (rule != null) {
+            final Comparator<ByteSequence> comparator = rule.comparator();
+            return comparator.compare(normalizedValue, otherNormalizedValue);
+        } else {
+            return normalizedValue.compareTo(otherNormalizedValue);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof AVA) {
+            final AVA ava = (AVA) obj;
+
+            if (!attributeType.equals(ava.attributeType)) {
+                return false;
+            }
+
+            final ByteString normalizedValue = getEqualityNormalizedValue();
+            final ByteString otherNormalizedValue = ava.getEqualityNormalizedValue();
+            final MatchingRule rule = attributeType.getEqualityMatchingRule();
+            if (rule != null) {
+                final Comparator<ByteSequence> comparator = rule.comparator();
+                return comparator.compare(normalizedValue, otherNormalizedValue) != 0 ? false
+                        : true;
+            } else {
+                return normalizedValue.equals(otherNormalizedValue);
+            }
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns the attribute type associated with this AVA.
+     *
+     * @return The attribute type associated with this AVA.
+     */
+    public AttributeType getAttributeType() {
+        return attributeType;
+    }
+
+    /**
+     * Returns the attribute value associated with this AVA.
+     *
+     * @return The attribute value associated with this AVA.
+     */
+    public ByteString getAttributeValue() {
+        return attributeValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return attributeType.hashCode() * 31 + getEqualityNormalizedValue().hashCode();
+    }
+
+    /**
+     * Returns a single valued attribute having the same attribute type and
+     * value as this AVA.
+     *
+     * @return A single valued attribute having the same attribute type and
+     *         value as this AVA.
+     */
+    public Attribute toAttribute() {
+        AttributeDescription ad = AttributeDescription.create(attributeType);
+        return new LinkedAttribute(ad, attributeValue);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        return toString(builder).toString();
+    }
+
+    StringBuilder toString(final StringBuilder builder) {
+        if (!attributeType.getNames().iterator().hasNext()) {
+            builder.append(attributeType.getOID());
+            builder.append("=#");
+            StaticUtils.toHex(attributeValue, builder);
+        } else {
+            final String name = attributeType.getNameOrOID();
+            builder.append(name);
+            builder.append("=");
+
+            final Syntax syntax = attributeType.getSyntax();
+            if (!syntax.isHumanReadable()) {
+                builder.append("#");
+                StaticUtils.toHex(attributeValue, builder);
+            } else {
+                final String str = attributeValue.toString();
+                if (str.length() == 0) {
+                    return builder;
+                }
+                char c = str.charAt(0);
+                int startPos = 0;
+                if ((c == ' ') || (c == '#')) {
+                    builder.append('\\');
+                    builder.append(c);
+                    startPos = 1;
+                }
+                final int length = str.length();
+                for (int si = startPos; si < length; si++) {
+                    c = str.charAt(si);
+                    if (c < ' ') {
+                        for (final byte b : getBytes(String.valueOf(c))) {
+                            builder.append('\\');
+                            builder.append(StaticUtils.byteToLowerHex(b));
+                        }
+                    } else {
+                        if ((c == ' ' && si == length - 1)
+                                || (c == '"' || c == '+' || c == ',' || c == ';' || c == '<'
+                                        || c == '=' || c == '>' || c == '\\' || c == '\u0000')) {
+                            builder.append('\\');
+                        }
+                        builder.append(c);
+                    }
+                }
+            }
+        }
+        return builder;
+    }
+
+    private ByteString getEqualityNormalizedValue() {
+        final ByteString normalizedValue = equalityNormalizedAttributeValue;
+
+        if (normalizedValue != null) {
+            return normalizedValue;
+        }
+
+        final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
+        if (matchingRule != null) {
+            try {
+                equalityNormalizedAttributeValue =
+                        matchingRule.normalizeAttributeValue(attributeValue);
+            } catch (final DecodeException de) {
+                // Unable to normalize, so default to byte-wise comparison.
+                equalityNormalizedAttributeValue = attributeValue;
+            }
+        } else {
+            // No matching rule, so default to byte-wise comparison.
+            equalityNormalizedAttributeValue = attributeValue;
+        }
+
+        return equalityNormalizedAttributeValue;
+    }
+
+    private ByteString getOrderingNormalizedValue() {
+        final ByteString normalizedValue = orderingNormalizedAttributeValue;
+
+        if (normalizedValue != null) {
+            return normalizedValue;
+        }
+
+        final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
+        if (matchingRule != null) {
+            try {
+                orderingNormalizedAttributeValue =
+                        matchingRule.normalizeAttributeValue(attributeValue);
+            } catch (final DecodeException de) {
+                // Unable to normalize, so default to equality matching.
+                orderingNormalizedAttributeValue = getEqualityNormalizedValue();
+            }
+        } else {
+            // No matching rule, so default to equality matching.
+            orderingNormalizedAttributeValue = getEqualityNormalizedValue();
+        }
+
+        return orderingNormalizedAttributeValue;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java
index f223ed7..c9827a2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,200 +27,150 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
-import org.forgerock.opendj.ldap.requests.*;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
 import org.forgerock.opendj.ldap.responses.CompareResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * An abstract connection whose synchronous methods are implemented in terms of
  * asynchronous methods.
  */
-public abstract class AbstractAsynchronousConnection extends AbstractConnection
-{
+public abstract class AbstractAsynchronousConnection extends AbstractConnection {
 
-  /**
-   * Creates a new abstract asynchronous connection.
-   */
-  protected AbstractAsynchronousConnection()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result add(final AddRequest request) throws ErrorResultException,
-      InterruptedException
-  {
-    final FutureResult<Result> future = addAsync(request, null, null);
-    try
-    {
-      return future.get();
+    /**
+     * Creates a new abstract asynchronous connection.
+     */
+    protected AbstractAsynchronousConnection() {
+        // No implementation required.
     }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result add(final AddRequest request) throws ErrorResultException, InterruptedException {
+        final FutureResult<Result> future = addAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public BindResult bind(final BindRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final FutureResult<BindResult> future = bindAsync(request, null, null);
-    try
-    {
-      return future.get();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BindResult bind(final BindRequest request) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<BindResult> future = bindAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CompareResult compare(final CompareRequest request) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<CompareResult> future = compareAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public CompareResult compare(final CompareRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final FutureResult<CompareResult> future = compareAsync(request, null, null);
-    try
-    {
-      return future.get();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result delete(final DeleteRequest request) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<Result> future = deleteAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
+            final IntermediateResponseHandler handler) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<R> future = extendedRequestAsync(request, handler, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result delete(final DeleteRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final FutureResult<Result> future = deleteAsync(request, null, null);
-    try
-    {
-      return future.get();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result modify(final ModifyRequest request) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<Result> future = modifyAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException,
+            InterruptedException {
+        final FutureResult<Result> future = modifyDNAsync(request, null, null);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <R extends ExtendedResult> R extendedRequest(
-      final ExtendedRequest<R> request,
-      final IntermediateResponseHandler handler) throws ErrorResultException,
-      InterruptedException
-  {
-    final FutureResult<R> future = extendedRequestAsync(request, handler, null);
-    try
-    {
-      return future.get();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result search(final SearchRequest request, final SearchResultHandler handler)
+            throws ErrorResultException, InterruptedException {
+        final FutureResult<Result> future = searchAsync(request, null, handler);
+        try {
+            return future.get();
+        } finally {
+            // Cancel the request if it hasn't completed.
+            future.cancel(false);
+        }
     }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result modify(final ModifyRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final FutureResult<Result> future = modifyAsync(request, null, null);
-    try
-    {
-      return future.get();
-    }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result modifyDN(final ModifyDNRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final FutureResult<Result> future = modifyDNAsync(request, null, null);
-    try
-    {
-      return future.get();
-    }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final SearchResultHandler handler) throws ErrorResultException,
-      InterruptedException
-  {
-    final FutureResult<Result> future = searchAsync(request, null, handler);
-    try
-    {
-      return future.get();
-    }
-    finally
-    {
-      // Cancel the request if it hasn't completed.
-      future.cancel(false);
-    }
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java
index d2423d0..81dec63 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,461 +27,351 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
-import java.util.*;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.MatchingRule;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class provides a skeletal implementation of the {@code Attribute}
  * interface, to minimize the effort required to implement this interface.
  */
-public abstract class AbstractAttribute extends AbstractSet<ByteString>
-    implements Attribute
-{
+public abstract class AbstractAttribute extends AbstractSet<ByteString> implements Attribute {
 
-  /**
-   * Returns {@code true} if {@code object} is an attribute which is equal to
-   * {@code attribute}. Two attributes are considered equal if their attribute
-   * descriptions are equal, they both have the same number of attribute values,
-   * and every attribute value contained in the first attribute is also
-   * contained in the second attribute.
-   *
-   * @param attribute
-   *          The attribute to be tested for equality.
-   * @param object
-   *          The object to be tested for equality with the attribute.
-   * @return {@code true} if {@code object} is an attribute which is equal to
-   *         {@code attribute}, or {@code false} if not.
-   */
-  static boolean equals(final Attribute attribute, final Object object)
-  {
-    if (attribute == object)
-    {
-      return true;
-    }
-
-    if (!(object instanceof Attribute))
-    {
-      return false;
-    }
-
-    final Attribute other = (Attribute) object;
-    if (!attribute.getAttributeDescription().equals(
-        other.getAttributeDescription()))
-    {
-      return false;
-    }
-
-    // Attribute description is the same, compare values.
-    if (attribute.size() != other.size())
-    {
-      return false;
-    }
-
-    return attribute.containsAll(other);
-  }
-
-
-
-  /**
-   * Returns the hash code for {@code attribute}. It will be calculated as the
-   * sum of the hash codes of the attribute description and all of the attribute
-   * values.
-   *
-   * @param attribute
-   *          The attribute whose hash code should be calculated.
-   * @return The hash code for {@code attribute}.
-   */
-  static int hashCode(final Attribute attribute)
-  {
-    int hashCode = attribute.getAttributeDescription().hashCode();
-    for (final ByteString value : attribute)
-    {
-      hashCode += normalizeValue(attribute, value).hashCode();
-    }
-    return hashCode;
-  }
-
-
-
-  /**
-   * Returns the normalized form of {@code value} normalized using {@code
-   * attribute}'s equality matching rule.
-   *
-   * @param attribute
-   *          The attribute whose equality matching rule should be used for
-   *          normalization.
-   * @param value
-   *          The attribute value to be normalized.
-   * @return The normalized form of {@code value} normalized using {@code
-   *         attribute}'s equality matching rule.
-   */
-  static ByteString normalizeValue(final Attribute attribute,
-      final ByteString value)
-  {
-    final AttributeDescription attributeDescription = attribute
-        .getAttributeDescription();
-    final AttributeType attributeType = attributeDescription.getAttributeType();
-    final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
-
-    try
-    {
-      return matchingRule.normalizeAttributeValue(value);
-    }
-    catch (final Exception e)
-    {
-      // Fall back to provided value.
-      return value;
-    }
-  }
-
-
-
-  /**
-   * Returns a string representation of {@code attribute}.
-   *
-   * @param attribute
-   *          The attribute whose string representation should be returned.
-   * @return The string representation of {@code attribute}.
-   */
-  static String toString(final Attribute attribute)
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("Attribute(");
-    builder.append(attribute.getAttributeDescriptionAsString());
-    builder.append(", {");
-
-    boolean firstValue = true;
-    for (final ByteString value : attribute)
-    {
-      if (!firstValue)
-      {
-        builder.append(", ");
-      }
-
-      builder.append(value);
-      firstValue = false;
-    }
-
-    builder.append("})");
-    return builder.toString();
-  }
-
-
-
-  /**
-   * Sole constructor.
-   */
-  protected AbstractAttribute()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract boolean add(ByteString value);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean add(final Object firstValue, final Object... remainingValues)
-  {
-    Validator.ensureNotNull(firstValue);
-
-    boolean modified = add(ByteString.valueOf(firstValue));
-    if (remainingValues != null)
-    {
-      for (final Object value : remainingValues)
-      {
-        modified |= add(ByteString.valueOf(value));
-      }
-    }
-    return modified;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean addAll(final Collection<? extends ByteString> values)
-  {
-    return addAll(values, null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAll(final Collection<? extends ByteString> values,
-      final Collection<? super ByteString> duplicateValues)
-  {
-    boolean modified = false;
-    for (final ByteString value : values)
-    {
-      if (add(value))
-      {
-        modified = true;
-      }
-      else if (duplicateValues != null)
-      {
-        duplicateValues.add(value);
-      }
-    }
-    return modified;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract boolean contains(Object value);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean containsAll(final Collection<?> values)
-  {
-    for (final Object value : values)
-    {
-      if (!contains(value))
-      {
-        return false;
-      }
-    }
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object object)
-  {
-    return equals(this, object);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString firstValue()
-  {
-    return iterator().next();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String firstValueAsString()
-  {
-    return firstValue().toString();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract AttributeDescription getAttributeDescription();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getAttributeDescriptionAsString()
-  {
-    return getAttributeDescription().toString();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return hashCode(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract Iterator<ByteString> iterator();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract boolean remove(Object value);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean removeAll(final Collection<?> values)
-  {
-    return removeAll(values, null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public <T> boolean removeAll(final Collection<T> values,
-      final Collection<? super T> missingValues)
-  {
-    boolean modified = false;
-    for (final T value : values)
-    {
-      if (remove(value))
-      {
-        modified = true;
-      }
-      else if (missingValues != null)
-      {
-        missingValues.add(value);
-      }
-    }
-    return modified;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean retainAll(final Collection<?> values)
-  {
-    return retainAll(values, null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public <T> boolean retainAll(final Collection<T> values,
-      final Collection<? super T> missingValues)
-  {
-    if (values.isEmpty())
-    {
-      if (isEmpty())
-      {
-        return false;
-      }
-      else
-      {
-        clear();
-        return true;
-      }
-    }
-
-    if (isEmpty())
-    {
-      if (missingValues != null)
-      {
-        for (final T value : values)
-        {
-          missingValues.add(value);
+    /**
+     * Returns {@code true} if {@code object} is an attribute which is equal to
+     * {@code attribute}. Two attributes are considered equal if their attribute
+     * descriptions are equal, they both have the same number of attribute
+     * values, and every attribute value contained in the first attribute is
+     * also contained in the second attribute.
+     *
+     * @param attribute
+     *            The attribute to be tested for equality.
+     * @param object
+     *            The object to be tested for equality with the attribute.
+     * @return {@code true} if {@code object} is an attribute which is equal to
+     *         {@code attribute}, or {@code false} if not.
+     */
+    static boolean equals(final Attribute attribute, final Object object) {
+        if (attribute == object) {
+            return true;
         }
-      }
-      return false;
+
+        if (!(object instanceof Attribute)) {
+            return false;
+        }
+
+        final Attribute other = (Attribute) object;
+        if (!attribute.getAttributeDescription().equals(other.getAttributeDescription())) {
+            return false;
+        }
+
+        // Attribute description is the same, compare values.
+        if (attribute.size() != other.size()) {
+            return false;
+        }
+
+        return attribute.containsAll(other);
     }
 
-    final Map<ByteString, T> valuesToRetain = new HashMap<ByteString, T>(values
-        .size());
-    for (final T value : values)
-    {
-      valuesToRetain
-          .put(normalizeValue(this, ByteString.valueOf(value)), value);
+    /**
+     * Returns the hash code for {@code attribute}. It will be calculated as the
+     * sum of the hash codes of the attribute description and all of the
+     * attribute values.
+     *
+     * @param attribute
+     *            The attribute whose hash code should be calculated.
+     * @return The hash code for {@code attribute}.
+     */
+    static int hashCode(final Attribute attribute) {
+        int hashCode = attribute.getAttributeDescription().hashCode();
+        for (final ByteString value : attribute) {
+            hashCode += normalizeValue(attribute, value).hashCode();
+        }
+        return hashCode;
     }
 
-    boolean modified = false;
-    final Iterator<ByteString> iterator = iterator();
-    while (iterator.hasNext())
-    {
-      final ByteString value = iterator.next();
-      final ByteString normalizedValue = normalizeValue(this, value);
-      if (valuesToRetain.remove(normalizedValue) == null)
-      {
-        modified = true;
-        iterator.remove();
-      }
+    /**
+     * Returns the normalized form of {@code value} normalized using
+     * {@code attribute}'s equality matching rule.
+     *
+     * @param attribute
+     *            The attribute whose equality matching rule should be used for
+     *            normalization.
+     * @param value
+     *            The attribute value to be normalized.
+     * @return The normalized form of {@code value} normalized using
+     *         {@code attribute}'s equality matching rule.
+     */
+    static ByteString normalizeValue(final Attribute attribute, final ByteString value) {
+        final AttributeDescription attributeDescription = attribute.getAttributeDescription();
+        final AttributeType attributeType = attributeDescription.getAttributeType();
+        final MatchingRule matchingRule = attributeType.getEqualityMatchingRule();
+
+        try {
+            return matchingRule.normalizeAttributeValue(value);
+        } catch (final Exception e) {
+            // Fall back to provided value.
+            return value;
+        }
     }
 
-    if (missingValues != null)
-    {
-      missingValues.addAll(valuesToRetain.values());
+    /**
+     * Returns a string representation of {@code attribute}.
+     *
+     * @param attribute
+     *            The attribute whose string representation should be returned.
+     * @return The string representation of {@code attribute}.
+     */
+    static String toString(final Attribute attribute) {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("Attribute(");
+        builder.append(attribute.getAttributeDescriptionAsString());
+        builder.append(", {");
+
+        boolean firstValue = true;
+        for (final ByteString value : attribute) {
+            if (!firstValue) {
+                builder.append(", ");
+            }
+
+            builder.append(value);
+            firstValue = false;
+        }
+
+        builder.append("})");
+        return builder.toString();
     }
 
-    return modified;
-  }
+    /**
+     * Sole constructor.
+     */
+    protected AbstractAttribute() {
+        // No implementation required.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract boolean add(ByteString value);
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean add(final Object firstValue, final Object... remainingValues) {
+        Validator.ensureNotNull(firstValue);
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract int size();
+        boolean modified = add(ByteString.valueOf(firstValue));
+        if (remainingValues != null) {
+            for (final Object value : remainingValues) {
+                modified |= add(ByteString.valueOf(value));
+            }
+        }
+        return modified;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean addAll(final Collection<? extends ByteString> values) {
+        return addAll(values, null);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAll(final Collection<? extends ByteString> values,
+            final Collection<? super ByteString> duplicateValues) {
+        boolean modified = false;
+        for (final ByteString value : values) {
+            if (add(value)) {
+                modified = true;
+            } else if (duplicateValues != null) {
+                duplicateValues.add(value);
+            }
+        }
+        return modified;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString[] toArray()
-  {
-    return toArray(new ByteString[size()]);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract boolean contains(Object value);
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean containsAll(final Collection<?> values) {
+        for (final Object value : values) {
+            if (!contains(value)) {
+                return false;
+            }
+        }
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object object) {
+        return equals(this, object);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return toString(this);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString firstValue() {
+        return iterator().next();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String firstValueAsString() {
+        return firstValue().toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public abstract AttributeDescription getAttributeDescription();
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getAttributeDescriptionAsString() {
+        return getAttributeDescription().toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return hashCode(this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract Iterator<ByteString> iterator();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract boolean remove(Object value);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean removeAll(final Collection<?> values) {
+        return removeAll(values, null);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> boolean removeAll(final Collection<T> values,
+            final Collection<? super T> missingValues) {
+        boolean modified = false;
+        for (final T value : values) {
+            if (remove(value)) {
+                modified = true;
+            } else if (missingValues != null) {
+                missingValues.add(value);
+            }
+        }
+        return modified;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean retainAll(final Collection<?> values) {
+        return retainAll(values, null);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> boolean retainAll(final Collection<T> values,
+            final Collection<? super T> missingValues) {
+        if (values.isEmpty()) {
+            if (isEmpty()) {
+                return false;
+            } else {
+                clear();
+                return true;
+            }
+        }
+
+        if (isEmpty()) {
+            if (missingValues != null) {
+                for (final T value : values) {
+                    missingValues.add(value);
+                }
+            }
+            return false;
+        }
+
+        final Map<ByteString, T> valuesToRetain = new HashMap<ByteString, T>(values.size());
+        for (final T value : values) {
+            valuesToRetain.put(normalizeValue(this, ByteString.valueOf(value)), value);
+        }
+
+        boolean modified = false;
+        final Iterator<ByteString> iterator = iterator();
+        while (iterator.hasNext()) {
+            final ByteString value = iterator.next();
+            final ByteString normalizedValue = normalizeValue(this, value);
+            if (valuesToRetain.remove(normalizedValue) == null) {
+                modified = true;
+                iterator.remove();
+            }
+        }
+
+        if (missingValues != null) {
+            missingValues.addAll(valuesToRetain.values());
+        }
+
+        return modified;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract int size();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString[] toArray() {
+        return toArray(new ByteString[size()]);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return toString(this);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
index 9d8d19b..00a384c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_NO_SEARCH_RESULT_ENTRIES;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_UNEXPECTED_SEARCH_RESULT_REFERENCES;
@@ -39,609 +36,441 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.forgerock.opendj.ldif.ConnectionEntryReader;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class provides a skeletal implementation of the {@code Connection}
  * interface, to minimize the effort required to implement this interface.
  */
-public abstract class AbstractConnection implements Connection
-{
+public abstract class AbstractConnection implements Connection {
 
-  private static final class SingleEntryFuture implements
-      FutureResult<SearchResultEntry>, SearchResultHandler
-  {
-    private final ResultHandler<? super SearchResultEntry> handler;
+    private static final class SingleEntryFuture implements FutureResult<SearchResultEntry>,
+            SearchResultHandler {
+        private final ResultHandler<? super SearchResultEntry> handler;
 
-    private volatile SearchResultEntry firstEntry = null;
+        private volatile SearchResultEntry firstEntry = null;
 
-    private volatile SearchResultReference firstReference = null;
+        private volatile SearchResultReference firstReference = null;
 
-    private volatile int entryCount = 0;
+        private volatile int entryCount = 0;
 
-    private volatile FutureResult<Result> future = null;
+        private volatile FutureResult<Result> future = null;
 
-
-
-    private SingleEntryFuture(
-        final ResultHandler<? super SearchResultEntry> handler)
-    {
-      this.handler = handler;
-    }
-
-
-
-    @Override
-    public boolean cancel(final boolean mayInterruptIfRunning)
-    {
-      return future.cancel(mayInterruptIfRunning);
-    }
-
-
-
-    @Override
-    public SearchResultEntry get() throws ErrorResultException,
-        InterruptedException
-    {
-      future.get();
-      return get0();
-    }
-
-
-
-    @Override
-    public SearchResultEntry get(final long timeout, final TimeUnit unit)
-        throws ErrorResultException, TimeoutException, InterruptedException
-    {
-      future.get(timeout, unit);
-      return get0();
-    }
-
-
-
-    @Override
-    public int getRequestID()
-    {
-      return future.getRequestID();
-    }
-
-
-
-    @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      if (firstEntry == null)
-      {
-        firstEntry = entry;
-      }
-      entryCount++;
-      return true;
-    }
-
-
-
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      if (handler != null)
-      {
-        handler.handleErrorResult(error);
-      }
-    }
-
-
-
-    @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      if (firstReference == null)
-      {
-        firstReference = reference;
-      }
-      return true;
-    }
-
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      if (handler != null)
-      {
-        try
-        {
-          handler.handleResult(get0());
+        private SingleEntryFuture(final ResultHandler<? super SearchResultEntry> handler) {
+            this.handler = handler;
         }
-        catch (final ErrorResultException e)
-        {
-          handler.handleErrorResult(e);
+
+        @Override
+        public boolean cancel(final boolean mayInterruptIfRunning) {
+            return future.cancel(mayInterruptIfRunning);
         }
-      }
+
+        @Override
+        public SearchResultEntry get() throws ErrorResultException, InterruptedException {
+            future.get();
+            return get0();
+        }
+
+        @Override
+        public SearchResultEntry get(final long timeout, final TimeUnit unit)
+                throws ErrorResultException, TimeoutException, InterruptedException {
+            future.get(timeout, unit);
+            return get0();
+        }
+
+        @Override
+        public int getRequestID() {
+            return future.getRequestID();
+        }
+
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            if (firstEntry == null) {
+                firstEntry = entry;
+            }
+            entryCount++;
+            return true;
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            if (handler != null) {
+                handler.handleErrorResult(error);
+            }
+        }
+
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            if (firstReference == null) {
+                firstReference = reference;
+            }
+            return true;
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            if (handler != null) {
+                try {
+                    handler.handleResult(get0());
+                } catch (final ErrorResultException e) {
+                    handler.handleErrorResult(e);
+                }
+            }
+        }
+
+        @Override
+        public boolean isCancelled() {
+            return future.isCancelled();
+        }
+
+        @Override
+        public boolean isDone() {
+            return future.isDone();
+        }
+
+        private SearchResultEntry get0() throws ErrorResultException {
+            if (entryCount == 0) {
+                // Did not find any entries.
+                throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
+                        ERR_NO_SEARCH_RESULT_ENTRIES.get().toString());
+            } else if (entryCount > 1) {
+                // Got more entries than expected.
+                throw newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
+                        ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES.get(entryCount).toString());
+            } else if (firstReference != null) {
+                // Got an unexpected search result reference.
+                throw newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
+                        ERR_UNEXPECTED_SEARCH_RESULT_REFERENCES.get(
+                                firstReference.getURIs().iterator().next()).toString());
+            } else {
+                return firstEntry;
+            }
+        }
+
+        private void setResultFuture(final FutureResult<Result> future) {
+            this.future = future;
+        }
     }
 
+    private static final class SingleEntryHandler implements SearchResultHandler {
+        private volatile SearchResultEntry firstEntry = null;
 
+        private volatile SearchResultReference firstReference = null;
 
-    @Override
-    public boolean isCancelled()
-    {
-      return future.isCancelled();
+        private volatile int entryCount = 0;
+
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            if (firstEntry == null) {
+                firstEntry = entry;
+            }
+            entryCount++;
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            // Ignore.
+        }
+
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            if (firstReference == null) {
+                firstReference = reference;
+            }
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final Result result) {
+            // Ignore.
+        }
+
     }
 
-
-
-    @Override
-    public boolean isDone()
-    {
-      return future.isDone();
+    /**
+     * Creates a new abstract connection.
+     */
+    protected AbstractConnection() {
+        // No implementation required.
     }
 
-
-
-    private SearchResultEntry get0() throws ErrorResultException
-    {
-      if (entryCount == 0)
-      {
-        // Did not find any entries.
-        throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
-            ERR_NO_SEARCH_RESULT_ENTRIES.get().toString());
-      }
-      else if (entryCount > 1)
-      {
-        // Got more entries than expected.
-        throw newErrorResult(
-            ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
-            ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES.get(entryCount).toString());
-      }
-      else if (firstReference != null)
-      {
-        // Got an unexpected search result reference.
-        throw newErrorResult(
-            ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
-            ERR_UNEXPECTED_SEARCH_RESULT_REFERENCES.get(
-                firstReference.getURIs().iterator().next()).toString());
-      }
-      else
-      {
-        return firstEntry;
-      }
-    }
-
-
-
-    private void setResultFuture(final FutureResult<Result> future)
-    {
-      this.future = future;
-    }
-  }
-
-
-
-  private static final class SingleEntryHandler implements SearchResultHandler
-  {
-    private volatile SearchResultEntry firstEntry = null;
-
-    private volatile SearchResultReference firstReference = null;
-
-    private volatile int entryCount = 0;
-
-
-
-    @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      if (firstEntry == null)
-      {
-        firstEntry = entry;
-      }
-      entryCount++;
-      return true;
-    }
-
-
-
     /**
      * {@inheritDoc}
      */
     @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      // Ignore.
+    public Result add(final Entry entry) throws ErrorResultException, InterruptedException {
+        return add(Requests.newAddRequest(entry));
     }
 
-
-
-    @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      if (firstReference == null)
-      {
-        firstReference = reference;
-      }
-      return true;
-    }
-
-
-
     /**
      * {@inheritDoc}
      */
     @Override
-    public void handleResult(final Result result)
-    {
-      // Ignore.
+    public Result add(final String... ldifLines) throws ErrorResultException, InterruptedException {
+        return add(Requests.newAddRequest(ldifLines));
     }
 
-  }
-
-
-
-  /**
-   * Creates a new abstract connection.
-   */
-  protected AbstractConnection()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result add(final Entry entry) throws ErrorResultException,
-      InterruptedException
-  {
-    return add(Requests.newAddRequest(entry));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result add(final String... ldifLines) throws ErrorResultException,
-      InterruptedException
-  {
-    return add(Requests.newAddRequest(ldifLines));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public BindResult bind(final String name, final char[] password)
-      throws ErrorResultException, InterruptedException
-  {
-    return bind(Requests.newSimpleBindRequest(name, password));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close()
-  {
-    close(Requests.newUnbindRequest(), null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public CompareResult compare(final String name,
-      final String attributeDescription, final String assertionValue)
-      throws ErrorResultException, InterruptedException
-  {
-    return compare(Requests.newCompareRequest(name, attributeDescription,
-        assertionValue));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result delete(final String name) throws ErrorResultException,
-      InterruptedException
-  {
-    return delete(Requests.newDeleteRequest(name));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <R extends ExtendedResult> R extendedRequest(
-      final ExtendedRequest<R> request) throws ErrorResultException,
-      InterruptedException
-  {
-    return extendedRequest(request, null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GenericExtendedResult extendedRequest(final String requestName,
-      final ByteString requestValue) throws ErrorResultException,
-      InterruptedException
-  {
-    return extendedRequest(Requests.newGenericExtendedRequest(requestName,
-        requestValue));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result modify(final String... ldifLines) throws ErrorResultException,
-      InterruptedException
-  {
-    return modify(Requests.newModifyRequest(ldifLines));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result modifyDN(final String name, final String newRDN)
-      throws ErrorResultException, InterruptedException
-  {
-    return modifyDN(Requests.newModifyDNRequest(name, newRDN));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public SearchResultEntry readEntry(final DN baseObject,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    final SearchRequest request = Requests.newSearchRequest(baseObject,
-        SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter(),
-        attributeDescriptions);
-    return searchSingleEntry(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public SearchResultEntry readEntry(final String baseObject,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    return readEntry(DN.valueOf(baseObject));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
-      final Collection<String> attributeDescriptions,
-      final ResultHandler<? super SearchResultEntry> handler)
-  {
-    final SearchRequest request = Requests.newSearchRequest(name,
-        SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter());
-    if (attributeDescriptions != null)
-    {
-      request.getAttributes().addAll(attributeDescriptions);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BindResult bind(final String name, final char[] password) throws ErrorResultException,
+            InterruptedException {
+        return bind(Requests.newSimpleBindRequest(name, password));
     }
-    return searchSingleEntryAsync(request, handler);
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() {
+        close(Requests.newUnbindRequest(), null);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CompareResult compare(final String name, final String attributeDescription,
+            final String assertionValue) throws ErrorResultException, InterruptedException {
+        return compare(Requests.newCompareRequest(name, attributeDescription, assertionValue));
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ConnectionEntryReader search(final SearchRequest request)
-  {
-    return new ConnectionEntryReader(this, request);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result delete(final String name) throws ErrorResultException, InterruptedException {
+        return delete(Requests.newDeleteRequest(name));
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request)
+            throws ErrorResultException, InterruptedException {
+        return extendedRequest(request, null);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GenericExtendedResult extendedRequest(final String requestName,
+            final ByteString requestValue) throws ErrorResultException, InterruptedException {
+        return extendedRequest(Requests.newGenericExtendedRequest(requestName, requestValue));
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final Collection<? super SearchResultEntry> entries)
-      throws ErrorResultException, InterruptedException
-  {
-    return search(request, entries, null);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result modify(final String... ldifLines) throws ErrorResultException,
+            InterruptedException {
+        return modify(Requests.newModifyRequest(ldifLines));
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result modifyDN(final String name, final String newRDN) throws ErrorResultException,
+            InterruptedException {
+        return modifyDN(Requests.newModifyDNRequest(name, newRDN));
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SearchResultEntry readEntry(final DN baseObject, final String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException {
+        final SearchRequest request =
+                Requests.newSearchRequest(baseObject, SearchScope.BASE_OBJECT, Filter
+                        .getObjectClassPresentFilter(), attributeDescriptions);
+        return searchSingleEntry(request);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Result search(final SearchRequest request,
-      final Collection<? super SearchResultEntry> entries,
-      final Collection<? super SearchResultReference> references)
-      throws ErrorResultException, InterruptedException
-  {
-    Validator.ensureNotNull(request, entries);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SearchResultEntry readEntry(final String baseObject,
+            final String... attributeDescriptions) throws ErrorResultException,
+            InterruptedException {
+        return readEntry(DN.valueOf(baseObject));
+    }
 
-    // FIXME: does this need to be thread safe?
-    final SearchResultHandler handler = new SearchResultHandler()
-    {
-
-      @Override
-      public boolean handleEntry(final SearchResultEntry entry)
-      {
-        entries.add(entry);
-        return true;
-      }
-
-
-
-      /**
-       * {@inheritDoc}
-       */
-      @Override
-      public void handleErrorResult(final ErrorResultException error)
-      {
-        // Ignore.
-      }
-
-
-
-      @Override
-      public boolean handleReference(final SearchResultReference reference)
-      {
-        if (references != null)
-        {
-          references.add(reference);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
+            final Collection<String> attributeDescriptions,
+            final ResultHandler<? super SearchResultEntry> handler) {
+        final SearchRequest request =
+                Requests.newSearchRequest(name, SearchScope.BASE_OBJECT, Filter
+                        .getObjectClassPresentFilter());
+        if (attributeDescriptions != null) {
+            request.getAttributes().addAll(attributeDescriptions);
         }
-        return true;
-      }
-
-
-
-      /**
-       * {@inheritDoc}
-       */
-      @Override
-      public void handleResult(final Result result)
-      {
-        // Ignore.
-      }
-    };
-
-    return search(request, handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ConnectionEntryReader search(final String baseObject,
-      final SearchScope scope, final String filter,
-      final String... attributeDescriptions)
-  {
-    final SearchRequest request = Requests.newSearchRequest(baseObject, scope,
-        filter, attributeDescriptions);
-    return search(request);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public SearchResultEntry searchSingleEntry(final SearchRequest request)
-      throws ErrorResultException, InterruptedException
-  {
-    final SingleEntryHandler handler = new SingleEntryHandler();
-    search(request, handler);
-
-    if (handler.entryCount == 0)
-    {
-      // Did not find any entries.
-      throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
-          ERR_NO_SEARCH_RESULT_ENTRIES.get().toString());
+        return searchSingleEntryAsync(request, handler);
     }
-    else if (handler.entryCount > 1)
-    {
-      // Got more entries than expected.
-      throw newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
-          ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES.get(handler.entryCount)
-              .toString());
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConnectionEntryReader search(final SearchRequest request) {
+        return new ConnectionEntryReader(this, request);
     }
-    else if (handler.firstReference != null)
-    {
-      // Got an unexpected search result reference.
-      throw newErrorResult(
-          ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
-          ERR_UNEXPECTED_SEARCH_RESULT_REFERENCES.get(
-              handler.firstReference.getURIs().iterator().next()).toString());
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result search(final SearchRequest request,
+            final Collection<? super SearchResultEntry> entries) throws ErrorResultException,
+            InterruptedException {
+        return search(request, entries, null);
     }
-    else
-    {
-      return handler.firstEntry;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Result search(final SearchRequest request,
+            final Collection<? super SearchResultEntry> entries,
+            final Collection<? super SearchResultReference> references)
+            throws ErrorResultException, InterruptedException {
+        Validator.ensureNotNull(request, entries);
+
+        // FIXME: does this need to be thread safe?
+        final SearchResultHandler handler = new SearchResultHandler() {
+
+            @Override
+            public boolean handleEntry(final SearchResultEntry entry) {
+                entries.add(entry);
+                return true;
+            }
+
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public void handleErrorResult(final ErrorResultException error) {
+                // Ignore.
+            }
+
+            @Override
+            public boolean handleReference(final SearchResultReference reference) {
+                if (references != null) {
+                    references.add(reference);
+                }
+                return true;
+            }
+
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public void handleResult(final Result result) {
+                // Ignore.
+            }
+        };
+
+        return search(request, handler);
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConnectionEntryReader search(final String baseObject, final SearchScope scope,
+            final String filter, final String... attributeDescriptions) {
+        final SearchRequest request =
+                Requests.newSearchRequest(baseObject, scope, filter, attributeDescriptions);
+        return search(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SearchResultEntry searchSingleEntry(final SearchRequest request)
+            throws ErrorResultException, InterruptedException {
+        final SingleEntryHandler handler = new SingleEntryHandler();
+        search(request, handler);
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public SearchResultEntry searchSingleEntry(final String baseObject,
-      final SearchScope scope, final String filter,
-      final String... attributeDescriptions) throws ErrorResultException,
-      InterruptedException
-  {
-    final SearchRequest request = Requests.newSearchRequest(baseObject, scope,
-        filter, attributeDescriptions);
-    return searchSingleEntry(request);
-  }
+        if (handler.entryCount == 0) {
+            // Did not find any entries.
+            throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
+                    ERR_NO_SEARCH_RESULT_ENTRIES.get().toString());
+        } else if (handler.entryCount > 1) {
+            // Got more entries than expected.
+            throw newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
+                    ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES.get(handler.entryCount).toString());
+        } else if (handler.firstReference != null) {
+            // Got an unexpected search result reference.
+            throw newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
+                    ERR_UNEXPECTED_SEARCH_RESULT_REFERENCES.get(
+                            handler.firstReference.getURIs().iterator().next()).toString());
+        } else {
+            return handler.firstEntry;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SearchResultEntry searchSingleEntry(final String baseObject, final SearchScope scope,
+            final String filter, final String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException {
+        final SearchRequest request =
+                Requests.newSearchRequest(baseObject, scope, filter, attributeDescriptions);
+        return searchSingleEntry(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<SearchResultEntry> searchSingleEntryAsync(final SearchRequest request,
+            final ResultHandler<? super SearchResultEntry> handler) {
+        final SingleEntryFuture innerFuture = new SingleEntryFuture(handler);
+        final FutureResult<Result> future = searchAsync(request, null, innerFuture);
+        innerFuture.setResultFuture(future);
+        return innerFuture;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<SearchResultEntry> searchSingleEntryAsync(
-      final SearchRequest request,
-      final ResultHandler<? super SearchResultEntry> handler)
-  {
-    final SingleEntryFuture innerFuture = new SingleEntryFuture(handler);
-    final FutureResult<Result> future = searchAsync(request, null, innerFuture);
-    innerFuture.setResultFuture(future);
-    return innerFuture;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * Sub-classes should provide an implementation which returns an appropriate
-   * description of the connection which may be used for debugging purposes.
-   */
-  @Override
-  public abstract String toString();
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Sub-classes should provide an implementation which returns an appropriate
+     * description of the connection which may be used for debugging purposes.
+     */
+    @Override
+    public abstract String toString();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java
index 989b999..37664b5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,350 +27,259 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 
-
 import com.forgerock.opendj.util.Iterables;
 import com.forgerock.opendj.util.Predicate;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class provides a skeletal implementation of the {@code Entry} interface,
  * to minimize the effort required to implement this interface.
  */
-public abstract class AbstractEntry implements Entry
-{
+public abstract class AbstractEntry implements Entry {
 
-  // Predicate used for findAttributes.
-  private static final Predicate<Attribute, AttributeDescription>
-    FIND_ATTRIBUTES_PREDICATE = new Predicate<Attribute, AttributeDescription>()
-  {
+    // Predicate used for findAttributes.
+    private static final Predicate<Attribute, AttributeDescription> FIND_ATTRIBUTES_PREDICATE =
+            new Predicate<Attribute, AttributeDescription>() {
 
-    public boolean matches(final Attribute value, final AttributeDescription p)
-    {
-      return value.getAttributeDescription().isSubTypeOf(p);
-    }
+                public boolean matches(final Attribute value, final AttributeDescription p) {
+                    return value.getAttributeDescription().isSubTypeOf(p);
+                }
 
-  };
+            };
 
-
-
-  /**
-   * Returns {@code true} if {@code object} is an entry which is equal to
-   * {@code entry}. Two entry are considered equal if their distinguished names
-   * are equal, they both have the same number of attributes, and every
-   * attribute contained in the first entry is also contained in the second
-   * entry.
-   *
-   * @param entry
-   *          The entry to be tested for equality.
-   * @param object
-   *          The object to be tested for equality with the entry.
-   * @return {@code true} if {@code object} is an entry which is equal to
-   *         {@code entry}, or {@code false} if not.
-   */
-  static boolean equals(final Entry entry, final Object object)
-  {
-    if (entry == object)
-    {
-      return true;
-    }
-
-    if (!(object instanceof Entry))
-    {
-      return false;
-    }
-
-    final Entry other = (Entry) object;
-    if (!entry.getName().equals(other.getName()))
-    {
-      return false;
-    }
-
-    // Distinguished name is the same, compare attributes.
-    if (entry.getAttributeCount() != other.getAttributeCount())
-    {
-      return false;
-    }
-
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      final Attribute otherAttribute = other.getAttribute(attribute
-          .getAttributeDescription());
-
-      if (!attribute.equals(otherAttribute))
-      {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-
-
-  /**
-   * Returns the hash code for {@code entry}. It will be calculated as the sum
-   * of the hash codes of the distinguished name and all of the attributes.
-   *
-   * @param entry
-   *          The entry whose hash code should be calculated.
-   * @return The hash code for {@code entry}.
-   */
-  static int hashCode(final Entry entry)
-  {
-    int hashCode = entry.getName().hashCode();
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      hashCode += attribute.hashCode();
-    }
-    return hashCode;
-  }
-
-
-
-  /**
-   * Returns a string representation of {@code entry}.
-   *
-   * @param entry
-   *          The entry whose string representation should be returned.
-   * @return The string representation of {@code entry}.
-   */
-  static String toString(final Entry entry)
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("Entry(");
-    builder.append(entry.getName());
-    builder.append(", {");
-
-    boolean firstValue = true;
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      if (!firstValue)
-      {
-        builder.append(", ");
-      }
-
-      builder.append(attribute);
-      firstValue = false;
-    }
-
-    builder.append("})");
-    return builder.toString();
-  }
-
-
-
-  /**
-   * Sole constructor.
-   */
-  protected AbstractEntry()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAttribute(final Attribute attribute)
-  {
-    return addAttribute(attribute, null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Entry addAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    addAttribute(new LinkedAttribute(attributeDescription, values), null);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    final Attribute a = getAttribute(attribute.getAttributeDescription());
-    if (a == null)
-    {
-      if (missingValues != null)
-      {
-        missingValues.addAll(attribute);
-      }
-      return false;
-    }
-    else
-    {
-      boolean result = true;
-      for (final ByteString value : attribute)
-      {
-        if (!a.contains(value))
-        {
-          if (missingValues != null)
-          {
-            missingValues.add(value);
-          }
-          result = false;
+    /**
+     * Returns {@code true} if {@code object} is an entry which is equal to
+     * {@code entry}. Two entry are considered equal if their distinguished
+     * names are equal, they both have the same number of attributes, and every
+     * attribute contained in the first entry is also contained in the second
+     * entry.
+     *
+     * @param entry
+     *            The entry to be tested for equality.
+     * @param object
+     *            The object to be tested for equality with the entry.
+     * @return {@code true} if {@code object} is an entry which is equal to
+     *         {@code entry}, or {@code false} if not.
+     */
+    static boolean equals(final Entry entry, final Object object) {
+        if (entry == object) {
+            return true;
         }
-      }
-      return result;
+
+        if (!(object instanceof Entry)) {
+            return false;
+        }
+
+        final Entry other = (Entry) object;
+        if (!entry.getName().equals(other.getName())) {
+            return false;
+        }
+
+        // Distinguished name is the same, compare attributes.
+        if (entry.getAttributeCount() != other.getAttributeCount()) {
+            return false;
+        }
+
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            final Attribute otherAttribute =
+                    other.getAttribute(attribute.getAttributeDescription());
+
+            if (!attribute.equals(otherAttribute)) {
+                return false;
+            }
+        }
+
+        return true;
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    return containsAttribute(new LinkedAttribute(attributeDescription, values),
-        null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object object)
-  {
-    return equals(this, object);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-
-    return Iterables.filteredIterable(getAllAttributes(), FIND_ATTRIBUTES_PREDICATE,
-        attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(final String attributeDescription)
-  {
-    return getAllAttributes(AttributeDescription.valueOf(attributeDescription));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Attribute getAttribute(final String attributeDescription)
-  {
-    return getAttribute(AttributeDescription.valueOf(attributeDescription));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return hashCode(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean removeAttribute(final AttributeDescription attributeDescription)
-  {
-    return removeAttribute(
-        Attributes.emptyAttribute(attributeDescription), null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Entry removeAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    removeAttribute(new LinkedAttribute(attributeDescription, values), null);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean replaceAttribute(final Attribute attribute)
-  {
-    if (attribute.isEmpty())
-    {
-      return removeAttribute(attribute.getAttributeDescription());
+    /**
+     * Returns the hash code for {@code entry}. It will be calculated as the sum
+     * of the hash codes of the distinguished name and all of the attributes.
+     *
+     * @param entry
+     *            The entry whose hash code should be calculated.
+     * @return The hash code for {@code entry}.
+     */
+    static int hashCode(final Entry entry) {
+        int hashCode = entry.getName().hashCode();
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            hashCode += attribute.hashCode();
+        }
+        return hashCode;
     }
-    else
-    {
-      removeAttribute(attribute.getAttributeDescription());
-      addAttribute(attribute, null);
-      return true;
+
+    /**
+     * Returns a string representation of {@code entry}.
+     *
+     * @param entry
+     *            The entry whose string representation should be returned.
+     * @return The string representation of {@code entry}.
+     */
+    static String toString(final Entry entry) {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("Entry(");
+        builder.append(entry.getName());
+        builder.append(", {");
+
+        boolean firstValue = true;
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            if (!firstValue) {
+                builder.append(", ");
+            }
+
+            builder.append(attribute);
+            firstValue = false;
+        }
+
+        builder.append("})");
+        return builder.toString();
     }
-  }
 
+    /**
+     * Sole constructor.
+     */
+    protected AbstractEntry() {
+        // No implementation required.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAttribute(final Attribute attribute) {
+        return addAttribute(attribute, null);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public Entry replaceAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    replaceAttribute(new LinkedAttribute(attributeDescription, values));
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Entry addAttribute(final String attributeDescription, final Object... values) {
+        addAttribute(new LinkedAttribute(attributeDescription, values), null);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        final Attribute a = getAttribute(attribute.getAttributeDescription());
+        if (a == null) {
+            if (missingValues != null) {
+                missingValues.addAll(attribute);
+            }
+            return false;
+        } else {
+            boolean result = true;
+            for (final ByteString value : attribute) {
+                if (!a.contains(value)) {
+                    if (missingValues != null) {
+                        missingValues.add(value);
+                    }
+                    result = false;
+                }
+            }
+            return result;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final String attributeDescription, final Object... values) {
+        return containsAttribute(new LinkedAttribute(attributeDescription, values), null);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public Entry setName(final String dn)
-  {
-    return setName(DN.valueOf(dn));
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object object) {
+        return equals(this, object);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
 
+        return Iterables.filteredIterable(getAllAttributes(), FIND_ATTRIBUTES_PREDICATE,
+                attributeDescription);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return toString(this);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final String attributeDescription) {
+        return getAllAttributes(AttributeDescription.valueOf(attributeDescription));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Attribute getAttribute(final String attributeDescription) {
+        return getAttribute(AttributeDescription.valueOf(attributeDescription));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return hashCode(this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean removeAttribute(final AttributeDescription attributeDescription) {
+        return removeAttribute(Attributes.emptyAttribute(attributeDescription), null);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Entry removeAttribute(final String attributeDescription, final Object... values) {
+        removeAttribute(new LinkedAttribute(attributeDescription, values), null);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean replaceAttribute(final Attribute attribute) {
+        if (attribute.isEmpty()) {
+            return removeAttribute(attribute.getAttributeDescription());
+        } else {
+            removeAttribute(attribute.getAttributeDescription());
+            addAttribute(attribute, null);
+            return true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Entry replaceAttribute(final String attributeDescription, final Object... values) {
+        replaceAttribute(new LinkedAttribute(attributeDescription, values));
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Entry setName(final String dn) {
+        return setName(DN.valueOf(dn));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return toString(this);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java
index 7370ef7..731a5ac 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,194 +26,150 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.List;
 
-
-
 /**
- * An abstract filter visitor whose default implementation for all {@code
- * Visitor} methods is to invoke {@link #visitDefaultFilter(Object)}.
+ * An abstract filter visitor whose default implementation for all
+ * {@code Visitor} methods is to invoke {@link #visitDefaultFilter(Object)}.
  * <p>
  * Implementations can override the methods on a case by case behavior.
  *
  * @param <R>
- *          The return type of this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need to return
- *          results.
+ *            The return type of this visitor's methods. Use
+ *            {@link java.lang.Void} for visitors that do not need to return
+ *            results.
  * @param <P>
- *          The type of the additional parameter to this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need an additional
- *          parameter.
+ *            The type of the additional parameter to this visitor's methods.
+ *            Use {@link java.lang.Void} for visitors that do not need an
+ *            additional parameter.
  */
-public abstract class AbstractFilterVisitor<R, P> implements
-    FilterVisitor<R, P>
-{
+public abstract class AbstractFilterVisitor<R, P> implements FilterVisitor<R, P> {
 
-  /**
-   * Default constructor.
-   */
-  protected AbstractFilterVisitor()
-  {
-    // Nothing to do.
-  }
+    /**
+     * Default constructor.
+     */
+    protected AbstractFilterVisitor() {
+        // Nothing to do.
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitAndFilter(final P p, final List<Filter> subFilters) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitApproxMatchFilter(final P p, final String attributeDescription,
+            final ByteString assertionValue) {
+        return visitDefaultFilter(p);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitAndFilter(final P p, final List<Filter> subFilters)
-  {
-    return visitDefaultFilter(p);
-  }
+    /**
+     * Visits any filters which are not explicitly handled by other visitor
+     * methods.
+     * <p>
+     * The default implementation of this method is to return {@code null}.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @return A visitor specified result.
+     */
+    public R visitDefaultFilter(final P p) {
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitEqualityMatchFilter(final P p, final String attributeDescription,
+            final ByteString assertionValue) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitExtensibleMatchFilter(final P p, final String matchingRule,
+            final String attributeDescription, final ByteString assertionValue,
+            final boolean dnAttributes) {
+        return visitDefaultFilter(p);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitApproxMatchFilter(final P p, final String attributeDescription,
-      final ByteString assertionValue)
-  {
-    return visitDefaultFilter(p);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitGreaterOrEqualFilter(final P p, final String attributeDescription,
+            final ByteString assertionValue) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitLessOrEqualFilter(final P p, final String attributeDescription,
+            final ByteString assertionValue) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitNotFilter(final P p, final Filter subFilter) {
+        return visitDefaultFilter(p);
+    }
 
-  /**
-   * Visits any filters which are not explicitly handled by other visitor
-   * methods.
-   * <p>
-   * The default implementation of this method is to return {@code null}.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @return A visitor specified result.
-   */
-  public R visitDefaultFilter(final P p)
-  {
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitOrFilter(final P p, final List<Filter> subFilters) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitPresentFilter(final P p, final String attributeDescription) {
+        return visitDefaultFilter(p);
+    }
 
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitSubstringsFilter(final P p, final String attributeDescription,
+            final ByteString initialSubstring, final List<ByteString> anySubstrings,
+            final ByteString finalSubstring) {
+        return visitDefaultFilter(p);
+    }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitEqualityMatchFilter(final P p,
-      final String attributeDescription, final ByteString assertionValue)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitExtensibleMatchFilter(final P p, final String matchingRule,
-      final String attributeDescription, final ByteString assertionValue,
-      final boolean dnAttributes)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitGreaterOrEqualFilter(final P p,
-      final String attributeDescription, final ByteString assertionValue)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitLessOrEqualFilter(final P p, final String attributeDescription,
-      final ByteString assertionValue)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitNotFilter(final P p, final Filter subFilter)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitOrFilter(final P p, final List<Filter> subFilters)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitPresentFilter(final P p, final String attributeDescription)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitSubstringsFilter(final P p, final String attributeDescription,
-      final ByteString initialSubstring, final List<ByteString> anySubstrings,
-      final ByteString finalSubstring)
-  {
-    return visitDefaultFilter(p);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   * <p>
-   * The default implementation is to call {@link #visitDefaultFilter(Object)}.
-   */
-  public R visitUnrecognizedFilter(final P p, final byte filterTag,
-      final ByteString filterBytes)
-  {
-    return visitDefaultFilter(p);
-  }
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation is to call {@link #visitDefaultFilter(Object)}.
+     */
+    public R visitUnrecognizedFilter(final P p, final byte filterTag, final ByteString filterBytes) {
+        return visitDefaultFilter(p);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
index 4d41dba..06b5348 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.util.ArrayList;
@@ -45,8 +42,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An abstract load balancing algorithm providing monitoring and failover
  * capabilities.
@@ -55,416 +50,316 @@
  * {@code getInitialConnectionFactoryIndex()} in order to provide the policy for
  * selecting the first connection factory to use for each connection request.
  */
-abstract class AbstractLoadBalancingAlgorithm implements LoadBalancingAlgorithm
-{
-  private final class MonitoredConnectionFactory implements ConnectionFactory,
-      ResultHandler<Connection>
-  {
+abstract class AbstractLoadBalancingAlgorithm implements LoadBalancingAlgorithm {
+    private final class MonitoredConnectionFactory implements ConnectionFactory,
+            ResultHandler<Connection> {
 
-    private final ConnectionFactory factory;
+        private final ConnectionFactory factory;
 
-    private final AtomicBoolean isOperational = new AtomicBoolean(true);
+        private final AtomicBoolean isOperational = new AtomicBoolean(true);
 
-    private volatile FutureResult<?> pendingConnectFuture = null;
+        private volatile FutureResult<?> pendingConnectFuture = null;
 
-    private final int index;
+        private final int index;
 
-
-
-    private MonitoredConnectionFactory(final ConnectionFactory factory,
-        final int index)
-    {
-      this.factory = factory;
-      this.index = index;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Connection getConnection() throws ErrorResultException,
-        InterruptedException
-    {
-      final Connection connection;
-      try
-      {
-        connection = factory.getConnection();
-      }
-      catch (ErrorResultException e)
-      {
-        // Attempt failed - try next factory.
-        notifyOffline(e);
-        final int nextIndex = (index + 1) % monitoredFactories.size();
-        final MonitoredConnectionFactory nextFactory =
-            getMonitoredConnectionFactory(nextIndex);
-        return nextFactory.getConnection();
-      }
-      notifyOnline();
-      return connection;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public FutureResult<Connection> getConnectionAsync(
-        final ResultHandler<? super Connection> resultHandler)
-    {
-      final AsynchronousFutureResult<Connection> future =
-        new AsynchronousFutureResult<Connection>(resultHandler);
-
-      final ResultHandler<Connection> failoverHandler =
-        new ResultHandler<Connection>()
-      {
-        @Override
-        public void handleErrorResult(final ErrorResultException error)
-        {
-          // Attempt failed - try next factory.
-          notifyOffline(error);
-          final int nextIndex = (index + 1) % monitoredFactories.size();
-          try
-          {
-            final MonitoredConnectionFactory nextFactory =
-              getMonitoredConnectionFactory(nextIndex);
-            nextFactory.getConnectionAsync(future);
-          }
-          catch (final ErrorResultException e)
-          {
-            future.handleErrorResult(e);
-          }
+        private MonitoredConnectionFactory(final ConnectionFactory factory, final int index) {
+            this.factory = factory;
+            this.index = index;
         }
 
+        /**
+         * {@inheritDoc}
+         */
+        public Connection getConnection() throws ErrorResultException, InterruptedException {
+            final Connection connection;
+            try {
+                connection = factory.getConnection();
+            } catch (ErrorResultException e) {
+                // Attempt failed - try next factory.
+                notifyOffline(e);
+                final int nextIndex = (index + 1) % monitoredFactories.size();
+                final MonitoredConnectionFactory nextFactory =
+                        getMonitoredConnectionFactory(nextIndex);
+                return nextFactory.getConnection();
+            }
+            notifyOnline();
+            return connection;
+        }
 
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public FutureResult<Connection> getConnectionAsync(
+                final ResultHandler<? super Connection> resultHandler) {
+            final AsynchronousFutureResult<Connection> future =
+                    new AsynchronousFutureResult<Connection>(resultHandler);
+
+            final ResultHandler<Connection> failoverHandler = new ResultHandler<Connection>() {
+                @Override
+                public void handleErrorResult(final ErrorResultException error) {
+                    // Attempt failed - try next factory.
+                    notifyOffline(error);
+                    final int nextIndex = (index + 1) % monitoredFactories.size();
+                    try {
+                        final MonitoredConnectionFactory nextFactory =
+                                getMonitoredConnectionFactory(nextIndex);
+                        nextFactory.getConnectionAsync(future);
+                    } catch (final ErrorResultException e) {
+                        future.handleErrorResult(e);
+                    }
+                }
+
+                @Override
+                public void handleResult(final Connection result) {
+                    notifyOnline();
+                    future.handleResult(result);
+                }
+            };
+
+            factory.getConnectionAsync(failoverHandler);
+            return future;
+        }
+
+        /**
+         * Handle monitoring connection request failure.
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            notifyOffline(error);
+        }
+
+        /**
+         * Handle monitoring connection request success.
+         */
+        @Override
+        public void handleResult(final Connection connection) {
+            notifyOnline();
+
+            // The connection is not going to be used, so close it immediately.
+            connection.close();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return factory.toString();
+        }
+
+        /**
+         * Attempt to connect to the factory if it is offline and there is no
+         * pending monitoring request.
+         */
+        private synchronized void checkIfAvailable() {
+            if (!isOperational.get()
+                    && (pendingConnectFuture == null || pendingConnectFuture.isDone())) {
+                if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                    StaticUtils.DEBUG_LOG.fine(String
+                            .format("Attempting reconnect to offline factory " + this));
+                }
+                pendingConnectFuture = factory.getConnectionAsync(this);
+            }
+        }
+
+        private void notifyOffline(final ErrorResultException error) {
+            if (isOperational.getAndSet(false)) {
+                // Transition from online to offline.
+                if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    StaticUtils.DEBUG_LOG.warning(String.format("Connection factory " + factory
+                            + " is no longer operational: " + error.getMessage()));
+                }
+
+                synchronized (stateLock) {
+                    offlineFactoriesCount++;
+                    if (offlineFactoriesCount == 1) {
+                        // Enable monitoring.
+                        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                            StaticUtils.DEBUG_LOG.fine(String.format("Starting monitoring thread"));
+                        }
+
+                        monitoringFuture =
+                                scheduler.scheduleWithFixedDelay(new MonitorRunnable(), 0,
+                                        monitoringInterval, monitoringIntervalTimeUnit);
+                    }
+                }
+            }
+        }
+
+        private void notifyOnline() {
+            if (!isOperational.getAndSet(true)) {
+                // Transition from offline to online.
+                if (StaticUtils.DEBUG_LOG.isLoggable(Level.INFO)) {
+                    StaticUtils.DEBUG_LOG.info(String.format("Connection factory " + factory
+                            + " is now operational"));
+                }
+
+                synchronized (stateLock) {
+                    offlineFactoriesCount--;
+                    if (offlineFactoriesCount == 0) {
+                        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                            StaticUtils.DEBUG_LOG.fine(String.format("Stopping monitoring thread"));
+                        }
+
+                        monitoringFuture.cancel(false);
+                        monitoringFuture = null;
+                    }
+                }
+            }
+        }
+    }
+
+    private final class MonitorRunnable implements Runnable {
+        private MonitorRunnable() {
+            // Nothing to do.
+        }
 
         @Override
-        public void handleResult(final Connection result)
-        {
-          notifyOnline();
-          future.handleResult(result);
+        public void run() {
+            for (final MonitoredConnectionFactory factory : monitoredFactories) {
+                factory.checkIfAvailable();
+            }
         }
-      };
-
-      factory.getConnectionAsync(failoverHandler);
-      return future;
     }
 
+    private final List<MonitoredConnectionFactory> monitoredFactories;
 
+    private final ScheduledExecutorService scheduler;
+
+    private final Object stateLock = new Object();
+
+    // Guarded by stateLock.
+    private int offlineFactoriesCount = 0;
+
+    private final long monitoringInterval;
+
+    private final TimeUnit monitoringIntervalTimeUnit;
+
+    // Guarded by stateLock.
+    private ScheduledFuture<?> monitoringFuture;
 
     /**
-     * Handle monitoring connection request failure.
+     * Creates a new abstract load balancing algorithm which will monitor
+     * offline connection factories every second using the default scheduler.
+     *
+     * @param factories
+     *            The connection factories.
      */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      notifyOffline(error);
+    AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories) {
+        this(factories, 1, TimeUnit.SECONDS, StaticUtils.getDefaultScheduler());
     }
 
-
-
     /**
-     * Handle monitoring connection request success.
+     * Creates a new abstract load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency using the
+     * default scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
      */
-    @Override
-    public void handleResult(final Connection connection)
-    {
-      notifyOnline();
-
-      // The connection is not going to be used, so close it immediately.
-      connection.close();
+    AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit) {
+        this(factories, interval, unit, StaticUtils.getDefaultScheduler());
     }
 
+    /**
+     * Creates a new abstract load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency and scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
+     * @param scheduler
+     *            The scheduler which should for periodically monitoring dead
+     *            connection factories to see if they are usable again.
+     */
+    AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit, final ScheduledExecutorService scheduler) {
+        Validator.ensureNotNull(factories, scheduler, unit);
 
+        this.monitoredFactories = new ArrayList<MonitoredConnectionFactory>(factories.size());
+        int i = 0;
+        for (final ConnectionFactory f : factories) {
+            this.monitoredFactories.add(new MonitoredConnectionFactory(f, i++));
+        }
+        this.scheduler = scheduler;
+        this.monitoringInterval = interval;
+        this.monitoringIntervalTimeUnit = unit;
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public String toString()
-    {
-      return factory.toString();
+    public final ConnectionFactory getConnectionFactory() throws ErrorResultException {
+        final int index = getInitialConnectionFactoryIndex();
+        return getMonitoredConnectionFactory(index);
     }
 
-
-
     /**
-     * Attempt to connect to the factory if it is offline and there is no
-     * pending monitoring request.
+     * {@inheritDoc}
      */
-    private synchronized void checkIfAvailable()
-    {
-      if (!isOperational.get()
-          && (pendingConnectFuture == null || pendingConnectFuture.isDone()))
-      {
-        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-        {
-          StaticUtils.DEBUG_LOG.fine(String
-              .format("Attempting reconnect to offline factory " + this));
-        }
-        pendingConnectFuture = factory.getConnectionAsync(this);
-      }
-    }
-
-
-
-    private void notifyOffline(final ErrorResultException error)
-    {
-      if (isOperational.getAndSet(false))
-      {
-        // Transition from online to offline.
-        if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          StaticUtils.DEBUG_LOG.warning(String.format("Connection factory "
-              + factory + " is no longer operational: " + error.getMessage()));
-        }
-
-        synchronized (stateLock)
-        {
-          offlineFactoriesCount++;
-          if (offlineFactoriesCount == 1)
-          {
-            // Enable monitoring.
-            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-            {
-              StaticUtils.DEBUG_LOG.fine(String
-                  .format("Starting monitoring thread"));
-            }
-
-            monitoringFuture = scheduler.scheduleWithFixedDelay(
-                new MonitorRunnable(), 0, monitoringInterval,
-                monitoringIntervalTimeUnit);
-          }
-        }
-      }
-    }
-
-
-
-    private void notifyOnline()
-    {
-      if (!isOperational.getAndSet(true))
-      {
-        // Transition from offline to online.
-        if (StaticUtils.DEBUG_LOG.isLoggable(Level.INFO))
-        {
-          StaticUtils.DEBUG_LOG.info(String.format("Connection factory "
-              + factory + " is now operational"));
-        }
-
-        synchronized (stateLock)
-        {
-          offlineFactoriesCount--;
-          if (offlineFactoriesCount == 0)
-          {
-            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-            {
-              StaticUtils.DEBUG_LOG.fine(String
-                  .format("Stopping monitoring thread"));
-            }
-
-            monitoringFuture.cancel(false);
-            monitoringFuture = null;
-          }
-        }
-      }
-    }
-  }
-
-
-
-  private final class MonitorRunnable implements Runnable
-  {
-    private MonitorRunnable()
-    {
-      // Nothing to do.
-    }
-
-
-
     @Override
-    public void run()
-    {
-      for (final MonitoredConnectionFactory factory : monitoredFactories)
-      {
-        factory.checkIfAvailable();
-      }
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append(getAlgorithmName());
+        builder.append('(');
+        boolean isFirst = true;
+        for (final ConnectionFactory factory : monitoredFactories) {
+            if (!isFirst) {
+                builder.append(',');
+            } else {
+                isFirst = false;
+            }
+            builder.append(factory);
+        }
+        builder.append(')');
+        return builder.toString();
     }
-  }
 
+    /**
+     * Returns the name of this load balancing algorithm.
+     *
+     * @return The name of this load balancing algorithm.
+     */
+    abstract String getAlgorithmName();
 
+    /**
+     * Returns the index of the first connection factory which should be used in
+     * order to satisfy the next connection request.
+     *
+     * @return The index of the first connection factory which should be used in
+     *         order to satisfy the next connection request.
+     */
+    abstract int getInitialConnectionFactoryIndex();
 
-  private final List<MonitoredConnectionFactory> monitoredFactories;
+    // Return the first factory after index which is operational.
+    private MonitoredConnectionFactory getMonitoredConnectionFactory(final int initialIndex)
+            throws ErrorResultException {
+        int index = initialIndex;
+        final int maxIndex = monitoredFactories.size();
+        do {
+            final MonitoredConnectionFactory factory = monitoredFactories.get(index);
+            if (factory.isOperational.get()) {
+                return factory;
+            }
+            index = (index + 1) % maxIndex;
+        } while (index != initialIndex);
 
-  private final ScheduledExecutorService scheduler;
-
-  private final Object stateLock = new Object();
-
-  // Guarded by stateLock.
-  private int offlineFactoriesCount = 0;
-
-  private final long monitoringInterval;
-
-  private final TimeUnit monitoringIntervalTimeUnit;
-
-  // Guarded by stateLock.
-  private ScheduledFuture<?> monitoringFuture;
-
-
-
-  /**
-   * Creates a new abstract load balancing algorithm which will monitor offline
-   * connection factories every second using the default scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   */
-  AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories)
-  {
-    this(factories, 1, TimeUnit.SECONDS, StaticUtils.getDefaultScheduler());
-  }
-
-
-
-  /**
-   * Creates a new abstract load balancing algorithm which will monitor offline
-   * connection factories using the specified frequency using the default
-   * scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   */
-  AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
-      final long interval, final TimeUnit unit)
-  {
-    this(factories, interval, unit, StaticUtils.getDefaultScheduler());
-  }
-
-
-
-  /**
-   * Creates a new abstract load balancing algorithm which will monitor offline
-   * connection factories using the specified frequency and scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   * @param scheduler
-   *          The scheduler which should for periodically monitoring dead
-   *          connection factories to see if they are usable again.
-   */
-  AbstractLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
-      final long interval, final TimeUnit unit,
-      final ScheduledExecutorService scheduler)
-  {
-    Validator.ensureNotNull(factories, scheduler, unit);
-
-    this.monitoredFactories = new ArrayList<MonitoredConnectionFactory>(
-        factories.size());
-    int i = 0;
-    for (final ConnectionFactory f : factories)
-    {
-      this.monitoredFactories.add(new MonitoredConnectionFactory(f, i++));
+        // All factories are offline so give up. We could have a
+        // configurable policy here such as waiting indefinitely, or for a
+        // configurable timeout period.
+        throw newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR,
+                "No operational connection factories available");
     }
-    this.scheduler = scheduler;
-    this.monitoringInterval = interval;
-    this.monitoringIntervalTimeUnit = unit;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final ConnectionFactory getConnectionFactory()
-      throws ErrorResultException
-  {
-    final int index = getInitialConnectionFactoryIndex();
-    return getMonitoredConnectionFactory(index);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append(getAlgorithmName());
-    builder.append('(');
-    boolean isFirst = true;
-    for (final ConnectionFactory factory : monitoredFactories)
-    {
-      if (!isFirst)
-      {
-        builder.append(',');
-      }
-      else
-      {
-        isFirst = false;
-      }
-      builder.append(factory);
-    }
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  /**
-   * Returns the name of this load balancing algorithm.
-   *
-   * @return The name of this load balancing algorithm.
-   */
-  abstract String getAlgorithmName();
-
-
-
-  /**
-   * Returns the index of the first connection factory which should be used in
-   * order to satisfy the next connection request.
-   *
-   * @return The index of the first connection factory which should be used in
-   *         order to satisfy the next connection request.
-   */
-  abstract int getInitialConnectionFactoryIndex();
-
-
-
-  // Return the first factory after index which is operational.
-  private MonitoredConnectionFactory getMonitoredConnectionFactory(
-      final int initialIndex) throws ErrorResultException
-  {
-    int index = initialIndex;
-    final int maxIndex = monitoredFactories.size();
-    do
-    {
-      final MonitoredConnectionFactory factory = monitoredFactories.get(index);
-      if (factory.isOperational.get())
-      {
-        return factory;
-      }
-      index = (index + 1) % maxIndex;
-    }
-    while (index != initialIndex);
-
-    // All factories are offline so give up. We could have a
-    // configurable policy here such as waiting indefinitely, or for a
-    // configurable timeout period.
-    throw newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR,
-        "No operational connection factories available");
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java
index 89030e9..9825e45 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,172 +27,124 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 import java.util.Map;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Abstract implementation for {@code Map} based entries.
  */
-abstract class AbstractMapEntry extends AbstractEntry
-{
-  private final Map<AttributeDescription, Attribute> attributes;
+abstract class AbstractMapEntry extends AbstractEntry {
+    private final Map<AttributeDescription, Attribute> attributes;
 
-  private DN name;
+    private DN name;
 
-
-
-  /**
-   * Creates an empty entry using the provided distinguished name and {@code
-   * Map}.
-   *
-   * @param name
-   *          The distinguished name of this entry.
-   * @param attributes
-   *          The attribute map.
-   */
-  AbstractMapEntry(final DN name,
-      final Map<AttributeDescription, Attribute> attributes)
-  {
-    this.name = name;
-    this.attributes = attributes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean addAttribute(final Attribute attribute,
-      final Collection<ByteString> duplicateValues)
-  {
-    Validator.ensureNotNull(attribute);
-
-    final AttributeDescription attributeDescription = attribute
-        .getAttributeDescription();
-    final Attribute oldAttribute = attributes.get(attributeDescription);
-    if (oldAttribute != null)
-    {
-      return oldAttribute.addAll(attribute, duplicateValues);
+    /**
+     * Creates an empty entry using the provided distinguished name and
+     * {@code Map}.
+     *
+     * @param name
+     *            The distinguished name of this entry.
+     * @param attributes
+     *            The attribute map.
+     */
+    AbstractMapEntry(final DN name, final Map<AttributeDescription, Attribute> attributes) {
+        this.name = name;
+        this.attributes = attributes;
     }
-    else
-    {
-      attributes.put(attributeDescription, attribute);
-      return true;
-    }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean addAttribute(final Attribute attribute,
+            final Collection<ByteString> duplicateValues) {
+        Validator.ensureNotNull(attribute);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public final Entry clearAttributes()
-  {
-    attributes.clear();
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final Iterable<Attribute> getAllAttributes()
-  {
-    return attributes.values();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final Attribute getAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-
-    return attributes.get(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final int getAttributeCount()
-  {
-    return attributes.size();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final DN getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean removeAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    Validator.ensureNotNull(attribute);
-
-    final AttributeDescription attributeDescription = attribute
-        .getAttributeDescription();
-
-    if (attribute.isEmpty())
-    {
-      return attributes.remove(attributeDescription) != null;
-    }
-    else
-    {
-      final Attribute oldAttribute = attributes.get(attributeDescription);
-      if (oldAttribute != null)
-      {
-        final boolean modified = oldAttribute.removeAll(attribute,
-            missingValues);
-        if (oldAttribute.isEmpty())
-        {
-          attributes.remove(attributeDescription);
-          return true;
+        final AttributeDescription attributeDescription = attribute.getAttributeDescription();
+        final Attribute oldAttribute = attributes.get(attributeDescription);
+        if (oldAttribute != null) {
+            return oldAttribute.addAll(attribute, duplicateValues);
+        } else {
+            attributes.put(attributeDescription, attribute);
+            return true;
         }
-        return modified;
-      }
-      else
-      {
-        if (missingValues != null)
-        {
-          missingValues.addAll(attribute);
-        }
-        return false;
-      }
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final Entry clearAttributes() {
+        attributes.clear();
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final Iterable<Attribute> getAllAttributes() {
+        return attributes.values();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final Entry setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = dn;
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final Attribute getAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+
+        return attributes.get(attributeDescription);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final int getAttributeCount() {
+        return attributes.size();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final DN getName() {
+        return name;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean removeAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        Validator.ensureNotNull(attribute);
+
+        final AttributeDescription attributeDescription = attribute.getAttributeDescription();
+
+        if (attribute.isEmpty()) {
+            return attributes.remove(attributeDescription) != null;
+        } else {
+            final Attribute oldAttribute = attributes.get(attributeDescription);
+            if (oldAttribute != null) {
+                final boolean modified = oldAttribute.removeAll(attribute, missingValues);
+                if (oldAttribute.isEmpty()) {
+                    attributes.remove(attributeDescription);
+                    return true;
+                }
+                return modified;
+            } else {
+                if (missingValues != null) {
+                    missingValues.addAll(attribute);
+                }
+                return false;
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final Entry setName(final DN dn) {
+        Validator.ensureNotNull(dn);
+        this.name = dn;
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Assertion.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Assertion.java
index e7e0bbd..08a65ae 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Assertion.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Assertion.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,22 +26,19 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A compiled attribute value assertion.
  */
-public interface Assertion
-{
-  /**
-   * Indicates whether the provided attribute value should be considered a match
-   * for this assertion value according to the matching rule.
-   *
-   * @param attributeValue
-   *          The attribute value.
-   * @return {@code TRUE} if the attribute value should be considered a match
-   *         for the provided assertion value, {@code FALSE} if it does not
-   *         match, or {@code UNDEFINED} if the result is undefined.
-   */
-  public abstract ConditionResult matches(ByteSequence attributeValue);
+public interface Assertion {
+    /**
+     * Indicates whether the provided attribute value should be considered a
+     * match for this assertion value according to the matching rule.
+     *
+     * @param attributeValue
+     *            The attribute value.
+     * @return {@code TRUE} if the attribute value should be considered a match
+     *         for the provided assertion value, {@code FALSE} if it does not
+     *         match, or {@code UNDEFINED} if the result is undefined.
+     */
+    public abstract ConditionResult matches(ByteSequence attributeValue);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java
index b55e916..4c3047a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * failed because the filter contained in an assertion control failed to match
@@ -40,10 +35,8 @@
  * {@link ResultCode#ASSERTION_FAILED ASSERTION_FAILED} result code.
  */
 @SuppressWarnings("serial")
-public class AssertionFailureException extends ErrorResultException
-{
-  AssertionFailureException(final Result result)
-  {
-    super(result);
-  }
+public class AssertionFailureException extends ErrorResultException {
+    AssertionFailureException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attribute.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attribute.java
index 068a799..2ef52e0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attribute.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attribute.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
-import java.util.*;
-
-
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
 
 /**
  * An attribute, comprising of an attribute description and zero or more
@@ -58,419 +56,380 @@
  * </pre>
  * <p>
  */
-public interface Attribute extends Set<ByteString>
-{
-  // TODO: matching against attribute value assertions.
+public interface Attribute extends Set<ByteString> {
+    // TODO: matching against attribute value assertions.
 
+    /**
+     * Adds {@code value} to this attribute if it is not already present
+     * (optional operation). If this attribute already contains {@code value},
+     * the call leaves the attribute unchanged and returns {@code false}.
+     *
+     * @param value
+     *            The attribute value to be added to this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support addition of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code value} was {@code null}.
+     */
+    boolean add(ByteString value);
 
+    /**
+     * Adds all of the provided attribute values to this attribute if they are
+     * not already present (optional operation).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param firstValue
+     *            The first attribute value to be added to this attribute.
+     * @param remainingValues
+     *            The remaining attribute values to be added to this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support addition of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code firstValue} was {@code null}.
+     */
+    boolean add(Object firstValue, Object... remainingValues);
 
-  /**
-   * Adds {@code value} to this attribute if it is not already present (optional
-   * operation). If this attribute already contains {@code value}, the call
-   * leaves the attribute unchanged and returns {@code false}.
-   *
-   * @param value
-   *          The attribute value to be added to this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support addition of attribute values.
-   * @throws NullPointerException
-   *           If {@code value} was {@code null}.
-   */
-  boolean add(ByteString value);
+    /**
+     * Adds all of the attribute values contained in {@code values} to this
+     * attribute if they are not already present (optional operation).
+     * <p>
+     * An invocation of this method is equivalent to:
+     *
+     * <pre>
+     * attribute.addAll(values, null);
+     * </pre>
+     *
+     * @param values
+     *            The attribute values to be added to this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support addition of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    boolean addAll(Collection<? extends ByteString> values);
 
+    /**
+     * Adds all of the attribute values contained in {@code values} to this
+     * attribute if they are not already present (optional operation). Any
+     * attribute values which are already present will be added to
+     * {@code duplicateValues} if specified.
+     *
+     * @param values
+     *            The attribute values to be added to this attribute.
+     * @param duplicateValues
+     *            A collection into which duplicate values will be added, or
+     *            {@code null} if duplicate values should not be saved.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support addition of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    boolean addAll(Collection<? extends ByteString> values,
+            Collection<? super ByteString> duplicateValues);
 
+    /**
+     * Removes all of the attribute values from this attribute (optional
+     * operation). This attribute will be empty after this call returns.
+     *
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     */
+    void clear();
 
-  /**
-   * Adds all of the provided attribute values to this attribute if they are not
-   * already present (optional operation).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param firstValue
-   *          The first attribute value to be added to this attribute.
-   * @param remainingValues
-   *          The remaining attribute values to be added to this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support addition of attribute values.
-   * @throws NullPointerException
-   *           If {@code firstValue} was {@code null}.
-   */
-  boolean add(Object firstValue, Object... remainingValues);
+    /**
+     * Returns {@code true} if this attribute contains {@code value}.
+     * <p>
+     * If {@code value} is not an instance of {@code ByteString} then it will be
+     * converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param value
+     *            The attribute value whose presence in this attribute is to be
+     *            tested.
+     * @return {@code true} if this attribute contains {@code value}, or
+     *         {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code value} was {@code null}.
+     */
+    boolean contains(Object value);
 
+    /**
+     * Returns {@code true} if this attribute contains all of the attribute
+     * values contained in {@code values}.
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param values
+     *            The attribute values whose presence in this attribute is to be
+     *            tested.
+     * @return {@code true} if this attribute contains all of the attribute
+     *         values contained in {@code values}, or {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    boolean containsAll(Collection<?> values);
 
+    /**
+     * Returns {@code true} if {@code object} is an attribute which is equal to
+     * this attribute. Two attributes are considered equal if their attribute
+     * descriptions are equal, they both have the same number of attribute
+     * values, and every attribute value contained in the first attribute is
+     * also contained in the second attribute.
+     *
+     * @param object
+     *            The object to be tested for equality with this attribute.
+     * @return {@code true} if {@code object} is an attribute which is equal to
+     *         this attribute, or {@code false} if not.
+     */
+    boolean equals(Object object);
 
-  /**
-   * Adds all of the attribute values contained in {@code values} to this
-   * attribute if they are not already present (optional operation).
-   * <p>
-   * An invocation of this method is equivalent to:
-   *
-   * <pre>
-   * attribute.addAll(values, null);
-   * </pre>
-   *
-   * @param values
-   *          The attribute values to be added to this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support addition of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  boolean addAll(Collection<? extends ByteString> values);
+    /**
+     * Returns the first attribute value in this attribute.
+     *
+     * @return The first attribute value in this attribute.
+     * @throws NoSuchElementException
+     *             If this attribute is empty.
+     */
+    ByteString firstValue();
 
+    /**
+     * Returns the first attribute value in this attribute decoded as a UTF-8
+     * string.
+     *
+     * @return The first attribute value in this attribute decoded as a UTF-8
+     *         string.
+     * @throws NoSuchElementException
+     *             If this attribute is empty.
+     */
+    String firstValueAsString();
 
+    /**
+     * Returns the attribute description of this attribute, which includes its
+     * attribute type and any options.
+     *
+     * @return The attribute description.
+     */
+    AttributeDescription getAttributeDescription();
 
-  /**
-   * Adds all of the attribute values contained in {@code values} to this
-   * attribute if they are not already present (optional operation). Any
-   * attribute values which are already present will be added to {@code
-   * duplicateValues} if specified.
-   *
-   * @param values
-   *          The attribute values to be added to this attribute.
-   * @param duplicateValues
-   *          A collection into which duplicate values will be added, or {@code
-   *          null} if duplicate values should not be saved.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support addition of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  boolean addAll(Collection<? extends ByteString> values,
-      Collection<? super ByteString> duplicateValues);
+    /**
+     * Returns the string representation of the attribute description of this
+     * attribute, which includes its attribute type and any options.
+     *
+     * @return The string representation of the attribute description.
+     */
+    String getAttributeDescriptionAsString();
 
+    /**
+     * Returns the hash code for this attribute. It will be calculated as the
+     * sum of the hash codes of the attribute description and all of the
+     * attribute values.
+     *
+     * @return The hash code for this attribute.
+     */
+    int hashCode();
 
+    /**
+     * Returns {@code true} if this attribute contains no attribute values.
+     *
+     * @return {@code true} if this attribute contains no attribute values.
+     */
+    boolean isEmpty();
 
-  /**
-   * Removes all of the attribute values from this attribute (optional
-   * operation). This attribute will be empty after this call returns.
-   *
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   */
-  void clear();
+    /**
+     * Returns an iterator over the attribute values in this attribute. The
+     * attribute values are returned in no particular order, unless the
+     * implementation of this attribute provides such a guarantee.
+     *
+     * @return An iterator over the attribute values in this attribute.
+     */
+    Iterator<ByteString> iterator();
 
+    /**
+     * Removes {@code value} from this attribute if it is present (optional
+     * operation). If this attribute does not contain {@code value}, the call
+     * leaves the attribute unchanged and returns {@code false}.
+     * <p>
+     * If {@code value} is not an instance of {@code ByteString} then it will be
+     * converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param value
+     *            The attribute value to be removed from this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code value} was {@code null}.
+     */
+    boolean remove(Object value);
 
+    /**
+     * Removes all of the attribute values contained in {@code values} from this
+     * attribute if they are present (optional operation).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     * <p>
+     * An invocation of this method is equivalent to:
+     *
+     * <pre>
+     * attribute.removeAll(values, null);
+     * </pre>
+     *
+     * @param values
+     *            The attribute values to be removed from this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    boolean removeAll(Collection<?> values);
 
-  /**
-   * Returns {@code true} if this attribute contains {@code value}.
-   * <p>
-   * If {@code value} is not an instance of {@code ByteString} then it will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param value
-   *          The attribute value whose presence in this attribute is to be
-   *          tested.
-   * @return {@code true} if this attribute contains {@code value}, or {@code
-   *         false} if not.
-   * @throws NullPointerException
-   *           If {@code value} was {@code null}.
-   */
-  boolean contains(Object value);
+    /**
+     * Removes all of the attribute values contained in {@code values} from this
+     * attribute if they are present (optional operation). Any attribute values
+     * which are not already present will be added to {@code missingValues} if
+     * specified.
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param <T>
+     *            The type of the attribute value objects being removed.
+     * @param values
+     *            The attribute values to be removed from this attribute.
+     * @param missingValues
+     *            A collection into which missing values will be added, or
+     *            {@code null} if missing values should not be saved.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    <T> boolean removeAll(Collection<T> values, Collection<? super T> missingValues);
 
+    /**
+     * Retains only the attribute values in this attribute which are contained
+     * in {@code values} (optional operation).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     * <p>
+     * An invocation of this method is equivalent to:
+     *
+     * <pre>
+     * attribute.retainAll(values, null);
+     * </pre>
+     *
+     * @param values
+     *            The attribute values to be retained in this attribute.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    boolean retainAll(Collection<?> values);
 
-
-  /**
-   * Returns {@code true} if this attribute contains all of the attribute values
-   * contained in {@code values}.
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param values
-   *          The attribute values whose presence in this attribute is to be
-   *          tested.
-   * @return {@code true} if this attribute contains all of the attribute values
-   *         contained in {@code values}, or {@code false} if not.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  boolean containsAll(Collection<?> values);
-
-
-
-  /**
-   * Returns {@code true} if {@code object} is an attribute which is equal to
-   * this attribute. Two attributes are considered equal if their attribute
-   * descriptions are equal, they both have the same number of attribute values,
-   * and every attribute value contained in the first attribute is also
-   * contained in the second attribute.
-   *
-   * @param object
-   *          The object to be tested for equality with this attribute.
-   * @return {@code true} if {@code object} is an attribute which is equal to
-   *         this attribute, or {@code false} if not.
-   */
-  boolean equals(Object object);
-
-
-
-  /**
-   * Returns the first attribute value in this attribute.
-   *
-   * @return The first attribute value in this attribute.
-   * @throws NoSuchElementException
-   *           If this attribute is empty.
-   */
-  ByteString firstValue();
-
-
-
-  /**
-   * Returns the first attribute value in this attribute decoded as a UTF-8
-   * string.
-   *
-   * @return The first attribute value in this attribute decoded as a UTF-8
-   *         string.
-   * @throws NoSuchElementException
-   *           If this attribute is empty.
-   */
-  String firstValueAsString();
-
-
-
-  /**
-   * Returns the attribute description of this attribute, which includes its
-   * attribute type and any options.
-   *
-   * @return The attribute description.
-   */
-  AttributeDescription getAttributeDescription();
-
-
-
-  /**
-   * Returns the string representation of the attribute description of this
-   * attribute, which includes its attribute type and any options.
-   *
-   * @return The string representation of the attribute description.
-   */
-  String getAttributeDescriptionAsString();
-
-
-
-  /**
-   * Returns the hash code for this attribute. It will be calculated as the sum
-   * of the hash codes of the attribute description and all of the attribute
-   * values.
-   *
-   * @return The hash code for this attribute.
-   */
-  int hashCode();
-
-
-
-  /**
-   * Returns {@code true} if this attribute contains no attribute values.
-   *
-   * @return {@code true} if this attribute contains no attribute values.
-   */
-  boolean isEmpty();
-
-
-
-  /**
-   * Returns an iterator over the attribute values in this attribute. The
-   * attribute values are returned in no particular order, unless the
-   * implementation of this attribute provides such a guarantee.
-   *
-   * @return An iterator over the attribute values in this attribute.
-   */
-  Iterator<ByteString> iterator();
-
-
-
-  /**
-   * Removes {@code value} from this attribute if it is present (optional
-   * operation). If this attribute does not contain {@code value}, the call
-   * leaves the attribute unchanged and returns {@code false}.
-   * <p>
-   * If {@code value} is not an instance of {@code ByteString} then it will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param value
-   *          The attribute value to be removed from this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   * @throws NullPointerException
-   *           If {@code value} was {@code null}.
-   */
-  boolean remove(Object value);
-
-
-
-  /**
-   * Removes all of the attribute values contained in {@code values} from this
-   * attribute if they are present (optional operation).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   * <p>
-   * An invocation of this method is equivalent to:
-   *
-   * <pre>
-   * attribute.removeAll(values, null);
-   * </pre>
-   *
-   * @param values
-   *          The attribute values to be removed from this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  boolean removeAll(Collection<?> values);
-
-
-
-  /**
-   * Removes all of the attribute values contained in {@code values} from this
-   * attribute if they are present (optional operation). Any attribute values
-   * which are not already present will be added to {@code missingValues} if
-   * specified.
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param <T>
-   *          The type of the attribute value objects being removed.
-   * @param values
-   *          The attribute values to be removed from this attribute.
-   * @param missingValues
-   *          A collection into which missing values will be added, or {@code
-   *          null} if missing values should not be saved.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  <T> boolean removeAll(Collection<T> values,
-      Collection<? super T> missingValues);
-
-
-
-  /**
-   * Retains only the attribute values in this attribute which are contained in
-   * {@code values} (optional operation).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   * <p>
-   * An invocation of this method is equivalent to:
-   *
-   * <pre>
-   * attribute.retainAll(values, null);
-   * </pre>
-   *
-   * @param values
-   *          The attribute values to be retained in this attribute.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  boolean retainAll(Collection<?> values);
-
-
-
-  /**
-   * Retains only the attribute values in this attribute which are contained in
-   * {@code values} (optional operation). Any attribute values which are not
-   * already present will be added to {@code missingValues} if specified.
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param <T>
-   *          The type of the attribute value objects being retained.
-   * @param values
-   *          The attribute values to be retained in this attribute.
-   * @param missingValues
-   *          A collection into which missing values will be added, or {@code
-   *          null} if missing values should not be saved.
-   * @return {@code true} if this attribute changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this attribute does not support removal of attribute values.
-   * @throws NullPointerException
-   *           If {@code values} was {@code null}.
-   */
-  <T> boolean retainAll(Collection<T> values,
-      Collection<? super T> missingValues);
-
-
-
-  /**
-   * Returns the number of attribute values in this attribute.
-   *
-   * @return The number of attribute values in this attribute.
-   */
-  int size();
-
-
-
-  /**
-   * Returns an array containing all of the attribute values contained in this
-   * attribute.
-   * <p>
-   * If this attribute makes any guarantees as to what order its attribute
-   * values are returned by its iterator, this method must return the attribute
-   * values in the same order.
-   * <p>
-   * The returned array will be "safe" in that no references to it are
-   * maintained by this attribute. The caller is thus free to modify the
-   * returned array.
-   *
-   * @return An array containing all of the attribute values contained in this
-   *         attribute.
-   */
-  ByteString[] toArray();
-
-
+    /**
+     * Retains only the attribute values in this attribute which are contained
+     * in {@code values} (optional operation). Any attribute values which are
+     * not already present will be added to {@code missingValues} if specified.
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param <T>
+     *            The type of the attribute value objects being retained.
+     * @param values
+     *            The attribute values to be retained in this attribute.
+     * @param missingValues
+     *            A collection into which missing values will be added, or
+     *            {@code null} if missing values should not be saved.
+     * @return {@code true} if this attribute changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this attribute does not support removal of attribute
+     *             values.
+     * @throws NullPointerException
+     *             If {@code values} was {@code null}.
+     */
+    <T> boolean retainAll(Collection<T> values, Collection<? super T> missingValues);
 
-  /**
-   * Returns an array containing all of the attribute values in this attribute;
-   * the runtime type of the returned array is that of the specified array.
-   * <p>
-   * If the set fits in the specified array, it is returned therein. Otherwise,
-   * a new array is allocated with the runtime type of the specified array and
-   * the size of this attribute. If this attribute fits in the specified array
-   * with room to spare (i.e., the array has more elements than this attribute),
-   * the elements in the array immediately following the end of the set is set
-   * to {@code null}.
-   * <p>
-   * If this attribute makes any guarantees as to what order its attribute
-   * values are returned by its iterator, this method must return the attribute
-   * values in the same order.
-   *
-   * @param <T>
-   *          The type of elements contained in {@code array}.
-   * @param array
-   *          An array into which the elements of this attribute should be put.
-   * @return An array containing all of the attribute values contained in this
-   *         attribute.
-   * @throws ArrayStoreException
-   *           If the runtime type of {@code array} is not a supertype of
-   *           {@code ByteString}.
-   * @throws NullPointerException
-   *           If {@code array} was {@code null}.
-   */
-  <T> T[] toArray(T[] array);
+    /**
+     * Returns the number of attribute values in this attribute.
+     *
+     * @return The number of attribute values in this attribute.
+     */
+    int size();
 
+    /**
+     * Returns an array containing all of the attribute values contained in this
+     * attribute.
+     * <p>
+     * If this attribute makes any guarantees as to what order its attribute
+     * values are returned by its iterator, this method must return the
+     * attribute values in the same order.
+     * <p>
+     * The returned array will be "safe" in that no references to it are
+     * maintained by this attribute. The caller is thus free to modify the
+     * returned array.
+     *
+     * @return An array containing all of the attribute values contained in this
+     *         attribute.
+     */
+    ByteString[] toArray();
 
+    /**
+     * Returns an array containing all of the attribute values in this
+     * attribute; the runtime type of the returned array is that of the
+     * specified array.
+     * <p>
+     * If the set fits in the specified array, it is returned therein.
+     * Otherwise, a new array is allocated with the runtime type of the
+     * specified array and the size of this attribute. If this attribute fits in
+     * the specified array with room to spare (i.e., the array has more elements
+     * than this attribute), the elements in the array immediately following the
+     * end of the set is set to {@code null}.
+     * <p>
+     * If this attribute makes any guarantees as to what order its attribute
+     * values are returned by its iterator, this method must return the
+     * attribute values in the same order.
+     *
+     * @param <T>
+     *            The type of elements contained in {@code array}.
+     * @param array
+     *            An array into which the elements of this attribute should be
+     *            put.
+     * @return An array containing all of the attribute values contained in this
+     *         attribute.
+     * @throws ArrayStoreException
+     *             If the runtime type of {@code array} is not a supertype of
+     *             {@code ByteString}.
+     * @throws NullPointerException
+     *             If {@code array} was {@code null}.
+     */
+    <T> T[] toArray(T[] array);
 
-  /**
-   * Returns a string representation of this attribute.
-   *
-   * @return The string representation of this attribute.
-   */
-  String toString();
+    /**
+     * Returns a string representation of this attribute.
+     *
+     * @return The string representation of this attribute.
+     */
+    String toString();
 }
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 bbe259f..6921105 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
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,23 +27,29 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.WeakHashMap;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.schema.*;
+import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
 
 import com.forgerock.opendj.util.ASCIICharProp;
 import com.forgerock.opendj.util.Iterators;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An attribute description as defined in RFC 4512 section 2.5. Attribute
  * descriptions are used to identify an attribute in an entry and are composed
@@ -54,1380 +59,1054 @@
  *      Lightweight Directory Access Protocol (LDAP): Directory Information
  *      Models </a>
  */
-public final class AttributeDescription implements
-    Comparable<AttributeDescription>
-{
-  private static abstract class Impl implements Iterable<String>
-  {
-    protected Impl()
-    {
-      // Nothing to do.
-    }
-
-
-
-    public abstract int compareTo(Impl other);
-
-
-
-    public abstract boolean containsOption(String normalizedOption);
-
-
-
-    public abstract boolean equals(Impl other);
-
-
-
-    public abstract String firstNormalizedOption();
-
-
-
-    @Override
-    public abstract int hashCode();
-
-
-
-    public abstract boolean hasOptions();
-
-
-
-    public abstract boolean isSubTypeOf(Impl other);
-
-
-
-    public abstract boolean isSuperTypeOf(Impl other);
-
-
-
-    public abstract int size();
-
-  }
-
-
-
-  private static final class MultiOptionImpl extends Impl
-  {
-
-    private final String[] normalizedOptions;
-
-    private final String[] options;
-
-
-
-    private MultiOptionImpl(final String[] options,
-        final String[] normalizedOptions)
-    {
-      if (normalizedOptions.length < 2)
-      {
-        throw new AssertionError();
-      }
-
-      this.options = options;
-      this.normalizedOptions = normalizedOptions;
-    }
-
-
-
-    @Override
-    public int compareTo(final Impl other)
-    {
-      final int thisSize = normalizedOptions.length;
-      final int otherSize = other.size();
-
-      if (thisSize < otherSize)
-      {
-        return -1;
-      }
-      else if (thisSize > otherSize)
-      {
-        return 1;
-      }
-      else
-      {
-        // Same number of options.
-        final MultiOptionImpl otherImpl = (MultiOptionImpl) other;
-        for (int i = 0; i < thisSize; i++)
-        {
-          final String o1 = normalizedOptions[i];
-          final String o2 = otherImpl.normalizedOptions[i];
-          final int result = o1.compareTo(o2);
-          if (result != 0)
-          {
-            return result;
-          }
+public final class AttributeDescription implements Comparable<AttributeDescription> {
+    private static abstract class Impl implements Iterable<String> {
+        protected Impl() {
+            // Nothing to do.
         }
 
-        // All options the same.
-        return 0;
-      }
+        public abstract int compareTo(Impl other);
+
+        public abstract boolean containsOption(String normalizedOption);
+
+        public abstract boolean equals(Impl other);
+
+        public abstract String firstNormalizedOption();
+
+        @Override
+        public abstract int hashCode();
+
+        public abstract boolean hasOptions();
+
+        public abstract boolean isSubTypeOf(Impl other);
+
+        public abstract boolean isSuperTypeOf(Impl other);
+
+        public abstract int size();
+
     }
 
+    private static final class MultiOptionImpl extends Impl {
 
+        private final String[] normalizedOptions;
 
-    @Override
-    public boolean containsOption(final String normalizedOption)
-    {
-      final int sz = normalizedOptions.length;
-      for (int i = 0; i < sz; i++)
-      {
-        if (normalizedOptions[i].equals(normalizedOption))
-        {
-          return true;
+        private final String[] options;
+
+        private MultiOptionImpl(final String[] options, final String[] normalizedOptions) {
+            if (normalizedOptions.length < 2) {
+                throw new AssertionError();
+            }
+
+            this.options = options;
+            this.normalizedOptions = normalizedOptions;
         }
-      }
-      return false;
-    }
 
+        @Override
+        public int compareTo(final Impl other) {
+            final int thisSize = normalizedOptions.length;
+            final int otherSize = other.size();
 
+            if (thisSize < otherSize) {
+                return -1;
+            } else if (thisSize > otherSize) {
+                return 1;
+            } else {
+                // Same number of options.
+                final MultiOptionImpl otherImpl = (MultiOptionImpl) other;
+                for (int i = 0; i < thisSize; i++) {
+                    final String o1 = normalizedOptions[i];
+                    final String o2 = otherImpl.normalizedOptions[i];
+                    final int result = o1.compareTo(o2);
+                    if (result != 0) {
+                        return result;
+                    }
+                }
 
-    @Override
-    public boolean equals(final Impl other)
-    {
-      if (other instanceof MultiOptionImpl)
-      {
-        final MultiOptionImpl tmp = (MultiOptionImpl) other;
-        return Arrays.equals(normalizedOptions, tmp.normalizedOptions);
-      }
-      else
-      {
-        return false;
-      }
-    }
+                // All options the same.
+                return 0;
+            }
+        }
 
-
-
-    @Override
-    public String firstNormalizedOption()
-    {
-      return normalizedOptions[0];
-    }
-
-
-
-    @Override
-    public int hashCode()
-    {
-      return Arrays.hashCode(normalizedOptions);
-    }
-
-
-
-    @Override
-    public boolean hasOptions()
-    {
-      return true;
-    }
-
-
-
-    @Override
-    public boolean isSubTypeOf(final Impl other)
-    {
-      // Must contain a super-set of other's options.
-      if (other == ZERO_OPTION_IMPL)
-      {
-        return true;
-      }
-      else if (other.size() == 1)
-      {
-        return containsOption(other.firstNormalizedOption());
-      }
-      else if (other.size() > size())
-      {
-        return false;
-      }
-      else
-      {
-        // Check this contains other's options.
-        //
-        // This could be optimized more if required, but it's probably
-        // not worth it.
-        final MultiOptionImpl tmp = (MultiOptionImpl) other;
-        for (final String normalizedOption : tmp.normalizedOptions)
-        {
-          if (!containsOption(normalizedOption))
-          {
+        @Override
+        public boolean containsOption(final String normalizedOption) {
+            final int sz = normalizedOptions.length;
+            for (int i = 0; i < sz; i++) {
+                if (normalizedOptions[i].equals(normalizedOption)) {
+                    return true;
+                }
+            }
             return false;
-          }
         }
-        return true;
-      }
-    }
 
-
-
-    @Override
-    public boolean isSuperTypeOf(final Impl other)
-    {
-      // Must contain a sub-set of other's options.
-      for (final String normalizedOption : normalizedOptions)
-      {
-        if (!other.containsOption(normalizedOption))
-        {
-          return false;
+        @Override
+        public boolean equals(final Impl other) {
+            if (other instanceof MultiOptionImpl) {
+                final MultiOptionImpl tmp = (MultiOptionImpl) other;
+                return Arrays.equals(normalizedOptions, tmp.normalizedOptions);
+            } else {
+                return false;
+            }
         }
-      }
-      return true;
+
+        @Override
+        public String firstNormalizedOption() {
+            return normalizedOptions[0];
+        }
+
+        @Override
+        public int hashCode() {
+            return Arrays.hashCode(normalizedOptions);
+        }
+
+        @Override
+        public boolean hasOptions() {
+            return true;
+        }
+
+        @Override
+        public boolean isSubTypeOf(final Impl other) {
+            // Must contain a super-set of other's options.
+            if (other == ZERO_OPTION_IMPL) {
+                return true;
+            } else if (other.size() == 1) {
+                return containsOption(other.firstNormalizedOption());
+            } else if (other.size() > size()) {
+                return false;
+            } else {
+                // Check this contains other's options.
+                //
+                // This could be optimized more if required, but it's probably
+                // not worth it.
+                final MultiOptionImpl tmp = (MultiOptionImpl) other;
+                for (final String normalizedOption : tmp.normalizedOptions) {
+                    if (!containsOption(normalizedOption)) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+        }
+
+        @Override
+        public boolean isSuperTypeOf(final Impl other) {
+            // Must contain a sub-set of other's options.
+            for (final String normalizedOption : normalizedOptions) {
+                if (!other.containsOption(normalizedOption)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public Iterator<String> iterator() {
+            return Iterators.arrayIterator(options);
+        }
+
+        @Override
+        public int size() {
+            return normalizedOptions.length;
+        }
+
     }
 
+    private static final class SingleOptionImpl extends Impl {
 
+        private final String normalizedOption;
 
-    public Iterator<String> iterator()
-    {
-      return Iterators.arrayIterator(options);
+        private final String option;
+
+        private SingleOptionImpl(final String option, final String normalizedOption) {
+            this.option = option;
+            this.normalizedOption = normalizedOption;
+        }
+
+        @Override
+        public int compareTo(final Impl other) {
+            if (other == ZERO_OPTION_IMPL) {
+                // If other has zero options then this sorts after.
+                return 1;
+            } else if (other.size() == 1) {
+                // Same number of options, so compare.
+                return normalizedOption.compareTo(other.firstNormalizedOption());
+            } else {
+                // Other has more options, so comes after.
+                return -1;
+            }
+        }
+
+        @Override
+        public boolean containsOption(final String normalizedOption) {
+            return this.normalizedOption.equals(normalizedOption);
+        }
+
+        @Override
+        public boolean equals(final Impl other) {
+            return other.size() == 1 && other.containsOption(normalizedOption);
+        }
+
+        @Override
+        public String firstNormalizedOption() {
+            return normalizedOption;
+        }
+
+        @Override
+        public int hashCode() {
+            return normalizedOption.hashCode();
+        }
+
+        @Override
+        public boolean hasOptions() {
+            return true;
+        }
+
+        @Override
+        public boolean isSubTypeOf(final Impl other) {
+            // Other must have no options or the same option.
+            if (other == ZERO_OPTION_IMPL) {
+                return true;
+            } else {
+                return equals(other);
+            }
+        }
+
+        @Override
+        public boolean isSuperTypeOf(final Impl other) {
+            // Other must have this option.
+            return other.containsOption(normalizedOption);
+        }
+
+        public Iterator<String> iterator() {
+            return Iterators.singletonIterator(option);
+        }
+
+        @Override
+        public int size() {
+            return 1;
+        }
+
     }
 
+    private static final class ZeroOptionImpl extends Impl {
+        private ZeroOptionImpl() {
+            // Nothing to do.
+        }
 
+        @Override
+        public int compareTo(final Impl other) {
+            // If other has options then this sorts before.
+            return this == other ? 0 : -1;
+        }
 
-    @Override
-    public int size()
-    {
-      return normalizedOptions.length;
+        @Override
+        public boolean containsOption(final String normalizedOption) {
+            return false;
+        }
+
+        @Override
+        public boolean equals(final Impl other) {
+            return this == other;
+        }
+
+        @Override
+        public String firstNormalizedOption() {
+            // No first option.
+            return null;
+        }
+
+        @Override
+        public int hashCode() {
+            // Use attribute type hash code.
+            return 0;
+        }
+
+        @Override
+        public boolean hasOptions() {
+            return false;
+        }
+
+        @Override
+        public boolean isSubTypeOf(final Impl other) {
+            // Can only be a sub-type if other has no options.
+            return this == other;
+        }
+
+        @Override
+        public boolean isSuperTypeOf(final Impl other) {
+            // Will always be a super-type.
+            return true;
+        }
+
+        public Iterator<String> iterator() {
+            return Iterators.emptyIterator();
+        }
+
+        @Override
+        public int size() {
+            return 0;
+        }
+
     }
 
-  }
+    private static final ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>> CACHE =
+            new ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>>() {
 
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
+                protected WeakHashMap<Schema, Map<String, AttributeDescription>> initialValue() {
+                    return new WeakHashMap<Schema, Map<String, AttributeDescription>>();
+                }
 
+            };
 
-  private static final class SingleOptionImpl extends Impl
-  {
+    // Object class attribute description.
+    private static final ZeroOptionImpl ZERO_OPTION_IMPL = new ZeroOptionImpl();
 
-    private final String normalizedOption;
-
-    private final String option;
-
-
-
-    private SingleOptionImpl(final String option, final String normalizedOption)
-    {
-      this.option = option;
-      this.normalizedOption = normalizedOption;
+    private static final AttributeDescription OBJECT_CLASS;
+    static {
+        final AttributeType attributeType = Schema.getCoreSchema().getAttributeType("2.5.4.0");
+        OBJECT_CLASS =
+                new AttributeDescription(attributeType.getNameOrOID(), attributeType,
+                        ZERO_OPTION_IMPL);
     }
 
-
-
-    @Override
-    public int compareTo(final Impl other)
-    {
-      if (other == ZERO_OPTION_IMPL)
-      {
-        // If other has zero options then this sorts after.
-        return 1;
-      }
-      else if (other.size() == 1)
-      {
-        // Same number of options, so compare.
-        return normalizedOption.compareTo(other.firstNormalizedOption());
-      }
-      else
-      {
-        // Other has more options, so comes after.
-        return -1;
-      }
-    }
-
-
-
-    @Override
-    public boolean containsOption(final String normalizedOption)
-    {
-      return this.normalizedOption.equals(normalizedOption);
-    }
-
-
-
-    @Override
-    public boolean equals(final Impl other)
-    {
-      return other.size() == 1 && other.containsOption(normalizedOption);
-    }
-
-
-
-    @Override
-    public String firstNormalizedOption()
-    {
-      return normalizedOption;
-    }
-
-
-
-    @Override
-    public int hashCode()
-    {
-      return normalizedOption.hashCode();
-    }
-
-
-
-    @Override
-    public boolean hasOptions()
-    {
-      return true;
-    }
-
-
-
-    @Override
-    public boolean isSubTypeOf(final Impl other)
-    {
-      // Other must have no options or the same option.
-      if (other == ZERO_OPTION_IMPL)
-      {
-        return true;
-      }
-      else
-      {
-        return equals(other);
-      }
-    }
-
-
-
-    @Override
-    public boolean isSuperTypeOf(final Impl other)
-    {
-      // Other must have this option.
-      return other.containsOption(normalizedOption);
-    }
-
-
-
-    public Iterator<String> iterator()
-    {
-      return Iterators.singletonIterator(option);
-    }
-
-
-
-    @Override
-    public int size()
-    {
-      return 1;
-    }
-
-  }
-
-
-
-  private static final class ZeroOptionImpl extends Impl
-  {
-    private ZeroOptionImpl()
-    {
-      // Nothing to do.
-    }
-
-
-
-    @Override
-    public int compareTo(final Impl other)
-    {
-      // If other has options then this sorts before.
-      return this == other ? 0 : -1;
-    }
-
-
-
-    @Override
-    public boolean containsOption(final String normalizedOption)
-    {
-      return false;
-    }
-
-
-
-    @Override
-    public boolean equals(final Impl other)
-    {
-      return this == other;
-    }
-
-
-
-    @Override
-    public String firstNormalizedOption()
-    {
-      // No first option.
-      return null;
-    }
-
-
-
-    @Override
-    public int hashCode()
-    {
-      // Use attribute type hash code.
-      return 0;
-    }
-
-
-
-    @Override
-    public boolean hasOptions()
-    {
-      return false;
-    }
-
-
-
-    @Override
-    public boolean isSubTypeOf(final Impl other)
-    {
-      // Can only be a sub-type if other has no options.
-      return this == other;
-    }
-
-
-
-    @Override
-    public boolean isSuperTypeOf(final Impl other)
-    {
-      // Will always be a super-type.
-      return true;
-    }
-
-
-
-    public Iterator<String> iterator()
-    {
-      return Iterators.emptyIterator();
-    }
-
-
-
-    @Override
-    public int size()
-    {
-      return 0;
-    }
-
-  }
-
-
-
-  private static final ThreadLocal<WeakHashMap<
-    Schema, Map<String, AttributeDescription>>> CACHE =
-      new ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>>()
-  {
+    // This is the size of the per-thread per-schema attribute description
+    // cache. We should be conservative here in case there are many
+    // threads.
+    private static final int ATTRIBUTE_DESCRIPTION_CACHE_SIZE = 512;
 
     /**
-     * {@inheritDoc}
+     * Returns an attribute description having the same attribute type and
+     * options as this attribute description as well as the provided option.
+     *
+     * @param option
+     *            The attribute option.
+     * @return The new attribute description containing {@code option}.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code option} was
+     *             {@code null}.
      */
-    @Override
-    protected WeakHashMap<Schema, Map<String, AttributeDescription>> initialValue()
-    {
-      return new WeakHashMap<Schema, Map<String, AttributeDescription>>();
-    }
+    public AttributeDescription withOption(final String option) {
+        Validator.ensureNotNull(option);
 
-  };
-
-  // Object class attribute description.
-  private static final ZeroOptionImpl ZERO_OPTION_IMPL = new ZeroOptionImpl();
-
-  private static final AttributeDescription OBJECT_CLASS;
-  static
-  {
-    final AttributeType attributeType = Schema.getCoreSchema()
-        .getAttributeType("2.5.4.0");
-    OBJECT_CLASS = new AttributeDescription(attributeType.getNameOrOID(),
-        attributeType, ZERO_OPTION_IMPL);
-  }
-
-  // This is the size of the per-thread per-schema attribute description
-  // cache. We should be conservative here in case there are many
-  // threads.
-  private static final int ATTRIBUTE_DESCRIPTION_CACHE_SIZE = 512;
-
-
-
-  /**
-   * Returns an attribute description having the same attribute type and options
-   * as this attribute description as well as the provided option.
-   *
-   * @param option
-   *          The attribute option.
-   * @return The new attribute description containing {@code option}.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code option} was
-   *           {@code null}.
-   */
-  public AttributeDescription withOption(final String option)
-  {
-    Validator.ensureNotNull(option);
-
-    final String normalizedOption = toLowerCase(option);
-    if (pimpl.containsOption(normalizedOption))
-    {
-      return this;
-    }
-
-    final String oldAttributeDescription = attributeDescription;
-    final StringBuilder builder = new StringBuilder(oldAttributeDescription
-        .length()
-        + option.length() + 1);
-    builder.append(oldAttributeDescription);
-    builder.append(';');
-    builder.append(option);
-    final String newAttributeDescription = builder.toString();
-
-    final Impl impl = pimpl;
-    if (impl instanceof ZeroOptionImpl)
-    {
-      return new AttributeDescription(newAttributeDescription,
-          attributeType, new SingleOptionImpl(option,
-              normalizedOption));
-
-    }
-    else if (impl instanceof SingleOptionImpl)
-    {
-      final SingleOptionImpl simpl = (SingleOptionImpl) impl;
-
-      final String[] newOptions = new String[2];
-      newOptions[0] = simpl.option;
-      newOptions[1] = option;
-
-      final String[] newNormalizedOptions = new String[2];
-      if (normalizedOption.compareTo(simpl.normalizedOption) < 0)
-      {
-        newNormalizedOptions[0] = normalizedOption;
-        newNormalizedOptions[1] = simpl.normalizedOption;
-      }
-
-      return new AttributeDescription(newAttributeDescription,
-          attributeType, new MultiOptionImpl(newOptions,
-              newNormalizedOptions));
-    }
-    else
-    {
-      final MultiOptionImpl mimpl = (MultiOptionImpl) impl;
-
-      final int sz1 = mimpl.options.length;
-      final String[] newOptions = new String[sz1 + 1];
-      for (int i = 0; i < sz1; i++)
-      {
-        newOptions[i] = mimpl.options[i];
-      }
-      newOptions[sz1] = option;
-
-      final int sz2 = mimpl.normalizedOptions.length;
-      final String[] newNormalizedOptions = new String[sz2 + 1];
-      boolean inserted = false;
-      for (int i = 0; i < sz2; i++)
-      {
-        if (!inserted)
-        {
-          final String s = mimpl.normalizedOptions[i];
-          if (normalizedOption.compareTo(s) < 0)
-          {
-            newNormalizedOptions[i] = normalizedOption;
-            newNormalizedOptions[i + 1] = s;
-            inserted = true;
-          }
-          else
-          {
-            newNormalizedOptions[i] = s;
-          }
+        final String normalizedOption = toLowerCase(option);
+        if (pimpl.containsOption(normalizedOption)) {
+            return this;
         }
-        else
-        {
-          newNormalizedOptions[i + 1] = mimpl.normalizedOptions[i];
-        }
-      }
 
-      if (!inserted)
-      {
-        newNormalizedOptions[sz2] = normalizedOption;
-      }
-
-      return new AttributeDescription(newAttributeDescription,
-          attributeType, new MultiOptionImpl(newOptions,
-              newNormalizedOptions));
-    }
-  }
-
-
-
-  /**
-   * Creates an attribute description having the provided attribute type and no
-   * options.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @return The attribute description.
-   * @throws NullPointerException
-   *           If {@code attributeType} was {@code null}.
-   */
-  public static AttributeDescription create(final AttributeType attributeType)
-  {
-    Validator.ensureNotNull(attributeType);
-
-    // Use object identity in case attribute type does not come from
-    // core schema.
-    if (attributeType == OBJECT_CLASS.getAttributeType())
-    {
-      return OBJECT_CLASS;
-    }
-    else
-    {
-      return new AttributeDescription(attributeType.getNameOrOID(),
-          attributeType, ZERO_OPTION_IMPL);
-    }
-  }
-
-
-
-  /**
-   * Creates an attribute description having the provided attribute type and
-   * single option.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param option
-   *          The attribute option.
-   * @return The attribute description.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code option} was {@code null}.
-   */
-  public static AttributeDescription create(final AttributeType attributeType,
-      final String option)
-  {
-    Validator.ensureNotNull(attributeType, option);
-
-    final String oid = attributeType.getNameOrOID();
-    final StringBuilder builder = new StringBuilder(oid.length()
-        + option.length() + 1);
-    builder.append(oid);
-    builder.append(';');
-    builder.append(option);
-    final String attributeDescription = builder.toString();
-    final String normalizedOption = toLowerCase(option);
-
-    return new AttributeDescription(attributeDescription, attributeType,
-        new SingleOptionImpl(option, normalizedOption));
-  }
-
-
-
-  /**
-   * Creates an attribute description having the provided attribute type and
-   * options.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param options
-   *          The attribute options.
-   * @return The attribute description.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code options} was {@code null}.
-   */
-  public static AttributeDescription create(final AttributeType attributeType,
-      final String... options)
-  {
-    Validator.ensureNotNull(attributeType, options);
-
-    switch (options.length)
-    {
-    case 0:
-      return create(attributeType);
-    case 1:
-      return create(attributeType, options[0]);
-    default:
-      final String[] optionsList = new String[options.length];
-      final String[] normalizedOptions = new String[options.length];
-
-      final String oid = attributeType.getNameOrOID();
-      final StringBuilder builder = new StringBuilder(oid.length()
-          + options[0].length() + options[1].length() + 2);
-      builder.append(oid);
-
-      int i = 0;
-      for (final String option : options)
-      {
+        final String oldAttributeDescription = attributeDescription;
+        final StringBuilder builder =
+                new StringBuilder(oldAttributeDescription.length() + option.length() + 1);
+        builder.append(oldAttributeDescription);
         builder.append(';');
         builder.append(option);
-        optionsList[i] = option;
+        final String newAttributeDescription = builder.toString();
+
+        final Impl impl = pimpl;
+        if (impl instanceof ZeroOptionImpl) {
+            return new AttributeDescription(newAttributeDescription, attributeType,
+                    new SingleOptionImpl(option, normalizedOption));
+
+        } else if (impl instanceof SingleOptionImpl) {
+            final SingleOptionImpl simpl = (SingleOptionImpl) impl;
+
+            final String[] newOptions = new String[2];
+            newOptions[0] = simpl.option;
+            newOptions[1] = option;
+
+            final String[] newNormalizedOptions = new String[2];
+            if (normalizedOption.compareTo(simpl.normalizedOption) < 0) {
+                newNormalizedOptions[0] = normalizedOption;
+                newNormalizedOptions[1] = simpl.normalizedOption;
+            }
+
+            return new AttributeDescription(newAttributeDescription, attributeType,
+                    new MultiOptionImpl(newOptions, newNormalizedOptions));
+        } else {
+            final MultiOptionImpl mimpl = (MultiOptionImpl) impl;
+
+            final int sz1 = mimpl.options.length;
+            final String[] newOptions = new String[sz1 + 1];
+            for (int i = 0; i < sz1; i++) {
+                newOptions[i] = mimpl.options[i];
+            }
+            newOptions[sz1] = option;
+
+            final int sz2 = mimpl.normalizedOptions.length;
+            final String[] newNormalizedOptions = new String[sz2 + 1];
+            boolean inserted = false;
+            for (int i = 0; i < sz2; i++) {
+                if (!inserted) {
+                    final String s = mimpl.normalizedOptions[i];
+                    if (normalizedOption.compareTo(s) < 0) {
+                        newNormalizedOptions[i] = normalizedOption;
+                        newNormalizedOptions[i + 1] = s;
+                        inserted = true;
+                    } else {
+                        newNormalizedOptions[i] = s;
+                    }
+                } else {
+                    newNormalizedOptions[i + 1] = mimpl.normalizedOptions[i];
+                }
+            }
+
+            if (!inserted) {
+                newNormalizedOptions[sz2] = normalizedOption;
+            }
+
+            return new AttributeDescription(newAttributeDescription, attributeType,
+                    new MultiOptionImpl(newOptions, newNormalizedOptions));
+        }
+    }
+
+    /**
+     * Creates an attribute description having the provided attribute type and
+     * no options.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @return The attribute description.
+     * @throws NullPointerException
+     *             If {@code attributeType} was {@code null}.
+     */
+    public static AttributeDescription create(final AttributeType attributeType) {
+        Validator.ensureNotNull(attributeType);
+
+        // Use object identity in case attribute type does not come from
+        // core schema.
+        if (attributeType == OBJECT_CLASS.getAttributeType()) {
+            return OBJECT_CLASS;
+        } else {
+            return new AttributeDescription(attributeType.getNameOrOID(), attributeType,
+                    ZERO_OPTION_IMPL);
+        }
+    }
+
+    /**
+     * Creates an attribute description having the provided attribute type and
+     * single option.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param option
+     *            The attribute option.
+     * @return The attribute description.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code option} was {@code null}.
+     */
+    public static AttributeDescription create(final AttributeType attributeType, final String option) {
+        Validator.ensureNotNull(attributeType, option);
+
+        final String oid = attributeType.getNameOrOID();
+        final StringBuilder builder = new StringBuilder(oid.length() + option.length() + 1);
+        builder.append(oid);
+        builder.append(';');
+        builder.append(option);
+        final String attributeDescription = builder.toString();
         final String normalizedOption = toLowerCase(option);
-        normalizedOptions[i++] = normalizedOption;
-      }
-      Arrays.sort(normalizedOptions);
 
-      final String attributeDescription = builder.toString();
-      return new AttributeDescription(attributeDescription, attributeType,
-          new MultiOptionImpl(optionsList, normalizedOptions));
+        return new AttributeDescription(attributeDescription, attributeType, new SingleOptionImpl(
+                option, normalizedOption));
     }
 
-  }
+    /**
+     * Creates an attribute description having the provided attribute type and
+     * options.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param options
+     *            The attribute options.
+     * @return The attribute description.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code options} was {@code null}.
+     */
+    public static AttributeDescription create(final AttributeType attributeType,
+            final String... options) {
+        Validator.ensureNotNull(attributeType, options);
 
+        switch (options.length) {
+        case 0:
+            return create(attributeType);
+        case 1:
+            return create(attributeType, options[0]);
+        default:
+            final String[] optionsList = new String[options.length];
+            final String[] normalizedOptions = new String[options.length];
 
+            final String oid = attributeType.getNameOrOID();
+            final StringBuilder builder =
+                    new StringBuilder(oid.length() + options[0].length() + options[1].length() + 2);
+            builder.append(oid);
 
-  /**
-   * Returns an attribute description representing the object class attribute
-   * type with no options.
-   *
-   * @return The object class attribute description.
-   */
-  public static AttributeDescription objectClass()
-  {
-    return OBJECT_CLASS;
-  }
+            int i = 0;
+            for (final String option : options) {
+                builder.append(';');
+                builder.append(option);
+                optionsList[i] = option;
+                final String normalizedOption = toLowerCase(option);
+                normalizedOptions[i++] = normalizedOption;
+            }
+            Arrays.sort(normalizedOptions);
 
-
-
-  /**
-   * Parses the provided LDAP string representation of an attribute description
-   * using the default schema.
-   *
-   * @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.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  public static AttributeDescription valueOf(final String attributeDescription)
-  {
-    return valueOf(attributeDescription, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of an attribute description
-   * using the provided schema.
-   *
-   * @param attributeDescription
-   *          The LDAP string representation of an attribute description.
-   * @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}.
-   */
-  @SuppressWarnings("serial")
-  public static AttributeDescription valueOf(final String attributeDescription,
-      final Schema schema)
-  {
-    Validator.ensureNotNull(attributeDescription, schema);
-
-    // First look up the attribute description in the cache.
-    final WeakHashMap<Schema, Map<String, AttributeDescription>> threadLocalMap = CACHE
-        .get();
-    Map<String, AttributeDescription> schemaLocalMap = threadLocalMap
-        .get(schema);
-
-    AttributeDescription ad = null;
-    if (schemaLocalMap == null)
-    {
-      schemaLocalMap = new LinkedHashMap<String, AttributeDescription>(
-          ATTRIBUTE_DESCRIPTION_CACHE_SIZE, 0.75f, true)
-      {
-        @Override
-        protected boolean removeEldestEntry(
-            final Map.Entry<String, AttributeDescription> eldest)
-        {
-          return size() > ATTRIBUTE_DESCRIPTION_CACHE_SIZE;
-        }
-      };
-      threadLocalMap.put(schema, schemaLocalMap);
-    }
-    else
-    {
-      ad = schemaLocalMap.get(attributeDescription);
-    }
-
-    // Cache miss: decode and cache.
-    if (ad == null)
-    {
-      ad = valueOf0(attributeDescription, schema);
-      schemaLocalMap.put(attributeDescription, ad);
-    }
-
-    return ad;
-  }
-
-
-
-  private static int skipTrailingWhiteSpace(final String attributeDescription,
-      int i, final int length)
-  {
-    char c;
-    while (i < length)
-    {
-      c = attributeDescription.charAt(i);
-      if (c != ' ')
-      {
-        final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_INTERNAL_WHITESPACE
-            .get(attributeDescription);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-      i++;
-    }
-    return i;
-  }
-
-
-
-  // Uncached valueOf implementation.
-  private static AttributeDescription valueOf0(
-      final String attributeDescription, final Schema schema)
-  {
-    final boolean allowMalformedNamesAndOptions = schema
-        .allowMalformedNamesAndOptions();
-    int i = 0;
-    final int length = attributeDescription.length();
-    char c = 0;
-
-    // Skip leading white space.
-    while (i < length)
-    {
-      c = attributeDescription.charAt(i);
-      if (c != ' ')
-      {
-        break;
-      }
-      i++;
-    }
-
-    // If we're already at the end then the attribute description only
-    // contained whitespace.
-    if (i == length)
-    {
-      final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_EMPTY
-          .get(attributeDescription);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    // Validate the first non-whitespace character.
-    ASCIICharProp cp = ASCIICharProp.valueOf(c);
-    if (cp == null)
-    {
-      final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-          .get(attributeDescription, c, i);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    // Mark the attribute type start position.
-    final int attributeTypeStart = i;
-    if (cp.isLetter())
-    {
-      // Non-numeric OID: letter + zero or more keychars.
-      i++;
-      while (i < length)
-      {
-        c = attributeDescription.charAt(i);
-
-        if (c == ';' || c == ' ')
-        {
-          break;
+            final String attributeDescription = builder.toString();
+            return new AttributeDescription(attributeDescription, attributeType,
+                    new MultiOptionImpl(optionsList, normalizedOptions));
         }
 
-        cp = ASCIICharProp.valueOf(c);
-        if (!cp.isKeyChar(allowMalformedNamesAndOptions))
-        {
-          final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-              .get(attributeDescription, c, i);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-        i++;
-      }
-
-      // (charAt(i) == ';' || c == ' ' || i == length)
-    }
-    else if (cp.isDigit())
-    {
-      // Numeric OID: decimal digit + zero or more dots or decimals.
-      i++;
-      while (i < length)
-      {
-        c = attributeDescription.charAt(i);
-        if (c == ';' || c == ' ')
-        {
-          break;
-        }
-
-        cp = ASCIICharProp.valueOf(c);
-        if (c != '.' && !cp.isDigit())
-        {
-          final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-              .get(attributeDescription, c, i);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-        i++;
-      }
-
-      // (charAt(i) == ';' || charAt(i) == ' ' || i == length)
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-          .get(attributeDescription, c, i);
-      throw new LocalizedIllegalArgumentException(message);
     }
 
-    // Skip trailing white space.
-    final int attributeTypeEnd = i;
-    if (c == ' ')
-    {
-      i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
-    }
-
-    // Determine the portion of the string containing the attribute type
-    // name.
-    String oid;
-    if (attributeTypeStart == 0 && attributeTypeEnd == length)
-    {
-      oid = attributeDescription;
-    }
-    else
-    {
-      oid = attributeDescription
-          .substring(attributeTypeStart, attributeTypeEnd);
-    }
-
-    if (oid.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_NO_TYPE
-          .get(attributeDescription);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    // Get the attribute type from the schema.
-    final AttributeType attributeType = schema.getAttributeType(oid);
-
-    // If we're already at the end of the attribute description then it
-    // does not contain any options.
-    if (i == length)
-    {
-      // Use object identity in case attribute type does not come from
-      // core schema.
-      if (attributeType == OBJECT_CLASS.getAttributeType()
-          && attributeDescription.equals(OBJECT_CLASS.toString()))
-      {
+    /**
+     * Returns an attribute description representing the object class attribute
+     * type with no options.
+     *
+     * @return The object class attribute description.
+     */
+    public static AttributeDescription objectClass() {
         return OBJECT_CLASS;
-      }
-      else
-      {
-        return new AttributeDescription(attributeDescription, attributeType,
-            ZERO_OPTION_IMPL);
-      }
     }
 
-    // At this point 'i' must point at a semi-colon.
-    i++;
-    StringBuilder builder = null;
-    int optionStart = i;
-    while (i < length)
-    {
-      c = attributeDescription.charAt(i);
-      if (c == ' ' || c == ';')
-      {
-        break;
-      }
-
-      cp = ASCIICharProp.valueOf(c);
-      if (!cp.isKeyChar(allowMalformedNamesAndOptions))
-      {
-        final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-            .get(attributeDescription, c, i);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      if (builder == null)
-      {
-        if (cp.isUpperCase())
-        {
-          // Need to normalize the option.
-          builder = new StringBuilder(length - optionStart);
-          builder.append(attributeDescription, optionStart, i);
-          builder.append(cp.toLowerCase());
-        }
-      }
-      else
-      {
-        builder.append(cp.toLowerCase());
-      }
-      i++;
+    /**
+     * Parses the provided LDAP string representation of an attribute
+     * description using the default schema.
+     *
+     * @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.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    public static AttributeDescription valueOf(final String attributeDescription) {
+        return valueOf(attributeDescription, Schema.getDefaultSchema());
     }
 
-    String option = attributeDescription.substring(optionStart, i);
-    String normalizedOption;
-    if (builder != null)
-    {
-      normalizedOption = builder.toString();
-    }
-    else
-    {
-      normalizedOption = option;
-    }
+    /**
+     * Parses the provided LDAP string representation of an attribute
+     * description using the provided schema.
+     *
+     * @param attributeDescription
+     *            The LDAP string representation of an attribute description.
+     * @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}.
+     */
+    @SuppressWarnings("serial")
+    public static AttributeDescription valueOf(final String attributeDescription,
+            final Schema schema) {
+        Validator.ensureNotNull(attributeDescription, schema);
 
-    if (option.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_EMPTY_OPTION
-          .get(attributeDescription);
-      throw new LocalizedIllegalArgumentException(message);
-    }
+        // First look up the attribute description in the cache.
+        final WeakHashMap<Schema, Map<String, AttributeDescription>> threadLocalMap = CACHE.get();
+        Map<String, AttributeDescription> schemaLocalMap = threadLocalMap.get(schema);
 
-    // Skip trailing white space.
-    if (c == ' ')
-    {
-      i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
-    }
-
-    // If we're already at the end of the attribute description then it
-    // only contains a single option.
-    if (i == length)
-    {
-      return new AttributeDescription(attributeDescription, attributeType,
-          new SingleOptionImpl(option, normalizedOption));
-    }
-
-    // Multiple options need sorting and duplicates removed - we could
-    // optimize a bit further here for 2 option attribute descriptions.
-    final List<String> options = new LinkedList<String>();
-    options.add(option);
-
-    final SortedSet<String> normalizedOptions = new TreeSet<String>();
-    normalizedOptions.add(normalizedOption);
-
-    while (i < length)
-    {
-      // At this point 'i' must point at a semi-colon.
-      i++;
-      builder = null;
-      optionStart = i;
-      while (i < length)
-      {
-        c = attributeDescription.charAt(i);
-        if (c == ' ' || c == ';')
-        {
-          break;
+        AttributeDescription ad = null;
+        if (schemaLocalMap == null) {
+            schemaLocalMap =
+                    new LinkedHashMap<String, AttributeDescription>(
+                            ATTRIBUTE_DESCRIPTION_CACHE_SIZE, 0.75f, true) {
+                        @Override
+                        protected boolean removeEldestEntry(
+                                final Map.Entry<String, AttributeDescription> eldest) {
+                            return size() > ATTRIBUTE_DESCRIPTION_CACHE_SIZE;
+                        }
+                    };
+            threadLocalMap.put(schema, schemaLocalMap);
+        } else {
+            ad = schemaLocalMap.get(attributeDescription);
         }
 
-        cp = ASCIICharProp.valueOf(c);
-        if (!cp.isKeyChar(allowMalformedNamesAndOptions))
-        {
-          final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
-              .get(attributeDescription, c, i);
-          throw new LocalizedIllegalArgumentException(message);
+        // Cache miss: decode and cache.
+        if (ad == null) {
+            ad = valueOf0(attributeDescription, schema);
+            schemaLocalMap.put(attributeDescription, ad);
         }
 
-        if (builder == null)
-        {
-          if (cp.isUpperCase())
-          {
-            // Need to normalize the option.
-            builder = new StringBuilder(length - optionStart);
-            builder.append(attributeDescription, optionStart, i);
-            builder.append(cp.toLowerCase());
-          }
+        return ad;
+    }
+
+    private static int skipTrailingWhiteSpace(final String attributeDescription, int i,
+            final int length) {
+        char c;
+        while (i < length) {
+            c = attributeDescription.charAt(i);
+            if (c != ' ') {
+                final LocalizableMessage message =
+                        ERR_ATTRIBUTE_DESCRIPTION_INTERNAL_WHITESPACE.get(attributeDescription);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+            i++;
         }
-        else
-        {
-          builder.append(cp.toLowerCase());
+        return i;
+    }
+
+    // Uncached valueOf implementation.
+    private static AttributeDescription valueOf0(final String attributeDescription,
+            final Schema schema) {
+        final boolean allowMalformedNamesAndOptions = schema.allowMalformedNamesAndOptions();
+        int i = 0;
+        final int length = attributeDescription.length();
+        char c = 0;
+
+        // Skip leading white space.
+        while (i < length) {
+            c = attributeDescription.charAt(i);
+            if (c != ' ') {
+                break;
+            }
+            i++;
         }
+
+        // If we're already at the end then the attribute description only
+        // contained whitespace.
+        if (i == length) {
+            final LocalizableMessage message =
+                    ERR_ATTRIBUTE_DESCRIPTION_EMPTY.get(attributeDescription);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Validate the first non-whitespace character.
+        ASCIICharProp cp = ASCIICharProp.valueOf(c);
+        if (cp == null) {
+            final LocalizableMessage message =
+                    ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription, c, i);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Mark the attribute type start position.
+        final int attributeTypeStart = i;
+        if (cp.isLetter()) {
+            // Non-numeric OID: letter + zero or more keychars.
+            i++;
+            while (i < length) {
+                c = attributeDescription.charAt(i);
+
+                if (c == ';' || c == ' ') {
+                    break;
+                }
+
+                cp = ASCIICharProp.valueOf(c);
+                if (!cp.isKeyChar(allowMalformedNamesAndOptions)) {
+                    final LocalizableMessage message =
+                            ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription,
+                                    c, i);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+                i++;
+            }
+
+            // (charAt(i) == ';' || c == ' ' || i == length)
+        } else if (cp.isDigit()) {
+            // Numeric OID: decimal digit + zero or more dots or decimals.
+            i++;
+            while (i < length) {
+                c = attributeDescription.charAt(i);
+                if (c == ';' || c == ' ') {
+                    break;
+                }
+
+                cp = ASCIICharProp.valueOf(c);
+                if (c != '.' && !cp.isDigit()) {
+                    final LocalizableMessage message =
+                            ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription,
+                                    c, i);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+                i++;
+            }
+
+            // (charAt(i) == ';' || charAt(i) == ' ' || i == length)
+        } else {
+            final LocalizableMessage message =
+                    ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription, c, i);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Skip trailing white space.
+        final int attributeTypeEnd = i;
+        if (c == ' ') {
+            i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
+        }
+
+        // Determine the portion of the string containing the attribute type
+        // name.
+        String oid;
+        if (attributeTypeStart == 0 && attributeTypeEnd == length) {
+            oid = attributeDescription;
+        } else {
+            oid = attributeDescription.substring(attributeTypeStart, attributeTypeEnd);
+        }
+
+        if (oid.length() == 0) {
+            final LocalizableMessage message =
+                    ERR_ATTRIBUTE_DESCRIPTION_NO_TYPE.get(attributeDescription);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Get the attribute type from the schema.
+        final AttributeType attributeType = schema.getAttributeType(oid);
+
+        // If we're already at the end of the attribute description then it
+        // does not contain any options.
+        if (i == length) {
+            // Use object identity in case attribute type does not come from
+            // core schema.
+            if (attributeType == OBJECT_CLASS.getAttributeType()
+                    && attributeDescription.equals(OBJECT_CLASS.toString())) {
+                return OBJECT_CLASS;
+            } else {
+                return new AttributeDescription(attributeDescription, attributeType,
+                        ZERO_OPTION_IMPL);
+            }
+        }
+
+        // At this point 'i' must point at a semi-colon.
         i++;
-      }
+        StringBuilder builder = null;
+        int optionStart = i;
+        while (i < length) {
+            c = attributeDescription.charAt(i);
+            if (c == ' ' || c == ';') {
+                break;
+            }
 
-      option = attributeDescription.substring(optionStart, i);
-      if (builder != null)
-      {
-        normalizedOption = builder.toString();
-      }
-      else
-      {
-        normalizedOption = option;
-      }
+            cp = ASCIICharProp.valueOf(c);
+            if (!cp.isKeyChar(allowMalformedNamesAndOptions)) {
+                final LocalizableMessage message =
+                        ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription, c, i);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      if (option.length() == 0)
-      {
-        final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_EMPTY_OPTION
-            .get(attributeDescription);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (builder == null) {
+                if (cp.isUpperCase()) {
+                    // Need to normalize the option.
+                    builder = new StringBuilder(length - optionStart);
+                    builder.append(attributeDescription, optionStart, i);
+                    builder.append(cp.toLowerCase());
+                }
+            } else {
+                builder.append(cp.toLowerCase());
+            }
+            i++;
+        }
 
-      // Skip trailing white space.
-      if (c == ' ')
-      {
-        i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
-      }
+        String option = attributeDescription.substring(optionStart, i);
+        String normalizedOption;
+        if (builder != null) {
+            normalizedOption = builder.toString();
+        } else {
+            normalizedOption = option;
+        }
 
-      options.add(option);
-      normalizedOptions.add(normalizedOption);
+        if (option.length() == 0) {
+            final LocalizableMessage message =
+                    ERR_ATTRIBUTE_DESCRIPTION_EMPTY_OPTION.get(attributeDescription);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Skip trailing white space.
+        if (c == ' ') {
+            i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
+        }
+
+        // If we're already at the end of the attribute description then it
+        // only contains a single option.
+        if (i == length) {
+            return new AttributeDescription(attributeDescription, attributeType,
+                    new SingleOptionImpl(option, normalizedOption));
+        }
+
+        // Multiple options need sorting and duplicates removed - we could
+        // optimize a bit further here for 2 option attribute descriptions.
+        final List<String> options = new LinkedList<String>();
+        options.add(option);
+
+        final SortedSet<String> normalizedOptions = new TreeSet<String>();
+        normalizedOptions.add(normalizedOption);
+
+        while (i < length) {
+            // At this point 'i' must point at a semi-colon.
+            i++;
+            builder = null;
+            optionStart = i;
+            while (i < length) {
+                c = attributeDescription.charAt(i);
+                if (c == ' ' || c == ';') {
+                    break;
+                }
+
+                cp = ASCIICharProp.valueOf(c);
+                if (!cp.isKeyChar(allowMalformedNamesAndOptions)) {
+                    final LocalizableMessage message =
+                            ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER.get(attributeDescription,
+                                    c, i);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                if (builder == null) {
+                    if (cp.isUpperCase()) {
+                        // Need to normalize the option.
+                        builder = new StringBuilder(length - optionStart);
+                        builder.append(attributeDescription, optionStart, i);
+                        builder.append(cp.toLowerCase());
+                    }
+                } else {
+                    builder.append(cp.toLowerCase());
+                }
+                i++;
+            }
+
+            option = attributeDescription.substring(optionStart, i);
+            if (builder != null) {
+                normalizedOption = builder.toString();
+            } else {
+                normalizedOption = option;
+            }
+
+            if (option.length() == 0) {
+                final LocalizableMessage message =
+                        ERR_ATTRIBUTE_DESCRIPTION_EMPTY_OPTION.get(attributeDescription);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+
+            // Skip trailing white space.
+            if (c == ' ') {
+                i = skipTrailingWhiteSpace(attributeDescription, i + 1, length);
+            }
+
+            options.add(option);
+            normalizedOptions.add(normalizedOption);
+        }
+
+        return new AttributeDescription(attributeDescription, attributeType, new MultiOptionImpl(
+                options.toArray(new String[options.size()]), normalizedOptions
+                        .toArray(new String[normalizedOptions.size()])));
     }
 
-    return new AttributeDescription(attributeDescription, attributeType,
-        new MultiOptionImpl(options.toArray(new String[options.size()]),
-            normalizedOptions.toArray(new String[normalizedOptions.size()])));
-  }
+    private final String attributeDescription;
 
+    private final AttributeType attributeType;
 
+    private final Impl pimpl;
 
-  private final String attributeDescription;
-
-  private final AttributeType attributeType;
-
-  private final Impl pimpl;
-
-
-
-  // Private constructor.
-  private AttributeDescription(final String attributeDescription,
-      final AttributeType attributeType, final Impl pimpl)
-  {
-    this.attributeDescription = attributeDescription;
-    this.attributeType = attributeType;
-    this.pimpl = pimpl;
-  }
-
-
-
-  /**
-   * Compares this attribute description to the provided attribute description.
-   * The attribute types are compared first and then, if equal, the options are
-   * normalized, sorted, and compared.
-   *
-   * @param other
-   *          The attribute description to be compared.
-   * @return A negative integer, zero, or a positive integer as this attribute
-   *         description is less than, equal to, or greater than the specified
-   *         attribute description.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public int compareTo(final AttributeDescription other)
-  {
-    final int result = attributeType.compareTo(other.attributeType);
-    if (result != 0)
-    {
-      return result;
-    }
-    else
-    {
-      // Attribute type is the same, so compare options.
-      return pimpl.compareTo(other.pimpl);
-    }
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute description contains the provided
-   * option.
-   *
-   * @param option
-   *          The option for which to make the determination.
-   * @return {@code true} if this attribute description has the provided option,
-   *         or {@code false} if not.
-   * @throws NullPointerException
-   *           If {@code option} was {@code null}.
-   */
-  public boolean containsOption(final String option)
-  {
-    final String normalizedOption = toLowerCase(option);
-    return pimpl.containsOption(normalizedOption);
-  }
-
-
-
-  /**
-   * Indicates whether the provided object is an attribute description which is
-   * equal to this attribute description. It will be considered equal if the
-   * attribute type and normalized sorted list of options are identical.
-   *
-   * @param o
-   *          The object for which to make the determination.
-   * @return {@code true} if the provided object is an attribute description
-   *         that is equal to this attribute description, or {@code false} if
-   *         not.
-   */
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (this == o)
-    {
-      return true;
+    // Private constructor.
+    private AttributeDescription(final String attributeDescription,
+            final AttributeType attributeType, final Impl pimpl) {
+        this.attributeDescription = attributeDescription;
+        this.attributeType = attributeType;
+        this.pimpl = pimpl;
     }
 
-    if (!(o instanceof AttributeDescription))
-    {
-      return false;
+    /**
+     * Compares this attribute description to the provided attribute
+     * description. The attribute types are compared first and then, if equal,
+     * the options are normalized, sorted, and compared.
+     *
+     * @param other
+     *            The attribute description to be compared.
+     * @return A negative integer, zero, or a positive integer as this attribute
+     *         description is less than, equal to, or greater than the specified
+     *         attribute description.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public int compareTo(final AttributeDescription other) {
+        final int result = attributeType.compareTo(other.attributeType);
+        if (result != 0) {
+            return result;
+        } else {
+            // Attribute type is the same, so compare options.
+            return pimpl.compareTo(other.pimpl);
+        }
     }
 
-    final AttributeDescription other = (AttributeDescription) o;
-    if (!attributeType.equals(other.attributeType))
-    {
-      return false;
+    /**
+     * Indicates whether or not this attribute description contains the provided
+     * option.
+     *
+     * @param option
+     *            The option for which to make the determination.
+     * @return {@code true} if this attribute description has the provided
+     *         option, or {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code option} was {@code null}.
+     */
+    public boolean containsOption(final String option) {
+        final String normalizedOption = toLowerCase(option);
+        return pimpl.containsOption(normalizedOption);
     }
 
-    // Attribute type is the same, compare options.
-    return pimpl.equals(other.pimpl);
-  }
+    /**
+     * Indicates whether the provided object is an attribute description which
+     * is equal to this attribute description. It will be considered equal if
+     * the attribute type and normalized sorted list of options are identical.
+     *
+     * @param o
+     *            The object for which to make the determination.
+     * @return {@code true} if the provided object is an attribute description
+     *         that is equal to this attribute description, or {@code false} if
+     *         not.
+     */
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        }
 
+        if (!(o instanceof AttributeDescription)) {
+            return false;
+        }
 
+        final AttributeDescription other = (AttributeDescription) o;
+        if (!attributeType.equals(other.attributeType)) {
+            return false;
+        }
 
-  /**
-   * Returns the attribute type associated with this attribute description.
-   *
-   * @return The attribute type associated with this attribute description.
-   */
-  public AttributeType getAttributeType()
-  {
-    return attributeType;
-  }
-
-
-
-  /**
-   * Returns an {@code Iterable} containing the options contained in this
-   * attribute description. Attempts to remove options using an iterator's
-   * {@code remove()} method are not permitted and will result in an {@code
-   * UnsupportedOperationException} being thrown.
-   *
-   * @return An {@code Iterable} containing the options.
-   */
-  public Iterable<String> getOptions()
-  {
-    return pimpl;
-  }
-
-
-
-  /**
-   * Returns the hash code for this attribute description. It will be calculated
-   * as the sum of the hash codes of the attribute type and normalized sorted
-   * list of options.
-   *
-   * @return The hash code for this attribute description.
-   */
-  @Override
-  public int hashCode()
-  {
-    // FIXME: should we cache this?
-    return attributeType.hashCode() * 31 + pimpl.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute description has any options.
-   *
-   * @return {@code true} if this attribute description has any options, or
-   *         {@code false} if not.
-   */
-  public boolean hasOptions()
-  {
-    return pimpl.hasOptions();
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute description is the {@code
-   * objectClass} attribute description with no options.
-   *
-   * @return {@code true} if this attribute description is the {@code
-   *         objectClass} attribute description with no options, or {@code
-   *         false} if not.
-   */
-  public boolean isObjectClass()
-  {
-    return attributeType.isObjectClass() && !hasOptions();
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute description is a sub-type of the
-   * provided attribute description as defined in RFC 4512 section 2.5.
-   * Specifically, this method will return {@code true} if and only if the
-   * following conditions are both {@code true}:
-   * <ul>
-   * <li>This attribute description has an attribute type which is equal to, or
-   * is a sub-type of, the attribute type in the provided attribute description.
-   * <li>This attribute description contains all of the options contained in the
-   * provided attribute description.
-   * </ul>
-   * Note that this method will return {@code true} if this attribute
-   * description is equal to the provided attribute description.
-   *
-   * @param other
-   *          The attribute description for which to make the determination.
-   * @return {@code true} if this attribute description is a sub-type of the
-   *         provided attribute description, or {@code false} if not.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public boolean isSubTypeOf(final AttributeDescription other)
-  {
-    if (!attributeType.isSubTypeOf(other.attributeType))
-    {
-      return false;
+        // Attribute type is the same, compare options.
+        return pimpl.equals(other.pimpl);
     }
-    else
-    {
-      return pimpl.isSubTypeOf(other.pimpl);
+
+    /**
+     * Returns the attribute type associated with this attribute description.
+     *
+     * @return The attribute type associated with this attribute description.
+     */
+    public AttributeType getAttributeType() {
+        return attributeType;
     }
-  }
 
-
-
-  /**
-   * Indicates whether or not this attribute description is a super-type of the
-   * provided attribute description as defined in RFC 4512 section 2.5.
-   * Specifically, this method will return {@code true} if and only if the
-   * following conditions are both {@code true}:
-   * <ul>
-   * <li>This attribute description has an attribute type which is equal to, or
-   * is a super-type of, the attribute type in the provided attribute
-   * description.
-   * <li>This attribute description contains a sub-set of the options contained
-   * in the provided attribute description.
-   * </ul>
-   * Note that this method will return {@code true} if this attribute
-   * description is equal to the provided attribute description.
-   *
-   * @param other
-   *          The attribute description for which to make the determination.
-   * @return {@code true} if this attribute description is a super-type of the
-   *         provided attribute description, or {@code false} if not.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public boolean isSuperTypeOf(final AttributeDescription other)
-  {
-    if (!other.attributeType.isSubTypeOf(attributeType))
-    {
-      return false;
+    /**
+     * Returns an {@code Iterable} containing the options contained in this
+     * attribute description. Attempts to remove options using an iterator's
+     * {@code remove()} method are not permitted and will result in an
+     * {@code UnsupportedOperationException} being thrown.
+     *
+     * @return An {@code Iterable} containing the options.
+     */
+    public Iterable<String> getOptions() {
+        return pimpl;
     }
-    else
-    {
-      return pimpl.isSuperTypeOf(other.pimpl);
+
+    /**
+     * Returns the hash code for this attribute description. It will be
+     * calculated as the sum of the hash codes of the attribute type and
+     * normalized sorted list of options.
+     *
+     * @return The hash code for this attribute description.
+     */
+    @Override
+    public int hashCode() {
+        // FIXME: should we cache this?
+        return attributeType.hashCode() * 31 + pimpl.hashCode();
     }
-  }
 
+    /**
+     * Indicates whether or not this attribute description has any options.
+     *
+     * @return {@code true} if this attribute description has any options, or
+     *         {@code false} if not.
+     */
+    public boolean hasOptions() {
+        return pimpl.hasOptions();
+    }
 
+    /**
+     * Indicates whether or not this attribute description is the
+     * {@code objectClass} attribute description with no options.
+     *
+     * @return {@code true} if this attribute description is the
+     *         {@code objectClass} attribute description with no options, or
+     *         {@code false} if not.
+     */
+    public boolean isObjectClass() {
+        return attributeType.isObjectClass() && !hasOptions();
+    }
 
-  /**
-   * Returns the string representation of this attribute description as defined
-   * in RFC4512 section 2.5.
-   *
-   * @return The string representation of this attribute description.
-   */
-  @Override
-  public String toString()
-  {
-    return attributeDescription;
-  }
+    /**
+     * Indicates whether or not this attribute description is a sub-type of the
+     * provided attribute description as defined in RFC 4512 section 2.5.
+     * Specifically, this method will return {@code true} if and only if the
+     * following conditions are both {@code true}:
+     * <ul>
+     * <li>This attribute description has an attribute type which is equal to,
+     * or is a sub-type of, the attribute type in the provided attribute
+     * description.
+     * <li>This attribute description contains all of the options contained in
+     * the provided attribute description.
+     * </ul>
+     * Note that this method will return {@code true} if this attribute
+     * description is equal to the provided attribute description.
+     *
+     * @param other
+     *            The attribute description for which to make the determination.
+     * @return {@code true} if this attribute description is a sub-type of the
+     *         provided attribute description, or {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public boolean isSubTypeOf(final AttributeDescription other) {
+        if (!attributeType.isSubTypeOf(other.attributeType)) {
+            return false;
+        } else {
+            return pimpl.isSubTypeOf(other.pimpl);
+        }
+    }
+
+    /**
+     * Indicates whether or not this attribute description is a super-type of
+     * the provided attribute description as defined in RFC 4512 section 2.5.
+     * Specifically, this method will return {@code true} if and only if the
+     * following conditions are both {@code true}:
+     * <ul>
+     * <li>This attribute description has an attribute type which is equal to,
+     * or is a super-type of, the attribute type in the provided attribute
+     * description.
+     * <li>This attribute description contains a sub-set of the options
+     * contained in the provided attribute description.
+     * </ul>
+     * Note that this method will return {@code true} if this attribute
+     * description is equal to the provided attribute description.
+     *
+     * @param other
+     *            The attribute description for which to make the determination.
+     * @return {@code true} if this attribute description is a super-type of the
+     *         provided attribute description, or {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public boolean isSuperTypeOf(final AttributeDescription other) {
+        if (!other.attributeType.isSubTypeOf(attributeType)) {
+            return false;
+        } else {
+            return pimpl.isSuperTypeOf(other.pimpl);
+        }
+    }
+
+    /**
+     * Returns the string representation of this attribute description as
+     * defined in RFC4512 section 2.5.
+     *
+     * @return The string representation of this attribute description.
+     */
+    @Override
+    public String toString() {
+        return attributeDescription;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java
index d15c72c..04aff95 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * Attribute factories are included with a set of {@code DecodeOptions} in order
  * to allow application to control how {@code Attribute} instances are created
@@ -38,17 +35,16 @@
  * @see Attribute
  * @see DecodeOptions
  */
-public interface AttributeFactory
-{
-  /**
-   * Creates an attribute using the provided attribute description and no
-   * values.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @return The new attribute.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Attribute newAttribute(AttributeDescription attributeDescription);
+public interface AttributeFactory {
+    /**
+     * Creates an attribute using the provided attribute description and no
+     * values.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @return The new attribute.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Attribute newAttribute(AttributeDescription attributeDescription);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
index 326efe1..34f707c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -38,570 +35,367 @@
 import com.forgerock.opendj.util.Iterators;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains methods for creating and manipulating attributes.
  */
-public final class Attributes
-{
+public final class Attributes {
 
-  /**
-   * Empty attribute.
-   */
-  private static final class EmptyAttribute extends AbstractAttribute
-  {
+    /**
+     * Empty attribute.
+     */
+    private static final class EmptyAttribute extends AbstractAttribute {
 
-    private final AttributeDescription attributeDescription;
+        private final AttributeDescription attributeDescription;
 
+        private EmptyAttribute(final AttributeDescription attributeDescription) {
+            this.attributeDescription = attributeDescription;
+        }
 
+        @Override
+        public boolean add(final ByteString value) {
+            throw new UnsupportedOperationException();
+        }
 
-    private EmptyAttribute(final AttributeDescription attributeDescription)
-    {
-      this.attributeDescription = attributeDescription;
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean contains(final Object value) {
+            return false;
+        }
+
+        @Override
+        public AttributeDescription getAttributeDescription() {
+            return attributeDescription;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return true;
+        }
+
+        @Override
+        public Iterator<ByteString> iterator() {
+            return Iterators.emptyIterator();
+        }
+
+        @Override
+        public boolean remove(final Object value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return 0;
+        }
+
     }
 
+    /**
+     * Renamed attribute.
+     */
+    private static final class RenamedAttribute implements Attribute {
 
+        private final Attribute attribute;
 
-    @Override
-    public boolean add(final ByteString value)
-    {
-      throw new UnsupportedOperationException();
+        private final AttributeDescription attributeDescription;
+
+        private RenamedAttribute(final Attribute attribute,
+                final AttributeDescription attributeDescription) {
+            this.attribute = attribute;
+            this.attributeDescription = attributeDescription;
+        }
+
+        public boolean add(final ByteString value) {
+            return attribute.add(value);
+        }
+
+        public boolean add(final Object firstValue, final Object... remainingValues) {
+            return attribute.add(firstValue, remainingValues);
+        }
+
+        public boolean addAll(final Collection<? extends ByteString> values) {
+            return attribute.addAll(values);
+        }
+
+        public boolean addAll(final Collection<? extends ByteString> values,
+                final Collection<? super ByteString> duplicateValues) {
+            return attribute.addAll(values, duplicateValues);
+        }
+
+        public void clear() {
+            attribute.clear();
+        }
+
+        public boolean contains(final Object value) {
+            return attribute.contains(value);
+        }
+
+        public boolean containsAll(final Collection<?> values) {
+            return attribute.containsAll(values);
+        }
+
+        @Override
+        public boolean equals(final Object object) {
+            return AbstractAttribute.equals(this, object);
+        }
+
+        public ByteString firstValue() {
+            return attribute.firstValue();
+        }
+
+        public String firstValueAsString() {
+            return attribute.firstValueAsString();
+        }
+
+        public AttributeDescription getAttributeDescription() {
+            return attributeDescription;
+        }
+
+        public String getAttributeDescriptionAsString() {
+            return attributeDescription.toString();
+        }
+
+        @Override
+        public int hashCode() {
+            return AbstractAttribute.hashCode(this);
+        }
+
+        public boolean isEmpty() {
+            return attribute.isEmpty();
+        }
+
+        public Iterator<ByteString> iterator() {
+            return attribute.iterator();
+        }
+
+        public boolean remove(final Object value) {
+            return attribute.remove(value);
+        }
+
+        public boolean removeAll(final Collection<?> values) {
+            return attribute.removeAll(values);
+        }
+
+        public <T> boolean removeAll(final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            return attribute.removeAll(values, missingValues);
+        }
+
+        public boolean retainAll(final Collection<?> values) {
+            return attribute.retainAll(values);
+        }
+
+        public <T> boolean retainAll(final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            return attribute.retainAll(values, missingValues);
+        }
+
+        public int size() {
+            return attribute.size();
+        }
+
+        public ByteString[] toArray() {
+            return attribute.toArray();
+        }
+
+        public <T> T[] toArray(final T[] array) {
+            return attribute.toArray(array);
+        }
+
+        @Override
+        public String toString() {
+            return AbstractAttribute.toString(this);
+        }
+
     }
 
+    /**
+     * Unmodifiable attribute.
+     */
+    private static final class UnmodifiableAttribute implements Attribute {
 
+        private final Attribute attribute;
 
-    @Override
-    public void clear()
-    {
-      throw new UnsupportedOperationException();
+        private UnmodifiableAttribute(final Attribute attribute) {
+            this.attribute = attribute;
+        }
+
+        public boolean add(final ByteString value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean add(final Object firstValue, final Object... remainingValues) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean addAll(final Collection<? extends ByteString> values) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean addAll(final Collection<? extends ByteString> values,
+                final Collection<? super ByteString> duplicateValues) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean contains(final Object value) {
+            return attribute.contains(value);
+        }
+
+        public boolean containsAll(final Collection<?> values) {
+            return attribute.containsAll(values);
+        }
+
+        @Override
+        public boolean equals(final Object object) {
+            return (object == this || attribute.equals(object));
+        }
+
+        public ByteString firstValue() {
+            return attribute.firstValue();
+        }
+
+        public String firstValueAsString() {
+            return attribute.firstValueAsString();
+        }
+
+        public AttributeDescription getAttributeDescription() {
+            return attribute.getAttributeDescription();
+        }
+
+        public String getAttributeDescriptionAsString() {
+            return attribute.getAttributeDescriptionAsString();
+        }
+
+        @Override
+        public int hashCode() {
+            return attribute.hashCode();
+        }
+
+        public boolean isEmpty() {
+            return attribute.isEmpty();
+        }
+
+        public Iterator<ByteString> iterator() {
+            return Iterators.unmodifiableIterator(attribute.iterator());
+        }
+
+        public boolean remove(final Object value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean removeAll(final Collection<?> values) {
+            throw new UnsupportedOperationException();
+        }
+
+        public <T> boolean removeAll(final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean retainAll(final Collection<?> values) {
+            throw new UnsupportedOperationException();
+        }
+
+        public <T> boolean retainAll(final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            throw new UnsupportedOperationException();
+        }
+
+        public int size() {
+            return attribute.size();
+        }
+
+        public ByteString[] toArray() {
+            return attribute.toArray();
+        }
+
+        public <T> T[] toArray(final T[] array) {
+            return attribute.toArray(array);
+        }
+
+        @Override
+        public String toString() {
+            return attribute.toString();
+        }
+
     }
 
-
-
-    @Override
-    public boolean contains(final Object value)
-    {
-      return false;
+    /**
+     * Returns a read-only empty attribute having the specified attribute
+     * description.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @return The empty attribute.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    public static final Attribute emptyAttribute(final AttributeDescription attributeDescription) {
+        return new EmptyAttribute(attributeDescription);
     }
 
+    /**
+     * Returns a view of {@code attribute} having a different attribute
+     * description. All operations on the returned attribute "pass-through" to
+     * the underlying attribute.
+     *
+     * @param attribute
+     *            The attribute to be renamed.
+     * @param attributeDescription
+     *            The new attribute description for {@code attribute}, which
+     *            must be compatible with {@code attribute}'s attribute
+     *            description.
+     * @return A renamed view of {@code attribute}.
+     * @throws IllegalArgumentException
+     *             If {@code attributeDescription} does not have the same
+     *             attribute type as {@code attribute}'s attribute description.
+     * @throws NullPointerException
+     *             If {@code attribute} or {@code attributeDescription} was
+     *             {@code null}.
+     */
+    public static final Attribute renameAttribute(final Attribute attribute,
+            final AttributeDescription attributeDescription) {
+        final AttributeType oldType = attribute.getAttributeDescription().getAttributeType();
+        final AttributeType newType = attributeDescription.getAttributeType();
 
+        // We could relax a bit by ensuring that they are both compatible
+        // (e.g. one sub-type of another, or same equality matching rule,
+        // etc).
+        Validator
+                .ensureTrue(oldType.equals(newType), "Old and new attribute type are not the same");
 
-    @Override
-    public AttributeDescription getAttributeDescription()
-    {
-      return attributeDescription;
+        return new RenamedAttribute(attribute, attributeDescription);
     }
 
-
-
-    @Override
-    public boolean isEmpty()
-    {
-      return true;
+    /**
+     * Returns a read-only view of {@code attribute}. Query operations on the
+     * returned attribute "read-through" to the underlying attribute, and
+     * attempts to modify the returned attribute either directly or indirectly
+     * via an iterator result in an {@code UnsupportedOperationException}.
+     *
+     * @param attribute
+     *            The attribute for which a read-only view is to be returned.
+     * @return A read-only view of {@code attribute}.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    public static final Attribute unmodifiableAttribute(final Attribute attribute) {
+        if (attribute instanceof UnmodifiableAttribute) {
+            return attribute;
+        } else {
+            return new UnmodifiableAttribute(attribute);
+        }
     }
 
-
-
-    @Override
-    public Iterator<ByteString> iterator()
-    {
-      return Iterators.emptyIterator();
+    // Prevent instantiation.
+    private Attributes() {
+        // Nothing to do.
     }
-
-
-
-    @Override
-    public boolean remove(final Object value)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    @Override
-    public int size()
-    {
-      return 0;
-    }
-
-  }
-
-
-
-  /**
-   * Renamed attribute.
-   */
-  private static final class RenamedAttribute implements Attribute
-  {
-
-    private final Attribute attribute;
-
-    private final AttributeDescription attributeDescription;
-
-
-
-    private RenamedAttribute(final Attribute attribute,
-        final AttributeDescription attributeDescription)
-    {
-      this.attribute = attribute;
-      this.attributeDescription = attributeDescription;
-    }
-
-
-
-    public boolean add(final ByteString value)
-    {
-      return attribute.add(value);
-    }
-
-
-
-    public boolean add(final Object firstValue, final Object... remainingValues)
-    {
-      return attribute.add(firstValue, remainingValues);
-    }
-
-
-
-    public boolean addAll(final Collection<? extends ByteString> values)
-    {
-      return attribute.addAll(values);
-    }
-
-
-
-    public boolean addAll(final Collection<? extends ByteString> values,
-        final Collection<? super ByteString> duplicateValues)
-    {
-      return attribute.addAll(values, duplicateValues);
-    }
-
-
-
-    public void clear()
-    {
-      attribute.clear();
-    }
-
-
-
-    public boolean contains(final Object value)
-    {
-      return attribute.contains(value);
-    }
-
-
-
-    public boolean containsAll(final Collection<?> values)
-    {
-      return attribute.containsAll(values);
-    }
-
-
-
-    @Override
-    public boolean equals(final Object object)
-    {
-      return AbstractAttribute.equals(this, object);
-    }
-
-
-
-    public ByteString firstValue()
-    {
-      return attribute.firstValue();
-    }
-
-
-
-    public String firstValueAsString()
-    {
-      return attribute.firstValueAsString();
-    }
-
-
-
-    public AttributeDescription getAttributeDescription()
-    {
-      return attributeDescription;
-    }
-
-
-
-    public String getAttributeDescriptionAsString()
-    {
-      return attributeDescription.toString();
-    }
-
-
-
-    @Override
-    public int hashCode()
-    {
-      return AbstractAttribute.hashCode(this);
-    }
-
-
-
-    public boolean isEmpty()
-    {
-      return attribute.isEmpty();
-    }
-
-
-
-    public Iterator<ByteString> iterator()
-    {
-      return attribute.iterator();
-    }
-
-
-
-    public boolean remove(final Object value)
-    {
-      return attribute.remove(value);
-    }
-
-
-
-    public boolean removeAll(final Collection<?> values)
-    {
-      return attribute.removeAll(values);
-    }
-
-
-
-    public <T> boolean removeAll(final Collection<T> values,
-        final Collection<? super T> missingValues)
-    {
-      return attribute.removeAll(values, missingValues);
-    }
-
-
-
-    public boolean retainAll(final Collection<?> values)
-    {
-      return attribute.retainAll(values);
-    }
-
-
-
-    public <T> boolean retainAll(final Collection<T> values,
-        final Collection<? super T> missingValues)
-    {
-      return attribute.retainAll(values, missingValues);
-    }
-
-
-
-    public int size()
-    {
-      return attribute.size();
-    }
-
-
-
-    public ByteString[] toArray()
-    {
-      return attribute.toArray();
-    }
-
-
-
-    public <T> T[] toArray(final T[] array)
-    {
-      return attribute.toArray(array);
-    }
-
-
-
-    @Override
-    public String toString()
-    {
-      return AbstractAttribute.toString(this);
-    }
-
-  }
-
-
-
-  /**
-   * Unmodifiable attribute.
-   */
-  private static final class UnmodifiableAttribute implements Attribute
-  {
-
-    private final Attribute attribute;
-
-
-
-    private UnmodifiableAttribute(final Attribute attribute)
-    {
-      this.attribute = attribute;
-    }
-
-
-
-    public boolean add(final ByteString value)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean add(final Object firstValue, final Object... remainingValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean addAll(final Collection<? extends ByteString> values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean addAll(final Collection<? extends ByteString> values,
-        final Collection<? super ByteString> duplicateValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public void clear()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean contains(final Object value)
-    {
-      return attribute.contains(value);
-    }
-
-
-
-    public boolean containsAll(final Collection<?> values)
-    {
-      return attribute.containsAll(values);
-    }
-
-
-
-    @Override
-    public boolean equals(final Object object)
-    {
-      return (object == this || attribute.equals(object));
-    }
-
-
-
-    public ByteString firstValue()
-    {
-      return attribute.firstValue();
-    }
-
-
-
-    public String firstValueAsString()
-    {
-      return attribute.firstValueAsString();
-    }
-
-
-
-    public AttributeDescription getAttributeDescription()
-    {
-      return attribute.getAttributeDescription();
-    }
-
-
-
-    public String getAttributeDescriptionAsString()
-    {
-      return attribute.getAttributeDescriptionAsString();
-    }
-
-
-
-    @Override
-    public int hashCode()
-    {
-      return attribute.hashCode();
-    }
-
-
-
-    public boolean isEmpty()
-    {
-      return attribute.isEmpty();
-    }
-
-
-
-    public Iterator<ByteString> iterator()
-    {
-      return Iterators.unmodifiableIterator(attribute.iterator());
-    }
-
-
-
-    public boolean remove(final Object value)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean removeAll(final Collection<?> values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public <T> boolean removeAll(final Collection<T> values,
-        final Collection<? super T> missingValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public boolean retainAll(final Collection<?> values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public <T> boolean retainAll(final Collection<T> values,
-        final Collection<? super T> missingValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    public int size()
-    {
-      return attribute.size();
-    }
-
-
-
-    public ByteString[] toArray()
-    {
-      return attribute.toArray();
-    }
-
-
-
-    public <T> T[] toArray(final T[] array)
-    {
-      return attribute.toArray(array);
-    }
-
-
-
-    @Override
-    public String toString()
-    {
-      return attribute.toString();
-    }
-
-  }
-
-
-
-  /**
-   * Returns a read-only empty attribute having the specified attribute
-   * description.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @return The empty attribute.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  public static final Attribute emptyAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    return new EmptyAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * Returns a view of {@code attribute} having a different attribute
-   * description. All operations on the returned attribute "pass-through" to the
-   * underlying attribute.
-   *
-   * @param attribute
-   *          The attribute to be renamed.
-   * @param attributeDescription
-   *          The new attribute description for {@code attribute}, which must be
-   *          compatible with {@code attribute}'s attribute description.
-   * @return A renamed view of {@code attribute}.
-   * @throws IllegalArgumentException
-   *           If {@code attributeDescription} does not have the same attribute
-   *           type as {@code attribute}'s attribute description.
-   * @throws NullPointerException
-   *           If {@code attribute} or {@code attributeDescription} was {@code
-   *           null}.
-   */
-  public static final Attribute renameAttribute(final Attribute attribute,
-      final AttributeDescription attributeDescription)
-  {
-    final AttributeType oldType = attribute.getAttributeDescription()
-        .getAttributeType();
-    final AttributeType newType = attributeDescription.getAttributeType();
-
-    // We could relax a bit by ensuring that they are both compatible
-    // (e.g. one sub-type of another, or same equality matching rule,
-    // etc).
-    Validator.ensureTrue(oldType.equals(newType),
-        "Old and new attribute type are not the same");
-
-    return new RenamedAttribute(attribute, attributeDescription);
-  }
-
-
-
-  /**
-   * Returns a read-only view of {@code attribute}. Query operations on the
-   * returned attribute "read-through" to the underlying attribute, and attempts
-   * to modify the returned attribute either directly or indirectly via an
-   * iterator result in an {@code UnsupportedOperationException}.
-   *
-   * @param attribute
-   *          The attribute for which a read-only view is to be returned.
-   * @return A read-only view of {@code attribute}.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  public static final Attribute unmodifiableAttribute(final Attribute attribute)
-  {
-    if (attribute instanceof UnmodifiableAttribute)
-    {
-      return attribute;
-    }
-    else
-    {
-      return new UnmodifiableAttribute(attribute);
-    }
-  }
-
-
-
-  // Prevent instantiation.
-  private Attributes()
-  {
-    // Nothing to do.
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java
index 03d26b3..93cdff3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
 
@@ -37,8 +34,6 @@
 import com.forgerock.opendj.util.FutureResultTransformer;
 import com.forgerock.opendj.util.RecursiveFutureResult;
 
-
-
 /**
  * An authenticated connection factory can be used to create pre-authenticated
  * connections to a Directory Server.
@@ -51,221 +46,173 @@
  * the connection attempt will fail and an {@code ErrorResultException} will be
  * thrown.
  */
-final class AuthenticatedConnectionFactory implements ConnectionFactory
-{
-
-  /**
-   * An authenticated connection supports all operations except Bind operations.
-   */
-  public static final class AuthenticatedConnection extends ConnectionDecorator
-  {
-
-    private AuthenticatedConnection(final Connection connection)
-    {
-      super(connection);
-    }
-
-
+final class AuthenticatedConnectionFactory implements ConnectionFactory {
 
     /**
-     * Bind operations are not supported by pre-authenticated connections. This
-     * method will always throw {@code UnsupportedOperationException}.
+     * An authenticated connection supports all operations except Bind
+     * operations.
      */
+    public static final class AuthenticatedConnection extends ConnectionDecorator {
 
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<BindResult> bindAsync(final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public BindResult bind(BindRequest request) throws ErrorResultException,
-        InterruptedException
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public BindResult bind(String name, char[] password)
-        throws ErrorResultException, InterruptedException
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString()
-    {
-      StringBuilder builder = new StringBuilder();
-      builder.append("AuthenticatedConnection(");
-      builder.append(connection);
-      builder.append(')');
-      return builder.toString();
-    }
-
-  }
-
-
-
-  private static final class FutureResultImpl
-  {
-    private final FutureResultTransformer<BindResult, Connection> futureBindResult;
-
-    private final RecursiveFutureResult<Connection, BindResult> futureConnectionResult;
-
-    private final BindRequest bindRequest;
-
-    private Connection connection;
-
-
-
-    private FutureResultImpl(final BindRequest request,
-        final ResultHandler<? super Connection> handler)
-    {
-      this.bindRequest = request;
-      this.futureBindResult = new FutureResultTransformer<BindResult, Connection>(
-          handler)
-      {
-
-        @Override
-        protected ErrorResultException transformErrorResult(
-            final ErrorResultException errorResult)
-        {
-          // Ensure that the connection is closed.
-          if (connection != null)
-          {
-            connection.close();
-            connection = null;
-          }
-          return errorResult;
+        private AuthenticatedConnection(final Connection connection) {
+            super(connection);
         }
 
+        /**
+         * Bind operations are not supported by pre-authenticated connections.
+         * This method will always throw {@code UnsupportedOperationException}.
+         */
 
-
-        @Override
-        protected Connection transformResult(final BindResult result)
-            throws ErrorResultException
-        {
-          return new AuthenticatedConnection(connection);
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<BindResult> bindAsync(final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler) {
+            throw new UnsupportedOperationException();
         }
 
-      };
-      this.futureConnectionResult = new RecursiveFutureResult<Connection, BindResult>(
-          futureBindResult)
-      {
-
-        @Override
-        protected FutureResult<? extends BindResult> chainResult(
-            final Connection innerResult,
-            final ResultHandler<? super BindResult> handler)
-            throws ErrorResultException
-        {
-          connection = innerResult;
-          return connection.bindAsync(bindRequest, null, handler);
+        /**
+         * {@inheritDoc}
+         */
+        public BindResult bind(BindRequest request) throws ErrorResultException,
+                InterruptedException {
+            throw new UnsupportedOperationException();
         }
-      };
-      futureBindResult.setFutureResult(futureConnectionResult);
+
+        /**
+         * {@inheritDoc}
+         */
+        public BindResult bind(String name, char[] password) throws ErrorResultException,
+                InterruptedException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append("AuthenticatedConnection(");
+            builder.append(connection);
+            builder.append(')');
+            return builder.toString();
+        }
+
     }
 
-  }
+    private static final class FutureResultImpl {
+        private final FutureResultTransformer<BindResult, Connection> futureBindResult;
 
+        private final RecursiveFutureResult<Connection, BindResult> futureConnectionResult;
 
+        private final BindRequest bindRequest;
 
-  private final BindRequest request;
+        private Connection connection;
 
-  private final ConnectionFactory parentFactory;
+        private FutureResultImpl(final BindRequest request,
+                final ResultHandler<? super Connection> handler) {
+            this.bindRequest = request;
+            this.futureBindResult = new FutureResultTransformer<BindResult, Connection>(handler) {
 
+                @Override
+                protected ErrorResultException transformErrorResult(
+                        final ErrorResultException errorResult) {
+                    // Ensure that the connection is closed.
+                    if (connection != null) {
+                        connection.close();
+                        connection = null;
+                    }
+                    return errorResult;
+                }
 
+                @Override
+                protected Connection transformResult(final BindResult result)
+                        throws ErrorResultException {
+                    return new AuthenticatedConnection(connection);
+                }
 
-  /**
-   * Creates a new authenticated connection factory which will obtain
-   * connections using the provided connection factory and immediately perform
-   * the provided Bind request.
-   *
-   * @param factory
-   *          The connection factory to use for connecting to the Directory
-   *          Server.
-   * @param request
-   *          The Bind request to use for authentication.
-   */
-  AuthenticatedConnectionFactory(final ConnectionFactory factory,
-      final BindRequest request)
-  {
-    this.parentFactory = factory;
+            };
+            this.futureConnectionResult =
+                    new RecursiveFutureResult<Connection, BindResult>(futureBindResult) {
 
-    // FIXME: should do a defensive copy.
-    this.request = request;
-  }
+                        @Override
+                        protected FutureResult<? extends BindResult> chainResult(
+                                final Connection innerResult,
+                                final ResultHandler<? super BindResult> handler)
+                                throws ErrorResultException {
+                            connection = innerResult;
+                            return connection.bindAsync(bindRequest, null, handler);
+                        }
+                    };
+            futureBindResult.setFutureResult(futureConnectionResult);
+        }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    final Connection connection = parentFactory.getConnection();
-    boolean bindSucceeded = false;
-    try
-    {
-      connection.bind(request);
-      bindSucceeded = true;
     }
-    finally
-    {
-      if (!bindSucceeded)
-      {
-        connection.close();
-      }
+
+    private final BindRequest request;
+
+    private final ConnectionFactory parentFactory;
+
+    /**
+     * Creates a new authenticated connection factory which will obtain
+     * connections using the provided connection factory and immediately perform
+     * the provided Bind request.
+     *
+     * @param factory
+     *            The connection factory to use for connecting to the Directory
+     *            Server.
+     * @param request
+     *            The Bind request to use for authentication.
+     */
+    AuthenticatedConnectionFactory(final ConnectionFactory factory, final BindRequest request) {
+        this.parentFactory = factory;
+
+        // FIXME: should do a defensive copy.
+        this.request = request;
     }
-    // If the bind didn't succeed then an exception will have been thrown and
-    // this line will not be reached.
-    return new AuthenticatedConnection(connection);
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        final Connection connection = parentFactory.getConnection();
+        boolean bindSucceeded = false;
+        try {
+            connection.bind(request);
+            bindSucceeded = true;
+        } finally {
+            if (!bindSucceeded) {
+                connection.close();
+            }
+        }
+        // If the bind didn't succeed then an exception will have been thrown
+        // and
+        // this line will not be reached.
+        return new AuthenticatedConnection(connection);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        final FutureResultImpl future = new FutureResultImpl(request, handler);
+        future.futureConnectionResult.setFutureResult(parentFactory
+                .getConnectionAsync(future.futureConnectionResult));
+        return future.futureBindResult;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    final FutureResultImpl future = new FutureResultImpl(request, handler);
-    future.futureConnectionResult.setFutureResult(parentFactory
-        .getConnectionAsync(future.futureConnectionResult));
-    return future.futureBindResult;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AuthenticatedConnectionFactory(");
-    builder.append(String.valueOf(parentFactory));
-    builder.append(')');
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AuthenticatedConnectionFactory(");
+        builder.append(String.valueOf(parentFactory));
+        builder.append(')');
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java
index 7f62552..5d683d1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Bind
  * Request failed due to an authentication failure. More specifically, this
@@ -51,10 +46,8 @@
  * </ul>
  */
 @SuppressWarnings("serial")
-public class AuthenticationException extends ErrorResultException
-{
-  AuthenticationException(final Result result)
-  {
-    super(result);
-  }
+public class AuthenticationException extends ErrorResultException {
+    AuthenticationException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java
index ec1af31..94b81d5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * failed due to an authorization failure. More specifically, this exception is
@@ -53,10 +48,8 @@
  * </ul>
  */
 @SuppressWarnings("serial")
-public class AuthorizationException extends ErrorResultException
-{
-  AuthorizationException(final Result result)
-  {
-    super(result);
-  }
+public class AuthorizationException extends ErrorResultException {
+    AuthorizationException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java
index d6d5a05..975b840 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,301 +26,272 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 import java.io.OutputStream;
 
-
-
 /**
  * A {@code ByteSequence} is a readable sequence of byte values. This interface
  * provides uniform, read-only access to many different kinds of byte sequences.
  */
-public interface ByteSequence extends Comparable<ByteSequence>
-{
+public interface ByteSequence extends Comparable<ByteSequence> {
 
-  /**
-   * Returns a {@link ByteSequenceReader} which can be used to incrementally
-   * read and decode data from this byte sequence.
-   * <p>
-   * <b>NOTE:</b> any concurrent changes to the underlying byte sequence (if
-   * mutable) may cause subsequent reads to overrun and fail.
-   *
-   * @return The {@link ByteSequenceReader} which can be used to incrementally
-   *         read and decode data from this byte sequence.
-   */
-  ByteSequenceReader asReader();
+    /**
+     * Returns a {@link ByteSequenceReader} which can be used to incrementally
+     * read and decode data from this byte sequence.
+     * <p>
+     * <b>NOTE:</b> any concurrent changes to the underlying byte sequence (if
+     * mutable) may cause subsequent reads to overrun and fail.
+     *
+     * @return The {@link ByteSequenceReader} which can be used to incrementally
+     *         read and decode data from this byte sequence.
+     */
+    ByteSequenceReader asReader();
 
+    /**
+     * Returns the byte value at the specified index.
+     * <p>
+     * An index ranges from zero to {@code length() - 1}. The first byte value
+     * of the sequence is at index zero, the next at index one, and so on, as
+     * for array indexing.
+     *
+     * @param index
+     *            The index of the byte to be returned.
+     * @return The byte value at the specified index.
+     * @throws IndexOutOfBoundsException
+     *             If the index argument is negative or not less than length().
+     */
+    byte byteAt(int index);
 
+    /**
+     * Compares this byte sequence with the specified byte array sub-sequence
+     * for order. Returns a negative integer, zero, or a positive integer
+     * depending on whether this byte sequence is less than, equal to, or
+     * greater than the specified byte array sub-sequence.
+     *
+     * @param bytes
+     *            The byte array to compare.
+     * @param offset
+     *            The offset of the sub-sequence in the byte array to be
+     *            compared; must be non-negative and no larger than
+     *            {@code bytes.length} .
+     * @param length
+     *            The length of the sub-sequence in the byte array to be
+     *            compared; must be non-negative and no larger than
+     *            {@code bytes.length - offset}.
+     * @return A negative integer, zero, or a positive integer depending on
+     *         whether this byte sequence is less than, equal to, or greater
+     *         than the specified byte array sub-sequence.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative or if {@code length} is
+     *             negative or if {@code offset + length} is greater than
+     *             {@code bytes.length}.
+     */
+    int compareTo(byte[] bytes, int offset, int length);
 
-  /**
-   * Returns the byte value at the specified index.
-   * <p>
-   * An index ranges from zero to {@code length() - 1}. The first byte value of
-   * the sequence is at index zero, the next at index one, and so on, as for
-   * array indexing.
-   *
-   * @param index
-   *          The index of the byte to be returned.
-   * @return The byte value at the specified index.
-   * @throws IndexOutOfBoundsException
-   *           If the index argument is negative or not less than length().
-   */
-  byte byteAt(int index);
+    /**
+     * Compares this byte sequence with the specified byte sequence for order.
+     * Returns a negative integer, zero, or a positive integer depending on
+     * whether this byte sequence is less than, equal to, or greater than the
+     * specified object.
+     *
+     * @param o
+     *            The byte sequence to be compared.
+     * @return A negative integer, zero, or a positive integer depending on
+     *         whether this byte sequence is less than, equal to, or greater
+     *         than the specified object.
+     */
+    int compareTo(ByteSequence o);
 
+    /**
+     * Copies the contents of this byte sequence to the provided byte array.
+     * <p>
+     * Copying will stop when either the entire content of this sequence has
+     * been copied or if the end of the provided byte array has been reached.
+     * <p>
+     * An invocation of the form:
+     *
+     * <pre>
+     * src.copyTo(bytes)
+     * </pre>
+     *
+     * Behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     * src.copyTo(bytes, 0);
+     * </pre>
+     *
+     * @param bytes
+     *            The byte array to which bytes are to be copied.
+     * @return The byte array.
+     */
+    byte[] copyTo(byte[] bytes);
 
+    /**
+     * Copies the contents of this byte sequence to the specified location in
+     * the provided byte array.
+     * <p>
+     * Copying will stop when either the entire content of this sequence has
+     * been copied or if the end of the provided byte array has been reached.
+     * <p>
+     * An invocation of the form:
+     *
+     * <pre>
+     * src.copyTo(bytes, offset)
+     * </pre>
+     *
+     * Behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     * int len = Math.min(src.length(), bytes.length - offset);
+     * for (int i = 0; i &lt; len; i++)
+     *     bytes[offset + i] = src.get(i);
+     * </pre>
+     *
+     * Except that it is potentially much more efficient.
+     *
+     * @param bytes
+     *            The byte array to which bytes are to be copied.
+     * @param offset
+     *            The offset within the array of the first byte to be written;
+     *            must be non-negative and no larger than bytes.length.
+     * @return The byte array.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative.
+     */
+    byte[] copyTo(byte[] bytes, int offset);
 
-  /**
-   * Compares this byte sequence with the specified byte array sub-sequence for
-   * order. Returns a negative integer, zero, or a positive integer depending on
-   * whether this byte sequence is less than, equal to, or greater than the
-   * specified byte array sub-sequence.
-   *
-   * @param bytes
-   *          The byte array to compare.
-   * @param offset
-   *          The offset of the sub-sequence in the byte array to be compared;
-   *          must be non-negative and no larger than {@code bytes.length} .
-   * @param length
-   *          The length of the sub-sequence in the byte array to be compared;
-   *          must be non-negative and no larger than
-   *          {@code bytes.length - offset}.
-   * @return A negative integer, zero, or a positive integer depending on
-   *         whether this byte sequence is less than, equal to, or greater than
-   *         the specified byte array sub-sequence.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative or if {@code length} is negative or
-   *           if {@code offset + length} is greater than {@code bytes.length}.
-   */
-  int compareTo(byte[] bytes, int offset, int length);
+    /**
+     * Appends the entire contents of this byte sequence to the provided
+     * {@link ByteStringBuilder}.
+     *
+     * @param builder
+     *            The builder to copy to.
+     * @return The builder.
+     */
+    ByteStringBuilder copyTo(ByteStringBuilder builder);
 
+    /**
+     * Copies the entire contents of this byte sequence to the provided
+     * {@code OutputStream}.
+     *
+     * @param stream
+     *            The {@code OutputStream} to copy to.
+     * @return The {@code OutputStream}.
+     * @throws IOException
+     *             If an error occurs while writing to the {@code OutputStream}.
+     */
+    OutputStream copyTo(OutputStream stream) throws IOException;
 
+    /**
+     * Indicates whether the provided byte array sub-sequence is equal to this
+     * byte sequence. In order for it to be considered equal, the provided byte
+     * array sub-sequence must contain the same bytes in the same order.
+     *
+     * @param bytes
+     *            The byte array for which to make the determination.
+     * @param offset
+     *            The offset of the sub-sequence in the byte array to be
+     *            compared; must be non-negative and no larger than
+     *            {@code bytes.length} .
+     * @param length
+     *            The length of the sub-sequence in the byte array to be
+     *            compared; must be non-negative and no larger than
+     *            {@code bytes.length - offset}.
+     * @return {@code true} if the content of the provided byte array
+     *         sub-sequence is equal to that of this byte sequence, or
+     *         {@code false} if not.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative or if {@code length} is
+     *             negative or if {@code offset + length} is greater than
+     *             {@code bytes.length}.
+     */
+    boolean equals(byte[] bytes, int offset, int length);
 
-  /**
-   * Compares this byte sequence with the specified byte sequence for order.
-   * Returns a negative integer, zero, or a positive integer depending on
-   * whether this byte sequence is less than, equal to, or greater than the
-   * specified object.
-   *
-   * @param o
-   *          The byte sequence to be compared.
-   * @return A negative integer, zero, or a positive integer depending on
-   *         whether this byte sequence is less than, equal to, or greater than
-   *         the specified object.
-   */
-  int compareTo(ByteSequence o);
+    /**
+     * Indicates whether the provided object is equal to this byte sequence. In
+     * order for it to be considered equal, the provided object must be a byte
+     * sequence containing the same bytes in the same order.
+     *
+     * @param o
+     *            The object for which to make the determination.
+     * @return {@code true} if the provided object is a byte sequence whose
+     *         content is equal to that of this byte sequence, or {@code false}
+     *         if not.
+     */
+    boolean equals(Object o);
 
+    /**
+     * Returns a hash code for this byte sequence. It will be the sum of all of
+     * the bytes contained in the byte sequence.
+     *
+     * @return A hash code for this byte sequence.
+     */
+    int hashCode();
 
+    /**
+     * Returns the length of this byte sequence.
+     *
+     * @return The length of this byte sequence.
+     */
+    int length();
 
-  /**
-   * Copies the contents of this byte sequence to the provided byte array.
-   * <p>
-   * Copying will stop when either the entire content of this sequence has been
-   * copied or if the end of the provided byte array has been reached.
-   * <p>
-   * An invocation of the form:
-   *
-   * <pre>
-   * src.copyTo(bytes)
-   * </pre>
-   *
-   * Behaves in exactly the same way as the invocation:
-   *
-   * <pre>
-   * src.copyTo(bytes, 0);
-   * </pre>
-   *
-   * @param bytes
-   *          The byte array to which bytes are to be copied.
-   * @return The byte array.
-   */
-  byte[] copyTo(byte[] bytes);
+    /**
+     * Returns a new byte sequence that is a subsequence of this byte sequence.
+     * <p>
+     * The subsequence starts with the byte value at the specified {@code start}
+     * index and ends with the byte value at index {@code end - 1}. The length
+     * (in bytes) of the returned sequence is {@code end - start}, so if
+     * {@code start
+     * == end} then an empty sequence is returned.
+     * <p>
+     * <b>NOTE:</b> changes to the underlying byte sequence (if mutable) may
+     * render the returned sub-sequence invalid.
+     *
+     * @param start
+     *            The start index, inclusive.
+     * @param end
+     *            The end index, exclusive.
+     * @return The newly created byte subsequence.
+     * @throws IndexOutOfBoundsException
+     *             If {@code start} or {@code end} are negative, if {@code end}
+     *             is greater than {@code length()}, or if {@code start} is
+     *             greater than {@code end}.
+     */
+    ByteSequence subSequence(int start, int end);
 
+    /**
+     * Returns a byte array containing the bytes in this sequence in the same
+     * order as this sequence. The length of the byte array will be the length
+     * of this sequence.
+     * <p>
+     * An invocation of the form:
+     *
+     * <pre>
+     * src.toByteArray()
+     * </pre>
+     *
+     * Behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     * src.copyTo(new byte[src.length()]);
+     * </pre>
+     *
+     * @return A byte array consisting of exactly this sequence of bytes.
+     */
+    byte[] toByteArray();
 
+    /**
+     * Returns the {@link ByteString} representation of this byte sequence.
+     *
+     * @return The {@link ByteString} representation of this byte sequence.
+     */
+    ByteString toByteString();
 
-  /**
-   * Copies the contents of this byte sequence to the specified location in the
-   * provided byte array.
-   * <p>
-   * Copying will stop when either the entire content of this sequence has been
-   * copied or if the end of the provided byte array has been reached.
-   * <p>
-   * An invocation of the form:
-   *
-   * <pre>
-   * src.copyTo(bytes, offset)
-   * </pre>
-   *
-   * Behaves in exactly the same way as the invocation:
-   *
-   * <pre>
-   * int len = Math.min(src.length(), bytes.length - offset);
-   * for (int i = 0; i &lt; len; i++)
-   *   bytes[offset + i] = src.get(i);
-   * </pre>
-   *
-   * Except that it is potentially much more efficient.
-   *
-   * @param bytes
-   *          The byte array to which bytes are to be copied.
-   * @param offset
-   *          The offset within the array of the first byte to be written; must
-   *          be non-negative and no larger than bytes.length.
-   * @return The byte array.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative.
-   */
-  byte[] copyTo(byte[] bytes, int offset);
-
-
-
-  /**
-   * Appends the entire contents of this byte sequence to the provided
-   * {@link ByteStringBuilder}.
-   *
-   * @param builder
-   *          The builder to copy to.
-   * @return The builder.
-   */
-  ByteStringBuilder copyTo(ByteStringBuilder builder);
-
-
-
-  /**
-   * Copies the entire contents of this byte sequence to the provided {@code
-   * OutputStream}.
-   *
-   * @param stream
-   *          The {@code OutputStream} to copy to.
-   * @return The {@code OutputStream}.
-   * @throws IOException
-   *           If an error occurs while writing to the {@code OutputStream}.
-   */
-  OutputStream copyTo(OutputStream stream) throws IOException;
-
-
-
-  /**
-   * Indicates whether the provided byte array sub-sequence is equal to this
-   * byte sequence. In order for it to be considered equal, the provided byte
-   * array sub-sequence must contain the same bytes in the same order.
-   *
-   * @param bytes
-   *          The byte array for which to make the determination.
-   * @param offset
-   *          The offset of the sub-sequence in the byte array to be compared;
-   *          must be non-negative and no larger than {@code bytes.length} .
-   * @param length
-   *          The length of the sub-sequence in the byte array to be compared;
-   *          must be non-negative and no larger than
-   *          {@code bytes.length - offset}.
-   * @return {@code true} if the content of the provided byte array sub-sequence
-   *         is equal to that of this byte sequence, or {@code false} if not.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative or if {@code length} is negative or
-   *           if {@code offset + length} is greater than {@code bytes.length}.
-   */
-  boolean equals(byte[] bytes, int offset, int length);
-
-
-
-  /**
-   * Indicates whether the provided object is equal to this byte sequence. In
-   * order for it to be considered equal, the provided object must be a byte
-   * sequence containing the same bytes in the same order.
-   *
-   * @param o
-   *          The object for which to make the determination.
-   * @return {@code true} if the provided object is a byte sequence whose
-   *         content is equal to that of this byte sequence, or {@code false} if
-   *         not.
-   */
-  boolean equals(Object o);
-
-
-
-  /**
-   * Returns a hash code for this byte sequence. It will be the sum of all of
-   * the bytes contained in the byte sequence.
-   *
-   * @return A hash code for this byte sequence.
-   */
-  int hashCode();
-
-
-
-  /**
-   * Returns the length of this byte sequence.
-   *
-   * @return The length of this byte sequence.
-   */
-  int length();
-
-
-
-  /**
-   * Returns a new byte sequence that is a subsequence of this byte sequence.
-   * <p>
-   * The subsequence starts with the byte value at the specified {@code start}
-   * index and ends with the byte value at index {@code end - 1}. The length (in
-   * bytes) of the returned sequence is {@code end - start}, so if {@code start
-   * == end} then an empty sequence is returned.
-   * <p>
-   * <b>NOTE:</b> changes to the underlying byte sequence (if mutable) may
-   * render the returned sub-sequence invalid.
-   *
-   * @param start
-   *          The start index, inclusive.
-   * @param end
-   *          The end index, exclusive.
-   * @return The newly created byte subsequence.
-   * @throws IndexOutOfBoundsException
-   *           If {@code start} or {@code end} are negative, if {@code end} is
-   *           greater than {@code length()}, or if {@code start} is greater
-   *           than {@code end}.
-   */
-  ByteSequence subSequence(int start, int end);
-
-
-
-  /**
-   * Returns a byte array containing the bytes in this sequence in the same
-   * order as this sequence. The length of the byte array will be the length of
-   * this sequence.
-   * <p>
-   * An invocation of the form:
-   *
-   * <pre>
-   * src.toByteArray()
-   * </pre>
-   *
-   * Behaves in exactly the same way as the invocation:
-   *
-   * <pre>
-   * src.copyTo(new byte[src.length()]);
-   * </pre>
-   *
-   * @return A byte array consisting of exactly this sequence of bytes.
-   */
-  byte[] toByteArray();
-
-
-
-  /**
-   * Returns the {@link ByteString} representation of this byte sequence.
-   *
-   * @return The {@link ByteString} representation of this byte sequence.
-   */
-  ByteString toByteString();
-
-
-
-  /**
-   * Returns the UTF-8 decoded string representation of this byte sequence. If
-   * UTF-8 decoding fails, the platform's default encoding will be used.
-   *
-   * @return The string representation of this byte sequence.
-   */
-  String toString();
+    /**
+     * Returns the UTF-8 decoded string representation of this byte sequence. If
+     * UTF-8 decoding fails, the platform's default encoding will be used.
+     *
+     * @return The string representation of this byte sequence.
+     */
+    String toString();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java
index c4dfa14..6d90962 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,477 +26,421 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * An interface for iteratively reading date from a {@link ByteSequence} .
- * {@code ByteSequenceReader} must be created using the associated {@code
- * ByteSequence}'s {@code asReader()} method.
+ * {@code ByteSequenceReader} must be created using the associated
+ * {@code ByteSequence}'s {@code asReader()} method.
  */
-public final class ByteSequenceReader
-{
+public final class ByteSequenceReader {
 
-  // The current position in the byte sequence.
-  private int pos = 0;
+    // The current position in the byte sequence.
+    private int pos = 0;
 
-  // The underlying byte sequence.
-  private final ByteSequence sequence;
+    // The underlying byte sequence.
+    private final ByteSequence sequence;
 
-
-
-  /**
-   * Creates a new byte sequence reader whose source is the provided byte
-   * sequence.
-   * <p>
-   * <b>NOTE:</b> any concurrent changes to the underlying byte sequence (if
-   * mutable) may cause subsequent reads to overrun and fail.
-   * <p>
-   * This constructor is package private: construction must be performed using
-   * {@link ByteSequence#asReader()}.
-   *
-   * @param sequence
-   *          The byte sequence to be read.
-   */
-  ByteSequenceReader(final ByteSequence sequence)
-  {
-    this.sequence = sequence;
-  }
-
-
-
-  /**
-   * Relative get method. Reads the byte at the current position.
-   *
-   * @return The byte at this reader's current position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; 1}.
-   */
-  public byte get()
-  {
-    final byte b = sequence.byteAt(pos);
-    pos++;
-    return b;
-  }
-
-
-
-  /**
-   * Relative bulk get method. This method transfers bytes from this reader into
-   * the given destination array. An invocation of this method of the form:
-   *
-   * <pre>
-   * src.get(b);
-   * </pre>
-   *
-   * Behaves in exactly the same way as the invocation:
-   *
-   * <pre>
-   * src.get(b, 0, b.length);
-   * </pre>
-   *
-   * @param b
-   *          The byte array into which bytes are to be written.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; b.length}.
-   */
-  public void get(final byte[] b)
-  {
-    get(b, 0, b.length);
-  }
-
-
-
-  /**
-   * Relative bulk get method. Copies {@code length} bytes from this reader into
-   * the given array, starting at the current position of this reader and at the
-   * given {@code offset} in the array. The position of this reader is then
-   * incremented by {@code length}. In other words, an invocation of this method
-   * of the form:
-   *
-   * <pre>
-   * src.get(b, offset, length);
-   * </pre>
-   *
-   * Has exactly the same effect as the loop:
-   *
-   * <pre>
-   * for (int i = offset; i &lt; offset + length; i++)
-   *   b[i] = src.get();
-   * </pre>
-   *
-   * Except that it first checks that there are sufficient bytes in this buffer
-   * and it is potentially much more efficient.
-   *
-   * @param b
-   *          The byte array into which bytes are to be written.
-   * @param offset
-   *          The offset within the array of the first byte to be written; must
-   *          be non-negative and no larger than {@code b.length}.
-   * @param length
-   *          The number of bytes to be written to the given array; must be
-   *          non-negative and no larger than {@code b.length} .
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; length}.
-   */
-  public void get(final byte[] b, final int offset, final int length)
-  {
-    if (offset < 0 || length < 0 || offset + length > b.length
-        || length > remaining())
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Creates a new byte sequence reader whose source is the provided byte
+     * sequence.
+     * <p>
+     * <b>NOTE:</b> any concurrent changes to the underlying byte sequence (if
+     * mutable) may cause subsequent reads to overrun and fail.
+     * <p>
+     * This constructor is package private: construction must be performed using
+     * {@link ByteSequence#asReader()}.
+     *
+     * @param sequence
+     *            The byte sequence to be read.
+     */
+    ByteSequenceReader(final ByteSequence sequence) {
+        this.sequence = sequence;
     }
 
-    sequence.subSequence(pos, pos + length).copyTo(b, offset);
-    pos += length;
-  }
-
-
-
-  /**
-   * Relative get method for reading a multi-byte BER length. Reads the next one
-   * to five bytes at this reader's current position, composing them into a
-   * integer value and then increments the position by the number of bytes read.
-   *
-   * @return The integer value representing the length at this reader's current
-   *         position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request.
-   */
-  public int getBERLength()
-  {
-    // Make sure we have at least one byte to read.
-    int newPos = pos + 1;
-    if (newPos > sequence.length())
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Relative get method. Reads the byte at the current position.
+     *
+     * @return The byte at this reader's current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; 1}.
+     */
+    public byte get() {
+        final byte b = sequence.byteAt(pos);
+        pos++;
+        return b;
     }
 
-    int length = sequence.byteAt(pos) & 0x7F;
-    if (length != sequence.byteAt(pos))
-    {
-      // Its a multi-byte length
-      final int numLengthBytes = length;
-      newPos = pos + 1 + numLengthBytes;
-      // Make sure we have the bytes needed
-      if (numLengthBytes > 4 || newPos > sequence.length())
-      {
-        // Shouldn't have more than 4 bytes
-        throw new IndexOutOfBoundsException();
-      }
-
-      length = 0x00;
-      for (int i = pos + 1; i < newPos; i++)
-      {
-        length = length << 8 | sequence.byteAt(i) & 0xFF;
-      }
+    /**
+     * Relative bulk get method. This method transfers bytes from this reader
+     * into the given destination array. An invocation of this method of the
+     * form:
+     *
+     * <pre>
+     * src.get(b);
+     * </pre>
+     *
+     * Behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     * src.get(b, 0, b.length);
+     * </pre>
+     *
+     * @param b
+     *            The byte array into which bytes are to be written.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; b.length}.
+     */
+    public void get(final byte[] b) {
+        get(b, 0, b.length);
     }
 
-    pos = newPos;
-    return length;
-  }
+    /**
+     * Relative bulk get method. Copies {@code length} bytes from this reader
+     * into the given array, starting at the current position of this reader and
+     * at the given {@code offset} in the array. The position of this reader is
+     * then incremented by {@code length}. In other words, an invocation of this
+     * method of the form:
+     *
+     * <pre>
+     * src.get(b, offset, length);
+     * </pre>
+     *
+     * Has exactly the same effect as the loop:
+     *
+     * <pre>
+     * for (int i = offset; i &lt; offset + length; i++)
+     *     b[i] = src.get();
+     * </pre>
+     *
+     * Except that it first checks that there are sufficient bytes in this
+     * buffer and it is potentially much more efficient.
+     *
+     * @param b
+     *            The byte array into which bytes are to be written.
+     * @param offset
+     *            The offset within the array of the first byte to be written;
+     *            must be non-negative and no larger than {@code b.length}.
+     * @param length
+     *            The number of bytes to be written to the given array; must be
+     *            non-negative and no larger than {@code b.length} .
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; length}.
+     */
+    public void get(final byte[] b, final int offset, final int length) {
+        if (offset < 0 || length < 0 || offset + length > b.length || length > remaining()) {
+            throw new IndexOutOfBoundsException();
+        }
 
-
-
-  /**
-   * Relative bulk get method. Returns a {@link ByteSequence} whose content is
-   * the next {@code length} bytes from this reader, starting at the current
-   * position of this reader. The position of this reader is then incremented by
-   * {@code length}.
-   * <p>
-   * <b>NOTE:</b> The value returned from this method should NEVER be cached as
-   * it prevents the contents of the underlying byte stream from being garbage
-   * collected.
-   *
-   * @param length
-   *          The length of the byte sequence to be returned.
-   * @return The byte sequence whose content is the next {@code length} bytes
-   *         from this reader.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; length}.
-   */
-  public ByteSequence getByteSequence(final int length)
-  {
-    final int newPos = pos + length;
-    final ByteSequence subSequence = sequence.subSequence(pos, newPos);
-    pos = newPos;
-    return subSequence;
-  }
-
-
-
-  /**
-   * Relative bulk get method. Returns a {@link ByteString} whose content is the
-   * next {@code length} bytes from this reader, starting at the current
-   * position of this reader. The position of this reader is then incremented by
-   * {@code length}.
-   * <p>
-   * An invocation of this method of the form:
-   *
-   * <pre>
-   * src.getByteString(length);
-   * </pre>
-   *
-   * Has exactly the same effect as:
-   *
-   * <pre>
-   * src.getByteSequence(length).toByteString();
-   * </pre>
-   *
-   * <b>NOTE:</b> The value returned from this method should NEVER be cached as
-   * it prevents the contents of the underlying byte stream from being garbage
-   * collected.
-   *
-   * @param length
-   *          The length of the byte string to be returned.
-   * @return The byte string whose content is the next {@code length} bytes from
-   *         this reader.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; length}.
-   */
-  public ByteString getByteString(final int length)
-  {
-    return getByteSequence(length).toByteString();
-  }
-
-
-
-  /**
-   * Relative get method for reading an integer value. Reads the next four bytes
-   * at this reader's current position, composing them into an integer value
-   * according to big-endian byte order, and then increments the position by
-   * four.
-   *
-   * @return The integer value at this reader's current position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; 4}.
-   */
-  public int getInt()
-  {
-    if (remaining() < 4)
-    {
-      throw new IndexOutOfBoundsException();
+        sequence.subSequence(pos, pos + length).copyTo(b, offset);
+        pos += length;
     }
 
-    int v = 0;
-    for (int i = 0; i < 4; i++)
-    {
-      v <<= 8;
-      v |= sequence.byteAt(pos++) & 0xFF;
+    /**
+     * Relative get method for reading a multi-byte BER length. Reads the next
+     * one to five bytes at this reader's current position, composing them into
+     * a integer value and then increments the position by the number of bytes
+     * read.
+     *
+     * @return The integer value representing the length at this reader's
+     *         current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request.
+     */
+    public int getBERLength() {
+        // Make sure we have at least one byte to read.
+        int newPos = pos + 1;
+        if (newPos > sequence.length()) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        int length = sequence.byteAt(pos) & 0x7F;
+        if (length != sequence.byteAt(pos)) {
+            // Its a multi-byte length
+            final int numLengthBytes = length;
+            newPos = pos + 1 + numLengthBytes;
+            // Make sure we have the bytes needed
+            if (numLengthBytes > 4 || newPos > sequence.length()) {
+                // Shouldn't have more than 4 bytes
+                throw new IndexOutOfBoundsException();
+            }
+
+            length = 0x00;
+            for (int i = pos + 1; i < newPos; i++) {
+                length = length << 8 | sequence.byteAt(i) & 0xFF;
+            }
+        }
+
+        pos = newPos;
+        return length;
     }
 
-    return v;
-  }
-
-
-
-  /**
-   * Relative get method for reading a long value. Reads the next eight bytes at
-   * this reader's current position, composing them into a long value according
-   * to big-endian byte order, and then increments the position by eight.
-   *
-   * @return The long value at this reader's current position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; 8}.
-   */
-  public long getLong()
-  {
-    if (remaining() < 8)
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Relative bulk get method. Returns a {@link ByteSequence} whose content is
+     * the next {@code length} bytes from this reader, starting at the current
+     * position of this reader. The position of this reader is then incremented
+     * by {@code length}.
+     * <p>
+     * <b>NOTE:</b> The value returned from this method should NEVER be cached
+     * as it prevents the contents of the underlying byte stream from being
+     * garbage collected.
+     *
+     * @param length
+     *            The length of the byte sequence to be returned.
+     * @return The byte sequence whose content is the next {@code length} bytes
+     *         from this reader.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; length}.
+     */
+    public ByteSequence getByteSequence(final int length) {
+        final int newPos = pos + length;
+        final ByteSequence subSequence = sequence.subSequence(pos, newPos);
+        pos = newPos;
+        return subSequence;
     }
 
-    long v = 0;
-    for (int i = 0; i < 8; i++)
-    {
-      v <<= 8;
-      v |= sequence.byteAt(pos++) & 0xFF;
+    /**
+     * Relative bulk get method. Returns a {@link ByteString} whose content is
+     * the next {@code length} bytes from this reader, starting at the current
+     * position of this reader. The position of this reader is then incremented
+     * by {@code length}.
+     * <p>
+     * An invocation of this method of the form:
+     *
+     * <pre>
+     * src.getByteString(length);
+     * </pre>
+     *
+     * Has exactly the same effect as:
+     *
+     * <pre>
+     * src.getByteSequence(length).toByteString();
+     * </pre>
+     *
+     * <b>NOTE:</b> The value returned from this method should NEVER be cached
+     * as it prevents the contents of the underlying byte stream from being
+     * garbage collected.
+     *
+     * @param length
+     *            The length of the byte string to be returned.
+     * @return The byte string whose content is the next {@code length} bytes
+     *         from this reader.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; length}.
+     */
+    public ByteString getByteString(final int length) {
+        return getByteSequence(length).toByteString();
     }
 
-    return v;
-  }
+    /**
+     * Relative get method for reading an integer value. Reads the next four
+     * bytes at this reader's current position, composing them into an integer
+     * value according to big-endian byte order, and then increments the
+     * position by four.
+     *
+     * @return The integer value at this reader's current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; 4}.
+     */
+    public int getInt() {
+        if (remaining() < 4) {
+            throw new IndexOutOfBoundsException();
+        }
 
+        int v = 0;
+        for (int i = 0; i < 4; i++) {
+            v <<= 8;
+            v |= sequence.byteAt(pos++) & 0xFF;
+        }
 
-
-  /**
-   * Relative get method for reading an short value. Reads the next 2 bytes at
-   * this reader's current position, composing them into an short value
-   * according to big-endian byte order, and then increments the position by
-   * two.
-   *
-   * @return The integer value at this reader's current position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; 2}.
-   */
-  public short getShort()
-  {
-    if (remaining() < 2)
-    {
-      throw new IndexOutOfBoundsException();
+        return v;
     }
 
-    short v = 0;
-    for (int i = 0; i < 2; i++)
-    {
-      v <<= 8;
-      v |= sequence.byteAt(pos++) & 0xFF;
+    /**
+     * Relative get method for reading a long value. Reads the next eight bytes
+     * at this reader's current position, composing them into a long value
+     * according to big-endian byte order, and then increments the position by
+     * eight.
+     *
+     * @return The long value at this reader's current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; 8}.
+     */
+    public long getLong() {
+        if (remaining() < 8) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        long v = 0;
+        for (int i = 0; i < 8; i++) {
+            v <<= 8;
+            v |= sequence.byteAt(pos++) & 0xFF;
+        }
+
+        return v;
     }
 
-    return v;
-  }
+    /**
+     * Relative get method for reading an short value. Reads the next 2 bytes at
+     * this reader's current position, composing them into an short value
+     * according to big-endian byte order, and then increments the position by
+     * two.
+     *
+     * @return The integer value at this reader's current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; 2}.
+     */
+    public short getShort() {
+        if (remaining() < 2) {
+            throw new IndexOutOfBoundsException();
+        }
 
+        short v = 0;
+        for (int i = 0; i < 2; i++) {
+            v <<= 8;
+            v |= sequence.byteAt(pos++) & 0xFF;
+        }
 
-
-  /**
-   * Relative get method for reading a UTF-8 encoded string. Reads the next
-   * number of specified bytes at this reader's current position, decoding them
-   * into a string using UTF-8 and then increments the position by the number of
-   * bytes read. If UTF-8 decoding fails, the platform's default encoding will
-   * be used.
-   *
-   * @param length
-   *          The number of bytes to read and decode.
-   * @return The string value at the reader's current position.
-   * @throws IndexOutOfBoundsException
-   *           If there are fewer bytes remaining in this reader than are
-   *           required to satisfy the request, that is, if {@code remaining()
-   *           &lt; length}.
-   */
-  public String getString(final int length)
-  {
-    if (remaining() < length)
-    {
-      throw new IndexOutOfBoundsException();
+        return v;
     }
 
-    final int newPos = pos + length;
-    final String str = sequence.subSequence(pos, pos + length).toString();
-    pos = newPos;
-    return str;
-  }
+    /**
+     * Relative get method for reading a UTF-8 encoded string. Reads the next
+     * number of specified bytes at this reader's current position, decoding
+     * them into a string using UTF-8 and then increments the position by the
+     * number of bytes read. If UTF-8 decoding fails, the platform's default
+     * encoding will be used.
+     *
+     * @param length
+     *            The number of bytes to read and decode.
+     * @return The string value at the reader's current position.
+     * @throws IndexOutOfBoundsException
+     *             If there are fewer bytes remaining in this reader than are
+     *             required to satisfy the request, that is, if
+     *             {@code remaining()
+     *           &lt; length}.
+     */
+    public String getString(final int length) {
+        if (remaining() < length) {
+            throw new IndexOutOfBoundsException();
+        }
 
-
-
-  /**
-   * Returns this reader's position.
-   *
-   * @return The position of this reader.
-   */
-  public int position()
-  {
-    return pos;
-  }
-
-
-
-  /**
-   * Sets this reader's position.
-   *
-   * @param pos
-   *          The new position value; must be non-negative and no larger than
-   *          the length of the underlying byte sequence.
-   * @throws IndexOutOfBoundsException
-   *           If the position is negative or larger than the length of the
-   *           underlying byte sequence.
-   */
-  public void position(final int pos)
-  {
-    if (pos > sequence.length() || pos < 0)
-    {
-      throw new IndexOutOfBoundsException();
+        final int newPos = pos + length;
+        final String str = sequence.subSequence(pos, pos + length).toString();
+        pos = newPos;
+        return str;
     }
 
-    this.pos = pos;
-  }
+    /**
+     * Returns this reader's position.
+     *
+     * @return The position of this reader.
+     */
+    public int position() {
+        return pos;
+    }
 
+    /**
+     * Sets this reader's position.
+     *
+     * @param pos
+     *            The new position value; must be non-negative and no larger
+     *            than the length of the underlying byte sequence.
+     * @throws IndexOutOfBoundsException
+     *             If the position is negative or larger than the length of the
+     *             underlying byte sequence.
+     */
+    public void position(final int pos) {
+        if (pos > sequence.length() || pos < 0) {
+            throw new IndexOutOfBoundsException();
+        }
 
+        this.pos = pos;
+    }
 
-  /**
-   * Returns the number of bytes between the current position and the end of the
-   * underlying byte sequence.
-   *
-   * @return The number of bytes between the current position and the end of the
-   *         underlying byte sequence.
-   */
-  public int remaining()
-  {
-    return sequence.length() - pos;
-  }
+    /**
+     * Returns the number of bytes between the current position and the end of
+     * the underlying byte sequence.
+     *
+     * @return The number of bytes between the current position and the end of
+     *         the underlying byte sequence.
+     */
+    public int remaining() {
+        return sequence.length() - pos;
+    }
 
+    /**
+     * Rewinds this reader's position to zero.
+     * <p>
+     * An invocation of this method of the form:
+     *
+     * <pre>
+     * src.rewind();
+     * </pre>
+     *
+     * Has exactly the same effect as:
+     *
+     * <pre>
+     * src.position(0);
+     * </pre>
+     */
+    public void rewind() {
+        position(0);
+    }
 
+    /**
+     * Skips the given number of bytes. Negative values are allowed.
+     * <p>
+     * An invocation of this method of the form:
+     *
+     * <pre>
+     * src.skip(length);
+     * </pre>
+     *
+     * Has exactly the same effect as:
+     *
+     * <pre>
+     * src.position(position() + length);
+     * </pre>
+     *
+     * @param length
+     *            The number of bytes to skip.
+     * @throws IndexOutOfBoundsException
+     *             If the new position is less than 0 or greater than the length
+     *             of the underlying byte sequence.
+     */
+    public void skip(final int length) {
+        position(pos + length);
+    }
 
-  /**
-   * Rewinds this reader's position to zero.
-   * <p>
-   * An invocation of this method of the form:
-   *
-   * <pre>
-   * src.rewind();
-   * </pre>
-   *
-   * Has exactly the same effect as:
-   *
-   * <pre>
-   * src.position(0);
-   * </pre>
-   */
-  public void rewind()
-  {
-    position(0);
-  }
-
-
-
-  /**
-   * Skips the given number of bytes. Negative values are allowed.
-   * <p>
-   * An invocation of this method of the form:
-   *
-   * <pre>
-   * src.skip(length);
-   * </pre>
-   *
-   * Has exactly the same effect as:
-   *
-   * <pre>
-   * src.position(position() + length);
-   * </pre>
-   *
-   * @param length
-   *          The number of bytes to skip.
-   * @throws IndexOutOfBoundsException
-   *           If the new position is less than 0 or greater than the length of
-   *           the underlying byte sequence.
-   */
-  public void skip(final int length)
-  {
-    position(pos + length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return sequence.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return sequence.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java
index 97690fd..2b92904 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
@@ -39,714 +36,576 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An immutable sequence of bytes backed by a byte array.
  */
-public final class ByteString implements ByteSequence
-{
+public final class ByteString implements ByteSequence {
 
-  // Singleton empty byte string.
-  private static final ByteString EMPTY = wrap(new byte[0]);
+    // Singleton empty byte string.
+    private static final ByteString EMPTY = wrap(new byte[0]);
 
-
-
-  /**
-   * Returns an empty byte string.
-   *
-   * @return An empty byte string.
-   */
-  public static ByteString empty()
-  {
-    return EMPTY;
-  }
-
-
-
-  /**
-   * Returns a byte string containing the big-endian encoded bytes of the
-   * provided integer.
-   *
-   * @param i
-   *          The integer to encode.
-   * @return The byte string containing the big-endian encoded bytes of the
-   *         provided integer.
-   */
-  public static ByteString valueOf(int i)
-  {
-    final byte[] bytes = new byte[4];
-    for (int j = 3; j >= 0; j--)
-    {
-      bytes[j] = (byte) (i & 0xFF);
-      i >>>= 8;
-    }
-    return wrap(bytes);
-  }
-
-
-
-  /**
-   * Returns a byte string containing the big-endian encoded bytes of the
-   * provided long.
-   *
-   * @param l
-   *          The long to encode.
-   * @return The byte string containing the big-endian encoded bytes of the
-   *         provided long.
-   */
-  public static ByteString valueOf(long l)
-  {
-    final byte[] bytes = new byte[8];
-    for (int i = 7; i >= 0; i--)
-    {
-      bytes[i] = (byte) (l & 0xFF);
-      l >>>= 8;
-    }
-    return wrap(bytes);
-  }
-
-
-
-  /**
-   * Returns a byte string representation of the provided object. The object is
-   * converted to a byte string as follows:
-   * <ul>
-   * <li>if the object is an instance of {@code ByteSequence} then this method
-   * is equivalent to calling {@code o.toByteString()}
-   * <li>if the object is a {@code byte[]} then this method is equivalent to
-   * calling {@link #valueOf(byte[])}
-   * <li>if the object is a {@code char[]} then this method is equivalent to
-   * calling {@link #valueOf(char[])}
-   * <li>for all other types of object this method is equivalent to calling
-   * {@link #valueOf(String)} with the {@code toString()} representation of the
-   * provided object.
-   * </ul>
-   * <b>Note:</b> this method treats {@code Long} and {@code Integer} objects
-   * like any other type of {@code Object}. More specifically, the following
-   * invocations are not equivalent:
-   * <ul>
-   * <li>{@code valueOf(0)} is not equivalent to {@code valueOf((Object) 0)}
-   * <li>{@code valueOf(0L)} is not equivalent to {@code valueOf((Object) 0L)}
-   * </ul>
-   *
-   * @param o
-   *          The object to use.
-   * @return The byte string containing the provided object.
-   */
-  public static ByteString valueOf(final Object o)
-  {
-    if (o instanceof ByteSequence)
-    {
-      return ((ByteSequence) o).toByteString();
-    }
-    else if (o instanceof byte[])
-    {
-      return valueOf((byte[]) o);
-    }
-    else if (o instanceof char[])
-    {
-      return valueOf((char[]) o);
-    }
-    else
-    {
-      return valueOf(o.toString());
-    }
-  }
-
-
-
-  /**
-   * Returns a byte string containing the UTF-8 encoded bytes of the provided
-   * string.
-   *
-   * @param s
-   *          The string to use.
-   * @return The byte string with the encoded bytes of the provided string.
-   */
-  public static ByteString valueOf(final String s)
-  {
-    return wrap(StaticUtils.getBytes(s));
-  }
-
-
-
-  /**
-   * Returns a byte string containing the contents of the provided byte array.
-   * <p>
-   * This method differs from {@link #wrap(byte[])} in that it defensively
-   * copies the provided byte array.
-   *
-   * @param bytes
-   *          The byte array to use.
-   * @return A byte string containing a copy of the provided byte array.
-   */
-  public static ByteString valueOf(final byte[] bytes)
-  {
-    return wrap(Arrays.copyOf(bytes, bytes.length));
-  }
-
-
-
-  /**
-   * Returns a byte string containing the UTF-8 encoded bytes of the provided
-   * char array.
-   *
-   * @param chars
-   *          The char array to use.
-   * @return A byte string containing the UTF-8 encoded bytes of the provided
-   *         char array.
-   */
-  public static ByteString valueOf(final char[] chars)
-  {
-    return wrap(StaticUtils.getBytes(chars));
-  }
-
-
-
-  /**
-   * Returns a byte string that wraps the provided byte array.
-   * <p>
-   * <b>NOTE:</b> this method takes ownership of the provided byte array and,
-   * therefore, the byte array MUST NOT be altered directly after this method
-   * returns.
-   *
-   * @param bytes
-   *          The byte array to wrap.
-   * @return The byte string that wraps the given byte array.
-   */
-  public static ByteString wrap(final byte[] bytes)
-  {
-    return new ByteString(bytes, 0, bytes.length);
-  }
-
-
-
-  /**
-   * Returns a byte string that wraps a subsequence of the provided byte array.
-   * <p>
-   * <b>NOTE:</b> this method takes ownership of the provided byte array and,
-   * therefore, the byte array MUST NOT be altered directly after this method
-   * returns.
-   *
-   * @param bytes
-   *          The byte array to wrap.
-   * @param offset
-   *          The offset of the byte array to be used; must be non-negative and
-   *          no larger than {@code bytes.length} .
-   * @param length
-   *          The length of the byte array to be used; must be non-negative and
-   *          no larger than {@code bytes.length - offset}.
-   * @return The byte string that wraps the given byte array.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative or if {@code length} is negative or
-   *           if {@code offset + length} is greater than {@code bytes.length}.
-   */
-  public static ByteString wrap(final byte[] bytes, final int offset,
-      final int length)
-  {
-    checkArrayBounds(bytes, offset, length);
-    return new ByteString(bytes, offset, length);
-  }
-
-
-
-  /**
-   * Checks the array bounds of the provided byte array sub-sequence, throwing
-   * an {@code IndexOutOfBoundsException} if they are illegal.
-   *
-   * @param b
-   *          The byte array.
-   * @param offset
-   *          The offset of the byte array to be checked; must be non-negative
-   *          and no larger than {@code b.length}.
-   * @param length
-   *          The length of the byte array to be checked; must be non-negative
-   *          and no larger than {@code b.length - offset}.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative or if {@code length} is negative or
-   *           if {@code offset + length} is greater than {@code b.length}.
-   */
-  static void checkArrayBounds(final byte[] b, final int offset,
-      final int length)
-  {
-    if (offset < 0 || offset > b.length || length < 0
-        || offset + length > b.length || offset + length < 0)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-  }
-
-
-
-  /**
-   * Compares two byte array sub-sequences and returns a value that indicates
-   * their relative order.
-   *
-   * @param b1
-   *          The byte array containing the first sub-sequence.
-   * @param offset1
-   *          The offset of the first byte array sub-sequence.
-   * @param length1
-   *          The length of the first byte array sub-sequence.
-   * @param b2
-   *          The byte array containing the second sub-sequence.
-   * @param offset2
-   *          The offset of the second byte array sub-sequence.
-   * @param length2
-   *          The length of the second byte array sub-sequence.
-   * @return A negative integer if first byte array sub-sequence should come
-   *         before the second byte array sub-sequence in ascending order, a
-   *         positive integer if the first byte array sub-sequence should come
-   *         after the byte array sub-sequence in ascending order, or zero if
-   *         there is no difference between the two byte array sub-sequences
-   *         with regard to ordering.
-   */
-  static int compareTo(final byte[] b1, final int offset1, final int length1,
-      final byte[] b2, final int offset2, final int length2)
-  {
-    int count = Math.min(length1, length2);
-    int i = offset1;
-    int j = offset2;
-    while (count-- != 0)
-    {
-      final int firstByte = 0xFF & b1[i++];
-      final int secondByte = 0xFF & b2[j++];
-      if (firstByte != secondByte)
-      {
-        return firstByte - secondByte;
-      }
-    }
-    return length1 - length2;
-  }
-
-
-
-  /**
-   * Indicates whether two byte array sub-sequences are equal. In order for them
-   * to be considered equal, they must contain the same bytes in the same order.
-   *
-   * @param b1
-   *          The byte array containing the first sub-sequence.
-   * @param offset1
-   *          The offset of the first byte array sub-sequence.
-   * @param length1
-   *          The length of the first byte array sub-sequence.
-   * @param b2
-   *          The byte array containing the second sub-sequence.
-   * @param offset2
-   *          The offset of the second byte array sub-sequence.
-   * @param length2
-   *          The length of the second byte array sub-sequence.
-   * @return {@code true} if the two byte array sub-sequences have the same
-   *         content, or {@code false} if not.
-   */
-  static boolean equals(final byte[] b1, final int offset1, final int length1,
-      final byte[] b2, final int offset2, final int length2)
-  {
-    if (length1 != length2)
-    {
-      return false;
+    /**
+     * Returns an empty byte string.
+     *
+     * @return An empty byte string.
+     */
+    public static ByteString empty() {
+        return EMPTY;
     }
 
-    int i = offset1;
-    int j = offset2;
-    int count = length1;
-    while (count-- != 0)
-    {
-      if (b1[i++] != b2[j++])
-      {
-        return false;
-      }
+    /**
+     * Returns a byte string containing the big-endian encoded bytes of the
+     * provided integer.
+     *
+     * @param i
+     *            The integer to encode.
+     * @return The byte string containing the big-endian encoded bytes of the
+     *         provided integer.
+     */
+    public static ByteString valueOf(int i) {
+        final byte[] bytes = new byte[4];
+        for (int j = 3; j >= 0; j--) {
+            bytes[j] = (byte) (i & 0xFF);
+            i >>>= 8;
+        }
+        return wrap(bytes);
     }
 
-    return true;
-  }
-
-
-
-  /**
-   * Returns a hash code for the provided byte array sub-sequence.
-   *
-   * @param b
-   *          The byte array.
-   * @param offset
-   *          The offset of the byte array sub-sequence.
-   * @param length
-   *          The length of the byte array sub-sequence.
-   * @return A hash code for the provided byte array sub-sequence.
-   */
-  static int hashCode(final byte[] b, final int offset, final int length)
-  {
-    int hashCode = 1;
-    int i = offset;
-    int count = length;
-    while (count-- != 0)
-    {
-      hashCode = 31 * hashCode + b[i++];
-    }
-    return hashCode;
-  }
-
-
-
-  /**
-   * Returns the UTF-8 decoded string representation of the provided byte array
-   * sub-sequence. If UTF-8 decoding fails, the platform's default encoding will
-   * be used.
-   *
-   * @param b
-   *          The byte array.
-   * @param offset
-   *          The offset of the byte array sub-sequence.
-   * @param length
-   *          The length of the byte array sub-sequence.
-   * @return The string representation of the byte array sub-sequence.
-   */
-  static String toString(final byte[] b, final int offset, final int length)
-  {
-    String stringValue;
-    try
-    {
-      stringValue = new String(b, offset, length, "UTF-8");
-    }
-    catch (final Exception e)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        StaticUtils.DEBUG_LOG.warning("Unable to decode ByteString "
-            + "bytes as UTF-8 string: " + e.toString());
-      }
-
-      stringValue = new String(b, offset, length);
+    /**
+     * Returns a byte string containing the big-endian encoded bytes of the
+     * provided long.
+     *
+     * @param l
+     *            The long to encode.
+     * @return The byte string containing the big-endian encoded bytes of the
+     *         provided long.
+     */
+    public static ByteString valueOf(long l) {
+        final byte[] bytes = new byte[8];
+        for (int i = 7; i >= 0; i--) {
+            bytes[i] = (byte) (l & 0xFF);
+            l >>>= 8;
+        }
+        return wrap(bytes);
     }
 
-    return stringValue;
-  }
-
-
-
-  // These are package private so that compression and crypto
-  // functionality may directly access the fields.
-
-  // The buffer where data is stored.
-  final byte[] buffer;
-
-  // The number of bytes to expose from the buffer.
-  final int length;
-
-  // The start index of the range of bytes to expose through this byte
-  // string.
-  final int offset;
-
-
-
-  /**
-   * Creates a new byte string that wraps a subsequence of the provided byte
-   * array.
-   * <p>
-   * <b>NOTE:</b> this method takes ownership of the provided byte array and,
-   * therefore, the byte array MUST NOT be altered directly after this method
-   * returns.
-   *
-   * @param b
-   *          The byte array to wrap.
-   * @param offset
-   *          The offset of the byte array to be used; must be non-negative and
-   *          no larger than {@code b.length} .
-   * @param length
-   *          The length of the byte array to be used; must be non-negative and
-   *          no larger than {@code b.length - offset}.
-   */
-  private ByteString(final byte[] b, final int offset, final int length)
-  {
-    this.buffer = b;
-    this.offset = offset;
-    this.length = length;
-  }
-
-
-
-  /**
-   * Returns a {@link ByteSequenceReader} which can be used to incrementally
-   * read and decode data from this byte string.
-   *
-   * @return The {@link ByteSequenceReader} which can be used to incrementally
-   *         read and decode data from this byte string.
-   */
-  public ByteSequenceReader asReader()
-  {
-    return new ByteSequenceReader(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte byteAt(final int index)
-  {
-    if (index >= length || index < 0)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-    return buffer[offset + index];
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final byte[] bytes, final int offset, final int length)
-  {
-    checkArrayBounds(bytes, offset, length);
-    return compareTo(this.buffer, this.offset, this.length, bytes, offset,
-        length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final ByteSequence o)
-  {
-    if (this == o)
-    {
-      return 0;
-    }
-    return -o.compareTo(buffer, offset, length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] copyTo(final byte[] bytes)
-  {
-    copyTo(bytes, 0);
-    return bytes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] copyTo(final byte[] bytes, final int offset)
-  {
-    if (offset < 0)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-    System.arraycopy(buffer, this.offset, bytes, offset,
-        Math.min(length, bytes.length - offset));
-    return bytes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder copyTo(final ByteStringBuilder builder)
-  {
-    builder.append(buffer, offset, length);
-    return builder;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public OutputStream copyTo(final OutputStream stream) throws IOException
-  {
-    stream.write(buffer, offset, length);
-    return stream;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean equals(final byte[] bytes, final int offset, final int length)
-  {
-    checkArrayBounds(bytes, offset, length);
-    return equals(this.buffer, this.offset, this.length, bytes, offset, length);
-  }
-
-
-
-  /**
-   * Indicates whether the provided object is equal to this byte string. In
-   * order for it to be considered equal, the provided object must be a byte
-   * sequence containing the same bytes in the same order.
-   *
-   * @param o
-   *          The object for which to make the determination.
-   * @return {@code true} if the provided object is a byte sequence whose
-   *         content is equal to that of this byte string, or {@code false} if
-   *         not.
-   */
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (this == o)
-    {
-      return true;
-    }
-    else if (o instanceof ByteSequence)
-    {
-      final ByteSequence other = (ByteSequence) o;
-      return other.equals(buffer, offset, length);
-    }
-    else
-    {
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Returns a hash code for this byte string. It will be the sum of all of the
-   * bytes contained in the byte string.
-   *
-   * @return A hash code for this byte string.
-   */
-  @Override
-  public int hashCode()
-  {
-    return hashCode(buffer, offset, length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int length()
-  {
-    return length;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString subSequence(final int start, final int end)
-  {
-    if (start < 0 || start > end || end > length)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-    return new ByteString(buffer, offset + start, end - start);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] toByteArray()
-  {
-    return copyTo(new byte[length]);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString toByteString()
-  {
-    return this;
-  }
-
-
-
-  /**
-   * Returns the UTF-8 decoded char array representation of this byte sequence.
-   *
-   * @return The UTF-8 decoded char array representation of this byte sequence.
-   */
-  public char[] toCharArray()
-  {
-    Charset utf8 = Charset.forName("UTF-8");
-    CharBuffer charBuffer = utf8
-        .decode(ByteBuffer.wrap(buffer, offset, length));
-    char[] chars = new char[charBuffer.remaining()];
-    charBuffer.get(chars);
-    return chars;
-  }
-
-
-
-  /**
-   * Returns the integer value represented by the first four bytes of this byte
-   * string in big-endian order.
-   *
-   * @return The integer value represented by the first four bytes of this byte
-   *         string in big-endian order.
-   * @throws IndexOutOfBoundsException
-   *           If this byte string has less than four bytes.
-   */
-  public int toInt()
-  {
-    if (length < 4)
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Returns a byte string representation of the provided object. The object
+     * is converted to a byte string as follows:
+     * <ul>
+     * <li>if the object is an instance of {@code ByteSequence} then this method
+     * is equivalent to calling {@code o.toByteString()}
+     * <li>if the object is a {@code byte[]} then this method is equivalent to
+     * calling {@link #valueOf(byte[])}
+     * <li>if the object is a {@code char[]} then this method is equivalent to
+     * calling {@link #valueOf(char[])}
+     * <li>for all other types of object this method is equivalent to calling
+     * {@link #valueOf(String)} with the {@code toString()} representation of
+     * the provided object.
+     * </ul>
+     * <b>Note:</b> this method treats {@code Long} and {@code Integer} objects
+     * like any other type of {@code Object}. More specifically, the following
+     * invocations are not equivalent:
+     * <ul>
+     * <li>{@code valueOf(0)} is not equivalent to {@code valueOf((Object) 0)}
+     * <li>{@code valueOf(0L)} is not equivalent to {@code valueOf((Object) 0L)}
+     * </ul>
+     *
+     * @param o
+     *            The object to use.
+     * @return The byte string containing the provided object.
+     */
+    public static ByteString valueOf(final Object o) {
+        if (o instanceof ByteSequence) {
+            return ((ByteSequence) o).toByteString();
+        } else if (o instanceof byte[]) {
+            return valueOf((byte[]) o);
+        } else if (o instanceof char[]) {
+            return valueOf((char[]) o);
+        } else {
+            return valueOf(o.toString());
+        }
     }
 
-    int v = 0;
-    for (int i = 0; i < 4; i++)
-    {
-      v <<= 8;
-      v |= buffer[offset + i] & 0xFF;
-    }
-    return v;
-  }
-
-
-
-  /**
-   * Returns the long value represented by the first eight bytes of this byte
-   * string in big-endian order.
-   *
-   * @return The long value represented by the first eight bytes of this byte
-   *         string in big-endian order.
-   * @throws IndexOutOfBoundsException
-   *           If this byte string has less than eight bytes.
-   */
-  public long toLong()
-  {
-    if (length < 8)
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Returns a byte string containing the UTF-8 encoded bytes of the provided
+     * string.
+     *
+     * @param s
+     *            The string to use.
+     * @return The byte string with the encoded bytes of the provided string.
+     */
+    public static ByteString valueOf(final String s) {
+        return wrap(StaticUtils.getBytes(s));
     }
 
-    long v = 0;
-    for (int i = 0; i < 8; i++)
-    {
-      v <<= 8;
-      v |= buffer[offset + i] & 0xFF;
+    /**
+     * Returns a byte string containing the contents of the provided byte array.
+     * <p>
+     * This method differs from {@link #wrap(byte[])} in that it defensively
+     * copies the provided byte array.
+     *
+     * @param bytes
+     *            The byte array to use.
+     * @return A byte string containing a copy of the provided byte array.
+     */
+    public static ByteString valueOf(final byte[] bytes) {
+        return wrap(Arrays.copyOf(bytes, bytes.length));
     }
-    return v;
-  }
 
+    /**
+     * Returns a byte string containing the UTF-8 encoded bytes of the provided
+     * char array.
+     *
+     * @param chars
+     *            The char array to use.
+     * @return A byte string containing the UTF-8 encoded bytes of the provided
+     *         char array.
+     */
+    public static ByteString valueOf(final char[] chars) {
+        return wrap(StaticUtils.getBytes(chars));
+    }
 
+    /**
+     * Returns a byte string that wraps the provided byte array.
+     * <p>
+     * <b>NOTE:</b> this method takes ownership of the provided byte array and,
+     * therefore, the byte array MUST NOT be altered directly after this method
+     * returns.
+     *
+     * @param bytes
+     *            The byte array to wrap.
+     * @return The byte string that wraps the given byte array.
+     */
+    public static ByteString wrap(final byte[] bytes) {
+        return new ByteString(bytes, 0, bytes.length);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return toString(buffer, offset, length);
-  }
+    /**
+     * Returns a byte string that wraps a subsequence of the provided byte
+     * array.
+     * <p>
+     * <b>NOTE:</b> this method takes ownership of the provided byte array and,
+     * therefore, the byte array MUST NOT be altered directly after this method
+     * returns.
+     *
+     * @param bytes
+     *            The byte array to wrap.
+     * @param offset
+     *            The offset of the byte array to be used; must be non-negative
+     *            and no larger than {@code bytes.length} .
+     * @param length
+     *            The length of the byte array to be used; must be non-negative
+     *            and no larger than {@code bytes.length - offset}.
+     * @return The byte string that wraps the given byte array.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative or if {@code length} is
+     *             negative or if {@code offset + length} is greater than
+     *             {@code bytes.length}.
+     */
+    public static ByteString wrap(final byte[] bytes, final int offset, final int length) {
+        checkArrayBounds(bytes, offset, length);
+        return new ByteString(bytes, offset, length);
+    }
+
+    /**
+     * Checks the array bounds of the provided byte array sub-sequence, throwing
+     * an {@code IndexOutOfBoundsException} if they are illegal.
+     *
+     * @param b
+     *            The byte array.
+     * @param offset
+     *            The offset of the byte array to be checked; must be
+     *            non-negative and no larger than {@code b.length}.
+     * @param length
+     *            The length of the byte array to be checked; must be
+     *            non-negative and no larger than {@code b.length - offset}.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative or if {@code length} is
+     *             negative or if {@code offset + length} is greater than
+     *             {@code b.length}.
+     */
+    static void checkArrayBounds(final byte[] b, final int offset, final int length) {
+        if (offset < 0 || offset > b.length || length < 0 || offset + length > b.length
+                || offset + length < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+    }
+
+    /**
+     * Compares two byte array sub-sequences and returns a value that indicates
+     * their relative order.
+     *
+     * @param b1
+     *            The byte array containing the first sub-sequence.
+     * @param offset1
+     *            The offset of the first byte array sub-sequence.
+     * @param length1
+     *            The length of the first byte array sub-sequence.
+     * @param b2
+     *            The byte array containing the second sub-sequence.
+     * @param offset2
+     *            The offset of the second byte array sub-sequence.
+     * @param length2
+     *            The length of the second byte array sub-sequence.
+     * @return A negative integer if first byte array sub-sequence should come
+     *         before the second byte array sub-sequence in ascending order, a
+     *         positive integer if the first byte array sub-sequence should come
+     *         after the byte array sub-sequence in ascending order, or zero if
+     *         there is no difference between the two byte array sub-sequences
+     *         with regard to ordering.
+     */
+    static int compareTo(final byte[] b1, final int offset1, final int length1, final byte[] b2,
+            final int offset2, final int length2) {
+        int count = Math.min(length1, length2);
+        int i = offset1;
+        int j = offset2;
+        while (count-- != 0) {
+            final int firstByte = 0xFF & b1[i++];
+            final int secondByte = 0xFF & b2[j++];
+            if (firstByte != secondByte) {
+                return firstByte - secondByte;
+            }
+        }
+        return length1 - length2;
+    }
+
+    /**
+     * Indicates whether two byte array sub-sequences are equal. In order for
+     * them to be considered equal, they must contain the same bytes in the same
+     * order.
+     *
+     * @param b1
+     *            The byte array containing the first sub-sequence.
+     * @param offset1
+     *            The offset of the first byte array sub-sequence.
+     * @param length1
+     *            The length of the first byte array sub-sequence.
+     * @param b2
+     *            The byte array containing the second sub-sequence.
+     * @param offset2
+     *            The offset of the second byte array sub-sequence.
+     * @param length2
+     *            The length of the second byte array sub-sequence.
+     * @return {@code true} if the two byte array sub-sequences have the same
+     *         content, or {@code false} if not.
+     */
+    static boolean equals(final byte[] b1, final int offset1, final int length1, final byte[] b2,
+            final int offset2, final int length2) {
+        if (length1 != length2) {
+            return false;
+        }
+
+        int i = offset1;
+        int j = offset2;
+        int count = length1;
+        while (count-- != 0) {
+            if (b1[i++] != b2[j++]) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns a hash code for the provided byte array sub-sequence.
+     *
+     * @param b
+     *            The byte array.
+     * @param offset
+     *            The offset of the byte array sub-sequence.
+     * @param length
+     *            The length of the byte array sub-sequence.
+     * @return A hash code for the provided byte array sub-sequence.
+     */
+    static int hashCode(final byte[] b, final int offset, final int length) {
+        int hashCode = 1;
+        int i = offset;
+        int count = length;
+        while (count-- != 0) {
+            hashCode = 31 * hashCode + b[i++];
+        }
+        return hashCode;
+    }
+
+    /**
+     * Returns the UTF-8 decoded string representation of the provided byte
+     * array sub-sequence. If UTF-8 decoding fails, the platform's default
+     * encoding will be used.
+     *
+     * @param b
+     *            The byte array.
+     * @param offset
+     *            The offset of the byte array sub-sequence.
+     * @param length
+     *            The length of the byte array sub-sequence.
+     * @return The string representation of the byte array sub-sequence.
+     */
+    static String toString(final byte[] b, final int offset, final int length) {
+        String stringValue;
+        try {
+            stringValue = new String(b, offset, length, "UTF-8");
+        } catch (final Exception e) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                StaticUtils.DEBUG_LOG.warning("Unable to decode ByteString "
+                        + "bytes as UTF-8 string: " + e.toString());
+            }
+
+            stringValue = new String(b, offset, length);
+        }
+
+        return stringValue;
+    }
+
+    // These are package private so that compression and crypto
+    // functionality may directly access the fields.
+
+    // The buffer where data is stored.
+    final byte[] buffer;
+
+    // The number of bytes to expose from the buffer.
+    final int length;
+
+    // The start index of the range of bytes to expose through this byte
+    // string.
+    final int offset;
+
+    /**
+     * Creates a new byte string that wraps a subsequence of the provided byte
+     * array.
+     * <p>
+     * <b>NOTE:</b> this method takes ownership of the provided byte array and,
+     * therefore, the byte array MUST NOT be altered directly after this method
+     * returns.
+     *
+     * @param b
+     *            The byte array to wrap.
+     * @param offset
+     *            The offset of the byte array to be used; must be non-negative
+     *            and no larger than {@code b.length} .
+     * @param length
+     *            The length of the byte array to be used; must be non-negative
+     *            and no larger than {@code b.length - offset}.
+     */
+    private ByteString(final byte[] b, final int offset, final int length) {
+        this.buffer = b;
+        this.offset = offset;
+        this.length = length;
+    }
+
+    /**
+     * Returns a {@link ByteSequenceReader} which can be used to incrementally
+     * read and decode data from this byte string.
+     *
+     * @return The {@link ByteSequenceReader} which can be used to incrementally
+     *         read and decode data from this byte string.
+     */
+    public ByteSequenceReader asReader() {
+        return new ByteSequenceReader(this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte byteAt(final int index) {
+        if (index >= length || index < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+        return buffer[offset + index];
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final byte[] bytes, final int offset, final int length) {
+        checkArrayBounds(bytes, offset, length);
+        return compareTo(this.buffer, this.offset, this.length, bytes, offset, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final ByteSequence o) {
+        if (this == o) {
+            return 0;
+        }
+        return -o.compareTo(buffer, offset, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] copyTo(final byte[] bytes) {
+        copyTo(bytes, 0);
+        return bytes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] copyTo(final byte[] bytes, final int offset) {
+        if (offset < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+        System.arraycopy(buffer, this.offset, bytes, offset, Math
+                .min(length, bytes.length - offset));
+        return bytes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder copyTo(final ByteStringBuilder builder) {
+        builder.append(buffer, offset, length);
+        return builder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public OutputStream copyTo(final OutputStream stream) throws IOException {
+        stream.write(buffer, offset, length);
+        return stream;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(final byte[] bytes, final int offset, final int length) {
+        checkArrayBounds(bytes, offset, length);
+        return equals(this.buffer, this.offset, this.length, bytes, offset, length);
+    }
+
+    /**
+     * Indicates whether the provided object is equal to this byte string. In
+     * order for it to be considered equal, the provided object must be a byte
+     * sequence containing the same bytes in the same order.
+     *
+     * @param o
+     *            The object for which to make the determination.
+     * @return {@code true} if the provided object is a byte sequence whose
+     *         content is equal to that of this byte string, or {@code false} if
+     *         not.
+     */
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        } else if (o instanceof ByteSequence) {
+            final ByteSequence other = (ByteSequence) o;
+            return other.equals(buffer, offset, length);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns a hash code for this byte string. It will be the sum of all of
+     * the bytes contained in the byte string.
+     *
+     * @return A hash code for this byte string.
+     */
+    @Override
+    public int hashCode() {
+        return hashCode(buffer, offset, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int length() {
+        return length;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString subSequence(final int start, final int end) {
+        if (start < 0 || start > end || end > length) {
+            throw new IndexOutOfBoundsException();
+        }
+        return new ByteString(buffer, offset + start, end - start);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] toByteArray() {
+        return copyTo(new byte[length]);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString toByteString() {
+        return this;
+    }
+
+    /**
+     * Returns the UTF-8 decoded char array representation of this byte
+     * sequence.
+     *
+     * @return The UTF-8 decoded char array representation of this byte
+     *         sequence.
+     */
+    public char[] toCharArray() {
+        Charset utf8 = Charset.forName("UTF-8");
+        CharBuffer charBuffer = utf8.decode(ByteBuffer.wrap(buffer, offset, length));
+        char[] chars = new char[charBuffer.remaining()];
+        charBuffer.get(chars);
+        return chars;
+    }
+
+    /**
+     * Returns the integer value represented by the first four bytes of this
+     * byte string in big-endian order.
+     *
+     * @return The integer value represented by the first four bytes of this
+     *         byte string in big-endian order.
+     * @throws IndexOutOfBoundsException
+     *             If this byte string has less than four bytes.
+     */
+    public int toInt() {
+        if (length < 4) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        int v = 0;
+        for (int i = 0; i < 4; i++) {
+            v <<= 8;
+            v |= buffer[offset + i] & 0xFF;
+        }
+        return v;
+    }
+
+    /**
+     * Returns the long value represented by the first eight bytes of this byte
+     * string in big-endian order.
+     *
+     * @return The long value represented by the first eight bytes of this byte
+     *         string in big-endian order.
+     * @throws IndexOutOfBoundsException
+     *             If this byte string has less than eight bytes.
+     */
+    public long toLong() {
+        if (length < 8) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        long v = 0;
+        for (int i = 0; i < 8; i++) {
+            v <<= 8;
+            v |= buffer[offset + i] & 0xFF;
+        }
+        return v;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return toString(buffer, offset, length);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java
index f709bf3..6ecfd05 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -39,1146 +36,907 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * A mutable sequence of bytes backed by a byte array.
  */
-public final class ByteStringBuilder implements ByteSequence
-{
-
-  /**
-   * A sub-sequence of the parent byte string builder. The sub-sequence will be
-   * robust against all updates to the byte string builder except for
-   * invocations of the method {@code clear()}.
-   */
-  private final class SubSequence implements ByteSequence
-  {
-
-    // The length of the sub-sequence.
-    private final int subLength;
-
-    // The offset of the sub-sequence.
-    private final int subOffset;
-
-
+public final class ByteStringBuilder implements ByteSequence {
 
     /**
-     * Creates a new sub-sequence.
+     * A sub-sequence of the parent byte string builder. The sub-sequence will
+     * be robust against all updates to the byte string builder except for
+     * invocations of the method {@code clear()}.
+     */
+    private final class SubSequence implements ByteSequence {
+
+        // The length of the sub-sequence.
+        private final int subLength;
+
+        // The offset of the sub-sequence.
+        private final int subOffset;
+
+        /**
+         * Creates a new sub-sequence.
+         *
+         * @param offset
+         *            The offset of the sub-sequence.
+         * @param length
+         *            The length of the sub-sequence.
+         */
+        private SubSequence(final int offset, final int length) {
+            this.subOffset = offset;
+            this.subLength = length;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public ByteSequenceReader asReader() {
+            return new ByteSequenceReader(this);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public byte byteAt(final int index) {
+            if (index >= subLength || index < 0) {
+                throw new IndexOutOfBoundsException();
+            }
+
+            // Protect against reallocation: use builder's buffer.
+            return buffer[subOffset + index];
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public int compareTo(final byte[] b, final int offset, final int length) {
+            ByteString.checkArrayBounds(b, offset, length);
+
+            // Protect against reallocation: use builder's buffer.
+            return ByteString.compareTo(buffer, subOffset, subLength, b, offset, length);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public int compareTo(final ByteSequence o) {
+            if (this == o) {
+                return 0;
+            }
+
+            // Protect against reallocation: use builder's buffer.
+            return -o.compareTo(buffer, subOffset, subLength);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public byte[] copyTo(final byte[] b) {
+            copyTo(b, 0);
+            return b;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public byte[] copyTo(final byte[] b, final int offset) {
+            if (offset < 0) {
+                throw new IndexOutOfBoundsException();
+            }
+
+            // Protect against reallocation: use builder's buffer.
+            System.arraycopy(buffer, subOffset, b, offset, Math.min(subLength, b.length - offset));
+            return b;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public ByteStringBuilder copyTo(final ByteStringBuilder builder) {
+            // Protect against reallocation: use builder's buffer.
+            return builder.append(buffer, subOffset, subLength);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public OutputStream copyTo(final OutputStream stream) throws IOException {
+            // Protect against reallocation: use builder's buffer.
+            stream.write(buffer, subOffset, subLength);
+            return stream;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean equals(final byte[] b, final int offset, final int length) {
+            ByteString.checkArrayBounds(b, offset, length);
+
+            // Protect against reallocation: use builder's buffer.
+            return ByteString.equals(buffer, subOffset, subLength, b, offset, length);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean equals(final Object o) {
+            if (this == o) {
+                return true;
+            } else if (o instanceof ByteSequence) {
+                final ByteSequence other = (ByteSequence) o;
+
+                // Protect against reallocation: use builder's buffer.
+                return other.equals(buffer, subOffset, subLength);
+            } else {
+                return false;
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int hashCode() {
+            // Protect against reallocation: use builder's buffer.
+            return ByteString.hashCode(buffer, subOffset, subLength);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public int length() {
+            return subLength;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public ByteSequence subSequence(final int start, final int end) {
+            if (start < 0 || start > end || end > subLength) {
+                throw new IndexOutOfBoundsException();
+            }
+
+            return new SubSequence(subOffset + start, end - start);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public byte[] toByteArray() {
+            return copyTo(new byte[subLength]);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public ByteString toByteString() {
+            // Protect against reallocation: use builder's buffer.
+            final byte[] b = new byte[subLength];
+            System.arraycopy(buffer, subOffset, b, 0, subLength);
+            return ByteString.wrap(b);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            // Protect against reallocation: use builder's buffer.
+            return ByteString.toString(buffer, subOffset, subLength);
+        }
+    }
+
+    // These are package private so that compression and crypto
+    // functionality may directly access the fields.
+
+    // The buffer where data is stored.
+    byte[] buffer;
+
+    // The number of bytes to expose from the buffer.
+    int length;
+
+    /**
+     * Creates a new byte string builder with an initial capacity of 32 bytes.
+     */
+    public ByteStringBuilder() {
+        // Initially create a 32 byte buffer.
+        this(32);
+    }
+
+    /**
+     * Creates a new byte string builder with the specified initial capacity.
      *
-     * @param offset
-     *          The offset of the sub-sequence.
-     * @param length
-     *          The length of the sub-sequence.
+     * @param capacity
+     *            The initial capacity.
+     * @throws IllegalArgumentException
+     *             If the {@code capacity} is negative.
      */
-    private SubSequence(final int offset, final int length)
-    {
-      this.subOffset = offset;
-      this.subLength = length;
+    public ByteStringBuilder(final int capacity) {
+        if (capacity < 0) {
+            throw new IllegalArgumentException();
+        }
+
+        this.buffer = new byte[capacity];
+        this.length = 0;
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Appends the provided byte to this byte string builder.
+     *
+     * @param b
+     *            The byte to be appended to this byte string builder.
+     * @return This byte string builder.
      */
-    public ByteSequenceReader asReader()
-    {
-      return new ByteSequenceReader(this);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public byte byteAt(final int index)
-    {
-      if (index >= subLength || index < 0)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-
-      // Protect against reallocation: use builder's buffer.
-      return buffer[subOffset + index];
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public int compareTo(final byte[] b, final int offset, final int length)
-    {
-      ByteString.checkArrayBounds(b, offset, length);
-
-      // Protect against reallocation: use builder's buffer.
-      return ByteString.compareTo(buffer, subOffset, subLength, b, offset,
-          length);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public int compareTo(final ByteSequence o)
-    {
-      if (this == o)
-      {
-        return 0;
-      }
-
-      // Protect against reallocation: use builder's buffer.
-      return -o.compareTo(buffer, subOffset, subLength);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public byte[] copyTo(final byte[] b)
-    {
-      copyTo(b, 0);
-      return b;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public byte[] copyTo(final byte[] b, final int offset)
-    {
-      if (offset < 0)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-
-      // Protect against reallocation: use builder's buffer.
-      System.arraycopy(buffer, subOffset, b, offset, Math.min(subLength,
-          b.length - offset));
-      return b;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public ByteStringBuilder copyTo(final ByteStringBuilder builder)
-    {
-      // Protect against reallocation: use builder's buffer.
-      return builder.append(buffer, subOffset, subLength);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public OutputStream copyTo(final OutputStream stream) throws IOException
-    {
-      // Protect against reallocation: use builder's buffer.
-      stream.write(buffer, subOffset, subLength);
-      return stream;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean equals(final byte[] b, final int offset, final int length)
-    {
-      ByteString.checkArrayBounds(b, offset, length);
-
-      // Protect against reallocation: use builder's buffer.
-      return ByteString.equals(buffer, subOffset, subLength, b, offset, length);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(final Object o)
-    {
-      if (this == o)
-      {
-        return true;
-      }
-      else if (o instanceof ByteSequence)
-      {
-        final ByteSequence other = (ByteSequence) o;
-
-        // Protect against reallocation: use builder's buffer.
-        return other.equals(buffer, subOffset, subLength);
-      }
-      else
-      {
-        return false;
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode()
-    {
-      // Protect against reallocation: use builder's buffer.
-      return ByteString.hashCode(buffer, subOffset, subLength);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public int length()
-    {
-      return subLength;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public ByteSequence subSequence(final int start, final int end)
-    {
-      if (start < 0 || start > end || end > subLength)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-
-      return new SubSequence(subOffset + start, end - start);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public byte[] toByteArray()
-    {
-      return copyTo(new byte[subLength]);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public ByteString toByteString()
-    {
-      // Protect against reallocation: use builder's buffer.
-      final byte[] b = new byte[subLength];
-      System.arraycopy(buffer, subOffset, b, 0, subLength);
-      return ByteString.wrap(b);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString()
-    {
-      // Protect against reallocation: use builder's buffer.
-      return ByteString.toString(buffer, subOffset, subLength);
-    }
-  }
-
-
-
-  // These are package private so that compression and crypto
-  // functionality may directly access the fields.
-
-  // The buffer where data is stored.
-  byte[] buffer;
-
-  // The number of bytes to expose from the buffer.
-  int length;
-
-
-
-  /**
-   * Creates a new byte string builder with an initial capacity of 32 bytes.
-   */
-  public ByteStringBuilder()
-  {
-    // Initially create a 32 byte buffer.
-    this(32);
-  }
-
-
-
-  /**
-   * Creates a new byte string builder with the specified initial capacity.
-   *
-   * @param capacity
-   *          The initial capacity.
-   * @throws IllegalArgumentException
-   *           If the {@code capacity} is negative.
-   */
-  public ByteStringBuilder(final int capacity)
-  {
-    if (capacity < 0)
-    {
-      throw new IllegalArgumentException();
-    }
-
-    this.buffer = new byte[capacity];
-    this.length = 0;
-  }
-
-
-
-  /**
-   * Appends the provided byte to this byte string builder.
-   *
-   * @param b
-   *          The byte to be appended to this byte string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final byte b)
-  {
-    ensureAdditionalCapacity(1);
-    buffer[length++] = b;
-    return this;
-  }
-
-
-
-  /**
-   * Appends the provided byte array to this byte string builder.
-   * <p>
-   * An invocation of the form:
-   *
-   * <pre>
-   * src.append(bytes)
-   * </pre>
-   *
-   * Behaves in exactly the same way as the invocation:
-   *
-   * <pre>
-   * src.append(bytes, 0, bytes.length);
-   * </pre>
-   *
-   * @param bytes
-   *          The byte array to be appended to this byte string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final byte[] bytes)
-  {
-    return append(bytes, 0, bytes.length);
-  }
-
-
-
-  /**
-   * Appends the provided byte array to this byte string builder.
-   *
-   * @param bytes
-   *          The byte array to be appended to this byte string builder.
-   * @param offset
-   *          The offset of the byte array to be used; must be non-negative and
-   *          no larger than {@code bytes.length} .
-   * @param length
-   *          The length of the byte array to be used; must be non-negative and
-   *          no larger than {@code bytes.length - offset}.
-   * @return This byte string builder.
-   * @throws IndexOutOfBoundsException
-   *           If {@code offset} is negative or if {@code length} is negative or
-   *           if {@code offset + length} is greater than {@code bytes.length}.
-   */
-  public ByteStringBuilder append(final byte[] bytes, final int offset,
-      final int length)
-  {
-    ByteString.checkArrayBounds(bytes, offset, length);
-
-    if (length != 0)
-    {
-      ensureAdditionalCapacity(length);
-      System.arraycopy(bytes, offset, buffer, this.length, length);
-      this.length += length;
-    }
-
-    return this;
-  }
-
-
-
-  /**
-   * Appends the provided {@code ByteBuffer} to this byte string builder.
-   *
-   * @param buffer
-   *          The byte buffer to be appended to this byte string builder.
-   * @param length
-   *          The number of bytes to be appended from {@code buffer}.
-   * @return This byte string builder.
-   * @throws IndexOutOfBoundsException
-   *           If {@code length} is less than zero or greater than {@code
-   *           buffer.remaining()}.
-   */
-  public ByteStringBuilder append(final ByteBuffer buffer, final int length)
-  {
-    if (length < 0 || length > buffer.remaining())
-    {
-      throw new IndexOutOfBoundsException();
-    }
-
-    if (length != 0)
-    {
-      ensureAdditionalCapacity(length);
-      buffer.get(this.buffer, this.length, length);
-      this.length += length;
-    }
-
-    return this;
-  }
-
-
-
-  /**
-   * Appends the provided {@link ByteSequence} to this byte string builder.
-   *
-   * @param bytes
-   *          The byte sequence to be appended to this byte string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final ByteSequence bytes)
-  {
-    return bytes.copyTo(this);
-  }
-
-
-
-  /**
-   * Appends the provided {@link ByteSequenceReader} to this byte string
-   * builder.
-   *
-   * @param reader
-   *          The byte sequence reader to be appended to this byte string
-   *          builder.
-   * @param length
-   *          The number of bytes to be appended from {@code reader}.
-   * @return This byte string builder.
-   * @throws IndexOutOfBoundsException
-   *           If {@code length} is less than zero or greater than {@code
-   *           reader.remaining()}.
-   */
-  public ByteStringBuilder append(final ByteSequenceReader reader,
-      final int length)
-  {
-    if (length < 0 || length > reader.remaining())
-    {
-      throw new IndexOutOfBoundsException();
-    }
-
-    if (length != 0)
-    {
-      ensureAdditionalCapacity(length);
-      reader.get(buffer, this.length, length);
-      this.length += length;
-    }
-
-    return this;
-  }
-
-
-
-  /**
-   * Appends the UTF-8 encoded bytes of the provided
-   * char array to this byte string
-   * builder.
-   *
-   * @param chars
-   *          The char array whose UTF-8 encoding is to be appended to this byte
-   *          string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final char[] chars)
-  {
-    if (chars == null)
-    {
-      return this;
-    }
-
-    // Assume that each char is 1 byte
-    final int len = chars.length;
-    ensureAdditionalCapacity(len);
-
-    for (int i = 0; i < len; i++)
-    {
-      final char c = chars[i];
-      final byte b = (byte) (c & 0x0000007F);
-
-      if (c == b)
-      {
-        buffer[this.length + i] = b;
-      }
-      else
-      {
-        // There is a multi-byte char. Defer to JDK.
-        final Charset utf8 = Charset.forName("UTF-8");
-        final ByteBuffer byteBuffer = utf8.encode(CharBuffer.wrap(chars));
-        final int remaining = byteBuffer.remaining();
-        ensureAdditionalCapacity(remaining - len);
-        byteBuffer.get(buffer, this.length, remaining);
-        this.length += remaining;
+    public ByteStringBuilder append(final byte b) {
+        ensureAdditionalCapacity(1);
+        buffer[length++] = b;
         return this;
-      }
     }
 
-    // The 1 byte char assumption was correct
-    this.length += len;
-    return this;
-
-  }
-
-
-
-  /**
-   * Appends the provided {@code InputStream} to this byte string builder.
-   *
-   * @param stream
-   *          The input stream to be appended to this byte string builder.
-   * @param length
-   *          The maximum number of bytes to be appended from {@code buffer}.
-   * @return The number of bytes read from the input stream, or {@code -1} if
-   *         the end of the input stream has been reached.
-   * @throws IndexOutOfBoundsException
-   *           If {@code length} is less than zero.
-   * @throws IOException
-   *           If an I/O error occurs.
-   */
-  public int append(final InputStream stream, final int length)
-      throws IOException
-  {
-    if (length < 0)
-    {
-      throw new IndexOutOfBoundsException();
+    /**
+     * Appends the provided byte array to this byte string builder.
+     * <p>
+     * An invocation of the form:
+     *
+     * <pre>
+     * src.append(bytes)
+     * </pre>
+     *
+     * Behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     * src.append(bytes, 0, bytes.length);
+     * </pre>
+     *
+     * @param bytes
+     *            The byte array to be appended to this byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(final byte[] bytes) {
+        return append(bytes, 0, bytes.length);
     }
 
-    ensureAdditionalCapacity(length);
-    final int bytesRead = stream.read(buffer, this.length, length);
-    if (bytesRead > 0)
-    {
-      this.length += bytesRead;
-    }
+    /**
+     * Appends the provided byte array to this byte string builder.
+     *
+     * @param bytes
+     *            The byte array to be appended to this byte string builder.
+     * @param offset
+     *            The offset of the byte array to be used; must be non-negative
+     *            and no larger than {@code bytes.length} .
+     * @param length
+     *            The length of the byte array to be used; must be non-negative
+     *            and no larger than {@code bytes.length - offset}.
+     * @return This byte string builder.
+     * @throws IndexOutOfBoundsException
+     *             If {@code offset} is negative or if {@code length} is
+     *             negative or if {@code offset + length} is greater than
+     *             {@code bytes.length}.
+     */
+    public ByteStringBuilder append(final byte[] bytes, final int offset, final int length) {
+        ByteString.checkArrayBounds(bytes, offset, length);
 
-    return bytesRead;
-  }
-
-
-
-  /**
-   * Appends the big-endian encoded bytes of the provided integer to this byte
-   * string builder.
-   *
-   * @param i
-   *          The integer whose big-endian encoding is to be appended to this
-   *          byte string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(int i)
-  {
-    ensureAdditionalCapacity(4);
-    for (int j = length + 3; j >= length; j--)
-    {
-      buffer[j] = (byte) (i & 0xFF);
-      i >>>= 8;
-    }
-    length += 4;
-    return this;
-  }
-
-
-
-  /**
-   * Appends the big-endian encoded bytes of the provided long to this byte
-   * string builder.
-   *
-   * @param l
-   *          The long whose big-endian encoding is to be appended to this byte
-   *          string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(long l)
-  {
-    ensureAdditionalCapacity(8);
-    for (int i = length + 7; i >= length; i--)
-    {
-      buffer[i] = (byte) (l & 0xFF);
-      l >>>= 8;
-    }
-    length += 8;
-    return this;
-  }
-
-
-
-  /**
-   * Appends the byte string representation of the provided object to this byte
-   * string builder. The object is converted to a byte string as follows:
-   * <ul>
-   * <li>if the object is an instance of {@code ByteSequence} then this method
-   * is equivalent to calling {@link #append(ByteSequence)}
-   * <li>if the object is a {@code byte[]} then this method is equivalent to
-   * calling {@link #append(byte[])}
-   * <li>if the object is a {@code char[]} then this method is equivalent to
-   * calling {@link #append(char[])}
-   * <li>for all other types of object this method is equivalent to calling
-   * {@link #append(String)} with the {@code toString()} representation of the
-   * provided object.
-   * </ul>
-   * <b>Note:</b> this method treats {@code Long} and {@code Integer} objects
-   * like any other type of {@code Object}. More specifically, the following
-   * invocations are not equivalent:
-   * <ul>
-   * <li>{@code append(0)} is not equivalent to {@code append((Object) 0)}
-   * <li>{@code append(0L)} is not equivalent to {@code append((Object) 0L)}
-   * </ul>
-   *
-   * @param o
-   *          The object to be appended to this byte string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final Object o)
-  {
-    if (o == null)
-    {
-      return this;
-    }
-    else if (o instanceof ByteSequence)
-    {
-      return append((ByteSequence) o);
-    }
-    else if (o instanceof byte[])
-    {
-      return append((byte[]) o);
-    }
-    else if (o instanceof char[])
-    {
-      return append((char[]) o);
-    }
-    else
-    {
-      return append(o.toString());
-    }
-  }
-
-
-
-  /**
-   * Appends the big-endian encoded bytes of the provided short to this byte
-   * string builder.
-   *
-   * @param i
-   *          The short whose big-endian encoding is to be appended to this byte
-   *          string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(short i)
-  {
-    ensureAdditionalCapacity(2);
-    for (int j = length + 1; j >= length; j--)
-    {
-      buffer[j] = (byte) (i & 0xFF);
-      i >>>= 8;
-    }
-    length += 2;
-    return this;
-  }
-
-
-
-  /**
-   * Appends the UTF-8 encoded bytes of the provided string to this byte string
-   * builder.
-   *
-   * @param s
-   *          The string whose UTF-8 encoding is to be appended to this byte
-   *          string builder.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder append(final String s)
-  {
-    if (s == null)
-    {
-      return this;
-    }
-
-    // Assume that each char is 1 byte
-    final int len = s.length();
-    ensureAdditionalCapacity(len);
-
-    for (int i = 0; i < len; i++)
-    {
-      final char c = s.charAt(i);
-      final byte b = (byte) (c & 0x0000007F);
-
-      if (c == b)
-      {
-        buffer[this.length + i] = b;
-      }
-      else
-      {
-        // There is a multi-byte char. Defer to JDK
-        try
-        {
-          return append(s.getBytes("UTF-8"));
+        if (length != 0) {
+            ensureAdditionalCapacity(length);
+            System.arraycopy(bytes, offset, buffer, this.length, length);
+            this.length += length;
         }
-        catch (final Exception e)
-        {
-          if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-          {
-            StaticUtils.DEBUG_LOG.warning("Unable to encode String "
-                + "to UTF-8 bytes: " + e.toString());
-          }
 
-          return append(s.getBytes());
+        return this;
+    }
+
+    /**
+     * Appends the provided {@code ByteBuffer} to this byte string builder.
+     *
+     * @param buffer
+     *            The byte buffer to be appended to this byte string builder.
+     * @param length
+     *            The number of bytes to be appended from {@code buffer}.
+     * @return This byte string builder.
+     * @throws IndexOutOfBoundsException
+     *             If {@code length} is less than zero or greater than
+     *             {@code buffer.remaining()}.
+     */
+    public ByteStringBuilder append(final ByteBuffer buffer, final int length) {
+        if (length < 0 || length > buffer.remaining()) {
+            throw new IndexOutOfBoundsException();
         }
-      }
+
+        if (length != 0) {
+            ensureAdditionalCapacity(length);
+            buffer.get(this.buffer, this.length, length);
+            this.length += length;
+        }
+
+        return this;
     }
 
-    // The 1 byte char assumption was correct
-    this.length += len;
-    return this;
-  }
-
-
-
-  /**
-   * Appends the ASN.1 BER length encoding representation of the provided
-   * integer to this byte string builder.
-   *
-   * @param length
-   *          The value to encode using the BER length encoding rules.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder appendBERLength(final int length)
-  {
-    if ((length & 0x0000007F) == length)
-    {
-      ensureAdditionalCapacity(1);
-
-      buffer[this.length++] = (byte) (length & 0xFF);
-    }
-    else if ((length & 0x000000FF) == length)
-    {
-      ensureAdditionalCapacity(2);
-
-      buffer[this.length++] = (byte) 0x81;
-      buffer[this.length++] = (byte) (length & 0xFF);
-    }
-    else if ((length & 0x0000FFFF) == length)
-    {
-      ensureAdditionalCapacity(3);
-
-      buffer[this.length++] = (byte) 0x82;
-      buffer[this.length++] = (byte) (length >> 8 & 0xFF);
-      buffer[this.length++] = (byte) (length & 0xFF);
-    }
-    else if ((length & 0x00FFFFFF) == length)
-    {
-      ensureAdditionalCapacity(4);
-
-      buffer[this.length++] = (byte) 0x83;
-      buffer[this.length++] = (byte) (length >> 16 & 0xFF);
-      buffer[this.length++] = (byte) (length >> 8 & 0xFF);
-      buffer[this.length++] = (byte) (length & 0xFF);
-    }
-    else
-    {
-      ensureAdditionalCapacity(5);
-
-      buffer[this.length++] = (byte) 0x84;
-      buffer[this.length++] = (byte) (length >> 24 & 0xFF);
-      buffer[this.length++] = (byte) (length >> 16 & 0xFF);
-      buffer[this.length++] = (byte) (length >> 8 & 0xFF);
-      buffer[this.length++] = (byte) (length & 0xFF);
-    }
-    return this;
-  }
-
-
-
-  /**
-   * Returns a {@link ByteSequenceReader} which can be used to incrementally
-   * read and decode data from this byte string builder.
-   * <p>
-   * <b>NOTE:</b> all concurrent updates to this byte string builder are
-   * supported with the exception of {@link #clear()}. Any invocations of
-   * {@link #clear()} must be accompanied by a subsequent call to {@code
-   * ByteSequenceReader.rewind()}.
-   *
-   * @return The {@link ByteSequenceReader} which can be used to incrementally
-   *         read and decode data from this byte string builder.
-   * @see #clear()
-   */
-  public ByteSequenceReader asReader()
-  {
-    return new ByteSequenceReader(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte byteAt(final int index)
-  {
-    if (index >= length || index < 0)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-    return buffer[index];
-  }
-
-
-
-  /**
-   * Sets the length of this byte string builder to zero.
-   * <p>
-   * <b>NOTE:</b> if this method is called, then {@code
-   * ByteSequenceReader.rewind()} must also be called on any associated byte
-   * sequence readers in order for them to remain valid.
-   *
-   * @return This byte string builder.
-   * @see #asReader()
-   */
-  public ByteStringBuilder clear()
-  {
-    length = 0;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final byte[] bytes, final int offset, final int length)
-  {
-    ByteString.checkArrayBounds(bytes, offset, length);
-    return ByteString.compareTo(this.buffer, 0, this.length, bytes, offset,
-        length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final ByteSequence o)
-  {
-    if (this == o)
-    {
-      return 0;
-    }
-    return -o.compareTo(buffer, 0, length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] copyTo(final byte[] bytes)
-  {
-    copyTo(bytes, 0);
-    return bytes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] copyTo(final byte[] bytes, final int offset)
-  {
-    if (offset < 0)
-    {
-      throw new IndexOutOfBoundsException();
-    }
-    System.arraycopy(buffer, 0, bytes, offset,
-        Math.min(length, bytes.length - offset));
-    return bytes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteStringBuilder copyTo(final ByteStringBuilder builder)
-  {
-    builder.append(buffer, 0, length);
-    return builder;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public OutputStream copyTo(final OutputStream stream) throws IOException
-  {
-    stream.write(buffer, 0, length);
-    return stream;
-  }
-
-
-
-  /**
-   * Ensures that the specified number of additional bytes will fit in this byte
-   * string builder and resizes it if necessary.
-   *
-   * @param size
-   *          The number of additional bytes.
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder ensureAdditionalCapacity(final int size)
-  {
-    final int newCount = this.length + size;
-    if (newCount > buffer.length)
-    {
-      final byte[] newbuffer = new byte[Math.max(buffer.length << 1, newCount)];
-      System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
-      buffer = newbuffer;
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean equals(final byte[] bytes, final int offset, final int length)
-  {
-    ByteString.checkArrayBounds(bytes, offset, length);
-    return ByteString
-        .equals(this.buffer, 0, this.length, bytes, offset, length);
-  }
-
-
-
-  /**
-   * Indicates whether the provided object is equal to this byte string builder.
-   * In order for it to be considered equal, the provided object must be a byte
-   * sequence containing the same bytes in the same order.
-   *
-   * @param o
-   *          The object for which to make the determination.
-   * @return {@code true} if the provided object is a byte sequence whose
-   *         content is equal to that of this byte string builder, or {@code
-   *         false} if not.
-   */
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (this == o)
-    {
-      return true;
-    }
-    else if (o instanceof ByteSequence)
-    {
-      final ByteSequence other = (ByteSequence) o;
-      return other.equals(buffer, 0, length);
-    }
-    else
-    {
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Returns the byte array that backs this byte string builder. Modifications
-   * to this byte string builder's content may cause the returned array's
-   * content to be modified, and vice versa.
-   * <p>
-   * Note that the length of the returned array is only guaranteed to be the
-   * same as the length of this byte string builder immediately after a call to
-   * {@link #trimToSize()}.
-   * <p>
-   * In addition, subsequent modifications to this byte string builder may cause
-   * the backing byte array to be reallocated thus decoupling the returned byte
-   * array from this byte string builder.
-   *
-   * @return The byte array that backs this byte string builder.
-   */
-  public byte[] getBackingArray()
-  {
-    return buffer;
-  }
-
-
-
-  /**
-   * Returns a hash code for this byte string builder. It will be the sum of all
-   * of the bytes contained in the byte string builder.
-   * <p>
-   * <b>NOTE:</b> subsequent changes to this byte string builder will invalidate
-   * the returned hash code.
-   *
-   * @return A hash code for this byte string builder.
-   */
-  @Override
-  public int hashCode()
-  {
-    return ByteString.hashCode(buffer, 0, length);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int length()
-  {
-    return length;
-  }
-
-
-
-  /**
-   * Sets the length of this byte string builder.
-   * <p>
-   * If the <code>newLength</code> argument is less than the current length, the
-   * length is changed to the specified length.
-   * <p>
-   * If the <code>newLength</code> argument is greater than or equal to the
-   * current length, then the capacity is increased and sufficient null bytes
-   * are appended so that length becomes the <code>newLength</code> argument.
-   * <p>
-   * The <code>newLength</code> argument must be greater than or equal to
-   * <code>0</code>.
-   *
-   * @param newLength
-   *          The new length.
-   * @return This byte string builder.
-   * @throws IndexOutOfBoundsException
-   *           If the <code>newLength</code> argument is negative.
-   */
-  public ByteStringBuilder setLength(final int newLength)
-  {
-    if (newLength < 0)
-    {
-      throw new IndexOutOfBoundsException("Negative newLength: " + newLength);
+    /**
+     * Appends the provided {@link ByteSequence} to this byte string builder.
+     *
+     * @param bytes
+     *            The byte sequence to be appended to this byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(final ByteSequence bytes) {
+        return bytes.copyTo(this);
     }
 
-    if (newLength > length)
-    {
-      ensureAdditionalCapacity(newLength - length);
+    /**
+     * Appends the provided {@link ByteSequenceReader} to this byte string
+     * builder.
+     *
+     * @param reader
+     *            The byte sequence reader to be appended to this byte string
+     *            builder.
+     * @param length
+     *            The number of bytes to be appended from {@code reader}.
+     * @return This byte string builder.
+     * @throws IndexOutOfBoundsException
+     *             If {@code length} is less than zero or greater than
+     *             {@code reader.remaining()}.
+     */
+    public ByteStringBuilder append(final ByteSequenceReader reader, final int length) {
+        if (length < 0 || length > reader.remaining()) {
+            throw new IndexOutOfBoundsException();
+        }
 
-      // Pad with zeros.
-      for (int i = length; i < newLength; i++)
-      {
-        buffer[i] = 0;
-      }
-    }
-    length = newLength;
+        if (length != 0) {
+            ensureAdditionalCapacity(length);
+            reader.get(buffer, this.length, length);
+            this.length += length;
+        }
 
-    return this;
-  }
-
-
-
-  /**
-   * Returns a new byte sequence that is a subsequence of this byte sequence.
-   * <p>
-   * The subsequence starts with the byte value at the specified {@code start}
-   * index and ends with the byte value at index {@code end - 1}. The length (in
-   * bytes) of the returned sequence is {@code end - start}, so if {@code start
-   * == end} then an empty sequence is returned.
-   * <p>
-   * <b>NOTE:</b> the returned sub-sequence will be robust against all updates
-   * to the byte string builder except for invocations of the method
-   * {@link #clear()}. If a permanent immutable byte sequence is required then
-   * callers should invoke {@code toByteString()} on the returned byte sequence.
-   *
-   * @param start
-   *          The start index, inclusive.
-   * @param end
-   *          The end index, exclusive.
-   * @return The newly created byte subsequence.
-   */
-  public ByteSequence subSequence(final int start, final int end)
-  {
-    if (start < 0 || start > end || end > length)
-    {
-      throw new IndexOutOfBoundsException();
+        return this;
     }
 
-    return new SubSequence(start, end - start);
-  }
+    /**
+     * Appends the UTF-8 encoded bytes of the provided char array to this byte
+     * string builder.
+     *
+     * @param chars
+     *            The char array whose UTF-8 encoding is to be appended to this
+     *            byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(final char[] chars) {
+        if (chars == null) {
+            return this;
+        }
 
+        // Assume that each char is 1 byte
+        final int len = chars.length;
+        ensureAdditionalCapacity(len);
 
+        for (int i = 0; i < len; i++) {
+            final char c = chars[i];
+            final byte b = (byte) (c & 0x0000007F);
 
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] toByteArray()
-  {
-    return copyTo(new byte[length]);
-  }
+            if (c == b) {
+                buffer[this.length + i] = b;
+            } else {
+                // There is a multi-byte char. Defer to JDK.
+                final Charset utf8 = Charset.forName("UTF-8");
+                final ByteBuffer byteBuffer = utf8.encode(CharBuffer.wrap(chars));
+                final int remaining = byteBuffer.remaining();
+                ensureAdditionalCapacity(remaining - len);
+                byteBuffer.get(buffer, this.length, remaining);
+                this.length += remaining;
+                return this;
+            }
+        }
 
+        // The 1 byte char assumption was correct
+        this.length += len;
+        return this;
 
-
-  /**
-   * Returns the {@link ByteString} representation of this byte string builder.
-   * Subsequent changes to this byte string builder will not modify the returned
-   * {@link ByteString}.
-   *
-   * @return The {@link ByteString} representation of this byte sequence.
-   */
-  public ByteString toByteString()
-  {
-    final byte[] b = new byte[length];
-    System.arraycopy(buffer, 0, b, 0, length);
-    return ByteString.wrap(b);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return ByteString.toString(buffer, 0, length);
-  }
-
-
-
-  /**
-   * Attempts to reduce storage used for this byte string builder. If the buffer
-   * is larger than necessary to hold its current sequence of bytes, then it may
-   * be resized to become more space efficient.
-   *
-   * @return This byte string builder.
-   */
-  public ByteStringBuilder trimToSize()
-  {
-    if (buffer.length > length)
-    {
-      final byte[] newBuffer = new byte[length];
-      System.arraycopy(buffer, 0, newBuffer, 0, length);
-      buffer = newBuffer;
     }
-    return this;
-  }
+
+    /**
+     * Appends the provided {@code InputStream} to this byte string builder.
+     *
+     * @param stream
+     *            The input stream to be appended to this byte string builder.
+     * @param length
+     *            The maximum number of bytes to be appended from {@code buffer}
+     *            .
+     * @return The number of bytes read from the input stream, or {@code -1} if
+     *         the end of the input stream has been reached.
+     * @throws IndexOutOfBoundsException
+     *             If {@code length} is less than zero.
+     * @throws IOException
+     *             If an I/O error occurs.
+     */
+    public int append(final InputStream stream, final int length) throws IOException {
+        if (length < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        ensureAdditionalCapacity(length);
+        final int bytesRead = stream.read(buffer, this.length, length);
+        if (bytesRead > 0) {
+            this.length += bytesRead;
+        }
+
+        return bytesRead;
+    }
+
+    /**
+     * Appends the big-endian encoded bytes of the provided integer to this byte
+     * string builder.
+     *
+     * @param i
+     *            The integer whose big-endian encoding is to be appended to
+     *            this byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(int i) {
+        ensureAdditionalCapacity(4);
+        for (int j = length + 3; j >= length; j--) {
+            buffer[j] = (byte) (i & 0xFF);
+            i >>>= 8;
+        }
+        length += 4;
+        return this;
+    }
+
+    /**
+     * Appends the big-endian encoded bytes of the provided long to this byte
+     * string builder.
+     *
+     * @param l
+     *            The long whose big-endian encoding is to be appended to this
+     *            byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(long l) {
+        ensureAdditionalCapacity(8);
+        for (int i = length + 7; i >= length; i--) {
+            buffer[i] = (byte) (l & 0xFF);
+            l >>>= 8;
+        }
+        length += 8;
+        return this;
+    }
+
+    /**
+     * Appends the byte string representation of the provided object to this
+     * byte string builder. The object is converted to a byte string as follows:
+     * <ul>
+     * <li>if the object is an instance of {@code ByteSequence} then this method
+     * is equivalent to calling {@link #append(ByteSequence)}
+     * <li>if the object is a {@code byte[]} then this method is equivalent to
+     * calling {@link #append(byte[])}
+     * <li>if the object is a {@code char[]} then this method is equivalent to
+     * calling {@link #append(char[])}
+     * <li>for all other types of object this method is equivalent to calling
+     * {@link #append(String)} with the {@code toString()} representation of the
+     * provided object.
+     * </ul>
+     * <b>Note:</b> this method treats {@code Long} and {@code Integer} objects
+     * like any other type of {@code Object}. More specifically, the following
+     * invocations are not equivalent:
+     * <ul>
+     * <li>{@code append(0)} is not equivalent to {@code append((Object) 0)}
+     * <li>{@code append(0L)} is not equivalent to {@code append((Object) 0L)}
+     * </ul>
+     *
+     * @param o
+     *            The object to be appended to this byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(final Object o) {
+        if (o == null) {
+            return this;
+        } else if (o instanceof ByteSequence) {
+            return append((ByteSequence) o);
+        } else if (o instanceof byte[]) {
+            return append((byte[]) o);
+        } else if (o instanceof char[]) {
+            return append((char[]) o);
+        } else {
+            return append(o.toString());
+        }
+    }
+
+    /**
+     * Appends the big-endian encoded bytes of the provided short to this byte
+     * string builder.
+     *
+     * @param i
+     *            The short whose big-endian encoding is to be appended to this
+     *            byte string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(short i) {
+        ensureAdditionalCapacity(2);
+        for (int j = length + 1; j >= length; j--) {
+            buffer[j] = (byte) (i & 0xFF);
+            i >>>= 8;
+        }
+        length += 2;
+        return this;
+    }
+
+    /**
+     * Appends the UTF-8 encoded bytes of the provided string to this byte
+     * string builder.
+     *
+     * @param s
+     *            The string whose UTF-8 encoding is to be appended to this byte
+     *            string builder.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder append(final String s) {
+        if (s == null) {
+            return this;
+        }
+
+        // Assume that each char is 1 byte
+        final int len = s.length();
+        ensureAdditionalCapacity(len);
+
+        for (int i = 0; i < len; i++) {
+            final char c = s.charAt(i);
+            final byte b = (byte) (c & 0x0000007F);
+
+            if (c == b) {
+                buffer[this.length + i] = b;
+            } else {
+                // There is a multi-byte char. Defer to JDK
+                try {
+                    return append(s.getBytes("UTF-8"));
+                } catch (final Exception e) {
+                    if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                        StaticUtils.DEBUG_LOG.warning("Unable to encode String "
+                                + "to UTF-8 bytes: " + e.toString());
+                    }
+
+                    return append(s.getBytes());
+                }
+            }
+        }
+
+        // The 1 byte char assumption was correct
+        this.length += len;
+        return this;
+    }
+
+    /**
+     * Appends the ASN.1 BER length encoding representation of the provided
+     * integer to this byte string builder.
+     *
+     * @param length
+     *            The value to encode using the BER length encoding rules.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder appendBERLength(final int length) {
+        if ((length & 0x0000007F) == length) {
+            ensureAdditionalCapacity(1);
+
+            buffer[this.length++] = (byte) (length & 0xFF);
+        } else if ((length & 0x000000FF) == length) {
+            ensureAdditionalCapacity(2);
+
+            buffer[this.length++] = (byte) 0x81;
+            buffer[this.length++] = (byte) (length & 0xFF);
+        } else if ((length & 0x0000FFFF) == length) {
+            ensureAdditionalCapacity(3);
+
+            buffer[this.length++] = (byte) 0x82;
+            buffer[this.length++] = (byte) (length >> 8 & 0xFF);
+            buffer[this.length++] = (byte) (length & 0xFF);
+        } else if ((length & 0x00FFFFFF) == length) {
+            ensureAdditionalCapacity(4);
+
+            buffer[this.length++] = (byte) 0x83;
+            buffer[this.length++] = (byte) (length >> 16 & 0xFF);
+            buffer[this.length++] = (byte) (length >> 8 & 0xFF);
+            buffer[this.length++] = (byte) (length & 0xFF);
+        } else {
+            ensureAdditionalCapacity(5);
+
+            buffer[this.length++] = (byte) 0x84;
+            buffer[this.length++] = (byte) (length >> 24 & 0xFF);
+            buffer[this.length++] = (byte) (length >> 16 & 0xFF);
+            buffer[this.length++] = (byte) (length >> 8 & 0xFF);
+            buffer[this.length++] = (byte) (length & 0xFF);
+        }
+        return this;
+    }
+
+    /**
+     * Returns a {@link ByteSequenceReader} which can be used to incrementally
+     * read and decode data from this byte string builder.
+     * <p>
+     * <b>NOTE:</b> all concurrent updates to this byte string builder are
+     * supported with the exception of {@link #clear()}. Any invocations of
+     * {@link #clear()} must be accompanied by a subsequent call to
+     * {@code ByteSequenceReader.rewind()}.
+     *
+     * @return The {@link ByteSequenceReader} which can be used to incrementally
+     *         read and decode data from this byte string builder.
+     * @see #clear()
+     */
+    public ByteSequenceReader asReader() {
+        return new ByteSequenceReader(this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte byteAt(final int index) {
+        if (index >= length || index < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+        return buffer[index];
+    }
+
+    /**
+     * Sets the length of this byte string builder to zero.
+     * <p>
+     * <b>NOTE:</b> if this method is called, then
+     * {@code ByteSequenceReader.rewind()} must also be called on any associated
+     * byte sequence readers in order for them to remain valid.
+     *
+     * @return This byte string builder.
+     * @see #asReader()
+     */
+    public ByteStringBuilder clear() {
+        length = 0;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final byte[] bytes, final int offset, final int length) {
+        ByteString.checkArrayBounds(bytes, offset, length);
+        return ByteString.compareTo(this.buffer, 0, this.length, bytes, offset, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final ByteSequence o) {
+        if (this == o) {
+            return 0;
+        }
+        return -o.compareTo(buffer, 0, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] copyTo(final byte[] bytes) {
+        copyTo(bytes, 0);
+        return bytes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] copyTo(final byte[] bytes, final int offset) {
+        if (offset < 0) {
+            throw new IndexOutOfBoundsException();
+        }
+        System.arraycopy(buffer, 0, bytes, offset, Math.min(length, bytes.length - offset));
+        return bytes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteStringBuilder copyTo(final ByteStringBuilder builder) {
+        builder.append(buffer, 0, length);
+        return builder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public OutputStream copyTo(final OutputStream stream) throws IOException {
+        stream.write(buffer, 0, length);
+        return stream;
+    }
+
+    /**
+     * Ensures that the specified number of additional bytes will fit in this
+     * byte string builder and resizes it if necessary.
+     *
+     * @param size
+     *            The number of additional bytes.
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder ensureAdditionalCapacity(final int size) {
+        final int newCount = this.length + size;
+        if (newCount > buffer.length) {
+            final byte[] newbuffer = new byte[Math.max(buffer.length << 1, newCount)];
+            System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
+            buffer = newbuffer;
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(final byte[] bytes, final int offset, final int length) {
+        ByteString.checkArrayBounds(bytes, offset, length);
+        return ByteString.equals(this.buffer, 0, this.length, bytes, offset, length);
+    }
+
+    /**
+     * Indicates whether the provided object is equal to this byte string
+     * builder. In order for it to be considered equal, the provided object must
+     * be a byte sequence containing the same bytes in the same order.
+     *
+     * @param o
+     *            The object for which to make the determination.
+     * @return {@code true} if the provided object is a byte sequence whose
+     *         content is equal to that of this byte string builder, or
+     *         {@code false} if not.
+     */
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        } else if (o instanceof ByteSequence) {
+            final ByteSequence other = (ByteSequence) o;
+            return other.equals(buffer, 0, length);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns the byte array that backs this byte string builder. Modifications
+     * to this byte string builder's content may cause the returned array's
+     * content to be modified, and vice versa.
+     * <p>
+     * Note that the length of the returned array is only guaranteed to be the
+     * same as the length of this byte string builder immediately after a call
+     * to {@link #trimToSize()}.
+     * <p>
+     * In addition, subsequent modifications to this byte string builder may
+     * cause the backing byte array to be reallocated thus decoupling the
+     * returned byte array from this byte string builder.
+     *
+     * @return The byte array that backs this byte string builder.
+     */
+    public byte[] getBackingArray() {
+        return buffer;
+    }
+
+    /**
+     * Returns a hash code for this byte string builder. It will be the sum of
+     * all of the bytes contained in the byte string builder.
+     * <p>
+     * <b>NOTE:</b> subsequent changes to this byte string builder will
+     * invalidate the returned hash code.
+     *
+     * @return A hash code for this byte string builder.
+     */
+    @Override
+    public int hashCode() {
+        return ByteString.hashCode(buffer, 0, length);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int length() {
+        return length;
+    }
+
+    /**
+     * Sets the length of this byte string builder.
+     * <p>
+     * If the <code>newLength</code> argument is less than the current length,
+     * the length is changed to the specified length.
+     * <p>
+     * If the <code>newLength</code> argument is greater than or equal to the
+     * current length, then the capacity is increased and sufficient null bytes
+     * are appended so that length becomes the <code>newLength</code> argument.
+     * <p>
+     * The <code>newLength</code> argument must be greater than or equal to
+     * <code>0</code>.
+     *
+     * @param newLength
+     *            The new length.
+     * @return This byte string builder.
+     * @throws IndexOutOfBoundsException
+     *             If the <code>newLength</code> argument is negative.
+     */
+    public ByteStringBuilder setLength(final int newLength) {
+        if (newLength < 0) {
+            throw new IndexOutOfBoundsException("Negative newLength: " + newLength);
+        }
+
+        if (newLength > length) {
+            ensureAdditionalCapacity(newLength - length);
+
+            // Pad with zeros.
+            for (int i = length; i < newLength; i++) {
+                buffer[i] = 0;
+            }
+        }
+        length = newLength;
+
+        return this;
+    }
+
+    /**
+     * Returns a new byte sequence that is a subsequence of this byte sequence.
+     * <p>
+     * The subsequence starts with the byte value at the specified {@code start}
+     * index and ends with the byte value at index {@code end - 1}. The length
+     * (in bytes) of the returned sequence is {@code end - start}, so if
+     * {@code start
+     * == end} then an empty sequence is returned.
+     * <p>
+     * <b>NOTE:</b> the returned sub-sequence will be robust against all updates
+     * to the byte string builder except for invocations of the method
+     * {@link #clear()}. If a permanent immutable byte sequence is required then
+     * callers should invoke {@code toByteString()} on the returned byte
+     * sequence.
+     *
+     * @param start
+     *            The start index, inclusive.
+     * @param end
+     *            The end index, exclusive.
+     * @return The newly created byte subsequence.
+     */
+    public ByteSequence subSequence(final int start, final int end) {
+        if (start < 0 || start > end || end > length) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        return new SubSequence(start, end - start);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] toByteArray() {
+        return copyTo(new byte[length]);
+    }
+
+    /**
+     * Returns the {@link ByteString} representation of this byte string
+     * builder. Subsequent changes to this byte string builder will not modify
+     * the returned {@link ByteString}.
+     *
+     * @return The {@link ByteString} representation of this byte sequence.
+     */
+    public ByteString toByteString() {
+        final byte[] b = new byte[length];
+        System.arraycopy(buffer, 0, b, 0, length);
+        return ByteString.wrap(b);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return ByteString.toString(buffer, 0, length);
+    }
+
+    /**
+     * Attempts to reduce storage used for this byte string builder. If the
+     * buffer is larger than necessary to hold its current sequence of bytes,
+     * then it may be resized to become more space efficient.
+     *
+     * @return This byte string builder.
+     */
+    public ByteStringBuilder trimToSize() {
+        if (buffer.length > length) {
+            final byte[] newBuffer = new byte[length];
+            System.arraycopy(buffer, 0, newBuffer, 0, length);
+            buffer = newBuffer;
+        }
+        return this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java
index ae3e154..ac20606 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.EventListener;
 
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * An object that registers to be notified when a cancellation request has been
  * received and processing of the request should be aborted if possible.
@@ -43,22 +38,21 @@
  * extended request sent from the client, or by the server itself (e.g. during
  * server shutdown).
  */
-public interface CancelRequestListener extends EventListener
-{
-  /**
-   * Invoked when a cancellation request has been received and processing of the
-   * request should be aborted if possible.
-   * <p>
-   * Requests may be cancelled as a result of an abandon request or a cancel
-   * extended request sent from the client, or by the server itself (e.g. during
-   * server shutdown).
-   * <p>
-   * Implementations should, if possible, abort further processing of the
-   * request and return an appropriate cancellation result.
-   *
-   * @param cancellationReason
-   *          A message describing the reason why the request is being
-   *          cancelled.
-   */
-  void handleCancelRequest(LocalizableMessage cancellationReason);
+public interface CancelRequestListener extends EventListener {
+    /**
+     * Invoked when a cancellation request has been received and processing of
+     * the request should be aborted if possible.
+     * <p>
+     * Requests may be cancelled as a result of an abandon request or a cancel
+     * extended request sent from the client, or by the server itself (e.g.
+     * during server shutdown).
+     * <p>
+     * Implementations should, if possible, abort further processing of the
+     * request and return an appropriate cancellation result.
+     *
+     * @param cancellationReason
+     *            A message describing the reason why the request is being
+     *            cancelled.
+     */
+    void handleCancelRequest(LocalizableMessage cancellationReason);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java
index d43d719..80422e1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * was cancelled. More specifically, this exception is used for the following
@@ -45,10 +40,8 @@
  * </ul>
  */
 @SuppressWarnings("serial")
-public class CancelledResultException extends ErrorResultException
-{
-  CancelledResultException(final Result result)
-  {
-    super(result);
-  }
+public class CancelledResultException extends ErrorResultException {
+    CancelledResultException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java
index 0ee305a..42c4373 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * The result of a tri-state logical expression. Condition results are used to
  * represent the result of a conditional evaluation that can yield three
@@ -36,263 +33,213 @@
  * {@code UNDEFINED} (i.e. "maybe"). A result of {@code UNDEFINED} indicates
  * that further investigation may be required.
  */
-public enum ConditionResult
-{
-  /**
-   * Indicates that the condition evaluated to {@code false}.
-   */
-  FALSE("false"),
+public enum ConditionResult {
+    /**
+     * Indicates that the condition evaluated to {@code false}.
+     */
+    FALSE("false"),
 
-  /**
-   * Indicates that the condition could not be evaluated and its result is
-   * undefined.
-   */
-  UNDEFINED("undefined"),
+    /**
+     * Indicates that the condition could not be evaluated and its result is
+     * undefined.
+     */
+    UNDEFINED("undefined"),
 
-  /**
-   * Indicates that the condition evaluated to {@code true}.
-   */
-  TRUE("true");
+    /**
+     * Indicates that the condition evaluated to {@code true}.
+     */
+    TRUE("true");
 
-  // Boolean -> ConditionResult map.
-  private static final boolean[] BOOLEAN_MAP = { false, false, true };
+    // Boolean -> ConditionResult map.
+    private static final boolean[] BOOLEAN_MAP = { false, false, true };
 
-  // AND truth table.
-  private static final ConditionResult[][] LOGICAL_AND = {
-      { FALSE, FALSE, FALSE }, { FALSE, UNDEFINED, UNDEFINED },
-      { FALSE, UNDEFINED, TRUE }, };
+    // AND truth table.
+    private static final ConditionResult[][] LOGICAL_AND = { { FALSE, FALSE, FALSE },
+        { FALSE, UNDEFINED, UNDEFINED }, { FALSE, UNDEFINED, TRUE }, };
 
-  // NOT truth table.
-  private static final ConditionResult[] LOGICAL_NOT = { TRUE, UNDEFINED, FALSE };
+    // NOT truth table.
+    private static final ConditionResult[] LOGICAL_NOT = { TRUE, UNDEFINED, FALSE };
 
-  // OR truth table.
-  private static final ConditionResult[][] LOGICAL_OR = {
-      { FALSE, UNDEFINED, TRUE }, { UNDEFINED, UNDEFINED, TRUE },
-      { TRUE, TRUE, TRUE }, };
+    // OR truth table.
+    private static final ConditionResult[][] LOGICAL_OR = { { FALSE, UNDEFINED, TRUE },
+        { UNDEFINED, UNDEFINED, TRUE }, { TRUE, TRUE, TRUE }, };
 
-
-
-  /**
-   * Returns the logical AND of zero condition results, which is always {@code
-   * TRUE}.
-   *
-   * @return The logical OR of zero condition results, which is always {@code
-   *         TRUE}.
-   */
-  public static ConditionResult and()
-  {
-    return TRUE;
-  }
-
-
-
-  /**
-   * Returns the logical AND of the provided condition result, which is always
-   * {@code r}.
-   *
-   * @param r
-   *          The condition result.
-   * @return The logical AND of the provided condition result, which is always
-   *         {@code r}.
-   */
-  public static ConditionResult and(final ConditionResult r)
-  {
-    return r;
-  }
-
-
-
-  /**
-   * Returns the logical AND of the provided condition results, which is {@code
-   * TRUE} if all of the provided condition results are {@code TRUE}, {@code
-   * FALSE} if at least one of them is {@code FALSE}, and {@code UNDEFINED}
-   * otherwise. Note that {@code TRUE} is returned if the provided list of
-   * results is empty.
-   *
-   * @param results
-   *          The condition results to be compared.
-   * @return The logical AND of the provided condition results.
-   */
-  public static ConditionResult and(final ConditionResult... results)
-  {
-    ConditionResult finalResult = TRUE;
-    for (final ConditionResult result : results)
-    {
-      finalResult = and(finalResult, result);
-      if (finalResult == FALSE)
-      {
-        break;
-      }
+    /**
+     * Returns the logical AND of zero condition results, which is always
+     * {@code TRUE}.
+     *
+     * @return The logical OR of zero condition results, which is always
+     *         {@code TRUE}.
+     */
+    public static ConditionResult and() {
+        return TRUE;
     }
-    return finalResult;
-  }
 
-
-
-  /**
-   * Returns the logical AND of the provided condition results, which is {@code
-   * TRUE} if both of the provided condition results are {@code TRUE}, {@code
-   * FALSE} if at least one of them is {@code FALSE} , and {@code UNDEFINED}
-   * otherwise.
-   *
-   * @param r1
-   *          The first condition result to be compared.
-   * @param r2
-   *          The second condition result to be compared.
-   * @return The logical AND of the provided condition results.
-   */
-  public static ConditionResult and(final ConditionResult r1,
-      final ConditionResult r2)
-  {
-    return LOGICAL_AND[r1.ordinal()][r2.ordinal()];
-  }
-
-
-
-  /**
-   * Returns the logical NOT of the provided condition result, which is {@code
-   * TRUE} if the provided condition result is {@code FALSE}, {@code TRUE} if it
-   * is {@code FALSE}, and {@code UNDEFINED} otherwise.
-   *
-   * @param r
-   *          The condition result to invert.
-   * @return The logical NOT of the provided condition result.
-   */
-  public static ConditionResult not(final ConditionResult r)
-  {
-    return LOGICAL_NOT[r.ordinal()];
-  }
-
-
-
-  /**
-   * Returns the logical OR of zero condition results, which is always {@code
-   * FALSE}.
-   *
-   * @return The logical OR of zero condition results, which is always {@code
-   *         FALSE}.
-   */
-  public static ConditionResult or()
-  {
-    return FALSE;
-  }
-
-
-
-  /**
-   * Returns the logical OR of the provided condition result, which is always
-   * {@code r}.
-   *
-   * @param r
-   *          The condition result.
-   * @return The logical OR of the provided condition result, which is always
-   *         {@code r}.
-   */
-  public static ConditionResult or(final ConditionResult r)
-  {
-    return r;
-  }
-
-
-
-  /**
-   * Returns the logical OR of the provided condition results, which is {@code
-   * FALSE} if all of the provided condition results are {@code FALSE}, {@code
-   * TRUE} if at least one of them is {@code TRUE}, and {@code UNDEFINED}
-   * otherwise. Note that {@code FALSE} is returned if the provided list of
-   * results is empty.
-   *
-   * @param results
-   *          The condition results to be compared.
-   * @return The logical OR of the provided condition results.
-   */
-  public static ConditionResult or(final ConditionResult... results)
-  {
-    ConditionResult finalResult = FALSE;
-    for (final ConditionResult result : results)
-    {
-      finalResult = and(finalResult, result);
-      if (finalResult == TRUE)
-      {
-        break;
-      }
+    /**
+     * Returns the logical AND of the provided condition result, which is always
+     * {@code r}.
+     *
+     * @param r
+     *            The condition result.
+     * @return The logical AND of the provided condition result, which is always
+     *         {@code r}.
+     */
+    public static ConditionResult and(final ConditionResult r) {
+        return r;
     }
-    return finalResult;
-  }
 
+    /**
+     * Returns the logical AND of the provided condition results, which is
+     * {@code TRUE} if all of the provided condition results are {@code TRUE},
+     * {@code FALSE} if at least one of them is {@code FALSE}, and
+     * {@code UNDEFINED} otherwise. Note that {@code TRUE} is returned if the
+     * provided list of results is empty.
+     *
+     * @param results
+     *            The condition results to be compared.
+     * @return The logical AND of the provided condition results.
+     */
+    public static ConditionResult and(final ConditionResult... results) {
+        ConditionResult finalResult = TRUE;
+        for (final ConditionResult result : results) {
+            finalResult = and(finalResult, result);
+            if (finalResult == FALSE) {
+                break;
+            }
+        }
+        return finalResult;
+    }
 
+    /**
+     * Returns the logical AND of the provided condition results, which is
+     * {@code TRUE} if both of the provided condition results are {@code TRUE},
+     * {@code FALSE} if at least one of them is {@code FALSE} , and
+     * {@code UNDEFINED} otherwise.
+     *
+     * @param r1
+     *            The first condition result to be compared.
+     * @param r2
+     *            The second condition result to be compared.
+     * @return The logical AND of the provided condition results.
+     */
+    public static ConditionResult and(final ConditionResult r1, final ConditionResult r2) {
+        return LOGICAL_AND[r1.ordinal()][r2.ordinal()];
+    }
 
-  /**
-   * Returns the logical OR of the provided condition results, which is {@code
-   * FALSE} if both of the provided condition results are {@code FALSE}, {@code
-   * TRUE} if at least one of them is {@code TRUE} , and {@code UNDEFINED}
-   * otherwise.
-   *
-   * @param r1
-   *          The first condition result to be compared.
-   * @param r2
-   *          The second condition result to be compared.
-   * @return The logical OR of the provided condition results.
-   */
-  public static ConditionResult or(final ConditionResult r1,
-      final ConditionResult r2)
-  {
-    return LOGICAL_OR[r1.ordinal()][r2.ordinal()];
-  }
+    /**
+     * Returns the logical NOT of the provided condition result, which is
+     * {@code TRUE} if the provided condition result is {@code FALSE},
+     * {@code TRUE} if it is {@code FALSE}, and {@code UNDEFINED} otherwise.
+     *
+     * @param r
+     *            The condition result to invert.
+     * @return The logical NOT of the provided condition result.
+     */
+    public static ConditionResult not(final ConditionResult r) {
+        return LOGICAL_NOT[r.ordinal()];
+    }
 
+    /**
+     * Returns the logical OR of zero condition results, which is always
+     * {@code FALSE}.
+     *
+     * @return The logical OR of zero condition results, which is always
+     *         {@code FALSE}.
+     */
+    public static ConditionResult or() {
+        return FALSE;
+    }
 
+    /**
+     * Returns the logical OR of the provided condition result, which is always
+     * {@code r}.
+     *
+     * @param r
+     *            The condition result.
+     * @return The logical OR of the provided condition result, which is always
+     *         {@code r}.
+     */
+    public static ConditionResult or(final ConditionResult r) {
+        return r;
+    }
 
-  /**
-   * Returns the condition result which is equivalent to the provided boolean
-   * value.
-   *
-   * @param b
-   *          The boolean value.
-   * @return {@code TRUE} if {@code b} was {@code true}, otherwise {@code FALSE}
-   *         .
-   */
-  public static ConditionResult valueOf(final boolean b)
-  {
-    return b ? TRUE : FALSE;
-  }
+    /**
+     * Returns the logical OR of the provided condition results, which is
+     * {@code FALSE} if all of the provided condition results are {@code FALSE},
+     * {@code TRUE} if at least one of them is {@code TRUE}, and
+     * {@code UNDEFINED} otherwise. Note that {@code FALSE} is returned if the
+     * provided list of results is empty.
+     *
+     * @param results
+     *            The condition results to be compared.
+     * @return The logical OR of the provided condition results.
+     */
+    public static ConditionResult or(final ConditionResult... results) {
+        ConditionResult finalResult = FALSE;
+        for (final ConditionResult result : results) {
+            finalResult = and(finalResult, result);
+            if (finalResult == TRUE) {
+                break;
+            }
+        }
+        return finalResult;
+    }
 
+    /**
+     * Returns the logical OR of the provided condition results, which is
+     * {@code FALSE} if both of the provided condition results are {@code FALSE}
+     * , {@code TRUE} if at least one of them is {@code TRUE} , and
+     * {@code UNDEFINED} otherwise.
+     *
+     * @param r1
+     *            The first condition result to be compared.
+     * @param r2
+     *            The second condition result to be compared.
+     * @return The logical OR of the provided condition results.
+     */
+    public static ConditionResult or(final ConditionResult r1, final ConditionResult r2) {
+        return LOGICAL_OR[r1.ordinal()][r2.ordinal()];
+    }
 
+    /**
+     * Returns the condition result which is equivalent to the provided boolean
+     * value.
+     *
+     * @param b
+     *            The boolean value.
+     * @return {@code TRUE} if {@code b} was {@code true}, otherwise
+     *         {@code FALSE} .
+     */
+    public static ConditionResult valueOf(final boolean b) {
+        return b ? TRUE : FALSE;
+    }
 
-  // The human-readable name for this result.
-  private final String resultName;
+    // The human-readable name for this result.
+    private final String resultName;
 
+    // Prevent instantiation.
+    private ConditionResult(final String resultName) {
+        this.resultName = resultName;
+    }
 
+    /**
+     * Converts this condition result to a boolean value. {@code FALSE} and
+     * {@code UNDEFINED} are both converted to {@code false}, and {@code TRUE}
+     * is converted to {@code true}.
+     *
+     * @return The boolean equivalent of this condition result.
+     */
+    public boolean toBoolean() {
+        return BOOLEAN_MAP[ordinal()];
+    }
 
-  // Prevent instantiation.
-  private ConditionResult(final String resultName)
-  {
-    this.resultName = resultName;
-  }
-
-
-
-  /**
-   * Converts this condition result to a boolean value. {@code FALSE} and
-   * {@code UNDEFINED} are both converted to {@code false}, and {@code TRUE} is
-   * converted to {@code true}.
-   *
-   * @return The boolean equivalent of this condition result.
-   */
-  public boolean toBoolean()
-  {
-    return BOOLEAN_MAP[ordinal()];
-  }
-
-
-
-  /**
-   * Returns the string representation of this condition result.
-   *
-   * @return The string representation of his condition result.
-   */
-  @Override
-  public String toString()
-  {
-    return resultName;
-  }
+    /**
+     * Returns the string representation of this condition result.
+     *
+     * @return The string representation of his condition result.
+     */
+    @Override
+    public String toString() {
+        return resultName;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
index dee5bff..ba49493 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,18 +27,29 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.Closeable;
 import java.util.Collection;
 
-import org.forgerock.i18n.*;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.forgerock.opendj.ldif.ConnectionEntryReader;
 
-
-
 /**
  * A connection with a Directory Server over which read and update operations
  * may be performed. See RFC 4511 for the LDAPv3 protocol specification and more
@@ -136,1257 +146,1175 @@
  * @see <a href="http://tools.ietf.org/html/rfc4511">RFC 4511 - Lightweight
  *      Directory Access Protocol (LDAP): The Protocol </a>
  */
-public interface Connection extends Closeable
-{
+public interface Connection extends Closeable {
 
-  /**
-   * Abandons the unfinished operation identified in the provided abandon
-   * request.
-   * <p>
-   * Abandon requests do not have a response, so invoking the method get() on
-   * the returned future will not block, nor return anything (it is Void), but
-   * may throw an exception if a problem occurred while sending the abandon
-   * request. In addition the returned future may be used in order to determine
-   * the message ID of the abandon request.
-   * <p>
-   * <b>Note:</b> a more convenient approach to abandoning unfinished
-   * asynchronous operations is provided via the
-   * {@link FutureResult#cancel(boolean)} method.
-   *
-   * @param request
-   *          The request identifying the operation to be abandoned.
-   * @return A future whose result is Void.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support abandon operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Void> abandonAsync(AbandonRequest request);
+    /**
+     * Abandons the unfinished operation identified in the provided abandon
+     * request.
+     * <p>
+     * Abandon requests do not have a response, so invoking the method get() on
+     * the returned future will not block, nor return anything (it is Void), but
+     * may throw an exception if a problem occurred while sending the abandon
+     * request. In addition the returned future may be used in order to
+     * determine the message ID of the abandon request.
+     * <p>
+     * <b>Note:</b> a more convenient approach to abandoning unfinished
+     * asynchronous operations is provided via the
+     * {@link FutureResult#cancel(boolean)} method.
+     *
+     * @param request
+     *            The request identifying the operation to be abandoned.
+     * @return A future whose result is Void.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support abandon operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Void> abandonAsync(AbandonRequest request);
 
+    /**
+     * Adds an entry to the Directory Server using the provided add request.
+     *
+     * @param request
+     *            The add request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support add operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    Result add(AddRequest request) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Adds the provided entry to the Directory Server.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * AddRequest request = new AddRequest(entry);
+     * connection.add(request);
+     * </pre>
+     *
+     * @param entry
+     *            The entry to be added.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support add operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    Result add(Entry entry) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Adds an entry to the Directory Server using the provided add request.
-   *
-   * @param request
-   *          The add request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support add operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  Result add(AddRequest request) throws ErrorResultException,
-      InterruptedException;
+    /**
+     * Adds an entry to the Directory Server using the provided lines of LDIF.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * AddRequest request = new AddRequest(ldifLines);
+     * connection.add(request);
+     * </pre>
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing the an LDIF add change record or an
+     *            LDIF entry record.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support add operations.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    Result add(String... ldifLines) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously adds an entry to the Directory Server using the provided
+     * add request.
+     *
+     * @param request
+     *            The add request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support add operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Result> addAsync(AddRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Registers the provided connection event listener so that it will be
+     * notified when this connection is closed by the application, receives an
+     * unsolicited notification, or experiences a fatal error.
+     *
+     * @param listener
+     *            The listener which wants to be notified when events occur on
+     *            this connection.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code listener} was {@code null}.
+     */
+    void addConnectionEventListener(ConnectionEventListener listener);
 
-  /**
-   * Adds the provided entry to the Directory Server.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * AddRequest request = new AddRequest(entry);
-   * connection.add(request);
-   * </pre>
-   *
-   * @param entry
-   *          The entry to be added.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support add operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  Result add(Entry entry) throws ErrorResultException, InterruptedException;
+    /**
+     * Authenticates to the Directory Server using the provided bind request.
+     *
+     * @param request
+     *            The bind request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support bind operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    BindResult bind(BindRequest request) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Authenticates to the Directory Server using simple authentication and the
+     * provided user name and password.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * BindRequest request = new SimpleBindRequest(name, password);
+     * connection.bind(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the Directory object that the client
+     *            wishes to bind as, which may be empty.
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support bind operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code name} or {@code password} was {@code null}.
+     */
+    BindResult bind(String name, char[] password) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously authenticates to the Directory Server using the provided
+     * bind request.
+     *
+     * @param request
+     *            The bind request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support bind operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<BindResult> bindAsync(BindRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super BindResult> resultHandler);
 
-  /**
-   * Adds an entry to the Directory Server using the provided lines of LDIF.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * AddRequest request = new AddRequest(ldifLines);
-   * connection.add(request);
-   * </pre>
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing the an LDIF add change record or an LDIF
-   *          entry record.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support add operations.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  Result add(String... ldifLines) throws ErrorResultException,
-      InterruptedException;
+    /**
+     * Releases any resources associated with this connection. For physical
+     * connections to a Directory Server this will mean that an unbind request
+     * is sent and the underlying socket is closed.
+     * <p>
+     * Other connection implementations may behave differently, and may choose
+     * not to send an unbind request if its use is inappropriate (for example a
+     * pooled connection will be released and returned to its connection pool
+     * without ever issuing an unbind request).
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * UnbindRequest request = new UnbindRequest();
+     * connection.close(request);
+     * </pre>
+     *
+     * Calling {@code close} on a connection that is already closed has no
+     * effect.
+     */
+    void close();
 
+    /**
+     * Releases any resources associated with this connection. For physical
+     * connections to a Directory Server this will mean that the provided unbind
+     * request is sent and the underlying socket is closed.
+     * <p>
+     * Other connection implementations may behave differently, and may choose
+     * to ignore the provided unbind request if its use is inappropriate (for
+     * example a pooled connection will be released and returned to its
+     * connection pool without ever issuing an unbind request).
+     * <p>
+     * Calling {@code close} on a connection that is already closed has no
+     * effect.
+     *
+     * @param request
+     *            The unbind request to use in the case where a physical
+     *            connection is closed.
+     * @param reason
+     *            A reason describing why the connection was closed.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    void close(UnbindRequest request, String reason);
 
+    /**
+     * Compares an entry in the Directory Server using the provided compare
+     * request.
+     *
+     * @param request
+     *            The compare request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support compare operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    CompareResult compare(CompareRequest request) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Asynchronously adds an entry to the Directory Server using the provided add
-   * request.
-   *
-   * @param request
-   *          The add request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support add operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Result> addAsync(AddRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
+    /**
+     * Compares the named entry in the Directory Server against the provided
+     * attribute value assertion.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * CompareRequest request = new CompareRequest(name, attributeDescription, assertionValue);
+     * connection.compare(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be compared.
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @param assertionValue
+     *            The assertion value to be compared.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} or {@code AttributeDescription} could not be
+     *             decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support compare operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code name}, {@code attributeDescription}, or
+     *             {@code assertionValue} was {@code null}.
+     */
+    CompareResult compare(String name, String attributeDescription, String assertionValue)
+            throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously compares an entry in the Directory Server using the
+     * provided compare request.
+     *
+     * @param request
+     *            The compare request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support compare operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<CompareResult> compareAsync(CompareRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super CompareResult> resultHandler);
 
+    /**
+     * Deletes an entry from the Directory Server using the provided delete
+     * request.
+     *
+     * @param request
+     *            The delete request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support delete operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    Result delete(DeleteRequest request) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Registers the provided connection event listener so that it will be
-   * notified when this connection is closed by the application, receives an
-   * unsolicited notification, or experiences a fatal error.
-   *
-   * @param listener
-   *          The listener which wants to be notified when events occur on this
-   *          connection.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code listener} was {@code null}.
-   */
-  void addConnectionEventListener(ConnectionEventListener listener);
+    /**
+     * Deletes the named entry from the Directory Server.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * DeleteRequest request = new DeleteRequest(name);
+     * connection.delete(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be deleted.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support delete operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    Result delete(String name) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously deletes an entry from the Directory Server using the
+     * provided delete request.
+     *
+     * @param request
+     *            The delete request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support delete operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Result> deleteAsync(DeleteRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Requests that the Directory Server performs the provided extended
+     * request.
+     *
+     * @param <R>
+     *            The type of result returned by the extended request.
+     * @param request
+     *            The extended request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support extended operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request)
+            throws ErrorResultException, InterruptedException;
 
-  /**
-   * Authenticates to the Directory Server using the provided bind request.
-   *
-   * @param request
-   *          The bind request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support bind operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  BindResult bind(BindRequest request) throws ErrorResultException,
-      InterruptedException;
+    /**
+     * Requests that the Directory Server performs the provided extended
+     * request, optionally listening for any intermediate responses.
+     *
+     * @param <R>
+     *            The type of result returned by the extended request.
+     * @param request
+     *            The extended request.
+     * @param handler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support extended operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request,
+            IntermediateResponseHandler handler) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Requests that the Directory Server performs the provided extended
+     * request.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * GenericExtendedRequest request = new GenericExtendedRequest(requestName, requestValue);
+     * connection.extendedRequest(request);
+     * </pre>
+     *
+     * @param requestName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to the extended request.
+     * @param requestValue
+     *            The content of the extended request in a form defined by the
+     *            extended operation, or {@code null} if there is no content.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support extended operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code requestName} was {@code null}.
+     */
+    GenericExtendedResult extendedRequest(String requestName, ByteString requestValue)
+            throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously performs the provided extended request in the Directory
+     * Server.
+     *
+     * @param <R>
+     *            The type of result returned by the extended request.
+     * @param request
+     *            The extended request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support extended operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(ExtendedRequest<R> request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super R> resultHandler);
 
-  /**
-   * Authenticates to the Directory Server using simple authentication and the
-   * provided user name and password.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * BindRequest request = new SimpleBindRequest(name, password);
-   * connection.bind(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the Directory object that the client
-   *          wishes to bind as, which may be empty.
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support bind operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code name} or {@code password} was {@code null}.
-   */
-  BindResult bind(String name, char[] password) throws ErrorResultException,
-      InterruptedException;
+    /**
+     * Indicates whether or not this connection has been explicitly closed by
+     * calling {@code close}. This method will not return {@code true} if a
+     * fatal error has occurred on the connection unless {@code close} has been
+     * called.
+     *
+     * @return {@code true} if this connection has been explicitly closed by
+     *         calling {@code close}, or {@code false} otherwise.
+     */
+    boolean isClosed();
 
+    /**
+     * Returns {@code true} if this connection has not been closed and no fatal
+     * errors have been detected. This method is guaranteed to return
+     * {@code false} only when it is called after the method {@code close} has
+     * been called.
+     *
+     * @return {@code true} if this connection is valid, {@code false}
+     *         otherwise.
+     */
+    boolean isValid();
 
+    /**
+     * Modifies an entry in the Directory Server using the provided modify
+     * request.
+     *
+     * @param request
+     *            The modify request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    Result modify(ModifyRequest request) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Asynchronously authenticates to the Directory Server using the provided
-   * bind request.
-   *
-   * @param request
-   *          The bind request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support bind operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<BindResult> bindAsync(BindRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super BindResult> resultHandler);
+    /**
+     * Modifies an entry in the Directory Server using the provided lines of
+     * LDIF.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * ModifyRequest request = new ModifyRequest(name, ldifChanges);
+     * connection.modify(request);
+     * </pre>
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing the a single LDIF modify change
+     *            record.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify operations.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    Result modify(String... ldifLines) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously modifies an entry in the Directory Server using the
+     * provided modify request.
+     *
+     * @param request
+     *            The modify request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Result> modifyAsync(ModifyRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Renames an entry in the Directory Server using the provided modify DN
+     * request.
+     *
+     * @param request
+     *            The modify DN request.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify DN operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    Result modifyDN(ModifyDNRequest request) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Releases any resources associated with this connection. For physical
-   * connections to a Directory Server this will mean that an unbind request is
-   * sent and the underlying socket is closed.
-   * <p>
-   * Other connection implementations may behave differently, and may choose not
-   * to send an unbind request if its use is inappropriate (for example a pooled
-   * connection will be released and returned to its connection pool without
-   * ever issuing an unbind request).
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * UnbindRequest request = new UnbindRequest();
-   * connection.close(request);
-   * </pre>
-   *
-   * Calling {@code close} on a connection that is already closed has no effect.
-   */
-  void close();
+    /**
+     * Renames the named entry in the Directory Server using the provided new
+     * RDN.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * ModifyDNRequest request = new ModifyDNRequest(name, newRDN);
+     * connection.modifyDN(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be renamed.
+     * @param newRDN
+     *            The new RDN of the entry.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} or {@code newRDN} could not be decoded using
+     *             the default schema.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify DN operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code name} or {@code newRDN} was {@code null}.
+     */
+    Result modifyDN(String name, String newRDN) throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously renames an entry in the Directory Server using the
+     * provided modify DN request.
+     *
+     * @param request
+     *            The modify DN request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support modify DN operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Result> modifyDNAsync(ModifyDNRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Reads the named entry from the Directory Server.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, this method will never return {@code null}.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * SearchRequest request =
+     *         new SearchRequest(name, SearchScope.BASE_OBJECT, &quot;(objectClass=*)&quot;, attributeDescriptions);
+     * connection.searchSingleEntry(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be read.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with the entry,
+     *            which may be {@code null} or empty indicating that all user
+     *            attributes should be returned.
+     * @return The single search result entry returned from the search.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code name} was {@code null}.
+     */
+    SearchResultEntry readEntry(DN name, String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException;
 
-  /**
-   * Releases any resources associated with this connection. For physical
-   * connections to a Directory Server this will mean that the provided unbind
-   * request is sent and the underlying socket is closed.
-   * <p>
-   * Other connection implementations may behave differently, and may choose to
-   * ignore the provided unbind request if its use is inappropriate (for example
-   * a pooled connection will be released and returned to its connection pool
-   * without ever issuing an unbind request).
-   * <p>
-   * Calling {@code close} on a connection that is already closed has no effect.
-   *
-   * @param request
-   *          The unbind request to use in the case where a physical connection
-   *          is closed.
-   * @param reason
-   *          A reason describing why the connection was closed.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  void close(UnbindRequest request, String reason);
+    /**
+     * Reads the named entry from the Directory Server.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, this method will never return {@code null}.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * SearchRequest request =
+     *         new SearchRequest(name, SearchScope.BASE_OBJECT, &quot;(objectClass=*)&quot;, attributeDescriptions);
+     * connection.searchSingleEntry(request);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be read.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with the entry.
+     * @return The single search result entry returned from the search.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code baseObject} could not be decoded using the default
+     *             schema.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code name} was {@code null}.
+     */
+    SearchResultEntry readEntry(String name, String... attributeDescriptions)
+            throws ErrorResultException, InterruptedException;
 
+    /**
+     * Asynchronously reads the named entry from the Directory Server.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, the returned future will never return {@code null}.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * SearchRequest request =
+     *         new SearchRequest(name, SearchScope.BASE_OBJECT, &quot;(objectClass=*)&quot;, attributeDescriptions);
+     * connection.searchSingleEntryAsync(request, resultHandler, p);
+     * </pre>
+     *
+     * @param name
+     *            The distinguished name of the entry to be read.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with the entry,
+     *            which may be {@code null} or empty indicating that all user
+     *            attributes should be returned.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code name} was {@code null}.
+     */
+    FutureResult<SearchResultEntry> readEntryAsync(DN name,
+            Collection<String> attributeDescriptions,
+            ResultHandler<? super SearchResultEntry> handler);
 
+    /**
+     * Removes the provided connection event listener from this connection so
+     * that it will no longer be notified when this connection is closed by the
+     * application, receives an unsolicited notification, or experiences a fatal
+     * error.
+     *
+     * @param listener
+     *            The listener which no longer wants to be notified when events
+     *            occur on this connection.
+     * @throws NullPointerException
+     *             If the {@code listener} was {@code null}.
+     */
+    void removeConnectionEventListener(ConnectionEventListener listener);
 
-  /**
-   * Compares an entry in the Directory Server using the provided compare
-   * request.
-   *
-   * @param request
-   *          The compare request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support compare operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  CompareResult compare(CompareRequest request) throws ErrorResultException,
-      InterruptedException;
+    /**
+     * Searches the Directory Server using the provided search parameters. Any
+     * matching entries returned by the search will be exposed through the
+     * returned {@code ConnectionEntryReader}.
+     * <p>
+     * Unless otherwise specified, calling this method is equivalent to:
+     *
+     * <pre>
+     * ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
+     * </pre>
+     *
+     * @param request
+     *            The search request.
+     * @return The result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} or {@code entries} was {@code null}.
+     */
+    ConnectionEntryReader search(SearchRequest request);
 
-
-
-  /**
-   * Compares the named entry in the Directory Server against the provided
-   * attribute value assertion.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * CompareRequest request = new CompareRequest(name, attributeDescription,
-   *     assertionValue);
-   * connection.compare(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be compared.
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @param assertionValue
-   *          The assertion value to be compared.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} or {@code AttributeDescription} could not be
-   *           decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support compare operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code name}, {@code attributeDescription}, or
-   *           {@code assertionValue} was {@code null}.
-   */
-  CompareResult compare(String name, String attributeDescription,
-      String assertionValue) throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Asynchronously compares an entry in the Directory Server using the provided
-   * compare request.
-   *
-   * @param request
-   *          The compare request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support compare operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<CompareResult> compareAsync(CompareRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super CompareResult> resultHandler);
-
-
-
-  /**
-   * Deletes an entry from the Directory Server using the provided delete
-   * request.
-   *
-   * @param request
-   *          The delete request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support delete operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  Result delete(DeleteRequest request) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Deletes the named entry from the Directory Server.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * DeleteRequest request = new DeleteRequest(name);
-   * connection.delete(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be deleted.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support delete operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  Result delete(String name) throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Asynchronously deletes an entry from the Directory Server using the
-   * provided delete request.
-   *
-   * @param request
-   *          The delete request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support delete operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Result> deleteAsync(DeleteRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Requests that the Directory Server performs the provided extended request.
-   *
-   * @param <R>
-   *          The type of result returned by the extended request.
-   * @param request
-   *          The extended request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support extended operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Requests that the Directory Server performs the provided extended request,
-   * optionally listening for any intermediate responses.
-   *
-   * @param <R>
-   *          The type of result returned by the extended request.
-   * @param request
-   *          The extended request.
-   * @param handler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support extended operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request,
-      IntermediateResponseHandler handler) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Requests that the Directory Server performs the provided extended request.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * GenericExtendedRequest request = new GenericExtendedRequest(requestName,
-   *     requestValue);
-   * connection.extendedRequest(request);
-   * </pre>
-   *
-   * @param requestName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to the extended request.
-   * @param requestValue
-   *          The content of the extended request in a form defined by the
-   *          extended operation, or {@code null} if there is no content.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support extended operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code requestName} was {@code null}.
-   */
-  GenericExtendedResult extendedRequest(String requestName,
-      ByteString requestValue) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Asynchronously performs the provided extended request in the Directory
-   * Server.
-   *
-   * @param <R>
-   *          The type of result returned by the extended request.
-   * @param request
-   *          The extended request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support extended operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-      ExtendedRequest<R> request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super R> resultHandler);
-
-
-
-  /**
-   * Indicates whether or not this connection has been explicitly closed by
-   * calling {@code close}. This method will not return {@code true} if a fatal
-   * error has occurred on the connection unless {@code close} has been called.
-   *
-   * @return {@code true} if this connection has been explicitly closed by
-   *         calling {@code close}, or {@code false} otherwise.
-   */
-  boolean isClosed();
-
-
-
-  /**
-   * Returns {@code true} if this connection has not been closed and no fatal
-   * errors have been detected. This method is guaranteed to return
-   * {@code false} only when it is called after the method {@code close} has
-   * been called.
-   *
-   * @return {@code true} if this connection is valid, {@code false} otherwise.
-   */
-  boolean isValid();
-
-
-
-  /**
-   * Modifies an entry in the Directory Server using the provided modify
-   * request.
-   *
-   * @param request
-   *          The modify request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  Result modify(ModifyRequest request) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Modifies an entry in the Directory Server using the provided lines of LDIF.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * ModifyRequest request = new ModifyRequest(name, ldifChanges);
-   * connection.modify(request);
-   * </pre>
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing the a single LDIF modify change record.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify operations.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  Result modify(String... ldifLines) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Asynchronously modifies an entry in the Directory Server using the provided
-   * modify request.
-   *
-   * @param request
-   *          The modify request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Result> modifyAsync(ModifyRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Renames an entry in the Directory Server using the provided modify DN
-   * request.
-   *
-   * @param request
-   *          The modify DN request.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify DN operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  Result modifyDN(ModifyDNRequest request) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Renames the named entry in the Directory Server using the provided new RDN.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * ModifyDNRequest request = new ModifyDNRequest(name, newRDN);
-   * connection.modifyDN(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be renamed.
-   * @param newRDN
-   *          The new RDN of the entry.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} or {@code newRDN} could not be decoded using the
-   *           default schema.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify DN operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code name} or {@code newRDN} was {@code null}.
-   */
-  Result modifyDN(String name, String newRDN) throws ErrorResultException,
-      InterruptedException;
-
-
-
-  /**
-   * Asynchronously renames an entry in the Directory Server using the provided
-   * modify DN request.
-   *
-   * @param request
-   *          The modify DN request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support modify DN operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Result> modifyDNAsync(ModifyDNRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Reads the named entry from the Directory Server.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, this method will never return {@code null}.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT,
-   *     &quot;(objectClass=*)&quot;, attributeDescriptions);
-   * connection.searchSingleEntry(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be read.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with the entry, which
-   *          may be {@code null} or empty indicating that all user attributes
-   *          should be returned.
-   * @return The single search result entry returned from the search.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code name} was {@code null}.
-   */
-  SearchResultEntry readEntry(DN name, String... attributeDescriptions)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Reads the named entry from the Directory Server.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, this method will never return {@code null}.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT,
-   *     &quot;(objectClass=*)&quot;, attributeDescriptions);
-   * connection.searchSingleEntry(request);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be read.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with the entry.
-   * @return The single search result entry returned from the search.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code baseObject} could not be decoded using the default
-   *           schema.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code name} was {@code null}.
-   */
-  SearchResultEntry readEntry(String name, String... attributeDescriptions)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Asynchronously reads the named entry from the Directory Server.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, the returned future will never return {@code null}.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * SearchRequest request = new SearchRequest(name, SearchScope.BASE_OBJECT,
-   *     &quot;(objectClass=*)&quot;, attributeDescriptions);
-   * connection.searchSingleEntryAsync(request, resultHandler, p);
-   * </pre>
-   *
-   * @param name
-   *          The distinguished name of the entry to be read.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with the entry, which
-   *          may be {@code null} or empty indicating that all user attributes
-   *          should be returned.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code name} was {@code null}.
-   */
-  FutureResult<SearchResultEntry> readEntryAsync(DN name,
-      Collection<String> attributeDescriptions,
-      ResultHandler<? super SearchResultEntry> handler);
-
-
-
-  /**
-   * Removes the provided connection event listener from this connection so that
-   * it will no longer be notified when this connection is closed by the
-   * application, receives an unsolicited notification, or experiences a fatal
-   * error.
-   *
-   * @param listener
-   *          The listener which no longer wants to be notified when events
-   *          occur on this connection.
-   * @throws NullPointerException
-   *           If the {@code listener} was {@code null}.
-   */
-  void removeConnectionEventListener(ConnectionEventListener listener);
-
-
-
-  /**
-   * Searches the Directory Server using the provided search parameters. Any
-   * matching entries returned by the search will be exposed through the
-   * returned {@code ConnectionEntryReader}.
-   * <p>
-   * Unless otherwise specified, calling this method is equivalent to:
-   * <pre>
-   * ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
-   * </pre>
-   *
-   * @param request
-   *          The search request.
-   * @return The result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} or {@code entries} was {@code null}.
-   */
-  ConnectionEntryReader search(SearchRequest request);
-
-
-
-  /**
-   * Searches the Directory Server using the provided search request. Any
-   * matching entries returned by the search will be added to {@code entries},
-   * even if the final search result indicates that the search failed. Search
-   * result references will be discarded.
-   * <p>
-   * <b>Warning:</b> Usage of this method is discouraged if the search request
-   * is expected to yield a large number of search results since the entire set
-   * of results will be stored in memory, potentially causing an
-   * {@code OutOfMemoryError}.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * connection.search(request, entries, null);
-   * </pre>
-   *
-   * @param request
-   *          The search request.
-   * @param entries
-   *          The collection to which matching entries should be added.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} or {@code entries} was {@code null}.
-   */
-  Result search(SearchRequest request,
-      Collection<? super SearchResultEntry> entries)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Searches the Directory Server using the provided search request. Any
-   * matching entries returned by the search will be added to {@code entries},
-   * even if the final search result indicates that the search failed.
-   * Similarly, search result references returned by the search will be added to
-   * {@code references}.
-   * <p>
-   * <b>Warning:</b> Usage of this method is discouraged if the search request
-   * is expected to yield a large number of search results since the entire set
-   * of results will be stored in memory, potentially causing an
-   * {@code OutOfMemoryError}.
-   *
-   * @param request
-   *          The search request.
-   * @param entries
-   *          The collection to which matching entries should be added.
-   * @param references
-   *          The collection to which search result references should be added,
-   *          or {@code null} if references are to be discarded.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} or {@code entries} was {@code null}.
-   */
-  Result search(SearchRequest request,
-      Collection<? super SearchResultEntry> entries,
-      Collection<? super SearchResultReference> references)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Searches the Directory Server using the provided search request. Any
-   * matching entries returned by the search as well as any search result
-   * references will be passed to the provided search result handler.
-   *
-   * @param request
-   *          The search request.
-   * @param handler
-   *          A search result handler which can be used to process the search
-   *          result entries and references as they are received, may be
-   *          {@code null}.
-   * @return The result of the operation.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  Result search(SearchRequest request, SearchResultHandler handler)
-      throws ErrorResultException, InterruptedException;
-
-
-
-  /**
-   * Searches the Directory Server using the provided search parameters. Any
-   * matching entries returned by the search will be exposed through the
-   * {@code EntryReader} interface.
-   * <p>
-   * <b>Warning:</b> When using a queue with an optional capacity bound, the
-   * connection will stop reading responses and wait if necessary for space to
-   * become available.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * SearchRequest request = new SearchRequest(baseDN, scope, filter,
-   *     attributeDescriptions);
-   * connection.search(request, new LinkedBlockingQueue&lt;Response&gt;());
-   * </pre>
-   *
-   * @param baseObject
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @param scope
-   *          The scope of the search.
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with each entry.
-   * @return An entry reader exposing the returned entries.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code baseObject}, {@code scope}, or {@code filter} were
-   *           {@code null}.
-   */
-  ConnectionEntryReader search(String baseObject, SearchScope scope,
-      String filter, String... attributeDescriptions);
-
-
-
-  /**
-   * Asynchronously searches the Directory Server using the provided search
-   * request.
-   *
-   * @param request
-   *          The search request.
-   * @param intermediateResponseHandler
-   *          An intermediate response handler which can be used to process any
-   *          intermediate responses as they are received, may be {@code null}.
-   * @param resultHandler
-   *          A search result handler which can be used to asynchronously
-   *          process the search result entries and references as they are
-   *          received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  FutureResult<Result> searchAsync(SearchRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      SearchResultHandler resultHandler);
-
-
+    /**
+     * Searches the Directory Server using the provided search request. Any
+     * matching entries returned by the search will be added to {@code entries},
+     * even if the final search result indicates that the search failed. Search
+     * result references will be discarded.
+     * <p>
+     * <b>Warning:</b> Usage of this method is discouraged if the search request
+     * is expected to yield a large number of search results since the entire
+     * set of results will be stored in memory, potentially causing an
+     * {@code OutOfMemoryError}.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * connection.search(request, entries, null);
+     * </pre>
+     *
+     * @param request
+     *            The search request.
+     * @param entries
+     *            The collection to which matching entries should be added.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} or {@code entries} was {@code null}.
+     */
+    Result search(SearchRequest request, Collection<? super SearchResultEntry> entries)
+            throws ErrorResultException, InterruptedException;
 
-  /**
-   * Searches the Directory Server for a single entry using the provided search
-   * request.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, this method will never return {@code null}. If multiple
-   * matching entries are returned by the Directory Server then the request will
-   * fail with an {@link MultipleEntriesFoundException}.
-   *
-   * @param request
-   *          The search request.
-   * @return The single search result entry returned from the search.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code request} was {@code null}.
-   */
-  SearchResultEntry searchSingleEntry(SearchRequest request)
-      throws ErrorResultException, InterruptedException;
+    /**
+     * Searches the Directory Server using the provided search request. Any
+     * matching entries returned by the search will be added to {@code entries},
+     * even if the final search result indicates that the search failed.
+     * Similarly, search result references returned by the search will be added
+     * to {@code references}.
+     * <p>
+     * <b>Warning:</b> Usage of this method is discouraged if the search request
+     * is expected to yield a large number of search results since the entire
+     * set of results will be stored in memory, potentially causing an
+     * {@code OutOfMemoryError}.
+     *
+     * @param request
+     *            The search request.
+     * @param entries
+     *            The collection to which matching entries should be added.
+     * @param references
+     *            The collection to which search result references should be
+     *            added, or {@code null} if references are to be discarded.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} or {@code entries} was {@code null}.
+     */
+    Result search(SearchRequest request, Collection<? super SearchResultEntry> entries,
+            Collection<? super SearchResultReference> references) throws ErrorResultException,
+            InterruptedException;
 
+    /**
+     * Searches the Directory Server using the provided search request. Any
+     * matching entries returned by the search as well as any search result
+     * references will be passed to the provided search result handler.
+     *
+     * @param request
+     *            The search request.
+     * @param handler
+     *            A search result handler which can be used to process the
+     *            search result entries and references as they are received, may
+     *            be {@code null}.
+     * @return The result of the operation.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    Result search(SearchRequest request, SearchResultHandler handler) throws ErrorResultException,
+            InterruptedException;
 
+    /**
+     * Searches the Directory Server using the provided search parameters. Any
+     * matching entries returned by the search will be exposed through the
+     * {@code EntryReader} interface.
+     * <p>
+     * <b>Warning:</b> When using a queue with an optional capacity bound, the
+     * connection will stop reading responses and wait if necessary for space to
+     * become available.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * SearchRequest request = new SearchRequest(baseDN, scope, filter, attributeDescriptions);
+     * connection.search(request, new LinkedBlockingQueue&lt;Response&gt;());
+     * </pre>
+     *
+     * @param baseObject
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @param scope
+     *            The scope of the search.
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with each entry.
+     * @return An entry reader exposing the returned entries.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code baseObject}, {@code scope}, or {@code filter}
+     *             were {@code null}.
+     */
+    ConnectionEntryReader search(String baseObject, SearchScope scope, String filter,
+            String... attributeDescriptions);
 
-  /**
-   * Searches the Directory Server for a single entry using the provided search
-   * parameters.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, this method will never return {@code null}. If multiple
-   * matching entries are returned by the Directory Server then the request will
-   * fail with an {@link MultipleEntriesFoundException}.
-   * <p>
-   * This method is equivalent to the following code:
-   *
-   * <pre>
-   * SearchRequest request = new SearchRequest(baseObject, scope, filter,
-   *     attributeDescriptions);
-   * connection.searchSingleEntry(request);
-   * </pre>
-   *
-   * @param baseObject
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @param scope
-   *          The scope of the search.
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with each entry.
-   * @return The single search result entry returned from the search.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code baseObject} could not be decoded using the default
-   *           schema or if {@code filter} is not a valid LDAP string
-   *           representation of a filter.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code baseObject}, {@code scope}, or {@code filter} were
-   *           {@code null}.
-   */
-  SearchResultEntry searchSingleEntry(String baseObject, SearchScope scope,
-      String filter, String... attributeDescriptions)
-      throws ErrorResultException, InterruptedException;
+    /**
+     * Asynchronously searches the Directory Server using the provided search
+     * request.
+     *
+     * @param request
+     *            The search request.
+     * @param intermediateResponseHandler
+     *            An intermediate response handler which can be used to process
+     *            any intermediate responses as they are received, may be
+     *            {@code null}.
+     * @param resultHandler
+     *            A search result handler which can be used to asynchronously
+     *            process the search result entries and references as they are
+     *            received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    FutureResult<Result> searchAsync(SearchRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            SearchResultHandler resultHandler);
 
+    /**
+     * Searches the Directory Server for a single entry using the provided
+     * search request.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, this method will never return {@code null}. If multiple
+     * matching entries are returned by the Directory Server then the request
+     * will fail with an {@link MultipleEntriesFoundException}.
+     *
+     * @param request
+     *            The search request.
+     * @return The single search result entry returned from the search.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code request} was {@code null}.
+     */
+    SearchResultEntry searchSingleEntry(SearchRequest request) throws ErrorResultException,
+            InterruptedException;
 
+    /**
+     * Searches the Directory Server for a single entry using the provided
+     * search parameters.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, this method will never return {@code null}. If multiple
+     * matching entries are returned by the Directory Server then the request
+     * will fail with an {@link MultipleEntriesFoundException}.
+     * <p>
+     * This method is equivalent to the following code:
+     *
+     * <pre>
+     * SearchRequest request = new SearchRequest(baseObject, scope, filter, attributeDescriptions);
+     * connection.searchSingleEntry(request);
+     * </pre>
+     *
+     * @param baseObject
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @param scope
+     *            The scope of the search.
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with each entry.
+     * @return The single search result entry returned from the search.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code baseObject} could not be decoded using the default
+     *             schema or if {@code filter} is not a valid LDAP string
+     *             representation of a filter.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code baseObject}, {@code scope}, or {@code filter}
+     *             were {@code null}.
+     */
+    SearchResultEntry searchSingleEntry(String baseObject, SearchScope scope, String filter,
+            String... attributeDescriptions) throws ErrorResultException, InterruptedException;
 
-  /**
-   * Asynchronously searches the Directory Server for a single entry using the
-   * provided search request.
-   * <p>
-   * If the requested entry is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, the returned future will never return {@code null}. If
-   * multiple matching entries are returned by the Directory Server then the
-   * request will fail with an {@link MultipleEntriesFoundException}.
-   *
-   * @param request
-   *          The search request.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If this connection does not support search operations.
-   * @throws IllegalStateException
-   *           If this connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code request} was {@code null}.
-   */
-  FutureResult<SearchResultEntry> searchSingleEntryAsync(SearchRequest request,
-      ResultHandler<? super SearchResultEntry> handler);
+    /**
+     * Asynchronously searches the Directory Server for a single entry using the
+     * provided search request.
+     * <p>
+     * If the requested entry is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, the returned future will never return {@code null}. If
+     * multiple matching entries are returned by the Directory Server then the
+     * request will fail with an {@link MultipleEntriesFoundException}.
+     *
+     * @param request
+     *            The search request.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If this connection does not support search operations.
+     * @throws IllegalStateException
+     *             If this connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code request} was {@code null}.
+     */
+    FutureResult<SearchResultEntry> searchSingleEntryAsync(SearchRequest request,
+            ResultHandler<? super SearchResultEntry> handler);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java
index 25ad262..098ec36 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,63 +26,54 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.EventListener;
 
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * An object that registers to be notified when a connection is closed by the
  * application, receives an unsolicited notification, or experiences a fatal
  * error.
  */
-public interface ConnectionEventListener extends EventListener
-{
-  /**
-   * Notifies this connection event listener that the application has called
-   * {@code close} on the connection. The connection event listener will be
-   * notified immediately after the application calls the {@code close} method
-   * on the associated connection.
-   */
-  void handleConnectionClosed();
+public interface ConnectionEventListener extends EventListener {
+    /**
+     * Notifies this connection event listener that the application has called
+     * {@code close} on the connection. The connection event listener will be
+     * notified immediately after the application calls the {@code close} method
+     * on the associated connection.
+     */
+    void handleConnectionClosed();
 
+    /**
+     * Notifies this connection event listener that a fatal error has occurred
+     * and the connection can no longer be used - the server has crashed, for
+     * example. The connection implementation makes this notification just
+     * before it throws the provided {@link ErrorResultException} to the
+     * application.
+     * <p>
+     * <b>Note:</b> disconnect notifications are treated as fatal connection
+     * errors and are handled by this method. In this case
+     * {@code isDisconnectNotification} will be {@code true} and {@code error}
+     * will contain the result code and any diagnostic information contained in
+     * the notification message.
+     *
+     * @param isDisconnectNotification
+     *            {@code true} if the error was triggered by a disconnect
+     *            notification sent by the server, otherwise {@code false}.
+     * @param error
+     *            The exception that is about to be thrown to the application.
+     */
+    void handleConnectionError(boolean isDisconnectNotification, ErrorResultException error);
 
-
-  /**
-   * Notifies this connection event listener that a fatal error has occurred and
-   * the connection can no longer be used - the server has crashed, for example.
-   * The connection implementation makes this notification just before it throws
-   * the provided {@link ErrorResultException} to the application.
-   * <p>
-   * <b>Note:</b> disconnect notifications are treated as fatal connection
-   * errors and are handled by this method. In this case
-   * {@code isDisconnectNotification} will be {@code true} and {@code error}
-   * will contain the result code and any diagnostic information contained in
-   * the notification message.
-   *
-   * @param isDisconnectNotification
-   *          {@code true} if the error was triggered by a disconnect
-   *          notification sent by the server, otherwise {@code false}.
-   * @param error
-   *          The exception that is about to be thrown to the application.
-   */
-  void handleConnectionError(boolean isDisconnectNotification,
-      ErrorResultException error);
-
-
-
-  /**
-   * Notifies this connection event listener that the connection has just
-   * received the provided unsolicited notification from the server.
-   * <p>
-   * <b>Note:</b> disconnect notifications are treated as fatal connection
-   * errors and are handled by the {@link #handleConnectionError} method.
-   *
-   * @param notification
-   *          The unsolicited notification.
-   */
-  void handleUnsolicitedNotification(ExtendedResult notification);
+    /**
+     * Notifies this connection event listener that the connection has just
+     * received the provided unsolicited notification from the server.
+     * <p>
+     * <b>Note:</b> disconnect notifications are treated as fatal connection
+     * errors and are handled by the {@link #handleConnectionError} method.
+     *
+     * @param notification
+     *            The unsolicited notification.
+     */
+    void handleUnsolicitedNotification(ExtendedResult notification);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java
index 917e655..856e850 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,21 +26,15 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * was unsuccessful because of a connection failure.
  */
 @SuppressWarnings("serial")
-public class ConnectionException extends ErrorResultException
-{
-  ConnectionException(final Result result)
-  {
-    super(result);
-  }
+public class ConnectionException extends ErrorResultException {
+    ConnectionException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java
index c729819..b5b1ccf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A connection factory provides an interface for obtaining a connection to a
  * Directory Server. Connection factories can be used to wrap other connection
@@ -52,36 +49,32 @@
  * should aim to close connections as soon as possible in order to avoid
  * resource contention.
  */
-public interface ConnectionFactory
-{
-  /**
-   * Asynchronously obtains a connection to the Directory Server associated with
-   * this connection factory. The returned {@code FutureResult} can be used to
-   * retrieve the completed connection. Alternatively, if a
-   * {@code ResultHandler} is provided, the handler will be notified when the
-   * connection is available and ready for use.
-   *
-   * @param handler
-   *          The completion handler, or {@code null} if no handler is to be
-   *          used.
-   * @return A future which can be used to retrieve the connection.
-   */
-  FutureResult<Connection> getConnectionAsync(
-      ResultHandler<? super Connection> handler);
+public interface ConnectionFactory {
+    /**
+     * Asynchronously obtains a connection to the Directory Server associated
+     * with this connection factory. The returned {@code FutureResult} can be
+     * used to retrieve the completed connection. Alternatively, if a
+     * {@code ResultHandler} is provided, the handler will be notified when the
+     * connection is available and ready for use.
+     *
+     * @param handler
+     *            The completion handler, or {@code null} if no handler is to be
+     *            used.
+     * @return A future which can be used to retrieve the connection.
+     */
+    FutureResult<Connection> getConnectionAsync(ResultHandler<? super Connection> handler);
 
-
-
-  /**
-   * Returns a connection to the Directory Server associated with this
-   * connection factory. The connection returned by this method can be used
-   * immediately.
-   *
-   * @return A connection to the Directory Server associated with this
-   *         connection factory.
-   * @throws ErrorResultException
-   *           If the connection request failed for some reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   */
-  Connection getConnection() throws ErrorResultException, InterruptedException;
+    /**
+     * Returns a connection to the Directory Server associated with this
+     * connection factory. The connection returned by this method can be used
+     * immediately.
+     *
+     * @return A connection to the Directory Server associated with this
+     *         connection factory.
+     * @throws ErrorResultException
+     *             If the connection request failed for some reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     */
+    Connection getConnection() throws ErrorResultException, InterruptedException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java
index b11862c..f06fe8d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.Closeable;
 
-
-
 /**
  * A connection factory which maintains and re-uses a pool of connections.
  * Connections obtained from a connection pool are returned to the connection
@@ -46,61 +41,55 @@
  * Since pooled connections are re-used, applications must use operations such
  * as binds and StartTLS with extreme caution.
  */
-public interface ConnectionPool extends ConnectionFactory, Closeable
-{
-  /**
-   * Releases any resources associated with this connection pool. Pooled
-   * connections will be permanently closed and this connection pool will no
-   * longer be available for use.
-   * <p>
-   * Attempts to use this connection pool after it has been closed will result
-   * in an {@code IllegalStateException}.
-   * <p>
-   * Calling {@code close} on a connection pool which is already closed has no
-   * effect.
-   */
-  void close();
+public interface ConnectionPool extends ConnectionFactory, Closeable {
+    /**
+     * Releases any resources associated with this connection pool. Pooled
+     * connections will be permanently closed and this connection pool will no
+     * longer be available for use.
+     * <p>
+     * Attempts to use this connection pool after it has been closed will result
+     * in an {@code IllegalStateException}.
+     * <p>
+     * Calling {@code close} on a connection pool which is already closed has no
+     * effect.
+     */
+    void close();
 
+    /**
+     * Asynchronously obtains a connection from this connection pool,
+     * potentially opening a new connection if needed.
+     * <p>
+     * The returned {@code FutureResult} can be used to retrieve the pooled
+     * connection. Alternatively, if a {@code ResultHandler} is provided, the
+     * handler will be notified when the pooled connection is available and
+     * ready for use.
+     * <p>
+     * Closing the pooled connection will, depending on the connection pool
+     * implementation, return the connection to this pool without closing it.
+     *
+     * @param handler
+     *            The completion handler, or {@code null} if no handler is to be
+     *            used.
+     * @return A future which can be used to retrieve the pooled connection.
+     * @throws IllegalStateException
+     *             If this connection pool has already been closed.
+     */
+    FutureResult<Connection> getConnectionAsync(ResultHandler<? super Connection> handler);
 
-
-  /**
-   * Asynchronously obtains a connection from this connection pool, potentially
-   * opening a new connection if needed.
-   * <p>
-   * The returned {@code FutureResult} can be used to retrieve the pooled
-   * connection. Alternatively, if a {@code ResultHandler} is
-   * provided, the handler will be notified when the pooled connection is
-   * available and ready for use.
-   * <p>
-   * Closing the pooled connection will, depending on the connection pool
-   * implementation, return the connection to this pool without closing it.
-   *
-   * @param handler
-   *          The completion handler, or {@code null} if no handler is to be
-   *          used.
-   * @return A future which can be used to retrieve the pooled connection.
-   * @throws IllegalStateException
-   *           If this connection pool has already been closed.
-   */
-  FutureResult<Connection> getConnectionAsync(
-      ResultHandler<? super Connection> handler);
-
-
-
-  /**
-   * Obtains a connection from this connection pool, potentially opening a new
-   * connection if needed.
-   * <p>
-   * Closing the pooled connection will, depending on the connection pool
-   * implementation, return the connection to this pool without closing it.
-   *
-   * @return A pooled connection.
-   * @throws ErrorResultException
-   *           If the connection request failed for some reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws IllegalStateException
-   *           If this connection pool has already been closed.
-   */
-  Connection getConnection() throws ErrorResultException, InterruptedException;
+    /**
+     * Obtains a connection from this connection pool, potentially opening a new
+     * connection if needed.
+     * <p>
+     * Closing the pooled connection will, depending on the connection pool
+     * implementation, return the connection to this pool without closing it.
+     *
+     * @return A pooled connection.
+     * @throws ErrorResultException
+     *             If the connection request failed for some reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws IllegalStateException
+     *             If this connection pool has already been closed.
+     */
+    Connection getConnection() throws ErrorResultException, InterruptedException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java
index ebd4081..57c598d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,57 +27,49 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * An interface for providing additional connection security to a connection.
  */
-public interface ConnectionSecurityLayer
-{
+public interface ConnectionSecurityLayer {
 
-  /**
-   * Disposes of any system resources or security-sensitive information that
-   * this connection security layer might be using. Invoking this method
-   * invalidates this instance.
-   */
-  void dispose();
+    /**
+     * Disposes of any system resources or security-sensitive information that
+     * this connection security layer might be using. Invoking this method
+     * invalidates this instance.
+     */
+    void dispose();
 
+    /**
+     * Unwraps a byte array received from the peer.
+     *
+     * @param incoming
+     *            A non-{@code null} byte array containing the encoded bytes
+     *            from the peer.
+     * @param offset
+     *            The starting position in {@code incoming} of the bytes to be
+     *            unwrapped.
+     * @param len
+     *            The number of bytes from {@code incoming} to be unwrapped.
+     * @return A non-{@code null} byte array containing the unwrapped bytes.
+     * @throws ErrorResultException
+     *             If {@code incoming} cannot be successfully unwrapped.
+     */
+    byte[] unwrap(byte[] incoming, int offset, int len) throws ErrorResultException;
 
-
-  /**
-   * Unwraps a byte array received from the peer.
-   *
-   * @param incoming
-   *          A non-{@code null} byte array containing the encoded bytes from
-   *          the peer.
-   * @param offset
-   *          The starting position in {@code incoming} of the bytes to be
-   *          unwrapped.
-   * @param len
-   *          The number of bytes from {@code incoming} to be unwrapped.
-   * @return A non-{@code null} byte array containing the unwrapped bytes.
-   * @throws ErrorResultException
-   *           If {@code incoming} cannot be successfully unwrapped.
-   */
-  byte[] unwrap(byte[] incoming, int offset, int len)
-      throws ErrorResultException;
-
-
-
-  /**
-   * Wraps a byte array to be sent to the peer.
-   *
-   * @param outgoing
-   *          A non-{@code null} byte array containing the unencoded bytes to be
-   *          sent to the peer.
-   * @param offset
-   *          The starting position in {@code outgoing} of the bytes to be
-   *          wrapped.
-   * @param len
-   *          The number of bytes from {@code outgoing} to be wrapped.
-   * @return A non-{@code null} byte array containing the wrapped bytes.
-   * @throws ErrorResultException
-   *           If {@code outgoing} cannot be successfully wrapped.
-   */
-  byte[] wrap(byte[] outgoing, int offset, int len) throws ErrorResultException;
+    /**
+     * Wraps a byte array to be sent to the peer.
+     *
+     * @param outgoing
+     *            A non-{@code null} byte array containing the unencoded bytes
+     *            to be sent to the peer.
+     * @param offset
+     *            The starting position in {@code outgoing} of the bytes to be
+     *            wrapped.
+     * @param len
+     *            The number of bytes from {@code outgoing} to be wrapped.
+     * @return A non-{@code null} byte array containing the wrapped bytes.
+     * @throws ErrorResultException
+     *             If {@code outgoing} cannot be successfully wrapped.
+     */
+    byte[] wrap(byte[] outgoing, int offset, int len) throws ErrorResultException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
index b3f64aa..1c1d042 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
@@ -38,368 +35,320 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains methods for creating and manipulating connection
  * factories and connections.
  */
-public final class Connections
-{
-  /**
-   * Creates a new authenticated connection factory which will obtain
-   * connections using the provided connection factory and immediately perform
-   * the provided Bind request.
-   * <p>
-   * The connections returned by an authenticated connection factory support all
-   * operations with the exception of Bind requests. Attempts to perform a Bind
-   * will result in an {@code UnsupportedOperationException}.
-   * <p>
-   * If the Bind request fails for some reason (e.g. invalid credentials), then
-   * the connection attempt will fail and an {@code ErrorResultException} will
-   * be thrown.
-   *
-   * @param factory
-   *          The connection factory to use for connecting to the Directory
-   *          Server.
-   * @param request
-   *          The Bind request to use for authentication.
-   * @return The new connection pool.
-   * @throws NullPointerException
-   *           If {@code factory} or {@code request} was {@code null}.
-   */
-  public static ConnectionFactory newAuthenticatedConnectionFactory(
-      final ConnectionFactory factory, final BindRequest request)
-  {
-    Validator.ensureNotNull(factory, request);
+public final class Connections {
+    /**
+     * Creates a new authenticated connection factory which will obtain
+     * connections using the provided connection factory and immediately perform
+     * the provided Bind request.
+     * <p>
+     * The connections returned by an authenticated connection factory support
+     * all operations with the exception of Bind requests. Attempts to perform a
+     * Bind will result in an {@code UnsupportedOperationException}.
+     * <p>
+     * If the Bind request fails for some reason (e.g. invalid credentials),
+     * then the connection attempt will fail and an {@code ErrorResultException}
+     * will be thrown.
+     *
+     * @param factory
+     *            The connection factory to use for connecting to the Directory
+     *            Server.
+     * @param request
+     *            The Bind request to use for authentication.
+     * @return The new connection pool.
+     * @throws NullPointerException
+     *             If {@code factory} or {@code request} was {@code null}.
+     */
+    public static ConnectionFactory newAuthenticatedConnectionFactory(
+            final ConnectionFactory factory, final BindRequest request) {
+        Validator.ensureNotNull(factory, request);
 
-    return new AuthenticatedConnectionFactory(factory, request);
-  }
+        return new AuthenticatedConnectionFactory(factory, request);
+    }
 
+    /**
+     * Creates a new connection pool which will maintain {@code poolSize}
+     * connections created using the provided connection factory.
+     *
+     * @param factory
+     *            The connection factory to use for creating new connections.
+     * @param poolSize
+     *            The maximum size of the connection pool.
+     * @return The new connection pool.
+     * @throws IllegalArgumentException
+     *             If {@code poolSize} is negative.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public static ConnectionPool newFixedConnectionPool(final ConnectionFactory factory,
+            final int poolSize) {
+        Validator.ensureNotNull(factory);
+        Validator.ensureTrue(poolSize >= 0, "negative pool size");
+        return new FixedConnectionPool(factory, poolSize);
+    }
 
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections in order to detect that they are still alive every 10 seconds
+     * using the default scheduler.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @return The new heart-beat connection factory.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public static ConnectionFactory newHeartBeatConnectionFactory(final ConnectionFactory factory) {
+        return new HeartBeatConnectionFactory(factory);
+    }
 
-  /**
-   * Creates a new connection pool which will maintain {@code poolSize}
-   * connections created using the provided connection factory.
-   *
-   * @param factory
-   *          The connection factory to use for creating new connections.
-   * @param poolSize
-   *          The maximum size of the connection pool.
-   * @return The new connection pool.
-   * @throws IllegalArgumentException
-   *           If {@code poolSize} is negative.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public static ConnectionPool newFixedConnectionPool(
-      final ConnectionFactory factory, final int poolSize)
-  {
-    Validator.ensureNotNull(factory);
-    Validator.ensureTrue(poolSize >= 0, "negative pool size");
-    return new FixedConnectionPool(factory, poolSize);
-  }
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections in order to detect that they are still alive using the
+     * specified frequency and the default scheduler.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     * @return The new heart-beat connection factory.
+     * @throws IllegalArgumentException
+     *             If {@code interval} was negative.
+     * @throws NullPointerException
+     *             If {@code factory} or {@code unit} was {@code null}.
+     */
+    public static ConnectionFactory newHeartBeatConnectionFactory(final ConnectionFactory factory,
+            final long interval, final TimeUnit unit) {
+        return new HeartBeatConnectionFactory(factory, interval, unit);
+    }
 
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections using the specified search request in order to detect that
+     * they are still alive.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     * @param heartBeat
+     *            The search request to use for keepalive pings.
+     * @return The new heart-beat connection factory.
+     * @throws IllegalArgumentException
+     *             If {@code interval} was negative.
+     * @throws NullPointerException
+     *             If {@code factory}, {@code unit}, or {@code heartBeat} was
+     *             {@code null}.
+     */
+    public static ConnectionFactory newHeartBeatConnectionFactory(final ConnectionFactory factory,
+            final long interval, final TimeUnit unit, final SearchRequest heartBeat) {
+        return new HeartBeatConnectionFactory(factory, interval, unit, heartBeat);
+    }
 
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections using the specified search request in order to detect that
+     * they are still alive.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     * @param heartBeat
+     *            The search request to use for keepalive pings.
+     * @param scheduler
+     *            The scheduler which should for periodically sending keepalive
+     *            pings.
+     * @return The new heart-beat connection factory.
+     * @throws IllegalArgumentException
+     *             If {@code interval} was negative.
+     * @throws NullPointerException
+     *             If {@code factory}, {@code unit}, or {@code heartBeat} was
+     *             {@code null}.
+     */
+    public static ConnectionFactory newHeartBeatConnectionFactory(final ConnectionFactory factory,
+            final long interval, final TimeUnit unit, final SearchRequest heartBeat,
+            final ScheduledExecutorService scheduler) {
+        return new HeartBeatConnectionFactory(factory, interval, unit, heartBeat, scheduler);
+    }
 
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections in order to detect that they are still alive every 10 seconds
-   * using the default scheduler.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @return The new heart-beat connection factory.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public static ConnectionFactory newHeartBeatConnectionFactory(
-      final ConnectionFactory factory)
-  {
-    return new HeartBeatConnectionFactory(factory);
-  }
+    /**
+     * Creates a new connection factory which binds internal client connections
+     * to {@link ServerConnection}s created using the provided
+     * {@link ServerConnectionFactory}.
+     * <p>
+     * When processing requests, {@code ServerConnection} implementations are
+     * passed an integer as the first parameter. This integer represents a
+     * pseudo {@code requestID} which is incremented for each successive
+     * internal request on a per client connection basis. The request ID may be
+     * useful for logging purposes.
+     * <p>
+     * An internal connection factory does not require {@code ServerConnection}
+     * implementations to return a result when processing requests. However, it
+     * is recommended that implementations do always return results even for
+     * abandoned requests. This is because application client threads may block
+     * indefinitely waiting for results.
+     *
+     * @param <C>
+     *            The type of client context.
+     * @param factory
+     *            The server connection factory to use for creating connections.
+     * @param clientContext
+     *            The client context.
+     * @return The new internal connection factory.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public static <C> ConnectionFactory newInternalConnectionFactory(
+            final ServerConnectionFactory<C, Integer> factory, final C clientContext) {
+        Validator.ensureNotNull(factory);
+        return new InternalConnectionFactory<C>(factory, clientContext);
+    }
 
+    /**
+     * Creates a new load balancer which will obtain connections using the
+     * provided load balancing algorithm.
+     *
+     * @param algorithm
+     *            The load balancing algorithm which will be used to obtain the
+     *            next
+     * @return The new load balancer.
+     * @throws NullPointerException
+     *             If {@code algorithm} was {@code null}.
+     */
+    public static ConnectionFactory newLoadBalancer(final LoadBalancingAlgorithm algorithm) {
+        return new LoadBalancer(algorithm);
+    }
 
+    /**
+     * Creates a new connection factory which forwards connection requests to
+     * the provided factory, but whose {@code toString} method will always
+     * return {@code name}.
+     * <p>
+     * This method may be useful for debugging purposes in order to more easily
+     * identity connection factories.
+     *
+     * @param factory
+     *            The connection factory to be named.
+     * @param name
+     *            The name of the connection factory.
+     * @return The named connection factory.
+     * @throws NullPointerException
+     *             If {@code factory} or {@code name} was {@code null}.
+     */
+    public static ConnectionFactory newNamedConnectionFactory(final ConnectionFactory factory,
+            final String name) {
+        Validator.ensureNotNull(factory, name);
 
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections in order to detect that they are still alive using the
-   * specified frequency and the default scheduler.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   * @return The new heart-beat connection factory.
-   * @throws IllegalArgumentException
-   *           If {@code interval} was negative.
-   * @throws NullPointerException
-   *           If {@code factory} or {@code unit} was {@code null}.
-   */
-  public static ConnectionFactory newHeartBeatConnectionFactory(
-      final ConnectionFactory factory, final long interval, final TimeUnit unit)
-  {
-    return new HeartBeatConnectionFactory(factory, interval, unit);
-  }
+        return new ConnectionFactory() {
 
+            @Override
+            public FutureResult<Connection> getConnectionAsync(
+                    final ResultHandler<? super Connection> handler) {
+                return factory.getConnectionAsync(handler);
+            }
 
+            @Override
+            public Connection getConnection() throws ErrorResultException, InterruptedException {
+                return factory.getConnection();
+            }
 
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections using the specified search request in order to detect that they
-   * are still alive.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   * @param heartBeat
-   *          The search request to use for keepalive pings.
-   * @return The new heart-beat connection factory.
-   * @throws IllegalArgumentException
-   *           If {@code interval} was negative.
-   * @throws NullPointerException
-   *           If {@code factory}, {@code unit}, or {@code heartBeat} was {@code null}.
-   */
-  public static ConnectionFactory newHeartBeatConnectionFactory(
-      final ConnectionFactory factory, final long interval, final TimeUnit unit,
-      final SearchRequest heartBeat)
-  {
-    return new HeartBeatConnectionFactory(factory, interval, unit, heartBeat);
-  }
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public String toString() {
+                return name;
+            }
 
+        };
+    }
 
+    /**
+     * Creates a new server connection factory using the provided
+     * {@link RequestHandler}. The returned factory will manage connection and
+     * request life-cycle, including request cancellation.
+     * <p>
+     * When processing requests, {@link RequestHandler} implementations are
+     * passed a {@link RequestContext} as the first parameter which may be used
+     * for detecting whether or not the request should be aborted due to
+     * cancellation requests or other events, such as connection failure.
+     * <p>
+     * The returned factory maintains state information which includes a table
+     * of active requests. Therefore, {@code RequestHandler} implementations are
+     * required to always return results in order to avoid potential memory
+     * leaks.
+     *
+     * @param <C>
+     *            The type of client context.
+     * @param requestHandler
+     *            The request handler which will be used for all client
+     *            connections.
+     * @return The new server connection factory.
+     * @throws NullPointerException
+     *             If {@code requestHandler} was {@code null}.
+     */
+    public static <C> ServerConnectionFactory<C, Integer> newServerConnectionFactory(
+            final RequestHandler<RequestContext> requestHandler) {
+        Validator.ensureNotNull(requestHandler);
 
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections using the specified search request in order to detect that they
-   * are still alive.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   * @param heartBeat
-   *          The search request to use for keepalive pings.
-   * @param scheduler
-   *          The scheduler which should for periodically sending keepalive
-   *          pings.
-   * @return The new heart-beat connection factory.
-   * @throws IllegalArgumentException
-   *           If {@code interval} was negative.
-   * @throws NullPointerException
-   *           If {@code factory}, {@code unit}, or {@code heartBeat} was
-   *           {@code null}.
-   */
-  public static ConnectionFactory newHeartBeatConnectionFactory(
-      final ConnectionFactory factory, final long interval,
-      final TimeUnit unit, final SearchRequest heartBeat,
-      final ScheduledExecutorService scheduler)
-  {
-    return new HeartBeatConnectionFactory(factory, interval, unit, heartBeat,
-        scheduler);
-  }
+        final RequestHandlerFactory<C, RequestContext> factory =
+                new RequestHandlerFactory<C, RequestContext>() {
 
+                    public RequestHandler<RequestContext> handleAccept(C clientContext)
+                            throws ErrorResultException {
+                        return requestHandler;
+                    }
+                };
 
+        return new RequestHandlerFactoryAdapter<C>(factory);
+    }
 
-  /**
-   * Creates a new connection factory which binds internal client connections to
-   * {@link ServerConnection}s created using the provided
-   * {@link ServerConnectionFactory}.
-   * <p>
-   * When processing requests, {@code ServerConnection} implementations are
-   * passed an integer as the first parameter. This integer represents a pseudo
-   * {@code requestID} which is incremented for each successive internal request
-   * on a per client connection basis. The request ID may be useful for logging
-   * purposes.
-   * <p>
-   * An internal connection factory does not require {@code ServerConnection}
-   * implementations to return a result when processing requests. However, it is
-   * recommended that implementations do always return results even for
-   * abandoned requests. This is because application client threads may block
-   * indefinitely waiting for results.
-   *
-   * @param <C>
-   *          The type of client context.
-   * @param factory
-   *          The server connection factory to use for creating connections.
-   * @param clientContext
-   *          The client context.
-   * @return The new internal connection factory.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public static <C> ConnectionFactory newInternalConnectionFactory(
-      final ServerConnectionFactory<C, Integer> factory, final C clientContext)
-  {
-    Validator.ensureNotNull(factory);
-    return new InternalConnectionFactory<C>(factory, clientContext);
-  }
+    /**
+     * Creates a new server connection factory using the provided
+     * {@link RequestHandlerFactory}. The returned factory will manage
+     * connection and request life-cycle, including request cancellation.
+     * <p>
+     * When processing requests, {@link RequestHandler} implementations are
+     * passed a {@link RequestContext} as the first parameter which may be used
+     * for detecting whether or not the request should be aborted due to
+     * cancellation requests or other events, such as connection failure.
+     * <p>
+     * The returned factory maintains state information which includes a table
+     * of active requests. Therefore, {@code RequestHandler} implementations are
+     * required to always return results in order to avoid potential memory
+     * leaks.
+     *
+     * @param <C>
+     *            The type of client context.
+     * @param factory
+     *            The request handler factory to use for associating request
+     *            handlers with client connections.
+     * @return The new server connection factory.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public static <C> ServerConnectionFactory<C, Integer> newServerConnectionFactory(
+            final RequestHandlerFactory<C, RequestContext> factory) {
+        Validator.ensureNotNull(factory);
+        return new RequestHandlerFactoryAdapter<C>(factory);
+    }
 
-
-
-  /**
-   * Creates a new load balancer which will obtain connections using the
-   * provided load balancing algorithm.
-   *
-   * @param algorithm
-   *          The load balancing algorithm which will be used to obtain the next
-   * @return The new load balancer.
-   * @throws NullPointerException
-   *           If {@code algorithm} was {@code null}.
-   */
-  public static ConnectionFactory newLoadBalancer(
-      final LoadBalancingAlgorithm algorithm)
-  {
-    return new LoadBalancer(algorithm);
-  }
-
-
-
-  /**
-   * Creates a new connection factory which forwards connection requests to the
-   * provided factory, but whose {@code toString} method will always return
-   * {@code name}.
-   * <p>
-   * This method may be useful for debugging purposes in order to more easily
-   * identity connection factories.
-   *
-   * @param factory
-   *          The connection factory to be named.
-   * @param name
-   *          The name of the connection factory.
-   * @return The named connection factory.
-   * @throws NullPointerException
-   *           If {@code factory} or {@code name} was {@code null}.
-   */
-  public static ConnectionFactory newNamedConnectionFactory(
-      final ConnectionFactory factory, final String name)
-  {
-    Validator.ensureNotNull(factory, name);
-
-    return new ConnectionFactory()
-    {
-
-      @Override
-      public FutureResult<Connection> getConnectionAsync(
-          final ResultHandler<? super Connection> handler)
-      {
-        return factory.getConnectionAsync(handler);
-      }
-
-
-
-      @Override
-      public Connection getConnection() throws ErrorResultException,
-          InterruptedException
-      {
-        return factory.getConnection();
-      }
-
-
-
-      /**
-       * {@inheritDoc}
-       */
-      @Override
-      public String toString()
-      {
-        return name;
-      }
-
-    };
-  }
-
-
-
-  /**
-   * Creates a new server connection factory using the provided
-   * {@link RequestHandler}. The returned factory will manage connection and
-   * request life-cycle, including request cancellation.
-   * <p>
-   * When processing requests, {@link RequestHandler} implementations are passed
-   * a {@link RequestContext} as the first parameter which may be used for
-   * detecting whether or not the request should be aborted due to cancellation
-   * requests or other events, such as connection failure.
-   * <p>
-   * The returned factory maintains state information which includes a table of
-   * active requests. Therefore, {@code RequestHandler} implementations are
-   * required to always return results in order to avoid potential memory leaks.
-   *
-   * @param <C>
-   *          The type of client context.
-   * @param requestHandler
-   *          The request handler which will be used for all client connections.
-   * @return The new server connection factory.
-   * @throws NullPointerException
-   *           If {@code requestHandler} was {@code null}.
-   */
-  public static <C> ServerConnectionFactory<C, Integer> newServerConnectionFactory(
-      final RequestHandler<RequestContext> requestHandler)
-  {
-    Validator.ensureNotNull(requestHandler);
-
-    final RequestHandlerFactory<C, RequestContext> factory =
-      new RequestHandlerFactory<C, RequestContext>()
-    {
-
-      public RequestHandler<RequestContext> handleAccept(
-          C clientContext) throws ErrorResultException
-      {
-        return requestHandler;
-      }
-    };
-
-    return new RequestHandlerFactoryAdapter<C>(factory);
-  }
-
-
-
-  /**
-   * Creates a new server connection factory using the provided
-   * {@link RequestHandlerFactory}. The returned factory will manage connection
-   * and request life-cycle, including request cancellation.
-   * <p>
-   * When processing requests, {@link RequestHandler} implementations are passed
-   * a {@link RequestContext} as the first parameter which may be used for
-   * detecting whether or not the request should be aborted due to cancellation
-   * requests or other events, such as connection failure.
-   * <p>
-   * The returned factory maintains state information which includes a table of
-   * active requests. Therefore, {@code RequestHandler} implementations are
-   * required to always return results in order to avoid potential memory leaks.
-   *
-   * @param <C>
-   *          The type of client context.
-   * @param factory
-   *          The request handler factory to use for associating request
-   *          handlers with client connections.
-   * @return The new server connection factory.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public static <C> ServerConnectionFactory<C, Integer> newServerConnectionFactory(
-      final RequestHandlerFactory<C, RequestContext> factory)
-  {
-    Validator.ensureNotNull(factory);
-    return new RequestHandlerFactoryAdapter<C>(factory);
-  }
-
-
-
-  // Prevent instantiation.
-  private Connections()
-  {
-    // Do nothing.
-  }
+    // Prevent instantiation.
+    private Connections() {
+        // Do nothing.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java
index 093f8a2..7a1857b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the update
  * Request failed because it would have left the Directory in an inconsistent
@@ -71,10 +66,8 @@
  * </ul>
  */
 @SuppressWarnings("serial")
-public class ConstraintViolationException extends ErrorResultException
-{
-  ConstraintViolationException(final Result result)
-  {
-    super(result);
-  }
+public class ConstraintViolationException extends ErrorResultException {
+    ConstraintViolationException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DN.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DN.java
index bfa4ff8..ef3f314 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DN.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DN.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,13 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_DN_TYPE_NOT_FOUND;
 
-import java.util.*;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.WeakHashMap;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -42,8 +43,6 @@
 import com.forgerock.opendj.util.SubstringReader;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A distinguished name (DN) as defined in RFC 4512 section 2.3 is the
  * concatenation of its relative distinguished name (RDN) and its immediate
@@ -60,895 +59,721 @@
  *      Lightweight Directory Access Protocol (LDAP): Directory Information
  *      Models </a>
  */
-public final class DN implements Iterable<RDN>, Comparable<DN>
-{
-  private static final DN ROOT_DN = new DN(null, null, "");
+public final class DN implements Iterable<RDN>, Comparable<DN> {
+    private static final DN ROOT_DN = new DN(null, null, "");
 
-  // This is the size of the per-thread per-schema DN cache. We should
-  // be conservative here in case there are many threads. We will only
-  // cache parent DNs, so there's no need for it to be big.
-  private static final int DN_CACHE_SIZE = 32;
+    // This is the size of the per-thread per-schema DN cache. We should
+    // be conservative here in case there are many threads. We will only
+    // cache parent DNs, so there's no need for it to be big.
+    private static final int DN_CACHE_SIZE = 32;
 
-  private static final ThreadLocal<WeakHashMap<Schema, Map<String, DN>>> CACHE =
-    new ThreadLocal<WeakHashMap<Schema, Map<String, DN>>>()
-  {
+    private static final ThreadLocal<WeakHashMap<Schema, Map<String, DN>>> CACHE =
+            new ThreadLocal<WeakHashMap<Schema, Map<String, DN>>>() {
+
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
+                protected WeakHashMap<Schema, Map<String, DN>> initialValue() {
+                    return new WeakHashMap<Schema, Map<String, DN>>();
+                }
+
+            };
+
+    /**
+     * Returns the Root DN. The Root DN does not contain and RDN components and
+     * is superior to all other DNs.
+     *
+     * @return The Root DN.
+     */
+    public static DN rootDN() {
+        return ROOT_DN;
+    }
+
+    /**
+     * Parses the provided LDAP string representation of a DN using the default
+     * schema.
+     *
+     * @param dn
+     *            The LDAP string representation of a DN.
+     * @return The parsed DN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public static DN valueOf(final String dn) {
+        return valueOf(dn, Schema.getDefaultSchema());
+    }
+
+    /**
+     * Parses the provided LDAP string representation of a DN using the provided
+     * schema.
+     *
+     * @param dn
+     *            The LDAP string representation of a DN.
+     * @param schema
+     *            The schema to use when parsing the DN.
+     * @return The parsed DN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} or {@code schema} was {@code null}.
+     */
+    public static DN valueOf(final String dn, final Schema schema) {
+        Validator.ensureNotNull(dn, schema);
+        if (dn.length() == 0) {
+            return ROOT_DN;
+        }
+
+        // First check if DN is already cached.
+        final Map<String, DN> cache = getCache(schema);
+        final DN cachedDN = cache.get(dn);
+        if (cachedDN != null) {
+            return cachedDN;
+        }
+
+        // Not in cache so decode.
+        final SubstringReader reader = new SubstringReader(dn);
+        return decode(dn, reader, schema, cache);
+    }
+
+    /**
+     * Compares the provided DN values to determine their relative order in a
+     * sorted list.
+     *
+     * @param dn1
+     *            The first DN to be compared. It must not be {@code null}.
+     * @param dn2
+     *            The second DN to be compared. It must not be {@code null}.
+     * @return A negative integer if the first DN should come before the second
+     *         DN in a sorted list, a positive integer if the first DN should
+     *         come after the second DN in a sorted list, or zero if the two DN
+     *         values can be considered equal.
+     */
+    private static int compareTo(final DN dn1, final DN dn2) {
+        // Quickly check if we are comparing against root dse.
+        if (dn1.isRootDN()) {
+            if (dn2.isRootDN()) {
+                // both are equal.
+                return 0;
+            } else {
+                // dn1 comes before dn2.
+                return -1;
+            }
+        }
+
+        if (dn2.isRootDN()) {
+            // dn1 comes after dn2.
+            return 1;
+        }
+
+        int dn1Size = dn1.size - 1;
+        int dn2Size = dn2.size - 1;
+        while (dn1Size >= 0 && dn2Size >= 0) {
+            final DN dn1Parent = dn1.parent(dn1Size--);
+            final DN dn2Parent = dn2.parent(dn2Size--);
+            final int result = dn1Parent.rdn.compareTo(dn2Parent.rdn);
+            if (result > 0) {
+                return 1;
+            } else if (result < 0) {
+                return -1;
+            }
+        }
+
+        // What do we have here?
+        if (dn1Size > dn2Size) {
+            return 1;
+        } else if (dn1Size < dn2Size) {
+            return -1;
+        }
+
+        return 0;
+    }
+
+    // Decodes a DN using the provided reader and schema.
+    private static DN decode(final String dnString, final SubstringReader reader,
+            final Schema schema, final Map<String, DN> cache) {
+        reader.skipWhitespaces();
+        if (reader.remaining() == 0) {
+            return ROOT_DN;
+        }
+
+        RDN rdn;
+        try {
+            rdn = RDN.decode(null, reader, schema);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_DN_TYPE_NOT_FOUND.get(reader.getString(), e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        DN parent;
+        if (reader.remaining() > 0 && reader.read() == ',') {
+            reader.mark();
+            final String parentString = reader.read(reader.remaining());
+
+            parent = cache.get(parentString);
+            if (parent == null) {
+                reader.reset();
+                parent = decode(parentString, reader, schema, cache);
+
+                // Only cache parent DNs since leaf DNs are likely to make the
+                // cache to volatile.
+                cache.put(parentString, parent);
+            }
+        } else {
+            parent = ROOT_DN;
+        }
+
+        return new DN(parent, rdn, dnString);
+    }
+
+    @SuppressWarnings("serial")
+    private static Map<String, DN> getCache(final Schema schema) {
+        final WeakHashMap<Schema, Map<String, DN>> threadLocalMap = CACHE.get();
+        Map<String, DN> schemaLocalMap = threadLocalMap.get(schema);
+
+        if (schemaLocalMap == null) {
+            schemaLocalMap = new LinkedHashMap<String, DN>(DN_CACHE_SIZE, 0.75f, true) {
+                @Override
+                protected boolean removeEldestEntry(final Map.Entry<String, DN> e) {
+                    return size() > DN_CACHE_SIZE;
+                }
+            };
+            threadLocalMap.put(schema, schemaLocalMap);
+        }
+        return schemaLocalMap;
+    }
+
+    private final RDN rdn;
+
+    private DN parent;
+
+    private final int size;
+
+    // We need to store the original string value if provided in order to
+    // preserve the original whitespace.
+    private String stringValue;
+
+    // Private constructor.
+    private DN(final DN parent, final RDN rdn, final String stringValue) {
+        this(parent, rdn, stringValue, parent != null ? parent.size + 1 : 0);
+    }
+
+    // Private constructor.
+    private DN(final DN parent, final RDN rdn, final String stringValue, final int size) {
+        this.parent = parent;
+        this.rdn = rdn;
+        this.stringValue = stringValue;
+        this.size = size;
+    }
+
+    /**
+     * Returns a DN which is subordinate to this DN and having the additional
+     * RDN components contained in the provided DN.
+     *
+     * @param dn
+     *            The DN containing the RDN components to be added to this DN.
+     * @return The subordinate DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public DN child(final DN dn) {
+        Validator.ensureNotNull(dn);
+
+        if (dn.isRootDN()) {
+            return this;
+        } else if (isRootDN()) {
+            return dn;
+        } else {
+            final RDN[] rdns = new RDN[dn.size()];
+            int i = rdns.length;
+            for (DN next = dn; next.rdn != null; next = next.parent) {
+                rdns[--i] = next.rdn;
+            }
+            DN newDN = this;
+            for (i = 0; i < rdns.length; i++) {
+                newDN = new DN(newDN, rdns[i], null);
+            }
+            return newDN;
+        }
+    }
+
+    /**
+     * Returns a DN which is an immediate child of this DN and having the
+     * specified RDN.
+     * <p>
+     * <b>Note:</b> the child DN whose RDN is {@link RDN#maxValue()} compares
+     * greater than all other possible child DNs, and may be used to construct
+     * range queries against DN keyed sorted collections such as
+     * {@code SortedSet} and {@code SortedMap}.
+     *
+     * @param rdn
+     *            The RDN for the child DN.
+     * @return The child DN.
+     * @throws NullPointerException
+     *             If {@code rdn} was {@code null}.
+     * @see RDN#maxValue()
+     */
+    public DN child(final RDN rdn) {
+        Validator.ensureNotNull(rdn);
+        return new DN(this, rdn, null);
+    }
+
+    /**
+     * Returns a DN which is subordinate to this DN and having the additional
+     * RDN components contained in the provided DN decoded using the default
+     * schema.
+     *
+     * @param dn
+     *            The DN containing the RDN components to be added to this DN.
+     * @return The subordinate DN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public DN child(final String dn) {
+        Validator.ensureNotNull(dn);
+        return child(valueOf(dn));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final DN dn) {
+        return compareTo(this, dn);
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected WeakHashMap<Schema, Map<String, DN>> initialValue()
-    {
-      return new WeakHashMap<Schema, Map<String, DN>>();
-    }
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof DN) {
+            DN other = (DN) obj;
+            if (size == other.size()) {
+                if (size == 0) {
+                    return true;
+                }
 
-  };
-
-
-
-  /**
-   * Returns the Root DN. The Root DN does not contain and RDN components and is
-   * superior to all other DNs.
-   *
-   * @return The Root DN.
-   */
-  public static DN rootDN()
-  {
-    return ROOT_DN;
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of a DN using the default
-   * schema.
-   *
-   * @param dn
-   *          The LDAP string representation of a DN.
-   * @return The parsed DN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public static DN valueOf(final String dn)
-  {
-    return valueOf(dn, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of a DN using the provided
-   * schema.
-   *
-   * @param dn
-   *          The LDAP string representation of a DN.
-   * @param schema
-   *          The schema to use when parsing the DN.
-   * @return The parsed DN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} or {@code schema} was {@code null}.
-   */
-  public static DN valueOf(final String dn, final Schema schema)
-  {
-    Validator.ensureNotNull(dn, schema);
-    if (dn.length() == 0)
-    {
-      return ROOT_DN;
-    }
-
-    // First check if DN is already cached.
-    final Map<String, DN> cache = getCache(schema);
-    final DN cachedDN = cache.get(dn);
-    if (cachedDN != null)
-    {
-      return cachedDN;
-    }
-
-    // Not in cache so decode.
-    final SubstringReader reader = new SubstringReader(dn);
-    return decode(dn, reader, schema, cache);
-  }
-
-
-
-  /**
-   * Compares the provided DN values to determine their relative order in a
-   * sorted list.
-   *
-   * @param dn1
-   *          The first DN to be compared. It must not be {@code null}.
-   * @param dn2
-   *          The second DN to be compared. It must not be {@code null}.
-   * @return A negative integer if the first DN should come before the second DN
-   *         in a sorted list, a positive integer if the first DN should come
-   *         after the second DN in a sorted list, or zero if the two DN values
-   *         can be considered equal.
-   */
-  private static int compareTo(final DN dn1, final DN dn2)
-  {
-    // Quickly check if we are comparing against root dse.
-    if (dn1.isRootDN())
-    {
-      if (dn2.isRootDN())
-      {
-        // both are equal.
-        return 0;
-      }
-      else
-      {
-        // dn1 comes before dn2.
-        return -1;
-      }
-    }
-
-    if (dn2.isRootDN())
-    {
-      // dn1 comes after dn2.
-      return 1;
-    }
-
-    int dn1Size = dn1.size - 1;
-    int dn2Size = dn2.size - 1;
-    while (dn1Size >= 0 && dn2Size >= 0)
-    {
-      final DN dn1Parent = dn1.parent(dn1Size--);
-      final DN dn2Parent = dn2.parent(dn2Size--);
-      final int result = dn1Parent.rdn.compareTo(dn2Parent.rdn);
-      if (result > 0)
-      {
-        return 1;
-      }
-      else if (result < 0)
-      {
-        return -1;
-      }
-    }
-
-    // What do we have here?
-    if (dn1Size > dn2Size)
-    {
-      return 1;
-    }
-    else if (dn1Size < dn2Size)
-    {
-      return -1;
-    }
-
-    return 0;
-  }
-
-
-
-  // Decodes a DN using the provided reader and schema.
-  private static DN decode(final String dnString, final SubstringReader reader,
-      final Schema schema, final Map<String, DN> cache)
-  {
-    reader.skipWhitespaces();
-    if (reader.remaining() == 0)
-    {
-      return ROOT_DN;
-    }
-
-    RDN rdn;
-    try
-    {
-      rdn = RDN.decode(null, reader, schema);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_DN_TYPE_NOT_FOUND.get(reader
-          .getString(), e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    DN parent;
-    if (reader.remaining() > 0 && reader.read() == ',')
-    {
-      reader.mark();
-      final String parentString = reader.read(reader.remaining());
-
-      parent = cache.get(parentString);
-      if (parent == null)
-      {
-        reader.reset();
-        parent = decode(parentString, reader, schema, cache);
-
-        // Only cache parent DNs since leaf DNs are likely to make the
-        // cache to volatile.
-        cache.put(parentString, parent);
-      }
-    }
-    else
-    {
-      parent = ROOT_DN;
-    }
-
-    return new DN(parent, rdn, dnString);
-  }
-
-
-
-  @SuppressWarnings("serial")
-  private static Map<String, DN> getCache(final Schema schema)
-  {
-    final WeakHashMap<Schema, Map<String, DN>> threadLocalMap = CACHE.get();
-    Map<String, DN> schemaLocalMap = threadLocalMap.get(schema);
-
-    if (schemaLocalMap == null)
-    {
-      schemaLocalMap = new LinkedHashMap<String, DN>(DN_CACHE_SIZE, 0.75f, true)
-      {
-        @Override
-        protected boolean removeEldestEntry(final Map.Entry<String, DN> e)
-        {
-          return size() > DN_CACHE_SIZE;
-        }
-      };
-      threadLocalMap.put(schema, schemaLocalMap);
-    }
-    return schemaLocalMap;
-  }
-
-
-
-  private final RDN rdn;
-
-  private DN parent;
-
-  private final int size;
-
-  // We need to store the original string value if provided in order to
-  // preserve the original whitespace.
-  private String stringValue;
-
-
-
-  // Private constructor.
-  private DN(final DN parent, final RDN rdn, final String stringValue)
-  {
-    this(parent, rdn, stringValue, parent != null ? parent.size + 1 : 0);
-  }
-
-
-
-  // Private constructor.
-  private DN(final DN parent, final RDN rdn, final String stringValue,
-      final int size)
-  {
-    this.parent = parent;
-    this.rdn = rdn;
-    this.stringValue = stringValue;
-    this.size = size;
-  }
-
-
-
-  /**
-   * Returns a DN which is subordinate to this DN and having the additional RDN
-   * components contained in the provided DN.
-   *
-   * @param dn
-   *          The DN containing the RDN components to be added to this DN.
-   * @return The subordinate DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public DN child(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-
-    if (dn.isRootDN())
-    {
-      return this;
-    }
-    else if (isRootDN())
-    {
-      return dn;
-    }
-    else
-    {
-      final RDN[] rdns = new RDN[dn.size()];
-      int i = rdns.length;
-      for (DN next = dn; next.rdn != null; next = next.parent)
-      {
-        rdns[--i] = next.rdn;
-      }
-      DN newDN = this;
-      for (i = 0; i < rdns.length; i++)
-      {
-        newDN = new DN(newDN, rdns[i], null);
-      }
-      return newDN;
-    }
-  }
-
-
-
-  /**
-   * Returns a DN which is an immediate child of this DN and having the
-   * specified RDN.
-   * <p>
-   * <b>Note:</b> the child DN whose RDN is {@link RDN#maxValue()} compares
-   * greater than all other possible child DNs, and may be used to construct
-   * range queries against DN keyed sorted collections such as {@code SortedSet}
-   * and {@code SortedMap}.
-   *
-   * @param rdn
-   *          The RDN for the child DN.
-   * @return The child DN.
-   * @throws NullPointerException
-   *           If {@code rdn} was {@code null}.
-   * @see RDN#maxValue()
-   */
-  public DN child(final RDN rdn)
-  {
-    Validator.ensureNotNull(rdn);
-    return new DN(this, rdn, null);
-  }
-
-
-
-  /**
-   * Returns a DN which is subordinate to this DN and having the additional RDN
-   * components contained in the provided DN decoded using the default schema.
-   *
-   * @param dn
-   *          The DN containing the RDN components to be added to this DN.
-   * @return The subordinate DN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public DN child(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-    return child(valueOf(dn));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final DN dn)
-  {
-    return compareTo(this, dn);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
-    }
-    else if (obj instanceof DN)
-    {
-      DN other = (DN)obj;
-      if(size == other.size())
-      {
-        if(size == 0)
-        {
-          return true;
+                if (rdn.equals(other.rdn)) {
+                    return parent.equals(other.parent);
+                }
+            }
         }
 
-        if(rdn.equals(other.rdn))
-        {
-          return parent.equals(other.parent);
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        if (size == 0) {
+            return 0;
+        } else {
+            return 31 * parent.hashCode() + rdn.hashCode();
         }
-      }
     }
 
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    if (size == 0)
-    {
-      return 0;
+    /**
+     * Returns {@code true} if this DN is an immediate child of the provided DN.
+     *
+     * @param dn
+     *            The potential parent DN.
+     * @return {@code true} if this DN is the immediate child of the provided
+     *         DN, otherwise {@code false}.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isChildOf(final DN dn) {
+        // If this is the Root DN then parent will be null but this is ok.
+        return dn.equals(parent);
     }
-    else
-    {
-      return 31 * parent.hashCode() + rdn.hashCode();
+
+    /**
+     * Returns {@code true} if this DN is an immediate child of the provided DN
+     * decoded using the default schema.
+     *
+     * @param dn
+     *            The potential parent DN.
+     * @return {@code true} if this DN is the immediate child of the provided
+     *         DN, otherwise {@code false}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isChildOf(final String dn) {
+        // If this is the Root DN then parent will be null but this is ok.
+        return isChildOf(valueOf(dn));
     }
-  }
 
-
-
-  /**
-   * Returns {@code true} if this DN is an immediate child of the provided DN.
-   *
-   * @param dn
-   *          The potential parent DN.
-   * @return {@code true} if this DN is the immediate child of the provided DN,
-   *         otherwise {@code false}.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isChildOf(final DN dn)
-  {
-    // If this is the Root DN then parent will be null but this is ok.
-    return dn.equals(parent);
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is an immediate child of the provided DN
-   * decoded using the default schema.
-   *
-   * @param dn
-   *          The potential parent DN.
-   * @return {@code true} if this DN is the immediate child of the provided DN,
-   *         otherwise {@code false}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isChildOf(final String dn)
-  {
-    // If this is the Root DN then parent will be null but this is ok.
-    return isChildOf(valueOf(dn));
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN matches the provided base DN and search
-   * scope.
-   *
-   * @param dn
-   *          The base DN.
-   * @param scope
-   *          The search scope.
-   * @return {@code true} if this DN matches the provided base DN and search
-   *         scope, otherwise {@code false}.
-   * @throws NullPointerException
-   *           If {@code dn} or {@code scope} was {@code null}.
-   */
-  public boolean isInScopeOf(DN dn, SearchScope scope)
-  {
-    if (scope == SearchScope.BASE_OBJECT)
-    {
-      // The base DN must equal this DN.
-      return equals(dn);
-    }
-    else if (scope == SearchScope.SINGLE_LEVEL)
-    {
-      // The parent DN must equal the base DN.
-      return isChildOf(dn);
-    }
-    else if (scope == SearchScope.SUBORDINATES)
-    {
-      // This DN must be a descendant of the provided base DN, but
-      // not equal to it.
-      return isSubordinateOrEqualTo(dn) && !equals(dn);
-    }
-    else if (scope == SearchScope.WHOLE_SUBTREE)
-    {
-      // This DN must be a descendant of the provided base DN.
-      return isSubordinateOrEqualTo(dn);
-    }
-    else
-    {
-      // This is a scope that we don't recognize.
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN matches the provided base DN and search
-   * scope.
-   *
-   * @param dn
-   *          The base DN.
-   * @param scope
-   *          The search scope.
-   * @return {@code true} if this DN matches the provided base DN and search
-   *         scope, otherwise {@code false}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} or {@code scope} was {@code null}.
-   */
-  public boolean isInScopeOf(String dn, SearchScope scope)
-  {
-    return isInScopeOf(valueOf(dn), scope);
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is the immediate parent of the provided DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is the immediate parent of the provided DN,
-   *         otherwise {@code false}.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isParentOf(final DN dn)
-  {
-    // If dn is the Root DN then parent will be null but this is ok.
-    return equals(dn.parent);
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is the immediate parent of the provided DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is the immediate parent of the provided DN,
-   *         otherwise {@code false}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isParentOf(final String dn)
-  {
-    // If dn is the Root DN then parent will be null but this is ok.
-    return isParentOf(valueOf(dn));
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is the Root DN.
-   *
-   * @return {@code true} if this DN is the Root DN, otherwise {@code false}.
-   */
-  public boolean isRootDN()
-  {
-    return size == 0;
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is subordinate to or equal to the provided
-   * DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is subordinate to or equal to the provided
-   *         DN, otherwise {@code false}.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isSubordinateOrEqualTo(final DN dn)
-  {
-    if (size < dn.size)
-    {
-      return false;
-    }
-    else if (size == dn.size)
-    {
-      return equals(dn);
-    }
-    else
-    {
-      // dn is a potential superior of this.
-      return parent(size - dn.size).equals(dn);
-    }
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is subordinate to or equal to the provided
-   * DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is subordinate to or equal to the provided
-   *         DN, otherwise {@code false}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isSubordinateOrEqualTo(final String dn)
-  {
-    return isSubordinateOrEqualTo(valueOf(dn));
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is superior to or equal to the provided DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is superior to or equal to the provided DN,
-   *         otherwise {@code false}.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isSuperiorOrEqualTo(final DN dn)
-  {
-    if (size > dn.size)
-    {
-      return false;
-    }
-    else if (size == dn.size)
-    {
-      return equals(dn);
-    }
-    else
-    {
-      // dn is a potential subordinate of this.
-      return dn.parent(dn.size - size).equals(this);
-    }
-  }
-
-
-
-  /**
-   * Returns {@code true} if this DN is superior to or equal to the provided DN.
-   *
-   * @param dn
-   *          The potential child DN.
-   * @return {@code true} if this DN is superior to or equal to the provided DN,
-   *         otherwise {@code false}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} is not a valid LDAP string representation of a DN.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  public boolean isSuperiorOrEqualTo(final String dn)
-  {
-    return isSuperiorOrEqualTo(valueOf(dn));
-  }
-
-
-
-  /**
-   * Returns an iterator of the RDNs contained in this DN. The RDNs will be
-   * returned in the order starting with this DN's RDN, followed by the RDN of
-   * the parent DN, and so on.
-   * <p>
-   * Attempts to remove RDNs using an iterator's {@code remove()} method are not
-   * permitted and will result in an {@code UnsupportedOperationException} being
-   * thrown.
-   *
-   * @return An iterator of the RDNs contained in this DN.
-   */
-  public Iterator<RDN> iterator()
-  {
-    return new Iterator<RDN>()
-    {
-      private DN dn = DN.this;
-
-
-
-      public boolean hasNext()
-      {
-        return dn.rdn != null;
-      }
-
-
-
-      public RDN next()
-      {
-        if (dn.rdn == null)
-        {
-          throw new NoSuchElementException();
+    /**
+     * Returns {@code true} if this DN matches the provided base DN and search
+     * scope.
+     *
+     * @param dn
+     *            The base DN.
+     * @param scope
+     *            The search scope.
+     * @return {@code true} if this DN matches the provided base DN and search
+     *         scope, otherwise {@code false}.
+     * @throws NullPointerException
+     *             If {@code dn} or {@code scope} was {@code null}.
+     */
+    public boolean isInScopeOf(DN dn, SearchScope scope) {
+        if (scope == SearchScope.BASE_OBJECT) {
+            // The base DN must equal this DN.
+            return equals(dn);
+        } else if (scope == SearchScope.SINGLE_LEVEL) {
+            // The parent DN must equal the base DN.
+            return isChildOf(dn);
+        } else if (scope == SearchScope.SUBORDINATES) {
+            // This DN must be a descendant of the provided base DN, but
+            // not equal to it.
+            return isSubordinateOrEqualTo(dn) && !equals(dn);
+        } else if (scope == SearchScope.WHOLE_SUBTREE) {
+            // This DN must be a descendant of the provided base DN.
+            return isSubordinateOrEqualTo(dn);
+        } else {
+            // This is a scope that we don't recognize.
+            return false;
         }
+    }
 
-        final RDN rdn = dn.rdn;
-        dn = dn.parent;
+    /**
+     * Returns {@code true} if this DN matches the provided base DN and search
+     * scope.
+     *
+     * @param dn
+     *            The base DN.
+     * @param scope
+     *            The search scope.
+     * @return {@code true} if this DN matches the provided base DN and search
+     *         scope, otherwise {@code false}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} or {@code scope} was {@code null}.
+     */
+    public boolean isInScopeOf(String dn, SearchScope scope) {
+        return isInScopeOf(valueOf(dn), scope);
+    }
+
+    /**
+     * Returns {@code true} if this DN is the immediate parent of the provided
+     * DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is the immediate parent of the provided
+     *         DN, otherwise {@code false}.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isParentOf(final DN dn) {
+        // If dn is the Root DN then parent will be null but this is ok.
+        return equals(dn.parent);
+    }
+
+    /**
+     * Returns {@code true} if this DN is the immediate parent of the provided
+     * DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is the immediate parent of the provided
+     *         DN, otherwise {@code false}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isParentOf(final String dn) {
+        // If dn is the Root DN then parent will be null but this is ok.
+        return isParentOf(valueOf(dn));
+    }
+
+    /**
+     * Returns {@code true} if this DN is the Root DN.
+     *
+     * @return {@code true} if this DN is the Root DN, otherwise {@code false}.
+     */
+    public boolean isRootDN() {
+        return size == 0;
+    }
+
+    /**
+     * Returns {@code true} if this DN is subordinate to or equal to the
+     * provided DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is subordinate to or equal to the
+     *         provided DN, otherwise {@code false}.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isSubordinateOrEqualTo(final DN dn) {
+        if (size < dn.size) {
+            return false;
+        } else if (size == dn.size) {
+            return equals(dn);
+        } else {
+            // dn is a potential superior of this.
+            return parent(size - dn.size).equals(dn);
+        }
+    }
+
+    /**
+     * Returns {@code true} if this DN is subordinate to or equal to the
+     * provided DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is subordinate to or equal to the
+     *         provided DN, otherwise {@code false}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isSubordinateOrEqualTo(final String dn) {
+        return isSubordinateOrEqualTo(valueOf(dn));
+    }
+
+    /**
+     * Returns {@code true} if this DN is superior to or equal to the provided
+     * DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is superior to or equal to the provided
+     *         DN, otherwise {@code false}.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isSuperiorOrEqualTo(final DN dn) {
+        if (size > dn.size) {
+            return false;
+        } else if (size == dn.size) {
+            return equals(dn);
+        } else {
+            // dn is a potential subordinate of this.
+            return dn.parent(dn.size - size).equals(this);
+        }
+    }
+
+    /**
+     * Returns {@code true} if this DN is superior to or equal to the provided
+     * DN.
+     *
+     * @param dn
+     *            The potential child DN.
+     * @return {@code true} if this DN is superior to or equal to the provided
+     *         DN, otherwise {@code false}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} is not a valid LDAP string representation of a
+     *             DN.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    public boolean isSuperiorOrEqualTo(final String dn) {
+        return isSuperiorOrEqualTo(valueOf(dn));
+    }
+
+    /**
+     * Returns an iterator of the RDNs contained in this DN. The RDNs will be
+     * returned in the order starting with this DN's RDN, followed by the RDN of
+     * the parent DN, and so on.
+     * <p>
+     * Attempts to remove RDNs using an iterator's {@code remove()} method are
+     * not permitted and will result in an {@code UnsupportedOperationException}
+     * being thrown.
+     *
+     * @return An iterator of the RDNs contained in this DN.
+     */
+    public Iterator<RDN> iterator() {
+        return new Iterator<RDN>() {
+            private DN dn = DN.this;
+
+            public boolean hasNext() {
+                return dn.rdn != null;
+            }
+
+            public RDN next() {
+                if (dn.rdn == null) {
+                    throw new NoSuchElementException();
+                }
+
+                final RDN rdn = dn.rdn;
+                dn = dn.parent;
+                return rdn;
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        };
+    }
+
+    /**
+     * Returns the DN whose content is the specified number of RDNs from this
+     * DN. The following equivalences hold:
+     *
+     * <pre>
+     * dn.localName(0).isRootDN();
+     * dn.localName(1).equals(rootDN.child(dn.rdn()));
+     * dn.localName(dn.size()).equals(dn);
+     * </pre>
+     *
+     * @param index
+     *            The number of RDNs to be included in the local name.
+     * @return The DN whose content is the specified number of RDNs from this
+     *         DN.
+     * @throws IllegalArgumentException
+     *             If {@code index} is less than zero.
+     */
+    public DN localName(final int index) {
+        Validator.ensureTrue(index >= 0, "index less than zero");
+
+        if (index == 0) {
+            return ROOT_DN;
+        } else if (index >= size) {
+            return this;
+        } else {
+            final DN localName = new DN(null, rdn, null, index);
+            DN nextLocalName = localName;
+            DN lastDN = parent;
+            for (int i = index - 1; i > 0; i--) {
+                nextLocalName.parent = new DN(null, lastDN.rdn, null, i);
+                nextLocalName = nextLocalName.parent;
+                lastDN = lastDN.parent;
+            }
+            nextLocalName.parent = ROOT_DN;
+            return localName;
+        }
+    }
+
+    /**
+     * Returns the DN which is the immediate parent of this DN, or {@code null}
+     * if this DN is the Root DN.
+     * <p>
+     * This method is equivalent to:
+     *
+     * <pre>
+     * parent(1);
+     * </pre>
+     *
+     * @return The DN which is the immediate parent of this DN, or {@code null}
+     *         if this DN is the Root DN.
+     */
+    public DN parent() {
+        return parent;
+    }
+
+    /**
+     * Returns the DN which is equal to this DN with the specified number of
+     * RDNs removed. Note that if {@code index} is zero then this DN will be
+     * returned (identity).
+     *
+     * @param index
+     *            The number of RDNs to be removed.
+     * @return The DN which is equal to this DN with the specified number of
+     *         RDNs removed, or {@code null} if the parent of the Root DN is
+     *         reached.
+     * @throws IllegalArgumentException
+     *             If {@code index} is less than zero.
+     */
+    public DN parent(final int index) {
+        // We allow size + 1 so that we can return null as the parent of the
+        // Root DN.
+        Validator.ensureTrue(index >= 0, "index less than zero");
+
+        DN parentDN = this;
+        for (int i = 0; parentDN != null && i < index; i++) {
+            parentDN = parentDN.parent;
+        }
+        return parentDN;
+    }
+
+    /**
+     * Returns the RDN of this DN, or {@code null} if this DN is the Root DN.
+     *
+     * @return The RDN of this DN, or {@code null} if this DN is the Root DN.
+     */
+    public RDN rdn() {
         return rdn;
-      }
-
-
-
-      public void remove()
-      {
-        throw new UnsupportedOperationException();
-      }
-    };
-  }
-
-
-
-  /**
-   * Returns the DN whose content is the specified number of RDNs from this DN.
-   * The following equivalences hold:
-   *
-   * <pre>
-   * dn.localName(0).isRootDN();
-   * dn.localName(1).equals(rootDN.child(dn.rdn()));
-   * dn.localName(dn.size()).equals(dn);
-   * </pre>
-   *
-   * @param index
-   *          The number of RDNs to be included in the local name.
-   * @return The DN whose content is the specified number of RDNs from this DN.
-   * @throws IllegalArgumentException
-   *           If {@code index} is less than zero.
-   */
-  public DN localName(final int index)
-  {
-    Validator.ensureTrue(index >= 0, "index less than zero");
-
-    if (index == 0)
-    {
-      return ROOT_DN;
     }
-    else if (index >= size)
-    {
-      return this;
+
+    /**
+     * Returns a copy of this DN whose parent DN, {@code fromDN}, has been
+     * renamed to the new parent DN, {@code toDN}. If this DN is not subordinate
+     * or equal to {@code fromDN} then this DN is returned (i.e. the DN is not
+     * renamed).
+     *
+     * @param fromDN
+     *            The old parent DN.
+     * @param toDN
+     *            The new parent DN.
+     * @return The renamed DN, or this DN if no renaming was performed.
+     * @throws NullPointerException
+     *             If {@code fromDN} or {@code toDN} was {@code null}.
+     */
+    public DN rename(final DN fromDN, final DN toDN) {
+        Validator.ensureNotNull(fromDN, toDN);
+
+        if (!isSubordinateOrEqualTo(fromDN)) {
+            return this;
+        } else if (equals(fromDN)) {
+            return toDN;
+        } else {
+            return toDN.child(localName(size - fromDN.size));
+        }
     }
-    else
-    {
-      final DN localName = new DN(null, rdn, null, index);
-      DN nextLocalName = localName;
-      DN lastDN = parent;
-      for (int i = index - 1; i > 0; i--)
-      {
-        nextLocalName.parent = new DN(null, lastDN.rdn, null, i);
-        nextLocalName = nextLocalName.parent;
-        lastDN = lastDN.parent;
-      }
-      nextLocalName.parent = ROOT_DN;
-      return localName;
+
+    /**
+     * Returns the number of RDN components in this DN.
+     *
+     * @return The number of RDN components in this DN.
+     */
+    public int size() {
+        return size;
     }
-  }
 
-
-
-  /**
-   * Returns the DN which is the immediate parent of this DN, or {@code null} if
-   * this DN is the Root DN.
-   * <p>
-   * This method is equivalent to:
-   *
-   * <pre>
-   * parent(1);
-   * </pre>
-   *
-   * @return The DN which is the immediate parent of this DN, or {@code null} if
-   *         this DN is the Root DN.
-   */
-  public DN parent()
-  {
-    return parent;
-  }
-
-
-
-  /**
-   * Returns the DN which is equal to this DN with the specified number of RDNs
-   * removed. Note that if {@code index} is zero then this DN will be returned
-   * (identity).
-   *
-   * @param index
-   *          The number of RDNs to be removed.
-   * @return The DN which is equal to this DN with the specified number of RDNs
-   *         removed, or {@code null} if the parent of the Root DN is reached.
-   * @throws IllegalArgumentException
-   *           If {@code index} is less than zero.
-   */
-  public DN parent(final int index)
-  {
-    // We allow size + 1 so that we can return null as the parent of the
-    // Root DN.
-    Validator.ensureTrue(index >= 0, "index less than zero");
-
-    DN parentDN = this;
-    for (int i = 0; parentDN != null && i < index; i++)
-    {
-      parentDN = parentDN.parent;
+    /**
+     * Returns the RFC 4514 string representation of this DN.
+     *
+     * @return The RFC 4514 string representation of this DN.
+     * @see <a href="http://tools.ietf.org/html/rfc4514">RFC 4514 - Lightweight
+     *      Directory Access Protocol (LDAP): String Representation of
+     *      Distinguished Names </a>
+     */
+    @Override
+    public String toString() {
+        // We don't care about potential race conditions here.
+        if (stringValue == null) {
+            final StringBuilder builder = new StringBuilder();
+            rdn.toString(builder);
+            if (!parent.isRootDN()) {
+                builder.append(',');
+                builder.append(parent.toString());
+            }
+            stringValue = builder.toString();
+        }
+        return stringValue;
     }
-    return parentDN;
-  }
-
-
-
-  /**
-   * Returns the RDN of this DN, or {@code null} if this DN is the Root DN.
-   *
-   * @return The RDN of this DN, or {@code null} if this DN is the Root DN.
-   */
-  public RDN rdn()
-  {
-    return rdn;
-  }
-
-
-
-  /**
-   * Returns a copy of this DN whose parent DN, {@code fromDN}, has been renamed
-   * to the new parent DN, {@code toDN}. If this DN is not subordinate or equal
-   * to {@code fromDN} then this DN is returned (i.e. the DN is not renamed).
-   *
-   * @param fromDN
-   *          The old parent DN.
-   * @param toDN
-   *          The new parent DN.
-   * @return The renamed DN, or this DN if no renaming was performed.
-   * @throws NullPointerException
-   *           If {@code fromDN} or {@code toDN} was {@code null}.
-   */
-  public DN rename(final DN fromDN, final DN toDN)
-  {
-    Validator.ensureNotNull(fromDN, toDN);
-
-    if (!isSubordinateOrEqualTo(fromDN))
-    {
-      return this;
-    }
-    else if (equals(fromDN))
-    {
-      return toDN;
-    }
-    else
-    {
-      return toDN.child(localName(size - fromDN.size));
-    }
-  }
-
-
-
-  /**
-   * Returns the number of RDN components in this DN.
-   *
-   * @return The number of RDN components in this DN.
-   */
-  public int size()
-  {
-    return size;
-  }
-
-
-
-  /**
-   * Returns the RFC 4514 string representation of this DN.
-   *
-   * @return The RFC 4514 string representation of this DN.
-   * @see <a href="http://tools.ietf.org/html/rfc4514">RFC 4514 - Lightweight
-   *      Directory Access Protocol (LDAP): String Representation of
-   *      Distinguished Names </a>
-   */
-  @Override
-  public String toString()
-  {
-    // We don't care about potential race conditions here.
-    if (stringValue == null)
-    {
-      final StringBuilder builder = new StringBuilder();
-      rdn.toString(builder);
-      if (!parent.isRootDN())
-      {
-        builder.append(',');
-        builder.append(parent.toString());
-      }
-      stringValue = builder.toString();
-    }
-    return stringValue;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeException.java
index f72848b..bd70db8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,127 +26,98 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.i18n.LocalizableException;
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * Thrown when data from an input source cannot be decoded, perhaps due to the
  * data being malformed in some way. By default decoding exceptions are fatal,
  * indicating that the associated input source is no longer usable.
  */
 @SuppressWarnings("serial")
-public final class DecodeException extends IOException implements
-    LocalizableException
-{
-  /**
-   * Creates a new non-fatal decode exception with the provided message.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @return The new non-fatal decode exception.
-   */
-  public static DecodeException error(final LocalizableMessage message)
-  {
-    return new DecodeException(message, false, null);
-  }
+public final class DecodeException extends IOException implements LocalizableException {
+    /**
+     * Creates a new non-fatal decode exception with the provided message.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @return The new non-fatal decode exception.
+     */
+    public static DecodeException error(final LocalizableMessage message) {
+        return new DecodeException(message, false, null);
+    }
 
+    /**
+     * Creates a new non-fatal decode exception with the provided message and
+     * root cause.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @param cause
+     *            The underlying cause of this exception.
+     * @return The new non-fatal decode exception.
+     */
+    public static DecodeException error(final LocalizableMessage message, final Throwable cause) {
+        return new DecodeException(message, false, cause);
+    }
 
+    /**
+     * Creates a new fatal decode exception with the provided message. The
+     * associated input source can no longer be used.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @return The new fatal decode exception.
+     */
+    public static DecodeException fatalError(final LocalizableMessage message) {
+        return new DecodeException(message, true, null);
+    }
 
-  /**
-   * Creates a new non-fatal decode exception with the provided message and root
-   * cause.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @param cause
-   *          The underlying cause of this exception.
-   * @return The new non-fatal decode exception.
-   */
-  public static DecodeException error(final LocalizableMessage message,
-      final Throwable cause)
-  {
-    return new DecodeException(message, false, cause);
-  }
+    /**
+     * Creates a new fatal decode exception with the provided message and root
+     * cause. The associated input source can no longer be used.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @param cause
+     *            The underlying cause of this exception.
+     * @return The new fatal decode exception.
+     */
+    public static DecodeException fatalError(final LocalizableMessage message, final Throwable cause) {
+        return new DecodeException(message, true, cause);
+    }
 
+    private final LocalizableMessage message;
 
+    private final boolean isFatal;
 
-  /**
-   * Creates a new fatal decode exception with the provided message. The
-   * associated input source can no longer be used.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @return The new fatal decode exception.
-   */
-  public static DecodeException fatalError(final LocalizableMessage message)
-  {
-    return new DecodeException(message, true, null);
-  }
+    // Construction is provided via factory methods.
+    private DecodeException(final LocalizableMessage message, final boolean isFatal,
+            final Throwable cause) {
+        super(message.toString(), cause);
+        this.message = message;
+        this.isFatal = isFatal;
+    }
 
+    /**
+     * Returns the message that explains the problem that occurred.
+     *
+     * @return LocalizableMessage of the problem
+     */
+    public LocalizableMessage getMessageObject() {
+        return message;
+    }
 
-
-  /**
-   * Creates a new fatal decode exception with the provided message and root
-   * cause. The associated input source can no longer be used.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @param cause
-   *          The underlying cause of this exception.
-   * @return The new fatal decode exception.
-   */
-  public static DecodeException fatalError(final LocalizableMessage message,
-      final Throwable cause)
-  {
-    return new DecodeException(message, true, cause);
-  }
-
-
-
-  private final LocalizableMessage message;
-
-  private final boolean isFatal;
-
-
-
-  // Construction is provided via factory methods.
-  private DecodeException(final LocalizableMessage message,
-      final boolean isFatal, final Throwable cause)
-  {
-    super(message.toString(), cause);
-    this.message = message;
-    this.isFatal = isFatal;
-  }
-
-
-
-  /**
-   * Returns the message that explains the problem that occurred.
-   *
-   * @return LocalizableMessage of the problem
-   */
-  public LocalizableMessage getMessageObject()
-  {
-    return message;
-  }
-
-
-
-  /**
-   * Indicates whether or not the error was fatal and the associated input
-   * source can no longer be used.
-   *
-   * @return {@code true} if the error was fatal and the associated input source
-   *         can no longer be used, otherwise {@code false} .
-   */
-  public boolean isFatal()
-  {
-    return isFatal;
-  }
+    /**
+     * Indicates whether or not the error was fatal and the associated input
+     * source can no longer be used.
+     *
+     * @return {@code true} if the error was fatal and the associated input
+     *         source can no longer be used, otherwise {@code false} .
+     */
+    public boolean isFatal() {
+        return isFatal;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java
index 702d10e..469066d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,14 +27,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Decode options allow applications to control how requests and responses are
  * decoded. In particular:
@@ -49,190 +44,153 @@
  * entries or entry like objects.
  * </ul>
  */
-public final class DecodeOptions
-{
-  private static final class FixedSchemaResolver implements SchemaResolver
-  {
-    private final Schema schema;
+public final class DecodeOptions {
+    private static final class FixedSchemaResolver implements SchemaResolver {
+        private final Schema schema;
 
+        private FixedSchemaResolver(final Schema schema) {
+            this.schema = schema;
+        }
 
+        /**
+         * {@inheritDoc}
+         */
+        public Schema resolveSchema(final String dn) {
+            return schema;
+        }
 
-    private FixedSchemaResolver(final Schema schema)
-    {
-      this.schema = schema;
     }
 
+    private SchemaResolver schemaResolver;
 
+    private EntryFactory entryFactory;
+
+    private AttributeFactory attributeFactory;
 
     /**
-     * {@inheritDoc}
+     * Creates a new set of decode options which will always use the default
+     * schema returned by {@link Schema#getDefaultSchema()},
+     * {@link LinkedAttribute}, and {@link LinkedHashMapEntry}.
      */
-    public Schema resolveSchema(final String dn)
-    {
-      return schema;
+    public DecodeOptions() {
+        this.attributeFactory = LinkedAttribute.FACTORY;
+        this.entryFactory = LinkedHashMapEntry.FACTORY;
+        this.schemaResolver = SchemaResolver.DEFAULT;
     }
 
-  }
+    /**
+     * Creates a new set of decode options having the same initial set of
+     * options as the provided set of decode options.
+     *
+     * @param options
+     *            The set of decode options to be copied.
+     */
+    public DecodeOptions(final DecodeOptions options) {
+        this.attributeFactory = options.attributeFactory;
+        this.entryFactory = options.entryFactory;
+        this.schemaResolver = options.schemaResolver;
+    }
 
+    /**
+     * Returns the {@code AttributeFactory} which will be used for creating new
+     * {@code Attribute} instances when decoding attributes.
+     *
+     * @return The {@code AttributeFactory} which will be used for creating new
+     *         {@code Attribute} instances when decoding attributes.
+     */
+    public final AttributeFactory getAttributeFactory() {
+        return attributeFactory;
+    }
 
+    /**
+     * Returns the {@code EntryFactory} which will be used for creating new
+     * {@code Entry} instances when decoding entries.
+     *
+     * @return The {@code EntryFactory} which will be used for creating new
+     *         {@code Entry} instances when decoding entries.
+     */
+    public final EntryFactory getEntryFactory() {
+        return entryFactory;
+    }
 
-  private SchemaResolver schemaResolver;
+    /**
+     * Returns the strategy for selecting which {@code Schema} should be used
+     * for decoding distinguished names, attribute descriptions, and other
+     * objects which require a {@code Schema} in order to be decoded.
+     *
+     * @return The schema resolver which will be used for decoding.
+     */
+    public final SchemaResolver getSchemaResolver() {
+        return schemaResolver;
+    }
 
-  private EntryFactory entryFactory;
+    /**
+     * Sets the {@code AttributeFactory} which will be used for creating new
+     * {@code Attribute} instances when decoding attributes.
+     *
+     * @param factory
+     *            The {@code AttributeFactory} which will be used for creating
+     *            new {@code Attribute} instances when decoding attributes.
+     * @return A reference to this set of decode options.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public final DecodeOptions setAttributeFactory(final AttributeFactory factory) {
+        Validator.ensureNotNull(factory);
+        this.attributeFactory = factory;
+        return this;
+    }
 
-  private AttributeFactory attributeFactory;
+    /**
+     * Sets the {@code EntryFactory} which will be used for creating new
+     * {@code Entry} instances when decoding entries.
+     *
+     * @param factory
+     *            The {@code EntryFactory} which will be used for creating new
+     *            {@code Entry} instances when decoding entries.
+     * @return A reference to this set of decode options.
+     * @throws NullPointerException
+     *             If {@code factory} was {@code null}.
+     */
+    public final DecodeOptions setEntryFactory(final EntryFactory factory) {
+        Validator.ensureNotNull(factory);
+        this.entryFactory = factory;
+        return this;
+    }
 
+    /**
+     * Sets the {@code Schema} which will be used for decoding distinguished
+     * names, attribute descriptions, and other objects which require a schema
+     * in order to be decoded. This setting overrides the currently active
+     * schema resolver set using {@link #setSchemaResolver}.
+     *
+     * @param schema
+     *            The {@code Schema} which will be used for decoding.
+     * @return A reference to this set of decode options.
+     * @throws NullPointerException
+     *             If {@code schema} was {@code null}.
+     */
+    public final DecodeOptions setSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        this.schemaResolver = new FixedSchemaResolver(schema);
+        return this;
+    }
 
-
-  /**
-   * Creates a new set of decode options which will always use the default
-   * schema returned by {@link Schema#getDefaultSchema()},
-   * {@link LinkedAttribute}, and {@link LinkedHashMapEntry}.
-   */
-  public DecodeOptions()
-  {
-    this.attributeFactory = LinkedAttribute.FACTORY;
-    this.entryFactory = LinkedHashMapEntry.FACTORY;
-    this.schemaResolver = SchemaResolver.DEFAULT;
-  }
-
-
-
-  /**
-   * Creates a new set of decode options having the same initial set of options
-   * as the provided set of decode options.
-   *
-   * @param options
-   *          The set of decode options to be copied.
-   */
-  public DecodeOptions(final DecodeOptions options)
-  {
-    this.attributeFactory = options.attributeFactory;
-    this.entryFactory = options.entryFactory;
-    this.schemaResolver = options.schemaResolver;
-  }
-
-
-
-  /**
-   * Returns the {@code AttributeFactory} which will be used for creating new
-   * {@code Attribute} instances when decoding attributes.
-   *
-   * @return The {@code AttributeFactory} which will be used for creating new
-   *         {@code Attribute} instances when decoding attributes.
-   */
-  public final AttributeFactory getAttributeFactory()
-  {
-    return attributeFactory;
-  }
-
-
-
-  /**
-   * Returns the {@code EntryFactory} which will be used for creating new
-   * {@code Entry} instances when decoding entries.
-   *
-   * @return The {@code EntryFactory} which will be used for creating new
-   *         {@code Entry} instances when decoding entries.
-   */
-  public final EntryFactory getEntryFactory()
-  {
-    return entryFactory;
-  }
-
-
-
-  /**
-   * Returns the strategy for selecting which {@code Schema} should be used for
-   * decoding distinguished names, attribute descriptions, and other objects
-   * which require a {@code Schema} in order to be decoded.
-   *
-   * @return The schema resolver which will be used for decoding.
-   */
-  public final SchemaResolver getSchemaResolver()
-  {
-    return schemaResolver;
-  }
-
-
-
-  /**
-   * Sets the {@code AttributeFactory} which will be used for creating new
-   * {@code Attribute} instances when decoding attributes.
-   *
-   * @param factory
-   *          The {@code AttributeFactory} which will be used for creating new
-   *          {@code Attribute} instances when decoding attributes.
-   * @return A reference to this set of decode options.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public final DecodeOptions setAttributeFactory(final AttributeFactory factory)
-  {
-    Validator.ensureNotNull(factory);
-    this.attributeFactory = factory;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the {@code EntryFactory} which will be used for creating new {@code
-   * Entry} instances when decoding entries.
-   *
-   * @param factory
-   *          The {@code EntryFactory} which will be used for creating new
-   *          {@code Entry} instances when decoding entries.
-   * @return A reference to this set of decode options.
-   * @throws NullPointerException
-   *           If {@code factory} was {@code null}.
-   */
-  public final DecodeOptions setEntryFactory(final EntryFactory factory)
-  {
-    Validator.ensureNotNull(factory);
-    this.entryFactory = factory;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the {@code Schema} which will be used for decoding distinguished
-   * names, attribute descriptions, and other objects which require a schema in
-   * order to be decoded. This setting overrides the currently active schema
-   * resolver set using {@link #setSchemaResolver}.
-   *
-   * @param schema
-   *          The {@code Schema} which will be used for decoding.
-   * @return A reference to this set of decode options.
-   * @throws NullPointerException
-   *           If {@code schema} was {@code null}.
-   */
-  public final DecodeOptions setSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    this.schemaResolver = new FixedSchemaResolver(schema);
-    return this;
-  }
-
-
-
-  /**
-   * Sets the strategy for selecting which {@code Schema} should be used for
-   * decoding distinguished names, attribute descriptions, and other objects
-   * which require a {@code Schema} in order to be decoded. This setting
-   * overrides the currently active schema set using {@link #setSchema}.
-   *
-   * @param resolver
-   *          The {@code SchemaResolver} which will be used for decoding.
-   * @return A reference to this set of decode options.
-   * @throws NullPointerException
-   *           If {@code resolver} was {@code null}.
-   */
-  public final DecodeOptions setSchemaResolver(final SchemaResolver resolver)
-  {
-    Validator.ensureNotNull(resolver);
-    this.schemaResolver = resolver;
-    return this;
-  }
+    /**
+     * Sets the strategy for selecting which {@code Schema} should be used for
+     * decoding distinguished names, attribute descriptions, and other objects
+     * which require a {@code Schema} in order to be decoded. This setting
+     * overrides the currently active schema set using {@link #setSchema}.
+     *
+     * @param resolver
+     *            The {@code SchemaResolver} which will be used for decoding.
+     * @return A reference to this set of decode options.
+     * @throws NullPointerException
+     *             If {@code resolver} was {@code null}.
+     */
+    public final DecodeOptions setSchemaResolver(final SchemaResolver resolver) {
+        Validator.ensureNotNull(resolver);
+        this.schemaResolver = resolver;
+        return this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java
index 74be9f2..3006a7b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-
-
 /**
  * A Search operation alias dereferencing policy as defined in RFC 4511 section
  * 4.5.1.3 is used to indicate whether or not alias entries (as defined in RFC
@@ -47,172 +42,135 @@
  * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
  *      Directory Access Protocol (LDAP): Directory Information Models </a>
  */
-public final class DereferenceAliasesPolicy
-{
-  private static final DereferenceAliasesPolicy[] ELEMENTS = new DereferenceAliasesPolicy[4];
+public final class DereferenceAliasesPolicy {
+    private static final DereferenceAliasesPolicy[] ELEMENTS = new DereferenceAliasesPolicy[4];
 
-  private static final List<DereferenceAliasesPolicy> IMMUTABLE_ELEMENTS = Collections
-      .unmodifiableList(Arrays.asList(ELEMENTS));
+    private static final List<DereferenceAliasesPolicy> IMMUTABLE_ELEMENTS = Collections
+            .unmodifiableList(Arrays.asList(ELEMENTS));
 
-  /**
-   * Do not dereference aliases in searching or in locating the base object of a
-   * Search operation.
-   */
-  public static final DereferenceAliasesPolicy NEVER = register(0, "never");
+    /**
+     * Do not dereference aliases in searching or in locating the base object of
+     * a Search operation.
+     */
+    public static final DereferenceAliasesPolicy NEVER = register(0, "never");
 
-  /**
-   * While searching subordinates of the base object, dereference any alias
-   * within the scope of the Search operation. Dereferenced objects become the
-   * vertices of further search scopes where the Search operation is also
-   * applied. If the search scope is {@code WHOLE_SUBTREE}, the Search continues
-   * in the subtree(s) of any dereferenced object. If the search scope is
-   * {@code SINGLE_LEVEL}, the search is applied to any dereferenced objects and
-   * is not applied to their subordinates.
-   */
-  public static final DereferenceAliasesPolicy IN_SEARCHING = register(1,
-      "search");
+    /**
+     * While searching subordinates of the base object, dereference any alias
+     * within the scope of the Search operation. Dereferenced objects become the
+     * vertices of further search scopes where the Search operation is also
+     * applied. If the search scope is {@code WHOLE_SUBTREE}, the Search
+     * continues in the subtree(s) of any dereferenced object. If the search
+     * scope is {@code SINGLE_LEVEL}, the search is applied to any dereferenced
+     * objects and is not applied to their subordinates.
+     */
+    public static final DereferenceAliasesPolicy IN_SEARCHING = register(1, "search");
 
-  /**
-   * Dereference aliases in locating the base object of a Search operation, but
-   * not when searching subordinates of the base object.
-   */
-  public static final DereferenceAliasesPolicy FINDING_BASE = register(2,
-      "find");
+    /**
+     * Dereference aliases in locating the base object of a Search operation,
+     * but not when searching subordinates of the base object.
+     */
+    public static final DereferenceAliasesPolicy FINDING_BASE = register(2, "find");
 
-  /**
-   * Dereference aliases both in searching and in locating the base object of a
-   * Search operation.
-   */
-  public static final DereferenceAliasesPolicy ALWAYS = register(3, "always");
+    /**
+     * Dereference aliases both in searching and in locating the base object of
+     * a Search operation.
+     */
+    public static final DereferenceAliasesPolicy ALWAYS = register(3, "always");
 
-
-
-  /**
-   * Returns the alias dereferencing policy having the specified integer value
-   * as defined in RFC 4511 section 4.5.1.
-   *
-   * @param intValue
-   *          The integer value of the alias dereferencing policy.
-   * @return The dereference aliases policy, or {@code null} if there was no
-   *         alias dereferencing policy associated with {@code intValue}.
-   */
-  public static DereferenceAliasesPolicy valueOf(final int intValue)
-  {
-    if (intValue < 0 || intValue >= ELEMENTS.length)
-    {
-      return null;
+    /**
+     * Returns the alias dereferencing policy having the specified integer value
+     * as defined in RFC 4511 section 4.5.1.
+     *
+     * @param intValue
+     *            The integer value of the alias dereferencing policy.
+     * @return The dereference aliases policy, or {@code null} if there was no
+     *         alias dereferencing policy associated with {@code intValue}.
+     */
+    public static DereferenceAliasesPolicy valueOf(final int intValue) {
+        if (intValue < 0 || intValue >= ELEMENTS.length) {
+            return null;
+        }
+        return ELEMENTS[intValue];
     }
-    return ELEMENTS[intValue];
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the set of available alias
-   * dereferencing policies indexed on their integer value as defined in RFC
-   * 4511 section 4.5.1.
-   *
-   * @return An unmodifiable list containing the set of available alias
-   *         dereferencing policies.
-   */
-  public static List<DereferenceAliasesPolicy> values()
-  {
-    return IMMUTABLE_ELEMENTS;
-  }
-
-
-
-  /**
-   * Creates and registers a new alias dereferencing policy with the
-   * application.
-   *
-   * @param intValue
-   *          The integer value of the alias dereferencing policy as defined in
-   *          RFC 4511 section 4.5.1.
-   * @param name
-   *          The name of the alias dereferencing policy.
-   * @return The new alias dereferencing policy.
-   */
-  private static DereferenceAliasesPolicy register(final int intValue,
-      final String name)
-  {
-    final DereferenceAliasesPolicy t = new DereferenceAliasesPolicy(intValue,
-        name);
-    ELEMENTS[intValue] = t;
-    return t;
-  }
-
-
-
-  private final int intValue;
-
-  private final String name;
-
-
-
-  // Prevent direct instantiation.
-  private DereferenceAliasesPolicy(final int intValue, final String name)
-  {
-    this.intValue = intValue;
-    this.name = name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
+    /**
+     * Returns an unmodifiable list containing the set of available alias
+     * dereferencing policies indexed on their integer value as defined in RFC
+     * 4511 section 4.5.1.
+     *
+     * @return An unmodifiable list containing the set of available alias
+     *         dereferencing policies.
+     */
+    public static List<DereferenceAliasesPolicy> values() {
+        return IMMUTABLE_ELEMENTS;
     }
-    else if (obj instanceof DereferenceAliasesPolicy)
-    {
-      return this.intValue == ((DereferenceAliasesPolicy) obj).intValue;
+
+    /**
+     * Creates and registers a new alias dereferencing policy with the
+     * application.
+     *
+     * @param intValue
+     *            The integer value of the alias dereferencing policy as defined
+     *            in RFC 4511 section 4.5.1.
+     * @param name
+     *            The name of the alias dereferencing policy.
+     * @return The new alias dereferencing policy.
+     */
+    private static DereferenceAliasesPolicy register(final int intValue, final String name) {
+        final DereferenceAliasesPolicy t = new DereferenceAliasesPolicy(intValue, name);
+        ELEMENTS[intValue] = t;
+        return t;
     }
-    else
-    {
-      return false;
+
+    private final int intValue;
+
+    private final String name;
+
+    // Prevent direct instantiation.
+    private DereferenceAliasesPolicy(final int intValue, final String name) {
+        this.intValue = intValue;
+        this.name = name;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof DereferenceAliasesPolicy) {
+            return this.intValue == ((DereferenceAliasesPolicy) obj).intValue;
+        } else {
+            return false;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return intValue;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value of this alias dereferencing policy as defined
+     * in RFC 4511 section 4.5.1.
+     *
+     * @return The integer value of this alias dereferencing policy.
+     */
+    public int intValue() {
+        return intValue;
+    }
 
-
-
-  /**
-   * Returns the integer value of this alias dereferencing policy as defined in
-   * RFC 4511 section 4.5.1.
-   *
-   * @return The integer value of this alias dereferencing policy.
-   */
-  public int intValue()
-  {
-    return intValue;
-  }
-
-
-
-  /**
-   * Returns the string representation of this alias dereferencing policy.
-   *
-   * @return The string representation of this alias dereferencing policy.
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
+    /**
+     * Returns the string representation of this alias dereferencing policy.
+     *
+     * @return The string representation of this alias dereferencing policy.
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
index 035ef7e..1c6f67f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,730 +27,564 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.AttributeDescription.objectClass;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
-import org.forgerock.opendj.ldap.schema.*;
+import org.forgerock.opendj.ldap.schema.ObjectClass;
+import org.forgerock.opendj.ldap.schema.ObjectClassType;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy;
+import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
 
 import com.forgerock.opendj.util.Function;
 import com.forgerock.opendj.util.Iterables;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains methods for creating and manipulating entries.
  *
  * @see Entry
  */
-public final class Entries
-{
+public final class Entries {
 
-  private static final class UnmodifiableEntry implements Entry
-  {
-    private final Entry entry;
+    private static final class UnmodifiableEntry implements Entry {
+        private final Entry entry;
 
-
-
-    private UnmodifiableEntry(final Entry entry)
-    {
-      this.entry = entry;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean addAttribute(final Attribute attribute)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean addAttribute(final Attribute attribute,
-        final Collection<ByteString> duplicateValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry addAttribute(final String attributeDescription,
-        final Object... values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    @Override
-    public Entry clearAttributes()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    @Override
-    public boolean containsAttribute(final Attribute attribute,
-        final Collection<ByteString> missingValues)
-    {
-      return entry.containsAttribute(attribute, missingValues);
-    }
-
-
-
-    @Override
-    public boolean containsAttribute(final String attributeDescription,
-        final Object... values)
-    {
-      return entry.containsAttribute(attributeDescription, values);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(final Object object)
-    {
-      return (object == this || entry.equals(object));
-    }
-
-
-
-    @Override
-    public Iterable<Attribute> getAllAttributes()
-    {
-      return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-          entry.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-    }
-
-
-
-    @Override
-    public Iterable<Attribute> getAllAttributes(
-        final AttributeDescription attributeDescription)
-    {
-      return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-          entry.getAllAttributes(attributeDescription),
-          UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Iterable<Attribute> getAllAttributes(
-        final String attributeDescription)
-    {
-      return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-          entry.getAllAttributes(attributeDescription),
-          UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-    }
-
-
-
-    @Override
-    public Attribute getAttribute(
-        final AttributeDescription attributeDescription)
-    {
-      final Attribute attribute = entry.getAttribute(attributeDescription);
-      if (attribute != null)
-      {
-        return Attributes.unmodifiableAttribute(attribute);
-      }
-      else
-      {
-        return null;
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Attribute getAttribute(final String attributeDescription)
-    {
-      final Attribute attribute = entry.getAttribute(attributeDescription);
-      if (attribute != null)
-      {
-        return Attributes.unmodifiableAttribute(attribute);
-      }
-      else
-      {
-        return null;
-      }
-    }
-
-
-
-    @Override
-    public int getAttributeCount()
-    {
-      return entry.getAttributeCount();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public DN getName()
-    {
-      return entry.getName();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode()
-    {
-      return entry.hashCode();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean removeAttribute(final Attribute attribute,
-        final Collection<ByteString> missingValues)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    @Override
-    public boolean removeAttribute(
-        final AttributeDescription attributeDescription)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry removeAttribute(final String attributeDescription,
-        final Object... values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean replaceAttribute(final Attribute attribute)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry replaceAttribute(final String attributeDescription,
-        final Object... values)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    @Override
-    public Entry setName(final DN dn)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry setName(final String dn)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString()
-    {
-      return entry.toString();
-    }
-
-  }
-
-
-
-  private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION =
-    new Function<Attribute, Attribute, Void>()
-  {
-
-    @Override
-    public Attribute apply(final Attribute value, final Void p)
-    {
-      return Attributes.unmodifiableAttribute(value);
-    }
-
-  };
-
-
-
-  private static final Comparator<Entry> COMPARATOR = new Comparator<Entry>()
-  {
-    public int compare(Entry o1, Entry o2)
-    {
-      return o1.getName().compareTo(o2.getName());
-    }
-  };
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries by name
-   * using the natural order for DN comparisons (parent before children).
-   * <p>
-   * In order to sort entries in reverse order (children first) use the
-   * following code:
-   *
-   * <pre>
-   * Collections.reverseOrder(Entries.compareByName());
-   * </pre>
-   *
-   * For more complex sort orders involving one or more attributes refer to the
-   * {@link SortKey} class.
-   *
-   * @return The {@code Comparator}.
-   */
-  public static Comparator<Entry> compareByName()
-  {
-    return COMPARATOR;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the provided entry is valid according to the
-   * specified schema and schema validation policy.
-   * <p>
-   * If attribute value validation is enabled then following checks will be
-   * performed:
-   * <ul>
-   * <li>checking that there is at least one value
-   * <li>checking that single-valued attributes contain only a single value
-   * </ul>
-   * In particular, attribute values will not be checked for conformance to
-   * their syntax since this is expected to have already been performed while
-   * adding the values to the entry.
-   *
-   * @param entry
-   *          The entry to be validated.
-   * @param schema
-   *          The schema against which the entry will be validated.
-   * @param policy
-   *          The schema validation policy.
-   * @param errorMessages
-   *          A collection into which any schema validation warnings or error
-   *          messages can be placed, or {@code null} if they should not be
-   *          saved.
-   * @return {@code true} if the provided entry is valid according to the
-   *         specified schema and schema validation policy.
-   * @see Schema#validateEntry(Entry, SchemaValidationPolicy, Collection)
-   */
-  public static boolean conformsToSchema(final Entry entry,
-      final Schema schema, final SchemaValidationPolicy policy,
-      final Collection<LocalizableMessage> errorMessages)
-  {
-    return schema.validateEntry(entry, policy, errorMessages);
-  }
-
-
-
-  /**
-   * Returns {@code true} if the provided entry is valid according to the
-   * default schema and schema validation policy.
-   * <p>
-   * If attribute value validation is enabled then following checks will be
-   * performed:
-   * <ul>
-   * <li>checking that there is at least one value
-   * <li>checking that single-valued attributes contain only a single value
-   * </ul>
-   * In particular, attribute values will not be checked for conformance to
-   * their syntax since this is expected to have already been performed while
-   * adding the values to the entry.
-   *
-   * @param entry
-   *          The entry to be validated.
-   * @param policy
-   *          The schema validation policy.
-   * @param errorMessages
-   *          A collection into which any schema validation warnings or error
-   *          messages can be placed, or {@code null} if they should not be
-   *          saved.
-   * @return {@code true} if the provided entry is valid according to the
-   *         default schema and schema validation policy.
-   * @see Schema#validateEntry(Entry, SchemaValidationPolicy, Collection)
-   */
-  public static boolean conformsToSchema(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final Collection<LocalizableMessage> errorMessages)
-  {
-    return conformsToSchema(entry, Schema.getDefaultSchema(), policy,
-        errorMessages);
-  }
-
-
-
-  /**
-   * Creates a new modify request containing a list of modifications which can
-   * be used to transform {@code fromEntry} into entry {@code toEntry}.
-   * <p>
-   * The modify request is reversible: it will contain only modifications of
-   * type {@link ModificationType#ADD ADD} and {@link ModificationType#DELETE
-   * DELETE}.
-   * <p>
-   * Finally, the modify request will use the distinguished name taken from
-   * {@code fromEntry}. Moreover, this method will not check to see if both
-   * {@code fromEntry} and {@code toEntry} have the same distinguished name.
-   * <p>
-   * This method is equivalent to:
-   *
-   * <pre>
-   * ModifyRequest request = Requests.newModifyRequest(fromEntry, toEntry);
-   * </pre>
-   *
-   * @param fromEntry
-   *          The source entry.
-   * @param toEntry
-   *          The destination entry.
-   * @return A modify request containing a list of modifications which can be
-   *         used to transform {@code fromEntry} into entry {@code toEntry}.
-   * @throws NullPointerException
-   *           If {@code fromEntry} or {@code toEntry} were {@code null}.
-   * @see Requests#newModifyRequest(Entry, Entry)
-   */
-  public static ModifyRequest diffEntries(final Entry fromEntry,
-      final Entry toEntry)
-  {
-    Validator.ensureNotNull(fromEntry, toEntry);
-
-    final ModifyRequest request = Requests
-        .newModifyRequest(fromEntry.getName());
-
-    TreeMapEntry tfrom;
-    if (fromEntry instanceof TreeMapEntry)
-    {
-      tfrom = (TreeMapEntry) fromEntry;
-    }
-    else
-    {
-      tfrom = new TreeMapEntry(fromEntry);
-    }
-
-    TreeMapEntry tto;
-    if (toEntry instanceof TreeMapEntry)
-    {
-      tto = (TreeMapEntry) toEntry;
-    }
-    else
-    {
-      tto = new TreeMapEntry(toEntry);
-    }
-
-    final Iterator<Attribute> ifrom = tfrom.getAllAttributes().iterator();
-    final Iterator<Attribute> ito = tto.getAllAttributes().iterator();
-
-    Attribute afrom = ifrom.hasNext() ? ifrom.next() : null;
-    Attribute ato = ito.hasNext() ? ito.next() : null;
-
-    while (afrom != null && ato != null)
-    {
-      final AttributeDescription adfrom = afrom.getAttributeDescription();
-      final AttributeDescription adto = ato.getAttributeDescription();
-
-      final int cmp = adfrom.compareTo(adto);
-      if (cmp == 0)
-      {
-        // Attribute is in both entries. Compute the set of values to be added
-        // and removed. We won't replace the attribute because this is not
-        // reversible.
-        final Attribute addedValues = new LinkedAttribute(ato);
-        addedValues.removeAll(afrom);
-        if (!addedValues.isEmpty())
-        {
-          request.addModification(new Modification(ModificationType.ADD,
-              addedValues));
+        private UnmodifiableEntry(final Entry entry) {
+            this.entry = entry;
         }
 
-        final Attribute deletedValues = new LinkedAttribute(afrom);
-        deletedValues.removeAll(ato);
-        if (!deletedValues.isEmpty())
-        {
-          request.addModification(new Modification(ModificationType.DELETE,
-              deletedValues));
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean addAttribute(final Attribute attribute) {
+            throw new UnsupportedOperationException();
         }
 
-        afrom = ifrom.hasNext() ? ifrom.next() : null;
-        ato = ito.hasNext() ? ito.next() : null;
-      }
-      else if (cmp < 0)
-      {
-        // afrom in source, but not destination.
-        request
-            .addModification(new Modification(ModificationType.DELETE, afrom));
-        afrom = ifrom.hasNext() ? ifrom.next() : null;
-      }
-      else
-      {
-        // ato in destination, but not in source.
-        request.addModification(new Modification(ModificationType.ADD, ato));
-        ato = ito.hasNext() ? ito.next() : null;
-      }
-    }
-
-    // Additional attributes in source entry: these must be deleted.
-    if (afrom != null)
-    {
-      request.addModification(new Modification(ModificationType.DELETE, afrom));
-    }
-
-    while (ifrom.hasNext())
-    {
-      final Attribute a = ifrom.next();
-      request.addModification(new Modification(ModificationType.DELETE, a));
-    }
-
-    // Additional attributes in destination entry: these must be added.
-    if (ato != null)
-    {
-      request.addModification(new Modification(ModificationType.ADD, ato));
-    }
-
-    while (ito.hasNext())
-    {
-      final Attribute a = ito.next();
-      request.addModification(new Modification(ModificationType.ADD, a));
-    }
-
-    return request;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the object classes associated with
-   * the provided entry. This method will ignore unrecognized object classes.
-   * <p>
-   * This method uses the default schema for decoding the object class attribute
-   * values.
-   *
-   * @param entry
-   *          The entry whose object classes are required.
-   * @return An unmodifiable set containing the object classes associated with
-   *         the provided entry.
-   */
-  public static Set<ObjectClass> getObjectClasses(final Entry entry)
-  {
-    return getObjectClasses(entry, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the object classes associated with
-   * the provided entry. This method will ignore unrecognized object classes.
-   *
-   * @param entry
-   *          The entry whose object classes are required.
-   * @param schema
-   *          The schema which should be used for decoding the object class
-   *          attribute values.
-   * @return An unmodifiable set containing the object classes associated with
-   *         the provided entry.
-   */
-  public static Set<ObjectClass> getObjectClasses(final Entry entry,
-      final Schema schema)
-  {
-    final Attribute objectClassAttribute = entry
-        .getAttribute(AttributeDescription.objectClass());
-    if (objectClassAttribute == null)
-    {
-      return Collections.emptySet();
-    }
-    else
-    {
-      final Set<ObjectClass> objectClasses = new HashSet<ObjectClass>(
-          objectClassAttribute.size());
-      for (final ByteString v : objectClassAttribute)
-      {
-        final String objectClassName = v.toString();
-        final ObjectClass objectClass;
-        try
-        {
-          objectClass = schema.getObjectClass(objectClassName);
-          objectClasses.add(objectClass);
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean addAttribute(final Attribute attribute,
+                final Collection<ByteString> duplicateValues) {
+            throw new UnsupportedOperationException();
         }
-        catch (final UnknownSchemaElementException e)
-        {
-          // Ignore.
-          continue;
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Entry addAttribute(final String attributeDescription, final Object... values) {
+            throw new UnsupportedOperationException();
         }
-      }
-      return Collections.unmodifiableSet(objectClasses);
-    }
-  }
 
-
-
-  /**
-   * Returns the structural object class associated with the provided entry, or
-   * {@code null} if none was found. If the entry contains multiple structural
-   * object classes then the first will be returned. This method will ignore
-   * unrecognized object classes.
-   * <p>
-   * This method uses the default schema for decoding the object class attribute
-   * values.
-   *
-   * @param entry
-   *          The entry whose structural object class is required.
-   * @return The structural object class associated with the provided entry, or
-   *         {@code null} if none was found.
-   */
-  public static ObjectClass getStructuralObjectClass(final Entry entry)
-  {
-    return getStructuralObjectClass(entry, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns the structural object class associated with the provided entry, or
-   * {@code null} if none was found. If the entry contains multiple structural
-   * object classes then the first will be returned. This method will ignore
-   * unrecognized object classes.
-   *
-   * @param entry
-   *          The entry whose structural object class is required.
-   * @param schema
-   *          The schema which should be used for decoding the object class
-   *          attribute values.
-   * @return The structural object class associated with the provided entry, or
-   *         {@code null} if none was found.
-   */
-  public static ObjectClass getStructuralObjectClass(final Entry entry,
-      final Schema schema)
-  {
-    ObjectClass structuralObjectClass = null;
-    final Attribute objectClassAttribute = entry.getAttribute(objectClass());
-
-    if (objectClassAttribute == null)
-    {
-      return null;
-    }
-
-    for (final ByteString v : objectClassAttribute)
-    {
-      final String objectClassName = v.toString();
-      final ObjectClass objectClass;
-      try
-      {
-        objectClass = schema.getObjectClass(objectClassName);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        // Ignore.
-        continue;
-      }
-
-      if (objectClass.getObjectClassType() == ObjectClassType.STRUCTURAL)
-      {
-        if (structuralObjectClass == null
-            || objectClass.isDescendantOf(structuralObjectClass))
-        {
-          structuralObjectClass = objectClass;
+        @Override
+        public Entry clearAttributes() {
+            throw new UnsupportedOperationException();
         }
-      }
+
+        @Override
+        public boolean containsAttribute(final Attribute attribute,
+                final Collection<ByteString> missingValues) {
+            return entry.containsAttribute(attribute, missingValues);
+        }
+
+        @Override
+        public boolean containsAttribute(final String attributeDescription, final Object... values) {
+            return entry.containsAttribute(attributeDescription, values);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean equals(final Object object) {
+            return (object == this || entry.equals(object));
+        }
+
+        @Override
+        public Iterable<Attribute> getAllAttributes() {
+            return Iterables.unmodifiableIterable(Iterables.transformedIterable(entry
+                    .getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+        }
+
+        @Override
+        public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) {
+            return Iterables.unmodifiableIterable(Iterables.transformedIterable(entry
+                    .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Iterable<Attribute> getAllAttributes(final String attributeDescription) {
+            return Iterables.unmodifiableIterable(Iterables.transformedIterable(entry
+                    .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+        }
+
+        @Override
+        public Attribute getAttribute(final AttributeDescription attributeDescription) {
+            final Attribute attribute = entry.getAttribute(attributeDescription);
+            if (attribute != null) {
+                return Attributes.unmodifiableAttribute(attribute);
+            } else {
+                return null;
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Attribute getAttribute(final String attributeDescription) {
+            final Attribute attribute = entry.getAttribute(attributeDescription);
+            if (attribute != null) {
+                return Attributes.unmodifiableAttribute(attribute);
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public int getAttributeCount() {
+            return entry.getAttributeCount();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public DN getName() {
+            return entry.getName();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int hashCode() {
+            return entry.hashCode();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean removeAttribute(final Attribute attribute,
+                final Collection<ByteString> missingValues) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAttribute(final AttributeDescription attributeDescription) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Entry removeAttribute(final String attributeDescription, final Object... values) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean replaceAttribute(final Attribute attribute) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Entry replaceAttribute(final String attributeDescription, final Object... values) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Entry setName(final DN dn) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Entry setName(final String dn) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return entry.toString();
+        }
+
     }
 
-    return structuralObjectClass;
-  }
+    private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION =
+            new Function<Attribute, Attribute, Void>() {
 
+                @Override
+                public Attribute apply(final Attribute value, final Void p) {
+                    return Attributes.unmodifiableAttribute(value);
+                }
 
+            };
 
-  /**
-   * Returns a read-only view of {@code entry} and its attributes. Query
-   * operations on the returned entry and its attributes "read-through" to the
-   * underlying entry or attribute, and attempts to modify the returned entry
-   * and its attributes either directly or indirectly via an iterator result in
-   * an {@code UnsupportedOperationException}.
-   *
-   * @param entry
-   *          The entry for which a read-only view is to be returned.
-   * @return A read-only view of {@code entry}.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public static Entry unmodifiableEntry(final Entry entry)
-  {
-    if (entry instanceof UnmodifiableEntry)
-    {
-      return entry;
+    private static final Comparator<Entry> COMPARATOR = new Comparator<Entry>() {
+        public int compare(Entry o1, Entry o2) {
+            return o1.getName().compareTo(o2.getName());
+        }
+    };
+
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries by name
+     * using the natural order for DN comparisons (parent before children).
+     * <p>
+     * In order to sort entries in reverse order (children first) use the
+     * following code:
+     *
+     * <pre>
+     * Collections.reverseOrder(Entries.compareByName());
+     * </pre>
+     *
+     * For more complex sort orders involving one or more attributes refer to
+     * the {@link SortKey} class.
+     *
+     * @return The {@code Comparator}.
+     */
+    public static Comparator<Entry> compareByName() {
+        return COMPARATOR;
     }
-    else
-    {
-      return new UnmodifiableEntry(entry);
+
+    /**
+     * Returns {@code true} if the provided entry is valid according to the
+     * specified schema and schema validation policy.
+     * <p>
+     * If attribute value validation is enabled then following checks will be
+     * performed:
+     * <ul>
+     * <li>checking that there is at least one value
+     * <li>checking that single-valued attributes contain only a single value
+     * </ul>
+     * In particular, attribute values will not be checked for conformance to
+     * their syntax since this is expected to have already been performed while
+     * adding the values to the entry.
+     *
+     * @param entry
+     *            The entry to be validated.
+     * @param schema
+     *            The schema against which the entry will be validated.
+     * @param policy
+     *            The schema validation policy.
+     * @param errorMessages
+     *            A collection into which any schema validation warnings or
+     *            error messages can be placed, or {@code null} if they should
+     *            not be saved.
+     * @return {@code true} if the provided entry is valid according to the
+     *         specified schema and schema validation policy.
+     * @see Schema#validateEntry(Entry, SchemaValidationPolicy, Collection)
+     */
+    public static boolean conformsToSchema(final Entry entry, final Schema schema,
+            final SchemaValidationPolicy policy, final Collection<LocalizableMessage> errorMessages) {
+        return schema.validateEntry(entry, policy, errorMessages);
     }
-  }
 
+    /**
+     * Returns {@code true} if the provided entry is valid according to the
+     * default schema and schema validation policy.
+     * <p>
+     * If attribute value validation is enabled then following checks will be
+     * performed:
+     * <ul>
+     * <li>checking that there is at least one value
+     * <li>checking that single-valued attributes contain only a single value
+     * </ul>
+     * In particular, attribute values will not be checked for conformance to
+     * their syntax since this is expected to have already been performed while
+     * adding the values to the entry.
+     *
+     * @param entry
+     *            The entry to be validated.
+     * @param policy
+     *            The schema validation policy.
+     * @param errorMessages
+     *            A collection into which any schema validation warnings or
+     *            error messages can be placed, or {@code null} if they should
+     *            not be saved.
+     * @return {@code true} if the provided entry is valid according to the
+     *         default schema and schema validation policy.
+     * @see Schema#validateEntry(Entry, SchemaValidationPolicy, Collection)
+     */
+    public static boolean conformsToSchema(final Entry entry, final SchemaValidationPolicy policy,
+            final Collection<LocalizableMessage> errorMessages) {
+        return conformsToSchema(entry, Schema.getDefaultSchema(), policy, errorMessages);
+    }
 
+    /**
+     * Creates a new modify request containing a list of modifications which can
+     * be used to transform {@code fromEntry} into entry {@code toEntry}.
+     * <p>
+     * The modify request is reversible: it will contain only modifications of
+     * type {@link ModificationType#ADD ADD} and {@link ModificationType#DELETE
+     * DELETE}.
+     * <p>
+     * Finally, the modify request will use the distinguished name taken from
+     * {@code fromEntry}. Moreover, this method will not check to see if both
+     * {@code fromEntry} and {@code toEntry} have the same distinguished name.
+     * <p>
+     * This method is equivalent to:
+     *
+     * <pre>
+     * ModifyRequest request = Requests.newModifyRequest(fromEntry, toEntry);
+     * </pre>
+     *
+     * @param fromEntry
+     *            The source entry.
+     * @param toEntry
+     *            The destination entry.
+     * @return A modify request containing a list of modifications which can be
+     *         used to transform {@code fromEntry} into entry {@code toEntry}.
+     * @throws NullPointerException
+     *             If {@code fromEntry} or {@code toEntry} were {@code null}.
+     * @see Requests#newModifyRequest(Entry, Entry)
+     */
+    public static ModifyRequest diffEntries(final Entry fromEntry, final Entry toEntry) {
+        Validator.ensureNotNull(fromEntry, toEntry);
 
-  // Prevent instantiation.
-  private Entries()
-  {
-    // Nothing to do.
-  }
+        final ModifyRequest request = Requests.newModifyRequest(fromEntry.getName());
+
+        TreeMapEntry tfrom;
+        if (fromEntry instanceof TreeMapEntry) {
+            tfrom = (TreeMapEntry) fromEntry;
+        } else {
+            tfrom = new TreeMapEntry(fromEntry);
+        }
+
+        TreeMapEntry tto;
+        if (toEntry instanceof TreeMapEntry) {
+            tto = (TreeMapEntry) toEntry;
+        } else {
+            tto = new TreeMapEntry(toEntry);
+        }
+
+        final Iterator<Attribute> ifrom = tfrom.getAllAttributes().iterator();
+        final Iterator<Attribute> ito = tto.getAllAttributes().iterator();
+
+        Attribute afrom = ifrom.hasNext() ? ifrom.next() : null;
+        Attribute ato = ito.hasNext() ? ito.next() : null;
+
+        while (afrom != null && ato != null) {
+            final AttributeDescription adfrom = afrom.getAttributeDescription();
+            final AttributeDescription adto = ato.getAttributeDescription();
+
+            final int cmp = adfrom.compareTo(adto);
+            if (cmp == 0) {
+                // Attribute is in both entries. Compute the set of values to be
+                // added
+                // and removed. We won't replace the attribute because this is
+                // not
+                // reversible.
+                final Attribute addedValues = new LinkedAttribute(ato);
+                addedValues.removeAll(afrom);
+                if (!addedValues.isEmpty()) {
+                    request.addModification(new Modification(ModificationType.ADD, addedValues));
+                }
+
+                final Attribute deletedValues = new LinkedAttribute(afrom);
+                deletedValues.removeAll(ato);
+                if (!deletedValues.isEmpty()) {
+                    request.addModification(new Modification(ModificationType.DELETE, deletedValues));
+                }
+
+                afrom = ifrom.hasNext() ? ifrom.next() : null;
+                ato = ito.hasNext() ? ito.next() : null;
+            } else if (cmp < 0) {
+                // afrom in source, but not destination.
+                request.addModification(new Modification(ModificationType.DELETE, afrom));
+                afrom = ifrom.hasNext() ? ifrom.next() : null;
+            } else {
+                // ato in destination, but not in source.
+                request.addModification(new Modification(ModificationType.ADD, ato));
+                ato = ito.hasNext() ? ito.next() : null;
+            }
+        }
+
+        // Additional attributes in source entry: these must be deleted.
+        if (afrom != null) {
+            request.addModification(new Modification(ModificationType.DELETE, afrom));
+        }
+
+        while (ifrom.hasNext()) {
+            final Attribute a = ifrom.next();
+            request.addModification(new Modification(ModificationType.DELETE, a));
+        }
+
+        // Additional attributes in destination entry: these must be added.
+        if (ato != null) {
+            request.addModification(new Modification(ModificationType.ADD, ato));
+        }
+
+        while (ito.hasNext()) {
+            final Attribute a = ito.next();
+            request.addModification(new Modification(ModificationType.ADD, a));
+        }
+
+        return request;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the object classes associated with
+     * the provided entry. This method will ignore unrecognized object classes.
+     * <p>
+     * This method uses the default schema for decoding the object class
+     * attribute values.
+     *
+     * @param entry
+     *            The entry whose object classes are required.
+     * @return An unmodifiable set containing the object classes associated with
+     *         the provided entry.
+     */
+    public static Set<ObjectClass> getObjectClasses(final Entry entry) {
+        return getObjectClasses(entry, Schema.getDefaultSchema());
+    }
+
+    /**
+     * Returns an unmodifiable set containing the object classes associated with
+     * the provided entry. This method will ignore unrecognized object classes.
+     *
+     * @param entry
+     *            The entry whose object classes are required.
+     * @param schema
+     *            The schema which should be used for decoding the object class
+     *            attribute values.
+     * @return An unmodifiable set containing the object classes associated with
+     *         the provided entry.
+     */
+    public static Set<ObjectClass> getObjectClasses(final Entry entry, final Schema schema) {
+        final Attribute objectClassAttribute =
+                entry.getAttribute(AttributeDescription.objectClass());
+        if (objectClassAttribute == null) {
+            return Collections.emptySet();
+        } else {
+            final Set<ObjectClass> objectClasses =
+                    new HashSet<ObjectClass>(objectClassAttribute.size());
+            for (final ByteString v : objectClassAttribute) {
+                final String objectClassName = v.toString();
+                final ObjectClass objectClass;
+                try {
+                    objectClass = schema.getObjectClass(objectClassName);
+                    objectClasses.add(objectClass);
+                } catch (final UnknownSchemaElementException e) {
+                    // Ignore.
+                    continue;
+                }
+            }
+            return Collections.unmodifiableSet(objectClasses);
+        }
+    }
+
+    /**
+     * Returns the structural object class associated with the provided entry,
+     * or {@code null} if none was found. If the entry contains multiple
+     * structural object classes then the first will be returned. This method
+     * will ignore unrecognized object classes.
+     * <p>
+     * This method uses the default schema for decoding the object class
+     * attribute values.
+     *
+     * @param entry
+     *            The entry whose structural object class is required.
+     * @return The structural object class associated with the provided entry,
+     *         or {@code null} if none was found.
+     */
+    public static ObjectClass getStructuralObjectClass(final Entry entry) {
+        return getStructuralObjectClass(entry, Schema.getDefaultSchema());
+    }
+
+    /**
+     * Returns the structural object class associated with the provided entry,
+     * or {@code null} if none was found. If the entry contains multiple
+     * structural object classes then the first will be returned. This method
+     * will ignore unrecognized object classes.
+     *
+     * @param entry
+     *            The entry whose structural object class is required.
+     * @param schema
+     *            The schema which should be used for decoding the object class
+     *            attribute values.
+     * @return The structural object class associated with the provided entry,
+     *         or {@code null} if none was found.
+     */
+    public static ObjectClass getStructuralObjectClass(final Entry entry, final Schema schema) {
+        ObjectClass structuralObjectClass = null;
+        final Attribute objectClassAttribute = entry.getAttribute(objectClass());
+
+        if (objectClassAttribute == null) {
+            return null;
+        }
+
+        for (final ByteString v : objectClassAttribute) {
+            final String objectClassName = v.toString();
+            final ObjectClass objectClass;
+            try {
+                objectClass = schema.getObjectClass(objectClassName);
+            } catch (final UnknownSchemaElementException e) {
+                // Ignore.
+                continue;
+            }
+
+            if (objectClass.getObjectClassType() == ObjectClassType.STRUCTURAL) {
+                if (structuralObjectClass == null
+                        || objectClass.isDescendantOf(structuralObjectClass)) {
+                    structuralObjectClass = objectClass;
+                }
+            }
+        }
+
+        return structuralObjectClass;
+    }
+
+    /**
+     * Returns a read-only view of {@code entry} and its attributes. Query
+     * operations on the returned entry and its attributes "read-through" to the
+     * underlying entry or attribute, and attempts to modify the returned entry
+     * and its attributes either directly or indirectly via an iterator result
+     * in an {@code UnsupportedOperationException}.
+     *
+     * @param entry
+     *            The entry for which a read-only view is to be returned.
+     * @return A read-only view of {@code entry}.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public static Entry unmodifiableEntry(final Entry entry) {
+        if (entry instanceof UnmodifiableEntry) {
+            return entry;
+        } else {
+            return new UnmodifiableEntry(entry);
+        }
+    }
+
+    // Prevent instantiation.
+    private Entries() {
+        // Nothing to do.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entry.java
index 6b298aa..0873122 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.i18n.*;
-
-
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 
 /**
  * An entry, comprising of a distinguished name and zero or more attributes.
@@ -63,473 +58,430 @@
  *
  * @see Entries
  */
-public interface Entry
-{
+public interface Entry {
 
-  /**
-   * Ensures that this entry contains the provided attribute and values
-   * (optional operation). This method has the following semantics:
-   * <ul>
-   * <li>If this entry does not already contain an attribute with the same
-   * attribute description, then this entry will be modified such that it
-   * contains {@code attribute}, even if it is empty.
-   * <li>If this entry already contains an attribute with the same attribute
-   * description, then the attribute values contained in {@code attribute} will
-   * be merged with the existing attribute values.
-   * </ul>
-   * <p>
-   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
-   * LDAP Modify add semantics.
-   *
-   * @param attribute
-   *          The attribute values to be added to this entry, merging with any
-   *          existing attribute values.
-   * @return {@code true} if this entry changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           added.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  boolean addAttribute(Attribute attribute);
+    /**
+     * Ensures that this entry contains the provided attribute and values
+     * (optional operation). This method has the following semantics:
+     * <ul>
+     * <li>If this entry does not already contain an attribute with the same
+     * attribute description, then this entry will be modified such that it
+     * contains {@code attribute}, even if it is empty.
+     * <li>If this entry already contains an attribute with the same attribute
+     * description, then the attribute values contained in {@code attribute}
+     * will be merged with the existing attribute values.
+     * </ul>
+     * <p>
+     * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+     * LDAP Modify add semantics.
+     *
+     * @param attribute
+     *            The attribute values to be added to this entry, merging with
+     *            any existing attribute values.
+     * @return {@code true} if this entry changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be added.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    boolean addAttribute(Attribute attribute);
 
+    /**
+     * Ensures that this entry contains the provided attribute and values
+     * (optional operation). This method has the following semantics:
+     * <ul>
+     * <li>If this entry does not already contain an attribute with the same
+     * attribute description, then this entry will be modified such that it
+     * contains {@code attribute}, even if it is empty.
+     * <li>If this entry already contains an attribute with the same attribute
+     * description, then the attribute values contained in {@code attribute}
+     * will be merged with the existing attribute values.
+     * </ul>
+     * <p>
+     * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+     * LDAP Modify add semantics.
+     *
+     * @param attribute
+     *            The attribute values to be added to this entry, merging with
+     *            any existing attribute values.
+     * @param duplicateValues
+     *            A collection into which duplicate values will be added, or
+     *            {@code null} if duplicate values should not be saved.
+     * @return {@code true} if this entry changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be added.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    boolean addAttribute(Attribute attribute, Collection<ByteString> duplicateValues);
 
+    /**
+     * Ensures that this entry contains the provided attribute and values
+     * (optional operation). This method has the following semantics:
+     * <ul>
+     * <li>If this entry does not already contain an attribute with the same
+     * attribute description, then this entry will be modified such that it
+     * contains {@code attribute}, even if it is empty.
+     * <li>If this entry already contains an attribute with the same attribute
+     * description, then the attribute values contained in {@code attribute}
+     * will be merged with the existing attribute values.
+     * </ul>
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     * <p>
+     * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+     * LDAP Modify add semantics.
+     *
+     * @param attributeDescription
+     *            The name of the attribute whose values are to be added.
+     * @param values
+     *            The attribute values to be added to this entry, merging any
+     *            existing attribute values.
+     * @return This entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be added.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Entry addAttribute(String attributeDescription, Object... values);
 
-  /**
-   * Ensures that this entry contains the provided attribute and values
-   * (optional operation). This method has the following semantics:
-   * <ul>
-   * <li>If this entry does not already contain an attribute with the same
-   * attribute description, then this entry will be modified such that it
-   * contains {@code attribute}, even if it is empty.
-   * <li>If this entry already contains an attribute with the same attribute
-   * description, then the attribute values contained in {@code attribute} will
-   * be merged with the existing attribute values.
-   * </ul>
-   * <p>
-   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
-   * LDAP Modify add semantics.
-   *
-   * @param attribute
-   *          The attribute values to be added to this entry, merging with any
-   *          existing attribute values.
-   * @param duplicateValues
-   *          A collection into which duplicate values will be added, or {@code
-   *          null} if duplicate values should not be saved.
-   * @return {@code true} if this entry changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           added.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  boolean addAttribute(Attribute attribute,
-      Collection<ByteString> duplicateValues);
+    /**
+     * Removes all the attributes from this entry (optional operation).
+     *
+     * @return This entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes to be removed.
+     */
+    Entry clearAttributes();
 
+    /**
+     * Returns {@code true} if this entry contains all of the attribute values
+     * contained in {@code attribute}. If {@code attribute} is empty then this
+     * method will return {@code true} if the attribute is present in this
+     * entry, regardless of how many values it contains.
+     *
+     * @param attribute
+     *            The attribute values whose presence in this entry is to be
+     *            tested.
+     * @param missingValues
+     *            A collection into which missing values will be added, or
+     *            {@code null} if missing values should not be saved.
+     * @return {@code true} if this entry contains all of the attribute values
+     *         contained in {@code attribute}.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    boolean containsAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
+    /**
+     * Returns {@code true} if this entry contains all of the attribute values
+     * contained in {@code values}. If {@code values} is {@code null} or empty
+     * then this method will return {@code true} if the attribute is present in
+     * this entry, regardless of how many values it contains.
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The name of the attribute whose presence in this entry is to
+     *            be tested.
+     * @param values
+     *            The attribute values whose presence in this entry is to be
+     *            tested, which may be {@code null}.
+     * @return {@code true} if this entry contains all of the attribute values
+     *         contained in {@code values}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    boolean containsAttribute(String attributeDescription, Object... values);
 
-  /**
-   * Ensures that this entry contains the provided attribute and values
-   * (optional operation). This method has the following semantics:
-   * <ul>
-   * <li>If this entry does not already contain an attribute with the same
-   * attribute description, then this entry will be modified such that it
-   * contains {@code attribute}, even if it is empty.
-   * <li>If this entry already contains an attribute with the same attribute
-   * description, then the attribute values contained in {@code attribute} will
-   * be merged with the existing attribute values.
-   * </ul>
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   * <p>
-   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
-   * LDAP Modify add semantics.
-   *
-   * @param attributeDescription
-   *          The name of the attribute whose values are to be added.
-   * @param values
-   *          The attribute values to be added to this entry, merging any
-   *          existing attribute values.
-   * @return This entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           added.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Entry addAttribute(String attributeDescription, Object... values);
+    /**
+     * Returns {@code true} if {@code object} is an entry which is equal to this
+     * entry. Two entries are considered equal if their distinguished names are
+     * equal, they both have the same number of attributes, and every attribute
+     * contained in the first entry is also contained in the second entry.
+     *
+     * @param object
+     *            The object to be tested for equality with this entry.
+     * @return {@code true} if {@code object} is an entry which is equal to this
+     *         entry, or {@code false} if not.
+     */
+    boolean equals(Object object);
 
+    /**
+     * Returns an {@code Iterable} containing all of the attributes in this
+     * entry. The returned {@code Iterable} may be used to remove attributes if
+     * permitted by this entry.
+     *
+     * @return An {@code Iterable} containing all of the attributes.
+     */
+    Iterable<Attribute> getAllAttributes();
 
+    /**
+     * Returns an {@code Iterable} containing all the attributes in this entry
+     * having an attribute description which is a sub-type of the provided
+     * attribute description. The returned {@code Iterable} may be used to
+     * remove attributes if permitted by this entry.
+     *
+     * @param attributeDescription
+     *            The name of the attributes to be returned.
+     * @return An {@code Iterable} containing the matching attributes.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
 
-  /**
-   * Removes all the attributes from this entry (optional operation).
-   *
-   * @return This entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes to be removed.
-   */
-  Entry clearAttributes();
+    /**
+     * Returns an {@code Iterable} containing all the attributes in this entry
+     * having an attribute description which is a sub-type of the provided
+     * attribute description. The returned {@code Iterable} may be used to
+     * remove attributes if permitted by this entry.
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     *
+     * @param attributeDescription
+     *            The name of the attributes to be returned.
+     * @return An {@code Iterable} containing the matching attributes.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Iterable<Attribute> getAllAttributes(String attributeDescription);
 
+    /**
+     * Returns the named attribute contained in this entry, or {@code null} if
+     * it is not included with this entry.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be returned.
+     * @return The named attribute, or {@code null} if it is not included with
+     *         this entry.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Attribute getAttribute(AttributeDescription attributeDescription);
 
+    /**
+     * Returns the named attribute contained in this entry, or {@code null} if
+     * it is not included with this entry.
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be returned.
+     * @return The named attribute, or {@code null} if it is not included with
+     *         this entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Attribute getAttribute(String attributeDescription);
 
-  /**
-   * Returns {@code true} if this entry contains all of the attribute values
-   * contained in {@code attribute}. If {@code attribute} is empty then this
-   * method will return {@code true} if the attribute is present in this entry,
-   * regardless of how many values it contains.
-   *
-   * @param attribute
-   *          The attribute values whose presence in this entry is to be tested.
-   * @param missingValues
-   *          A collection into which missing values will be added, or {@code
-   *          null} if missing values should not be saved.
-   * @return {@code true} if this entry contains all of the attribute values
-   *         contained in {@code attribute}.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  boolean containsAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
+    /**
+     * Returns the number of attributes in this entry.
+     *
+     * @return The number of attributes.
+     */
+    int getAttributeCount();
 
+    /**
+     * Returns the string representation of the distinguished name of this
+     * entry.
+     *
+     * @return The string representation of the distinguished name.
+     */
+    DN getName();
 
+    /**
+     * Returns the hash code for this entry. It will be calculated as the sum of
+     * the hash codes of the distinguished name and all of the attributes.
+     *
+     * @return The hash code for this entry.
+     */
+    int hashCode();
 
-  /**
-   * Returns {@code true} if this entry contains all of the attribute values
-   * contained in {@code values}. If {@code values} is {@code null} or empty
-   * then this method will return {@code true} if the attribute is present in
-   * this entry, regardless of how many values it contains.
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The name of the attribute whose presence in this entry is to be
-   *          tested.
-   * @param values
-   *          The attribute values whose presence in this entry is to be tested,
-   *          which may be {@code null}.
-   * @return {@code true} if this entry contains all of the attribute values
-   *         contained in {@code values}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  boolean containsAttribute(String attributeDescription, Object... values);
+    /**
+     * Removes all of the attribute values contained in {@code attribute} from
+     * this entry if it is present (optional operation). If {@code attribute} is
+     * empty then the entire attribute will be removed if it is present.
+     * <p>
+     * <b>NOTE:</b> This method implements LDAP Modify delete semantics.
+     *
+     * @param attribute
+     *            The attribute values to be removed from this entry, which may
+     *            be empty if the entire attribute is to be removed.
+     * @param missingValues
+     *            A collection into which missing values will be added, or
+     *            {@code null} if missing values should not be saved.
+     * @return {@code true} if this entry changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be removed.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    boolean removeAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
-
-
-  /**
-   * Returns {@code true} if {@code object} is an entry which is equal to this
-   * entry. Two entries are considered equal if their distinguished names are
-   * equal, they both have the same number of attributes, and every attribute
-   * contained in the first entry is also contained in the second entry.
-   *
-   * @param object
-   *          The object to be tested for equality with this entry.
-   * @return {@code true} if {@code object} is an entry which is equal to this
-   *         entry, or {@code false} if not.
-   */
-  boolean equals(Object object);
-
-
-
-  /**
-   * Returns an {@code Iterable} containing all of the attributes in this entry.
-   * The returned {@code Iterable} may be used to remove attributes if permitted
-   * by this entry.
-   *
-   * @return An {@code Iterable} containing all of the attributes.
-   */
-  Iterable<Attribute> getAllAttributes();
-
-
-
-  /**
-   * Returns an {@code Iterable} containing all the attributes in this entry
-   * having an attribute description which is a sub-type of the provided
-   * attribute description. The returned {@code Iterable} may be used to remove
-   * attributes if permitted by this entry.
-   *
-   * @param attributeDescription
-   *          The name of the attributes to be returned.
-   * @return An {@code Iterable} containing the matching attributes.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * Returns an {@code Iterable} containing all the attributes in this entry
-   * having an attribute description which is a sub-type of the provided
-   * attribute description. The returned {@code Iterable} may be used to remove
-   * attributes if permitted by this entry.
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   *
-   * @param attributeDescription
-   *          The name of the attributes to be returned.
-   * @return An {@code Iterable} containing the matching attributes.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Iterable<Attribute> getAllAttributes(String attributeDescription);
-
-
-
-  /**
-   * Returns the named attribute contained in this entry, or {@code null} if it
-   * is not included with this entry.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be returned.
-   * @return The named attribute, or {@code null} if it is not included with
-   *         this entry.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Attribute getAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * Returns the named attribute contained in this entry, or {@code null} if it
-   * is not included with this entry.
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be returned.
-   * @return The named attribute, or {@code null} if it is not included with
-   *         this entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Attribute getAttribute(String attributeDescription);
-
-
-
-  /**
-   * Returns the number of attributes in this entry.
-   *
-   * @return The number of attributes.
-   */
-  int getAttributeCount();
-
-
-
-  /**
-   * Returns the string representation of the distinguished name of this entry.
-   *
-   * @return The string representation of the distinguished name.
-   */
-  DN getName();
-
-
-
-  /**
-   * Returns the hash code for this entry. It will be calculated as the sum of
-   * the hash codes of the distinguished name and all of the attributes.
-   *
-   * @return The hash code for this entry.
-   */
-  int hashCode();
-
-
-
-  /**
-   * Removes all of the attribute values contained in {@code attribute} from
-   * this entry if it is present (optional operation). If {@code attribute} is
-   * empty then the entire attribute will be removed if it is present.
-   * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify delete semantics.
-   *
-   * @param attribute
-   *          The attribute values to be removed from this entry, which may be
-   *          empty if the entire attribute is to be removed.
-   * @param missingValues
-   *          A collection into which missing values will be added, or {@code
-   *          null} if missing values should not be saved.
-   * @return {@code true} if this entry changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           removed.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  boolean removeAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
-
-
-
-  /**
-   * Removes the named attribute from this entry if it is present (optional
-   * operation). If this attribute does not contain the attribute, the call
-   * leaves this entry unchanged and returns {@code false}.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be removed.
-   * @return {@code true} if this entry changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes to be removed.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  boolean removeAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * Removes all of the attribute values contained in {@code values} from the
-   * named attribute in this entry if it is present (optional operation). If
-   * {@code values} is {@code null} or empty then the entire attribute will be
-   * removed if it is present.
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify delete semantics.
-   *
-   * @param attributeDescription
-   *          The name of the attribute whose values are to be removed.
-   * @param values
-   *          The attribute values to be removed from this entry, which may be
-   *          {@code null} or empty if the entire attribute is to be removed.
-   * @return This entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           removed.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  Entry removeAttribute(String attributeDescription, Object... values);
-
-
-
-  /**
-   * Adds all of the attribute values contained in {@code attribute} to this
-   * entry, replacing any existing attribute values (optional operation). If
-   * {@code attribute} is empty then the entire attribute will be removed if it
-   * is present.
-   * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify replace semantics.
-   *
-   * @param attribute
-   *          The attribute values to be added to this entry, replacing any
-   *          existing attribute values, and which may be empty if the entire
-   *          attribute is to be removed.
-   * @return {@code true} if this entry changed as a result of this call.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           replaced.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  boolean replaceAttribute(Attribute attribute);
-
-
-
-  /**
-   * Adds all of the attribute values contained in {@code values} to this entry,
-   * replacing any existing attribute values (optional operation). If {@code
-   * values} is {@code null} or empty then the entire attribute will be removed
-   * if it is present.
-   * <p>
-   * The attribute description will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify replace semantics.
-   *
-   * @param attributeDescription
-   *          The name of the attribute whose values are to be replaced.
-   * @param values
-   *          The attribute values to be added to this entry, replacing any
-   *          existing attribute values, and which may be {@code null} or empty
-   *          if the entire attribute is to be removed.
-   * @return This entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           schema associated with this entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit attributes or their values to be
-   *           replaced.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  Entry replaceAttribute(String attributeDescription, Object... values);
-
-
-
-  /**
-   * Sets the distinguished name of this entry (optional operation).
-   *
-   * @param dn
-   *          The distinguished name.
-   * @return This entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit the distinguished name to be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  Entry setName(DN dn);
+    /**
+     * Removes the named attribute from this entry if it is present (optional
+     * operation). If this attribute does not contain the attribute, the call
+     * leaves this entry unchanged and returns {@code false}.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be removed.
+     * @return {@code true} if this entry changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes to be removed.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    boolean removeAttribute(AttributeDescription attributeDescription);
 
+    /**
+     * Removes all of the attribute values contained in {@code values} from the
+     * named attribute in this entry if it is present (optional operation). If
+     * {@code values} is {@code null} or empty then the entire attribute will be
+     * removed if it is present.
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     * <p>
+     * <b>NOTE:</b> This method implements LDAP Modify delete semantics.
+     *
+     * @param attributeDescription
+     *            The name of the attribute whose values are to be removed.
+     * @param values
+     *            The attribute values to be removed from this entry, which may
+     *            be {@code null} or empty if the entire attribute is to be
+     *            removed.
+     * @return This entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be removed.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    Entry removeAttribute(String attributeDescription, Object... values);
 
+    /**
+     * Adds all of the attribute values contained in {@code attribute} to this
+     * entry, replacing any existing attribute values (optional operation). If
+     * {@code attribute} is empty then the entire attribute will be removed if
+     * it is present.
+     * <p>
+     * <b>NOTE:</b> This method implements LDAP Modify replace semantics.
+     *
+     * @param attribute
+     *            The attribute values to be added to this entry, replacing any
+     *            existing attribute values, and which may be empty if the
+     *            entire attribute is to be removed.
+     * @return {@code true} if this entry changed as a result of this call.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be replaced.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    boolean replaceAttribute(Attribute attribute);
 
-  /**
-   * Sets the distinguished name of this entry (optional operation).
-   * <p>
-   * The distinguished name will be decoded using the schema associated with
-   * this entry (usually the default schema).
-   *
-   * @param dn
-   *          The string representation of the distinguished name.
-   * @return This entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the schema associated
-   *           with this entry.
-   * @throws UnsupportedOperationException
-   *           If this entry does not permit the distinguished name to be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  Entry setName(String dn);
+    /**
+     * Adds all of the attribute values contained in {@code values} to this
+     * entry, replacing any existing attribute values (optional operation). If
+     * {@code values} is {@code null} or empty then the entire attribute will be
+     * removed if it is present.
+     * <p>
+     * The attribute description will be decoded using the schema associated
+     * with this entry (usually the default schema).
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     * <p>
+     * <b>NOTE:</b> This method implements LDAP Modify replace semantics.
+     *
+     * @param attributeDescription
+     *            The name of the attribute whose values are to be replaced.
+     * @param values
+     *            The attribute values to be added to this entry, replacing any
+     *            existing attribute values, and which may be {@code null} or
+     *            empty if the entire attribute is to be removed.
+     * @return This entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the schema associated with this entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit attributes or their values to
+     *             be replaced.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    Entry replaceAttribute(String attributeDescription, Object... values);
 
+    /**
+     * Sets the distinguished name of this entry (optional operation).
+     *
+     * @param dn
+     *            The distinguished name.
+     * @return This entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit the distinguished name to be
+     *             set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    Entry setName(DN dn);
 
+    /**
+     * Sets the distinguished name of this entry (optional operation).
+     * <p>
+     * The distinguished name will be decoded using the schema associated with
+     * this entry (usually the default schema).
+     *
+     * @param dn
+     *            The string representation of the distinguished name.
+     * @return This entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the schema
+     *             associated with this entry.
+     * @throws UnsupportedOperationException
+     *             If this entry does not permit the distinguished name to be
+     *             set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    Entry setName(String dn);
 
-  /**
-   * Returns a string representation of this entry.
-   *
-   * @return The string representation of this entry.
-   */
-  String toString();
+    /**
+     * Returns a string representation of this entry.
+     *
+     * @return The string representation of this entry.
+     */
+    String toString();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java
index 5251204..ef94ccc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * Entry factories are included with a set of {@code DecodeOptions} in order to
  * allow application to control how {@code Entry} instances are created when
@@ -38,17 +35,16 @@
  * @see Entry
  * @see DecodeOptions
  */
-public interface EntryFactory
-{
-  /**
-   * Creates an empty entry using the provided distinguished name and no
-   * attributes.
-   *
-   * @param name
-   *          The distinguished name of the entry to be created.
-   * @return The new entry.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  Entry newEntry(DN name);
+public interface EntryFactory {
+    /**
+     * Creates an empty entry using the provided distinguished name and no
+     * attributes.
+     *
+     * @param name
+     *            The distinguished name of the entry to be created.
+     * @return The new entry.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    Entry newEntry(DN name);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java
index 687f2ea..0559c7b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * failed because the target entry was not found by the Directory Server. More
@@ -51,10 +46,8 @@
  * sub-class.
  */
 @SuppressWarnings("serial")
-public class EntryNotFoundException extends ErrorResultException
-{
-  EntryNotFoundException(final Result result)
-  {
-    super(result);
-  }
+public class EntryNotFoundException extends ErrorResultException {
+    EntryNotFoundException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java
index 201426b..b479697 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,243 +27,184 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.concurrent.ExecutionException;
 
 import org.forgerock.opendj.ldap.responses.Responses;
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * was unsuccessful. This class can be sub-classed in order to implement
  * application specific exceptions.
  */
 @SuppressWarnings("serial")
-public class ErrorResultException extends ExecutionException
-{
+public class ErrorResultException extends ExecutionException {
 
-  /**
-   * Creates a new error result exception with the provided result code and an
-   * empty diagnostic message.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new error result exception.
-   * @throws IllegalArgumentException
-   *           If the provided result code does not represent a failure.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static ErrorResultException newErrorResult(
-      ResultCode resultCode)
-  {
-    return newErrorResult(resultCode, null, null);
-  }
-
-
-
-  /**
-   * Creates a new error result exception with the provided result code and
-   * diagnostic message.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param diagnosticMessage
-   *          The diagnostic message, which may be empty or {@code null}
-   *          indicating that none was provided.
-   * @return The new error result exception.
-   * @throws IllegalArgumentException
-   *           If the provided result code does not represent a failure.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static ErrorResultException newErrorResult(
-      ResultCode resultCode, String diagnosticMessage)
-  {
-    return newErrorResult(resultCode, diagnosticMessage, null);
-  }
-
-
-
-  /**
-   * Creates a new error result exception with the provided result code and
-   * cause. The diagnostic message will be taken from the cause, if provided.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param cause
-   *          The throwable cause, which may be {@code null} indicating that
-   *          none was provided.
-   * @return The new error result exception.
-   * @throws IllegalArgumentException
-   *           If the provided result code does not represent a failure.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static ErrorResultException newErrorResult(
-      ResultCode resultCode, Throwable cause)
-  {
-    return newErrorResult(resultCode, null, cause);
-  }
-
-
-
-  /**
-   * Creates a new error result exception with the provided result code,
-   * diagnostic message, and cause.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param diagnosticMessage
-   *          The diagnostic message, which may be empty or {@code null}
-   *          indicating that none was provided.
-   * @param cause
-   *          The throwable cause, which may be {@code null} indicating that
-   *          none was provided.
-   * @return The new error result exception.
-   * @throws IllegalArgumentException
-   *           If the provided result code does not represent a failure.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static ErrorResultException newErrorResult(
-      ResultCode resultCode, String diagnosticMessage, Throwable cause)
-  {
-    final Result result = Responses.newResult(resultCode);
-    if (diagnosticMessage != null)
-    {
-      result.setDiagnosticMessage(diagnosticMessage);
-    }
-    else if (cause != null)
-    {
-      result.setDiagnosticMessage(cause.getLocalizedMessage());
-    }
-    result.setCause(cause);
-    return newErrorResult(result);
-  }
-
-
-
-  /**
-   * Creates a new error result exception using the provided result.
-   *
-   * @param result
-   *          The result whose result code indicates a failure.
-   * @return The error result exception wrapping the provided result.
-   * @throws IllegalArgumentException
-   *           If the provided result does not represent a failure.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static ErrorResultException newErrorResult(
-      final Result result)
-  {
-    if (!result.getResultCode().isExceptional())
-    {
-      throw new IllegalArgumentException(
-          "Attempted to wrap a successful result: " + result);
+    /**
+     * Creates a new error result exception with the provided result code and an
+     * empty diagnostic message.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new error result exception.
+     * @throws IllegalArgumentException
+     *             If the provided result code does not represent a failure.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static ErrorResultException newErrorResult(ResultCode resultCode) {
+        return newErrorResult(resultCode, null, null);
     }
 
-    ResultCode rc = result.getResultCode();
-    if (rc == ResultCode.ASSERTION_FAILED)
-    {
-      return new AssertionFailureException(result);
-    }
-    else if (rc == ResultCode.AUTH_METHOD_NOT_SUPPORTED
-        || rc == ResultCode.CLIENT_SIDE_AUTH_UNKNOWN
-        || rc == ResultCode.INAPPROPRIATE_AUTHENTICATION
-        || rc == ResultCode.INVALID_CREDENTIALS)
-    {
-      return new AuthenticationException(result);
-    }
-    else if (rc == ResultCode.AUTHORIZATION_DENIED
-        || rc == ResultCode.CONFIDENTIALITY_REQUIRED
-        || rc == ResultCode.INSUFFICIENT_ACCESS_RIGHTS
-        || rc == ResultCode.STRONG_AUTH_REQUIRED)
-    {
-      return new AuthorizationException(result);
-    }
-    else if (rc == ResultCode.CLIENT_SIDE_USER_CANCELLED
-        || rc == ResultCode.CANCELLED)
-    {
-      return new CancelledResultException(result);
-    }
-    else if (rc == ResultCode.CLIENT_SIDE_SERVER_DOWN
-        || rc == ResultCode.CLIENT_SIDE_CONNECT_ERROR
-        || rc == ResultCode.CLIENT_SIDE_DECODING_ERROR
-        || rc == ResultCode.CLIENT_SIDE_ENCODING_ERROR)
-    {
-      return new ConnectionException(result);
-    }
-    else if (rc == ResultCode.ATTRIBUTE_OR_VALUE_EXISTS
-        || rc == ResultCode.CONSTRAINT_VIOLATION
-        || rc == ResultCode.ENTRY_ALREADY_EXISTS
-        || rc == ResultCode.INVALID_ATTRIBUTE_SYNTAX
-        || rc == ResultCode.INVALID_DN_SYNTAX
-        || rc == ResultCode.NAMING_VIOLATION
-        || rc == ResultCode.NOT_ALLOWED_ON_NONLEAF
-        || rc == ResultCode.NOT_ALLOWED_ON_RDN
-        || rc == ResultCode.OBJECTCLASS_MODS_PROHIBITED
-        || rc == ResultCode.OBJECTCLASS_VIOLATION
-        || rc == ResultCode.UNDEFINED_ATTRIBUTE_TYPE)
-    {
-      return new ConstraintViolationException(result);
-    }
-    else if (rc == ResultCode.REFERRAL)
-    {
-      return new ReferralException(result);
-    }
-    else if (rc == ResultCode.NO_SUCH_OBJECT
-        || rc == ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED)
-    {
-      return new EntryNotFoundException(result);
-    }
-    else if (rc == ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED)
-    {
-      return new MultipleEntriesFoundException(result);
-    }
-    else if (rc == ResultCode.CLIENT_SIDE_TIMEOUT
-        || rc == ResultCode.TIME_LIMIT_EXCEEDED)
-    {
-      return new TimeoutResultException(result);
+    /**
+     * Creates a new error result exception with the provided result code and
+     * diagnostic message.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param diagnosticMessage
+     *            The diagnostic message, which may be empty or {@code null}
+     *            indicating that none was provided.
+     * @return The new error result exception.
+     * @throws IllegalArgumentException
+     *             If the provided result code does not represent a failure.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static ErrorResultException newErrorResult(ResultCode resultCode,
+            String diagnosticMessage) {
+        return newErrorResult(resultCode, diagnosticMessage, null);
     }
 
-    return new ErrorResultException(result);
-  }
+    /**
+     * Creates a new error result exception with the provided result code and
+     * cause. The diagnostic message will be taken from the cause, if provided.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param cause
+     *            The throwable cause, which may be {@code null} indicating that
+     *            none was provided.
+     * @return The new error result exception.
+     * @throws IllegalArgumentException
+     *             If the provided result code does not represent a failure.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static ErrorResultException newErrorResult(ResultCode resultCode, Throwable cause) {
+        return newErrorResult(resultCode, null, cause);
+    }
 
+    /**
+     * Creates a new error result exception with the provided result code,
+     * diagnostic message, and cause.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param diagnosticMessage
+     *            The diagnostic message, which may be empty or {@code null}
+     *            indicating that none was provided.
+     * @param cause
+     *            The throwable cause, which may be {@code null} indicating that
+     *            none was provided.
+     * @return The new error result exception.
+     * @throws IllegalArgumentException
+     *             If the provided result code does not represent a failure.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static ErrorResultException newErrorResult(ResultCode resultCode,
+            String diagnosticMessage, Throwable cause) {
+        final Result result = Responses.newResult(resultCode);
+        if (diagnosticMessage != null) {
+            result.setDiagnosticMessage(diagnosticMessage);
+        } else if (cause != null) {
+            result.setDiagnosticMessage(cause.getLocalizedMessage());
+        }
+        result.setCause(cause);
+        return newErrorResult(result);
+    }
 
+    /**
+     * Creates a new error result exception using the provided result.
+     *
+     * @param result
+     *            The result whose result code indicates a failure.
+     * @return The error result exception wrapping the provided result.
+     * @throws IllegalArgumentException
+     *             If the provided result does not represent a failure.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static ErrorResultException newErrorResult(final Result result) {
+        if (!result.getResultCode().isExceptional()) {
+            throw new IllegalArgumentException("Attempted to wrap a successful result: " + result);
+        }
 
-  private final Result result;
+        ResultCode rc = result.getResultCode();
+        if (rc == ResultCode.ASSERTION_FAILED) {
+            return new AssertionFailureException(result);
+        } else if (rc == ResultCode.AUTH_METHOD_NOT_SUPPORTED
+                || rc == ResultCode.CLIENT_SIDE_AUTH_UNKNOWN
+                || rc == ResultCode.INAPPROPRIATE_AUTHENTICATION
+                || rc == ResultCode.INVALID_CREDENTIALS) {
+            return new AuthenticationException(result);
+        } else if (rc == ResultCode.AUTHORIZATION_DENIED
+                || rc == ResultCode.CONFIDENTIALITY_REQUIRED
+                || rc == ResultCode.INSUFFICIENT_ACCESS_RIGHTS
+                || rc == ResultCode.STRONG_AUTH_REQUIRED) {
+            return new AuthorizationException(result);
+        } else if (rc == ResultCode.CLIENT_SIDE_USER_CANCELLED || rc == ResultCode.CANCELLED) {
+            return new CancelledResultException(result);
+        } else if (rc == ResultCode.CLIENT_SIDE_SERVER_DOWN
+                || rc == ResultCode.CLIENT_SIDE_CONNECT_ERROR
+                || rc == ResultCode.CLIENT_SIDE_DECODING_ERROR
+                || rc == ResultCode.CLIENT_SIDE_ENCODING_ERROR) {
+            return new ConnectionException(result);
+        } else if (rc == ResultCode.ATTRIBUTE_OR_VALUE_EXISTS
+                || rc == ResultCode.CONSTRAINT_VIOLATION || rc == ResultCode.ENTRY_ALREADY_EXISTS
+                || rc == ResultCode.INVALID_ATTRIBUTE_SYNTAX || rc == ResultCode.INVALID_DN_SYNTAX
+                || rc == ResultCode.NAMING_VIOLATION || rc == ResultCode.NOT_ALLOWED_ON_NONLEAF
+                || rc == ResultCode.NOT_ALLOWED_ON_RDN
+                || rc == ResultCode.OBJECTCLASS_MODS_PROHIBITED
+                || rc == ResultCode.OBJECTCLASS_VIOLATION
+                || rc == ResultCode.UNDEFINED_ATTRIBUTE_TYPE) {
+            return new ConstraintViolationException(result);
+        } else if (rc == ResultCode.REFERRAL) {
+            return new ReferralException(result);
+        } else if (rc == ResultCode.NO_SUCH_OBJECT
+                || rc == ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED) {
+            return new EntryNotFoundException(result);
+        } else if (rc == ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED) {
+            return new MultipleEntriesFoundException(result);
+        } else if (rc == ResultCode.CLIENT_SIDE_TIMEOUT || rc == ResultCode.TIME_LIMIT_EXCEEDED) {
+            return new TimeoutResultException(result);
+        }
 
+        return new ErrorResultException(result);
+    }
 
+    private final Result result;
 
-  /**
-   * Creates a new error result exception using the provided result.
-   *
-   * @param result
-   *          The error result.
-   */
-  protected ErrorResultException(final Result result)
-  {
-    super(result.getResultCode() + ": "
-        + result.getDiagnosticMessage());
-    this.result = result;
-  }
+    /**
+     * Creates a new error result exception using the provided result.
+     *
+     * @param result
+     *            The error result.
+     */
+    protected ErrorResultException(final Result result) {
+        super(result.getResultCode() + ": " + result.getDiagnosticMessage());
+        this.result = result;
+    }
 
-
-
-  /**
-   * Returns the error result which caused this exception to be thrown. The type
-   * of result returned corresponds to the expected result type of the original
-   * request.
-   *
-   * @return The error result which caused this exception to be thrown.
-   */
-  public final Result getResult()
-  {
-    return result;
-  }
+    /**
+     * Returns the error result which caused this exception to be thrown. The
+     * type of result returned corresponds to the expected result type of the
+     * original request.
+     *
+     * @return The error result which caused this exception to be thrown.
+     */
+    public final Result getResult() {
+        return result;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java
index 81c55fa..8b5c16b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,49 +27,38 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An {@code ErrorResultIOException} adapts an {@code ErrorResultException} to
  * an {@code IOException}.
  */
 @SuppressWarnings("serial")
-public final class ErrorResultIOException extends IOException
-{
-  private final ErrorResultException cause;
+public final class ErrorResultIOException extends IOException {
+    private final ErrorResultException cause;
 
+    /**
+     * Creates a new error result IO exception with the provided cause.
+     *
+     * @param cause
+     *            The cause which may be later retrieved by the
+     *            {@link #getCause} method.
+     * @throws NullPointerException
+     *             If {@code cause} was {@code null}.
+     */
+    public ErrorResultIOException(final ErrorResultException cause) {
+        super(Validator.ensureNotNull(cause));
 
+        this.cause = cause;
+    }
 
-  /**
-   * Creates a new error result IO exception with the provided cause.
-   *
-   * @param cause
-   *          The cause which may be later retrieved by the {@link #getCause}
-   *          method.
-   * @throws NullPointerException
-   *           If {@code cause} was {@code null}.
-   */
-  public ErrorResultIOException(final ErrorResultException cause)
-  {
-    super(Validator.ensureNotNull(cause));
-
-    this.cause = cause;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ErrorResultException getCause()
-  {
-    return cause;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ErrorResultException getCause() {
+        return cause;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java
index a165ffb..52b01e9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-
-
 /**
  * A fail-over load balancing algorithm provides fault tolerance across multiple
  * underlying connection factories.
@@ -64,90 +59,72 @@
  * @see RoundRobinLoadBalancingAlgorithm
  * @see Connections#newLoadBalancer(LoadBalancingAlgorithm)
  */
-public final class FailoverLoadBalancingAlgorithm extends
-    AbstractLoadBalancingAlgorithm
-{
+public final class FailoverLoadBalancingAlgorithm extends AbstractLoadBalancingAlgorithm {
 
-  /**
-   * Creates a new fail-over load balancing algorithm which will monitor offline
-   * connection factories every 1 second using the default scheduler.
-   *
-   * @param factories
-   *          The ordered collection of connection factories.
-   */
-  public FailoverLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories)
-  {
-    super(factories);
-  }
+    /**
+     * Creates a new fail-over load balancing algorithm which will monitor
+     * offline connection factories every 1 second using the default scheduler.
+     *
+     * @param factories
+     *            The ordered collection of connection factories.
+     */
+    public FailoverLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories) {
+        super(factories);
+    }
 
+    /**
+     * Creates a new fail-over load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency using the
+     * default scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
+     */
+    public FailoverLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit) {
+        super(factories, interval, unit);
+    }
 
+    /**
+     * Creates a new fail-over load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency and scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
+     * @param scheduler
+     *            The scheduler which should for periodically monitoring dead
+     *            connection factories to see if they are usable again.
+     */
+    public FailoverLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit, final ScheduledExecutorService scheduler) {
+        super(factories, interval, unit, scheduler);
+    }
 
-  /**
-   * Creates a new fail-over load balancing algorithm which will monitor offline
-   * connection factories using the specified frequency using the default
-   * scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   */
-  public FailoverLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories, final long interval,
-      final TimeUnit unit)
-  {
-    super(factories, interval, unit);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    String getAlgorithmName() {
+        return "Failover";
+    }
 
-
-
-  /**
-   * Creates a new fail-over load balancing algorithm which will monitor offline
-   * connection factories using the specified frequency and scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   * @param scheduler
-   *          The scheduler which should for periodically monitoring dead
-   *          connection factories to see if they are usable again.
-   */
-  public FailoverLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories, final long interval,
-      final TimeUnit unit, final ScheduledExecutorService scheduler)
-  {
-    super(factories, interval, unit, scheduler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  String getAlgorithmName()
-  {
-    return "Failover";
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  int getInitialConnectionFactoryIndex()
-  {
-    // Always start with the first connection factory.
-    return 0;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    int getInitialConnectionFactoryIndex() {
+        // Always start with the first connection factory.
+        return 0;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
index d0ba9c9..21217a6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Filter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,14 +27,16 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.byteToHex;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -44,8 +45,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A search filter as defined in RFC 4511. In addition this class also provides
  * support for the absolute true and absolute false filters as defined in RFC
@@ -66,2054 +65,1594 @@
  * @see <a href="http://tools.ietf.org/html/rfc4526">RFC 4526 - Absolute True
  *      and False Filters </a>
  */
-public final class Filter
-{
-  private static final class AndImpl extends Impl
-  {
-    private final List<Filter> subFilters;
+public final class Filter {
+    private static final class AndImpl extends Impl {
+        private final List<Filter> subFilters;
 
+        public AndImpl(final List<Filter> subFilters) {
+            this.subFilters = subFilters;
+        }
 
-
-    public AndImpl(final List<Filter> subFilters)
-    {
-      this.subFilters = subFilters;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitAndFilter(p, subFilters);
-    }
-
-  }
-
-
-
-  private static final class ApproxMatchImpl extends Impl
-  {
-
-    private final ByteString assertionValue;
-
-    private final String attributeDescription;
-
-
-
-    public ApproxMatchImpl(final String attributeDescription,
-        final ByteString assertionValue)
-    {
-      this.attributeDescription = attributeDescription;
-      this.assertionValue = assertionValue;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitApproxMatchFilter(p, attributeDescription, assertionValue);
-    }
-
-  }
-
-
-
-  private static final class EqualityMatchImpl extends Impl
-  {
-
-    private final ByteString assertionValue;
-
-    private final String attributeDescription;
-
-
-
-    public EqualityMatchImpl(final String attributeDescription,
-        final ByteString assertionValue)
-    {
-      this.attributeDescription = attributeDescription;
-      this.assertionValue = assertionValue;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v
-          .visitEqualityMatchFilter(p, attributeDescription, assertionValue);
-    }
-
-  }
-
-
-
-  private static final class ExtensibleMatchImpl extends Impl
-  {
-    private final String attributeDescription;
-
-    private final boolean dnAttributes;
-
-    private final String matchingRule;
-
-    private final ByteString matchValue;
-
-
-
-    public ExtensibleMatchImpl(final String matchingRule,
-        final String attributeDescription, final ByteString matchValue,
-        final boolean dnAttributes)
-    {
-      this.matchingRule = matchingRule;
-      this.attributeDescription = attributeDescription;
-      this.matchValue = matchValue;
-      this.dnAttributes = dnAttributes;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitExtensibleMatchFilter(p, matchingRule,
-          attributeDescription, matchValue, dnAttributes);
-    }
-
-  }
-
-
-
-  private static final class GreaterOrEqualImpl extends Impl
-  {
-
-    private final ByteString assertionValue;
-
-    private final String attributeDescription;
-
-
-
-    public GreaterOrEqualImpl(final String attributeDescription,
-        final ByteString assertionValue)
-    {
-      this.attributeDescription = attributeDescription;
-      this.assertionValue = assertionValue;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitGreaterOrEqualFilter(p, attributeDescription,
-          assertionValue);
-    }
-
-  }
-
-
-
-  private static abstract class Impl
-  {
-    protected Impl()
-    {
-      // Nothing to do.
-    }
-
-
-
-    public abstract <R, P> R accept(FilterVisitor<R, P> v, P p);
-  }
-
-
-
-  private static final class LessOrEqualImpl extends Impl
-  {
-
-    private final ByteString assertionValue;
-
-    private final String attributeDescription;
-
-
-
-    public LessOrEqualImpl(final String attributeDescription,
-        final ByteString assertionValue)
-    {
-      this.attributeDescription = attributeDescription;
-      this.assertionValue = assertionValue;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitLessOrEqualFilter(p, attributeDescription, assertionValue);
-    }
-
-  }
-
-
-
-  private static final class NotImpl extends Impl
-  {
-    private final Filter subFilter;
-
-
-
-    public NotImpl(final Filter subFilter)
-    {
-      this.subFilter = subFilter;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitNotFilter(p, subFilter);
-    }
-
-  }
-
-
-
-  private static final class OrImpl extends Impl
-  {
-    private final List<Filter> subFilters;
-
-
-
-    public OrImpl(final List<Filter> subFilters)
-    {
-      this.subFilters = subFilters;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitOrFilter(p, subFilters);
-    }
-
-  }
-
-
-
-  private static final class PresentImpl extends Impl
-  {
-
-    private final String attributeDescription;
-
-
-
-    public PresentImpl(final String attributeDescription)
-    {
-      this.attributeDescription = attributeDescription;
-    }
-
-
-
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitPresentFilter(p, attributeDescription);
-    }
-
-  }
-
-
-
-  private static final class SubstringsImpl extends Impl
-  {
-
-    private final List<ByteString> anyStrings;
-
-    private final String attributeDescription;
-
-    private final ByteString finalString;
-
-    private final ByteString initialString;
-
-
-
-    public SubstringsImpl(final String attributeDescription,
-        final ByteString initialString, final List<ByteString> anyStrings,
-        final ByteString finalString)
-    {
-      this.attributeDescription = attributeDescription;
-      this.initialString = initialString;
-      this.anyStrings = anyStrings;
-      this.finalString = finalString;
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitAndFilter(p, subFilters);
+        }
 
     }
 
+    private static final class ApproxMatchImpl extends Impl {
 
+        private final ByteString assertionValue;
 
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitSubstringsFilter(p, attributeDescription, initialString,
-          anyStrings, finalString);
+        private final String attributeDescription;
+
+        public ApproxMatchImpl(final String attributeDescription, final ByteString assertionValue) {
+            this.attributeDescription = attributeDescription;
+            this.assertionValue = assertionValue;
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitApproxMatchFilter(p, attributeDescription, assertionValue);
+        }
+
     }
 
-  }
+    private static final class EqualityMatchImpl extends Impl {
 
+        private final ByteString assertionValue;
 
+        private final String attributeDescription;
 
-  private static final class UnrecognizedImpl extends Impl
-  {
+        public EqualityMatchImpl(final String attributeDescription, final ByteString assertionValue) {
+            this.attributeDescription = attributeDescription;
+            this.assertionValue = assertionValue;
+        }
 
-    private final ByteString filterBytes;
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitEqualityMatchFilter(p, attributeDescription, assertionValue);
+        }
 
-    private final byte filterTag;
-
-
-
-    public UnrecognizedImpl(final byte filterTag, final ByteString filterBytes)
-    {
-      this.filterTag = filterTag;
-      this.filterBytes = filterBytes;
     }
 
+    private static final class ExtensibleMatchImpl extends Impl {
+        private final String attributeDescription;
 
+        private final boolean dnAttributes;
 
-    @Override
-    public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-    {
-      return v.visitUnrecognizedFilter(p, filterTag, filterBytes);
+        private final String matchingRule;
+
+        private final ByteString matchValue;
+
+        public ExtensibleMatchImpl(final String matchingRule, final String attributeDescription,
+                final ByteString matchValue, final boolean dnAttributes) {
+            this.matchingRule = matchingRule;
+            this.attributeDescription = attributeDescription;
+            this.matchValue = matchValue;
+            this.dnAttributes = dnAttributes;
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitExtensibleMatchFilter(p, matchingRule, attributeDescription, matchValue,
+                    dnAttributes);
+        }
+
     }
 
-  }
+    private static final class GreaterOrEqualImpl extends Impl {
 
+        private final ByteString assertionValue;
 
+        private final String attributeDescription;
 
-  // RFC 4526 - FALSE filter.
-  private static final Filter FALSE = new Filter(new OrImpl(Collections
-      .<Filter> emptyList()));
+        public GreaterOrEqualImpl(final String attributeDescription, final ByteString assertionValue) {
+            this.attributeDescription = attributeDescription;
+            this.assertionValue = assertionValue;
+        }
 
-  // Heavily used (objectClass=*) filter.
-  private static final Filter OBJECT_CLASS_PRESENT = new Filter(
-      new PresentImpl("objectClass"));
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitGreaterOrEqualFilter(p, attributeDescription, assertionValue);
+        }
 
-  private static final FilterVisitor<StringBuilder, StringBuilder>
-    TO_STRING_VISITOR = new FilterVisitor<StringBuilder, StringBuilder>()
-  {
-
-    public StringBuilder visitAndFilter(final StringBuilder builder,
-        final List<Filter> subFilters)
-    {
-      builder.append("(&");
-      for (final Filter subFilter : subFilters)
-      {
-        subFilter.accept(this, builder);
-      }
-      builder.append(')');
-      return builder;
     }
 
+    private static abstract class Impl {
+        protected Impl() {
+            // Nothing to do.
+        }
 
-
-    public StringBuilder visitApproxMatchFilter(final StringBuilder builder,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append("~=");
-      valueToFilterString(builder, assertionValue);
-      builder.append(')');
-      return builder;
+        public abstract <R, P> R accept(FilterVisitor<R, P> v, P p);
     }
 
+    private static final class LessOrEqualImpl extends Impl {
 
+        private final ByteString assertionValue;
 
-    public StringBuilder visitEqualityMatchFilter(final StringBuilder builder,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append("=");
-      valueToFilterString(builder, assertionValue);
-      builder.append(')');
-      return builder;
+        private final String attributeDescription;
+
+        public LessOrEqualImpl(final String attributeDescription, final ByteString assertionValue) {
+            this.attributeDescription = attributeDescription;
+            this.assertionValue = assertionValue;
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitLessOrEqualFilter(p, attributeDescription, assertionValue);
+        }
+
     }
 
+    private static final class NotImpl extends Impl {
+        private final Filter subFilter;
 
+        public NotImpl(final Filter subFilter) {
+            this.subFilter = subFilter;
+        }
 
-    public StringBuilder visitExtensibleMatchFilter(
-        final StringBuilder builder, final String matchingRule,
-        final String attributeDescription, final ByteString assertionValue,
-        final boolean dnAttributes)
-    {
-      builder.append('(');
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitNotFilter(p, subFilter);
+        }
 
-      if (attributeDescription != null)
-      {
-        builder.append(attributeDescription);
-      }
-
-      if (dnAttributes)
-      {
-        builder.append(":dn");
-      }
-
-      if (matchingRule != null)
-      {
-        builder.append(':');
-        builder.append(matchingRule);
-      }
-
-      builder.append(":=");
-      valueToFilterString(builder, assertionValue);
-      builder.append(')');
-      return builder;
     }
 
+    private static final class OrImpl extends Impl {
+        private final List<Filter> subFilters;
 
+        public OrImpl(final List<Filter> subFilters) {
+            this.subFilters = subFilters;
+        }
 
-    public StringBuilder visitGreaterOrEqualFilter(final StringBuilder builder,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append(">=");
-      valueToFilterString(builder, assertionValue);
-      builder.append(')');
-      return builder;
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitOrFilter(p, subFilters);
+        }
+
     }
 
+    private static final class PresentImpl extends Impl {
 
+        private final String attributeDescription;
 
-    public StringBuilder visitLessOrEqualFilter(final StringBuilder builder,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append("<=");
-      valueToFilterString(builder, assertionValue);
-      builder.append(')');
-      return builder;
+        public PresentImpl(final String attributeDescription) {
+            this.attributeDescription = attributeDescription;
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitPresentFilter(p, attributeDescription);
+        }
+
     }
 
+    private static final class SubstringsImpl extends Impl {
 
+        private final List<ByteString> anyStrings;
 
-    public StringBuilder visitNotFilter(final StringBuilder builder,
-        final Filter subFilter)
-    {
-      builder.append("(!");
-      subFilter.accept(this, builder);
-      builder.append(')');
-      return builder;
+        private final String attributeDescription;
+
+        private final ByteString finalString;
+
+        private final ByteString initialString;
+
+        public SubstringsImpl(final String attributeDescription, final ByteString initialString,
+                final List<ByteString> anyStrings, final ByteString finalString) {
+            this.attributeDescription = attributeDescription;
+            this.initialString = initialString;
+            this.anyStrings = anyStrings;
+            this.finalString = finalString;
+
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitSubstringsFilter(p, attributeDescription, initialString, anyStrings,
+                    finalString);
+        }
+
     }
 
+    private static final class UnrecognizedImpl extends Impl {
 
+        private final ByteString filterBytes;
 
-    public StringBuilder visitOrFilter(final StringBuilder builder,
-        final List<Filter> subFilters)
-    {
-      builder.append("(|");
-      for (final Filter subFilter : subFilters)
-      {
-        subFilter.accept(this, builder);
-      }
-      builder.append(')');
-      return builder;
+        private final byte filterTag;
+
+        public UnrecognizedImpl(final byte filterTag, final ByteString filterBytes) {
+            this.filterTag = filterTag;
+            this.filterBytes = filterBytes;
+        }
+
+        @Override
+        public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+            return v.visitUnrecognizedFilter(p, filterTag, filterBytes);
+        }
+
     }
 
+    // RFC 4526 - FALSE filter.
+    private static final Filter FALSE = new Filter(new OrImpl(Collections.<Filter> emptyList()));
 
+    // Heavily used (objectClass=*) filter.
+    private static final Filter OBJECT_CLASS_PRESENT = new Filter(new PresentImpl("objectClass"));
 
-    public StringBuilder visitPresentFilter(final StringBuilder builder,
-        final String attributeDescription)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append("=*)");
-      return builder;
+    private static final FilterVisitor<StringBuilder, StringBuilder> TO_STRING_VISITOR =
+            new FilterVisitor<StringBuilder, StringBuilder>() {
+
+                public StringBuilder visitAndFilter(final StringBuilder builder,
+                        final List<Filter> subFilters) {
+                    builder.append("(&");
+                    for (final Filter subFilter : subFilters) {
+                        subFilter.accept(this, builder);
+                    }
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitApproxMatchFilter(final StringBuilder builder,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append("~=");
+                    valueToFilterString(builder, assertionValue);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitEqualityMatchFilter(final StringBuilder builder,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append("=");
+                    valueToFilterString(builder, assertionValue);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitExtensibleMatchFilter(final StringBuilder builder,
+                        final String matchingRule, final String attributeDescription,
+                        final ByteString assertionValue, final boolean dnAttributes) {
+                    builder.append('(');
+
+                    if (attributeDescription != null) {
+                        builder.append(attributeDescription);
+                    }
+
+                    if (dnAttributes) {
+                        builder.append(":dn");
+                    }
+
+                    if (matchingRule != null) {
+                        builder.append(':');
+                        builder.append(matchingRule);
+                    }
+
+                    builder.append(":=");
+                    valueToFilterString(builder, assertionValue);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitGreaterOrEqualFilter(final StringBuilder builder,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append(">=");
+                    valueToFilterString(builder, assertionValue);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitLessOrEqualFilter(final StringBuilder builder,
+                        final String attributeDescription, final ByteString assertionValue) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append("<=");
+                    valueToFilterString(builder, assertionValue);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitNotFilter(final StringBuilder builder,
+                        final Filter subFilter) {
+                    builder.append("(!");
+                    subFilter.accept(this, builder);
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitOrFilter(final StringBuilder builder,
+                        final List<Filter> subFilters) {
+                    builder.append("(|");
+                    for (final Filter subFilter : subFilters) {
+                        subFilter.accept(this, builder);
+                    }
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitPresentFilter(final StringBuilder builder,
+                        final String attributeDescription) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append("=*)");
+                    return builder;
+                }
+
+                public StringBuilder visitSubstringsFilter(final StringBuilder builder,
+                        final String attributeDescription, final ByteString initialSubstring,
+                        final List<ByteString> anySubstrings, final ByteString finalSubstring) {
+                    builder.append('(');
+                    builder.append(attributeDescription);
+                    builder.append("=");
+                    if (initialSubstring != null) {
+                        valueToFilterString(builder, initialSubstring);
+                    }
+                    for (final ByteString anySubstring : anySubstrings) {
+                        builder.append('*');
+                        valueToFilterString(builder, anySubstring);
+                    }
+                    builder.append('*');
+                    if (finalSubstring != null) {
+                        valueToFilterString(builder, finalSubstring);
+                    }
+                    builder.append(')');
+                    return builder;
+                }
+
+                public StringBuilder visitUnrecognizedFilter(final StringBuilder builder,
+                        final byte filterTag, final ByteString filterBytes) {
+                    // Fake up a representation.
+                    builder.append('(');
+                    builder.append(byteToHex(filterTag));
+                    builder.append(':');
+                    StaticUtils.toHex(filterBytes, builder);
+                    builder.append(')');
+                    return builder;
+                }
+            };
+
+    // RFC 4526 - TRUE filter.
+    private static final Filter TRUE = new Filter(new AndImpl(Collections.<Filter> emptyList()));
+
+    /**
+     * Returns the {@code absolute false} filter as defined in RFC 4526 which is
+     * comprised of an {@code or} filter containing zero components.
+     *
+     * @return The absolute false filter.
+     * @see <a href="http://tools.ietf.org/html/rfc4526">RFC 4526</a>
+     */
+    public static Filter getAbsoluteFalseFilter() {
+        return FALSE;
     }
 
-
-
-    public StringBuilder visitSubstringsFilter(final StringBuilder builder,
-        final String attributeDescription, final ByteString initialSubstring,
-        final List<ByteString> anySubstrings, final ByteString finalSubstring)
-    {
-      builder.append('(');
-      builder.append(attributeDescription);
-      builder.append("=");
-      if (initialSubstring != null)
-      {
-        valueToFilterString(builder, initialSubstring);
-      }
-      for (final ByteString anySubstring : anySubstrings)
-      {
-        builder.append('*');
-        valueToFilterString(builder, anySubstring);
-      }
-      builder.append('*');
-      if (finalSubstring != null)
-      {
-        valueToFilterString(builder, finalSubstring);
-      }
-      builder.append(')');
-      return builder;
+    /**
+     * Returns the {@code absolute true} filter as defined in RFC 4526 which is
+     * comprised of an {@code and} filter containing zero components.
+     *
+     * @return The absolute true filter.
+     * @see <a href="http://tools.ietf.org/html/rfc4526">RFC 4526</a>
+     */
+    public static Filter getAbsoluteTrueFilter() {
+        return TRUE;
     }
 
-
-
-    public StringBuilder visitUnrecognizedFilter(final StringBuilder builder,
-        final byte filterTag, final ByteString filterBytes)
-    {
-      // Fake up a representation.
-      builder.append('(');
-      builder.append(byteToHex(filterTag));
-      builder.append(':');
-      StaticUtils.toHex(filterBytes, builder);
-      builder.append(')');
-      return builder;
+    /**
+     * Returns the {@code objectClass} presence filter {@code (objectClass=*)}.
+     * <p>
+     * A call to this method is equivalent to but more efficient than the
+     * following code:
+     *
+     * <pre>
+     * Filter.present(&quot;objectClass&quot;);
+     * </pre>
+     *
+     * @return The {@code objectClass} presence filter {@code (objectClass=*)}.
+     */
+    public static Filter getObjectClassPresentFilter() {
+        return OBJECT_CLASS_PRESENT;
     }
-  };
 
-  // RFC 4526 - TRUE filter.
-  private static final Filter TRUE = new Filter(new AndImpl(Collections
-      .<Filter> emptyList()));
-
-
-
-  /**
-   * Returns the {@code absolute false} filter as defined in RFC 4526 which is
-   * comprised of an {@code or} filter containing zero components.
-   *
-   * @return The absolute false filter.
-   * @see <a href="http://tools.ietf.org/html/rfc4526">RFC 4526</a>
-   */
-  public static Filter getAbsoluteFalseFilter()
-  {
-    return FALSE;
-  }
-
-
-
-  /**
-   * Returns the {@code absolute true} filter as defined in RFC 4526 which is
-   * comprised of an {@code and} filter containing zero components.
-   *
-   * @return The absolute true filter.
-   * @see <a href="http://tools.ietf.org/html/rfc4526">RFC 4526</a>
-   */
-  public static Filter getAbsoluteTrueFilter()
-  {
-    return TRUE;
-  }
-
-
-
-  /**
-   * Returns the {@code objectClass} presence filter {@code (objectClass=*)}.
-   * <p>
-   * A call to this method is equivalent to but more efficient than the
-   * following code:
-   *
-   * <pre>
-   * Filter.present(&quot;objectClass&quot;);
-   * </pre>
-   *
-   * @return The {@code objectClass} presence filter {@code (objectClass=*)}.
-   */
-  public static Filter getObjectClassPresentFilter()
-  {
-    return OBJECT_CLASS_PRESENT;
-  }
-
-
-
-  /**
-   * Creates a new {@code and} filter using the provided list of sub-filters.
-   * <p>
-   * Creating a new {@code and} filter with a {@code null} or empty list of
-   * sub-filters is equivalent to calling {@link #getAbsoluteTrueFilter()}.
-   *
-   * @param subFilters
-   *          The list of sub-filters, may be empty or {@code null}.
-   * @return The newly created {@code and} filter.
-   */
-  public static Filter newAndFilter(final Collection<Filter> subFilters)
-  {
-    if (subFilters == null || subFilters.isEmpty())
-    {
-      // RFC 4526 - TRUE filter.
-      return getAbsoluteTrueFilter();
+    /**
+     * Creates a new {@code and} filter using the provided list of sub-filters.
+     * <p>
+     * Creating a new {@code and} filter with a {@code null} or empty list of
+     * sub-filters is equivalent to calling {@link #getAbsoluteTrueFilter()}.
+     *
+     * @param subFilters
+     *            The list of sub-filters, may be empty or {@code null}.
+     * @return The newly created {@code and} filter.
+     */
+    public static Filter newAndFilter(final Collection<Filter> subFilters) {
+        if (subFilters == null || subFilters.isEmpty()) {
+            // RFC 4526 - TRUE filter.
+            return getAbsoluteTrueFilter();
+        } else if (subFilters.size() == 1) {
+            final Filter subFilter = subFilters.iterator().next();
+            Validator.ensureNotNull(subFilter);
+            return new Filter(new AndImpl(Collections.singletonList(subFilter)));
+        } else {
+            final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters.size());
+            for (final Filter subFilter : subFilters) {
+                Validator.ensureNotNull(subFilter);
+                subFiltersList.add(subFilter);
+            }
+            return new Filter(new AndImpl(Collections.unmodifiableList(subFiltersList)));
+        }
     }
-    else if (subFilters.size() == 1)
-    {
-      final Filter subFilter = subFilters.iterator().next();
-      Validator.ensureNotNull(subFilter);
-      return new Filter(new AndImpl(Collections.singletonList(subFilter)));
+
+    /**
+     * Creates a new {@code and} filter using the provided list of sub-filters.
+     * <p>
+     * Creating a new {@code and} filter with a {@code null} or empty list of
+     * sub-filters is equivalent to calling {@link #getAbsoluteTrueFilter()}.
+     *
+     * @param subFilters
+     *            The list of sub-filters, may be empty or {@code null}.
+     * @return The newly created {@code and} filter.
+     */
+    public static Filter newAndFilter(final Filter... subFilters) {
+        if ((subFilters == null) || (subFilters.length == 0)) {
+            // RFC 4526 - TRUE filter.
+            return getAbsoluteTrueFilter();
+        } else if (subFilters.length == 1) {
+            Validator.ensureNotNull(subFilters[0]);
+            return new Filter(new AndImpl(Collections.singletonList(subFilters[0])));
+        } else {
+            final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters.length);
+            for (final Filter subFilter : subFilters) {
+                Validator.ensureNotNull(subFilter);
+                subFiltersList.add(subFilter);
+            }
+            return new Filter(new AndImpl(Collections.unmodifiableList(subFiltersList)));
+        }
     }
-    else
-    {
-      final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters
-          .size());
-      for (final Filter subFilter : subFilters)
-      {
+
+    /**
+     * Creates a new {@code approximate match} filter using the provided
+     * attribute description and assertion value.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code approximate match} filter.
+     */
+    public static Filter newApproxMatchFilter(final String attributeDescription,
+            final ByteString assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new ApproxMatchImpl(attributeDescription, assertionValue));
+    }
+
+    /**
+     * Creates a new {@code approximate match} filter using the provided
+     * attribute description and assertion value.
+     * <p>
+     * If {@code assertionValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code approximate match} filter.
+     */
+    public static Filter newApproxMatchFilter(final String attributeDescription,
+            final Object assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new ApproxMatchImpl(attributeDescription, ByteString
+                .valueOf(assertionValue)));
+    }
+
+    /**
+     * Creates a new {@code equality match} filter using the provided attribute
+     * description and assertion value.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code equality match} filter.
+     */
+    public static Filter newEqualityMatchFilter(final String attributeDescription,
+            final ByteString assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new EqualityMatchImpl(attributeDescription, assertionValue));
+    }
+
+    /**
+     * Creates a new {@code equality match} filter using the provided attribute
+     * description and assertion value.
+     * <p>
+     * If {@code assertionValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code equality match} filter.
+     */
+    public static Filter newEqualityMatchFilter(final String attributeDescription,
+            final Object assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new EqualityMatchImpl(attributeDescription, ByteString
+                .valueOf(assertionValue)));
+    }
+
+    /**
+     * Creates a new {@code extensible match} filter.
+     *
+     * @param matchingRule
+     *            The matching rule name, may be {@code null} if
+     *            {@code attributeDescription} is specified.
+     * @param attributeDescription
+     *            The attribute description, may be {@code null} if
+     *            {@code matchingRule} is specified.
+     * @param assertionValue
+     *            The assertion value.
+     * @param dnAttributes
+     *            Indicates whether DN matching should be performed.
+     * @return The newly created {@code extensible match} filter.
+     */
+    public static Filter newExtensibleMatchFilter(final String matchingRule,
+            final String attributeDescription, final ByteString assertionValue,
+            final boolean dnAttributes) {
+        Validator.ensureTrue((matchingRule != null) || (attributeDescription != null),
+                "matchingRule and/or " + "attributeDescription must not be null");
+        Validator.ensureNotNull(assertionValue);
+        return new Filter(new ExtensibleMatchImpl(matchingRule, attributeDescription,
+                assertionValue, dnAttributes));
+    }
+
+    /**
+     * Creates a new {@code extensible match} filter.
+     * <p>
+     * If {@code assertionValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param matchingRule
+     *            The matching rule name, may be {@code null} if
+     *            {@code attributeDescription} is specified.
+     * @param attributeDescription
+     *            The attribute description, may be {@code null} if
+     *            {@code matchingRule} is specified.
+     * @param assertionValue
+     *            The assertion value.
+     * @param dnAttributes
+     *            Indicates whether DN matching should be performed.
+     * @return The newly created {@code extensible match} filter.
+     */
+    public static Filter newExtensibleMatchFilter(final String matchingRule,
+            final String attributeDescription, final Object assertionValue,
+            final boolean dnAttributes) {
+        Validator.ensureTrue((matchingRule != null) || (attributeDescription != null),
+                "matchingRule and/or " + "attributeDescription must not be null");
+        Validator.ensureNotNull(assertionValue);
+        return new Filter(new ExtensibleMatchImpl(matchingRule, attributeDescription, ByteString
+                .valueOf(assertionValue), dnAttributes));
+    }
+
+    /**
+     * Creates a new {@code greater or equal} filter using the provided
+     * attribute description and assertion value.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code greater or equal} filter.
+     */
+    public static Filter newGreaterOrEqualFilter(final String attributeDescription,
+            final ByteString assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new GreaterOrEqualImpl(attributeDescription, assertionValue));
+    }
+
+    /**
+     * Creates a new {@code greater or equal} filter using the provided
+     * attribute description and assertion value.
+     * <p>
+     * If {@code assertionValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code greater or equal} filter.
+     */
+    public static Filter newGreaterOrEqualFilter(final String attributeDescription,
+            final Object assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new GreaterOrEqualImpl(attributeDescription, ByteString
+                .valueOf(assertionValue)));
+    }
+
+    /**
+     * Creates a new {@code less or equal} filter using the provided attribute
+     * description and assertion value.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code less or equal} filter.
+     */
+    public static Filter newLessOrEqualFilter(final String attributeDescription,
+            final ByteString assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new LessOrEqualImpl(attributeDescription, assertionValue));
+    }
+
+    /**
+     * Creates a new {@code less or equal} filter using the provided attribute
+     * description and assertion value.
+     * <p>
+     * If {@code assertionValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return The newly created {@code less or equal} filter.
+     */
+    public static Filter newLessOrEqualFilter(final String attributeDescription,
+            final Object assertionValue) {
+        Validator.ensureNotNull(attributeDescription, assertionValue);
+        return new Filter(new LessOrEqualImpl(attributeDescription, ByteString
+                .valueOf(assertionValue)));
+    }
+
+    /**
+     * Creates a new {@code not} filter using the provided sub-filter.
+     *
+     * @param subFilter
+     *            The sub-filter.
+     * @return The newly created {@code not} filter.
+     */
+    public static Filter newNotFilter(final Filter subFilter) {
         Validator.ensureNotNull(subFilter);
-        subFiltersList.add(subFilter);
-      }
-      return new Filter(new AndImpl(Collections
-          .unmodifiableList(subFiltersList)));
-    }
-  }
-
-
-
-  /**
-   * Creates a new {@code and} filter using the provided list of sub-filters.
-   * <p>
-   * Creating a new {@code and} filter with a {@code null} or empty list of
-   * sub-filters is equivalent to calling {@link #getAbsoluteTrueFilter()}.
-   *
-   * @param subFilters
-   *          The list of sub-filters, may be empty or {@code null}.
-   * @return The newly created {@code and} filter.
-   */
-  public static Filter newAndFilter(final Filter... subFilters)
-  {
-    if ((subFilters == null) || (subFilters.length == 0))
-    {
-      // RFC 4526 - TRUE filter.
-      return getAbsoluteTrueFilter();
-    }
-    else if (subFilters.length == 1)
-    {
-      Validator.ensureNotNull(subFilters[0]);
-      return new Filter(new AndImpl(Collections.singletonList(subFilters[0])));
-    }
-    else
-    {
-      final List<Filter> subFiltersList = new ArrayList<Filter>(
-          subFilters.length);
-      for (final Filter subFilter : subFilters)
-      {
-        Validator.ensureNotNull(subFilter);
-        subFiltersList.add(subFilter);
-      }
-      return new Filter(new AndImpl(Collections
-          .unmodifiableList(subFiltersList)));
-    }
-  }
-
-
-
-  /**
-   * Creates a new {@code approximate match} filter using the provided attribute
-   * description and assertion value.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code approximate match} filter.
-   */
-  public static Filter newApproxMatchFilter(final String attributeDescription,
-      final ByteString assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new ApproxMatchImpl(attributeDescription, assertionValue));
-  }
-
-
-
-  /**
-   * Creates a new {@code approximate match} filter using the provided attribute
-   * description and assertion value.
-   * <p>
-   * If {@code assertionValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code approximate match} filter.
-   */
-  public static Filter newApproxMatchFilter(final String attributeDescription,
-      final Object assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new ApproxMatchImpl(attributeDescription, ByteString
-        .valueOf(assertionValue)));
-  }
-
-
-
-  /**
-   * Creates a new {@code equality match} filter using the provided attribute
-   * description and assertion value.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code equality match} filter.
-   */
-  public static Filter newEqualityMatchFilter(
-      final String attributeDescription, final ByteString assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new EqualityMatchImpl(attributeDescription,
-        assertionValue));
-  }
-
-
-
-  /**
-   * Creates a new {@code equality match} filter using the provided attribute
-   * description and assertion value.
-   * <p>
-   * If {@code assertionValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code equality match} filter.
-   */
-  public static Filter newEqualityMatchFilter(
-      final String attributeDescription, final Object assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new EqualityMatchImpl(attributeDescription, ByteString
-        .valueOf(assertionValue)));
-  }
-
-
-
-  /**
-   * Creates a new {@code extensible match} filter.
-   *
-   * @param matchingRule
-   *          The matching rule name, may be {@code null} if {@code
-   *          attributeDescription} is specified.
-   * @param attributeDescription
-   *          The attribute description, may be {@code null} if {@code
-   *          matchingRule} is specified.
-   * @param assertionValue
-   *          The assertion value.
-   * @param dnAttributes
-   *          Indicates whether DN matching should be performed.
-   * @return The newly created {@code extensible match} filter.
-   */
-  public static Filter newExtensibleMatchFilter(final String matchingRule,
-      final String attributeDescription, final ByteString assertionValue,
-      final boolean dnAttributes)
-  {
-    Validator.ensureTrue((matchingRule != null)
-        || (attributeDescription != null), "matchingRule and/or "
-        + "attributeDescription must not be null");
-    Validator.ensureNotNull(assertionValue);
-    return new Filter(new ExtensibleMatchImpl(matchingRule,
-        attributeDescription, assertionValue, dnAttributes));
-  }
-
-
-
-  /**
-   * Creates a new {@code extensible match} filter.
-   * <p>
-   * If {@code assertionValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param matchingRule
-   *          The matching rule name, may be {@code null} if {@code
-   *          attributeDescription} is specified.
-   * @param attributeDescription
-   *          The attribute description, may be {@code null} if {@code
-   *          matchingRule} is specified.
-   * @param assertionValue
-   *          The assertion value.
-   * @param dnAttributes
-   *          Indicates whether DN matching should be performed.
-   * @return The newly created {@code extensible match} filter.
-   */
-  public static Filter newExtensibleMatchFilter(final String matchingRule,
-      final String attributeDescription, final Object assertionValue,
-      final boolean dnAttributes)
-  {
-    Validator.ensureTrue((matchingRule != null)
-        || (attributeDescription != null), "matchingRule and/or "
-        + "attributeDescription must not be null");
-    Validator.ensureNotNull(assertionValue);
-    return new Filter(new ExtensibleMatchImpl(matchingRule,
-        attributeDescription, ByteString.valueOf(assertionValue), dnAttributes));
-  }
-
-
-
-  /**
-   * Creates a new {@code greater or equal} filter using the provided attribute
-   * description and assertion value.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code greater or equal} filter.
-   */
-  public static Filter newGreaterOrEqualFilter(
-      final String attributeDescription, final ByteString assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new GreaterOrEqualImpl(attributeDescription,
-        assertionValue));
-  }
-
-
-
-  /**
-   * Creates a new {@code greater or equal} filter using the provided attribute
-   * description and assertion value.
-   * <p>
-   * If {@code assertionValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code greater or equal} filter.
-   */
-  public static Filter newGreaterOrEqualFilter(
-      final String attributeDescription, final Object assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new GreaterOrEqualImpl(attributeDescription, ByteString
-        .valueOf(assertionValue)));
-  }
-
-
-
-  /**
-   * Creates a new {@code less or equal} filter using the provided attribute
-   * description and assertion value.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code less or equal} filter.
-   */
-  public static Filter newLessOrEqualFilter(final String attributeDescription,
-      final ByteString assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new LessOrEqualImpl(attributeDescription, assertionValue));
-  }
-
-
-
-  /**
-   * Creates a new {@code less or equal} filter using the provided attribute
-   * description and assertion value.
-   * <p>
-   * If {@code assertionValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return The newly created {@code less or equal} filter.
-   */
-  public static Filter newLessOrEqualFilter(final String attributeDescription,
-      final Object assertionValue)
-  {
-    Validator.ensureNotNull(attributeDescription, assertionValue);
-    return new Filter(new LessOrEqualImpl(attributeDescription, ByteString
-        .valueOf(assertionValue)));
-  }
-
-
-
-  /**
-   * Creates a new {@code not} filter using the provided sub-filter.
-   *
-   * @param subFilter
-   *          The sub-filter.
-   * @return The newly created {@code not} filter.
-   */
-  public static Filter newNotFilter(final Filter subFilter)
-  {
-    Validator.ensureNotNull(subFilter);
-    return new Filter(new NotImpl(subFilter));
-  }
-
-
-
-  /**
-   * Creates a new {@code or} filter using the provided list of sub-filters.
-   * <p>
-   * Creating a new {@code or} filter with a {@code null} or empty list of
-   * sub-filters is equivalent to calling {@link #getAbsoluteFalseFilter()}.
-   *
-   * @param subFilters
-   *          The list of sub-filters, may be empty or {@code null}.
-   * @return The newly created {@code or} filter.
-   */
-  public static Filter newOrFilter(final Collection<Filter> subFilters)
-  {
-    if (subFilters == null || subFilters.isEmpty())
-    {
-      // RFC 4526 - FALSE filter.
-      return getAbsoluteFalseFilter();
-    }
-    else if (subFilters.size() == 1)
-    {
-      final Filter subFilter = subFilters.iterator().next();
-      Validator.ensureNotNull(subFilter);
-      return new Filter(new OrImpl(Collections.singletonList(subFilter)));
-    }
-    else
-    {
-      final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters
-          .size());
-      for (final Filter subFilter : subFilters)
-      {
-        Validator.ensureNotNull(subFilter);
-        subFiltersList.add(subFilter);
-      }
-      return new Filter(
-          new OrImpl(Collections.unmodifiableList(subFiltersList)));
-    }
-  }
-
-
-
-  /**
-   * Creates a new {@code or} filter using the provided list of sub-filters.
-   * <p>
-   * Creating a new {@code or} filter with a {@code null} or empty list of
-   * sub-filters is equivalent to calling {@link #getAbsoluteFalseFilter()}.
-   *
-   * @param subFilters
-   *          The list of sub-filters, may be empty or {@code null}.
-   * @return The newly created {@code or} filter.
-   */
-  public static Filter newOrFilter(final Filter... subFilters)
-  {
-    if ((subFilters == null) || (subFilters.length == 0))
-    {
-      // RFC 4526 - FALSE filter.
-      return getAbsoluteFalseFilter();
-    }
-    else if (subFilters.length == 1)
-    {
-      Validator.ensureNotNull(subFilters[0]);
-      return new Filter(new OrImpl(Collections.singletonList(subFilters[0])));
-    }
-    else
-    {
-      final List<Filter> subFiltersList = new ArrayList<Filter>(
-          subFilters.length);
-      for (final Filter subFilter : subFilters)
-      {
-        Validator.ensureNotNull(subFilter);
-        subFiltersList.add(subFilter);
-      }
-      return new Filter(
-          new OrImpl(Collections.unmodifiableList(subFiltersList)));
-    }
-  }
-
-
-
-  /**
-   * Creates a new {@code present} filter using the provided attribute
-   * description.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @return The newly created {@code present} filter.
-   */
-  public static Filter newPresentFilter(final String attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    if (toLowerCase(attributeDescription).equals("objectclass"))
-    {
-      return OBJECT_CLASS_PRESENT;
-    }
-    return new Filter(new PresentImpl(attributeDescription));
-  }
-
-
-
-  /**
-   * Creates a new {@code substrings} filter using the provided attribute
-   * description, {@code initial}, {@code final}, and {@code any} sub-strings.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param initialSubstring
-   *          The initial sub-string, may be {@code null} if either {@code
-   *          finalSubstring} or {@code anySubstrings} are specified.
-   * @param anySubstrings
-   *          The final sub-string, may be {@code null} or empty if either
-   *          {@code finalSubstring} or {@code initialSubstring} are specified.
-   * @param finalSubstring
-   *          The final sub-string, may be {@code null}, may be {@code null} if
-   *          either {@code initialSubstring} or {@code anySubstrings} are
-   *          specified.
-   * @return The newly created {@code substrings} filter.
-   */
-  public static Filter newSubstringsFilter(final String attributeDescription,
-      final ByteString initialSubstring,
-      final Collection<ByteString> anySubstrings,
-      final ByteString finalSubstring)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    Validator
-        .ensureTrue((initialSubstring != null) || (finalSubstring != null)
-            || ((anySubstrings != null) && (anySubstrings.size() > 0)),
-            "at least one substring (initial, any or final)"
-                + " must be specified");
-
-    List<ByteString> anySubstringList;
-    if ((anySubstrings == null) || (anySubstrings.size() == 0))
-    {
-      anySubstringList = Collections.emptyList();
-    }
-    else if (anySubstrings.size() == 1)
-    {
-      final ByteString anySubstring = anySubstrings.iterator().next();
-      Validator.ensureNotNull(anySubstring);
-      anySubstringList = Collections.singletonList(anySubstring);
-    }
-    else
-    {
-      anySubstringList = new ArrayList<ByteString>(anySubstrings.size());
-      for (final ByteString anySubstring : anySubstrings)
-      {
-        Validator.ensureNotNull(anySubstring);
-
-        anySubstringList.add(anySubstring);
-      }
-      anySubstringList = Collections.unmodifiableList(anySubstringList);
+        return new Filter(new NotImpl(subFilter));
     }
 
-    return new Filter(new SubstringsImpl(attributeDescription,
-        initialSubstring, anySubstringList, finalSubstring));
-  }
-
-
-
-  /**
-   * Creates a new {@code substrings} filter using the provided attribute
-   * description, {@code initial}, {@code final}, and {@code any} sub-strings.
-   * <p>
-   * Any substrings which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param initialSubstring
-   *          The initial sub-string, may be {@code null} if either {@code
-   *          finalSubstring} or {@code anySubstrings} are specified.
-   * @param anySubstrings
-   *          The final sub-string, may be {@code null} or empty if either
-   *          {@code finalSubstring} or {@code initialSubstring} are specified.
-   * @param finalSubstring
-   *          The final sub-string, may be {@code null}, may be {@code null} if
-   *          either {@code initialSubstring} or {@code anySubstrings} are
-   *          specified.
-   * @return The newly created {@code substrings} filter.
-   */
-  public static Filter newSubstringsFilter(final String attributeDescription,
-      final Object initialSubstring, final Collection<?> anySubstrings,
-      final Object finalSubstring)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    Validator
-        .ensureTrue((initialSubstring != null) || (finalSubstring != null)
-            || ((anySubstrings != null) && (anySubstrings.size() > 0)),
-            "at least one substring (initial, any or final)"
-                + " must be specified");
-
-    List<ByteString> anySubstringList;
-    if ((anySubstrings == null) || (anySubstrings.size() == 0))
-    {
-      anySubstringList = Collections.emptyList();
-    }
-    else if (anySubstrings.size() == 1)
-    {
-      final Object anySubstring = anySubstrings.iterator().next();
-      Validator.ensureNotNull(anySubstring);
-      anySubstringList = Collections.singletonList(ByteString
-          .valueOf(anySubstring));
-    }
-    else
-    {
-      anySubstringList = new ArrayList<ByteString>(anySubstrings.size());
-      for (final Object anySubstring : anySubstrings)
-      {
-        Validator.ensureNotNull(anySubstring);
-
-        anySubstringList.add(ByteString.valueOf(anySubstring));
-      }
-      anySubstringList = Collections.unmodifiableList(anySubstringList);
-    }
-
-    return new Filter(new SubstringsImpl(attributeDescription,
-        initialSubstring != null ? ByteString.valueOf(initialSubstring) : null,
-        anySubstringList, finalSubstring != null ? ByteString
-            .valueOf(finalSubstring) : null));
-  }
-
-
-
-  /**
-   * Creates a new {@code unrecognized} filter using the provided ASN1 filter
-   * tag and content. This type of filter should be used for filters which are
-   * not part of the standard filter definition.
-   *
-   * @param filterTag
-   *          The ASN.1 tag.
-   * @param filterBytes
-   *          The filter content.
-   * @return The newly created {@code unrecognized} filter.
-   */
-  public static Filter newUnrecognizedFilter(final byte filterTag,
-      final ByteString filterBytes)
-  {
-    Validator.ensureNotNull(filterBytes);
-    return new Filter(new UnrecognizedImpl(filterTag, filterBytes));
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of a filter as a {@code
-   * Filter}.
-   *
-   * @param string
-   *          The LDAP string representation of a filter.
-   * @return The parsed {@code Filter}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code string} is not a valid LDAP string representation of a
-   *           filter.
-   */
-  public static Filter valueOf(final String string)
-  {
-    Validator.ensureNotNull(string);
-
-    // If the filter is enclosed in a pair of single quotes it
-    // is invalid (issue #1024).
-    if ((string.length() > 1) && string.startsWith("'") && string.endsWith("'"))
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_ENCLOSED_IN_APOSTROPHES
-          .get(string);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    try
-    {
-      if (string.startsWith("("))
-      {
-        if (string.endsWith(")"))
-        {
-          return valueOf0(string, 1, string.length() - 1);
+    /**
+     * Creates a new {@code or} filter using the provided list of sub-filters.
+     * <p>
+     * Creating a new {@code or} filter with a {@code null} or empty list of
+     * sub-filters is equivalent to calling {@link #getAbsoluteFalseFilter()}.
+     *
+     * @param subFilters
+     *            The list of sub-filters, may be empty or {@code null}.
+     * @return The newly created {@code or} filter.
+     */
+    public static Filter newOrFilter(final Collection<Filter> subFilters) {
+        if (subFilters == null || subFilters.isEmpty()) {
+            // RFC 4526 - FALSE filter.
+            return getAbsoluteFalseFilter();
+        } else if (subFilters.size() == 1) {
+            final Filter subFilter = subFilters.iterator().next();
+            Validator.ensureNotNull(subFilter);
+            return new Filter(new OrImpl(Collections.singletonList(subFilter)));
+        } else {
+            final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters.size());
+            for (final Filter subFilter : subFilters) {
+                Validator.ensureNotNull(subFilter);
+                subFiltersList.add(subFilter);
+            }
+            return new Filter(new OrImpl(Collections.unmodifiableList(subFiltersList)));
         }
-        else
-        {
-          final LocalizableMessage message = ERR_LDAP_FILTER_MISMATCHED_PARENTHESES
-              .get(string, 1, string.length());
-          throw new LocalizedIllegalArgumentException(message);
+    }
+
+    /**
+     * Creates a new {@code or} filter using the provided list of sub-filters.
+     * <p>
+     * Creating a new {@code or} filter with a {@code null} or empty list of
+     * sub-filters is equivalent to calling {@link #getAbsoluteFalseFilter()}.
+     *
+     * @param subFilters
+     *            The list of sub-filters, may be empty or {@code null}.
+     * @return The newly created {@code or} filter.
+     */
+    public static Filter newOrFilter(final Filter... subFilters) {
+        if ((subFilters == null) || (subFilters.length == 0)) {
+            // RFC 4526 - FALSE filter.
+            return getAbsoluteFalseFilter();
+        } else if (subFilters.length == 1) {
+            Validator.ensureNotNull(subFilters[0]);
+            return new Filter(new OrImpl(Collections.singletonList(subFilters[0])));
+        } else {
+            final List<Filter> subFiltersList = new ArrayList<Filter>(subFilters.length);
+            for (final Filter subFilter : subFilters) {
+                Validator.ensureNotNull(subFilter);
+                subFiltersList.add(subFilter);
+            }
+            return new Filter(new OrImpl(Collections.unmodifiableList(subFiltersList)));
         }
-      }
-      else
-      {
-        // We tolerate the top level filter component not being surrounded
-        // by parentheses.
-        return valueOf0(string, 0, string.length());
-      }
-    }
-    catch (final LocalizedIllegalArgumentException liae)
-    {
-      throw liae;
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_UNCAUGHT_EXCEPTION
-          .get(string, String.valueOf(e));
-      throw new LocalizedIllegalArgumentException(message);
-    }
-  }
-
-
-
-  // Converts an assertion value to a substring filter.
-  private static Filter assertionValue2SubstringFilter(
-      final String filterString, final String attrType, final int equalPos,
-      final int endPos)
-  {
-    // Get a binary representation of the value.
-    final byte[] valueBytes = getBytes(filterString.substring(equalPos, endPos));
-
-    // Find the locations of all the asterisks in the value. Also, check to
-    // see if there are any escaped values, since they will need special
-    // treatment.
-    boolean hasEscape = false;
-    final LinkedList<Integer> asteriskPositions = new LinkedList<Integer>();
-    for (int i = 0; i < valueBytes.length; i++)
-    {
-      if (valueBytes[i] == 0x2A) // The asterisk.
-      {
-        asteriskPositions.add(i);
-      }
-      else if (valueBytes[i] == 0x5C) // The backslash.
-      {
-        hasEscape = true;
-      }
     }
 
-    // If there were no asterisks, then this isn't a substring filter.
-    if (asteriskPositions.isEmpty())
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_SUBSTRING_NO_ASTERISKS
-          .get(filterString, equalPos + 1, endPos);
-      throw new LocalizedIllegalArgumentException(message);
+    /**
+     * Creates a new {@code present} filter using the provided attribute
+     * description.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @return The newly created {@code present} filter.
+     */
+    public static Filter newPresentFilter(final String attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        if (toLowerCase(attributeDescription).equals("objectclass")) {
+            return OBJECT_CLASS_PRESENT;
+        }
+        return new Filter(new PresentImpl(attributeDescription));
     }
 
-    // If the value starts with an asterisk, then there is no subInitial
-    // component. Otherwise, parse out the subInitial.
-    ByteString subInitial;
-    int firstPos = asteriskPositions.removeFirst();
-    if (firstPos == 0)
-    {
-      subInitial = null;
-    }
-    else
-    {
-      if (hasEscape)
-      {
-        final ByteStringBuilder buffer = new ByteStringBuilder(firstPos);
-        escapeHexChars(buffer, attrType, valueBytes, 0, firstPos, equalPos);
-        subInitial = buffer.toByteString();
-      }
-      else
-      {
-        subInitial = ByteString.wrap(valueBytes, 0, firstPos);
-      }
-    }
+    /**
+     * Creates a new {@code substrings} filter using the provided attribute
+     * description, {@code initial}, {@code final}, and {@code any} sub-strings.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param initialSubstring
+     *            The initial sub-string, may be {@code null} if either
+     *            {@code finalSubstring} or {@code anySubstrings} are specified.
+     * @param anySubstrings
+     *            The final sub-string, may be {@code null} or empty if either
+     *            {@code finalSubstring} or {@code initialSubstring} are
+     *            specified.
+     * @param finalSubstring
+     *            The final sub-string, may be {@code null}, may be {@code null}
+     *            if either {@code initialSubstring} or {@code anySubstrings}
+     *            are specified.
+     * @return The newly created {@code substrings} filter.
+     */
+    public static Filter newSubstringsFilter(final String attributeDescription,
+            final ByteString initialSubstring, final Collection<ByteString> anySubstrings,
+            final ByteString finalSubstring) {
+        Validator.ensureNotNull(attributeDescription);
+        Validator.ensureTrue((initialSubstring != null) || (finalSubstring != null)
+                || ((anySubstrings != null) && (anySubstrings.size() > 0)),
+                "at least one substring (initial, any or final)" + " must be specified");
 
-    // Next, process through the rest of the asterisks to get the subAny values.
-    final ArrayList<ByteString> subAny = new ArrayList<ByteString>();
-    for (final int asteriskPos : asteriskPositions)
-    {
-      final int length = asteriskPos - firstPos - 1;
+        List<ByteString> anySubstringList;
+        if ((anySubstrings == null) || (anySubstrings.size() == 0)) {
+            anySubstringList = Collections.emptyList();
+        } else if (anySubstrings.size() == 1) {
+            final ByteString anySubstring = anySubstrings.iterator().next();
+            Validator.ensureNotNull(anySubstring);
+            anySubstringList = Collections.singletonList(anySubstring);
+        } else {
+            anySubstringList = new ArrayList<ByteString>(anySubstrings.size());
+            for (final ByteString anySubstring : anySubstrings) {
+                Validator.ensureNotNull(anySubstring);
 
-      if (hasEscape)
-      {
-        final ByteStringBuilder buffer = new ByteStringBuilder(length);
-        escapeHexChars(buffer, attrType, valueBytes, firstPos + 1, asteriskPos,
-            equalPos);
-        subAny.add(buffer.toByteString());
-        buffer.clear();
-      }
-      else
-      {
-        subAny.add(ByteString.wrap(valueBytes, firstPos + 1, length));
-      }
-      firstPos = asteriskPos;
-    }
-
-    // Finally, see if there is anything after the last asterisk, which would be
-    // the subFinal value.
-    ByteString subFinal;
-    if (firstPos == (valueBytes.length - 1))
-    {
-      subFinal = null;
-    }
-    else
-    {
-      final int length = valueBytes.length - firstPos - 1;
-
-      if (hasEscape)
-      {
-        final ByteStringBuilder buffer = new ByteStringBuilder(length);
-        escapeHexChars(buffer, attrType, valueBytes, firstPos + 1,
-            valueBytes.length, equalPos);
-        subFinal = buffer.toByteString();
-      }
-      else
-      {
-        subFinal = ByteString.wrap(valueBytes, firstPos + 1, length);
-      }
-    }
-    return new Filter(
-        new SubstringsImpl(attrType, subInitial, subAny, subFinal));
-  }
-
-
-
-  private static void escapeHexChars(final ByteStringBuilder valueBuffer,
-      final String string, final byte[] valueBytes, final int fromIndex,
-      final int len, final int errorIndex)
-  {
-    for (int i = fromIndex; i < len; i++)
-    {
-      if (valueBytes[i] == 0x5C) // The backslash character
-      {
-        // The next two bytes must be the hex characters that comprise
-        // the binary value.
-        if ((i + 2) >= valueBytes.length)
-        {
-          final LocalizableMessage message = ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE
-              .get(string, errorIndex + i + 1);
-          throw new LocalizedIllegalArgumentException(message);
+                anySubstringList.add(anySubstring);
+            }
+            anySubstringList = Collections.unmodifiableList(anySubstringList);
         }
 
-        byte byteValue = 0;
-        switch (valueBytes[++i])
-        {
-        case 0x30: // '0'
-          break;
-        case 0x31: // '1'
-          byteValue = (byte) 0x10;
-          break;
-        case 0x32: // '2'
-          byteValue = (byte) 0x20;
-          break;
-        case 0x33: // '3'
-          byteValue = (byte) 0x30;
-          break;
-        case 0x34: // '4'
-          byteValue = (byte) 0x40;
-          break;
-        case 0x35: // '5'
-          byteValue = (byte) 0x50;
-          break;
-        case 0x36: // '6'
-          byteValue = (byte) 0x60;
-          break;
-        case 0x37: // '7'
-          byteValue = (byte) 0x70;
-          break;
-        case 0x38: // '8'
-          byteValue = (byte) 0x80;
-          break;
-        case 0x39: // '9'
-          byteValue = (byte) 0x90;
-          break;
-        case 0x41: // 'A'
-        case 0x61: // 'a'
-          byteValue = (byte) 0xA0;
-          break;
-        case 0x42: // 'B'
-        case 0x62: // 'b'
-          byteValue = (byte) 0xB0;
-          break;
-        case 0x43: // 'C'
-        case 0x63: // 'c'
-          byteValue = (byte) 0xC0;
-          break;
-        case 0x44: // 'D'
-        case 0x64: // 'd'
-          byteValue = (byte) 0xD0;
-          break;
-        case 0x45: // 'E'
-        case 0x65: // 'e'
-          byteValue = (byte) 0xE0;
-          break;
-        case 0x46: // 'F'
-        case 0x66: // 'f'
-          byteValue = (byte) 0xF0;
-          break;
-        default:
-          final LocalizableMessage message = ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE
-              .get(string, errorIndex + i + 1);
-          throw new LocalizedIllegalArgumentException(message);
+        return new Filter(new SubstringsImpl(attributeDescription, initialSubstring,
+                anySubstringList, finalSubstring));
+    }
+
+    /**
+     * Creates a new {@code substrings} filter using the provided attribute
+     * description, {@code initial}, {@code final}, and {@code any} sub-strings.
+     * <p>
+     * Any substrings which are not instances of {@code ByteString} will be
+     * converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param initialSubstring
+     *            The initial sub-string, may be {@code null} if either
+     *            {@code finalSubstring} or {@code anySubstrings} are specified.
+     * @param anySubstrings
+     *            The final sub-string, may be {@code null} or empty if either
+     *            {@code finalSubstring} or {@code initialSubstring} are
+     *            specified.
+     * @param finalSubstring
+     *            The final sub-string, may be {@code null}, may be {@code null}
+     *            if either {@code initialSubstring} or {@code anySubstrings}
+     *            are specified.
+     * @return The newly created {@code substrings} filter.
+     */
+    public static Filter newSubstringsFilter(final String attributeDescription,
+            final Object initialSubstring, final Collection<?> anySubstrings,
+            final Object finalSubstring) {
+        Validator.ensureNotNull(attributeDescription);
+        Validator.ensureTrue((initialSubstring != null) || (finalSubstring != null)
+                || ((anySubstrings != null) && (anySubstrings.size() > 0)),
+                "at least one substring (initial, any or final)" + " must be specified");
+
+        List<ByteString> anySubstringList;
+        if ((anySubstrings == null) || (anySubstrings.size() == 0)) {
+            anySubstringList = Collections.emptyList();
+        } else if (anySubstrings.size() == 1) {
+            final Object anySubstring = anySubstrings.iterator().next();
+            Validator.ensureNotNull(anySubstring);
+            anySubstringList = Collections.singletonList(ByteString.valueOf(anySubstring));
+        } else {
+            anySubstringList = new ArrayList<ByteString>(anySubstrings.size());
+            for (final Object anySubstring : anySubstrings) {
+                Validator.ensureNotNull(anySubstring);
+
+                anySubstringList.add(ByteString.valueOf(anySubstring));
+            }
+            anySubstringList = Collections.unmodifiableList(anySubstringList);
         }
 
-        switch (valueBytes[++i])
-        {
-        case 0x30: // '0'
-          break;
-        case 0x31: // '1'
-          byteValue |= (byte) 0x01;
-          break;
-        case 0x32: // '2'
-          byteValue |= (byte) 0x02;
-          break;
-        case 0x33: // '3'
-          byteValue |= (byte) 0x03;
-          break;
-        case 0x34: // '4'
-          byteValue |= (byte) 0x04;
-          break;
-        case 0x35: // '5'
-          byteValue |= (byte) 0x05;
-          break;
-        case 0x36: // '6'
-          byteValue |= (byte) 0x06;
-          break;
-        case 0x37: // '7'
-          byteValue |= (byte) 0x07;
-          break;
-        case 0x38: // '8'
-          byteValue |= (byte) 0x08;
-          break;
-        case 0x39: // '9'
-          byteValue |= (byte) 0x09;
-          break;
-        case 0x41: // 'A'
-        case 0x61: // 'a'
-          byteValue |= (byte) 0x0A;
-          break;
-        case 0x42: // 'B'
-        case 0x62: // 'b'
-          byteValue |= (byte) 0x0B;
-          break;
-        case 0x43: // 'C'
-        case 0x63: // 'c'
-          byteValue |= (byte) 0x0C;
-          break;
-        case 0x44: // 'D'
-        case 0x64: // 'd'
-          byteValue |= (byte) 0x0D;
-          break;
-        case 0x45: // 'E'
-        case 0x65: // 'e'
-          byteValue |= (byte) 0x0E;
-          break;
-        case 0x46: // 'F'
-        case 0x66: // 'f'
-          byteValue |= (byte) 0x0F;
-          break;
-        default:
-          final LocalizableMessage message = ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE
-              .get(string, errorIndex + i + 1);
-          throw new LocalizedIllegalArgumentException(message);
+        return new Filter(new SubstringsImpl(attributeDescription,
+                initialSubstring != null ? ByteString.valueOf(initialSubstring) : null,
+                anySubstringList, finalSubstring != null ? ByteString.valueOf(finalSubstring)
+                        : null));
+    }
+
+    /**
+     * Creates a new {@code unrecognized} filter using the provided ASN1 filter
+     * tag and content. This type of filter should be used for filters which are
+     * not part of the standard filter definition.
+     *
+     * @param filterTag
+     *            The ASN.1 tag.
+     * @param filterBytes
+     *            The filter content.
+     * @return The newly created {@code unrecognized} filter.
+     */
+    public static Filter newUnrecognizedFilter(final byte filterTag, final ByteString filterBytes) {
+        Validator.ensureNotNull(filterBytes);
+        return new Filter(new UnrecognizedImpl(filterTag, filterBytes));
+    }
+
+    /**
+     * Parses the provided LDAP string representation of a filter as a
+     * {@code Filter}.
+     *
+     * @param string
+     *            The LDAP string representation of a filter.
+     * @return The parsed {@code Filter}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code string} is not a valid LDAP string representation
+     *             of a filter.
+     */
+    public static Filter valueOf(final String string) {
+        Validator.ensureNotNull(string);
+
+        // If the filter is enclosed in a pair of single quotes it
+        // is invalid (issue #1024).
+        if ((string.length() > 1) && string.startsWith("'") && string.endsWith("'")) {
+            final LocalizableMessage message = ERR_LDAP_FILTER_ENCLOSED_IN_APOSTROPHES.get(string);
+            throw new LocalizedIllegalArgumentException(message);
         }
 
-        valueBuffer.append(byteValue);
-      }
-      else
-      {
-        valueBuffer.append(valueBytes[i]);
-      }
-    }
-  }
-
-
-
-  private static Filter valueOf0(final String string,
-      final int beginIndex /* inclusive */, final int endIndex /* exclusive */)
-  {
-    if (beginIndex >= endIndex)
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_STRING_NULL.get();
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    final int index = beginIndex;
-    final char c = string.charAt(index);
-
-    if (c == '&')
-    {
-      final List<Filter> subFilters = valueOfFilterList(string, index + 1,
-          endIndex);
-      if (subFilters.isEmpty())
-      {
-        return getAbsoluteTrueFilter();
-      }
-      else
-      {
-        return new Filter(new AndImpl(subFilters));
-      }
-    }
-    else if (c == '|')
-    {
-      final List<Filter> subFilters = valueOfFilterList(string, index + 1,
-          endIndex);
-      if (subFilters.isEmpty())
-      {
-        return getAbsoluteFalseFilter();
-      }
-      else
-      {
-        return new Filter(new OrImpl(subFilters));
-      }
-    }
-    else if (c == '!')
-    {
-      if ((string.charAt(index + 1) != '(')
-          || (string.charAt(endIndex - 1) != ')'))
-      {
-        final LocalizableMessage message = ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES
-            .get(string, index, endIndex - 1);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-      final List<Filter> subFilters = valueOfFilterList(string, index + 1,
-          endIndex);
-      if (subFilters.size() != 1)
-      {
-        final LocalizableMessage message = ERR_LDAP_FILTER_NOT_EXACTLY_ONE.get(
-            string, index, endIndex);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-      return new Filter(new NotImpl(subFilters.get(0)));
-    }
-    else
-    {
-      // It must be a simple filter. It must have an equal sign at some
-      // point, so find it.
-      int equalPos = -1;
-      for (int i = index; i < endIndex; i++)
-      {
-        if (string.charAt(i) == '=')
-        {
-          equalPos = i;
-          break;
+        try {
+            if (string.startsWith("(")) {
+                if (string.endsWith(")")) {
+                    return valueOf0(string, 1, string.length() - 1);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_LDAP_FILTER_MISMATCHED_PARENTHESES.get(string, 1, string.length());
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            } else {
+                // We tolerate the top level filter component not being
+                // surrounded
+                // by parentheses.
+                return valueOf0(string, 0, string.length());
+            }
+        } catch (final LocalizedIllegalArgumentException liae) {
+            throw liae;
+        } catch (final Exception e) {
+            final LocalizableMessage message =
+                    ERR_LDAP_FILTER_UNCAUGHT_EXCEPTION.get(string, String.valueOf(e));
+            throw new LocalizedIllegalArgumentException(message);
         }
-      }
-
-      if (equalPos <= index)
-      {
-        final LocalizableMessage message = ERR_LDAP_FILTER_NO_EQUAL_SIGN.get(
-            string, index, endIndex);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // Look at the character immediately before the equal sign,
-      // because it may help determine the filter type.
-      String attributeDescription;
-      ByteString assertionValue;
-
-      switch (string.charAt(equalPos - 1))
-      {
-      case '~':
-        attributeDescription = valueOfAttributeDescription(string, index,
-            equalPos - 1);
-        assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
-        return new Filter(new ApproxMatchImpl(attributeDescription,
-            assertionValue));
-      case '>':
-        attributeDescription = valueOfAttributeDescription(string, index,
-            equalPos - 1);
-        assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
-        return new Filter(new GreaterOrEqualImpl(attributeDescription,
-            assertionValue));
-      case '<':
-        attributeDescription = valueOfAttributeDescription(string, index,
-            equalPos - 1);
-        assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
-        return new Filter(new LessOrEqualImpl(attributeDescription,
-            assertionValue));
-      case ':':
-        return valueOfExtensibleFilter(string, index, equalPos, endIndex);
-      default:
-        attributeDescription = valueOfAttributeDescription(string, index,
-            equalPos);
-        return valueOfGenericFilter(string, attributeDescription, equalPos + 1,
-            endIndex);
-      }
-    }
-  }
-
-
-
-  private static ByteString valueOfAssertionValue(final String string,
-      final int startIndex, final int endIndex)
-  {
-    boolean hasEscape = false;
-    final byte[] valueBytes = getBytes(string.substring(startIndex, endIndex));
-    for (final byte valueByte : valueBytes)
-    {
-      if (valueByte == 0x5C) // The backslash character
-      {
-        hasEscape = true;
-        break;
-      }
     }
 
-    if (hasEscape)
-    {
-      final ByteStringBuilder valueBuffer = new ByteStringBuilder(
-          valueBytes.length);
-      escapeHexChars(valueBuffer, string, valueBytes, 0, valueBytes.length,
-          startIndex);
-      return valueBuffer.toByteString();
-    }
-    else
-    {
-      return ByteString.wrap(valueBytes);
-    }
-  }
+    // Converts an assertion value to a substring filter.
+    private static Filter assertionValue2SubstringFilter(final String filterString,
+            final String attrType, final int equalPos, final int endPos) {
+        // Get a binary representation of the value.
+        final byte[] valueBytes = getBytes(filterString.substring(equalPos, endPos));
 
-
-
-  private static String valueOfAttributeDescription(final String string,
-      final int startIndex, final int endIndex)
-  {
-    // The part of the filter string before the equal sign should be the
-    // attribute type. Make sure that the characters it contains are
-    // acceptable for attribute types, including those allowed by
-    // attribute name exceptions (ASCII letters and digits, the dash,
-    // and the underscore). We also need to allow attribute options,
-    // which includes the semicolon and the equal sign.
-    final String attrType = string.substring(startIndex, endIndex);
-    for (int i = 0; i < attrType.length(); i++)
-    {
-      switch (attrType.charAt(i))
-      {
-      case '-':
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-      case ';':
-      case '=':
-      case 'A':
-      case 'B':
-      case 'C':
-      case 'D':
-      case 'E':
-      case 'F':
-      case 'G':
-      case 'H':
-      case 'I':
-      case 'J':
-      case 'K':
-      case 'L':
-      case 'M':
-      case 'N':
-      case 'O':
-      case 'P':
-      case 'Q':
-      case 'R':
-      case 'S':
-      case 'T':
-      case 'U':
-      case 'V':
-      case 'W':
-      case 'X':
-      case 'Y':
-      case 'Z':
-      case '_':
-      case 'a':
-      case 'b':
-      case 'c':
-      case 'd':
-      case 'e':
-      case 'f':
-      case 'g':
-      case 'h':
-      case 'i':
-      case 'j':
-      case 'k':
-      case 'l':
-      case 'm':
-      case 'n':
-      case 'o':
-      case 'p':
-      case 'q':
-      case 'r':
-      case 's':
-      case 't':
-      case 'u':
-      case 'v':
-      case 'w':
-      case 'x':
-      case 'y':
-      case 'z':
-        // These are all OK.
-        break;
-
-      case '.':
-      case '/':
-      case ':':
-      case '<':
-      case '>':
-      case '?':
-      case '@':
-      case '[':
-      case '\\':
-      case ']':
-      case '^':
-      case '`':
-        // These are not allowed, but they are explicitly called out
-        // because they are included in the range of values between '-'
-        // and 'z', and making sure all possible characters are included
-        // can help make the switch statement more efficient. We'll fall
-        // through to the default clause to reject them.
-      default:
-        final LocalizableMessage message = ERR_LDAP_FILTER_INVALID_CHAR_IN_ATTR_TYPE
-            .get(attrType, String.valueOf(attrType.charAt(i)), i);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-    }
-
-    return attrType;
-  }
-
-
-
-  private static Filter valueOfExtensibleFilter(final String string,
-      final int startIndex, final int equalIndex, final int endIndex)
-  {
-    String attributeDescription = null;
-    boolean dnAttributes = false;
-    String matchingRule = null;
-
-    // Look at the first character. If it is a colon, then it must be
-    // followed by either the string "dn" or the matching rule ID. If it
-    // is not, then must be the attribute type.
-    final String lowerLeftStr = toLowerCase(string.substring(startIndex,
-        equalIndex));
-    if (string.charAt(startIndex) == ':')
-    {
-      // See if it starts with ":dn". Otherwise, it much be the matching
-      // rule ID.
-      if (lowerLeftStr.startsWith(":dn:"))
-      {
-        dnAttributes = true;
-
-        if ((startIndex + 4) < (equalIndex - 1))
-        {
-          matchingRule = string.substring(startIndex + 4, equalIndex - 1);
+        // Find the locations of all the asterisks in the value. Also, check to
+        // see if there are any escaped values, since they will need special
+        // treatment.
+        boolean hasEscape = false;
+        final LinkedList<Integer> asteriskPositions = new LinkedList<Integer>();
+        for (int i = 0; i < valueBytes.length; i++) {
+            if (valueBytes[i] == 0x2A /* The asterisk */) {
+                asteriskPositions.add(i);
+            } else if (valueBytes[i] == 0x5C /* The backslash. */) {
+                hasEscape = true;
+            }
         }
-      }
-      else
-      {
-        matchingRule = string.substring(startIndex + 1, equalIndex - 1);
-      }
-    }
-    else
-    {
-      final int colonPos = string.indexOf(':', startIndex);
-      if (colonPos < 0)
-      {
-        final LocalizableMessage message = ERR_LDAP_FILTER_EXTENSIBLE_MATCH_NO_COLON
-            .get(string, startIndex);
-        throw new LocalizedIllegalArgumentException(message);
-      }
 
-      attributeDescription = string.substring(startIndex, colonPos);
-
-      // If there is anything left, then it should be ":dn" and/or ":"
-      // followed by the matching rule ID.
-      if (colonPos < (equalIndex - 1))
-      {
-        if (lowerLeftStr.startsWith(":dn:", colonPos - startIndex))
-        {
-          dnAttributes = true;
-
-          if ((colonPos + 4) < (equalIndex - 1))
-          {
-            matchingRule = string.substring(colonPos + 4, equalIndex - 1);
-          }
+        // If there were no asterisks, then this isn't a substring filter.
+        if (asteriskPositions.isEmpty()) {
+            final LocalizableMessage message =
+                    ERR_LDAP_FILTER_SUBSTRING_NO_ASTERISKS.get(filterString, equalPos + 1, endPos);
+            throw new LocalizedIllegalArgumentException(message);
         }
-        else
-        {
-          matchingRule = string.substring(colonPos + 1, equalIndex - 1);
+
+        // If the value starts with an asterisk, then there is no subInitial
+        // component. Otherwise, parse out the subInitial.
+        ByteString subInitial;
+        int firstPos = asteriskPositions.removeFirst();
+        if (firstPos == 0) {
+            subInitial = null;
+        } else {
+            if (hasEscape) {
+                final ByteStringBuilder buffer = new ByteStringBuilder(firstPos);
+                escapeHexChars(buffer, attrType, valueBytes, 0, firstPos, equalPos);
+                subInitial = buffer.toByteString();
+            } else {
+                subInitial = ByteString.wrap(valueBytes, 0, firstPos);
+            }
         }
-      }
-    }
 
-    // Parse out the attribute value.
-    final ByteString matchValue = valueOfAssertionValue(string, equalIndex + 1,
-        endIndex);
+        // Next, process through the rest of the asterisks to get the subAny
+        // values.
+        final ArrayList<ByteString> subAny = new ArrayList<ByteString>();
+        for (final int asteriskPos : asteriskPositions) {
+            final int length = asteriskPos - firstPos - 1;
 
-    // Make sure that the filter has at least one of an attribute
-    // description and/or a matching rule ID.
-    if ((attributeDescription == null) && (matchingRule == null))
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_EXTENSIBLE_MATCH_NO_AD_OR_MR
-          .get(string, startIndex);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    return new Filter(new ExtensibleMatchImpl(matchingRule,
-        attributeDescription, matchValue, dnAttributes));
-  }
-
-
-
-  private static List<Filter> valueOfFilterList(final String string,
-      final int startIndex, final int endIndex)
-  {
-    // If the end index is equal to the start index, then there are no
-    // components.
-    if (startIndex >= endIndex)
-    {
-      return Collections.emptyList();
-    }
-
-    // At least one sub-filter.
-    Filter firstFilter = null;
-    List<Filter> subFilters = null;
-
-    // The first and last characters must be parentheses. If not, then
-    // that's an error.
-    if ((string.charAt(startIndex) != '(')
-        || (string.charAt(endIndex - 1) != ')'))
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES
-          .get(string, startIndex, endIndex);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-
-    // Iterate through the characters in the value. Whenever an open
-    // parenthesis is found, locate the corresponding close parenthesis
-    // by counting the number of intermediate open/close parentheses.
-    int pendingOpens = 0;
-    int openIndex = -1;
-    for (int i = startIndex; i < endIndex; i++)
-    {
-      final char c = string.charAt(i);
-      if (c == '(')
-      {
-        if (openIndex < 0)
-        {
-          openIndex = i;
+            if (hasEscape) {
+                final ByteStringBuilder buffer = new ByteStringBuilder(length);
+                escapeHexChars(buffer, attrType, valueBytes, firstPos + 1, asteriskPos, equalPos);
+                subAny.add(buffer.toByteString());
+                buffer.clear();
+            } else {
+                subAny.add(ByteString.wrap(valueBytes, firstPos + 1, length));
+            }
+            firstPos = asteriskPos;
         }
-        pendingOpens++;
-      }
-      else if (c == ')')
-      {
-        pendingOpens--;
-        if (pendingOpens == 0)
-        {
-          final Filter subFilter = valueOf0(string, openIndex + 1, i);
-          if (subFilters != null)
-          {
-            subFilters.add(subFilter);
-          }
-          else if (firstFilter != null)
-          {
-            subFilters = new LinkedList<Filter>();
-            subFilters.add(firstFilter);
-            subFilters.add(subFilter);
-            firstFilter = null;
-          }
-          else
-          {
-            firstFilter = subFilter;
-          }
-          openIndex = -1;
+
+        // Finally, see if there is anything after the last asterisk, which
+        // would be
+        // the subFinal value.
+        ByteString subFinal;
+        if (firstPos == (valueBytes.length - 1)) {
+            subFinal = null;
+        } else {
+            final int length = valueBytes.length - firstPos - 1;
+
+            if (hasEscape) {
+                final ByteStringBuilder buffer = new ByteStringBuilder(length);
+                escapeHexChars(buffer, attrType, valueBytes, firstPos + 1, valueBytes.length,
+                        equalPos);
+                subFinal = buffer.toByteString();
+            } else {
+                subFinal = ByteString.wrap(valueBytes, firstPos + 1, length);
+            }
         }
-        else if (pendingOpens < 0)
-        {
-          final LocalizableMessage message = ERR_LDAP_FILTER_NO_CORRESPONDING_OPEN_PARENTHESIS
-              .get(string, i);
-          throw new LocalizedIllegalArgumentException(message);
+        return new Filter(new SubstringsImpl(attrType, subInitial, subAny, subFinal));
+    }
+
+    private static void escapeHexChars(final ByteStringBuilder valueBuffer, final String string,
+            final byte[] valueBytes, final int fromIndex, final int len, final int errorIndex) {
+        for (int i = fromIndex; i < len; i++) {
+            if (valueBytes[i] == 0x5C /* The backslash character */) {
+                // The next two bytes must be the hex characters that comprise
+                // the binary value.
+                if ((i + 2) >= valueBytes.length) {
+                    final LocalizableMessage message =
+                            ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE.get(string, errorIndex + i + 1);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                byte byteValue = 0;
+                switch (valueBytes[++i]) {
+                case 0x30: // '0'
+                    break;
+                case 0x31: // '1'
+                    byteValue = (byte) 0x10;
+                    break;
+                case 0x32: // '2'
+                    byteValue = (byte) 0x20;
+                    break;
+                case 0x33: // '3'
+                    byteValue = (byte) 0x30;
+                    break;
+                case 0x34: // '4'
+                    byteValue = (byte) 0x40;
+                    break;
+                case 0x35: // '5'
+                    byteValue = (byte) 0x50;
+                    break;
+                case 0x36: // '6'
+                    byteValue = (byte) 0x60;
+                    break;
+                case 0x37: // '7'
+                    byteValue = (byte) 0x70;
+                    break;
+                case 0x38: // '8'
+                    byteValue = (byte) 0x80;
+                    break;
+                case 0x39: // '9'
+                    byteValue = (byte) 0x90;
+                    break;
+                case 0x41: // 'A'
+                case 0x61: // 'a'
+                    byteValue = (byte) 0xA0;
+                    break;
+                case 0x42: // 'B'
+                case 0x62: // 'b'
+                    byteValue = (byte) 0xB0;
+                    break;
+                case 0x43: // 'C'
+                case 0x63: // 'c'
+                    byteValue = (byte) 0xC0;
+                    break;
+                case 0x44: // 'D'
+                case 0x64: // 'd'
+                    byteValue = (byte) 0xD0;
+                    break;
+                case 0x45: // 'E'
+                case 0x65: // 'e'
+                    byteValue = (byte) 0xE0;
+                    break;
+                case 0x46: // 'F'
+                case 0x66: // 'f'
+                    byteValue = (byte) 0xF0;
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE.get(string, errorIndex + i + 1);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                switch (valueBytes[++i]) {
+                case 0x30: // '0'
+                    break;
+                case 0x31: // '1'
+                    byteValue |= (byte) 0x01;
+                    break;
+                case 0x32: // '2'
+                    byteValue |= (byte) 0x02;
+                    break;
+                case 0x33: // '3'
+                    byteValue |= (byte) 0x03;
+                    break;
+                case 0x34: // '4'
+                    byteValue |= (byte) 0x04;
+                    break;
+                case 0x35: // '5'
+                    byteValue |= (byte) 0x05;
+                    break;
+                case 0x36: // '6'
+                    byteValue |= (byte) 0x06;
+                    break;
+                case 0x37: // '7'
+                    byteValue |= (byte) 0x07;
+                    break;
+                case 0x38: // '8'
+                    byteValue |= (byte) 0x08;
+                    break;
+                case 0x39: // '9'
+                    byteValue |= (byte) 0x09;
+                    break;
+                case 0x41: // 'A'
+                case 0x61: // 'a'
+                    byteValue |= (byte) 0x0A;
+                    break;
+                case 0x42: // 'B'
+                case 0x62: // 'b'
+                    byteValue |= (byte) 0x0B;
+                    break;
+                case 0x43: // 'C'
+                case 0x63: // 'c'
+                    byteValue |= (byte) 0x0C;
+                    break;
+                case 0x44: // 'D'
+                case 0x64: // 'd'
+                    byteValue |= (byte) 0x0D;
+                    break;
+                case 0x45: // 'E'
+                case 0x65: // 'e'
+                    byteValue |= (byte) 0x0E;
+                    break;
+                case 0x46: // 'F'
+                case 0x66: // 'f'
+                    byteValue |= (byte) 0x0F;
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            ERR_LDAP_FILTER_INVALID_ESCAPED_BYTE.get(string, errorIndex + i + 1);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+
+                valueBuffer.append(byteValue);
+            } else {
+                valueBuffer.append(valueBytes[i]);
+            }
         }
-      }
-      else if (pendingOpens <= 0)
-      {
-        final LocalizableMessage message = ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES
-            .get(string, startIndex, endIndex);
-        throw new LocalizedIllegalArgumentException(message);
-      }
     }
 
-    // At this point, we have parsed the entire set of filter
-    // components. The list of open parenthesis positions must be empty.
-    if (pendingOpens != 0)
-    {
-      final LocalizableMessage message = ERR_LDAP_FILTER_NO_CORRESPONDING_CLOSE_PARENTHESIS
-          .get(string, openIndex);
-      throw new LocalizedIllegalArgumentException(message);
+    private static Filter valueOf0(final String string, final int beginIndex /* inclusive */,
+            final int endIndex /* exclusive */) {
+        if (beginIndex >= endIndex) {
+            final LocalizableMessage message = ERR_LDAP_FILTER_STRING_NULL.get();
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        final int index = beginIndex;
+        final char c = string.charAt(index);
+
+        if (c == '&') {
+            final List<Filter> subFilters = valueOfFilterList(string, index + 1, endIndex);
+            if (subFilters.isEmpty()) {
+                return getAbsoluteTrueFilter();
+            } else {
+                return new Filter(new AndImpl(subFilters));
+            }
+        } else if (c == '|') {
+            final List<Filter> subFilters = valueOfFilterList(string, index + 1, endIndex);
+            if (subFilters.isEmpty()) {
+                return getAbsoluteFalseFilter();
+            } else {
+                return new Filter(new OrImpl(subFilters));
+            }
+        } else if (c == '!') {
+            if ((string.charAt(index + 1) != '(') || (string.charAt(endIndex - 1) != ')')) {
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES.get(string, index,
+                                endIndex - 1);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+            final List<Filter> subFilters = valueOfFilterList(string, index + 1, endIndex);
+            if (subFilters.size() != 1) {
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_NOT_EXACTLY_ONE.get(string, index, endIndex);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+            return new Filter(new NotImpl(subFilters.get(0)));
+        } else {
+            // It must be a simple filter. It must have an equal sign at some
+            // point, so find it.
+            int equalPos = -1;
+            for (int i = index; i < endIndex; i++) {
+                if (string.charAt(i) == '=') {
+                    equalPos = i;
+                    break;
+                }
+            }
+
+            if (equalPos <= index) {
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_NO_EQUAL_SIGN.get(string, index, endIndex);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+
+            // Look at the character immediately before the equal sign,
+            // because it may help determine the filter type.
+            String attributeDescription;
+            ByteString assertionValue;
+
+            switch (string.charAt(equalPos - 1)) {
+            case '~':
+                attributeDescription = valueOfAttributeDescription(string, index, equalPos - 1);
+                assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
+                return new Filter(new ApproxMatchImpl(attributeDescription, assertionValue));
+            case '>':
+                attributeDescription = valueOfAttributeDescription(string, index, equalPos - 1);
+                assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
+                return new Filter(new GreaterOrEqualImpl(attributeDescription, assertionValue));
+            case '<':
+                attributeDescription = valueOfAttributeDescription(string, index, equalPos - 1);
+                assertionValue = valueOfAssertionValue(string, equalPos + 1, endIndex);
+                return new Filter(new LessOrEqualImpl(attributeDescription, assertionValue));
+            case ':':
+                return valueOfExtensibleFilter(string, index, equalPos, endIndex);
+            default:
+                attributeDescription = valueOfAttributeDescription(string, index, equalPos);
+                return valueOfGenericFilter(string, attributeDescription, equalPos + 1, endIndex);
+            }
+        }
     }
 
-    if (subFilters != null)
-    {
-      return Collections.unmodifiableList(subFilters);
+    private static ByteString valueOfAssertionValue(final String string, final int startIndex,
+            final int endIndex) {
+        boolean hasEscape = false;
+        final byte[] valueBytes = getBytes(string.substring(startIndex, endIndex));
+        for (final byte valueByte : valueBytes) {
+            if (valueByte == 0x5C /* The backslash character */) {
+                hasEscape = true;
+                break;
+            }
+        }
+
+        if (hasEscape) {
+            final ByteStringBuilder valueBuffer = new ByteStringBuilder(valueBytes.length);
+            escapeHexChars(valueBuffer, string, valueBytes, 0, valueBytes.length, startIndex);
+            return valueBuffer.toByteString();
+        } else {
+            return ByteString.wrap(valueBytes);
+        }
     }
-    else
-    {
-      return Collections.singletonList(firstFilter);
+
+    private static String valueOfAttributeDescription(final String string, final int startIndex,
+            final int endIndex) {
+        // The part of the filter string before the equal sign should be the
+        // attribute type. Make sure that the characters it contains are
+        // acceptable for attribute types, including those allowed by
+        // attribute name exceptions (ASCII letters and digits, the dash,
+        // and the underscore). We also need to allow attribute options,
+        // which includes the semicolon and the equal sign.
+        final String attrType = string.substring(startIndex, endIndex);
+        for (int i = 0; i < attrType.length(); i++) {
+            switch (attrType.charAt(i)) {
+            case '-':
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+            case ';':
+            case '=':
+            case 'A':
+            case 'B':
+            case 'C':
+            case 'D':
+            case 'E':
+            case 'F':
+            case 'G':
+            case 'H':
+            case 'I':
+            case 'J':
+            case 'K':
+            case 'L':
+            case 'M':
+            case 'N':
+            case 'O':
+            case 'P':
+            case 'Q':
+            case 'R':
+            case 'S':
+            case 'T':
+            case 'U':
+            case 'V':
+            case 'W':
+            case 'X':
+            case 'Y':
+            case 'Z':
+            case '_':
+            case 'a':
+            case 'b':
+            case 'c':
+            case 'd':
+            case 'e':
+            case 'f':
+            case 'g':
+            case 'h':
+            case 'i':
+            case 'j':
+            case 'k':
+            case 'l':
+            case 'm':
+            case 'n':
+            case 'o':
+            case 'p':
+            case 'q':
+            case 'r':
+            case 's':
+            case 't':
+            case 'u':
+            case 'v':
+            case 'w':
+            case 'x':
+            case 'y':
+            case 'z':
+                // These are all OK.
+                break;
+
+            case '.':
+            case '/':
+            case ':':
+            case '<':
+            case '>':
+            case '?':
+            case '@':
+            case '[':
+            case '\\':
+            case ']':
+            case '^':
+            case '`':
+                // These are not allowed, but they are explicitly called out
+                // because they are included in the range of values between '-'
+                // and 'z', and making sure all possible characters are included
+                // can help make the switch statement more efficient. We'll fall
+                // through to the default clause to reject them.
+            default:
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_INVALID_CHAR_IN_ATTR_TYPE.get(attrType, String
+                                .valueOf(attrType.charAt(i)), i);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        }
+
+        return attrType;
     }
-  }
 
+    private static Filter valueOfExtensibleFilter(final String string, final int startIndex,
+            final int equalIndex, final int endIndex) {
+        String attributeDescription = null;
+        boolean dnAttributes = false;
+        String matchingRule = null;
 
+        // Look at the first character. If it is a colon, then it must be
+        // followed by either the string "dn" or the matching rule ID. If it
+        // is not, then must be the attribute type.
+        final String lowerLeftStr = toLowerCase(string.substring(startIndex, equalIndex));
+        if (string.charAt(startIndex) == ':') {
+            // See if it starts with ":dn". Otherwise, it much be the matching
+            // rule ID.
+            if (lowerLeftStr.startsWith(":dn:")) {
+                dnAttributes = true;
 
-  private static Filter valueOfGenericFilter(final String string,
-      final String attributeDescription, final int startIndex,
-      final int endIndex)
-  {
-    final int asteriskIdx = string.indexOf('*', startIndex);
-    if (startIndex >= endIndex)
-    {
-      // Equality filter with empty assertion value.
-      return new Filter(new EqualityMatchImpl(attributeDescription, ByteString
-          .empty()));
+                if ((startIndex + 4) < (equalIndex - 1)) {
+                    matchingRule = string.substring(startIndex + 4, equalIndex - 1);
+                }
+            } else {
+                matchingRule = string.substring(startIndex + 1, equalIndex - 1);
+            }
+        } else {
+            final int colonPos = string.indexOf(':', startIndex);
+            if (colonPos < 0) {
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_EXTENSIBLE_MATCH_NO_COLON.get(string, startIndex);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+
+            attributeDescription = string.substring(startIndex, colonPos);
+
+            // If there is anything left, then it should be ":dn" and/or ":"
+            // followed by the matching rule ID.
+            if (colonPos < (equalIndex - 1)) {
+                if (lowerLeftStr.startsWith(":dn:", colonPos - startIndex)) {
+                    dnAttributes = true;
+
+                    if ((colonPos + 4) < (equalIndex - 1)) {
+                        matchingRule = string.substring(colonPos + 4, equalIndex - 1);
+                    }
+                } else {
+                    matchingRule = string.substring(colonPos + 1, equalIndex - 1);
+                }
+            }
+        }
+
+        // Parse out the attribute value.
+        final ByteString matchValue = valueOfAssertionValue(string, equalIndex + 1, endIndex);
+
+        // Make sure that the filter has at least one of an attribute
+        // description and/or a matching rule ID.
+        if ((attributeDescription == null) && (matchingRule == null)) {
+            final LocalizableMessage message =
+                    ERR_LDAP_FILTER_EXTENSIBLE_MATCH_NO_AD_OR_MR.get(string, startIndex);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        return new Filter(new ExtensibleMatchImpl(matchingRule, attributeDescription, matchValue,
+                dnAttributes));
     }
-    else if ((endIndex - startIndex == 1) && (string.charAt(startIndex) == '*'))
-    {
-      // Single asterisk is a present filter.
-      return newPresentFilter(attributeDescription);
+
+    private static List<Filter> valueOfFilterList(final String string, final int startIndex,
+            final int endIndex) {
+        // If the end index is equal to the start index, then there are no
+        // components.
+        if (startIndex >= endIndex) {
+            return Collections.emptyList();
+        }
+
+        // At least one sub-filter.
+        Filter firstFilter = null;
+        List<Filter> subFilters = null;
+
+        // The first and last characters must be parentheses. If not, then
+        // that's an error.
+        if ((string.charAt(startIndex) != '(') || (string.charAt(endIndex - 1) != ')')) {
+            final LocalizableMessage message =
+                    ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES.get(string, startIndex, endIndex);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        // Iterate through the characters in the value. Whenever an open
+        // parenthesis is found, locate the corresponding close parenthesis
+        // by counting the number of intermediate open/close parentheses.
+        int pendingOpens = 0;
+        int openIndex = -1;
+        for (int i = startIndex; i < endIndex; i++) {
+            final char c = string.charAt(i);
+            if (c == '(') {
+                if (openIndex < 0) {
+                    openIndex = i;
+                }
+                pendingOpens++;
+            } else if (c == ')') {
+                pendingOpens--;
+                if (pendingOpens == 0) {
+                    final Filter subFilter = valueOf0(string, openIndex + 1, i);
+                    if (subFilters != null) {
+                        subFilters.add(subFilter);
+                    } else if (firstFilter != null) {
+                        subFilters = new LinkedList<Filter>();
+                        subFilters.add(firstFilter);
+                        subFilters.add(subFilter);
+                        firstFilter = null;
+                    } else {
+                        firstFilter = subFilter;
+                    }
+                    openIndex = -1;
+                } else if (pendingOpens < 0) {
+                    final LocalizableMessage message =
+                            ERR_LDAP_FILTER_NO_CORRESPONDING_OPEN_PARENTHESIS.get(string, i);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            } else if (pendingOpens <= 0) {
+                final LocalizableMessage message =
+                        ERR_LDAP_FILTER_COMPOUND_MISSING_PARENTHESES.get(string, startIndex,
+                                endIndex);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        }
+
+        // At this point, we have parsed the entire set of filter
+        // components. The list of open parenthesis positions must be empty.
+        if (pendingOpens != 0) {
+            final LocalizableMessage message =
+                    ERR_LDAP_FILTER_NO_CORRESPONDING_CLOSE_PARENTHESIS.get(string, openIndex);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+
+        if (subFilters != null) {
+            return Collections.unmodifiableList(subFilters);
+        } else {
+            return Collections.singletonList(firstFilter);
+        }
     }
-    else if (asteriskIdx > 0 && asteriskIdx <= endIndex)
-    {
-      // Substring filter.
-      return assertionValue2SubstringFilter(string, attributeDescription,
-          startIndex, endIndex);
+
+    private static Filter valueOfGenericFilter(final String string,
+            final String attributeDescription, final int startIndex, final int endIndex) {
+        final int asteriskIdx = string.indexOf('*', startIndex);
+        if (startIndex >= endIndex) {
+            // Equality filter with empty assertion value.
+            return new Filter(new EqualityMatchImpl(attributeDescription, ByteString.empty()));
+        } else if ((endIndex - startIndex == 1) && (string.charAt(startIndex) == '*')) {
+            // Single asterisk is a present filter.
+            return newPresentFilter(attributeDescription);
+        } else if (asteriskIdx > 0 && asteriskIdx <= endIndex) {
+            // Substring filter.
+            return assertionValue2SubstringFilter(string, attributeDescription, startIndex,
+                    endIndex);
+        } else {
+            // equality filter.
+            final ByteString assertionValue = valueOfAssertionValue(string, startIndex, endIndex);
+            return new Filter(new EqualityMatchImpl(attributeDescription, assertionValue));
+        }
     }
-    else
-    {
-      // equality filter.
-      final ByteString assertionValue = valueOfAssertionValue(string,
-          startIndex, endIndex);
-      return new Filter(new EqualityMatchImpl(attributeDescription,
-          assertionValue));
+
+    /**
+     * Appends a properly-cleaned version of the provided value to the given
+     * builder so that it can be safely used in string representations of this
+     * search filter. The formatting changes that may be performed will be in
+     * compliance with the specification in RFC 2254.
+     *
+     * @param builder
+     *            The builder to which the "safe" version of the value will be
+     *            appended.
+     * @param value
+     *            The value to be appended to the builder.
+     */
+    private static void valueToFilterString(final StringBuilder builder, final ByteString value) {
+        // Get the binary representation of the value and iterate through
+        // it to see if there are any unsafe characters. If there are,
+        // then escape them and replace them with a two-digit hex
+        // equivalent.
+        builder.ensureCapacity(builder.length() + value.length());
+        for (int i = 0; i < value.length(); i++) {
+            // TODO: this is a bit overkill - it will escape all non-ascii
+            // chars!
+            final byte b = value.byteAt(i);
+            if (((b & 0x7F) != b) || // Not 7-bit clean
+                    (b <= 0x1F) || // Below the printable character range
+                    (b == 0x28) || // Open parenthesis
+                    (b == 0x29) || // Close parenthesis
+                    (b == 0x2A) || // Asterisk
+                    (b == 0x5C) || // Backslash
+                    (b == 0x7F) /* Delete character */) {
+                builder.append('\\');
+                builder.append(byteToHex(b));
+            } else {
+                builder.append((char) b);
+            }
+        }
     }
-  }
 
+    private final Impl pimpl;
 
-
-  /**
-   * Appends a properly-cleaned version of the provided value to the given
-   * builder so that it can be safely used in string representations of this
-   * search filter. The formatting changes that may be performed will be in
-   * compliance with the specification in RFC 2254.
-   *
-   * @param builder
-   *          The builder to which the "safe" version of the value will be
-   *          appended.
-   * @param value
-   *          The value to be appended to the builder.
-   */
-  private static void valueToFilterString(final StringBuilder builder,
-      final ByteString value)
-  {
-    // Get the binary representation of the value and iterate through
-    // it to see if there are any unsafe characters. If there are,
-    // then escape them and replace them with a two-digit hex
-    // equivalent.
-    builder.ensureCapacity(builder.length() + value.length());
-    for (int i = 0; i < value.length(); i++)
-    {
-      // TODO: this is a bit overkill - it will escape all non-ascii
-      // chars!
-      final byte b = value.byteAt(i);
-      if (((b & 0x7F) != b) || // Not 7-bit clean
-          (b <= 0x1F) || // Below the printable character range
-          (b == 0x28) || // Open parenthesis
-          (b == 0x29) || // Close parenthesis
-          (b == 0x2A) || // Asterisk
-          (b == 0x5C) || // Backslash
-          (b == 0x7F)) // Delete character
-      {
-        builder.append('\\');
-        builder.append(byteToHex(b));
-      }
-      else
-      {
-        builder.append((char) b);
-      }
+    private Filter(final Impl pimpl) {
+        this.pimpl = pimpl;
     }
-  }
 
+    /**
+     * Applies a {@code FilterVisitor} to this {@code Filter}.
+     *
+     * @param <R>
+     *            The return type of the visitor's methods.
+     * @param <P>
+     *            The type of the additional parameters to the visitor's
+     *            methods.
+     * @param v
+     *            The filter visitor.
+     * @param p
+     *            Optional additional visitor parameter.
+     * @return A result as specified by the visitor.
+     */
+    public <R, P> R accept(final FilterVisitor<R, P> v, final P p) {
+        return pimpl.accept(v, p);
+    }
 
+    /**
+     * Returns a {@code Matcher} which can be used to compare this
+     * {@code Filter} against entries using the default schema.
+     *
+     * @return The {@code Matcher}.
+     */
+    public Matcher matcher() {
+        return new Matcher(this, Schema.getDefaultSchema());
+    }
 
-  private final Impl pimpl;
+    /**
+     * Returns a {@code Matcher} which can be used to compare this
+     * {@code Filter} against entries using the provided {@code Schema}.
+     *
+     * @param schema
+     *            The schema which the {@code Matcher} should use for
+     *            comparisons.
+     * @return The {@code Matcher}.
+     */
+    public Matcher matcher(final Schema schema) {
+        return new Matcher(this, schema);
+    }
 
+    /**
+     * Indicates whether this {@code Filter} matches the provided {@code Entry}
+     * using the default schema.
+     * <p>
+     * Calling this method is equivalent to the following:
+     *
+     * <pre>
+     * matcher().matches(entry);
+     * </pre>
+     *
+     * @param entry
+     *            The entry to be matched.
+     * @return The result of matching the provided {@code Entry} against this
+     *         {@code Filter} using the default schema.
+     */
+    public ConditionResult matches(final Entry entry) {
+        return matcher(Schema.getDefaultSchema()).matches(entry);
+    }
 
-
-  private Filter(final Impl pimpl)
-  {
-    this.pimpl = pimpl;
-  }
-
-
-
-  /**
-   * Applies a {@code FilterVisitor} to this {@code Filter}.
-   *
-   * @param <R>
-   *          The return type of the visitor's methods.
-   * @param <P>
-   *          The type of the additional parameters to the visitor's methods.
-   * @param v
-   *          The filter visitor.
-   * @param p
-   *          Optional additional visitor parameter.
-   * @return A result as specified by the visitor.
-   */
-  public <R, P> R accept(final FilterVisitor<R, P> v, final P p)
-  {
-    return pimpl.accept(v, p);
-  }
-
-
-
-  /**
-   * Returns a {@code Matcher} which can be used to compare this {@code Filter}
-   * against entries using the default schema.
-   *
-   * @return The {@code Matcher}.
-   */
-  public Matcher matcher()
-  {
-    return new Matcher(this, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns a {@code Matcher} which can be used to compare this {@code Filter}
-   * against entries using the provided {@code Schema}.
-   *
-   * @param schema
-   *          The schema which the {@code Matcher} should use for comparisons.
-   * @return The {@code Matcher}.
-   */
-  public Matcher matcher(final Schema schema)
-  {
-    return new Matcher(this, schema);
-  }
-
-
-
-  /**
-   * Indicates whether this {@code Filter} matches the provided {@code Entry}
-   * using the default schema.
-   * <p>
-   * Calling this method is equivalent to the following:
-   *
-   * <pre>
-   * matcher().matches(entry);
-   * </pre>
-   *
-   * @param entry
-   *          The entry to be matched.
-   * @return The result of matching the provided {@code Entry} against this
-   *         {@code Filter} using the default schema.
-   */
-  public ConditionResult matches(final Entry entry)
-  {
-    return matcher(Schema.getDefaultSchema()).matches(entry);
-  }
-
-
-
-  /**
-   * Returns a {@code String} whose contents is the LDAP string representation
-   * of this {@code Filter}.
-   *
-   * @return The LDAP string representation of this {@code Filter}.
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    return pimpl.accept(TO_STRING_VISITOR, builder).toString();
-  }
+    /**
+     * Returns a {@code String} whose contents is the LDAP string representation
+     * of this {@code Filter}.
+     *
+     * @return The LDAP string representation of this {@code Filter}.
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        return pimpl.accept(TO_STRING_VISITOR, builder).toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java
index b97614d..a916711 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.List;
 
-
-
 /**
  * A visitor of {@code Filter}s, in the style of the visitor design pattern.
  * <p>
@@ -41,194 +36,167 @@
  * method most applicable to that filter is invoked.
  *
  * @param <R>
- *          The return type of this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need to return
- *          results.
+ *            The return type of this visitor's methods. Use
+ *            {@link java.lang.Void} for visitors that do not need to return
+ *            results.
  * @param <P>
- *          The type of the additional parameter to this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need an additional
- *          parameter.
+ *            The type of the additional parameter to this visitor's methods.
+ *            Use {@link java.lang.Void} for visitors that do not need an
+ *            additional parameter.
  */
-public interface FilterVisitor<R, P>
-{
+public interface FilterVisitor<R, P> {
 
-  /**
-   * Visits an {@code and} filter.
-   * <p>
-   * <b>Implementation note</b>: for the purposes of matching an empty
-   * sub-filter list should always evaluate to {@code true} as per RFC 4526.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param subFilters
-   *          The unmodifiable list of sub-filters.
-   * @return Returns a visitor specified result.
-   */
-  R visitAndFilter(P p, List<Filter> subFilters);
+    /**
+     * Visits an {@code and} filter.
+     * <p>
+     * <b>Implementation note</b>: for the purposes of matching an empty
+     * sub-filter list should always evaluate to {@code true} as per RFC 4526.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param subFilters
+     *            The unmodifiable list of sub-filters.
+     * @return Returns a visitor specified result.
+     */
+    R visitAndFilter(P p, List<Filter> subFilters);
 
+    /**
+     * Visits an {@code approximate match} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return Returns a visitor specified result.
+     */
+    R visitApproxMatchFilter(P p, String attributeDescription, ByteString assertionValue);
 
+    /**
+     * Visits an {@code equality match} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return Returns a visitor specified result.
+     */
+    R visitEqualityMatchFilter(P p, String attributeDescription, ByteString assertionValue);
 
-  /**
-   * Visits an {@code approximate match} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return Returns a visitor specified result.
-   */
-  R visitApproxMatchFilter(P p, String attributeDescription,
-      ByteString assertionValue);
+    /**
+     * Visits an {@code extensible} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param matchingRule
+     *            The matching rule name, may be {@code null} if
+     *            {@code attributeDescription} is specified.
+     * @param attributeDescription
+     *            The attribute description, may be {@code null} if
+     *            {@code matchingRule} is specified.
+     * @param assertionValue
+     *            The assertion value.
+     * @param dnAttributes
+     *            Indicates whether DN matching should be performed.
+     * @return Returns a visitor specified result.
+     */
+    R visitExtensibleMatchFilter(P p, String matchingRule, String attributeDescription,
+            ByteString assertionValue, boolean dnAttributes);
 
+    /**
+     * Visits a {@code greater or equal} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return Returns a visitor specified result.
+     */
+    R visitGreaterOrEqualFilter(P p, String attributeDescription, ByteString assertionValue);
 
+    /**
+     * Visits a {@code less or equal} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @param assertionValue
+     *            The assertion value.
+     * @return Returns a visitor specified result.
+     */
+    R visitLessOrEqualFilter(P p, String attributeDescription, ByteString assertionValue);
 
-  /**
-   * Visits an {@code equality match} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return Returns a visitor specified result.
-   */
-  R visitEqualityMatchFilter(P p, String attributeDescription,
-      ByteString assertionValue);
+    /**
+     * Visits a {@code not} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param subFilter
+     *            The sub-filter.
+     * @return Returns a visitor specified result.
+     */
+    R visitNotFilter(P p, Filter subFilter);
 
+    /**
+     * Visits an {@code or} filter.
+     * <p>
+     * <b>Implementation note</b>: for the purposes of matching an empty
+     * sub-filter list should always evaluate to {@code false} as per RFC 4526.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param subFilters
+     *            The unmodifiable list of sub-filters.
+     * @return Returns a visitor specified result.
+     */
+    R visitOrFilter(P p, List<Filter> subFilters);
 
+    /**
+     * Visits a {@code present} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @return Returns a visitor specified result.
+     */
+    R visitPresentFilter(P p, String attributeDescription);
 
-  /**
-   * Visits an {@code extensible} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param matchingRule
-   *          The matching rule name, may be {@code null} if {@code
-   *          attributeDescription} is specified.
-   * @param attributeDescription
-   *          The attribute description, may be {@code null} if {@code
-   *          matchingRule} is specified.
-   * @param assertionValue
-   *          The assertion value.
-   * @param dnAttributes
-   *          Indicates whether DN matching should be performed.
-   * @return Returns a visitor specified result.
-   */
-  R visitExtensibleMatchFilter(P p, String matchingRule,
-      String attributeDescription, ByteString assertionValue,
-      boolean dnAttributes);
+    /**
+     * Visits a {@code substrings} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param attributeDescription
+     *            The attribute description.
+     * @param initialSubstring
+     *            The initial sub-string, may be {@code null}.
+     * @param anySubstrings
+     *            The unmodifiable list of any sub-strings, may be empty.
+     * @param finalSubstring
+     *            The final sub-string, may be {@code null}.
+     * @return Returns a visitor specified result.
+     */
+    R visitSubstringsFilter(P p, String attributeDescription, ByteString initialSubstring,
+            List<ByteString> anySubstrings, ByteString finalSubstring);
 
-
-
-  /**
-   * Visits a {@code greater or equal} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return Returns a visitor specified result.
-   */
-  R visitGreaterOrEqualFilter(P p, String attributeDescription,
-      ByteString assertionValue);
-
-
-
-  /**
-   * Visits a {@code less or equal} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @param assertionValue
-   *          The assertion value.
-   * @return Returns a visitor specified result.
-   */
-  R visitLessOrEqualFilter(P p, String attributeDescription,
-      ByteString assertionValue);
-
-
-
-  /**
-   * Visits a {@code not} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param subFilter
-   *          The sub-filter.
-   * @return Returns a visitor specified result.
-   */
-  R visitNotFilter(P p, Filter subFilter);
-
-
-
-  /**
-   * Visits an {@code or} filter.
-   * <p>
-   * <b>Implementation note</b>: for the purposes of matching an empty
-   * sub-filter list should always evaluate to {@code false} as per RFC 4526.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param subFilters
-   *          The unmodifiable list of sub-filters.
-   * @return Returns a visitor specified result.
-   */
-  R visitOrFilter(P p, List<Filter> subFilters);
-
-
-
-  /**
-   * Visits a {@code present} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @return Returns a visitor specified result.
-   */
-  R visitPresentFilter(P p, String attributeDescription);
-
-
-
-  /**
-   * Visits a {@code substrings} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param attributeDescription
-   *          The attribute description.
-   * @param initialSubstring
-   *          The initial sub-string, may be {@code null}.
-   * @param anySubstrings
-   *          The unmodifiable list of any sub-strings, may be empty.
-   * @param finalSubstring
-   *          The final sub-string, may be {@code null}.
-   * @return Returns a visitor specified result.
-   */
-  R visitSubstringsFilter(P p, String attributeDescription,
-      ByteString initialSubstring, List<ByteString> anySubstrings,
-      ByteString finalSubstring);
-
-
-
-  /**
-   * Visits an {@code unrecognized} filter.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param filterTag
-   *          The ASN.1 tag.
-   * @param filterBytes
-   *          The filter content.
-   * @return Returns a visitor specified result.
-   */
-  R visitUnrecognizedFilter(P p, byte filterTag, ByteString filterBytes);
+    /**
+     * Visits an {@code unrecognized} filter.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param filterTag
+     *            The ASN.1 tag.
+     * @param filterBytes
+     *            The filter content.
+     * @return Returns a visitor specified result.
+     */
+    R visitUnrecognizedFilter(P p, byte filterTag, ByteString filterBytes);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
index aff47bd..04227a7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_CONNECTION_POOL_CLOSING;
 
 import java.util.Collection;
@@ -40,8 +37,23 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Level;
 
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 import org.forgerock.opendj.ldif.ConnectionEntryReader;
 
 import com.forgerock.opendj.util.AsynchronousFutureResult;
@@ -49,902 +61,639 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A simple connection pool implementation which maintains a fixed number of
  * connections.
  */
-final class FixedConnectionPool implements ConnectionPool
-{
+final class FixedConnectionPool implements ConnectionPool {
 
-  /**
-   * This result handler is invoked when an attempt to add a new connection to
-   * the pool completes.
-   */
-  private final class ConnectionResultHandler implements
-      ResultHandler<Connection>
-  {
     /**
-     * {@inheritDoc}
+     * This result handler is invoked when an attempt to add a new connection to
+     * the pool completes.
      */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      // Connection attempt failed, so decrease the pool size.
-      currentPoolSize.release();
+    private final class ConnectionResultHandler implements ResultHandler<Connection> {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            // Connection attempt failed, so decrease the pool size.
+            currentPoolSize.release();
 
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-      {
-        StaticUtils.DEBUG_LOG.fine(String.format("Connection attempt failed: "
-            + error.getMessage() + " currentPoolSize=%d, poolSize=%d", poolSize
-            - currentPoolSize.availablePermits(), poolSize));
-      }
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                StaticUtils.DEBUG_LOG.fine(String.format("Connection attempt failed: "
+                        + error.getMessage() + " currentPoolSize=%d, poolSize=%d", poolSize
+                        - currentPoolSize.availablePermits(), poolSize));
+            }
 
-      QueueElement holder;
-      synchronized (queue)
-      {
-        if (queue.isEmpty() || !queue.getFirst().isWaitingFuture())
-        {
-          // No waiting futures.
-          return;
+            QueueElement holder;
+            synchronized (queue) {
+                if (queue.isEmpty() || !queue.getFirst().isWaitingFuture()) {
+                    // No waiting futures.
+                    return;
+                } else {
+                    holder = queue.removeFirst();
+                }
+            }
+
+            // There was waiting future, so close it.
+            holder.getWaitingFuture().handleErrorResult(error);
         }
-        else
-        {
-          holder = queue.removeFirst();
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final Connection connection) {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                StaticUtils.DEBUG_LOG.fine(String.format("Connection attempt succeeded: "
+                        + " currentPoolSize=%d, poolSize=%d", poolSize
+                        - currentPoolSize.availablePermits(), poolSize));
+            }
+
+            publishConnection(connection);
         }
-      }
-
-      // There was waiting future, so close it.
-      holder.getWaitingFuture().handleErrorResult(error);
     }
 
+    /**
+     * A pooled connection is passed to the client. It wraps an underlying
+     * "pooled" connection obtained from the underlying factory and lasts until
+     * the client application closes this connection. More specifically, pooled
+     * connections are not actually stored in the internal queue.
+     */
+    private final class PooledConnection implements Connection {
+        // Connection event listeners registed against this pooled connection
+        // should
+        // have the same life time as the pooled connection.
+        private final List<ConnectionEventListener> listeners =
+                new CopyOnWriteArrayList<ConnectionEventListener>();
 
+        private final Connection connection;
+
+        private final AtomicBoolean isClosed = new AtomicBoolean(false);
+
+        PooledConnection(final Connection connection) {
+            this.connection = connection;
+        }
+
+        @Override
+        public FutureResult<Void> abandonAsync(final AbandonRequest request) {
+            return checkState().abandonAsync(request);
+        }
+
+        @Override
+        public Result add(final AddRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().add(request);
+        }
+
+        @Override
+        public Result add(final Entry entry) throws ErrorResultException, InterruptedException {
+            return checkState().add(entry);
+        }
+
+        @Override
+        public Result add(final String... ldifLines) throws ErrorResultException,
+                InterruptedException {
+            return checkState().add(ldifLines);
+        }
+
+        @Override
+        public FutureResult<Result> addAsync(final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            return checkState().addAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void addConnectionEventListener(final ConnectionEventListener listener) {
+            Validator.ensureNotNull(listener);
+            checkState();
+            listeners.add(listener);
+        }
+
+        @Override
+        public BindResult bind(final BindRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().bind(request);
+        }
+
+        @Override
+        public BindResult bind(final String name, final char[] password)
+                throws ErrorResultException, InterruptedException {
+            return checkState().bind(name, password);
+        }
+
+        @Override
+        public FutureResult<BindResult> bindAsync(final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler) {
+            return checkState().bindAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void close() {
+            if (!isClosed.compareAndSet(false, true)) {
+                // Already closed.
+                return;
+            }
+
+            // Don't put invalid connections back in the pool.
+            if (connection.isValid()) {
+                publishConnection(connection);
+            } else {
+                // The connection may have been disconnected by the remote
+                // server, but
+                // the server may still be available. In order to avoid leaving
+                // pending
+                // futures hanging indefinitely, we should try to reconnect
+                // immediately.
+
+                // Close the dead connection.
+                connection.close();
+
+                // Try to get a new connection to replace it.
+                factory.getConnectionAsync(connectionResultHandler);
+
+                if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    StaticUtils.DEBUG_LOG.warning(String.format("Connection no longer valid. "
+                            + "currentPoolSize=%d, poolSize=%d", poolSize
+                            - currentPoolSize.availablePermits(), poolSize));
+                }
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void close(final UnbindRequest request, final String reason) {
+            close();
+        }
+
+        @Override
+        public CompareResult compare(final CompareRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().compare(request);
+        }
+
+        @Override
+        public CompareResult compare(final String name, final String attributeDescription,
+                final String assertionValue) throws ErrorResultException, InterruptedException {
+            return checkState().compare(name, attributeDescription, assertionValue);
+        }
+
+        @Override
+        public FutureResult<CompareResult> compareAsync(final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler) {
+            return checkState().compareAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        @Override
+        public Result delete(final DeleteRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().delete(request);
+        }
+
+        @Override
+        public Result delete(final String name) throws ErrorResultException, InterruptedException {
+            return checkState().delete(name);
+        }
+
+        @Override
+        public FutureResult<Result> deleteAsync(final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            return checkState().deleteAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        @Override
+        public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request)
+                throws ErrorResultException, InterruptedException {
+            return checkState().extendedRequest(request);
+        }
+
+        @Override
+        public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
+                final IntermediateResponseHandler handler) throws ErrorResultException,
+                InterruptedException {
+            return checkState().extendedRequest(request, handler);
+        }
+
+        @Override
+        public GenericExtendedResult extendedRequest(final String requestName,
+                final ByteString requestValue) throws ErrorResultException, InterruptedException {
+            return checkState().extendedRequest(requestName, requestValue);
+        }
+
+        @Override
+        public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
+                final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) {
+            return checkState().extendedRequestAsync(request, intermediateResponseHandler,
+                    resultHandler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean isClosed() {
+            return isClosed.get();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean isValid() {
+            return connection.isValid() && !isClosed();
+        }
+
+        @Override
+        public Result modify(final ModifyRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().modify(request);
+        }
+
+        @Override
+        public Result modify(final String... ldifLines) throws ErrorResultException,
+                InterruptedException {
+            return checkState().modify(ldifLines);
+        }
+
+        @Override
+        public FutureResult<Result> modifyAsync(final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            return checkState().modifyAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        @Override
+        public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException,
+                InterruptedException {
+            return checkState().modifyDN(request);
+        }
+
+        @Override
+        public Result modifyDN(final String name, final String newRDN) throws ErrorResultException,
+                InterruptedException {
+            return checkState().modifyDN(name, newRDN);
+        }
+
+        @Override
+        public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            return checkState().modifyDNAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        @Override
+        public SearchResultEntry readEntry(final DN name, final String... attributeDescriptions)
+                throws ErrorResultException, InterruptedException {
+            return checkState().readEntry(name, attributeDescriptions);
+        }
+
+        @Override
+        public SearchResultEntry readEntry(final String name, final String... attributeDescriptions)
+                throws ErrorResultException, InterruptedException {
+            return checkState().readEntry(name, attributeDescriptions);
+        }
+
+        @Override
+        public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
+                final Collection<String> attributeDescriptions,
+                final ResultHandler<? super SearchResultEntry> handler) {
+            return checkState().readEntryAsync(name, attributeDescriptions, handler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void removeConnectionEventListener(final ConnectionEventListener listener) {
+            Validator.ensureNotNull(listener);
+            checkState();
+            listeners.remove(listener);
+        }
+
+        @Override
+        public ConnectionEntryReader search(final SearchRequest request) {
+            return checkState().search(request);
+        }
+
+        @Override
+        public Result search(final SearchRequest request,
+                final Collection<? super SearchResultEntry> entries) throws ErrorResultException,
+                InterruptedException {
+            return checkState().search(request, entries);
+        }
+
+        @Override
+        public Result search(final SearchRequest request,
+                final Collection<? super SearchResultEntry> entries,
+                final Collection<? super SearchResultReference> references)
+                throws ErrorResultException, InterruptedException {
+            return checkState().search(request, entries, references);
+        }
+
+        @Override
+        public Result search(final SearchRequest request, final SearchResultHandler handler)
+                throws ErrorResultException, InterruptedException {
+            return checkState().search(request, handler);
+        }
+
+        @Override
+        public ConnectionEntryReader search(final String baseObject, final SearchScope scope,
+                final String filter, final String... attributeDescriptions) {
+            return checkState().search(baseObject, scope, filter, attributeDescriptions);
+        }
+
+        @Override
+        public FutureResult<Result> searchAsync(final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) {
+            return checkState().searchAsync(request, intermediateResponseHandler, resultHandler);
+        }
+
+        @Override
+        public SearchResultEntry searchSingleEntry(final SearchRequest request)
+                throws ErrorResultException, InterruptedException {
+            return checkState().searchSingleEntry(request);
+        }
+
+        @Override
+        public SearchResultEntry searchSingleEntry(final String baseObject,
+                final SearchScope scope, final String filter, final String... attributeDescriptions)
+                throws ErrorResultException, InterruptedException {
+            return checkState().searchSingleEntry(baseObject, scope, filter, attributeDescriptions);
+        }
+
+        @Override
+        public FutureResult<SearchResultEntry> searchSingleEntryAsync(final SearchRequest request,
+                final ResultHandler<? super SearchResultEntry> handler) {
+            return checkState().searchSingleEntryAsync(request, handler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            final StringBuilder builder = new StringBuilder();
+            builder.append("PooledConnection(");
+            builder.append(connection);
+            builder.append(')');
+            return builder.toString();
+        }
+
+        // Checks that this pooled connection has not been closed.
+        private Connection checkState() {
+            if (isClosed()) {
+                throw new IllegalStateException();
+            }
+            return connection;
+        }
+
+    }
+
+    /**
+     * A queue element is either a pending connection request future awaiting an
+     * {@code Connection} or it is an unused {@code Connection} awaiting a
+     * connection request.
+     */
+    private static final class QueueElement {
+        private final Object value;
+
+        QueueElement(final Connection connection) {
+            this.value = connection;
+        }
+
+        QueueElement(final ResultHandler<? super Connection> handler) {
+            this.value = new AsynchronousFutureResult<Connection>(handler);
+        }
+
+        @Override
+        public String toString() {
+            return String.valueOf(value);
+        }
+
+        Connection getWaitingConnection() {
+            if (value instanceof Connection) {
+                return (Connection) value;
+            } else {
+                throw new IllegalStateException();
+            }
+        }
+
+        @SuppressWarnings("unchecked")
+        AsynchronousFutureResult<Connection> getWaitingFuture() {
+            if (value instanceof AsynchronousFutureResult) {
+                return (AsynchronousFutureResult<Connection>) value;
+            } else {
+                throw new IllegalStateException();
+            }
+        }
+
+        boolean isWaitingFuture() {
+            return value instanceof AsynchronousFutureResult;
+        }
+    }
+
+    // Guarded by queue.
+    private final LinkedList<QueueElement> queue = new LinkedList<QueueElement>();
+
+    // Guarded by queue.
+    private boolean isClosed = false;
+
+    private final ConnectionFactory factory;
+
+    private final int poolSize;
+
+    private final Semaphore currentPoolSize;
+
+    private final ResultHandler<Connection> connectionResultHandler = new ConnectionResultHandler();
+
+    /**
+     * Creates a new connection pool which will maintain {@code poolSize}
+     * connections created using the provided connection factory.
+     *
+     * @param factory
+     *            The connection factory to use for creating new connections.
+     * @param poolSize
+     *            The maximum size of the connection pool.
+     */
+    FixedConnectionPool(final ConnectionFactory factory, final int poolSize) {
+        this.factory = factory;
+        this.poolSize = poolSize;
+        this.currentPoolSize = new Semaphore(poolSize);
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void handleResult(final Connection connection)
-    {
-      if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-      {
-        StaticUtils.DEBUG_LOG.fine(String.format(
-            "Connection attempt succeeded: "
-                + " currentPoolSize=%d, poolSize=%d", poolSize
-                - currentPoolSize.availablePermits(), poolSize));
-      }
+    public void close() {
+        final LinkedList<Connection> idleConnections;
+        synchronized (queue) {
+            if (isClosed) {
+                return;
+            }
+            isClosed = true;
 
-      publishConnection(connection);
+            // Remove any connections which are waiting in the queue as these
+            // can be
+            // closed immediately.
+            idleConnections = new LinkedList<Connection>();
+            while (!queue.isEmpty() && !queue.getFirst().isWaitingFuture()) {
+                final QueueElement holder = queue.removeFirst();
+                idleConnections.add(holder.getWaitingConnection());
+            }
+        }
+
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+            StaticUtils.DEBUG_LOG.fine(String.format(
+                    "Connection pool is closing: currentPoolSize=%d, poolSize=%d", poolSize
+                            - currentPoolSize.availablePermits(), poolSize));
+        }
+
+        // Close the idle connections.
+        for (final Connection connection : idleConnections) {
+            closeConnection(connection);
+        }
     }
-  }
-
-
-
-  /**
-   * A pooled connection is passed to the client. It wraps an underlying
-   * "pooled" connection obtained from the underlying factory and lasts until
-   * the client application closes this connection. More specifically, pooled
-   * connections are not actually stored in the internal queue.
-   */
-  private final class PooledConnection implements Connection
-  {
-    // Connection event listeners registed against this pooled connection should
-    // have the same life time as the pooled connection.
-    private final List<ConnectionEventListener> listeners =
-        new CopyOnWriteArrayList<ConnectionEventListener>();
-
-    private final Connection connection;
-
-    private final AtomicBoolean isClosed = new AtomicBoolean(false);
-
-
-
-    PooledConnection(final Connection connection)
-    {
-      this.connection = connection;
-    }
-
-
-
-    @Override
-    public FutureResult<Void> abandonAsync(final AbandonRequest request)
-    {
-      return checkState().abandonAsync(request);
-    }
-
-
-
-    @Override
-    public Result add(final AddRequest request) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().add(request);
-    }
-
-
-
-    @Override
-    public Result add(final Entry entry) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().add(entry);
-    }
-
-
-
-    @Override
-    public Result add(final String... ldifLines) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().add(ldifLines);
-    }
-
-
-
-    @Override
-    public FutureResult<Result> addAsync(final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      return checkState().addAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void addConnectionEventListener(
-        final ConnectionEventListener listener)
-    {
-      Validator.ensureNotNull(listener);
-      checkState();
-      listeners.add(listener);
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        return getConnectionAsync(null).get();
     }
 
-
-
-    @Override
-    public BindResult bind(final BindRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().bind(request);
-    }
-
-
-
-    @Override
-    public BindResult bind(final String name, final char[] password)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().bind(name, password);
-    }
-
-
-
-    @Override
-    public FutureResult<BindResult> bindAsync(final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-    {
-      return checkState().bindAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
     /**
      * {@inheritDoc}
      */
     @Override
-    public void close()
-    {
-      if (!isClosed.compareAndSet(false, true))
-      {
-        // Already closed.
-        return;
-      }
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        QueueElement holder;
+        synchronized (queue) {
+            if (isClosed) {
+                throw new IllegalStateException("FixedConnectionPool is already closed");
+            }
 
-      // Don't put invalid connections back in the pool.
-      if (connection.isValid())
-      {
-        publishConnection(connection);
-      }
-      else
-      {
-        // The connection may have been disconnected by the remote server, but
-        // the server may still be available. In order to avoid leaving pending
-        // futures hanging indefinitely, we should try to reconnect immediately.
+            if (queue.isEmpty() || queue.getFirst().isWaitingFuture()) {
+                holder = new QueueElement(handler);
+                queue.add(holder);
+            } else {
+                holder = queue.removeFirst();
+            }
+        }
 
-        // Close the dead connection.
+        if (!holder.isWaitingFuture()) {
+            // There was a completed connection attempt.
+            final Connection connection = holder.getWaitingConnection();
+            final PooledConnection pooledConnection = new PooledConnection(connection);
+            if (handler != null) {
+                handler.handleResult(pooledConnection);
+            }
+            return new CompletedFutureResult<Connection>(pooledConnection);
+        } else {
+            // Grow the pool if needed.
+            final FutureResult<Connection> future = holder.getWaitingFuture();
+            if (!future.isDone() && currentPoolSize.tryAcquire()) {
+                factory.getConnectionAsync(connectionResultHandler);
+            }
+            return future;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("FixedConnectionPool(");
+        builder.append(String.valueOf(factory));
+        builder.append(',');
+        builder.append(poolSize);
+        builder.append(')');
+        return builder.toString();
+    }
+
+    /**
+     * Provide a finalizer because connection pools are expensive resources to
+     * accidentally leave around. Also, since they won't be created all that
+     * frequently, there's little risk of overloading the finalizer.
+     */
+    @Override
+    protected void finalize() throws Throwable {
+        close();
+    }
+
+    private void closeConnection(final Connection connection) {
+        // The connection will be closed, so decrease the pool size.
+        currentPoolSize.release();
         connection.close();
 
-        // Try to get a new connection to replace it.
-        factory.getConnectionAsync(connectionResultHandler);
-
-        if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          StaticUtils.DEBUG_LOG.warning(String.format(
-              "Connection no longer valid. "
-                  + "currentPoolSize=%d, poolSize=%d", poolSize
-                  - currentPoolSize.availablePermits(), poolSize));
+        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+            StaticUtils.DEBUG_LOG.fine(String.format(
+                    "Closing connection because connection pool is closing: "
+                            + " currentPoolSize=%d, poolSize=%d", poolSize
+                            - currentPoolSize.availablePermits(), poolSize));
         }
-      }
     }
 
+    private void publishConnection(final Connection connection) {
+        final QueueElement holder;
+        boolean connectionPoolIsClosing = false;
 
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void close(final UnbindRequest request, final String reason)
-    {
-      close();
-    }
-
-
-
-    @Override
-    public CompareResult compare(final CompareRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().compare(request);
-    }
-
-
-
-    @Override
-    public CompareResult compare(final String name,
-        final String attributeDescription, final String assertionValue)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().compare(name, attributeDescription, assertionValue);
-    }
-
-
-
-    @Override
-    public FutureResult<CompareResult> compareAsync(
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-    {
-      return checkState().compareAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
-    @Override
-    public Result delete(final DeleteRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().delete(request);
-    }
-
-
-
-    @Override
-    public Result delete(final String name) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().delete(name);
-    }
-
-
-
-    @Override
-    public FutureResult<Result> deleteAsync(final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      return checkState().deleteAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
-    @Override
-    public <R extends ExtendedResult> R extendedRequest(
-        final ExtendedRequest<R> request) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().extendedRequest(request);
-    }
-
-
-
-    @Override
-    public <R extends ExtendedResult> R extendedRequest(
-        final ExtendedRequest<R> request,
-        final IntermediateResponseHandler handler) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().extendedRequest(request, handler);
-    }
-
-
-
-    @Override
-    public GenericExtendedResult extendedRequest(final String requestName,
-        final ByteString requestValue) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().extendedRequest(requestName, requestValue);
-    }
-
-
-
-    @Override
-    public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-        final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-    {
-      return checkState().extendedRequestAsync(request,
-          intermediateResponseHandler, resultHandler);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isClosed()
-    {
-      return isClosed.get();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isValid()
-    {
-      return connection.isValid() && !isClosed();
-    }
-
-
-
-    @Override
-    public Result modify(final ModifyRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().modify(request);
-    }
-
-
-
-    @Override
-    public Result modify(final String... ldifLines)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().modify(ldifLines);
-    }
-
-
-
-    @Override
-    public FutureResult<Result> modifyAsync(final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      return checkState().modifyAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
-    @Override
-    public Result modifyDN(final ModifyDNRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().modifyDN(request);
-    }
-
-
-
-    @Override
-    public Result modifyDN(final String name, final String newRDN)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().modifyDN(name, newRDN);
-    }
-
-
-
-    @Override
-    public FutureResult<Result> modifyDNAsync(final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      return checkState().modifyDNAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
-    @Override
-    public SearchResultEntry readEntry(final DN name,
-        final String... attributeDescriptions) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().readEntry(name, attributeDescriptions);
-    }
-
-
-
-    @Override
-    public SearchResultEntry readEntry(final String name,
-        final String... attributeDescriptions) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().readEntry(name, attributeDescriptions);
-    }
-
-
-
-    @Override
-    public FutureResult<SearchResultEntry> readEntryAsync(final DN name,
-        final Collection<String> attributeDescriptions,
-        final ResultHandler<? super SearchResultEntry> handler)
-    {
-      return checkState().readEntryAsync(name, attributeDescriptions, handler);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void removeConnectionEventListener(
-        final ConnectionEventListener listener)
-    {
-      Validator.ensureNotNull(listener);
-      checkState();
-      listeners.remove(listener);
-    }
-
-
-
-    @Override
-    public ConnectionEntryReader search(final SearchRequest request)
-    {
-      return checkState().search(request);
-    }
-
-
-
-    @Override
-    public Result search(final SearchRequest request,
-        final Collection<? super SearchResultEntry> entries)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().search(request, entries);
-    }
-
-
-
-    @Override
-    public Result search(final SearchRequest request,
-        final Collection<? super SearchResultEntry> entries,
-        final Collection<? super SearchResultReference> references)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().search(request, entries, references);
-    }
-
-
-
-    @Override
-    public Result search(final SearchRequest request,
-        final SearchResultHandler handler) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().search(request, handler);
-    }
-
-
-
-    @Override
-    public ConnectionEntryReader search(final String baseObject,
-        final SearchScope scope, final String filter,
-        final String... attributeDescriptions)
-    {
-      return checkState().search(baseObject, scope, filter,
-          attributeDescriptions);
-    }
-
-
-
-    @Override
-    public FutureResult<Result> searchAsync(final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-    {
-      return checkState().searchAsync(request, intermediateResponseHandler,
-          resultHandler);
-    }
-
-
-
-    @Override
-    public SearchResultEntry searchSingleEntry(final SearchRequest request)
-        throws ErrorResultException, InterruptedException
-    {
-      return checkState().searchSingleEntry(request);
-    }
-
-
-
-    @Override
-    public SearchResultEntry searchSingleEntry(final String baseObject,
-        final SearchScope scope, final String filter,
-        final String... attributeDescriptions) throws ErrorResultException,
-        InterruptedException
-    {
-      return checkState().searchSingleEntry(baseObject, scope, filter,
-          attributeDescriptions);
-    }
-
-
-
-    @Override
-    public FutureResult<SearchResultEntry> searchSingleEntryAsync(
-        final SearchRequest request,
-        final ResultHandler<? super SearchResultEntry> handler)
-    {
-      return checkState().searchSingleEntryAsync(request, handler);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString()
-    {
-      final StringBuilder builder = new StringBuilder();
-      builder.append("PooledConnection(");
-      builder.append(connection);
-      builder.append(')');
-      return builder.toString();
-    }
-
-
-
-    // Checks that this pooled connection has not been closed.
-    private Connection checkState()
-    {
-      if (isClosed())
-      {
-        throw new IllegalStateException();
-      }
-      return connection;
-    }
-
-  }
-
-
-
-  /**
-   * A queue element is either a pending connection request future awaiting an
-   * {@code Connection} or it is an unused {@code Connection} awaiting a
-   * connection request.
-   */
-  private static final class QueueElement
-  {
-    private final Object value;
-
-
-
-    QueueElement(final Connection connection)
-    {
-      this.value = connection;
-    }
-
-
-
-    QueueElement(final ResultHandler<? super Connection> handler)
-    {
-      this.value = new AsynchronousFutureResult<Connection>(handler);
-    }
-
-
-
-    @Override
-    public String toString()
-    {
-      return String.valueOf(value);
-    }
-
-
-
-    Connection getWaitingConnection()
-    {
-      if (value instanceof Connection)
-      {
-        return (Connection) value;
-      }
-      else
-      {
-        throw new IllegalStateException();
-      }
-    }
-
-
-
-    @SuppressWarnings("unchecked")
-    AsynchronousFutureResult<Connection> getWaitingFuture()
-    {
-      if (value instanceof AsynchronousFutureResult)
-      {
-        return (AsynchronousFutureResult<Connection>) value;
-      }
-      else
-      {
-        throw new IllegalStateException();
-      }
-    }
-
-
-
-    boolean isWaitingFuture()
-    {
-      return value instanceof AsynchronousFutureResult;
-    }
-  }
-
-
-
-  // Guarded by queue.
-  private final LinkedList<QueueElement> queue = new LinkedList<QueueElement>();
-
-  // Guarded by queue.
-  private boolean isClosed = false;
-
-  private final ConnectionFactory factory;
-
-  private final int poolSize;
-
-  private final Semaphore currentPoolSize;
-
-  private final ResultHandler<Connection> connectionResultHandler = new ConnectionResultHandler();
-
-
-
-  /**
-   * Creates a new connection pool which will maintain {@code poolSize}
-   * connections created using the provided connection factory.
-   *
-   * @param factory
-   *          The connection factory to use for creating new connections.
-   * @param poolSize
-   *          The maximum size of the connection pool.
-   */
-  FixedConnectionPool(final ConnectionFactory factory, final int poolSize)
-  {
-    this.factory = factory;
-    this.poolSize = poolSize;
-    this.currentPoolSize = new Semaphore(poolSize);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close()
-  {
-    final LinkedList<Connection> idleConnections;
-    synchronized (queue)
-    {
-      if (isClosed)
-      {
-        return;
-      }
-      isClosed = true;
-
-      // Remove any connections which are waiting in the queue as these can be
-      // closed immediately.
-      idleConnections = new LinkedList<Connection>();
-      while (!queue.isEmpty() && !queue.getFirst().isWaitingFuture())
-      {
-        final QueueElement holder = queue.removeFirst();
-        idleConnections.add(holder.getWaitingConnection());
-      }
-    }
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-    {
-      StaticUtils.DEBUG_LOG.fine(String.format(
-          "Connection pool is closing: currentPoolSize=%d, poolSize=%d",
-          poolSize - currentPoolSize.availablePermits(), poolSize));
-    }
-
-    // Close the idle connections.
-    for (final Connection connection : idleConnections)
-    {
-      closeConnection(connection);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    return getConnectionAsync(null).get();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    QueueElement holder;
-    synchronized (queue)
-    {
-      if (isClosed)
-      {
-        throw new IllegalStateException("FixedConnectionPool is already closed");
-      }
-
-      if (queue.isEmpty() || queue.getFirst().isWaitingFuture())
-      {
-        holder = new QueueElement(handler);
-        queue.add(holder);
-      }
-      else
-      {
-        holder = queue.removeFirst();
-      }
-    }
-
-    if (!holder.isWaitingFuture())
-    {
-      // There was a completed connection attempt.
-      final Connection connection = holder.getWaitingConnection();
-      final PooledConnection pooledConnection = new PooledConnection(connection);
-      if (handler != null)
-      {
-        handler.handleResult(pooledConnection);
-      }
-      return new CompletedFutureResult<Connection>(pooledConnection);
-    }
-    else
-    {
-      // Grow the pool if needed.
-      final FutureResult<Connection> future = holder.getWaitingFuture();
-      if (!future.isDone() && currentPoolSize.tryAcquire())
-      {
-        factory.getConnectionAsync(connectionResultHandler);
-      }
-      return future;
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("FixedConnectionPool(");
-    builder.append(String.valueOf(factory));
-    builder.append(',');
-    builder.append(poolSize);
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  /**
-   * Provide a finalizer because connection pools are expensive resources to
-   * accidentally leave around. Also, since they won't be created all that
-   * frequently, there's little risk of overloading the finalizer.
-   */
-  @Override
-  protected void finalize() throws Throwable
-  {
-    close();
-  }
-
-
-
-  private void closeConnection(final Connection connection)
-  {
-    // The connection will be closed, so decrease the pool size.
-    currentPoolSize.release();
-    connection.close();
-
-    if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-    {
-      StaticUtils.DEBUG_LOG.fine(String.format(
-          "Closing connection because connection pool is closing: "
-              + " currentPoolSize=%d, poolSize=%d",
-          poolSize - currentPoolSize.availablePermits(), poolSize));
-    }
-  }
-
-
-
-  private void publishConnection(final Connection connection)
-  {
-    final QueueElement holder;
-    boolean connectionPoolIsClosing = false;
-
-    synchronized (queue)
-    {
-      if (queue.isEmpty() || !queue.getFirst().isWaitingFuture())
-      {
-        if (isClosed)
-        {
-          connectionPoolIsClosing = true;
-          holder = null;
+        synchronized (queue) {
+            if (queue.isEmpty() || !queue.getFirst().isWaitingFuture()) {
+                if (isClosed) {
+                    connectionPoolIsClosing = true;
+                    holder = null;
+                } else {
+                    holder = new QueueElement(connection);
+                    queue.add(holder);
+                    return;
+                }
+            } else {
+                connectionPoolIsClosing = isClosed;
+                holder = queue.removeFirst();
+            }
         }
-        else
-        {
-          holder = new QueueElement(connection);
-          queue.add(holder);
-          return;
+
+        // There was waiting future, so complete it.
+        if (connectionPoolIsClosing) {
+            closeConnection(connection);
+
+            if (holder != null) {
+                final ErrorResultException e =
+                        ErrorResultException.newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
+                                ERR_CONNECTION_POOL_CLOSING.get(toString()).toString());
+                holder.getWaitingFuture().handleErrorResult(e);
+
+                if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE)) {
+                    StaticUtils.DEBUG_LOG.fine(String.format("Connection attempt failed: "
+                            + e.getMessage() + " currentPoolSize=%d, poolSize=%d", poolSize
+                            - currentPoolSize.availablePermits(), poolSize));
+                }
+            }
+        } else {
+            final PooledConnection pooledConnection = new PooledConnection(connection);
+            holder.getWaitingFuture().handleResult(pooledConnection);
         }
-      }
-      else
-      {
-        connectionPoolIsClosing = isClosed;
-        holder = queue.removeFirst();
-      }
     }
 
-    // There was waiting future, so complete it.
-    if (connectionPoolIsClosing)
-    {
-      closeConnection(connection);
-
-      if (holder != null)
-      {
-        final ErrorResultException e = ErrorResultException.newErrorResult(
-            ResultCode.CLIENT_SIDE_USER_CANCELLED, ERR_CONNECTION_POOL_CLOSING
-                .get(toString()).toString());
-        holder.getWaitingFuture().handleErrorResult(e);
-
-        if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINE))
-        {
-          StaticUtils.DEBUG_LOG.fine(String.format(
-              "Connection attempt failed: " + e.getMessage()
-                  + " currentPoolSize=%d, poolSize=%d", poolSize
-                  - currentPoolSize.availablePermits(), poolSize));
-        }
-      }
-    }
-    else
-    {
-      final PooledConnection pooledConnection = new PooledConnection(connection);
-      holder.getWaitingFuture().handleResult(pooledConnection);
-    }
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FutureResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FutureResult.java
index 8238efb..1776f14 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FutureResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FutureResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,113 +26,100 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-
-
 /**
  * A handle which can be used to retrieve the Result of an asynchronous Request.
  *
  * @param <S>
- *          The type of result returned by this future.
+ *            The type of result returned by this future.
  */
-public interface FutureResult<S> extends Future<S>
-{
-  /**
-   * Attempts to cancel the request. This attempt will fail if the request has
-   * already completed or has already been cancelled. If successful, then
-   * cancellation results in an abandon or cancel request (if configured) being
-   * sent to the server.
-   * <p>
-   * After this method returns, subsequent calls to {@link #isDone} will always
-   * return {@code true}. Subsequent calls to {@link #isCancelled} will always
-   * return {@code true} if this method returned {@code true}.
-   *
-   * @param mayInterruptIfRunning
-   *          {@code true} if the thread executing executing the response
-   *          handler should be interrupted; otherwise, in-progress response
-   *          handlers are allowed to complete.
-   * @return {@code false} if the request could not be cancelled, typically
-   *         because it has already completed normally; {@code true} otherwise.
-   */
-  boolean cancel(boolean mayInterruptIfRunning);
+public interface FutureResult<S> extends Future<S> {
+    /**
+     * Attempts to cancel the request. This attempt will fail if the request has
+     * already completed or has already been cancelled. If successful, then
+     * cancellation results in an abandon or cancel request (if configured)
+     * being sent to the server.
+     * <p>
+     * After this method returns, subsequent calls to {@link #isDone} will
+     * always return {@code true}. Subsequent calls to {@link #isCancelled} will
+     * always return {@code true} if this method returned {@code true}.
+     *
+     * @param mayInterruptIfRunning
+     *            {@code true} if the thread executing executing the response
+     *            handler should be interrupted; otherwise, in-progress response
+     *            handlers are allowed to complete.
+     * @return {@code false} if the request could not be cancelled, typically
+     *         because it has already completed normally; {@code true}
+     *         otherwise.
+     */
+    boolean cancel(boolean mayInterruptIfRunning);
 
+    /**
+     * Waits if necessary for the request to complete, and then returns the
+     * result if the request succeeded. If the request failed (i.e. a
+     * non-successful result code was obtained) then the result is thrown as an
+     * {@link ErrorResultException}.
+     *
+     * @return The result, but only if the result code indicates that the
+     *         request succeeded.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     */
+    S get() throws ErrorResultException, InterruptedException;
 
+    /**
+     * Waits if necessary for at most the given time for the request to
+     * complete, and then returns the result if the request succeeded. If the
+     * request failed (i.e. a non-successful result code was obtained) then the
+     * result is thrown as an {@link ErrorResultException}.
+     *
+     * @param timeout
+     *            The maximum time to wait.
+     * @param unit
+     *            The time unit of the timeout argument.
+     * @return The result, but only if the result code indicates that the
+     *         request succeeded.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws TimeoutException
+     *             If the wait timed out.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     */
+    S get(long timeout, TimeUnit unit) throws ErrorResultException, TimeoutException,
+            InterruptedException;
 
-  /**
-   * Waits if necessary for the request to complete, and then returns the result
-   * if the request succeeded. If the request failed (i.e. a non-successful
-   * result code was obtained) then the result is thrown as an
-   * {@link ErrorResultException}.
-   *
-   * @return The result, but only if the result code indicates that the request
-   *         succeeded.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   */
-  S get() throws ErrorResultException, InterruptedException;
+    /**
+     * Returns the request ID of the request if appropriate.
+     *
+     * @return The request ID, or {@code -1} if there is no request ID.
+     */
+    int getRequestID();
 
+    /**
+     * Returns {@code true} if the request was cancelled before it completed
+     * normally.
+     *
+     * @return {@code true} if the request was cancelled before it completed
+     *         normally, otherwise {@code false}.
+     */
+    boolean isCancelled();
 
-
-  /**
-   * Waits if necessary for at most the given time for the request to complete,
-   * and then returns the result if the request succeeded. If the request failed
-   * (i.e. a non-successful result code was obtained) then the result is thrown
-   * as an {@link ErrorResultException}.
-   *
-   * @param timeout
-   *          The maximum time to wait.
-   * @param unit
-   *          The time unit of the timeout argument.
-   * @return The result, but only if the result code indicates that the request
-   *         succeeded.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws TimeoutException
-   *           If the wait timed out.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   */
-  S get(long timeout, TimeUnit unit) throws ErrorResultException,
-      TimeoutException, InterruptedException;
-
-
-
-  /**
-   * Returns the request ID of the request if appropriate.
-   *
-   * @return The request ID, or {@code -1} if there is no request ID.
-   */
-  int getRequestID();
-
-
-
-  /**
-   * Returns {@code true} if the request was cancelled before it completed
-   * normally.
-   *
-   * @return {@code true} if the request was cancelled before it completed
-   *         normally, otherwise {@code false}.
-   */
-  boolean isCancelled();
-
-
-
-  /**
-   * Returns {@code true} if the request has completed.
-   * <p>
-   * Completion may be due to normal termination, an exception, or cancellation.
-   * In all of these cases, this method will return {@code true}.
-   *
-   * @return {@code true} if the request has completed, otherwise {@code false}.
-   */
-  boolean isDone();
+    /**
+     * Returns {@code true} if the request has completed.
+     * <p>
+     * Completion may be due to normal termination, an exception, or
+     * cancellation. In all of these cases, this method will return {@code true}.
+     *
+     * @return {@code true} if the request has completed, otherwise
+     *         {@code false}.
+     */
+    boolean isDone();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
index e95795c..fc61d8c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.ScheduledExecutorService;
@@ -48,377 +45,289 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An heart beat connection factory can be used to create connections that sends
  * a periodic search request to a Directory Server.
  */
-final class HeartBeatConnectionFactory implements ConnectionFactory
-{
-  /**
-   * A connection that sends heart beats and supports all operations.
-   */
-  private final class ConnectionImpl extends ConnectionDecorator implements
-      ConnectionEventListener, SearchResultHandler
-  {
-    private long lastSuccessfulPing;
-
-    private FutureResult<Result> lastPingFuture;
-
-
-
-    private ConnectionImpl(final Connection connection)
-    {
-      super(connection);
-    }
-
-
-
-    @Override
-    public void handleConnectionClosed()
-    {
-      notifyClosed();
-    }
-
-
-
-    @Override
-    public void handleConnectionError(final boolean isDisconnectNotification,
-        final ErrorResultException error)
-    {
-      notifyClosed();
-    }
-
-
-
+final class HeartBeatConnectionFactory implements ConnectionFactory {
     /**
-     * {@inheritDoc}
+     * A connection that sends heart beats and supports all operations.
      */
-    @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      // Ignore.
-      return true;
-    }
+    private final class ConnectionImpl extends ConnectionDecorator implements
+            ConnectionEventListener, SearchResultHandler {
+        private long lastSuccessfulPing;
 
+        private FutureResult<Result> lastPingFuture;
 
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      connection.close(Requests.newUnbindRequest(), "Heartbeat retured error: "
-          + error);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      // Ignore.
-      return true;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleResult(final Result result)
-    {
-      lastSuccessfulPing = System.currentTimeMillis();
-    }
-
-
-
-    @Override
-    public void handleUnsolicitedNotification(final ExtendedResult notification)
-    {
-      // Do nothing
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isValid()
-    {
-      return connection.isValid()
-          && (lastSuccessfulPing <= 0 || System.currentTimeMillis()
-              - lastSuccessfulPing < unit.toMillis(interval) * 2);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString()
-    {
-      final StringBuilder builder = new StringBuilder();
-      builder.append("HeartBeatConnection(");
-      builder.append(connection);
-      builder.append(')');
-      return builder.toString();
-    }
-
-
-
-    private void notifyClosed()
-    {
-      synchronized (activeConnections)
-      {
-        connection.removeConnectionEventListener(this);
-        activeConnections.remove(this);
-
-        if (activeConnections.isEmpty())
-        {
-          // This is the last active connection, so stop the heart beat.
-          heartBeatFuture.cancel(false);
+        private ConnectionImpl(final Connection connection) {
+            super(connection);
         }
-      }
-    }
-  }
 
+        @Override
+        public void handleConnectionClosed() {
+            notifyClosed();
+        }
 
+        @Override
+        public void handleConnectionError(final boolean isDisconnectNotification,
+                final ErrorResultException error) {
+            notifyClosed();
+        }
 
-  private final class FutureResultImpl extends
-      FutureResultTransformer<Connection, Connection> implements
-      ResultHandler<Connection>
-  {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            // Ignore.
+            return true;
+        }
 
-    private FutureResultImpl(final ResultHandler<? super Connection> handler)
-    {
-      super(handler);
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            connection.close(Requests.newUnbindRequest(), "Heartbeat retured error: " + error);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            // Ignore.
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final Result result) {
+            lastSuccessfulPing = System.currentTimeMillis();
+        }
+
+        @Override
+        public void handleUnsolicitedNotification(final ExtendedResult notification) {
+            // Do nothing
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean isValid() {
+            return connection.isValid()
+                    && (lastSuccessfulPing <= 0 || System.currentTimeMillis() - lastSuccessfulPing < unit
+                            .toMillis(interval) * 2);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            final StringBuilder builder = new StringBuilder();
+            builder.append("HeartBeatConnection(");
+            builder.append(connection);
+            builder.append(')');
+            return builder.toString();
+        }
+
+        private void notifyClosed() {
+            synchronized (activeConnections) {
+                connection.removeConnectionEventListener(this);
+                activeConnections.remove(this);
+
+                if (activeConnections.isEmpty()) {
+                    // This is the last active connection, so stop the heart
+                    // beat.
+                    heartBeatFuture.cancel(false);
+                }
+            }
+        }
     }
 
+    private final class FutureResultImpl extends FutureResultTransformer<Connection, Connection>
+            implements ResultHandler<Connection> {
 
+        private FutureResultImpl(final ResultHandler<? super Connection> handler) {
+            super(handler);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected Connection transformResult(final Connection connection)
+                throws ErrorResultException {
+            return adaptConnection(connection);
+        }
+
+    }
+
+    private final class HeartBeatRunnable implements Runnable {
+        private HeartBeatRunnable() {
+            // Nothing to do.
+        }
+
+        @Override
+        public void run() {
+            synchronized (activeConnections) {
+                for (final ConnectionImpl connection : activeConnections) {
+                    if (connection.lastPingFuture == null || connection.lastPingFuture.isDone()) {
+                        connection.lastPingFuture =
+                                connection.searchAsync(heartBeat, null, connection);
+                    }
+                }
+            }
+        }
+    }
+
+    private final SearchRequest heartBeat;
+
+    private final long interval;
+
+    private final ScheduledExecutorService scheduler;
+
+    private final TimeUnit unit;
+
+    private final List<ConnectionImpl> activeConnections;
+
+    private final ConnectionFactory factory;
+
+    private static final SearchRequest DEFAULT_SEARCH = Requests.newSearchRequest("",
+            SearchScope.BASE_OBJECT, "(objectClass=*)", "1.1");
+
+    private ScheduledFuture<?> heartBeatFuture;
+
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections in order to detect that they are still alive every 10 seconds
+     * using the default scheduler.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     */
+    HeartBeatConnectionFactory(final ConnectionFactory factory) {
+        this(factory, 10, TimeUnit.SECONDS, DEFAULT_SEARCH, StaticUtils.getDefaultScheduler());
+    }
+
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections in order to detect that they are still alive using the
+     * specified frequency and the default scheduler.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     */
+    HeartBeatConnectionFactory(final ConnectionFactory factory, final long interval,
+            final TimeUnit unit) {
+        this(factory, interval, unit, DEFAULT_SEARCH, StaticUtils.getDefaultScheduler());
+    }
+
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections using the specified search request in order to detect that
+     * they are still alive.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     * @param heartBeat
+     *            The search request to use for keepalive pings.
+     */
+    HeartBeatConnectionFactory(final ConnectionFactory factory, final long interval,
+            final TimeUnit unit, final SearchRequest heartBeat) {
+        this(factory, interval, unit, heartBeat, StaticUtils.getDefaultScheduler());
+    }
+
+    /**
+     * Creates a new heart-beat connection factory which will create connections
+     * using the provided connection factory and periodically ping any created
+     * connections using the specified search request in order to detect that
+     * they are still alive.
+     *
+     * @param factory
+     *            The connection factory to use for creating connections.
+     * @param interval
+     *            The interval between keepalive pings.
+     * @param unit
+     *            The time unit for the interval between keepalive pings.
+     * @param heartBeat
+     *            The search request to use for keepalive pings.
+     * @param scheduler
+     *            The scheduler which should for periodically sending keepalive
+     *            pings.
+     */
+    HeartBeatConnectionFactory(final ConnectionFactory factory, final long interval,
+            final TimeUnit unit, final SearchRequest heartBeat,
+            final ScheduledExecutorService scheduler) {
+        Validator.ensureNotNull(factory, heartBeat, unit, scheduler);
+        Validator.ensureTrue(interval >= 0, "negative timeout");
+
+        this.heartBeat = heartBeat;
+        this.interval = interval;
+        this.unit = unit;
+        this.activeConnections = new LinkedList<ConnectionImpl>();
+        this.factory = factory;
+        this.scheduler = scheduler;
+    }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected Connection transformResult(final Connection connection)
-        throws ErrorResultException
-    {
-      return adaptConnection(connection);
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        return adaptConnection(factory.getConnection());
     }
 
-  }
-
-
-
-  private final class HeartBeatRunnable implements Runnable
-  {
-    private HeartBeatRunnable()
-    {
-      // Nothing to do.
-    }
-
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void run()
-    {
-      synchronized (activeConnections)
-      {
-        for (final ConnectionImpl connection : activeConnections)
-        {
-          if (connection.lastPingFuture == null
-              || connection.lastPingFuture.isDone())
-          {
-            connection.lastPingFuture = connection.searchAsync(heartBeat, null,
-                connection);
-          }
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        final FutureResultImpl future = new FutureResultImpl(handler);
+        future.setFutureResult(factory.getConnectionAsync(future));
+        return future;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("HeartBeatConnectionFactory(");
+        builder.append(String.valueOf(factory));
+        builder.append(')');
+        return builder.toString();
+    }
+
+    private Connection adaptConnection(final Connection connection) {
+        final ConnectionImpl heartBeatConnection = new ConnectionImpl(connection);
+        synchronized (activeConnections) {
+            connection.addConnectionEventListener(heartBeatConnection);
+            if (activeConnections.isEmpty()) {
+                // This is the first active connection, so start the heart beat.
+                heartBeatFuture =
+                        scheduler
+                                .scheduleWithFixedDelay(new HeartBeatRunnable(), 0, interval, unit);
+            }
+            activeConnections.add(heartBeatConnection);
         }
-      }
+        return heartBeatConnection;
     }
-  }
-
-
-
-  private final SearchRequest heartBeat;
-
-  private final long interval;
-
-  private final ScheduledExecutorService scheduler;
-
-  private final TimeUnit unit;
-
-  private final List<ConnectionImpl> activeConnections;
-
-  private final ConnectionFactory factory;
-
-  private static final SearchRequest DEFAULT_SEARCH = Requests
-      .newSearchRequest("", SearchScope.BASE_OBJECT, "(objectClass=*)", "1.1");
-
-  private ScheduledFuture<?> heartBeatFuture;
-
-
-
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections in order to detect that they are still alive every 10 seconds
-   * using the default scheduler.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   */
-  HeartBeatConnectionFactory(final ConnectionFactory factory)
-  {
-    this(factory, 10, TimeUnit.SECONDS, DEFAULT_SEARCH, StaticUtils
-        .getDefaultScheduler());
-  }
-
-
-
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections in order to detect that they are still alive using the
-   * specified frequency and the default scheduler.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   */
-  HeartBeatConnectionFactory(final ConnectionFactory factory,
-      final long interval, final TimeUnit unit)
-  {
-    this(factory, interval, unit, DEFAULT_SEARCH, StaticUtils
-        .getDefaultScheduler());
-  }
-
-
-
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections using the specified search request in order to detect that they
-   * are still alive.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   * @param heartBeat
-   *          The search request to use for keepalive pings.
-   */
-  HeartBeatConnectionFactory(final ConnectionFactory factory,
-      final long interval, final TimeUnit unit, final SearchRequest heartBeat)
-  {
-    this(factory, interval, unit, heartBeat, StaticUtils.getDefaultScheduler());
-  }
-
-
-
-  /**
-   * Creates a new heart-beat connection factory which will create connections
-   * using the provided connection factory and periodically ping any created
-   * connections using the specified search request in order to detect that they
-   * are still alive.
-   *
-   * @param factory
-   *          The connection factory to use for creating connections.
-   * @param interval
-   *          The interval between keepalive pings.
-   * @param unit
-   *          The time unit for the interval between keepalive pings.
-   * @param heartBeat
-   *          The search request to use for keepalive pings.
-   * @param scheduler
-   *          The scheduler which should for periodically sending keepalive
-   *          pings.
-   */
-  HeartBeatConnectionFactory(final ConnectionFactory factory,
-      final long interval, final TimeUnit unit, final SearchRequest heartBeat,
-      final ScheduledExecutorService scheduler)
-  {
-    Validator.ensureNotNull(factory, heartBeat, unit, scheduler);
-    Validator.ensureTrue(interval >= 0, "negative timeout");
-
-    this.heartBeat = heartBeat;
-    this.interval = interval;
-    this.unit = unit;
-    this.activeConnections = new LinkedList<ConnectionImpl>();
-    this.factory = factory;
-    this.scheduler = scheduler;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    return adaptConnection(factory.getConnection());
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    final FutureResultImpl future = new FutureResultImpl(handler);
-    future.setFutureResult(factory.getConnectionAsync(future));
-    return future;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("HeartBeatConnectionFactory(");
-    builder.append(String.valueOf(factory));
-    builder.append(')');
-    return builder.toString();
-  }
-
-
-
-  private Connection adaptConnection(final Connection connection)
-  {
-    final ConnectionImpl heartBeatConnection = new ConnectionImpl(connection);
-    synchronized (activeConnections)
-    {
-      connection.addConnectionEventListener(heartBeatConnection);
-      if (activeConnections.isEmpty())
-      {
-        // This is the first active connection, so start the heart beat.
-        heartBeatFuture = scheduler.scheduleWithFixedDelay(
-            new HeartBeatRunnable(), 0, interval, unit);
-      }
-      activeConnections.add(heartBeatConnection);
-    }
-    return heartBeatConnection;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java
index 1049d46..d0ccd15 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,12 +27,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.IntermediateResponse;
 
-
-
 /**
  * A completion handler for consuming intermediate responses returned from
  * extended operations, or other operations for which an appropriate control was
@@ -57,18 +52,17 @@
  * avoid keeping the invoking thread from dispatching to other completion
  * handlers.
  */
-public interface IntermediateResponseHandler
-{
-  /**
-   * Invoked each time an intermediate response is returned from the Directory
-   * Server.
-   *
-   * @param response
-   *          The intermediate response.
-   * @return {@code true} if this handler should continue to be notified of any
-   *         remaining intermediate responses, or {@code false} if the remaining
-   *         responses should be skipped for some reason (e.g. a client side
-   *         size limit has been reached).
-   */
-  boolean handleIntermediateResponse(IntermediateResponse response);
+public interface IntermediateResponseHandler {
+    /**
+     * Invoked each time an intermediate response is returned from the Directory
+     * Server.
+     *
+     * @param response
+     *            The intermediate response.
+     * @return {@code true} if this handler should continue to be notified of
+     *         any remaining intermediate responses, or {@code false} if the
+     *         remaining responses should be skipped for some reason (e.g. a
+     *         client side size limit has been reached).
+     */
+    boolean handleIntermediateResponse(IntermediateResponse response);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
index f0f4374..b7123cf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import com.forgerock.opendj.ldap.InternalConnection;
 import com.forgerock.opendj.util.CompletedFutureResult;
 
-
-
 /**
  * A special {@code ConnectionFactory} which waits for internal connection
  * requests and binds them to a {@link ServerConnection} created using the
@@ -52,81 +47,60 @@
  * threads may block indefinitely waiting for results.
  *
  * @param <C>
- *          The type of client context.
+ *            The type of client context.
  */
-final class InternalConnectionFactory<C> implements ConnectionFactory
-{
+final class InternalConnectionFactory<C> implements ConnectionFactory {
 
-  private final ServerConnectionFactory<C, Integer> factory;
+    private final ServerConnectionFactory<C, Integer> factory;
 
-  private final C clientContext;
+    private final C clientContext;
 
-
-
-  InternalConnectionFactory(final ServerConnectionFactory<C, Integer> factory,
-      final C clientContext)
-  {
-    this.factory = factory;
-    this.clientContext = clientContext;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    final ServerConnection<Integer> serverConnection = factory
-        .handleAccept(clientContext);
-    return new InternalConnection(serverConnection);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    final ServerConnection<Integer> serverConnection;
-    try
-    {
-      serverConnection = factory.handleAccept(clientContext);
-    }
-    catch (final ErrorResultException e)
-    {
-      if (handler != null)
-      {
-        handler.handleErrorResult(e);
-      }
-      return new CompletedFutureResult<Connection>(e);
+    InternalConnectionFactory(final ServerConnectionFactory<C, Integer> factory,
+            final C clientContext) {
+        this.factory = factory;
+        this.clientContext = clientContext;
     }
 
-    final InternalConnection connection = new InternalConnection(
-        serverConnection);
-    if (handler != null)
-    {
-      handler.handleResult(connection);
+    /**
+     * {@inheritDoc}
+     */
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        final ServerConnection<Integer> serverConnection = factory.handleAccept(clientContext);
+        return new InternalConnection(serverConnection);
     }
-    return new CompletedFutureResult<Connection>(connection);
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        final ServerConnection<Integer> serverConnection;
+        try {
+            serverConnection = factory.handleAccept(clientContext);
+        } catch (final ErrorResultException e) {
+            if (handler != null) {
+                handler.handleErrorResult(e);
+            }
+            return new CompletedFutureResult<Connection>(e);
+        }
 
+        final InternalConnection connection = new InternalConnection(serverConnection);
+        if (handler != null) {
+            handler.handleResult(connection);
+        }
+        return new CompletedFutureResult<Connection>(connection);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("InternalConnectionFactory(");
-    builder.append(String.valueOf(clientContext));
-    builder.append(',');
-    builder.append(String.valueOf(factory));
-    builder.append(')');
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("InternalConnectionFactory(");
+        builder.append(String.valueOf(clientContext));
+        builder.append(',');
+        builder.append(String.valueOf(factory));
+        builder.append(')');
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java
index 552fd00..0950438 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,372 +27,298 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.Socket;
-import java.security.*;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
+import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
 
-import javax.net.ssl.*;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedKeyManager;
+import javax.net.ssl.X509KeyManager;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains methods for creating common types of key manager.
  */
-public final class KeyManagers
-{
-  /**
-   * This class implements an X.509 key manager that will be used to wrap an
-   * existing key manager and makes it possible to configure which
-   * certificate(s) should be used for client and/or server operations. The
-   * certificate selection will be based on the alias (also called the nickname)
-   * of the certificate.
-   */
-  private static final class SelectCertificate extends X509ExtendedKeyManager
-  {
-    private final String alias;
-    private final X509KeyManager keyManager;
-
-
-
-    private SelectCertificate(final X509KeyManager keyManager,
-        final String alias)
-    {
-      this.keyManager = keyManager;
-      this.alias = alias;
-    }
-
-
-
+public final class KeyManagers {
     /**
-     * {@inheritDoc}
+     * This class implements an X.509 key manager that will be used to wrap an
+     * existing key manager and makes it possible to configure which
+     * certificate(s) should be used for client and/or server operations. The
+     * certificate selection will be based on the alias (also called the
+     * nickname) of the certificate.
      */
-    public String chooseClientAlias(final String[] keyType,
-        final Principal[] issuers, final Socket socket)
-    {
-      for (final String type : keyType)
-      {
-        final String[] clientAliases = keyManager.getClientAliases(type,
-            issuers);
-        if (clientAliases != null)
-        {
-          for (final String clientAlias : clientAliases)
-          {
-            if (clientAlias.equals(alias))
-            {
-              return alias;
+    private static final class SelectCertificate extends X509ExtendedKeyManager {
+        private final String alias;
+        private final X509KeyManager keyManager;
+
+        private SelectCertificate(final X509KeyManager keyManager, final String alias) {
+            this.keyManager = keyManager;
+            this.alias = alias;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String chooseClientAlias(final String[] keyType, final Principal[] issuers,
+                final Socket socket) {
+            for (final String type : keyType) {
+                final String[] clientAliases = keyManager.getClientAliases(type, issuers);
+                if (clientAliases != null) {
+                    for (final String clientAlias : clientAliases) {
+                        if (clientAlias.equals(alias)) {
+                            return alias;
+                        }
+                    }
+                }
             }
-          }
+
+            return null;
         }
-      }
 
-      return null;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String chooseEngineClientAlias(final String[] keyType,
-        final Principal[] issuers, final SSLEngine engine)
-    {
-      for (final String type : keyType)
-      {
-        final String[] clientAliases = keyManager.getClientAliases(type,
-            issuers);
-        if (clientAliases != null)
-        {
-          for (final String clientAlias : clientAliases)
-          {
-            if (clientAlias.equals(alias))
-            {
-              return alias;
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String chooseEngineClientAlias(final String[] keyType, final Principal[] issuers,
+                final SSLEngine engine) {
+            for (final String type : keyType) {
+                final String[] clientAliases = keyManager.getClientAliases(type, issuers);
+                if (clientAliases != null) {
+                    for (final String clientAlias : clientAliases) {
+                        if (clientAlias.equals(alias)) {
+                            return alias;
+                        }
+                    }
+                }
             }
-          }
+
+            return null;
         }
-      }
 
-      return null;
-    }
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String chooseEngineServerAlias(final String keyType, final Principal[] issuers,
+                final SSLEngine engine) {
+            final String[] serverAliases = keyManager.getServerAliases(keyType, issuers);
+            if (serverAliases != null) {
+                for (final String serverAlias : serverAliases) {
+                    if (serverAlias.equalsIgnoreCase(alias)) {
+                        return serverAlias;
+                    }
+                }
+            }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String chooseEngineServerAlias(final String keyType,
-        final Principal[] issuers, final SSLEngine engine)
-    {
-      final String[] serverAliases = keyManager.getServerAliases(keyType,
-          issuers);
-      if (serverAliases != null)
-      {
-        for (final String serverAlias : serverAliases)
-        {
-          if (serverAlias.equalsIgnoreCase(alias))
-          {
-            return serverAlias;
-          }
+            return null;
         }
-      }
 
-      return null;
-    }
+        /**
+         * {@inheritDoc}
+         */
+        public String chooseServerAlias(final String keyType, final Principal[] issuers,
+                final Socket socket) {
+            final String[] serverAliases = keyManager.getServerAliases(keyType, issuers);
+            if (serverAliases != null) {
+                for (final String serverAlias : serverAliases) {
+                    if (serverAlias.equals(alias)) {
+                        return alias;
+                    }
+                }
+            }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String chooseServerAlias(final String keyType,
-        final Principal[] issuers, final Socket socket)
-    {
-      final String[] serverAliases = keyManager.getServerAliases(keyType,
-          issuers);
-      if (serverAliases != null)
-      {
-        for (final String serverAlias : serverAliases)
-        {
-          if (serverAlias.equals(alias))
-          {
-            return alias;
-          }
+            return null;
         }
-      }
 
-      return null;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public X509Certificate[] getCertificateChain(final String alias)
-    {
-      return keyManager.getCertificateChain(alias);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] getClientAliases(final String keyType,
-        final Principal[] issuers)
-    {
-      return keyManager.getClientAliases(keyType, issuers);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public PrivateKey getPrivateKey(final String alias)
-    {
-      return keyManager.getPrivateKey(alias);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] getServerAliases(final String keyType,
-        final Principal[] issuers)
-    {
-      return keyManager.getServerAliases(keyType, issuers);
-    }
-  }
-
-
-
-  /**
-   * Creates a new {@code X509KeyManager} which will use the named key store
-   * file for retrieving certificates. It will use the default key store format
-   * for the JVM (e.g. {@code JKS}) and will not use a password to open the key
-   * store.
-   *
-   * @param file
-   *          The key store file name.
-   * @return A new {@code X509KeyManager} which will use the named key store
-   *         file for retrieving certificates.
-   * @throws GeneralSecurityException
-   *           If the key store could not be loaded, perhaps due to incorrect
-   *           format, or missing algorithms.
-   * @throws IOException
-   *           If the key store file could not be found or could not be read.
-   * @throws NullPointerException
-   *           If {@code file} was {@code null}.
-   */
-  public static X509KeyManager useKeyStoreFile(final String file)
-      throws GeneralSecurityException, IOException
-  {
-    return useKeyStoreFile(file, null, null);
-  }
-
-
-
-  /**
-   * Creates a new {@code X509KeyManager} which will use the named key store
-   * file for retrieving certificates. It will use the provided key store format
-   * and password.
-   *
-   * @param file
-   *          The key store file name.
-   * @param password
-   *          The key store password, which may be {@code null}.
-   * @param format
-   *          The key store format, which may be {@code null} to indicate that
-   *          the default key store format for the JVM (e.g. {@code JKS}) should
-   *          be used.
-   * @return A new {@code X509KeyManager} which will use the named key store
-   *         file for retrieving certificates.
-   * @throws GeneralSecurityException
-   *           If the key store could not be loaded, perhaps due to incorrect
-   *           format, or missing algorithms.
-   * @throws IOException
-   *           If the key store file could not be found or could not be read.
-   * @throws NullPointerException
-   *           If {@code file} was {@code null}.
-   */
-  public static X509KeyManager useKeyStoreFile(final String file,
-      final char[] password, final String format)
-      throws GeneralSecurityException, IOException
-  {
-    Validator.ensureNotNull(file);
-
-    final File keyStoreFile = new File(file);
-    final String keyStoreFormat = format != null ? format : KeyStore
-        .getDefaultType();
-
-    final KeyStore keyStore = KeyStore.getInstance(keyStoreFormat);
-
-    FileInputStream fos = null;
-    try
-    {
-      fos = new FileInputStream(keyStoreFile);
-      keyStore.load(fos, password);
-    }
-    finally
-    {
-      if (fos != null)
-      {
-        try
-        {
-          fos.close();
+        /**
+         * {@inheritDoc}
+         */
+        public X509Certificate[] getCertificateChain(final String alias) {
+            return keyManager.getCertificateChain(alias);
         }
-        catch (final IOException ignored)
-        {
-          // Ignore.
+
+        /**
+         * {@inheritDoc}
+         */
+        public String[] getClientAliases(final String keyType, final Principal[] issuers) {
+            return keyManager.getClientAliases(keyType, issuers);
         }
-      }
+
+        /**
+         * {@inheritDoc}
+         */
+        public PrivateKey getPrivateKey(final String alias) {
+            return keyManager.getPrivateKey(alias);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String[] getServerAliases(final String keyType, final Principal[] issuers) {
+            return keyManager.getServerAliases(keyType, issuers);
+        }
     }
 
-    final KeyManagerFactory kmf = KeyManagerFactory
-        .getInstance(KeyManagerFactory.getDefaultAlgorithm());
-    kmf.init(keyStore, password);
-
-    X509KeyManager x509km = null;
-    for (final KeyManager km : kmf.getKeyManagers())
-    {
-      if (km instanceof X509KeyManager)
-      {
-        x509km = (X509KeyManager) km;
-        break;
-      }
+    /**
+     * Creates a new {@code X509KeyManager} which will use the named key store
+     * file for retrieving certificates. It will use the default key store
+     * format for the JVM (e.g. {@code JKS}) and will not use a password to open
+     * the key store.
+     *
+     * @param file
+     *            The key store file name.
+     * @return A new {@code X509KeyManager} which will use the named key store
+     *         file for retrieving certificates.
+     * @throws GeneralSecurityException
+     *             If the key store could not be loaded, perhaps due to
+     *             incorrect format, or missing algorithms.
+     * @throws IOException
+     *             If the key store file could not be found or could not be
+     *             read.
+     * @throws NullPointerException
+     *             If {@code file} was {@code null}.
+     */
+    public static X509KeyManager useKeyStoreFile(final String file)
+            throws GeneralSecurityException, IOException {
+        return useKeyStoreFile(file, null, null);
     }
 
-    if (x509km == null)
-    {
-      throw new NoSuchAlgorithmException();
+    /**
+     * Creates a new {@code X509KeyManager} which will use the named key store
+     * file for retrieving certificates. It will use the provided key store
+     * format and password.
+     *
+     * @param file
+     *            The key store file name.
+     * @param password
+     *            The key store password, which may be {@code null}.
+     * @param format
+     *            The key store format, which may be {@code null} to indicate
+     *            that the default key store format for the JVM (e.g.
+     *            {@code JKS}) should be used.
+     * @return A new {@code X509KeyManager} which will use the named key store
+     *         file for retrieving certificates.
+     * @throws GeneralSecurityException
+     *             If the key store could not be loaded, perhaps due to
+     *             incorrect format, or missing algorithms.
+     * @throws IOException
+     *             If the key store file could not be found or could not be
+     *             read.
+     * @throws NullPointerException
+     *             If {@code file} was {@code null}.
+     */
+    public static X509KeyManager useKeyStoreFile(final String file, final char[] password,
+            final String format) throws GeneralSecurityException, IOException {
+        Validator.ensureNotNull(file);
+
+        final File keyStoreFile = new File(file);
+        final String keyStoreFormat = format != null ? format : KeyStore.getDefaultType();
+
+        final KeyStore keyStore = KeyStore.getInstance(keyStoreFormat);
+
+        FileInputStream fos = null;
+        try {
+            fos = new FileInputStream(keyStoreFile);
+            keyStore.load(fos, password);
+        } finally {
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (final IOException ignored) {
+                    // Ignore.
+                }
+            }
+        }
+
+        final KeyManagerFactory kmf =
+                KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+        kmf.init(keyStore, password);
+
+        X509KeyManager x509km = null;
+        for (final KeyManager km : kmf.getKeyManagers()) {
+            if (km instanceof X509KeyManager) {
+                x509km = (X509KeyManager) km;
+                break;
+            }
+        }
+
+        if (x509km == null) {
+            throw new NoSuchAlgorithmException();
+        }
+
+        return x509km;
     }
 
-    return x509km;
-  }
+    /**
+     * Creates a new {@code X509KeyManager} which will use a PKCS#11 token for
+     * retrieving certificates.
+     *
+     * @param password
+     *            The password to use for accessing the PKCS#11 token, which may
+     *            be {@code null} if no password is required.
+     * @return A new {@code X509KeyManager} which will use a PKCS#11 token for
+     *         retrieving certificates.
+     * @throws GeneralSecurityException
+     *             If the PKCS#11 token could not be accessed, perhaps due to
+     *             incorrect password, or missing algorithms.
+     * @throws IOException
+     *             If the PKCS#11 token could not be found or could not be read.
+     */
+    public static X509KeyManager usePKCS11Token(final char[] password)
+            throws GeneralSecurityException, IOException {
+        final KeyStore keyStore = KeyStore.getInstance("PKCS11");
+        keyStore.load(null, password);
+        final KeyManagerFactory kmf =
+                KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+        kmf.init(keyStore, password);
 
+        X509KeyManager x509km = null;
+        for (final KeyManager km : kmf.getKeyManagers()) {
+            if (km instanceof X509KeyManager) {
+                x509km = (X509KeyManager) km;
+                break;
+            }
+        }
 
+        if (x509km == null) {
+            throw new NoSuchAlgorithmException();
+        }
 
-  /**
-   * Creates a new {@code X509KeyManager} which will use a PKCS#11 token for
-   * retrieving certificates.
-   *
-   * @param password
-   *          The password to use for accessing the PKCS#11 token, which may be
-   *          {@code null} if no password is required.
-   * @return A new {@code X509KeyManager} which will use a PKCS#11 token for
-   *         retrieving certificates.
-   * @throws GeneralSecurityException
-   *           If the PKCS#11 token could not be accessed, perhaps due to
-   *           incorrect password, or missing algorithms.
-   * @throws IOException
-   *           If the PKCS#11 token could not be found or could not be read.
-   */
-  public static X509KeyManager usePKCS11Token(final char[] password)
-      throws GeneralSecurityException, IOException
-  {
-    final KeyStore keyStore = KeyStore.getInstance("PKCS11");
-    keyStore.load(null, password);
-    final KeyManagerFactory kmf = KeyManagerFactory
-        .getInstance(KeyManagerFactory.getDefaultAlgorithm());
-    kmf.init(keyStore, password);
-
-    X509KeyManager x509km = null;
-    for (final KeyManager km : kmf.getKeyManagers())
-    {
-      if (km instanceof X509KeyManager)
-      {
-        x509km = (X509KeyManager) km;
-        break;
-      }
+        return x509km;
     }
 
-    if (x509km == null)
-    {
-      throw new NoSuchAlgorithmException();
+    /**
+     * Returns a new {@code X509KeyManager} which selects the named certificate
+     * from the provided {@code X509KeyManager}.
+     *
+     * @param alias
+     *            The nickname of the certificate that should be selected for
+     *            operations involving this key manager.
+     * @param keyManager
+     *            The key manager to be filtered.
+     * @return The filtered key manager.
+     * @throws NullPointerException
+     *             If {@code keyManager} or {@code alias} was {@code null}.
+     */
+    public static X509KeyManager useSingleCertificate(final String alias,
+            final X509KeyManager keyManager) {
+        Validator.ensureNotNull(alias, keyManager);
+        return new SelectCertificate(keyManager, alias);
     }
 
-    return x509km;
-  }
-
-
-
-  /**
-   * Returns a new {@code X509KeyManager} which selects the named certificate
-   * from the provided {@code X509KeyManager}.
-   *
-   * @param alias
-   *          The nickname of the certificate that should be selected for
-   *          operations involving this key manager.
-   * @param keyManager
-   *          The key manager to be filtered.
-   * @return The filtered key manager.
-   * @throws NullPointerException
-   *           If {@code keyManager} or {@code alias} was {@code null}.
-   */
-  public static X509KeyManager useSingleCertificate(final String alias,
-      final X509KeyManager keyManager)
-  {
-    Validator.ensureNotNull(alias, keyManager);
-    return new SelectCertificate(keyManager, alias);
-  }
-
-
-
-  // Prevent insantiation.
-  private KeyManagers()
-  {
-    // Nothing to do.
-  }
+    // Prevent insantiation.
+    private KeyManagers() {
+        // Nothing to do.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java
index 42ad6a1..7575ea0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,152 +27,131 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.net.InetSocketAddress;
 
 import javax.net.ssl.SSLContext;
 
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * An LDAP client which has connected to a {@link ServerConnectionFactory}. An
  * LDAP client context can be used to query information about the client's
  * connection such as their network address, as well as managing the state of
  * the connection.
  */
-public interface LDAPClientContext
-{
+public interface LDAPClientContext {
 
-  /**
-   * Disconnects the client without sending a disconnect notification.
-   * <p>
-   * <b>Server connections:</b> invoking this method causes
-   * {@link ServerConnection#handleConnectionDisconnected
-   * handleConnectionDisconnected} to be called before this method returns.
-   */
-  void disconnect();
+    /**
+     * Disconnects the client without sending a disconnect notification.
+     * <p>
+     * <b>Server connections:</b> invoking this method causes
+     * {@link ServerConnection#handleConnectionDisconnected
+     * handleConnectionDisconnected} to be called before this method returns.
+     */
+    void disconnect();
 
+    /**
+     * Disconnects the client and sends a disconnect notification, if possible,
+     * containing the provided result code and diagnostic message.
+     * <p>
+     * <b>Server connections:</b> invoking this method causes
+     * {@link ServerConnection#handleConnectionDisconnected
+     * handleConnectionDisconnected} to be called before this method returns.
+     *
+     * @param resultCode
+     *            The result code which should be included with the disconnect
+     *            notification.
+     * @param message
+     *            The diagnostic message, which may be empty or {@code null}
+     *            indicating that none was provided.
+     */
+    void disconnect(ResultCode resultCode, String message);
 
+    /**
+     * Returns the {@code InetSocketAddress} associated with the local system.
+     *
+     * @return The {@code InetSocketAddress} associated with the local system.
+     */
+    InetSocketAddress getLocalAddress();
 
-  /**
-   * Disconnects the client and sends a disconnect notification, if possible,
-   * containing the provided result code and diagnostic message.
-   * <p>
-   * <b>Server connections:</b> invoking this method causes
-   * {@link ServerConnection#handleConnectionDisconnected
-   * handleConnectionDisconnected} to be called before this method returns.
-   *
-   * @param resultCode
-   *          The result code which should be included with the disconnect
-   *          notification.
-   * @param message
-   *          The diagnostic message, which may be empty or {@code null}
-   *          indicating that none was provided.
-   */
-  void disconnect(ResultCode resultCode, String message);
+    /**
+     * Returns the {@code InetSocketAddress} associated with the remote system.
+     *
+     * @return The {@code InetSocketAddress} associated with the remote system.
+     */
+    InetSocketAddress getPeerAddress();
 
+    /**
+     * Returns the strongest cipher strength currently in use by the underlying
+     * connection.
+     *
+     * @return The strongest cipher strength currently in use by the underlying
+     *         connection.
+     */
+    int getSecurityStrengthFactor();
 
+    /**
+     * Returns {@code true} if the underlying connection has been closed as a
+     * result of a client disconnect, a fatal connection error, or a server-side
+     * {@link #disconnect}.
+     * <p>
+     * This method provides a polling mechanism which can be used by synchronous
+     * request handler implementations to detect connection termination.
+     * <p>
+     * <b>Server connections:</b> this method will always return {@code true}
+     * when called from within {@link ServerConnection#handleConnectionClosed
+     * handleConnectionClosed},
+     * {@link ServerConnection#handleConnectionDisconnected
+     * handleConnectionDisconnected}, or
+     * {@link ServerConnection#handleConnectionError handleConnectionError}.
+     *
+     * @return {@code true} if the underlying connection has been closed.
+     */
+    boolean isClosed();
 
-  /**
-   * Returns the {@code InetSocketAddress} associated with the local system.
-   *
-   * @return The {@code InetSocketAddress} associated with the local system.
-   */
-  InetSocketAddress getLocalAddress();
+    /**
+     * Sends an unsolicited notification to the client.
+     *
+     * @param notification
+     *            The notification to send.
+     */
+    void sendUnsolicitedNotification(ExtendedResult notification);
 
+    /**
+     * Installs the provided connection security layer to the underlying
+     * connection. This may be used to add a SASL integrity and/or
+     * confidentiality protection layer after SASL authentication has completed,
+     * but could also be used to add other layers such as compression. Multiple
+     * layers may be installed.
+     *
+     * @param layer
+     *            The negotiated bind context that can be used to encode and
+     *            decode data on the connection.
+     */
+    void enableConnectionSecurityLayer(ConnectionSecurityLayer layer);
 
-
-  /**
-   * Returns the {@code InetSocketAddress} associated with the remote system.
-   *
-   * @return The {@code InetSocketAddress} associated with the remote system.
-   */
-  InetSocketAddress getPeerAddress();
-
-
-
-  /**
-   * Returns the strongest cipher strength currently in use by the underlying
-   * connection.
-   *
-   * @return The strongest cipher strength currently in use by the underlying
-   *         connection.
-   */
-  int getSecurityStrengthFactor();
-
-
-
-  /**
-   * Returns {@code true} if the underlying connection has been closed as a
-   * result of a client disconnect, a fatal connection error, or a server-side
-   * {@link #disconnect}.
-   * <p>
-   * This method provides a polling mechanism which can be used by synchronous
-   * request handler implementations to detect connection termination.
-   * <p>
-   * <b>Server connections:</b> this method will always return {@code true} when
-   * called from within {@link ServerConnection#handleConnectionClosed
-   * handleConnectionClosed},
-   * {@link ServerConnection#handleConnectionDisconnected
-   * handleConnectionDisconnected}, or
-   * {@link ServerConnection#handleConnectionError handleConnectionError}.
-   *
-   * @return {@code true} if the underlying connection has been closed.
-   */
-  boolean isClosed();
-
-
-
-  /**
-   * Sends an unsolicited notification to the client.
-   *
-   * @param notification
-   *          The notification to send.
-   */
-  void sendUnsolicitedNotification(ExtendedResult notification);
-
-
-
-  /**
-   * Installs the provided connection security layer to the underlying
-   * connection. This may be used to add a SASL integrity and/or confidentiality
-   * protection layer after SASL authentication has completed, but could also be
-   * used to add other layers such as compression. Multiple layers may be
-   * installed.
-   *
-   * @param layer
-   *          The negotiated bind context that can be used to encode and decode
-   *          data on the connection.
-   */
-  void enableConnectionSecurityLayer(ConnectionSecurityLayer layer);
-
-
-
-  /**
-   * Installs the TLS/SSL security layer on the underlying connection. The
-   * TLS/SSL security layer will be installed beneath any existing connection
-   * security layers and can only be installed at most once.
-   *
-   * @param sslContext
-   *          The {@code SSLContext} which should be used to secure the
-   * @param protocols
-   *          Names of all the protocols to enable or {@code null} to use the
-   *          default protocols.
-   * @param suites
-   *          Names of all the suites to enable or {@code null} to use the
-   *          default cipher suites.
-   * @param wantClientAuth
-   *          Set to {@code true} if client authentication is requested, or
-   *          {@code false} if no client authentication is desired.
-   * @param needClientAuth
-   *          Set to {@code true} if client authentication is required, or
-   *          {@code false} if no client authentication is desired.
-   * @throws IllegalStateException
-   *           If the TLS/SSL security layer has already been installed.
-   */
-  void enableTLS(SSLContext sslContext, String[] protocols, String[] suites,
-      boolean wantClientAuth, boolean needClientAuth);
+    /**
+     * Installs the TLS/SSL security layer on the underlying connection. The
+     * TLS/SSL security layer will be installed beneath any existing connection
+     * security layers and can only be installed at most once.
+     *
+     * @param sslContext
+     *            The {@code SSLContext} which should be used to secure the
+     * @param protocols
+     *            Names of all the protocols to enable or {@code null} to use
+     *            the default protocols.
+     * @param suites
+     *            Names of all the suites to enable or {@code null} to use the
+     *            default cipher suites.
+     * @param wantClientAuth
+     *            Set to {@code true} if client authentication is requested, or
+     *            {@code false} if no client authentication is desired.
+     * @param needClientAuth
+     *            Set to {@code true} if client authentication is required, or
+     *            {@code false} if no client authentication is desired.
+     * @throws IllegalStateException
+     *             If the TLS/SSL security layer has already been installed.
+     */
+    void enableTLS(SSLContext sslContext, String[] protocols, String[] suites,
+            boolean wantClientAuth, boolean needClientAuth);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java
index e842145..5660398 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
@@ -37,206 +34,161 @@
 import com.forgerock.opendj.ldap.LDAPConnectionFactoryImpl;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A factory class which can be used to obtain connections to an LDAP Directory
  * Server.
  */
-public final class LDAPConnectionFactory implements ConnectionFactory
-{
-  // We implement the factory using the pimpl idiom in order to avoid making too
-  // many implementation classes public.
+public final class LDAPConnectionFactory implements ConnectionFactory {
+    // We implement the factory using the pimpl idiom in order to avoid making
+    // too
+    // many implementation classes public.
 
-  private final LDAPConnectionFactoryImpl impl;
+    private final LDAPConnectionFactoryImpl impl;
 
-
-
-  /**
-   * Creates a new LDAP connection factory which can be used to create LDAP
-   * connections to the Directory Server at the provided address.
-   *
-   * @param address
-   *          The address of the Directory Server.
-   * @throws NullPointerException
-   *           If {@code address} was {@code null}.
-   */
-  public LDAPConnectionFactory(final SocketAddress address)
-  {
-    this(address, new LDAPOptions());
-  }
-
-
-
-  /**
-   * Creates a new LDAP connection factory which can be used to create LDAP
-   * connections to the Directory Server at the provided address.
-   *
-   * @param address
-   *          The address of the Directory Server.
-   * @param options
-   *          The LDAP options to use when creating connections.
-   * @throws NullPointerException
-   *           If {@code address} or {@code options} was {@code null}.
-   */
-  public LDAPConnectionFactory(final SocketAddress address,
-      final LDAPOptions options)
-  {
-    Validator.ensureNotNull(address, options);
-    this.impl = new LDAPConnectionFactoryImpl(address, options);
-  }
-
-
-
-  /**
-   * Creates a new LDAP connection factory which can be used to create LDAP
-   * connections to the Directory Server at the provided host and port address.
-   *
-   * @param host
-   *          The host name.
-   * @param port
-   *          The port number.
-   * @throws NullPointerException
-   *           If {@code host} was {@code null}.
-   */
-  public LDAPConnectionFactory(final String host, final int port)
-  {
-    this(host, port, new LDAPOptions());
-  }
-
-
-
-  /**
-   * Creates a new LDAP connection factory which can be used to create LDAP
-   * connections to the Directory Server at the provided host and port address.
-   *
-   * @param host
-   *          The host name.
-   * @param port
-   *          The port number.
-   * @param options
-   *          The LDAP options to use when creating connections.
-   * @throws NullPointerException
-   *           If {@code host} or {@code options} was {@code null}.
-   */
-  public LDAPConnectionFactory(final String host, final int port,
-      final LDAPOptions options)
-  {
-    Validator.ensureNotNull(host, options);
-    final SocketAddress address = new InetSocketAddress(host, port);
-    this.impl = new LDAPConnectionFactoryImpl(address, options);
-  }
-
-
-
-  /**
-   * Returns the {@code InetAddress} that this LDAP listener is listening on.
-   *
-   * @return The {@code InetAddress} that this LDAP listener is listening on, or
-   *         {@code null} if it is unknown.
-   */
-  public InetAddress getAddress()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getAddress();
+    /**
+     * Creates a new LDAP connection factory which can be used to create LDAP
+     * connections to the Directory Server at the provided address.
+     *
+     * @param address
+     *            The address of the Directory Server.
+     * @throws NullPointerException
+     *             If {@code address} was {@code null}.
+     */
+    public LDAPConnectionFactory(final SocketAddress address) {
+        this(address, new LDAPOptions());
     }
-    else
-    {
-      return null;
+
+    /**
+     * Creates a new LDAP connection factory which can be used to create LDAP
+     * connections to the Directory Server at the provided address.
+     *
+     * @param address
+     *            The address of the Directory Server.
+     * @param options
+     *            The LDAP options to use when creating connections.
+     * @throws NullPointerException
+     *             If {@code address} or {@code options} was {@code null}.
+     */
+    public LDAPConnectionFactory(final SocketAddress address, final LDAPOptions options) {
+        Validator.ensureNotNull(address, options);
+        this.impl = new LDAPConnectionFactoryImpl(address, options);
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    return impl.getConnectionAsync(handler);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    return impl.getConnection();
-  }
-
-
-
-  /**
-   * Returns the host name that this LDAP listener is listening on.
-   *
-   * @return The host name that this LDAP listener is listening on, or
-   *         {@code null} if it is unknown.
-   */
-  public String getHostname()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getHostName();
+    /**
+     * Creates a new LDAP connection factory which can be used to create LDAP
+     * connections to the Directory Server at the provided host and port
+     * address.
+     *
+     * @param host
+     *            The host name.
+     * @param port
+     *            The port number.
+     * @throws NullPointerException
+     *             If {@code host} was {@code null}.
+     */
+    public LDAPConnectionFactory(final String host, final int port) {
+        this(host, port, new LDAPOptions());
     }
-    else
-    {
-      return null;
+
+    /**
+     * Creates a new LDAP connection factory which can be used to create LDAP
+     * connections to the Directory Server at the provided host and port
+     * address.
+     *
+     * @param host
+     *            The host name.
+     * @param port
+     *            The port number.
+     * @param options
+     *            The LDAP options to use when creating connections.
+     * @throws NullPointerException
+     *             If {@code host} or {@code options} was {@code null}.
+     */
+    public LDAPConnectionFactory(final String host, final int port, final LDAPOptions options) {
+        Validator.ensureNotNull(host, options);
+        final SocketAddress address = new InetSocketAddress(host, port);
+        this.impl = new LDAPConnectionFactoryImpl(address, options);
     }
-  }
 
-
-
-  /**
-   * Returns the port that this LDAP listener is listening on.
-   *
-   * @return The port that this LDAP listener is listening on, or {@code -1} if
-   *         it is unknown.
-   */
-  public int getPort()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getPort();
+    /**
+     * Returns the {@code InetAddress} that this LDAP listener is listening on.
+     *
+     * @return The {@code InetAddress} that this LDAP listener is listening on,
+     *         or {@code null} if it is unknown.
+     */
+    public InetAddress getAddress() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getAddress();
+        } else {
+            return null;
+        }
     }
-    else
-    {
-      return -1;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        return impl.getConnectionAsync(handler);
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        return impl.getConnection();
+    }
 
+    /**
+     * Returns the host name that this LDAP listener is listening on.
+     *
+     * @return The host name that this LDAP listener is listening on, or
+     *         {@code null} if it is unknown.
+     */
+    public String getHostname() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getHostName();
+        } else {
+            return null;
+        }
+    }
 
-  /**
-   * Returns the address that this LDAP listener is listening on.
-   *
-   * @return The address that this LDAP listener is listening on.
-   */
-  public SocketAddress getSocketAddress()
-  {
-    return impl.getSocketAddress();
-  }
+    /**
+     * Returns the port that this LDAP listener is listening on.
+     *
+     * @return The port that this LDAP listener is listening on, or {@code -1}
+     *         if it is unknown.
+     */
+    public int getPort() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getPort();
+        } else {
+            return -1;
+        }
+    }
 
+    /**
+     * Returns the address that this LDAP listener is listening on.
+     *
+     * @return The address that this LDAP listener is listening on.
+     */
+    public SocketAddress getSocketAddress() {
+        return impl.getSocketAddress();
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return impl.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return impl.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java
index 77cf364..4aa7445 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.net.InetAddress;
@@ -39,8 +36,6 @@
 import com.forgerock.opendj.ldap.LDAPListenerImpl;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDAP server connection listener which waits for LDAP connection requests
  * to come in over the network and binds them to a {@link ServerConnection}
@@ -62,320 +57,255 @@
  * The following code illustrates how to create a simple LDAP server:
  *
  * <pre>
- * class MyClientConnection implements ServerConnection&lt;Integer&gt;
- * {
- *   private final LDAPClientContext clientContext;
+ * class MyClientConnection implements ServerConnection&lt;Integer&gt; {
+ *     private final LDAPClientContext clientContext;
  *
+ *     private MyClientConnection(LDAPClientContext clientContext) {
+ *         this.clientContext = clientContext;
+ *     }
  *
+ *     public void add(Integer requestID, AddRequest request, ResultHandler&lt;Result&gt; handler,
+ *             IntermediateResponseHandler intermediateResponseHandler)
+ *             throws UnsupportedOperationException {
+ *         // ...
+ *     }
  *
- *   private MyClientConnection(LDAPClientContext clientContext)
- *   {
- *     this.clientContext = clientContext;
- *   }
- *
- *
- *
- *   public void add(Integer requestID, AddRequest request,
- *       ResultHandler&lt;Result&gt; handler,
- *       IntermediateResponseHandler intermediateResponseHandler)
- *       throws UnsupportedOperationException
- *   {
  *     // ...
- *   }
- *
- *   // ...
  *
  * }
  *
- *
- *
- * class MyServer implements
- *     ServerConnectionFactory&lt;LDAPClientContext, RequestContext&gt;
- * {
- *   public ServerConnection&lt;RequestContext&gt; accept(LDAPClientContext context)
- *   {
- *     System.out.println(&quot;Connection from: &quot; + context.getPeerAddress());
- *     return new MyClientConnection(context);
- *   }
+ * class MyServer implements ServerConnectionFactory&lt;LDAPClientContext, RequestContext&gt; {
+ *     public ServerConnection&lt;RequestContext&gt; accept(LDAPClientContext context) {
+ *         System.out.println(&quot;Connection from: &quot; + context.getPeerAddress());
+ *         return new MyClientConnection(context);
+ *     }
  * }
  *
+ * public static void main(String[] args) throws Exception {
+ *     LDAPListener listener = new LDAPListener(1389, new MyServer());
  *
+ *     // ...
  *
- * public static void main(String[] args) throws Exception
- * {
- *   LDAPListener listener = new LDAPListener(1389, new MyServer());
- *
- *   // ...
- *
- *   listener.close();
+ *     listener.close();
  * }
  * </pre>
  */
-public final class LDAPListener implements Closeable
-{
-  // We implement the factory using the pimpl idiom in order have
-  // cleaner Javadoc which does not expose implementation methods.
+public final class LDAPListener implements Closeable {
+    // We implement the factory using the pimpl idiom in order have
+    // cleaner Javadoc which does not expose implementation methods.
 
-  private final LDAPListenerImpl impl;
+    private final LDAPListenerImpl impl;
 
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param port
-   *          The port to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {code factory} was {@code null}.
-   */
-  public LDAPListener(final int port,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory)
-      throws IOException
-  {
-    this(port, factory, new LDAPListenerOptions());
-  }
-
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param port
-   *          The port to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @param options
-   *          The LDAP listener options.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {code factory} or {@code options} was {@code null}.
-   */
-  public LDAPListener(final int port,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory,
-      final LDAPListenerOptions options) throws IOException
-  {
-    Validator.ensureNotNull(factory, options);
-    final SocketAddress address = new InetSocketAddress(port);
-    this.impl = new LDAPListenerImpl(address, factory, options);
-  }
-
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param address
-   *          The address to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {@code address} or {code factory} was {@code null}.
-   */
-  public LDAPListener(final SocketAddress address,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory)
-      throws IOException
-  {
-    this(address, factory, new LDAPListenerOptions());
-  }
-
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param address
-   *          The address to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @param options
-   *          The LDAP listener options.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {@code address}, {code factory}, or {@code options} was
-   *           {@code null}.
-   */
-  public LDAPListener(final SocketAddress address,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory,
-      final LDAPListenerOptions options) throws IOException
-  {
-    Validator.ensureNotNull(address, factory, options);
-    this.impl = new LDAPListenerImpl(address, factory, options);
-  }
-
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param host
-   *          The address to listen on.
-   * @param port
-   *          The port to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {@code host} or {code factory} was {@code null}.
-   */
-  public LDAPListener(final String host, final int port,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory)
-      throws IOException
-  {
-    this(host, port, factory, new LDAPListenerOptions());
-  }
-
-
-
-  /**
-   * Creates a new LDAP listener implementation which will listen for LDAP
-   * client connections at the provided address.
-   *
-   * @param host
-   *          The address to listen on.
-   * @param port
-   *          The port to listen on.
-   * @param factory
-   *          The server connection factory which will be used to create server
-   *          connections.
-   * @param options
-   *          The LDAP listener options.
-   * @throws IOException
-   *           If an error occurred while trying to listen on the provided
-   *           address.
-   * @throws NullPointerException
-   *           If {@code host}, {code factory}, or {@code options} was
-   *           {@code null}.
-   */
-  public LDAPListener(final String host, final int port,
-      final ServerConnectionFactory<LDAPClientContext, Integer> factory,
-      final LDAPListenerOptions options) throws IOException
-  {
-    Validator.ensureNotNull(host, factory, options);
-    final SocketAddress address = new InetSocketAddress(host, port);
-    this.impl = new LDAPListenerImpl(address, factory, options);
-  }
-
-
-
-  /**
-   * Closes this LDAP connection listener.
-   */
-  @Override
-  public void close()
-  {
-    impl.close();
-  }
-
-
-
-  /**
-   * Returns the {@code InetAddress} that this LDAP listener is listening on.
-   *
-   * @return The {@code InetAddress} that this LDAP listener is listening on, or
-   *         {@code null} if it is unknown.
-   */
-  public InetAddress getAddress()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getAddress();
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param port
+     *            The port to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {code factory} was {@code null}.
+     */
+    public LDAPListener(final int port,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory) throws IOException {
+        this(port, factory, new LDAPListenerOptions());
     }
-    else
-    {
-      return null;
+
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param port
+     *            The port to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @param options
+     *            The LDAP listener options.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {code factory} or {@code options} was {@code null}.
+     */
+    public LDAPListener(final int port,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory,
+            final LDAPListenerOptions options) throws IOException {
+        Validator.ensureNotNull(factory, options);
+        final SocketAddress address = new InetSocketAddress(port);
+        this.impl = new LDAPListenerImpl(address, factory, options);
     }
-  }
 
-
-
-  /**
-   * Returns the host name that this LDAP listener is listening on.
-   *
-   * @return The host name that this LDAP listener is listening on, or
-   *         {@code null} if it is unknown.
-   */
-  public String getHostname()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getHostName();
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param address
+     *            The address to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {@code address} or {code factory} was {@code null}.
+     */
+    public LDAPListener(final SocketAddress address,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory) throws IOException {
+        this(address, factory, new LDAPListenerOptions());
     }
-    else
-    {
-      return null;
+
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param address
+     *            The address to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @param options
+     *            The LDAP listener options.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {@code address}, {code factory}, or {@code options} was
+     *             {@code null}.
+     */
+    public LDAPListener(final SocketAddress address,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory,
+            final LDAPListenerOptions options) throws IOException {
+        Validator.ensureNotNull(address, factory, options);
+        this.impl = new LDAPListenerImpl(address, factory, options);
     }
-  }
 
-
-
-  /**
-   * Returns the port that this LDAP listener is listening on.
-   *
-   * @return The port that this LDAP listener is listening on, or {@code -1} if
-   *         it is unknown.
-   */
-  public int getPort()
-  {
-    final SocketAddress socketAddress = getSocketAddress();
-    if (socketAddress instanceof InetSocketAddress)
-    {
-      final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
-      return inetSocketAddress.getPort();
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param host
+     *            The address to listen on.
+     * @param port
+     *            The port to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {@code host} or {code factory} was {@code null}.
+     */
+    public LDAPListener(final String host, final int port,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory) throws IOException {
+        this(host, port, factory, new LDAPListenerOptions());
     }
-    else
-    {
-      return -1;
+
+    /**
+     * Creates a new LDAP listener implementation which will listen for LDAP
+     * client connections at the provided address.
+     *
+     * @param host
+     *            The address to listen on.
+     * @param port
+     *            The port to listen on.
+     * @param factory
+     *            The server connection factory which will be used to create
+     *            server connections.
+     * @param options
+     *            The LDAP listener options.
+     * @throws IOException
+     *             If an error occurred while trying to listen on the provided
+     *             address.
+     * @throws NullPointerException
+     *             If {@code host}, {code factory}, or {@code options} was
+     *             {@code null}.
+     */
+    public LDAPListener(final String host, final int port,
+            final ServerConnectionFactory<LDAPClientContext, Integer> factory,
+            final LDAPListenerOptions options) throws IOException {
+        Validator.ensureNotNull(host, factory, options);
+        final SocketAddress address = new InetSocketAddress(host, port);
+        this.impl = new LDAPListenerImpl(address, factory, options);
     }
-  }
 
+    /**
+     * Closes this LDAP connection listener.
+     */
+    @Override
+    public void close() {
+        impl.close();
+    }
 
+    /**
+     * Returns the {@code InetAddress} that this LDAP listener is listening on.
+     *
+     * @return The {@code InetAddress} that this LDAP listener is listening on,
+     *         or {@code null} if it is unknown.
+     */
+    public InetAddress getAddress() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getAddress();
+        } else {
+            return null;
+        }
+    }
 
-  /**
-   * Returns the address that this LDAP listener is listening on.
-   *
-   * @return The address that this LDAP listener is listening on.
-   */
-  public SocketAddress getSocketAddress()
-  {
-    return impl.getSocketAddress();
-  }
+    /**
+     * Returns the host name that this LDAP listener is listening on.
+     *
+     * @return The host name that this LDAP listener is listening on, or
+     *         {@code null} if it is unknown.
+     */
+    public String getHostname() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getHostName();
+        } else {
+            return null;
+        }
+    }
 
+    /**
+     * Returns the port that this LDAP listener is listening on.
+     *
+     * @return The port that this LDAP listener is listening on, or {@code -1}
+     *         if it is unknown.
+     */
+    public int getPort() {
+        final SocketAddress socketAddress = getSocketAddress();
+        if (socketAddress instanceof InetSocketAddress) {
+            final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+            return inetSocketAddress.getPort();
+        } else {
+            return -1;
+        }
+    }
 
+    /**
+     * Returns the address that this LDAP listener is listening on.
+     *
+     * @return The address that this LDAP listener is listening on.
+     */
+    public SocketAddress getSocketAddress() {
+        return impl.getSocketAddress();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    return impl.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return impl.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListenerOptions.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListenerOptions.java
index d9238cd..5dba9b5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListenerOptions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPListenerOptions.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,160 +27,130 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Common options for LDAP listeners.
  */
-public final class LDAPListenerOptions
-{
+public final class LDAPListenerOptions {
 
-  private DecodeOptions decodeOptions;
-  private int backlog;
-  private TCPNIOTransport transport;
+    private DecodeOptions decodeOptions;
+    private int backlog;
+    private TCPNIOTransport transport;
 
+    /**
+     * Creates a new set of listener options with default settings. SSL will not
+     * be enabled, and a default set of decode options will be used.
+     */
+    public LDAPListenerOptions() {
+        this.backlog = 0;
+        this.decodeOptions = new DecodeOptions();
+        this.transport = null;
+    }
 
+    /**
+     * Creates a new set of listener options having the same initial set of
+     * options as the provided set of listener options.
+     *
+     * @param options
+     *            The set of listener options to be copied.
+     */
+    public LDAPListenerOptions(final LDAPListenerOptions options) {
+        this.backlog = options.backlog;
+        this.decodeOptions = new DecodeOptions(options.decodeOptions);
+        this.transport = options.transport;
+    }
 
-  /**
-   * Creates a new set of listener options with default settings. SSL will not
-   * be enabled, and a default set of decode options will be used.
-   */
-  public LDAPListenerOptions()
-  {
-    this.backlog = 0;
-    this.decodeOptions = new DecodeOptions();
-    this.transport = null;
-  }
+    /**
+     * Returns the maximum queue length for incoming connections requests. If a
+     * connection request arrives when the queue is full, the connection is
+     * refused. If the backlog is less than {@code 1} then a default value of
+     * {@code 50} will be used.
+     *
+     * @return The maximum queue length for incoming connections requests.
+     */
+    public final int getBacklog() {
+        return backlog;
+    }
 
+    /**
+     * Returns the decoding options which will be used to control how requests
+     * and responses are decoded.
+     *
+     * @return The decoding options which will be used to control how requests
+     *         and responses are decoded (never {@code null}).
+     */
+    public final DecodeOptions getDecodeOptions() {
+        return decodeOptions;
+    }
 
+    /**
+     * Returns the Grizzly TCP transport which will be used when initiating
+     * connections with the Directory Server.
+     * <p>
+     * By default this method will return {@code null} indicating that the
+     * default transport factory should be used to obtain a TCP transport.
+     *
+     * @return The Grizzly TCP transport which will be used when initiating
+     *         connections with the Directory Server, or {@code null} if the
+     *         default transport factory should be used to obtain a TCP
+     *         transport.
+     */
+    public final TCPNIOTransport getTCPNIOTransport() {
+        return transport;
+    }
 
-  /**
-   * Creates a new set of listener options having the same initial set of
-   * options as the provided set of listener options.
-   *
-   * @param options
-   *          The set of listener options to be copied.
-   */
-  public LDAPListenerOptions(final LDAPListenerOptions options)
-  {
-    this.backlog = options.backlog;
-    this.decodeOptions = new DecodeOptions(options.decodeOptions);
-    this.transport = options.transport;
-  }
+    /**
+     * Sets the maximum queue length for incoming connections requests. If a
+     * connection request arrives when the queue is full, the connection is
+     * refused. If the backlog is less than {@code 1} then a default value of
+     * {@code 50} will be used.
+     *
+     * @param backlog
+     *            The maximum queue length for incoming connections requests.
+     * @return A reference to this LDAP listener options.
+     */
+    public final LDAPListenerOptions setBacklog(final int backlog) {
+        this.backlog = backlog;
+        return this;
+    }
 
+    /**
+     * Sets the decoding options which will be used to control how requests and
+     * responses are decoded.
+     *
+     * @param decodeOptions
+     *            The decoding options which will be used to control how
+     *            requests and responses are decoded (never {@code null}).
+     * @return A reference to this LDAP listener options.
+     * @throws NullPointerException
+     *             If {@code decodeOptions} was {@code null}.
+     */
+    public final LDAPListenerOptions setDecodeOptions(final DecodeOptions decodeOptions) {
+        Validator.ensureNotNull(decodeOptions);
+        this.decodeOptions = decodeOptions;
+        return this;
+    }
 
-
-  /**
-   * Returns the maximum queue length for incoming connections requests. If a
-   * connection request arrives when the queue is full, the connection is
-   * refused. If the backlog is less than {@code 1} then a default value of
-   * {@code 50} will be used.
-   *
-   * @return The maximum queue length for incoming connections requests.
-   */
-  public final int getBacklog()
-  {
-    return backlog;
-  }
-
-
-
-  /**
-   * Returns the decoding options which will be used to control how requests and
-   * responses are decoded.
-   *
-   * @return The decoding options which will be used to control how requests and
-   *         responses are decoded (never {@code null}).
-   */
-  public final DecodeOptions getDecodeOptions()
-  {
-    return decodeOptions;
-  }
-
-
-
-  /**
-   * Returns the Grizzly TCP transport which will be used when initiating
-   * connections with the Directory Server.
-   * <p>
-   * By default this method will return {@code null} indicating that the default
-   * transport factory should be used to obtain a TCP transport.
-   *
-   * @return The Grizzly TCP transport which will be used when initiating
-   *         connections with the Directory Server, or {@code null} if the
-   *         default transport factory should be used to obtain a TCP transport.
-   */
-  public final TCPNIOTransport getTCPNIOTransport()
-  {
-    return transport;
-  }
-
-
-
-  /**
-   * Sets the maximum queue length for incoming connections requests. If a
-   * connection request arrives when the queue is full, the connection is
-   * refused. If the backlog is less than {@code 1} then a default value of
-   * {@code 50} will be used.
-   *
-   * @param backlog
-   *          The maximum queue length for incoming connections requests.
-   * @return A reference to this LDAP listener options.
-   */
-  public final LDAPListenerOptions setBacklog(final int backlog)
-  {
-    this.backlog = backlog;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the decoding options which will be used to control how requests and
-   * responses are decoded.
-   *
-   * @param decodeOptions
-   *          The decoding options which will be used to control how requests
-   *          and responses are decoded (never {@code null}).
-   * @return A reference to this LDAP listener options.
-   * @throws NullPointerException
-   *           If {@code decodeOptions} was {@code null}.
-   */
-  public final LDAPListenerOptions setDecodeOptions(
-      final DecodeOptions decodeOptions)
-  {
-    Validator.ensureNotNull(decodeOptions);
-    this.decodeOptions = decodeOptions;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the Grizzly TCP transport which will be used when initiating
-   * connections with the Directory Server.
-   * <p>
-   * By default this method will return {@code null} indicating that the default
-   * transport factory should be used to obtain a TCP transport.
-   *
-   * @param transport
-   *          The Grizzly TCP transport which will be used when initiating
-   *          connections with the Directory Server, or {@code null} if the
-   *          default transport factory should be used to obtain a TCP
-   *          transport.
-   * @return A reference to this connection options.
-   */
-  public final LDAPListenerOptions setTCPNIOTransport(
-      final TCPNIOTransport transport)
-  {
-    this.transport = transport;
-    return this;
-  }
+    /**
+     * Sets the Grizzly TCP transport which will be used when initiating
+     * connections with the Directory Server.
+     * <p>
+     * By default this method will return {@code null} indicating that the
+     * default transport factory should be used to obtain a TCP transport.
+     *
+     * @param transport
+     *            The Grizzly TCP transport which will be used when initiating
+     *            connections with the Directory Server, or {@code null} if the
+     *            default transport factory should be used to obtain a TCP
+     *            transport.
+     * @return A reference to this connection options.
+     */
+    public final LDAPListenerOptions setTCPNIOTransport(final TCPNIOTransport transport) {
+        this.transport = transport;
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPOptions.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPOptions.java
index 9f1e706..f7efb6f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPOptions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPOptions.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -40,317 +37,266 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Common options for LDAP client connections.
  */
-public final class LDAPOptions
-{
-  private SSLContext sslContext;
-  private boolean useStartTLS;
-  private long timeoutInMillis;
-  private DecodeOptions decodeOptions;
-  private List<String> enabledCipherSuites = new LinkedList<String>();
-  private List<String> enabledProtocols = new LinkedList<String>();
-  private TCPNIOTransport transport;
+public final class LDAPOptions {
+    private SSLContext sslContext;
+    private boolean useStartTLS;
+    private long timeoutInMillis;
+    private DecodeOptions decodeOptions;
+    private List<String> enabledCipherSuites = new LinkedList<String>();
+    private List<String> enabledProtocols = new LinkedList<String>();
+    private TCPNIOTransport transport;
 
-
-
-  /**
-   * Creates a new set of connection options with default settings. SSL will not
-   * be enabled, and a default set of decode options will be used.
-   */
-  public LDAPOptions()
-  {
-    this.sslContext = null;
-    this.timeoutInMillis = 0;
-    this.useStartTLS = false;
-    this.decodeOptions = new DecodeOptions();
-    this.transport = null;
-  }
-
-
-
-  /**
-   * Creates a new set of connection options having the same initial set of
-   * options as the provided set of connection options.
-   *
-   * @param options
-   *          The set of connection options to be copied.
-   */
-  public LDAPOptions(final LDAPOptions options)
-  {
-    this.sslContext = options.sslContext;
-    this.timeoutInMillis = options.timeoutInMillis;
-    this.useStartTLS = options.useStartTLS;
-    this.decodeOptions = new DecodeOptions(options.decodeOptions);
-    this.enabledCipherSuites.addAll(options.getEnabledCipherSuites());
-    this.enabledProtocols.addAll(options.getEnabledProtocols());
-    this.transport = options.transport;
-  }
-
-
-
-  /**
-   * Returns the decoding options which will be used to control how requests and
-   * responses are decoded.
-   *
-   * @return The decoding options which will be used to control how requests and
-   *         responses are decoded (never {@code null}).
-   */
-  public final DecodeOptions getDecodeOptions()
-  {
-    return decodeOptions;
-  }
-
-
-
-  /**
-   * Returns the SSL context which will be used when initiating connections with
-   * the Directory Server.
-   * <p>
-   * By default no SSL context will be used, indicating that connections will
-   * not be secured. If a non-{@code null} SSL context is returned then
-   * connections will be secured using either SSL or StartTLS depending on
-   * {@link #useStartTLS()}.
-   *
-   * @return The SSL context which will be used when initiating secure
-   *         connections with the Directory Server, which may be {@code null}
-   *         indicating that connections will not be secured.
-   */
-  public final SSLContext getSSLContext()
-  {
-    return sslContext;
-  }
-
-
-
-  /**
-   * Returns the Grizzly TCP transport which will be used when initiating
-   * connections with the Directory Server.
-   * <p>
-   * By default this method will return {@code null} indicating that the default
-   * transport factory should be used to obtain a TCP transport.
-   *
-   * @return The Grizzly TCP transport which will be used when initiating
-   *         connections with the Directory Server, or {@code null} if the
-   *         default transport factory should be used to obtain a TCP transport.
-   */
-  public final TCPNIOTransport getTCPNIOTransport()
-  {
-    return transport;
-  }
-
-
-
-  /**
-   * Returns the operation timeout in the specified unit.
-   *
-   * @param unit
-   *          The time unit of use.
-   * @return The operation timeout.
-   */
-  public final long getTimeout(final TimeUnit unit)
-  {
-    return unit.convert(timeoutInMillis, TimeUnit.MILLISECONDS);
-  }
-
-
-
-  /**
-   * Sets the decoding options which will be used to control how requests and
-   * responses are decoded.
-   *
-   * @param decodeOptions
-   *          The decoding options which will be used to control how requests
-   *          and responses are decoded (never {@code null}).
-   * @return A reference to this LDAP connection options.
-   * @throws NullPointerException
-   *           If {@code decodeOptions} was {@code null}.
-   */
-  public final LDAPOptions setDecodeOptions(final DecodeOptions decodeOptions)
-  {
-    Validator.ensureNotNull(decodeOptions);
-    this.decodeOptions = decodeOptions;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the SSL context which will be used when initiating connections with
-   * the Directory Server.
-   * <p>
-   * By default no SSL context will be used, indicating that connections will
-   * not be secured. If a non-{@code null} SSL context is returned then
-   * connections will be secured using either SSL or StartTLS depending on
-   * {@link #useStartTLS()}.
-   *
-   * @param sslContext
-   *          The SSL context which will be used when initiating secure
-   *          connections with the Directory Server, which may be {@code null}
-   *          indicating that connections will not be secured.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions setSSLContext(final SSLContext sslContext)
-  {
-    this.sslContext = sslContext;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the Grizzly TCP transport which will be used when initiating
-   * connections with the Directory Server.
-   * <p>
-   * By default this method will return {@code null} indicating that the default
-   * transport factory will be used to obtain a TCP transport.
-   *
-   * @param transport
-   *          The Grizzly TCP transport which will be used when initiating
-   *          connections with the Directory Server, or {@code null} if the
-   *          default transport factory should be used to obtain a TCP
-   *          transport.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions setTCPNIOTransport(final TCPNIOTransport transport)
-  {
-    this.transport = transport;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the operation timeout. If the response is not received from the
-   * Directory Server in the timeout period, the operation will be abandoned and
-   * an error result returned. A timeout setting of 0 disables timeout limits.
-   *
-   * @param timeout
-   *          The operation timeout to use.
-   * @param unit
-   *          the time unit of the time argument.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions setTimeout(final long timeout, final TimeUnit unit)
-  {
-    this.timeoutInMillis = unit.toMillis(timeout);
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not SSL or StartTLS should be used for securing
-   * connections when an SSL context is specified.
-   * <p>
-   * By default SSL will be used in preference to StartTLS.
-   *
-   * @param useStartTLS
-   *          {@code true} if StartTLS should be used for securing connections
-   *          when an SSL context is specified, otherwise {@code false}
-   *          indicating that SSL should be used.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions setUseStartTLS(final boolean useStartTLS)
-  {
-    this.useStartTLS = useStartTLS;
-    return this;
-  }
-
-
-
-  /**
-   * Indicates whether or not SSL or StartTLS should be used for securing
-   * connections when an SSL context is specified.
-   * <p>
-   * By default SSL will be used in preference to StartTLS.
-   *
-   * @return {@code true} if StartTLS should be used for securing connections
-   *         when an SSL context is specified, otherwise {@code false}
-   *         indicating that SSL should be used.
-   */
-  public final boolean useStartTLS()
-  {
-    return useStartTLS;
-  }
-
-
-
-  /**
-   * Adds the protocol versions enabled for secure connections with the
-   * Directory Server.
-   * <p>
-   * The protocols must be supported by the SSLContext specified in
-   * {@link #setSSLContext(SSLContext)}. Following a successful call to this
-   * method, only the protocols listed in the protocols parameter are enabled
-   * for use.
-   *
-   * @param protocols
-   *          Names of all the protocols to enable.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions addEnabledProtocol(String... protocols)
-  {
-    for (final String protocol : protocols)
-    {
-      enabledProtocols.add(Validator.ensureNotNull(protocol));
+    /**
+     * Creates a new set of connection options with default settings. SSL will
+     * not be enabled, and a default set of decode options will be used.
+     */
+    public LDAPOptions() {
+        this.sslContext = null;
+        this.timeoutInMillis = 0;
+        this.useStartTLS = false;
+        this.decodeOptions = new DecodeOptions();
+        this.transport = null;
     }
-    return this;
-  }
 
-
-
-  /**
-   * Adds the cipher suites enabled for secure connections with the Directory
-   * Server.
-   * <p>
-   * The suites must be supported by the SSLContext specified in
-   * {@link #setSSLContext(SSLContext)}. Following a successful call to this
-   * method, only the suites listed in the protocols parameter are enabled for
-   * use.
-   *
-   * @param suites
-   *          Names of all the suites to enable.
-   * @return A reference to this LDAP connection options.
-   */
-  public final LDAPOptions addEnabledCipherSuite(String... suites)
-  {
-    for (final String suite : suites)
-    {
-      enabledCipherSuites.add(Validator.ensureNotNull(suite));
+    /**
+     * Creates a new set of connection options having the same initial set of
+     * options as the provided set of connection options.
+     *
+     * @param options
+     *            The set of connection options to be copied.
+     */
+    public LDAPOptions(final LDAPOptions options) {
+        this.sslContext = options.sslContext;
+        this.timeoutInMillis = options.timeoutInMillis;
+        this.useStartTLS = options.useStartTLS;
+        this.decodeOptions = new DecodeOptions(options.decodeOptions);
+        this.enabledCipherSuites.addAll(options.getEnabledCipherSuites());
+        this.enabledProtocols.addAll(options.getEnabledProtocols());
+        this.transport = options.transport;
     }
-    return this;
-  }
 
+    /**
+     * Returns the decoding options which will be used to control how requests
+     * and responses are decoded.
+     *
+     * @return The decoding options which will be used to control how requests
+     *         and responses are decoded (never {@code null}).
+     */
+    public final DecodeOptions getDecodeOptions() {
+        return decodeOptions;
+    }
 
+    /**
+     * Returns the SSL context which will be used when initiating connections
+     * with the Directory Server.
+     * <p>
+     * By default no SSL context will be used, indicating that connections will
+     * not be secured. If a non-{@code null} SSL context is returned then
+     * connections will be secured using either SSL or StartTLS depending on
+     * {@link #useStartTLS()}.
+     *
+     * @return The SSL context which will be used when initiating secure
+     *         connections with the Directory Server, which may be {@code null}
+     *         indicating that connections will not be secured.
+     */
+    public final SSLContext getSSLContext() {
+        return sslContext;
+    }
 
-  /**
-   * Returns the names of the protocol versions which are currently enabled for
-   * secure connections with the Directory Server.
-   *
-   * @return An array of protocols or empty set if the default protocols are to
-   *         be used.
-   */
-  public final List<String> getEnabledProtocols()
-  {
-    return enabledProtocols;
-  }
+    /**
+     * Returns the Grizzly TCP transport which will be used when initiating
+     * connections with the Directory Server.
+     * <p>
+     * By default this method will return {@code null} indicating that the
+     * default transport factory should be used to obtain a TCP transport.
+     *
+     * @return The Grizzly TCP transport which will be used when initiating
+     *         connections with the Directory Server, or {@code null} if the
+     *         default transport factory should be used to obtain a TCP
+     *         transport.
+     */
+    public final TCPNIOTransport getTCPNIOTransport() {
+        return transport;
+    }
 
+    /**
+     * Returns the operation timeout in the specified unit.
+     *
+     * @param unit
+     *            The time unit of use.
+     * @return The operation timeout.
+     */
+    public final long getTimeout(final TimeUnit unit) {
+        return unit.convert(timeoutInMillis, TimeUnit.MILLISECONDS);
+    }
 
+    /**
+     * Sets the decoding options which will be used to control how requests and
+     * responses are decoded.
+     *
+     * @param decodeOptions
+     *            The decoding options which will be used to control how
+     *            requests and responses are decoded (never {@code null}).
+     * @return A reference to this LDAP connection options.
+     * @throws NullPointerException
+     *             If {@code decodeOptions} was {@code null}.
+     */
+    public final LDAPOptions setDecodeOptions(final DecodeOptions decodeOptions) {
+        Validator.ensureNotNull(decodeOptions);
+        this.decodeOptions = decodeOptions;
+        return this;
+    }
 
-  /**
-   * Returns the names of the protocol versions which are currently enabled for
-   * secure connections with the Directory Server.
-   *
-   * @return An array of protocols or empty set if the default protocols are to
-   *         be used.
-   */
-  public final List<String> getEnabledCipherSuites()
-  {
-    return enabledCipherSuites;
-  }
+    /**
+     * Sets the SSL context which will be used when initiating connections with
+     * the Directory Server.
+     * <p>
+     * By default no SSL context will be used, indicating that connections will
+     * not be secured. If a non-{@code null} SSL context is returned then
+     * connections will be secured using either SSL or StartTLS depending on
+     * {@link #useStartTLS()}.
+     *
+     * @param sslContext
+     *            The SSL context which will be used when initiating secure
+     *            connections with the Directory Server, which may be
+     *            {@code null} indicating that connections will not be secured.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions setSSLContext(final SSLContext sslContext) {
+        this.sslContext = sslContext;
+        return this;
+    }
+
+    /**
+     * Sets the Grizzly TCP transport which will be used when initiating
+     * connections with the Directory Server.
+     * <p>
+     * By default this method will return {@code null} indicating that the
+     * default transport factory will be used to obtain a TCP transport.
+     *
+     * @param transport
+     *            The Grizzly TCP transport which will be used when initiating
+     *            connections with the Directory Server, or {@code null} if the
+     *            default transport factory should be used to obtain a TCP
+     *            transport.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions setTCPNIOTransport(final TCPNIOTransport transport) {
+        this.transport = transport;
+        return this;
+    }
+
+    /**
+     * Sets the operation timeout. If the response is not received from the
+     * Directory Server in the timeout period, the operation will be abandoned
+     * and an error result returned. A timeout setting of 0 disables timeout
+     * limits.
+     *
+     * @param timeout
+     *            The operation timeout to use.
+     * @param unit
+     *            the time unit of the time argument.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions setTimeout(final long timeout, final TimeUnit unit) {
+        this.timeoutInMillis = unit.toMillis(timeout);
+        return this;
+    }
+
+    /**
+     * Specifies whether or not SSL or StartTLS should be used for securing
+     * connections when an SSL context is specified.
+     * <p>
+     * By default SSL will be used in preference to StartTLS.
+     *
+     * @param useStartTLS
+     *            {@code true} if StartTLS should be used for securing
+     *            connections when an SSL context is specified, otherwise
+     *            {@code false} indicating that SSL should be used.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions setUseStartTLS(final boolean useStartTLS) {
+        this.useStartTLS = useStartTLS;
+        return this;
+    }
+
+    /**
+     * Indicates whether or not SSL or StartTLS should be used for securing
+     * connections when an SSL context is specified.
+     * <p>
+     * By default SSL will be used in preference to StartTLS.
+     *
+     * @return {@code true} if StartTLS should be used for securing connections
+     *         when an SSL context is specified, otherwise {@code false}
+     *         indicating that SSL should be used.
+     */
+    public final boolean useStartTLS() {
+        return useStartTLS;
+    }
+
+    /**
+     * Adds the protocol versions enabled for secure connections with the
+     * Directory Server.
+     * <p>
+     * The protocols must be supported by the SSLContext specified in
+     * {@link #setSSLContext(SSLContext)}. Following a successful call to this
+     * method, only the protocols listed in the protocols parameter are enabled
+     * for use.
+     *
+     * @param protocols
+     *            Names of all the protocols to enable.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions addEnabledProtocol(String... protocols) {
+        for (final String protocol : protocols) {
+            enabledProtocols.add(Validator.ensureNotNull(protocol));
+        }
+        return this;
+    }
+
+    /**
+     * Adds the cipher suites enabled for secure connections with the Directory
+     * Server.
+     * <p>
+     * The suites must be supported by the SSLContext specified in
+     * {@link #setSSLContext(SSLContext)}. Following a successful call to this
+     * method, only the suites listed in the protocols parameter are enabled for
+     * use.
+     *
+     * @param suites
+     *            Names of all the suites to enable.
+     * @return A reference to this LDAP connection options.
+     */
+    public final LDAPOptions addEnabledCipherSuite(String... suites) {
+        for (final String suite : suites) {
+            enabledCipherSuites.add(Validator.ensureNotNull(suite));
+        }
+        return this;
+    }
+
+    /**
+     * Returns the names of the protocol versions which are currently enabled
+     * for secure connections with the Directory Server.
+     *
+     * @return An array of protocols or empty set if the default protocols are
+     *         to be used.
+     */
+    public final List<String> getEnabledProtocols() {
+        return enabledProtocols;
+    }
+
+    /**
+     * Returns the names of the protocol versions which are currently enabled
+     * for secure connections with the Directory Server.
+     *
+     * @return An array of protocols or empty set if the default protocols are
+     *         to be used.
+     */
+    public final List<String> getEnabledCipherSuites() {
+        return enabledCipherSuites;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java
index 1db59d2..ddfec12 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,15 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -43,8 +46,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDAP URL as defined in RFC 4516. In addition, the secure ldap (ldaps://)
  * is also supported. LDAP URLs have the following format:
@@ -79,8 +80,8 @@
  * </UL>
  * If not specified, <CODE><I>scope</I></CODE> is <CODE>base</CODE> by default.
  * <LI><CODE><I>filterString</I></CODE> is a human-readable representation of
- * the search criteria. If no filter is provided, then a default of "{@code
- * (objectClass=*)}" should be assumed.
+ * the search criteria. If no filter is provided, then a default of "
+ * {@code (objectClass=*)}" should be assumed.
  * </UL>
  * The same encoding rules for other URLs (e.g. HTTP) apply for LDAP URLs.
  * Specifically, any "illegal" characters are escaped with
@@ -93,883 +94,712 @@
  * @see <a href="http://www.ietf.org/rfc/rfc4516">RFC 4516 - Lightweight
  *      Directory Access Protocol (LDAP): Uniform Resource Locator</a>
  */
-public final class LDAPUrl
-{
-  /**
-   * The scheme corresponding to an LDAP URL. RFC 4516 mandates only ldap scheme
-   * but we support "ldaps" too.
-   */
-  private final boolean isSecured;
+public final class LDAPUrl {
+    /**
+     * The scheme corresponding to an LDAP URL. RFC 4516 mandates only ldap
+     * scheme but we support "ldaps" too.
+     */
+    private final boolean isSecured;
 
-  /**
-   * The host name corresponding to an LDAP URL.
-   */
-  private final String host;
+    /**
+     * The host name corresponding to an LDAP URL.
+     */
+    private final String host;
 
-  /**
-   * The port number corresponding to an LDAP URL.
-   */
-  private final int port;
+    /**
+     * The port number corresponding to an LDAP URL.
+     */
+    private final int port;
 
-  /**
-   * The distinguished name corresponding to an LDAP URL.
-   */
-  private final DN name;
+    /**
+     * The distinguished name corresponding to an LDAP URL.
+     */
+    private final DN name;
 
-  /**
-   * The search scope corresponding to an LDAP URL.
-   */
-  private final SearchScope scope;
+    /**
+     * The search scope corresponding to an LDAP URL.
+     */
+    private final SearchScope scope;
 
-  /**
-   * The search filter corresponding to an LDAP URL.
-   */
-  private final Filter filter;
+    /**
+     * The search filter corresponding to an LDAP URL.
+     */
+    private final Filter filter;
 
-  /**
-   * The attributes that need to be searched.
-   */
-  private final List<String> attributes;
+    /**
+     * The attributes that need to be searched.
+     */
+    private final List<String> attributes;
 
-  /**
-   * The String value of LDAP URL.
-   */
-  private final String urlString;
+    /**
+     * The String value of LDAP URL.
+     */
+    private final String urlString;
 
-  /**
-   * Normalized ldap URL.
-   */
-  private String normalizedURL;
+    /**
+     * Normalized ldap URL.
+     */
+    private String normalizedURL;
 
-  /**
-   * The default scheme to be used with LDAP URL.
-   */
-  private static final String DEFAULT_URL_SCHEME = "ldap";
+    /**
+     * The default scheme to be used with LDAP URL.
+     */
+    private static final String DEFAULT_URL_SCHEME = "ldap";
 
-  /**
-   * The SSL-based scheme allowed to be used with LDAP URL.
-   */
-  private static final String SSL_URL_SCHEME = "ldaps";
+    /**
+     * The SSL-based scheme allowed to be used with LDAP URL.
+     */
+    private static final String SSL_URL_SCHEME = "ldaps";
 
-  /**
-   * The default host.
-   */
-  private static final String DEFAULT_HOST = "localhost";
+    /**
+     * The default host.
+     */
+    private static final String DEFAULT_HOST = "localhost";
 
-  /**
-   * The default non-SSL port.
-   */
-  private static final int DEFAULT_PORT = 389;
+    /**
+     * The default non-SSL port.
+     */
+    private static final int DEFAULT_PORT = 389;
 
-  /**
-   * The default SSL port.
-   */
-  private static final int DEFAULT_SSL_PORT = 636;
+    /**
+     * The default SSL port.
+     */
+    private static final int DEFAULT_SSL_PORT = 636;
 
-  /**
-   * The default filter.
-   */
-  private static final Filter DEFAULT_FILTER = Filter
-      .getObjectClassPresentFilter();
+    /**
+     * The default filter.
+     */
+    private static final Filter DEFAULT_FILTER = Filter.getObjectClassPresentFilter();
 
-  /**
-   * The default search scope.
-   */
-  private static final SearchScope DEFAULT_SCOPE = SearchScope.BASE_OBJECT;
+    /**
+     * The default search scope.
+     */
+    private static final SearchScope DEFAULT_SCOPE = SearchScope.BASE_OBJECT;
 
-  /**
-   * The default distinguished name.
-   */
-  private static final DN DEFAULT_DN = DN.rootDN();
+    /**
+     * The default distinguished name.
+     */
+    private static final DN DEFAULT_DN = DN.rootDN();
 
-  /**
-   * The % encoding character.
-   */
-  private static final char PERCENT_ENCODING_CHAR = '%';
+    /**
+     * The % encoding character.
+     */
+    private static final char PERCENT_ENCODING_CHAR = '%';
 
-  /**
-   * The ? character.
-   */
-  private static final char QUESTION_CHAR = '?';
+    /**
+     * The ? character.
+     */
+    private static final char QUESTION_CHAR = '?';
 
-  /**
-   * The slash (/) character.
-   */
-  private static final char SLASH_CHAR = '/';
+    /**
+     * The slash (/) character.
+     */
+    private static final char SLASH_CHAR = '/';
 
-  /**
-   * The comma (,) character.
-   */
-  private static final char COMMA_CHAR = ',';
+    /**
+     * The comma (,) character.
+     */
+    private static final char COMMA_CHAR = ',';
 
-  /**
-   * The colon (:) character.
-   */
-  private static final char COLON_CHAR = ':';
+    /**
+     * The colon (:) character.
+     */
+    private static final char COLON_CHAR = ':';
 
-  /**
-   * Set containing characters that do not need to be encoded.
-   */
-  private static final Set<Character> VALID_CHARS = new HashSet<Character>();
+    /**
+     * Set containing characters that do not need to be encoded.
+     */
+    private static final Set<Character> VALID_CHARS = new HashSet<Character>();
 
-  static
-  {
-    // Refer to RFC 3986 for more details.
-    final char[] delims = { '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';',
-        '=', '.', '-', '_', '~' };
-    for (final char c : delims)
-    {
-      VALID_CHARS.add(c);
-    }
-
-    for (char c = 'a'; c <= 'z'; c++)
-    {
-      VALID_CHARS.add(c);
-    }
-
-    for (char c = 'A'; c <= 'Z'; c++)
-    {
-      VALID_CHARS.add(c);
-    }
-
-    for (char c = '0'; c <= '9'; c++)
-    {
-      VALID_CHARS.add(c);
-    }
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of an LDAP URL using the
-   * default schema.
-   *
-   * @param url
-   *          The LDAP string representation of an LDAP URL.
-   * @return The parsed LDAP URL.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code url} is not a valid LDAP string representation of an
-   *           LDAP URL.
-   * @throws NullPointerException
-   *           If {@code url} was {@code null}.
-   */
-  public static LDAPUrl valueOf(final String url)
-  {
-    return valueOf(url, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of an LDAP URL using the
-   * provided schema.
-   *
-   * @param url
-   *          The LDAP string representation of an LDAP URL.
-   * @param schema
-   *          The schema to use when parsing the LDAP URL.
-   * @return The parsed LDAP URL.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code url} is not a valid LDAP string representation of an
-   *           LDAP URL.
-   * @throws NullPointerException
-   *           If {@code url} or {@code schema} was {@code null}.
-   */
-  public static LDAPUrl valueOf(final String url, final Schema schema)
-  {
-    Validator.ensureNotNull(url, schema);
-    return new LDAPUrl(url, schema);
-  }
-
-
-
-  private static int decodeHex(final String url, final int index,
-      final char hexChar)
-  {
-    if (hexChar >= '0' && hexChar <= '9')
-    {
-      return hexChar - '0';
-    }
-    else if (hexChar >= 'A' && hexChar <= 'F')
-    {
-      return hexChar - 'A' + 10;
-    }
-    else if (hexChar >= 'a' && hexChar <= 'f')
-    {
-      return hexChar - 'a' + 10;
-    }
-
-    final LocalizableMessage msg = ERR_LDAPURL_INVALID_HEX_BYTE.get(url, index);
-    throw new LocalizedIllegalArgumentException(msg);
-  }
-
-
-
-  private static void percentDecoder(final String urlString, final int index,
-      final String s, final StringBuilder decoded)
-  {
-    Validator.ensureNotNull(s, decoded);
-    decoded.append(s);
-
-    int srcPos = 0, dstPos = 0;
-
-    while (srcPos < decoded.length())
-    {
-      if (decoded.charAt(srcPos) != '%')
-      {
-        if (srcPos != dstPos)
-        {
-          decoded.setCharAt(dstPos, decoded.charAt(srcPos));
+    static {
+        // Refer to RFC 3986 for more details.
+        final char[] delims = {
+            '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=', '.', '-', '_', '~'
+        };
+        for (final char c : delims) {
+            VALID_CHARS.add(c);
         }
-        srcPos++;
-        dstPos++;
-        continue;
-      }
-      decoded.setCharAt(dstPos, (char) ((decodeHex(urlString, index + srcPos
-          + 1, decoded.charAt(srcPos + 1)) << 4) | (decodeHex(urlString, index
-          + srcPos + 2, decoded.charAt(srcPos + 2)))));
-      dstPos++;
-      srcPos += 3;
-    }
-    decoded.setLength(dstPos);
-  }
 
+        for (char c = 'a'; c <= 'z'; c++) {
+            VALID_CHARS.add(c);
+        }
 
+        for (char c = 'A'; c <= 'Z'; c++) {
+            VALID_CHARS.add(c);
+        }
 
-  /**
-   * This method performs the percent-encoding as defined in section 2.1 of RFC
-   * 3986.
-   *
-   * @param urlElement
-   *          The element of the URL that needs to be percent encoded.
-   * @param encodedBuffer
-   *          The buffer that contains the final percent encoded value.
-   */
-  private static void percentEncoder(final String urlElement,
-      final StringBuilder encodedBuffer)
-  {
-    Validator.ensureNotNull(urlElement);
-    for (int count = 0; count < urlElement.length(); count++)
-    {
-      final char c = urlElement.charAt(count);
-      if (VALID_CHARS.contains(c))
-      {
-        encodedBuffer.append(c);
-      }
-      else
-      {
-        encodedBuffer.append(PERCENT_ENCODING_CHAR);
-        encodedBuffer.append(Integer.toHexString(c));
-      }
-    }
-  }
-
-
-
-  /**
-   * Creates a new LDAP URL referring to a single entry on the specified server.
-   * The LDAP URL with have base object scope and the filter {@code
-   * (objectClass=*)}.
-   *
-   * @param isSecured
-   *          {@code true} if this LDAP URL should use LDAPS or {@code false} if
-   *          it should use LDAP.
-   * @param host
-   *          The name or IP address in dotted format of the LDAP server. For
-   *          example, {@code ldap.server1.com} or {@code 192.202.185.90}. Use
-   *          {@code null} for the local host.
-   * @param port
-   *          The port number of the LDAP server, or {@code null} to use the
-   *          default port (389 for LDAP and 636 for LDAPS).
-   * @param name
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed, or {@code null} to specify the root
-   *          DSE.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code port} was less than 1 or greater than 65535.
-   */
-  public LDAPUrl(final boolean isSecured, final String host,
-      final Integer port, final DN name)
-  {
-    this(isSecured, host, port, name, DEFAULT_SCOPE, DEFAULT_FILTER);
-  }
-
-
-
-  /**
-   * Creates a new LDAP URL including the full set of parameters for a search
-   * request.
-   *
-   * @param isSecured
-   *          {@code true} if this LDAP URL should use LDAPS or {@code false} if
-   *          it should use LDAP.
-   * @param host
-   *          The name or IP address in dotted format of the LDAP server. For
-   *          example, {@code ldap.server1.com} or {@code 192.202.185.90}. Use
-   *          {@code null} for the local host.
-   * @param port
-   *          The port number of the LDAP server, or {@code null} to use the
-   *          default port (389 for LDAP and 636 for LDAPS).
-   * @param name
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed, or {@code null} to specify the root
-   *          DSE.
-   * @param scope
-   *          The search scope, or {@code null} to specify base scope.
-   * @param filter
-   *          The search filter, or {@code null} to specify the filter {@code
-   *          (objectClass=*)}.
-   * @param attributes
-   *          The list of attributes to be included in the search results.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code port} was less than 1 or greater than 65535.
-   */
-  public LDAPUrl(final boolean isSecured, final String host,
-      final Integer port, final DN name, final SearchScope scope,
-      final Filter filter, final String... attributes)
-  {
-    // The buffer storing the encoded url.
-    final StringBuilder urlBuffer = new StringBuilder();
-
-    // build the scheme.
-    this.isSecured = isSecured;
-    if (this.isSecured)
-    {
-      urlBuffer.append(SSL_URL_SCHEME);
-    }
-    else
-    {
-      urlBuffer.append(DEFAULT_URL_SCHEME);
-    }
-    urlBuffer.append("://");
-
-    if (host == null)
-    {
-      this.host = DEFAULT_HOST;
-    }
-    else
-    {
-      this.host = host;
-      urlBuffer.append(this.host);
+        for (char c = '0'; c <= '9'; c++) {
+            VALID_CHARS.add(c);
+        }
     }
 
-    int listenPort = DEFAULT_PORT;
-    if (port == null)
-    {
-      listenPort = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
+    /**
+     * Parses the provided LDAP string representation of an LDAP URL using the
+     * default schema.
+     *
+     * @param url
+     *            The LDAP string representation of an LDAP URL.
+     * @return The parsed LDAP URL.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code url} is not a valid LDAP string representation of
+     *             an LDAP URL.
+     * @throws NullPointerException
+     *             If {@code url} was {@code null}.
+     */
+    public static LDAPUrl valueOf(final String url) {
+        return valueOf(url, Schema.getDefaultSchema());
     }
-    else
-    {
-      listenPort = port.intValue();
-      if (listenPort < 1 || listenPort > 65535)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_BAD_PORT.get(listenPort);
+
+    /**
+     * Parses the provided LDAP string representation of an LDAP URL using the
+     * provided schema.
+     *
+     * @param url
+     *            The LDAP string representation of an LDAP URL.
+     * @param schema
+     *            The schema to use when parsing the LDAP URL.
+     * @return The parsed LDAP URL.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code url} is not a valid LDAP string representation of
+     *             an LDAP URL.
+     * @throws NullPointerException
+     *             If {@code url} or {@code schema} was {@code null}.
+     */
+    public static LDAPUrl valueOf(final String url, final Schema schema) {
+        Validator.ensureNotNull(url, schema);
+        return new LDAPUrl(url, schema);
+    }
+
+    private static int decodeHex(final String url, final int index, final char hexChar) {
+        if (hexChar >= '0' && hexChar <= '9') {
+            return hexChar - '0';
+        } else if (hexChar >= 'A' && hexChar <= 'F') {
+            return hexChar - 'A' + 10;
+        } else if (hexChar >= 'a' && hexChar <= 'f') {
+            return hexChar - 'a' + 10;
+        }
+
+        final LocalizableMessage msg = ERR_LDAPURL_INVALID_HEX_BYTE.get(url, index);
         throw new LocalizedIllegalArgumentException(msg);
-      }
-      urlBuffer.append(COLON_CHAR);
-      urlBuffer.append(listenPort);
     }
 
-    this.port = listenPort;
+    private static void percentDecoder(final String urlString, final int index, final String s,
+            final StringBuilder decoded) {
+        Validator.ensureNotNull(s, decoded);
+        decoded.append(s);
 
-    // We need a slash irrespective of dn is defined or not.
-    urlBuffer.append(SLASH_CHAR);
-    if (name != null)
-    {
-      this.name = name;
-      percentEncoder(name.toString(), urlBuffer);
-    }
-    else
-    {
-      this.name = DEFAULT_DN;
+        int srcPos = 0, dstPos = 0;
+
+        while (srcPos < decoded.length()) {
+            if (decoded.charAt(srcPos) != '%') {
+                if (srcPos != dstPos) {
+                    decoded.setCharAt(dstPos, decoded.charAt(srcPos));
+                }
+                srcPos++;
+                dstPos++;
+                continue;
+            }
+            decoded.setCharAt(dstPos, (char) ((decodeHex(urlString, index + srcPos + 1, decoded
+                    .charAt(srcPos + 1)) << 4) | (decodeHex(urlString, index + srcPos + 2, decoded
+                    .charAt(srcPos + 2)))));
+            dstPos++;
+            srcPos += 3;
+        }
+        decoded.setLength(dstPos);
     }
 
-    // Add attributes.
-    urlBuffer.append(QUESTION_CHAR);
-    switch (attributes.length)
-    {
-    case 0:
-      this.attributes = Collections.emptyList();
-      break;
-    case 1:
-      this.attributes = Collections.singletonList(attributes[0]);
-      urlBuffer.append(attributes[0]);
-      break;
-    default:
-      this.attributes = Collections.unmodifiableList(Arrays.asList(attributes));
-      urlBuffer.append(attributes[0]);
-      for (int i = 1; i < attributes.length; i++)
-      {
-        urlBuffer.append(COMMA_CHAR);
-        urlBuffer.append(attributes[i]);
-      }
-      break;
+    /**
+     * This method performs the percent-encoding as defined in section 2.1 of
+     * RFC 3986.
+     *
+     * @param urlElement
+     *            The element of the URL that needs to be percent encoded.
+     * @param encodedBuffer
+     *            The buffer that contains the final percent encoded value.
+     */
+    private static void percentEncoder(final String urlElement, final StringBuilder encodedBuffer) {
+        Validator.ensureNotNull(urlElement);
+        for (int count = 0; count < urlElement.length(); count++) {
+            final char c = urlElement.charAt(count);
+            if (VALID_CHARS.contains(c)) {
+                encodedBuffer.append(c);
+            } else {
+                encodedBuffer.append(PERCENT_ENCODING_CHAR);
+                encodedBuffer.append(Integer.toHexString(c));
+            }
+        }
     }
 
-    // Add the scope.
-    urlBuffer.append(QUESTION_CHAR);
-    if (scope != null)
-    {
-      this.scope = scope;
-      urlBuffer.append(scope);
-    }
-    else
-    {
-      this.scope = DEFAULT_SCOPE;
+    /**
+     * Creates a new LDAP URL referring to a single entry on the specified
+     * server. The LDAP URL with have base object scope and the filter
+     * {@code (objectClass=*)}.
+     *
+     * @param isSecured
+     *            {@code true} if this LDAP URL should use LDAPS or
+     *            {@code false} if it should use LDAP.
+     * @param host
+     *            The name or IP address in dotted format of the LDAP server.
+     *            For example, {@code ldap.server1.com} or
+     *            {@code 192.202.185.90}. Use {@code null} for the local host.
+     * @param port
+     *            The port number of the LDAP server, or {@code null} to use the
+     *            default port (389 for LDAP and 636 for LDAPS).
+     * @param name
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed, or {@code null} to specify the root
+     *            DSE.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code port} was less than 1 or greater than 65535.
+     */
+    public LDAPUrl(final boolean isSecured, final String host, final Integer port, final DN name) {
+        this(isSecured, host, port, name, DEFAULT_SCOPE, DEFAULT_FILTER);
     }
 
-    // Add the search filter.
-    urlBuffer.append(QUESTION_CHAR);
-    if (filter != null)
-    {
-      this.filter = filter;
-      urlBuffer.append(this.filter);
-    }
-    else
-    {
-      this.filter = DEFAULT_FILTER;
+    /**
+     * Creates a new LDAP URL including the full set of parameters for a search
+     * request.
+     *
+     * @param isSecured
+     *            {@code true} if this LDAP URL should use LDAPS or
+     *            {@code false} if it should use LDAP.
+     * @param host
+     *            The name or IP address in dotted format of the LDAP server.
+     *            For example, {@code ldap.server1.com} or
+     *            {@code 192.202.185.90}. Use {@code null} for the local host.
+     * @param port
+     *            The port number of the LDAP server, or {@code null} to use the
+     *            default port (389 for LDAP and 636 for LDAPS).
+     * @param name
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed, or {@code null} to specify the root
+     *            DSE.
+     * @param scope
+     *            The search scope, or {@code null} to specify base scope.
+     * @param filter
+     *            The search filter, or {@code null} to specify the filter
+     *            {@code (objectClass=*)}.
+     * @param attributes
+     *            The list of attributes to be included in the search results.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code port} was less than 1 or greater than 65535.
+     */
+    public LDAPUrl(final boolean isSecured, final String host, final Integer port, final DN name,
+            final SearchScope scope, final Filter filter, final String... attributes) {
+        // The buffer storing the encoded url.
+        final StringBuilder urlBuffer = new StringBuilder();
+
+        // build the scheme.
+        this.isSecured = isSecured;
+        if (this.isSecured) {
+            urlBuffer.append(SSL_URL_SCHEME);
+        } else {
+            urlBuffer.append(DEFAULT_URL_SCHEME);
+        }
+        urlBuffer.append("://");
+
+        if (host == null) {
+            this.host = DEFAULT_HOST;
+        } else {
+            this.host = host;
+            urlBuffer.append(this.host);
+        }
+
+        int listenPort = DEFAULT_PORT;
+        if (port == null) {
+            listenPort = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
+        } else {
+            listenPort = port.intValue();
+            if (listenPort < 1 || listenPort > 65535) {
+                final LocalizableMessage msg = ERR_LDAPURL_BAD_PORT.get(listenPort);
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+            urlBuffer.append(COLON_CHAR);
+            urlBuffer.append(listenPort);
+        }
+
+        this.port = listenPort;
+
+        // We need a slash irrespective of dn is defined or not.
+        urlBuffer.append(SLASH_CHAR);
+        if (name != null) {
+            this.name = name;
+            percentEncoder(name.toString(), urlBuffer);
+        } else {
+            this.name = DEFAULT_DN;
+        }
+
+        // Add attributes.
+        urlBuffer.append(QUESTION_CHAR);
+        switch (attributes.length) {
+        case 0:
+            this.attributes = Collections.emptyList();
+            break;
+        case 1:
+            this.attributes = Collections.singletonList(attributes[0]);
+            urlBuffer.append(attributes[0]);
+            break;
+        default:
+            this.attributes = Collections.unmodifiableList(Arrays.asList(attributes));
+            urlBuffer.append(attributes[0]);
+            for (int i = 1; i < attributes.length; i++) {
+                urlBuffer.append(COMMA_CHAR);
+                urlBuffer.append(attributes[i]);
+            }
+            break;
+        }
+
+        // Add the scope.
+        urlBuffer.append(QUESTION_CHAR);
+        if (scope != null) {
+            this.scope = scope;
+            urlBuffer.append(scope);
+        } else {
+            this.scope = DEFAULT_SCOPE;
+        }
+
+        // Add the search filter.
+        urlBuffer.append(QUESTION_CHAR);
+        if (filter != null) {
+            this.filter = filter;
+            urlBuffer.append(this.filter);
+        } else {
+            this.filter = DEFAULT_FILTER;
+        }
+
+        urlString = urlBuffer.toString();
     }
 
-    urlString = urlBuffer.toString();
-  }
+    private LDAPUrl(final String urlString, final Schema schema) {
+        this.urlString = urlString;
 
+        // Parse the url and build the LDAP URL.
+        final int schemeIdx = urlString.indexOf("://");
+        if (schemeIdx < 0) {
+            final LocalizableMessage msg = ERR_LDAPURL_NO_SCHEME.get(urlString);
+            throw new LocalizedIllegalArgumentException(msg);
+        }
+        final String scheme = StaticUtils.toLowerCase(urlString.substring(0, schemeIdx));
 
+        if (scheme.equalsIgnoreCase(DEFAULT_URL_SCHEME)) {
+            // Default ldap scheme.
+            isSecured = false;
+        } else if (scheme.equalsIgnoreCase(SSL_URL_SCHEME)) {
+            isSecured = true;
+        } else {
+            final LocalizableMessage msg = ERR_LDAPURL_BAD_SCHEME.get(urlString, scheme);
+            throw new LocalizedIllegalArgumentException(msg);
+        }
 
-  private LDAPUrl(final String urlString, final Schema schema)
-  {
-    this.urlString = urlString;
+        final int urlLength = urlString.length();
+        final int hostPortIdx = urlString.indexOf(SLASH_CHAR, schemeIdx + 3);
+        final StringBuilder builder = new StringBuilder();
+        if (hostPortIdx < 0) {
+            // We got anything here like the host and port?
+            if (urlLength > (schemeIdx + 3)) {
+                final String hostAndPort = urlString.substring(schemeIdx + 3, urlLength);
+                port = parseHostPort(urlString, hostAndPort, builder);
+                host = builder.toString();
+                builder.setLength(0);
+            } else {
+                // Nothing else is specified apart from the scheme.
+                // Use the default settings and return from here.
+                host = DEFAULT_HOST;
+                port = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
+            }
+            name = DEFAULT_DN;
+            scope = DEFAULT_SCOPE;
+            filter = DEFAULT_FILTER;
+            attributes = Collections.emptyList();
+            return;
+        }
 
-    // Parse the url and build the LDAP URL.
-    final int schemeIdx = urlString.indexOf("://");
-    if (schemeIdx < 0)
-    {
-      final LocalizableMessage msg = ERR_LDAPURL_NO_SCHEME.get(urlString);
-      throw new LocalizedIllegalArgumentException(msg);
-    }
-    final String scheme = StaticUtils.toLowerCase(urlString.substring(0,
-        schemeIdx));
-
-    if (scheme.equalsIgnoreCase(DEFAULT_URL_SCHEME))
-    {
-      // Default ldap scheme.
-      isSecured = false;
-    }
-    else if (scheme.equalsIgnoreCase(SSL_URL_SCHEME))
-    {
-      isSecured = true;
-    }
-    else
-    {
-      final LocalizableMessage msg = ERR_LDAPURL_BAD_SCHEME.get(urlString,
-          scheme);
-      throw new LocalizedIllegalArgumentException(msg);
-    }
-
-    final int urlLength = urlString.length();
-    final int hostPortIdx = urlString.indexOf(SLASH_CHAR, schemeIdx + 3);
-    final StringBuilder builder = new StringBuilder();
-    if (hostPortIdx < 0)
-    {
-      // We got anything here like the host and port?
-      if (urlLength > (schemeIdx + 3))
-      {
-        final String hostAndPort = urlString
-            .substring(schemeIdx + 3, urlLength);
+        final String hostAndPort = urlString.substring(schemeIdx + 3, hostPortIdx);
+        // assign the host and port.
         port = parseHostPort(urlString, hostAndPort, builder);
         host = builder.toString();
         builder.setLength(0);
-      }
-      else
-      {
-        // Nothing else is specified apart from the scheme.
-        // Use the default settings and return from here.
-        host = DEFAULT_HOST;
-        port = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
-      }
-      name = DEFAULT_DN;
-      scope = DEFAULT_SCOPE;
-      filter = DEFAULT_FILTER;
-      attributes = Collections.emptyList();
-      return;
-    }
 
-    final String hostAndPort = urlString.substring(schemeIdx + 3, hostPortIdx);
-    // assign the host and port.
-    port = parseHostPort(urlString, hostAndPort, builder);
-    host = builder.toString();
-    builder.setLength(0);
+        // Parse the dn.
+        DN parsedDN = null;
+        final int dnIdx = urlString.indexOf(QUESTION_CHAR, hostPortIdx + 1);
 
-    // Parse the dn.
-    DN parsedDN = null;
-    final int dnIdx = urlString.indexOf(QUESTION_CHAR, hostPortIdx + 1);
-
-    if (dnIdx < 0)
-    {
-      // Whatever we have here is the dn.
-      final String dnStr = urlString.substring(hostPortIdx + 1, urlLength);
-      percentDecoder(urlString, hostPortIdx + 1, dnStr, builder);
-      try
-      {
-        parsedDN = DN.valueOf(builder.toString(), schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_INVALID_DN.get(urlString, e
-            .getMessageObject());
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-      builder.setLength(0);
-      name = parsedDN;
-      scope = DEFAULT_SCOPE;
-      filter = DEFAULT_FILTER;
-      attributes = Collections.emptyList();
-      return;
-    }
-
-    final String dnStr = urlString.substring(hostPortIdx + 1, dnIdx);
-    if (dnStr.length() == 0)
-    {
-      parsedDN = DEFAULT_DN;
-    }
-    else
-    {
-      percentDecoder(urlString, hostPortIdx + 1, dnStr, builder);
-      try
-      {
-        parsedDN = DN.valueOf(builder.toString(), schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_INVALID_DN.get(urlString, e
-            .getMessageObject());
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-      builder.setLength(0);
-    }
-    name = parsedDN;
-
-    // Find out the attributes.
-    final int attrIdx = urlString.indexOf(QUESTION_CHAR, dnIdx + 1);
-    if (attrIdx < 0)
-    {
-      attributes = Collections.emptyList();
-      scope = DEFAULT_SCOPE;
-      filter = DEFAULT_FILTER;
-      return;
-    }
-    else
-    {
-      final String attrDesc = urlString.substring(dnIdx + 1, attrIdx);
-      final StringTokenizer token = new StringTokenizer(attrDesc, String
-          .valueOf(COMMA_CHAR));
-      final List<String> parsedAttrs = new ArrayList<String>(token
-          .countTokens());
-      while (token.hasMoreElements())
-      {
-        parsedAttrs.add(token.nextToken());
-      }
-      attributes = Collections.unmodifiableList(parsedAttrs);
-    }
-
-    // Find the scope.
-    final int scopeIdx = urlString.indexOf(QUESTION_CHAR, attrIdx + 1);
-    SearchScope parsedScope = SearchScope.BASE_OBJECT;
-    if (scopeIdx < 0)
-    {
-      scope = DEFAULT_SCOPE;
-      filter = DEFAULT_FILTER;
-      return;
-    }
-    else
-    {
-      String scopeDef = urlString.substring(attrIdx + 1, scopeIdx);
-      scopeDef = StaticUtils.toLowerCase(scopeDef);
-      for (final SearchScope sscope : SearchScope.values())
-      {
-        if (sscope.toString().equals(scopeDef))
-        {
-          parsedScope = sscope;
-          break;
+        if (dnIdx < 0) {
+            // Whatever we have here is the dn.
+            final String dnStr = urlString.substring(hostPortIdx + 1, urlLength);
+            percentDecoder(urlString, hostPortIdx + 1, dnStr, builder);
+            try {
+                parsedDN = DN.valueOf(builder.toString(), schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                final LocalizableMessage msg =
+                        ERR_LDAPURL_INVALID_DN.get(urlString, e.getMessageObject());
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+            builder.setLength(0);
+            name = parsedDN;
+            scope = DEFAULT_SCOPE;
+            filter = DEFAULT_FILTER;
+            attributes = Collections.emptyList();
+            return;
         }
-      }
-    }
-    scope = parsedScope;
 
-    // Last one is filter.
-    final String parsedFilter = urlString.substring(scopeIdx + 1, urlLength);
-    if (parsedFilter.length() > 0)
-    {
-      // Clear what we already have.
-      builder.setLength(0);
-      percentDecoder(urlString, scopeIdx + 1, parsedFilter, builder);
-      try
-      {
-        this.filter = Filter.valueOf(builder.toString());
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_INVALID_FILTER.get(
-            urlString, e.getMessageObject());
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-    }
-    else
-    {
-      this.filter = DEFAULT_FILTER;
-    }
-  }
-
-
-
-  /**
-   * Creates a new search request containing the parameters of this LDAP URL.
-   *
-   * @return A new search request containing the parameters of this LDAP URL.
-   */
-  public SearchRequest asSearchRequest()
-  {
-    final SearchRequest request = Requests
-        .newSearchRequest(name, scope, filter);
-    for (final String a : attributes)
-    {
-      request.addAttribute(a);
-    }
-    return request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override()
-  public boolean equals(final Object o)
-  {
-    if (o == this)
-    {
-      return true;
-    }
-    else if (o instanceof LDAPUrl)
-    {
-      final String s1 = toNormalizedString();
-      final String s2 = ((LDAPUrl) o).toNormalizedString();
-      return s1.equals(s2);
-    }
-    else
-    {
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the attributes to be included with
-   * each entry that matches the search criteria. Attributes that are sub-types
-   * of listed attributes are implicitly included. If the returned list is empty
-   * then all user attributes will be included by default.
-   *
-   * @return An unmodifiable list containing the attributes to be included with
-   *         each entry that matches the search criteria.
-   */
-  public List<String> getAttributes()
-  {
-    return attributes;
-  }
-
-
-
-  /**
-   * Returns the search filter associated with this LDAP URL.
-   *
-   * @return The search filter associated with this LDAP URL.
-   */
-  public Filter getFilter()
-  {
-    return filter;
-  }
-
-
-
-  /**
-   * Returns the name or IP address in dotted format of the LDAP server
-   * referenced by this LDAP URL. For example, {@code ldap.server1.com} or
-   * {@code 192.202.185.90}. Use {@code null} for the local host.
-   *
-   * @return A name or IP address in dotted format of the LDAP server referenced
-   *         by this LDAP URL.
-   */
-  public String getHost()
-  {
-    return host;
-  }
-
-
-
-  /**
-   * Returns the distinguished name of the base entry relative to which the
-   * search is to be performed.
-   *
-   * @return The distinguished name of the base entry relative to which the
-   *         search is to be performed.
-   */
-  public DN getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * Returns the port number of the LDAP server referenced by this LDAP URL.
-   *
-   * @return The port number of the LDAP server referenced by this LDAP URL.
-   */
-  public int getPort()
-  {
-    return port;
-  }
-
-
-
-  /**
-   * Returns the search scope associated with this LDAP URL.
-   *
-   * @return The search scope associated with this LDAP URL.
-   */
-  public SearchScope getScope()
-  {
-    return scope;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    final String s = toNormalizedString();
-    return s.hashCode();
-  }
-
-
-
-  /**
-   * Returns {@code true} if this LDAP URL should use LDAPS or {@code false} if
-   * it should use LDAP.
-   *
-   * @return {@code true} if this LDAP URL should use LDAPS or {@code false} if
-   *         it should use LDAP.
-   */
-  public boolean isSecure()
-  {
-    return isSecured;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return urlString;
-  }
-
-
-
-  private int parseHostPort(final String urlString, final String hostAndPort,
-      final StringBuilder host)
-  {
-    Validator.ensureNotNull(hostAndPort, port, host);
-    int urlPort = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
-    if (hostAndPort.length() == 0)
-    {
-      host.append(DEFAULT_HOST);
-      return urlPort;
-    }
-    final int colonIdx = hostAndPort.indexOf(':');
-    if (colonIdx < 0)
-    {
-      // port is not specified.
-      host.append(hostAndPort);
-      return urlPort;
-    }
-    else
-    {
-      String s = hostAndPort.substring(0, colonIdx);
-      if (s.length() == 0)
-      {
-        // Use the default host as we allow only the port to be specified.
-        host.append(DEFAULT_HOST);
-      }
-      else
-      {
-        host.append(s);
-      }
-      s = hostAndPort.substring(colonIdx + 1, hostAndPort.length());
-      try
-      {
-        urlPort = Integer.parseInt(s);
-      }
-      catch (final NumberFormatException e)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_CANNOT_DECODE_PORT.get(
-            urlString, s);
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-
-      // Check the validity of the port.
-      if (urlPort < 1 || urlPort > 65535)
-      {
-        final LocalizableMessage msg = ERR_LDAPURL_INVALID_PORT.get(urlString,
-            urlPort);
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-    }
-    return urlPort;
-  }
-
-
-
-  private String toNormalizedString()
-  {
-    if (normalizedURL == null)
-    {
-      final StringBuilder builder = new StringBuilder();
-      if (this.isSecured)
-      {
-        builder.append(SSL_URL_SCHEME);
-      }
-      else
-      {
-        builder.append(DEFAULT_URL_SCHEME);
-      }
-      builder.append("://");
-      builder.append(host);
-      builder.append(COLON_CHAR);
-      builder.append(port);
-      builder.append(SLASH_CHAR);
-      percentEncoder(name.toString(), builder);
-      builder.append(QUESTION_CHAR);
-      final int sz = attributes.size();
-      for (int i = 0; i < sz; i++)
-      {
-        if (i > 0)
-        {
-          builder.append(COMMA_CHAR);
+        final String dnStr = urlString.substring(hostPortIdx + 1, dnIdx);
+        if (dnStr.length() == 0) {
+            parsedDN = DEFAULT_DN;
+        } else {
+            percentDecoder(urlString, hostPortIdx + 1, dnStr, builder);
+            try {
+                parsedDN = DN.valueOf(builder.toString(), schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                final LocalizableMessage msg =
+                        ERR_LDAPURL_INVALID_DN.get(urlString, e.getMessageObject());
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+            builder.setLength(0);
         }
-        builder.append(attributes.get(i));
-      }
-      builder.append(QUESTION_CHAR);
-      builder.append(scope);
-      builder.append(QUESTION_CHAR);
-      percentEncoder(filter.toString(), builder);
-      normalizedURL = builder.toString();
+        name = parsedDN;
+
+        // Find out the attributes.
+        final int attrIdx = urlString.indexOf(QUESTION_CHAR, dnIdx + 1);
+        if (attrIdx < 0) {
+            attributes = Collections.emptyList();
+            scope = DEFAULT_SCOPE;
+            filter = DEFAULT_FILTER;
+            return;
+        } else {
+            final String attrDesc = urlString.substring(dnIdx + 1, attrIdx);
+            final StringTokenizer token = new StringTokenizer(attrDesc, String.valueOf(COMMA_CHAR));
+            final List<String> parsedAttrs = new ArrayList<String>(token.countTokens());
+            while (token.hasMoreElements()) {
+                parsedAttrs.add(token.nextToken());
+            }
+            attributes = Collections.unmodifiableList(parsedAttrs);
+        }
+
+        // Find the scope.
+        final int scopeIdx = urlString.indexOf(QUESTION_CHAR, attrIdx + 1);
+        SearchScope parsedScope = SearchScope.BASE_OBJECT;
+        if (scopeIdx < 0) {
+            scope = DEFAULT_SCOPE;
+            filter = DEFAULT_FILTER;
+            return;
+        } else {
+            String scopeDef = urlString.substring(attrIdx + 1, scopeIdx);
+            scopeDef = StaticUtils.toLowerCase(scopeDef);
+            for (final SearchScope sscope : SearchScope.values()) {
+                if (sscope.toString().equals(scopeDef)) {
+                    parsedScope = sscope;
+                    break;
+                }
+            }
+        }
+        scope = parsedScope;
+
+        // Last one is filter.
+        final String parsedFilter = urlString.substring(scopeIdx + 1, urlLength);
+        if (parsedFilter.length() > 0) {
+            // Clear what we already have.
+            builder.setLength(0);
+            percentDecoder(urlString, scopeIdx + 1, parsedFilter, builder);
+            try {
+                this.filter = Filter.valueOf(builder.toString());
+            } catch (final LocalizedIllegalArgumentException e) {
+                final LocalizableMessage msg =
+                        ERR_LDAPURL_INVALID_FILTER.get(urlString, e.getMessageObject());
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+        } else {
+            this.filter = DEFAULT_FILTER;
+        }
     }
-    return normalizedURL;
-  }
+
+    /**
+     * Creates a new search request containing the parameters of this LDAP URL.
+     *
+     * @return A new search request containing the parameters of this LDAP URL.
+     */
+    public SearchRequest asSearchRequest() {
+        final SearchRequest request = Requests.newSearchRequest(name, scope, filter);
+        for (final String a : attributes) {
+            request.addAttribute(a);
+        }
+        return request;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override()
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (o instanceof LDAPUrl) {
+            final String s1 = toNormalizedString();
+            final String s2 = ((LDAPUrl) o).toNormalizedString();
+            return s1.equals(s2);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns an unmodifiable list containing the attributes to be included
+     * with each entry that matches the search criteria. Attributes that are
+     * sub-types of listed attributes are implicitly included. If the returned
+     * list is empty then all user attributes will be included by default.
+     *
+     * @return An unmodifiable list containing the attributes to be included
+     *         with each entry that matches the search criteria.
+     */
+    public List<String> getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * Returns the search filter associated with this LDAP URL.
+     *
+     * @return The search filter associated with this LDAP URL.
+     */
+    public Filter getFilter() {
+        return filter;
+    }
+
+    /**
+     * Returns the name or IP address in dotted format of the LDAP server
+     * referenced by this LDAP URL. For example, {@code ldap.server1.com} or
+     * {@code 192.202.185.90}. Use {@code null} for the local host.
+     *
+     * @return A name or IP address in dotted format of the LDAP server
+     *         referenced by this LDAP URL.
+     */
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * Returns the distinguished name of the base entry relative to which the
+     * search is to be performed.
+     *
+     * @return The distinguished name of the base entry relative to which the
+     *         search is to be performed.
+     */
+    public DN getName() {
+        return name;
+    }
+
+    /**
+     * Returns the port number of the LDAP server referenced by this LDAP URL.
+     *
+     * @return The port number of the LDAP server referenced by this LDAP URL.
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Returns the search scope associated with this LDAP URL.
+     *
+     * @return The search scope associated with this LDAP URL.
+     */
+    public SearchScope getScope() {
+        return scope;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        final String s = toNormalizedString();
+        return s.hashCode();
+    }
+
+    /**
+     * Returns {@code true} if this LDAP URL should use LDAPS or {@code false}
+     * if it should use LDAP.
+     *
+     * @return {@code true} if this LDAP URL should use LDAPS or {@code false}
+     *         if it should use LDAP.
+     */
+    public boolean isSecure() {
+        return isSecured;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return urlString;
+    }
+
+    private int parseHostPort(final String urlString, final String hostAndPort,
+            final StringBuilder host) {
+        Validator.ensureNotNull(hostAndPort, port, host);
+        int urlPort = isSecured ? DEFAULT_SSL_PORT : DEFAULT_PORT;
+        if (hostAndPort.length() == 0) {
+            host.append(DEFAULT_HOST);
+            return urlPort;
+        }
+        final int colonIdx = hostAndPort.indexOf(':');
+        if (colonIdx < 0) {
+            // port is not specified.
+            host.append(hostAndPort);
+            return urlPort;
+        } else {
+            String s = hostAndPort.substring(0, colonIdx);
+            if (s.length() == 0) {
+                // Use the default host as we allow only the port to be
+                // specified.
+                host.append(DEFAULT_HOST);
+            } else {
+                host.append(s);
+            }
+            s = hostAndPort.substring(colonIdx + 1, hostAndPort.length());
+            try {
+                urlPort = Integer.parseInt(s);
+            } catch (final NumberFormatException e) {
+                final LocalizableMessage msg = ERR_LDAPURL_CANNOT_DECODE_PORT.get(urlString, s);
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+
+            // Check the validity of the port.
+            if (urlPort < 1 || urlPort > 65535) {
+                final LocalizableMessage msg = ERR_LDAPURL_INVALID_PORT.get(urlString, urlPort);
+                throw new LocalizedIllegalArgumentException(msg);
+            }
+        }
+        return urlPort;
+    }
+
+    private String toNormalizedString() {
+        if (normalizedURL == null) {
+            final StringBuilder builder = new StringBuilder();
+            if (this.isSecured) {
+                builder.append(SSL_URL_SCHEME);
+            } else {
+                builder.append(DEFAULT_URL_SCHEME);
+            }
+            builder.append("://");
+            builder.append(host);
+            builder.append(COLON_CHAR);
+            builder.append(port);
+            builder.append(SLASH_CHAR);
+            percentEncoder(name.toString(), builder);
+            builder.append(QUESTION_CHAR);
+            final int sz = attributes.size();
+            for (int i = 0; i < sz; i++) {
+                if (i > 0) {
+                    builder.append(COMMA_CHAR);
+                }
+                builder.append(attributes.get(i));
+            }
+            builder.append(QUESTION_CHAR);
+            builder.append(scope);
+            builder.append(QUESTION_CHAR);
+            percentEncoder(filter.toString(), builder);
+            normalizedURL = builder.toString();
+        }
+        return normalizedURL;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java
index 7d640df..28ea4ff 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,16 +27,19 @@
 
 package org.forgerock.opendj.ldap;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
 
-
-import java.util.*;
-
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An implementation of the {@code Attribute} interface with predictable
  * iteration order.
@@ -50,988 +52,714 @@
  * <p>
  * All operations are supported by this implementation.
  */
-public final class LinkedAttribute extends AbstractAttribute
-{
+public final class LinkedAttribute extends AbstractAttribute {
 
-  private static abstract class Impl
-  {
+    private static abstract class Impl {
 
-    abstract boolean add(LinkedAttribute attribute, ByteString value);
+        abstract boolean add(LinkedAttribute attribute, ByteString value);
 
+        abstract void clear(LinkedAttribute attribute);
 
+        abstract boolean contains(LinkedAttribute attribute, ByteString value);
 
-    abstract void clear(LinkedAttribute attribute);
-
-
-
-    abstract boolean contains(LinkedAttribute attribute, ByteString value);
-
-
-
-    boolean containsAll(final LinkedAttribute attribute,
-        final Collection<?> values)
-    {
-      // TODO: could optimize if objects is a LinkedAttribute having the same
-      // equality matching rule.
-      for (final Object value : values)
-      {
-        if (!contains(attribute, ByteString.valueOf(value)))
-        {
-          return false;
-        }
-      }
-      return true;
-    }
-
-
-
-    abstract ByteString firstValue(LinkedAttribute attribute);
-
-
-
-    abstract Iterator<ByteString> iterator(LinkedAttribute attribute);
-
-
-
-    abstract boolean remove(LinkedAttribute attribute, ByteString value);
-
-
-
-    abstract <T> boolean retainAll(LinkedAttribute attribute,
-        Collection<T> values, Collection<? super T> missingValues);
-
-
-
-    abstract int size(LinkedAttribute attribute);
-  }
-
-
-
-  private static final class MultiValueImpl extends Impl
-  {
-
-    @Override
-    boolean add(final LinkedAttribute attribute, final ByteString value)
-    {
-      final ByteString normalizedValue = normalizeValue(attribute, value);
-      if (attribute.multipleValues.put(normalizedValue, value) == null)
-      {
-        return true;
-      }
-      else
-      {
-        return false;
-      }
-    }
-
-
-
-    @Override
-    void clear(final LinkedAttribute attribute)
-    {
-      attribute.multipleValues = null;
-      attribute.pimpl = ZERO_VALUE_IMPL;
-    }
-
-
-
-    @Override
-    boolean contains(final LinkedAttribute attribute, final ByteString value)
-    {
-      return attribute.multipleValues.containsKey(normalizeValue(attribute,
-          value));
-    }
-
-
-
-    @Override
-    ByteString firstValue(final LinkedAttribute attribute)
-    {
-      return attribute.multipleValues.values().iterator().next();
-    }
-
-
-
-    @Override
-    Iterator<ByteString> iterator(final LinkedAttribute attribute)
-    {
-      return new Iterator<ByteString>()
-      {
-        private Impl expectedImpl = MULTI_VALUE_IMPL;
-
-        private Iterator<ByteString> iterator = attribute.multipleValues
-            .values().iterator();
-
-
-
-        @Override
-        public boolean hasNext()
-        {
-          return iterator.hasNext();
+        boolean containsAll(final LinkedAttribute attribute, final Collection<?> values) {
+            // TODO: could optimize if objects is a LinkedAttribute having the
+            // same
+            // equality matching rule.
+            for (final Object value : values) {
+                if (!contains(attribute, ByteString.valueOf(value))) {
+                    return false;
+                }
+            }
+            return true;
         }
 
+        abstract ByteString firstValue(LinkedAttribute attribute);
 
+        abstract Iterator<ByteString> iterator(LinkedAttribute attribute);
+
+        abstract boolean remove(LinkedAttribute attribute, ByteString value);
+
+        abstract <T> boolean retainAll(LinkedAttribute attribute, Collection<T> values,
+                Collection<? super T> missingValues);
+
+        abstract int size(LinkedAttribute attribute);
+    }
+
+    private static final class MultiValueImpl extends Impl {
 
         @Override
-        public ByteString next()
-        {
-          if (attribute.pimpl != expectedImpl)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else
-          {
-            return iterator.next();
-          }
+        boolean add(final LinkedAttribute attribute, final ByteString value) {
+            final ByteString normalizedValue = normalizeValue(attribute, value);
+            return (attribute.multipleValues.put(normalizedValue, value) == null);
         }
 
-
+        @Override
+        void clear(final LinkedAttribute attribute) {
+            attribute.multipleValues = null;
+            attribute.pimpl = ZERO_VALUE_IMPL;
+        }
 
         @Override
-        public void remove()
-        {
-          if (attribute.pimpl != expectedImpl)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else
-          {
-            iterator.remove();
+        boolean contains(final LinkedAttribute attribute, final ByteString value) {
+            return attribute.multipleValues.containsKey(normalizeValue(attribute, value));
+        }
 
-            // Resize if we have removed the second to last value.
-            if (attribute.multipleValues != null
-                && attribute.multipleValues.size() == 1)
-            {
-              resize(attribute);
-              iterator = attribute.pimpl.iterator(attribute);
+        @Override
+        ByteString firstValue(final LinkedAttribute attribute) {
+            return attribute.multipleValues.values().iterator().next();
+        }
+
+        @Override
+        Iterator<ByteString> iterator(final LinkedAttribute attribute) {
+            return new Iterator<ByteString>() {
+                private Impl expectedImpl = MULTI_VALUE_IMPL;
+
+                private Iterator<ByteString> iterator = attribute.multipleValues.values()
+                        .iterator();
+
+                @Override
+                public boolean hasNext() {
+                    return iterator.hasNext();
+                }
+
+                @Override
+                public ByteString next() {
+                    if (attribute.pimpl != expectedImpl) {
+                        throw new ConcurrentModificationException();
+                    } else {
+                        return iterator.next();
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    if (attribute.pimpl != expectedImpl) {
+                        throw new ConcurrentModificationException();
+                    } else {
+                        iterator.remove();
+
+                        // Resize if we have removed the second to last value.
+                        if (attribute.multipleValues != null
+                                && attribute.multipleValues.size() == 1) {
+                            resize(attribute);
+                            iterator = attribute.pimpl.iterator(attribute);
+                        }
+
+                        // Always update since we may change to single or zero
+                        // value
+                        // impl.
+                        expectedImpl = attribute.pimpl;
+                    }
+                }
+
+            };
+        }
+
+        @Override
+        boolean remove(final LinkedAttribute attribute, final ByteString value) {
+            final ByteString normalizedValue = normalizeValue(attribute, value);
+            if (attribute.multipleValues.remove(normalizedValue) != null) {
+                resize(attribute);
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        <T> boolean retainAll(final LinkedAttribute attribute, final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            // TODO: could optimize if objects is a LinkedAttribute having the
+            // same
+            // equality matching rule.
+            if (values.isEmpty()) {
+                clear(attribute);
+                return true;
             }
 
-            // Always update since we may change to single or zero value
-            // impl.
-            expectedImpl = attribute.pimpl;
-          }
+            final Map<ByteString, T> valuesToRetain = new HashMap<ByteString, T>(values.size());
+            for (final T value : values) {
+                valuesToRetain.put(normalizeValue(attribute, ByteString.valueOf(value)), value);
+            }
+
+            boolean modified = false;
+            final Iterator<ByteString> iterator = attribute.multipleValues.keySet().iterator();
+            while (iterator.hasNext()) {
+                final ByteString normalizedValue = iterator.next();
+                if (valuesToRetain.remove(normalizedValue) == null) {
+                    modified = true;
+                    iterator.remove();
+                }
+            }
+
+            if (missingValues != null) {
+                missingValues.addAll(valuesToRetain.values());
+            }
+
+            resize(attribute);
+
+            return modified;
         }
 
-      };
-    }
-
-
-
-    @Override
-    boolean remove(final LinkedAttribute attribute, final ByteString value)
-    {
-      final ByteString normalizedValue = normalizeValue(attribute, value);
-      if (attribute.multipleValues.remove(normalizedValue) != null)
-      {
-        resize(attribute);
-        return true;
-      }
-      else
-      {
-        return false;
-      }
-    }
-
-
-
-    @Override
-    <T> boolean retainAll(final LinkedAttribute attribute,
-        final Collection<T> values, final Collection<? super T> missingValues)
-    {
-      // TODO: could optimize if objects is a LinkedAttribute having the same
-      // equality matching rule.
-      if (values.isEmpty())
-      {
-        clear(attribute);
-        return true;
-      }
-
-      final Map<ByteString, T> valuesToRetain = new HashMap<ByteString, T>(
-          values.size());
-      for (final T value : values)
-      {
-        valuesToRetain.put(
-            normalizeValue(attribute, ByteString.valueOf(value)), value);
-      }
-
-      boolean modified = false;
-      final Iterator<ByteString> iterator = attribute.multipleValues.keySet()
-          .iterator();
-      while (iterator.hasNext())
-      {
-        final ByteString normalizedValue = iterator.next();
-        if (valuesToRetain.remove(normalizedValue) == null)
-        {
-          modified = true;
-          iterator.remove();
-        }
-      }
-
-      if (missingValues != null)
-      {
-        missingValues.addAll(valuesToRetain.values());
-      }
-
-      resize(attribute);
-
-      return modified;
-    }
-
-
-
-    @Override
-    int size(final LinkedAttribute attribute)
-    {
-      return attribute.multipleValues.size();
-    }
-
-
-
-    private void resize(final LinkedAttribute attribute)
-    {
-      // May need to resize if initial size estimate was wrong (e.g. all
-      // values in added collection were the same).
-      switch (attribute.multipleValues.size())
-      {
-      case 0:
-        attribute.multipleValues = null;
-        attribute.pimpl = ZERO_VALUE_IMPL;
-        break;
-      case 1:
-        final Map.Entry<ByteString, ByteString> e = attribute.multipleValues
-            .entrySet().iterator().next();
-        attribute.singleValue = e.getValue();
-        attribute.normalizedSingleValue = e.getKey();
-        attribute.multipleValues = null;
-        attribute.pimpl = SINGLE_VALUE_IMPL;
-        break;
-      default:
-        // Nothing to do.
-        break;
-      }
-    }
-  }
-
-
-
-  private static final class SingleValueImpl extends Impl
-  {
-
-    @Override
-    boolean add(final LinkedAttribute attribute, final ByteString value)
-    {
-      final ByteString normalizedValue = normalizeValue(attribute, value);
-      if (attribute.normalizedSingleValue().equals(normalizedValue))
-      {
-        return false;
-      }
-
-      attribute.multipleValues = new LinkedHashMap<ByteString, ByteString>(2);
-      attribute.multipleValues.put(attribute.normalizedSingleValue,
-          attribute.singleValue);
-      attribute.multipleValues.put(normalizedValue, value);
-      attribute.singleValue = null;
-      attribute.normalizedSingleValue = null;
-      attribute.pimpl = MULTI_VALUE_IMPL;
-
-      return true;
-    }
-
-
-
-    @Override
-    void clear(final LinkedAttribute attribute)
-    {
-      attribute.singleValue = null;
-      attribute.normalizedSingleValue = null;
-      attribute.pimpl = ZERO_VALUE_IMPL;
-    }
-
-
-
-    @Override
-    boolean contains(final LinkedAttribute attribute, final ByteString value)
-    {
-      final ByteString normalizedValue = normalizeValue(attribute, value);
-      return attribute.normalizedSingleValue().equals(normalizedValue);
-    }
-
-
-
-    @Override
-    ByteString firstValue(final LinkedAttribute attribute)
-    {
-      if (attribute.singleValue != null)
-      {
-        return attribute.singleValue;
-      }
-      else
-      {
-        throw new NoSuchElementException();
-      }
-    }
-
-
-
-    @Override
-    Iterator<ByteString> iterator(final LinkedAttribute attribute)
-    {
-      return new Iterator<ByteString>()
-      {
-        private Impl expectedImpl = SINGLE_VALUE_IMPL;
-
-        private boolean hasNext = true;
-
-
-
         @Override
-        public boolean hasNext()
-        {
-          return hasNext;
+        int size(final LinkedAttribute attribute) {
+            return attribute.multipleValues.size();
         }
 
-
-
-        @Override
-        public ByteString next()
-        {
-          if (attribute.pimpl != expectedImpl)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else if (hasNext)
-          {
-            hasNext = false;
-            return attribute.singleValue;
-          }
-          else
-          {
-            throw new NoSuchElementException();
-          }
+        private void resize(final LinkedAttribute attribute) {
+            // May need to resize if initial size estimate was wrong (e.g. all
+            // values in added collection were the same).
+            switch (attribute.multipleValues.size()) {
+            case 0:
+                attribute.multipleValues = null;
+                attribute.pimpl = ZERO_VALUE_IMPL;
+                break;
+            case 1:
+                final Map.Entry<ByteString, ByteString> e =
+                        attribute.multipleValues.entrySet().iterator().next();
+                attribute.singleValue = e.getValue();
+                attribute.normalizedSingleValue = e.getKey();
+                attribute.multipleValues = null;
+                attribute.pimpl = SINGLE_VALUE_IMPL;
+                break;
+            default:
+                // Nothing to do.
+                break;
+            }
         }
-
-
-
-        @Override
-        public void remove()
-        {
-          if (attribute.pimpl != expectedImpl)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else if (hasNext || attribute.singleValue == null)
-          {
-            throw new IllegalStateException();
-          }
-          else
-          {
-            clear(attribute);
-            expectedImpl = attribute.pimpl;
-          }
-        }
-
-      };
     }
 
+    private static final class SingleValueImpl extends Impl {
 
+        @Override
+        boolean add(final LinkedAttribute attribute, final ByteString value) {
+            final ByteString normalizedValue = normalizeValue(attribute, value);
+            if (attribute.normalizedSingleValue().equals(normalizedValue)) {
+                return false;
+            }
 
-    @Override
-    boolean remove(final LinkedAttribute attribute, final ByteString value)
-    {
-      if (contains(attribute, value))
-      {
-        clear(attribute);
-        return true;
-      }
-      else
-      {
-        return false;
-      }
+            attribute.multipleValues = new LinkedHashMap<ByteString, ByteString>(2);
+            attribute.multipleValues.put(attribute.normalizedSingleValue, attribute.singleValue);
+            attribute.multipleValues.put(normalizedValue, value);
+            attribute.singleValue = null;
+            attribute.normalizedSingleValue = null;
+            attribute.pimpl = MULTI_VALUE_IMPL;
+
+            return true;
+        }
+
+        @Override
+        void clear(final LinkedAttribute attribute) {
+            attribute.singleValue = null;
+            attribute.normalizedSingleValue = null;
+            attribute.pimpl = ZERO_VALUE_IMPL;
+        }
+
+        @Override
+        boolean contains(final LinkedAttribute attribute, final ByteString value) {
+            final ByteString normalizedValue = normalizeValue(attribute, value);
+            return attribute.normalizedSingleValue().equals(normalizedValue);
+        }
+
+        @Override
+        ByteString firstValue(final LinkedAttribute attribute) {
+            if (attribute.singleValue != null) {
+                return attribute.singleValue;
+            } else {
+                throw new NoSuchElementException();
+            }
+        }
+
+        @Override
+        Iterator<ByteString> iterator(final LinkedAttribute attribute) {
+            return new Iterator<ByteString>() {
+                private Impl expectedImpl = SINGLE_VALUE_IMPL;
+
+                private boolean hasNext = true;
+
+                @Override
+                public boolean hasNext() {
+                    return hasNext;
+                }
+
+                @Override
+                public ByteString next() {
+                    if (attribute.pimpl != expectedImpl) {
+                        throw new ConcurrentModificationException();
+                    } else if (hasNext) {
+                        hasNext = false;
+                        return attribute.singleValue;
+                    } else {
+                        throw new NoSuchElementException();
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    if (attribute.pimpl != expectedImpl) {
+                        throw new ConcurrentModificationException();
+                    } else if (hasNext || attribute.singleValue == null) {
+                        throw new IllegalStateException();
+                    } else {
+                        clear(attribute);
+                        expectedImpl = attribute.pimpl;
+                    }
+                }
+
+            };
+        }
+
+        @Override
+        boolean remove(final LinkedAttribute attribute, final ByteString value) {
+            if (contains(attribute, value)) {
+                clear(attribute);
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        <T> boolean retainAll(final LinkedAttribute attribute, final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            // TODO: could optimize if objects is a LinkedAttribute having the
+            // same
+            // equality matching rule.
+            if (values.isEmpty()) {
+                clear(attribute);
+                return true;
+            }
+
+            final ByteString normalizedSingleValue = attribute.normalizedSingleValue();
+            boolean retained = false;
+            for (final T value : values) {
+                final ByteString normalizedValue =
+                        normalizeValue(attribute, ByteString.valueOf(value));
+                if (normalizedSingleValue.equals(normalizedValue)) {
+                    if (missingValues == null) {
+                        // We can stop now.
+                        return false;
+                    }
+                    retained = true;
+                } else if (missingValues != null) {
+                    missingValues.add(value);
+                }
+            }
+
+            if (!retained) {
+                clear(attribute);
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        int size(final LinkedAttribute attribute) {
+            return 1;
+        }
     }
 
+    private static final class ZeroValueImpl extends Impl {
 
+        @Override
+        boolean add(final LinkedAttribute attribute, final ByteString value) {
+            attribute.singleValue = value;
+            attribute.pimpl = SINGLE_VALUE_IMPL;
+            return true;
+        }
 
-    @Override
-    <T> boolean retainAll(final LinkedAttribute attribute,
-        final Collection<T> values, final Collection<? super T> missingValues)
-    {
-      // TODO: could optimize if objects is a LinkedAttribute having the same
-      // equality matching rule.
-      if (values.isEmpty())
-      {
-        clear(attribute);
-        return true;
-      }
+        @Override
+        void clear(final LinkedAttribute attribute) {
+            // Nothing to do.
+        }
 
-      final ByteString normalizedSingleValue = attribute
-          .normalizedSingleValue();
-      boolean retained = false;
-      for (final T value : values)
-      {
-        final ByteString normalizedValue = normalizeValue(attribute,
-            ByteString.valueOf(value));
-        if (normalizedSingleValue.equals(normalizedValue))
-        {
-          if (missingValues == null)
-          {
-            // We can stop now.
+        @Override
+        boolean contains(final LinkedAttribute attribute, final ByteString value) {
             return false;
-          }
-          retained = true;
         }
-        else if (missingValues != null)
-        {
-          missingValues.add(value);
-        }
-      }
-
-      if (!retained)
-      {
-        clear(attribute);
-        return true;
-      }
-      else
-      {
-        return false;
-      }
-    }
-
-
-
-    @Override
-    int size(final LinkedAttribute attribute)
-    {
-      return 1;
-    }
-  }
-
-
-
-  private static final class ZeroValueImpl extends Impl
-  {
-
-    @Override
-    boolean add(final LinkedAttribute attribute, final ByteString value)
-    {
-      attribute.singleValue = value;
-      attribute.pimpl = SINGLE_VALUE_IMPL;
-      return true;
-    }
-
-
-
-    @Override
-    void clear(final LinkedAttribute attribute)
-    {
-      // Nothing to do.
-    }
-
-
-
-    @Override
-    boolean contains(final LinkedAttribute attribute, final ByteString value)
-    {
-      return false;
-    }
-
-
-
-    @Override
-    boolean containsAll(final LinkedAttribute attribute,
-        final Collection<?> values)
-    {
-      return values.isEmpty();
-    }
-
-
-
-    @Override
-    ByteString firstValue(final LinkedAttribute attribute)
-    {
-      throw new NoSuchElementException();
-    }
-
-
-
-    @Override
-    Iterator<ByteString> iterator(final LinkedAttribute attribute)
-    {
-      return new Iterator<ByteString>()
-      {
-        @Override
-        public boolean hasNext()
-        {
-          return false;
-        }
-
-
 
         @Override
-        public ByteString next()
-        {
-          if (attribute.pimpl != ZERO_VALUE_IMPL)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else
-          {
+        boolean containsAll(final LinkedAttribute attribute, final Collection<?> values) {
+            return values.isEmpty();
+        }
+
+        @Override
+        ByteString firstValue(final LinkedAttribute attribute) {
             throw new NoSuchElementException();
-          }
         }
 
-
-
         @Override
-        public void remove()
-        {
-          if (attribute.pimpl != ZERO_VALUE_IMPL)
-          {
-            throw new ConcurrentModificationException();
-          }
-          else
-          {
-            throw new IllegalStateException();
-          }
+        Iterator<ByteString> iterator(final LinkedAttribute attribute) {
+            return new Iterator<ByteString>() {
+                @Override
+                public boolean hasNext() {
+                    return false;
+                }
+
+                @Override
+                public ByteString next() {
+                    if (attribute.pimpl != ZERO_VALUE_IMPL) {
+                        throw new ConcurrentModificationException();
+                    } else {
+                        throw new NoSuchElementException();
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    if (attribute.pimpl != ZERO_VALUE_IMPL) {
+                        throw new ConcurrentModificationException();
+                    } else {
+                        throw new IllegalStateException();
+                    }
+                }
+
+            };
         }
 
-      };
+        @Override
+        boolean remove(final LinkedAttribute attribute, final ByteString value) {
+            return false;
+        }
+
+        @Override
+        <T> boolean retainAll(final LinkedAttribute attribute, final Collection<T> values,
+                final Collection<? super T> missingValues) {
+            if (missingValues != null) {
+                missingValues.addAll(values);
+            }
+            return false;
+        }
+
+        @Override
+        int size(final LinkedAttribute attribute) {
+            return 0;
+        }
+
     }
 
+    /**
+     * An attribute factory which can be used to create new linked attributes.
+     */
+    public static final AttributeFactory FACTORY = new AttributeFactory() {
+        @Override
+        public Attribute newAttribute(final AttributeDescription attributeDescription) {
+            return new LinkedAttribute(attributeDescription);
+        }
+    };
 
+    private static final MultiValueImpl MULTI_VALUE_IMPL = new MultiValueImpl();
 
+    private static final SingleValueImpl SINGLE_VALUE_IMPL = new SingleValueImpl();
+
+    private static final ZeroValueImpl ZERO_VALUE_IMPL = new ZeroValueImpl();
+
+    private final AttributeDescription attributeDescription;
+
+    private Map<ByteString, ByteString> multipleValues = null;
+
+    private ByteString normalizedSingleValue = null;
+
+    private Impl pimpl = ZERO_VALUE_IMPL;
+
+    private ByteString singleValue = null;
+
+    /**
+     * Creates a new attribute having the same attribute description and
+     * attribute values as {@code attribute}.
+     *
+     * @param attribute
+     *            The attribute to be copied.
+     * @throws NullPointerException
+     *             If {@code attribute} was {@code null}.
+     */
+    public LinkedAttribute(final Attribute attribute) {
+        this.attributeDescription = attribute.getAttributeDescription();
+
+        if (attribute instanceof LinkedAttribute) {
+            final LinkedAttribute other = (LinkedAttribute) attribute;
+            this.pimpl = other.pimpl;
+            this.singleValue = other.singleValue;
+            this.normalizedSingleValue = other.normalizedSingleValue;
+            if (other.multipleValues != null) {
+                this.multipleValues =
+                        new LinkedHashMap<ByteString, ByteString>(other.multipleValues);
+            }
+        } else {
+            addAll(attribute);
+        }
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and no
+     * attribute values.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    public LinkedAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        this.attributeDescription = attributeDescription;
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and
+     * single attribute value.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param value
+     *            The single attribute value.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code value} was
+     *             {@code null} .
+     */
+    public LinkedAttribute(final AttributeDescription attributeDescription, final ByteString value) {
+        this(attributeDescription);
+        add(value);
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and
+     * attribute values.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param values
+     *            The attribute values.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code values} was
+     *             {@code null}.
+     */
+    public LinkedAttribute(final AttributeDescription attributeDescription,
+            final ByteString... values) {
+        this(attributeDescription);
+        addAll(Arrays.asList(values));
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and
+     * attribute values.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param values
+     *            The attribute values.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code values} was
+     *             {@code null}.
+     */
+    public LinkedAttribute(final AttributeDescription attributeDescription,
+            final Collection<ByteString> values) {
+        this(attributeDescription);
+        addAll(values);
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and no
+     * attribute values. The attribute description will be decoded using the
+     * default schema.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the default schema.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    public LinkedAttribute(final String attributeDescription) {
+        this(AttributeDescription.valueOf(attributeDescription));
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and
+     * single attribute value. The attribute description will be decoded using
+     * the default schema.
+     * <p>
+     * If {@code value} is not an instance of {@code ByteString} then it will be
+     * converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param value
+     *            The single attribute value.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the default schema.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code value} was
+     *             {@code null} .
+     */
+    public LinkedAttribute(final String attributeDescription, final Object value) {
+        this(attributeDescription);
+        add(ByteString.valueOf(value));
+    }
+
+    /**
+     * Creates a new attribute having the specified attribute description and
+     * attribute values. The attribute description will be decoded using the
+     * default schema.
+     * <p>
+     * Any attribute values which are not instances of {@code ByteString} will
+     * be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeDescription
+     *            The attribute description.
+     * @param values
+     *            The attribute values.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the default schema.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} or {@code values} was
+     *             {@code null}.
+     */
+    public LinkedAttribute(final String attributeDescription, final Object... values) {
+        this(attributeDescription);
+        for (final Object value : values) {
+            add(ByteString.valueOf(value));
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    boolean remove(final LinkedAttribute attribute, final ByteString value)
-    {
-      return false;
+    public boolean add(final ByteString value) {
+        Validator.ensureNotNull(value);
+        return pimpl.add(this, value);
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    <T> boolean retainAll(final LinkedAttribute attribute,
-        final Collection<T> values, final Collection<? super T> missingValues)
-    {
-      if (missingValues != null)
-      {
-        missingValues.addAll(values);
-      }
-      return false;
+    public boolean addAll(final Collection<? extends ByteString> values,
+            final Collection<? super ByteString> duplicateValues) {
+        Validator.ensureNotNull(values);
+
+        // TODO: could optimize if objects is a LinkedAttribute having the same
+        // equality matching rule.
+        boolean modified = false;
+        for (final ByteString value : values) {
+            if (add(value)) {
+                modified = true;
+            } else if (duplicateValues != null) {
+                duplicateValues.add(value);
+            }
+        }
+        return modified;
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    int size(final LinkedAttribute attribute)
-    {
-      return 0;
+    public void clear() {
+        pimpl.clear(this);
     }
 
-  }
-
-
-
-  /**
-   * An attribute factory which can be used to create new linked attributes.
-   */
-  public static final AttributeFactory FACTORY = new AttributeFactory()
-  {
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public Attribute newAttribute(
-        final AttributeDescription attributeDescription)
-    {
-      return new LinkedAttribute(attributeDescription);
+    public boolean contains(final Object value) {
+        Validator.ensureNotNull(value);
+        return pimpl.contains(this, ByteString.valueOf(value));
     }
-  };
 
-  private static final MultiValueImpl MULTI_VALUE_IMPL = new MultiValueImpl();
-
-  private static final SingleValueImpl SINGLE_VALUE_IMPL = new SingleValueImpl();
-
-  private static final ZeroValueImpl ZERO_VALUE_IMPL = new ZeroValueImpl();
-
-  private final AttributeDescription attributeDescription;
-
-  private Map<ByteString, ByteString> multipleValues = null;
-
-  private ByteString normalizedSingleValue = null;
-
-  private Impl pimpl = ZERO_VALUE_IMPL;
-
-  private ByteString singleValue = null;
-
-
-
-  /**
-   * Creates a new attribute having the same attribute description and attribute
-   * values as {@code attribute}.
-   *
-   * @param attribute
-   *          The attribute to be copied.
-   * @throws NullPointerException
-   *           If {@code attribute} was {@code null}.
-   */
-  public LinkedAttribute(final Attribute attribute)
-  {
-    this.attributeDescription = attribute.getAttributeDescription();
-
-    if (attribute instanceof LinkedAttribute)
-    {
-      final LinkedAttribute other = (LinkedAttribute) attribute;
-      this.pimpl = other.pimpl;
-      this.singleValue = other.singleValue;
-      this.normalizedSingleValue = other.normalizedSingleValue;
-      if (other.multipleValues != null)
-      {
-        this.multipleValues = new LinkedHashMap<ByteString, ByteString>(
-            other.multipleValues);
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean containsAll(final Collection<?> values) {
+        Validator.ensureNotNull(values);
+        return pimpl.containsAll(this, values);
     }
-    else
-    {
-      addAll(attribute);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString firstValue() {
+        return pimpl.firstValue(this);
     }
-  }
 
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and no
-   * attribute values.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  public LinkedAttribute(final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    this.attributeDescription = attributeDescription;
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and
-   * single attribute value.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param value
-   *          The single attribute value.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code value} was {@code null}
-   *           .
-   */
-  public LinkedAttribute(final AttributeDescription attributeDescription,
-      final ByteString value)
-  {
-    this(attributeDescription);
-    add(value);
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and
-   * attribute values.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param values
-   *          The attribute values.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code values} was
-   *           {@code null}.
-   */
-  public LinkedAttribute(final AttributeDescription attributeDescription,
-      final ByteString... values)
-  {
-    this(attributeDescription);
-    addAll(Arrays.asList(values));
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and
-   * attribute values.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param values
-   *          The attribute values.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code values} was
-   *           {@code null}.
-   */
-  public LinkedAttribute(final AttributeDescription attributeDescription,
-      final Collection<ByteString> values)
-  {
-    this(attributeDescription);
-    addAll(values);
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and no
-   * attribute values. The attribute description will be decoded using the
-   * default schema.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           default schema.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  public LinkedAttribute(final String attributeDescription)
-  {
-    this(AttributeDescription.valueOf(attributeDescription));
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and
-   * single attribute value. The attribute description will be decoded using the
-   * default schema.
-   * <p>
-   * If {@code value} is not an instance of {@code ByteString} then it will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param value
-   *          The single attribute value.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           default schema.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code value} was {@code null}
-   *           .
-   */
-  public LinkedAttribute(final String attributeDescription, final Object value)
-  {
-    this(attributeDescription);
-    add(ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * Creates a new attribute having the specified attribute description and
-   * attribute values. The attribute description will be decoded using the
-   * default schema.
-   * <p>
-   * Any attribute values which are not instances of {@code ByteString} will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeDescription
-   *          The attribute description.
-   * @param values
-   *          The attribute values.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           default schema.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} or {@code values} was
-   *           {@code null}.
-   */
-  public LinkedAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    this(attributeDescription);
-    for (final Object value : values)
-    {
-      add(ByteString.valueOf(value));
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public AttributeDescription getAttributeDescription() {
+        return attributeDescription;
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean add(final ByteString value)
-  {
-    Validator.ensureNotNull(value);
-    return pimpl.add(this, value);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean addAll(final Collection<? extends ByteString> values,
-      final Collection<? super ByteString> duplicateValues)
-  {
-    Validator.ensureNotNull(values);
-
-    // TODO: could optimize if objects is a LinkedAttribute having the same
-    // equality matching rule.
-    boolean modified = false;
-    for (final ByteString value : values)
-    {
-      if (add(value))
-      {
-        modified = true;
-      }
-      else if (duplicateValues != null)
-      {
-        duplicateValues.add(value);
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Iterator<ByteString> iterator() {
+        return pimpl.iterator(this);
     }
-    return modified;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void clear()
-  {
-    pimpl.clear(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean contains(final Object value)
-  {
-    Validator.ensureNotNull(value);
-    return pimpl.contains(this, ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean containsAll(final Collection<?> values)
-  {
-    Validator.ensureNotNull(values);
-    return pimpl.containsAll(this, values);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString firstValue()
-  {
-    return pimpl.firstValue(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public AttributeDescription getAttributeDescription()
-  {
-    return attributeDescription;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Iterator<ByteString> iterator()
-  {
-    return pimpl.iterator(this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean remove(final Object value)
-  {
-    Validator.ensureNotNull(value);
-    return pimpl.remove(this, ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <T> boolean removeAll(final Collection<T> values,
-      final Collection<? super T> missingValues)
-  {
-    Validator.ensureNotNull(values);
-
-    // TODO: could optimize if objects is a LinkedAttribute having the same
-    // equality matching rule.
-    boolean modified = false;
-    for (final T value : values)
-    {
-      if (remove(ByteString.valueOf(value)))
-      {
-        modified = true;
-      }
-      else if (missingValues != null)
-      {
-        missingValues.add(value);
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean remove(final Object value) {
+        Validator.ensureNotNull(value);
+        return pimpl.remove(this, ByteString.valueOf(value));
     }
-    return modified;
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <T> boolean removeAll(final Collection<T> values,
+            final Collection<? super T> missingValues) {
+        Validator.ensureNotNull(values);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <T> boolean retainAll(final Collection<T> values,
-      final Collection<? super T> missingValues)
-  {
-    Validator.ensureNotNull(values);
-    return pimpl.retainAll(this, values, missingValues);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int size()
-  {
-    return pimpl.size(this);
-  }
-
-
-
-  // Lazily computes the normalized single value.
-  private ByteString normalizedSingleValue()
-  {
-    if (normalizedSingleValue == null)
-    {
-      normalizedSingleValue = normalizeValue(this, singleValue);
+        // TODO: could optimize if objects is a LinkedAttribute having the same
+        // equality matching rule.
+        boolean modified = false;
+        for (final T value : values) {
+            if (remove(ByteString.valueOf(value))) {
+                modified = true;
+            } else if (missingValues != null) {
+                missingValues.add(value);
+            }
+        }
+        return modified;
     }
-    return normalizedSingleValue;
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <T> boolean retainAll(final Collection<T> values,
+            final Collection<? super T> missingValues) {
+        Validator.ensureNotNull(values);
+        return pimpl.retainAll(this, values, missingValues);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int size() {
+        return pimpl.size(this);
+    }
+
+    // Lazily computes the normalized single value.
+    private ByteString normalizedSingleValue() {
+        if (normalizedSingleValue == null) {
+            normalizedSingleValue = normalizeValue(this, singleValue);
+        }
+        return normalizedSingleValue;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java
index f900a06..2f9b7a2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,13 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.LinkedHashMap;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.requests.Requests;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An implementation of the {@code Entry} interface which uses a
  * {@code LinkedHashMap} for storing attributes. Attributes are returned in the
@@ -55,133 +50,113 @@
  * and store a reference to the new attribute - neither the new or existing
  * attribute need to be modifiable in this case.
  */
-public final class LinkedHashMapEntry extends AbstractMapEntry
-{
-  /**
-   * An entry factory which can be used to create new linked hash map entries.
-   */
-  public static final EntryFactory FACTORY = new EntryFactory()
-  {
-    public Entry newEntry(final DN name)
-    {
-      return new LinkedHashMapEntry(name);
+public final class LinkedHashMapEntry extends AbstractMapEntry {
+    /**
+     * An entry factory which can be used to create new linked hash map entries.
+     */
+    public static final EntryFactory FACTORY = new EntryFactory() {
+        public Entry newEntry(final DN name) {
+            return new LinkedHashMapEntry(name);
+        }
+    };
+
+    /**
+     * Creates an entry having the same distinguished name, attributes, and
+     * object classes of the provided entry. This constructor performs a deep
+     * copy of {@code entry} and will copy each attribute as a
+     * {@link LinkedAttribute}.
+     * <p>
+     * A shallow copy constructor is provided by
+     * {@link #LinkedHashMapEntry(Entry)}.
+     *
+     * @param entry
+     *            The entry to be copied.
+     * @return A deep copy of {@code entry}.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     * @see #LinkedHashMapEntry(Entry)
+     */
+    public static LinkedHashMapEntry deepCopyOfEntry(final Entry entry) {
+        LinkedHashMapEntry copy = new LinkedHashMapEntry(entry.getName());
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            copy.addAttribute(new LinkedAttribute(attribute));
+        }
+        return copy;
     }
-  };
 
-
-
-  /**
-   * Creates an entry having the same distinguished name, attributes, and object
-   * classes of the provided entry. This constructor performs a deep copy of
-   * {@code entry} and will copy each attribute as a {@link LinkedAttribute}.
-   * <p>
-   * A shallow copy constructor is provided by
-   * {@link #LinkedHashMapEntry(Entry)}.
-   *
-   * @param entry
-   *          The entry to be copied.
-   * @return A deep copy of {@code entry}.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   * @see #LinkedHashMapEntry(Entry)
-   */
-  public static LinkedHashMapEntry deepCopyOfEntry(final Entry entry)
-  {
-    LinkedHashMapEntry copy = new LinkedHashMapEntry(entry.getName());
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      copy.addAttribute(new LinkedAttribute(attribute));
+    /**
+     * Creates an entry with an empty (root) distinguished name and no
+     * attributes.
+     */
+    public LinkedHashMapEntry() {
+        this(DN.rootDN());
     }
-    return copy;
-  }
 
-
-
-  /**
-   * Creates an entry with an empty (root) distinguished name and no attributes.
-   */
-  public LinkedHashMapEntry()
-  {
-    this(DN.rootDN());
-  }
-
-
-
-  /**
-   * Creates an empty entry using the provided distinguished name and no
-   * attributes.
-   *
-   * @param name
-   *          The distinguished name of this entry.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public LinkedHashMapEntry(final DN name)
-  {
-    super(Validator.ensureNotNull(name),
-        new LinkedHashMap<AttributeDescription, Attribute>());
-  }
-
-
-
-  /**
-   * Creates an entry having the same distinguished name, attributes, and object
-   * classes of the provided entry. This constructor performs a shallow copy of
-   * {@code entry} and will not copy the attributes contained in {@code entry}.
-   * <p>
-   * A deep copy constructor is provided by {@link #deepCopyOfEntry(Entry)}
-   *
-   * @param entry
-   *          The entry to be copied.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   * @see #deepCopyOfEntry(Entry)
-   */
-  public LinkedHashMapEntry(final Entry entry)
-  {
-    this(entry.getName());
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      addAttribute(attribute);
+    /**
+     * Creates an empty entry using the provided distinguished name and no
+     * attributes.
+     *
+     * @param name
+     *            The distinguished name of this entry.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public LinkedHashMapEntry(final DN name) {
+        super(Validator.ensureNotNull(name), new LinkedHashMap<AttributeDescription, Attribute>());
     }
-  }
 
+    /**
+     * Creates an entry having the same distinguished name, attributes, and
+     * object classes of the provided entry. This constructor performs a shallow
+     * copy of {@code entry} and will not copy the attributes contained in
+     * {@code entry}.
+     * <p>
+     * A deep copy constructor is provided by {@link #deepCopyOfEntry(Entry)}
+     *
+     * @param entry
+     *            The entry to be copied.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     * @see #deepCopyOfEntry(Entry)
+     */
+    public LinkedHashMapEntry(final Entry entry) {
+        this(entry.getName());
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            addAttribute(attribute);
+        }
+    }
 
+    /**
+     * Creates an empty entry using the provided distinguished name decoded
+     * using the default schema.
+     *
+     * @param name
+     *            The distinguished name of this entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public LinkedHashMapEntry(final String name) {
+        this(DN.valueOf(name));
+    }
 
-  /**
-   * Creates an empty entry using the provided distinguished name decoded using
-   * the default schema.
-   *
-   * @param name
-   *          The distinguished name of this entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public LinkedHashMapEntry(final String name)
-  {
-    this(DN.valueOf(name));
-  }
-
-
-
-  /**
-   * Creates a new entry using the provided lines of LDIF decoded using the
-   * default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing the an LDIF add change record or an LDIF
-   *          entry record.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public LinkedHashMapEntry(final String... ldifLines)
-  {
-    this(Requests.newAddRequest(ldifLines));
-  }
+    /**
+     * Creates a new entry using the provided lines of LDIF decoded using the
+     * default schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing the an LDIF add change record or an
+     *            LDIF entry record.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public LinkedHashMapEntry(final String... ldifLines) {
+        this(Requests.newAddRequest(ldifLines));
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java
index 3fb7352..1c65d0d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,85 +27,63 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import com.forgerock.opendj.util.CompletedFutureResult;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A load balancing connection factory allocates connections using the provided
  * algorithm.
  */
-final class LoadBalancer implements ConnectionFactory
-{
-  private final LoadBalancingAlgorithm algorithm;
+final class LoadBalancer implements ConnectionFactory {
+    private final LoadBalancingAlgorithm algorithm;
 
-
-
-  /**
-   * Creates a new load balancer using the provided algorithm.
-   *
-   * @param algorithm
-   *          The load balancing algorithm which will be used to obtain the next
-   *          connection factory.
-   */
-  public LoadBalancer(final LoadBalancingAlgorithm algorithm)
-  {
-    Validator.ensureNotNull(algorithm);
-    this.algorithm = algorithm;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    return algorithm.getConnectionFactory().getConnection();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> resultHandler)
-  {
-    final ConnectionFactory factory;
-
-    try
-    {
-      factory = algorithm.getConnectionFactory();
-    }
-    catch (final ErrorResultException e)
-    {
-      if (resultHandler != null)
-      {
-        resultHandler.handleErrorResult(e);
-      }
-      return new CompletedFutureResult<Connection>(e);
+    /**
+     * Creates a new load balancer using the provided algorithm.
+     *
+     * @param algorithm
+     *            The load balancing algorithm which will be used to obtain the
+     *            next connection factory.
+     */
+    public LoadBalancer(final LoadBalancingAlgorithm algorithm) {
+        Validator.ensureNotNull(algorithm);
+        this.algorithm = algorithm;
     }
 
-    return factory.getConnectionAsync(resultHandler);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        return algorithm.getConnectionFactory().getConnection();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> resultHandler) {
+        final ConnectionFactory factory;
 
+        try {
+            factory = algorithm.getConnectionFactory();
+        } catch (final ErrorResultException e) {
+            if (resultHandler != null) {
+                resultHandler.handleErrorResult(e);
+            }
+            return new CompletedFutureResult<Connection>(e);
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("LoadBalancer(");
-    builder.append(String.valueOf(algorithm));
-    builder.append(')');
-    return builder.toString();
-  }
+        return factory.getConnectionAsync(resultHandler);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("LoadBalancer(");
+        builder.append(String.valueOf(algorithm));
+        builder.append(')');
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java
index 3f588e6..9e2e9ec 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,23 +26,20 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A load balancing algorithm distributes connection requests across one or more
  * underlying connection factories in an implementation defined manner.
  *
  * @see Connections#newLoadBalancer(LoadBalancingAlgorithm) newLoadBalancer
  */
-public interface LoadBalancingAlgorithm
-{
-  /**
-   * Returns a connection factory which should be used in order to satisfy the
-   * next connection request.
-   *
-   * @return The connection factory.
-   * @throws ErrorResultException
-   *           If no connection factories are available for use.
-   */
-  ConnectionFactory getConnectionFactory() throws ErrorResultException;
+public interface LoadBalancingAlgorithm {
+    /**
+     * Returns a connection factory which should be used in order to satisfy the
+     * next connection request.
+     *
+     * @return The connection factory.
+     * @throws ErrorResultException
+     *             If no connection factories are available for use.
+     */
+    ConnectionFactory getConnectionFactory() throws ErrorResultException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java
index 6cec11f..ebc8d16 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Matcher.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.DEBUG_LOG;
 
 import java.util.ArrayList;
@@ -43,804 +40,564 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An interface for determining whether entries match a {@code Filter}.
  */
-public final class Matcher
-{
-  private static final class AndMatcherImpl extends MatcherImpl
-  {
-    private final List<MatcherImpl> subMatchers;
+public final class Matcher {
+    private static final class AndMatcherImpl extends MatcherImpl {
+        private final List<MatcherImpl> subMatchers;
 
-
-
-    private AndMatcherImpl(final List<MatcherImpl> subMatchers)
-    {
-      this.subMatchers = subMatchers;
-    }
-
-
-
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      ConditionResult r = ConditionResult.TRUE;
-      for (final MatcherImpl m : subMatchers)
-      {
-        final ConditionResult p = m.matches(entry);
-        if (p == ConditionResult.FALSE)
-        {
-          return p;
+        private AndMatcherImpl(final List<MatcherImpl> subMatchers) {
+            this.subMatchers = subMatchers;
         }
-        r = ConditionResult.and(r, p);
-      }
-      return r;
-    }
-  }
 
-
-
-  private static final class AssertionMatcherImpl extends MatcherImpl
-  {
-    private final Assertion assertion;
-
-    private final AttributeDescription attributeDescription;
-
-    private final boolean dnAttributes;
-
-    private final MatchingRule rule;
-
-    private final MatchingRuleUse ruleUse;
-
-
-
-    private AssertionMatcherImpl(
-        final AttributeDescription attributeDescription,
-        final MatchingRule rule, final MatchingRuleUse ruleUse,
-        final Assertion assertion, final boolean dnAttributes)
-    {
-      this.attributeDescription = attributeDescription;
-      this.rule = rule;
-      this.ruleUse = ruleUse;
-      this.assertion = assertion;
-      this.dnAttributes = dnAttributes;
-    }
-
-
-
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      ConditionResult r = ConditionResult.FALSE;
-      if (attributeDescription != null)
-      {
-        // If the matchingRule field is absent, the type field will be
-        // present and the default equality matching rule is used,
-        // and an equality match is performed for that type.
-
-        // If the type field is present and the matchingRule is present,
-        // the matchValue is compared against the specified attribute
-        // type and its subtypes.
-        final ConditionResult p = Matcher.matches(entry
-            .getAttribute(attributeDescription), rule, assertion);
-        if (p == ConditionResult.TRUE)
-        {
-          return p;
-        }
-        r = ConditionResult.or(r, p);
-      }
-      else
-      {
-        // If the type field is absent and the matchingRule is present,
-        // the matchValue is compared against all attributes in an entry
-        // that support that matchingRule.
-        for (final Attribute a : entry.getAllAttributes())
-        {
-          if (ruleUse.hasAttribute(a.getAttributeDescription()
-              .getAttributeType()))
-          {
-            final ConditionResult p = Matcher.matches(a, rule, assertion);
-            if (p == ConditionResult.TRUE)
-            {
-              return p;
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            ConditionResult r = ConditionResult.TRUE;
+            for (final MatcherImpl m : subMatchers) {
+                final ConditionResult p = m.matches(entry);
+                if (p == ConditionResult.FALSE) {
+                    return p;
+                }
+                r = ConditionResult.and(r, p);
             }
-            r = ConditionResult.or(r, p);
-          }
+            return r;
         }
-      }
+    }
 
-      if (dnAttributes)
-      {
-        // If the dnAttributes field is set to TRUE, the match is
-        // additionally applied against all the AttributeValueAssertions
-        // in an entry's distinguished name, and it evaluates to TRUE if
-        // there is at least one attribute or subtype in the
-        // distinguished name for which the filter item evaluates to
-        // TRUE.
-        final DN dn = entry.getName();
-        for (final RDN rdn : dn)
-        {
-          for (final AVA ava : rdn)
-          {
-            if (ruleUse.hasAttribute(ava.getAttributeType()))
-            {
-              final ConditionResult p = Matcher.matches(
-                  ava.getAttributeValue(), rule, assertion);
-              if (p == ConditionResult.TRUE)
-              {
-                return p;
-              }
-              r = ConditionResult.or(r, p);
+    private static final class AssertionMatcherImpl extends MatcherImpl {
+        private final Assertion assertion;
+
+        private final AttributeDescription attributeDescription;
+
+        private final boolean dnAttributes;
+
+        private final MatchingRule rule;
+
+        private final MatchingRuleUse ruleUse;
+
+        private AssertionMatcherImpl(final AttributeDescription attributeDescription,
+                final MatchingRule rule, final MatchingRuleUse ruleUse, final Assertion assertion,
+                final boolean dnAttributes) {
+            this.attributeDescription = attributeDescription;
+            this.rule = rule;
+            this.ruleUse = ruleUse;
+            this.assertion = assertion;
+            this.dnAttributes = dnAttributes;
+        }
+
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            ConditionResult r = ConditionResult.FALSE;
+            if (attributeDescription != null) {
+                // If the matchingRule field is absent, the type field will be
+                // present and the default equality matching rule is used,
+                // and an equality match is performed for that type.
+
+                // If the type field is present and the matchingRule is present,
+                // the matchValue is compared against the specified attribute
+                // type and its subtypes.
+                final ConditionResult p =
+                        Matcher.matches(entry.getAttribute(attributeDescription), rule, assertion);
+                if (p == ConditionResult.TRUE) {
+                    return p;
+                }
+                r = ConditionResult.or(r, p);
+            } else {
+                // If the type field is absent and the matchingRule is present,
+                // the matchValue is compared against all attributes in an entry
+                // that support that matchingRule.
+                for (final Attribute a : entry.getAllAttributes()) {
+                    if (ruleUse.hasAttribute(a.getAttributeDescription().getAttributeType())) {
+                        final ConditionResult p = Matcher.matches(a, rule, assertion);
+                        if (p == ConditionResult.TRUE) {
+                            return p;
+                        }
+                        r = ConditionResult.or(r, p);
+                    }
+                }
             }
-          }
+
+            if (dnAttributes) {
+                // If the dnAttributes field is set to TRUE, the match is
+                // additionally applied against all the AttributeValueAssertions
+                // in an entry's distinguished name, and it evaluates to TRUE if
+                // there is at least one attribute or subtype in the
+                // distinguished name for which the filter item evaluates to
+                // TRUE.
+                final DN dn = entry.getName();
+                for (final RDN rdn : dn) {
+                    for (final AVA ava : rdn) {
+                        if (ruleUse.hasAttribute(ava.getAttributeType())) {
+                            final ConditionResult p =
+                                    Matcher.matches(ava.getAttributeValue(), rule, assertion);
+                            if (p == ConditionResult.TRUE) {
+                                return p;
+                            }
+                            r = ConditionResult.or(r, p);
+                        }
+                    }
+                }
+            }
+            return r;
         }
-      }
-      return r;
-    }
-  }
-
-
-
-  private static class FalseMatcherImpl extends MatcherImpl
-  {
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      return ConditionResult.FALSE;
-    }
-  }
-
-
-
-  private static abstract class MatcherImpl
-  {
-    public abstract ConditionResult matches(Entry entry);
-  }
-
-
-
-  private static final class NotMatcherImpl extends MatcherImpl
-  {
-    private final MatcherImpl subFilter;
-
-
-
-    private NotMatcherImpl(final MatcherImpl subFilter)
-    {
-      this.subFilter = subFilter;
     }
 
-
-
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      return ConditionResult.not(subFilter.matches(entry));
-    }
-  }
-
-
-
-  private static final class OrMatcherImpl extends MatcherImpl
-  {
-    private final List<MatcherImpl> subMatchers;
-
-
-
-    private OrMatcherImpl(final List<MatcherImpl> subMatchers)
-    {
-      this.subMatchers = subMatchers;
+    private static class FalseMatcherImpl extends MatcherImpl {
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            return ConditionResult.FALSE;
+        }
     }
 
-
-
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      ConditionResult r = ConditionResult.FALSE;
-      for (final MatcherImpl m : subMatchers)
-      {
-        final ConditionResult p = m.matches(entry);
-        if (p == ConditionResult.TRUE)
-        {
-          return p;
-        }
-        r = ConditionResult.or(r, p);
-      }
-      return r;
-    }
-  }
-
-
-
-  private static final class PresentMatcherImpl extends MatcherImpl
-  {
-    private final AttributeDescription attribute;
-
-
-
-    private PresentMatcherImpl(final AttributeDescription attribute)
-    {
-      this.attribute = attribute;
+    private static abstract class MatcherImpl {
+        public abstract ConditionResult matches(Entry entry);
     }
 
+    private static final class NotMatcherImpl extends MatcherImpl {
+        private final MatcherImpl subFilter;
 
-
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      return entry.getAttribute(attribute) == null ? ConditionResult.FALSE
-          : ConditionResult.TRUE;
-    }
-  }
-
-
-
-  private static class TrueMatcherImpl extends MatcherImpl
-  {
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      return ConditionResult.TRUE;
-    }
-  }
-
-
-
-  private static class UndefinedMatcherImpl extends MatcherImpl
-  {
-    @Override
-    public ConditionResult matches(final Entry entry)
-    {
-      return ConditionResult.UNDEFINED;
-    }
-  }
-
-
-
-  /**
-   * A visitor which is used to transform a filter into a matcher.
-   */
-  private static final class Visitor implements
-      FilterVisitor<MatcherImpl, Schema>
-  {
-    public MatcherImpl visitAndFilter(final Schema schema,
-        final List<Filter> subFilters)
-    {
-      if (subFilters.isEmpty())
-      {
-        if (DEBUG_LOG.isLoggable(Level.FINER))
-        {
-          DEBUG_LOG.finer("Empty add filter component. "
-              + "Will always return TRUE");
+        private NotMatcherImpl(final MatcherImpl subFilter) {
+            this.subFilter = subFilter;
         }
-        return TRUE;
-      }
 
-      final List<MatcherImpl> subMatchers = new ArrayList<MatcherImpl>(
-          subFilters.size());
-      for (final Filter f : subFilters)
-      {
-        subMatchers.add(f.accept(this, schema));
-      }
-      return new AndMatcherImpl(subMatchers);
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            return ConditionResult.not(subFilter.matches(entry));
+        }
     }
 
+    private static final class OrMatcherImpl extends MatcherImpl {
+        private final List<MatcherImpl> subMatchers;
 
-
-    public MatcherImpl visitApproxMatchFilter(final Schema schema,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      AttributeDescription ad;
-      MatchingRule rule;
-      Assertion assertion;
-
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
+        private OrMatcherImpl(final List<MatcherImpl> subMatchers) {
+            this.subMatchers = subMatchers;
         }
-        return UNDEFINED;
-      }
 
-      if ((rule = ad.getAttributeType().getApproximateMatchingRule()) == null)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The attribute type " + attributeDescription
-              + " does not define an approximate matching rule");
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            ConditionResult r = ConditionResult.FALSE;
+            for (final MatcherImpl m : subMatchers) {
+                final ConditionResult p = m.matches(entry);
+                if (p == ConditionResult.TRUE) {
+                    return p;
+                }
+                r = ConditionResult.or(r, p);
+            }
+            return r;
         }
-        return UNDEFINED;
-      }
-
-      try
-      {
-        assertion = rule.getAssertion(assertionValue);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The assertion value " + assertionValue
-              + " is invalid: " + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, null, assertion, false);
     }
 
+    private static final class PresentMatcherImpl extends MatcherImpl {
+        private final AttributeDescription attribute;
 
-
-    public MatcherImpl visitEqualityMatchFilter(final Schema schema,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      AttributeDescription ad;
-      MatchingRule rule;
-      Assertion assertion;
-
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
+        private PresentMatcherImpl(final AttributeDescription attribute) {
+            this.attribute = attribute;
         }
-        return UNDEFINED;
-      }
 
-      if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The attribute type " + attributeDescription
-              + " does not define an equality matching rule");
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            return entry.getAttribute(attribute) == null ? ConditionResult.FALSE
+                    : ConditionResult.TRUE;
         }
-        return UNDEFINED;
-      }
-
-      try
-      {
-        assertion = rule.getAssertion(assertionValue);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The assertion value " + assertionValue
-              + " is invalid: " + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, null, assertion, false);
     }
 
-
-
-    public MatcherImpl visitExtensibleMatchFilter(final Schema schema,
-        final String matchingRule, final String attributeDescription,
-        final ByteString assertionValue, final boolean dnAttributes)
-    {
-      AttributeDescription ad = null;
-      MatchingRule rule = null;
-      MatchingRuleUse ruleUse = null;
-      Assertion assertion;
-
-      if (matchingRule != null)
-      {
-        try
-        {
-          rule = schema.getMatchingRule(matchingRule);
+    private static class TrueMatcherImpl extends MatcherImpl {
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            return ConditionResult.TRUE;
         }
-        catch (final UnknownSchemaElementException e)
-        {
-          if (DEBUG_LOG.isLoggable(Level.WARNING))
-          {
-            DEBUG_LOG.warning("Matching rule " + matchingRule
-                + " is not recognized: " + e.getMessage());
-          }
-          return UNDEFINED;
-        }
-      }
+    }
 
-      if (attributeDescription != null)
-      {
-        try
-        {
-          ad = AttributeDescription.valueOf(attributeDescription, schema);
+    private static class UndefinedMatcherImpl extends MatcherImpl {
+        @Override
+        public ConditionResult matches(final Entry entry) {
+            return ConditionResult.UNDEFINED;
         }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          if (DEBUG_LOG.isLoggable(Level.WARNING))
-          {
-            DEBUG_LOG.warning("Attribute description " + attributeDescription
-                + " is not recognized: " + e.getMessage());
-          }
-          return UNDEFINED;
+    }
+
+    /**
+     * A visitor which is used to transform a filter into a matcher.
+     */
+    private static final class Visitor implements FilterVisitor<MatcherImpl, Schema> {
+        public MatcherImpl visitAndFilter(final Schema schema, final List<Filter> subFilters) {
+            if (subFilters.isEmpty()) {
+                if (DEBUG_LOG.isLoggable(Level.FINER)) {
+                    DEBUG_LOG.finer("Empty add filter component. " + "Will always return TRUE");
+                }
+                return TRUE;
+            }
+
+            final List<MatcherImpl> subMatchers = new ArrayList<MatcherImpl>(subFilters.size());
+            for (final Filter f : subFilters) {
+                subMatchers.add(f.accept(this, schema));
+            }
+            return new AndMatcherImpl(subMatchers);
         }
 
-        if (rule == null)
-        {
-          if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null)
-          {
-            if (DEBUG_LOG.isLoggable(Level.WARNING))
-            {
-              DEBUG_LOG.warning("The attribute type " + attributeDescription
-                  + " does not define an equality matching rule");
+        public MatcherImpl visitApproxMatchFilter(final Schema schema,
+                final String attributeDescription, final ByteString assertionValue) {
+            AttributeDescription ad;
+            MatchingRule rule;
+            Assertion assertion;
+
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            if ((rule = ad.getAttributeType().getApproximateMatchingRule()) == null) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The attribute type " + attributeDescription
+                            + " does not define an approximate matching rule");
+                }
+                return UNDEFINED;
+            }
+
+            try {
+                assertion = rule.getAssertion(assertionValue);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+        }
+
+        public MatcherImpl visitEqualityMatchFilter(final Schema schema,
+                final String attributeDescription, final ByteString assertionValue) {
+            AttributeDescription ad;
+            MatchingRule rule;
+            Assertion assertion;
+
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The attribute type " + attributeDescription
+                            + " does not define an equality matching rule");
+                }
+                return UNDEFINED;
+            }
+
+            try {
+                assertion = rule.getAssertion(assertionValue);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+        }
+
+        public MatcherImpl visitExtensibleMatchFilter(final Schema schema,
+                final String matchingRule, final String attributeDescription,
+                final ByteString assertionValue, final boolean dnAttributes) {
+            AttributeDescription ad = null;
+            MatchingRule rule = null;
+            MatchingRuleUse ruleUse = null;
+            Assertion assertion;
+
+            if (matchingRule != null) {
+                try {
+                    rule = schema.getMatchingRule(matchingRule);
+                } catch (final UnknownSchemaElementException e) {
+                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                        DEBUG_LOG.warning("Matching rule " + matchingRule + " is not recognized: "
+                                + e.getMessage());
+                    }
+                    return UNDEFINED;
+                }
+            }
+
+            if (attributeDescription != null) {
+                try {
+                    ad = AttributeDescription.valueOf(attributeDescription, schema);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                        DEBUG_LOG.warning("Attribute description " + attributeDescription
+                                + " is not recognized: " + e.getMessage());
+                    }
+                    return UNDEFINED;
+                }
+
+                if (rule == null) {
+                    if ((rule = ad.getAttributeType().getEqualityMatchingRule()) == null) {
+                        if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                            DEBUG_LOG.warning("The attribute type " + attributeDescription
+                                    + " does not define an equality matching rule");
+                        }
+                        return UNDEFINED;
+                    }
+                } else {
+                    try {
+                        ruleUse = schema.getMatchingRuleUse(rule);
+                    } catch (final UnknownSchemaElementException e) {
+                        if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                            DEBUG_LOG.warning("No matching rule use is defined for "
+                                    + "matching rule " + matchingRule);
+                            return UNDEFINED;
+                        }
+                    }
+                    if (!ruleUse.hasAttribute(ad.getAttributeType())) {
+                        if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                            DEBUG_LOG.warning("The matching rule " + matchingRule
+                                    + " is not valid for attribute type " + attributeDescription);
+                        }
+                        return UNDEFINED;
+                    }
+                }
+            } else {
+                try {
+                    ruleUse = schema.getMatchingRuleUse(rule);
+                } catch (final UnknownSchemaElementException e) {
+                    if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                        DEBUG_LOG.warning("No matching rule use is defined for " + "matching rule "
+                                + matchingRule);
+                    }
+                    return UNDEFINED;
+                }
+            }
+
+            try {
+                assertion = rule.getAssertion(assertionValue);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, ruleUse, assertion, dnAttributes);
+        }
+
+        public MatcherImpl visitGreaterOrEqualFilter(final Schema schema,
+                final String attributeDescription, final ByteString assertionValue) {
+            AttributeDescription ad;
+            MatchingRule rule;
+            Assertion assertion;
+
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The attribute type " + attributeDescription
+                            + " does not define an ordering matching rule");
+                }
+                return UNDEFINED;
+            }
+
+            try {
+                assertion = rule.getGreaterOrEqualAssertion(assertionValue);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+        }
+
+        public MatcherImpl visitLessOrEqualFilter(final Schema schema,
+                final String attributeDescription, final ByteString assertionValue) {
+            AttributeDescription ad;
+            MatchingRule rule;
+            Assertion assertion;
+
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The attribute type " + attributeDescription
+                            + " does not define an ordering matching rule");
+                }
+                return UNDEFINED;
+            }
+
+            try {
+                assertion = rule.getLessOrEqualAssertion(assertionValue);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The assertion value " + assertionValue + " is invalid: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+        }
+
+        public MatcherImpl visitNotFilter(final Schema schema, final Filter subFilter) {
+            final MatcherImpl subMatcher = subFilter.accept(this, schema);
+            return new NotMatcherImpl(subMatcher);
+        }
+
+        public MatcherImpl visitOrFilter(final Schema schema, final List<Filter> subFilters) {
+            if (subFilters.isEmpty()) {
+                if (DEBUG_LOG.isLoggable(Level.FINER)) {
+                    DEBUG_LOG.finer("Empty or filter component. " + "Will always return FALSE");
+                }
+                return FALSE;
+            }
+
+            final List<MatcherImpl> subMatchers = new ArrayList<MatcherImpl>(subFilters.size());
+            for (final Filter f : subFilters) {
+                subMatchers.add(f.accept(this, schema));
+            }
+            return new OrMatcherImpl(subMatchers);
+        }
+
+        public MatcherImpl visitPresentFilter(final Schema schema, final String attributeDescription) {
+            AttributeDescription ad;
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            return new PresentMatcherImpl(ad);
+        }
+
+        public MatcherImpl visitSubstringsFilter(final Schema schema,
+                final String attributeDescription, final ByteString initialSubstring,
+                final List<ByteString> anySubstrings, final ByteString finalSubstring) {
+            AttributeDescription ad;
+            MatchingRule rule;
+            Assertion assertion;
+
+            try {
+                ad = AttributeDescription.valueOf(attributeDescription, schema);
+            } catch (final LocalizedIllegalArgumentException e) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("Attribute description " + attributeDescription
+                            + " is not recognized: " + e.getMessage());
+                }
+                return UNDEFINED;
+            }
+
+            if ((rule = ad.getAttributeType().getSubstringMatchingRule()) == null) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The attribute type " + attributeDescription
+                            + " does not define an substring matching rule");
+                }
+                return UNDEFINED;
+            }
+
+            try {
+                assertion = rule.getAssertion(initialSubstring, anySubstrings, finalSubstring);
+            } catch (final DecodeException de) {
+                if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                    DEBUG_LOG.warning("The substring assertion values contain an invalid value: "
+                            + de.getMessage());
+                }
+                return UNDEFINED;
+            }
+            return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+        }
+
+        public MatcherImpl visitUnrecognizedFilter(final Schema schema, final byte filterTag,
+                final ByteString filterBytes) {
+            if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                DEBUG_LOG.warning("The type of filtering requested with tag "
+                        + StaticUtils.byteToHex(filterTag) + " is not implemented");
             }
             return UNDEFINED;
-          }
         }
-        else
-        {
-          try
-          {
-            ruleUse = schema.getMatchingRuleUse(rule);
-          }
-          catch (final UnknownSchemaElementException e)
-          {
-            if (DEBUG_LOG.isLoggable(Level.WARNING))
-            {
-              DEBUG_LOG.warning("No matching rule use is defined for "
-                  + "matching rule " + matchingRule);
-              return UNDEFINED;
+    }
+
+    private static final MatcherImpl FALSE = new FalseMatcherImpl();
+
+    private static final MatcherImpl TRUE = new TrueMatcherImpl();
+
+    private static final MatcherImpl UNDEFINED = new UndefinedMatcherImpl();
+
+    private static final FilterVisitor<MatcherImpl, Schema> VISITOR = new Visitor();
+
+    private static ConditionResult matches(final Attribute a, final MatchingRule rule,
+            final Assertion assertion) {
+
+        ConditionResult r = ConditionResult.FALSE;
+        if (a != null) {
+            for (final ByteString v : a) {
+                switch (matches(v, rule, assertion)) {
+                case TRUE:
+                    return ConditionResult.TRUE;
+                case UNDEFINED:
+                    r = ConditionResult.UNDEFINED;
+                }
             }
-          }
-          if (!ruleUse.hasAttribute(ad.getAttributeType()))
-          {
-            if (DEBUG_LOG.isLoggable(Level.WARNING))
-            {
-              DEBUG_LOG.warning("The matching rule " + matchingRule
-                  + " is not valid for attribute type " + attributeDescription);
+        }
+        return r;
+    }
+
+    private static ConditionResult matches(final ByteString v, final MatchingRule rule,
+            final Assertion assertion) {
+        try {
+            final ByteString normalizedValue = rule.normalizeAttributeValue(v);
+            return assertion.matches(normalizedValue);
+        } catch (final DecodeException de) {
+            if (DEBUG_LOG.isLoggable(Level.WARNING)) {
+                DEBUG_LOG.warning("The attribute value " + v.toString() + " is "
+                        + "invalid for matching rule " + rule.getNameOrOID()
+                        + ". Possible schema error? : " + de.getMessage());
             }
-            return UNDEFINED;
-          }
+            return ConditionResult.UNDEFINED;
         }
-      }
-      else
-      {
-        try
-        {
-          ruleUse = schema.getMatchingRuleUse(rule);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          if (DEBUG_LOG.isLoggable(Level.WARNING))
-          {
-            DEBUG_LOG.warning("No matching rule use is defined for "
-                + "matching rule " + matchingRule);
-          }
-          return UNDEFINED;
-        }
-      }
-
-      try
-      {
-        assertion = rule.getAssertion(assertionValue);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The assertion value " + assertionValue
-              + " is invalid: " + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, ruleUse, assertion,
-          dnAttributes);
     }
 
+    private final MatcherImpl impl;
 
-
-    public MatcherImpl visitGreaterOrEqualFilter(final Schema schema,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      AttributeDescription ad;
-      MatchingRule rule;
-      Assertion assertion;
-
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
-        }
-        return UNDEFINED;
-      }
-
-      if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The attribute type " + attributeDescription
-              + " does not define an ordering matching rule");
-        }
-        return UNDEFINED;
-      }
-
-      try
-      {
-        assertion = rule.getGreaterOrEqualAssertion(assertionValue);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The assertion value " + assertionValue
-              + " is invalid: " + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+    Matcher(final Filter filter, final Schema schema) {
+        this.impl = filter.accept(VISITOR, schema);
     }
 
-
-
-    public MatcherImpl visitLessOrEqualFilter(final Schema schema,
-        final String attributeDescription, final ByteString assertionValue)
-    {
-      AttributeDescription ad;
-      MatchingRule rule;
-      Assertion assertion;
-
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
-        }
-        return UNDEFINED;
-      }
-
-      if ((rule = ad.getAttributeType().getOrderingMatchingRule()) == null)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The attribute type " + attributeDescription
-              + " does not define an ordering matching rule");
-        }
-        return UNDEFINED;
-      }
-
-      try
-      {
-        assertion = rule.getLessOrEqualAssertion(assertionValue);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The assertion value " + assertionValue
-              + " is invalid: " + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, null, assertion, false);
+    /**
+     * Indicates whether this filter {@code Matcher} matches the provided
+     * {@code Entry}.
+     *
+     * @param entry
+     *            The entry to be matched.
+     * @return The result of matching the provided {@code Entry} against this
+     *         filter {@code Matcher}.
+     */
+    public ConditionResult matches(final Entry entry) {
+        return impl.matches(entry);
     }
-
-
-
-    public MatcherImpl visitNotFilter(final Schema schema,
-        final Filter subFilter)
-    {
-      final MatcherImpl subMatcher = subFilter.accept(this, schema);
-      return new NotMatcherImpl(subMatcher);
-    }
-
-
-
-    public MatcherImpl visitOrFilter(final Schema schema,
-        final List<Filter> subFilters)
-    {
-      if (subFilters.isEmpty())
-      {
-        if (DEBUG_LOG.isLoggable(Level.FINER))
-        {
-          DEBUG_LOG.finer("Empty or filter component. "
-              + "Will always return FALSE");
-        }
-        return FALSE;
-      }
-
-      final List<MatcherImpl> subMatchers = new ArrayList<MatcherImpl>(
-          subFilters.size());
-      for (final Filter f : subFilters)
-      {
-        subMatchers.add(f.accept(this, schema));
-      }
-      return new OrMatcherImpl(subMatchers);
-    }
-
-
-
-    public MatcherImpl visitPresentFilter(final Schema schema,
-        final String attributeDescription)
-    {
-      AttributeDescription ad;
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
-        }
-        return UNDEFINED;
-      }
-
-      return new PresentMatcherImpl(ad);
-    }
-
-
-
-    public MatcherImpl visitSubstringsFilter(final Schema schema,
-        final String attributeDescription, final ByteString initialSubstring,
-        final List<ByteString> anySubstrings, final ByteString finalSubstring)
-    {
-      AttributeDescription ad;
-      MatchingRule rule;
-      Assertion assertion;
-
-      try
-      {
-        ad = AttributeDescription.valueOf(attributeDescription, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("Attribute description " + attributeDescription
-              + " is not recognized: " + e.getMessage());
-        }
-        return UNDEFINED;
-      }
-
-      if ((rule = ad.getAttributeType().getSubstringMatchingRule()) == null)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG.warning("The attribute type " + attributeDescription
-              + " does not define an substring matching rule");
-        }
-        return UNDEFINED;
-      }
-
-      try
-      {
-        assertion = rule.getAssertion(initialSubstring, anySubstrings,
-            finalSubstring);
-      }
-      catch (final DecodeException de)
-      {
-        if (DEBUG_LOG.isLoggable(Level.WARNING))
-        {
-          DEBUG_LOG
-              .warning("The substring assertion values contain an invalid value: "
-                  + de.getMessage());
-        }
-        return UNDEFINED;
-      }
-      return new AssertionMatcherImpl(ad, rule, null, assertion, false);
-    }
-
-
-
-    public MatcherImpl visitUnrecognizedFilter(final Schema schema,
-        final byte filterTag, final ByteString filterBytes)
-    {
-      if (DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        DEBUG_LOG.warning("The type of filtering requested with tag "
-            + StaticUtils.byteToHex(filterTag) + " is not implemented");
-      }
-      return UNDEFINED;
-    }
-  }
-
-
-
-  private static final MatcherImpl FALSE = new FalseMatcherImpl();
-
-  private static final MatcherImpl TRUE = new TrueMatcherImpl();
-
-  private static final MatcherImpl UNDEFINED = new UndefinedMatcherImpl();
-
-  private static final FilterVisitor<MatcherImpl, Schema> VISITOR = new Visitor();
-
-
-
-  private static ConditionResult matches(final Attribute a,
-      final MatchingRule rule, final Assertion assertion)
-  {
-
-    ConditionResult r = ConditionResult.FALSE;
-    if (a != null)
-    {
-      for (final ByteString v : a)
-      {
-        switch (matches(v, rule, assertion))
-        {
-        case TRUE:
-          return ConditionResult.TRUE;
-        case UNDEFINED:
-          r = ConditionResult.UNDEFINED;
-        }
-      }
-    }
-    return r;
-  }
-
-
-
-  private static ConditionResult matches(final ByteString v,
-      final MatchingRule rule, final Assertion assertion)
-  {
-    try
-    {
-      final ByteString normalizedValue = rule.normalizeAttributeValue(v);
-      return assertion.matches(normalizedValue);
-    }
-    catch (final DecodeException de)
-    {
-      if (DEBUG_LOG.isLoggable(Level.WARNING))
-      {
-        DEBUG_LOG.warning("The attribute value " + v.toString() + " is "
-            + "invalid for matching rule " + rule.getNameOrOID()
-            + ". Possible schema error? : " + de.getMessage());
-      }
-      return ConditionResult.UNDEFINED;
-    }
-  }
-
-
-
-  private final MatcherImpl impl;
-
-
-
-  Matcher(final Filter filter, final Schema schema)
-  {
-    this.impl = filter.accept(VISITOR, schema);
-  }
-
-
-
-  /**
-   * Indicates whether this filter {@code Matcher} matches the provided
-   * {@code Entry}.
-   *
-   * @param entry
-   *          The entry to be matched.
-   * @return The result of matching the provided {@code Entry} against this
-   *         filter {@code Matcher}.
-   */
-  public ConditionResult matches(final Entry entry)
-  {
-    return impl.matches(entry);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Modification.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Modification.java
index 03cffab..1e05070 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Modification.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Modification.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,99 +26,78 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A modification to be performed on an entry during a Modify operation.
  */
-public final class Modification
-{
-  private final ModificationType modificationType;
+public final class Modification {
+    private final ModificationType modificationType;
 
-  private final Attribute attribute;
+    private final Attribute attribute;
 
+    /**
+     * Creates a new modification having the provided modification type and
+     * attribute values to be updated. Note that while the returned
+     * {@code Modification} is immutable, the underlying attribute may not be.
+     * The following code ensures that the returned {@code Modification} is
+     * fully immutable:
+     *
+     * <pre>
+     * Modification change = new Modification(modificationType, Types.unmodifiableAttribute(attribute));
+     * </pre>
+     *
+     * @param modificationType
+     *            The type of modification to be performed.
+     * @param attribute
+     *            The the attribute containing the values to be modified.
+     */
+    public Modification(final ModificationType modificationType, final Attribute attribute) {
+        Validator.ensureNotNull(modificationType, attribute);
 
-
-  /**
-   * Creates a new modification having the provided modification type and
-   * attribute values to be updated. Note that while the returned {@code
-   * Modification} is immutable, the underlying attribute may not be. The
-   * following code ensures that the returned {@code Modification} is fully
-   * immutable:
-   *
-   * <pre>
-   * Modification change = new Modification(modificationType, Types
-   *     .unmodifiableAttribute(attribute));
-   * </pre>
-   *
-   * @param modificationType
-   *          The type of modification to be performed.
-   * @param attribute
-   *          The the attribute containing the values to be modified.
-   */
-  public Modification(final ModificationType modificationType,
-      final Attribute attribute)
-  {
-    Validator.ensureNotNull(modificationType, attribute);
-
-    this.modificationType = modificationType;
-    this.attribute = attribute;
-  }
-
-
-
-  /**
-   * Returns the attribute containing the values to be modified.
-   *
-   * @return The the attribute containing the values to be modified.
-   */
-  public Attribute getAttribute()
-  {
-    return attribute;
-  }
-
-
-
-  /**
-   * Returns the type of modification to be performed.
-   *
-   * @return The type of modification to be performed.
-   */
-  public ModificationType getModificationType()
-  {
-    return modificationType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("Modification(modificationType=");
-    builder.append(modificationType);
-    builder.append(", attributeDescription=");
-    builder.append(attribute.getAttributeDescriptionAsString());
-    builder.append(", attributeValues={");
-    boolean firstValue = true;
-    for (final ByteString value : attribute)
-    {
-      if (!firstValue)
-      {
-        builder.append(", ");
-      }
-      builder.append(value);
-      firstValue = false;
+        this.modificationType = modificationType;
+        this.attribute = attribute;
     }
-    builder.append("})");
-    return builder.toString();
-  }
+
+    /**
+     * Returns the attribute containing the values to be modified.
+     *
+     * @return The the attribute containing the values to be modified.
+     */
+    public Attribute getAttribute() {
+        return attribute;
+    }
+
+    /**
+     * Returns the type of modification to be performed.
+     *
+     * @return The type of modification to be performed.
+     */
+    public ModificationType getModificationType() {
+        return modificationType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("Modification(modificationType=");
+        builder.append(modificationType);
+        builder.append(", attributeDescription=");
+        builder.append(attribute.getAttributeDescriptionAsString());
+        builder.append(", attributeValues={");
+        boolean firstValue = true;
+        for (final ByteString value : attribute) {
+            if (!firstValue) {
+                builder.append(", ");
+            }
+            builder.append(value);
+            firstValue = false;
+        }
+        builder.append("})");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ModificationType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ModificationType.java
index 9063dbf..f921607 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ModificationType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ModificationType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-
-
 /**
  * A Modify operation change type as defined in RFC 4511 section 4.6 is used to
  * specify the type of modification being performed on an attribute.
@@ -44,165 +39,133 @@
  * @see <a href="http://tools.ietf.org/html/rfc4525">RFC 4525 - Lightweight
  *      Directory Access Protocol (LDAP) Modify-Increment Extension </a>
  */
-public final class ModificationType
-{
-  private static final ModificationType[] ELEMENTS = new ModificationType[4];
+public final class ModificationType {
+    private static final ModificationType[] ELEMENTS = new ModificationType[4];
 
-  private static final List<ModificationType> IMMUTABLE_ELEMENTS = Collections
-      .unmodifiableList(Arrays.asList(ELEMENTS));
+    private static final List<ModificationType> IMMUTABLE_ELEMENTS = Collections
+            .unmodifiableList(Arrays.asList(ELEMENTS));
 
-  /**
-   * Add the values listed in the modification to the attribute, creating the
-   * attribute if necessary.
-   */
-  public static final ModificationType ADD = register(0, "add");
+    /**
+     * Add the values listed in the modification to the attribute, creating the
+     * attribute if necessary.
+     */
+    public static final ModificationType ADD = register(0, "add");
 
-  /**
-   * Delete the values listed in the modification from the attribute. If no
-   * values are listed, or if all current values of the attribute are listed,
-   * the entire attribute is removed.
-   */
-  public static final ModificationType DELETE = register(1, "delete");
+    /**
+     * Delete the values listed in the modification from the attribute. If no
+     * values are listed, or if all current values of the attribute are listed,
+     * the entire attribute is removed.
+     */
+    public static final ModificationType DELETE = register(1, "delete");
 
-  /**
-   * Replace all existing values of the attribute with the new values listed in
-   * the modification, creating the attribute if it did not already exist. A
-   * replace with no listed values will delete the entire attribute if it
-   * exists, and it is ignored if the attribute does not exist.
-   */
-  public static final ModificationType REPLACE = register(2, "replace");
+    /**
+     * Replace all existing values of the attribute with the new values listed
+     * in the modification, creating the attribute if it did not already exist.
+     * A replace with no listed values will delete the entire attribute if it
+     * exists, and it is ignored if the attribute does not exist.
+     */
+    public static final ModificationType REPLACE = register(2, "replace");
 
-  /**
-   * Increment all existing values of the attribute by the amount specified in
-   * the modification value.
-   */
-  public static final ModificationType INCREMENT = register(3, "increment");
+    /**
+     * Increment all existing values of the attribute by the amount specified in
+     * the modification value.
+     */
+    public static final ModificationType INCREMENT = register(3, "increment");
 
-
-
-  /**
-   * Returns the modification change type having the specified integer value as
-   * defined in RFC 4511 section 4.6.
-   *
-   * @param intValue
-   *          The integer value of the modification change type.
-   * @return The modification change type, or {@code null} if there was no
-   *         modification change type associated with {@code intValue}.
-   */
-  public static ModificationType valueOf(final int intValue)
-  {
-    if (intValue < 0 || intValue >= ELEMENTS.length)
-    {
-      return null;
+    /**
+     * Returns the modification change type having the specified integer value
+     * as defined in RFC 4511 section 4.6.
+     *
+     * @param intValue
+     *            The integer value of the modification change type.
+     * @return The modification change type, or {@code null} if there was no
+     *         modification change type associated with {@code intValue}.
+     */
+    public static ModificationType valueOf(final int intValue) {
+        if (intValue < 0 || intValue >= ELEMENTS.length) {
+            return null;
+        }
+        return ELEMENTS[intValue];
     }
-    return ELEMENTS[intValue];
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the set of available modification
-   * change types indexed on their integer value as defined in RFC 4511 section
-   * 4.6.
-   *
-   * @return An unmodifiable list containing the set of available modification
-   *         change types.
-   */
-  public static List<ModificationType> values()
-  {
-    return IMMUTABLE_ELEMENTS;
-  }
-
-
-
-  /**
-   * Creates and registers a new modification change type with the application.
-   *
-   * @param intValue
-   *          The integer value of the modification change type as defined in
-   *          RFC 4511 section 4.6.
-   * @param name
-   *          The name of the modification change type.
-   * @return The new modification change type.
-   */
-  private static ModificationType register(final int intValue, final String name)
-  {
-    final ModificationType t = new ModificationType(intValue, name);
-    ELEMENTS[intValue] = t;
-    return t;
-  }
-
-
-
-  private final int intValue;
-
-  private final String name;
-
-
-
-  // Prevent direct instantiation.
-  private ModificationType(final int intValue, final String name)
-  {
-    this.intValue = intValue;
-    this.name = name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
+    /**
+     * Returns an unmodifiable list containing the set of available modification
+     * change types indexed on their integer value as defined in RFC 4511
+     * section 4.6.
+     *
+     * @return An unmodifiable list containing the set of available modification
+     *         change types.
+     */
+    public static List<ModificationType> values() {
+        return IMMUTABLE_ELEMENTS;
     }
-    else if (obj instanceof ModificationType)
-    {
-      return this.intValue == ((ModificationType) obj).intValue;
+
+    /**
+     * Creates and registers a new modification change type with the
+     * application.
+     *
+     * @param intValue
+     *            The integer value of the modification change type as defined
+     *            in RFC 4511 section 4.6.
+     * @param name
+     *            The name of the modification change type.
+     * @return The new modification change type.
+     */
+    private static ModificationType register(final int intValue, final String name) {
+        final ModificationType t = new ModificationType(intValue, name);
+        ELEMENTS[intValue] = t;
+        return t;
     }
-    else
-    {
-      return false;
+
+    private final int intValue;
+
+    private final String name;
+
+    // Prevent direct instantiation.
+    private ModificationType(final int intValue, final String name) {
+        this.intValue = intValue;
+        this.name = name;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof ModificationType) {
+            return this.intValue == ((ModificationType) obj).intValue;
+        } else {
+            return false;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return intValue;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value of this modification change type as defined in
+     * RFC 4511 section 4.6.
+     *
+     * @return The integer value of this modification change type.
+     */
+    public int intValue() {
+        return intValue;
+    }
 
-
-
-  /**
-   * Returns the integer value of this modification change type as defined in
-   * RFC 4511 section 4.6.
-   *
-   * @return The integer value of this modification change type.
-   */
-  public int intValue()
-  {
-    return intValue;
-  }
-
-
-
-  /**
-   * Returns the string representation of this modification change type.
-   *
-   * @return The string representation of this modification change type.
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
+    /**
+     * Returns the string representation of this modification change type.
+     *
+     * @return The string representation of this modification change type.
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java
index db8c526..263372e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the requested
  * single entry search operation or read operation failed because the Directory
@@ -42,10 +37,8 @@
  * CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED} error result codes.
  */
 @SuppressWarnings("serial")
-public class MultipleEntriesFoundException extends ErrorResultException
-{
-  MultipleEntriesFoundException(final Result result)
-  {
-    super(result);
-  }
+public class MultipleEntriesFoundException extends ErrorResultException {
+    MultipleEntriesFoundException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RDN.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RDN.java
index efdf5cf..b12d3a1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RDN.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RDN.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_RDN_TYPE_NOT_FOUND;
 
 import java.util.ArrayList;
@@ -46,8 +43,6 @@
 import com.forgerock.opendj.util.Iterators;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * A relative distinguished name (RDN) as defined in RFC 4512 section 2.3 is the
  * name of an entry relative to its immediate superior. An RDN is composed of an
@@ -74,395 +69,316 @@
  *      Lightweight Directory Access Protocol (LDAP): Directory Information
  *      Models </a>
  */
-public final class RDN implements Iterable<AVA>, Comparable<RDN>
-{
+public final class RDN implements Iterable<AVA>, Comparable<RDN> {
 
-  // A constant holding a special RDN having zero AVAs and which always compares
-  // greater than any other RDN other than itself.
-  private static final RDN MAX_VALUE = new RDN(new AVA[0], "");
+    // A constant holding a special RDN having zero AVAs and which always
+    // compares
+    // greater than any other RDN other than itself.
+    private static final RDN MAX_VALUE = new RDN(new AVA[0], "");
 
-
-
-  /**
-   * Returns a constant containing a special RDN which is greater than any other
-   * RDN other than itself. This RDN may be used in order to perform range
-   * queries on DN keyed collections such as {@code SortedSet}s and
-   * {@code SortedMap}s. For example, the following code can be used to
-   * construct a range whose contents is a sub-tree of entries:
-   *
-   * <pre>
-   * SortedMap<DN, Entry> entries = ...;
-   * DN baseDN = ...;
-   *
-   * // Returns a map containing the baseDN and all of its subordinates.
-   * SortedMap<DN,Entry> subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue));
-   * </pre>
-   *
-   * @return A constant containing a special RDN which is greater than any other
-   *         RDN other than itself.
-   */
-  public static RDN maxValue()
-  {
-    return MAX_VALUE;
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of an RDN using the default
-   * schema.
-   *
-   * @param rdn
-   *          The LDAP string representation of a RDN.
-   * @return The parsed RDN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code rdn} is not a valid LDAP string representation of a
-   *           RDN.
-   * @throws NullPointerException
-   *           If {@code rdn} was {@code null}.
-   */
-  public static RDN valueOf(final String rdn)
-  {
-    return valueOf(rdn, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Parses the provided LDAP string representation of a RDN using the provided
-   * schema.
-   *
-   * @param rdn
-   *          The LDAP string representation of a RDN.
-   * @param schema
-   *          The schema to use when parsing the RDN.
-   * @return The parsed RDN.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code rdn} is not a valid LDAP string representation of a
-   *           RDN.
-   * @throws NullPointerException
-   *           If {@code rdn} or {@code schema} was {@code null}.
-   */
-  public static RDN valueOf(final String rdn, final Schema schema)
-  {
-    final SubstringReader reader = new SubstringReader(rdn);
-    try
-    {
-      return decode(rdn, reader, schema);
+    /**
+     * Returns a constant containing a special RDN which is greater than any
+     * other RDN other than itself. This RDN may be used in order to perform
+     * range queries on DN keyed collections such as {@code SortedSet}s and
+     * {@code SortedMap}s. For example, the following code can be used to
+     * construct a range whose contents is a sub-tree of entries:
+     *
+     * <pre>
+     * SortedMap<DN, Entry> entries = ...;
+     * DN baseDN = ...;
+     *
+     * // Returns a map containing the baseDN and all of its subordinates.
+     * SortedMap<DN,Entry> subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue));
+     * </pre>
+     *
+     * @return A constant containing a special RDN which is greater than any
+     *         other RDN other than itself.
+     */
+    public static RDN maxValue() {
+        return MAX_VALUE;
     }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_RDN_TYPE_NOT_FOUND.get(rdn, e
-          .getMessageObject());
-      throw new LocalizedIllegalArgumentException(message);
+
+    /**
+     * Parses the provided LDAP string representation of an RDN using the
+     * default schema.
+     *
+     * @param rdn
+     *            The LDAP string representation of a RDN.
+     * @return The parsed RDN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code rdn} is not a valid LDAP string representation of a
+     *             RDN.
+     * @throws NullPointerException
+     *             If {@code rdn} was {@code null}.
+     */
+    public static RDN valueOf(final String rdn) {
+        return valueOf(rdn, Schema.getDefaultSchema());
     }
-  }
 
+    /**
+     * Parses the provided LDAP string representation of a RDN using the
+     * provided schema.
+     *
+     * @param rdn
+     *            The LDAP string representation of a RDN.
+     * @param schema
+     *            The schema to use when parsing the RDN.
+     * @return The parsed RDN.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code rdn} is not a valid LDAP string representation of a
+     *             RDN.
+     * @throws NullPointerException
+     *             If {@code rdn} or {@code schema} was {@code null}.
+     */
+    public static RDN valueOf(final String rdn, final Schema schema) {
+        final SubstringReader reader = new SubstringReader(rdn);
+        try {
+            return decode(rdn, reader, schema);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_RDN_TYPE_NOT_FOUND.get(rdn, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(message);
+        }
+    }
 
-
-  // FIXME: ensure that the decoded RDN does not contain multiple AVAs
-  // with the same type.
-  static RDN decode(final String rdnString, final SubstringReader reader,
-      final Schema schema)
-  {
-    final AVA firstAVA = AVA.decode(reader, schema);
-
-    // Skip over any spaces that might be after the attribute value.
-    reader.skipWhitespaces();
-
-    reader.mark();
-    if (reader.remaining() > 0 && reader.read() == '+')
-    {
-      final List<AVA> avas = new ArrayList<AVA>();
-      avas.add(firstAVA);
-
-      do
-      {
-        avas.add(AVA.decode(reader, schema));
+    // FIXME: ensure that the decoded RDN does not contain multiple AVAs
+    // with the same type.
+    static RDN decode(final String rdnString, final SubstringReader reader, final Schema schema) {
+        final AVA firstAVA = AVA.decode(reader, schema);
 
         // Skip over any spaces that might be after the attribute value.
         reader.skipWhitespaces();
 
         reader.mark();
-      }
-      while (reader.remaining() > 0 && reader.read() == '+');
+        if (reader.remaining() > 0 && reader.read() == '+') {
+            final List<AVA> avas = new ArrayList<AVA>();
+            avas.add(firstAVA);
 
-      reader.reset();
-      return new RDN(avas.toArray(new AVA[avas.size()]), null);
-    }
-    else
-    {
-      reader.reset();
-      return new RDN(new AVA[] { firstAVA }, null);
-    }
-  }
+            do {
+                avas.add(AVA.decode(reader, schema));
 
+                // Skip over any spaces that might be after the attribute value.
+                reader.skipWhitespaces();
 
+                reader.mark();
+            } while (reader.remaining() > 0 && reader.read() == '+');
 
-  // In original order.
-  private final AVA[] avas;
-
-  // We need to store the original string value if provided in order to
-  // preserve the original whitespace.
-  private String stringValue;
-
-
-
-  /**
-   * Creates a new RDN using the provided attribute type and value.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param attributeValue
-   *          The attribute value.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code attributeValue} was {@code
-   *           null}.
-   */
-  public RDN(final AttributeType attributeType, final ByteString attributeValue)
-  {
-    this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
-  }
-
-
-
-  /**
-   * Creates a new RDN using the provided attribute type and value decoded using
-   * the default schema.
-   * <p>
-   * If {@code attributeValue} is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @param attributeValue
-   *          The attribute value.
-   * @throws UnknownSchemaElementException
-   *           If {@code attributeType} was not found in the default schema.
-   * @throws NullPointerException
-   *           If {@code attributeType} or {@code attributeValue} was {@code
-   *           null}.
-   */
-  public RDN(final String attributeType, final Object attributeValue)
-  {
-    this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
-  }
-
-
-
-  private RDN(final AVA[] avas, final String stringValue)
-  {
-    this.avas = avas;
-    this.stringValue = stringValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final RDN rdn)
-  {
-    // Identity.
-    if (this == rdn)
-    {
-      return 0;
+            reader.reset();
+            return new RDN(avas.toArray(new AVA[avas.size()]), null);
+        } else {
+            reader.reset();
+            return new RDN(new AVA[] { firstAVA }, null);
+        }
     }
 
-    // MAX_VALUE is always greater than any other RDN other than itself.
-    if (this == MAX_VALUE)
-    {
-      return 1;
+    // In original order.
+    private final AVA[] avas;
+
+    // We need to store the original string value if provided in order to
+    // preserve the original whitespace.
+    private String stringValue;
+
+    /**
+     * Creates a new RDN using the provided attribute type and value.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param attributeValue
+     *            The attribute value.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code attributeValue} was
+     *             {@code null}.
+     */
+    public RDN(final AttributeType attributeType, final ByteString attributeValue) {
+        this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
     }
 
-    if (rdn == MAX_VALUE)
-    {
-      return -1;
+    /**
+     * Creates a new RDN using the provided attribute type and value decoded
+     * using the default schema.
+     * <p>
+     * If {@code attributeValue} is not an instance of {@code ByteString} then
+     * it will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @param attributeValue
+     *            The attribute value.
+     * @throws UnknownSchemaElementException
+     *             If {@code attributeType} was not found in the default schema.
+     * @throws NullPointerException
+     *             If {@code attributeType} or {@code attributeValue} was
+     *             {@code null}.
+     */
+    public RDN(final String attributeType, final Object attributeValue) {
+        this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
     }
 
-    // Compare number of AVAs first as this is quick and easy.
-    final int sz1 = avas.length;
-    final int sz2 = rdn.avas.length;
-    if (sz1 != sz2)
-    {
-      return sz1 - sz2 > 0 ? 1 : -1;
+    private RDN(final AVA[] avas, final String stringValue) {
+        this.avas = avas;
+        this.stringValue = stringValue;
     }
 
-    // Fast path for common case.
-    if (sz1 == 1)
-    {
-      return avas[0].compareTo(rdn.avas[0]);
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final RDN rdn) {
+        // Identity.
+        if (this == rdn) {
+            return 0;
+        }
+
+        // MAX_VALUE is always greater than any other RDN other than itself.
+        if (this == MAX_VALUE) {
+            return 1;
+        }
+
+        if (rdn == MAX_VALUE) {
+            return -1;
+        }
+
+        // Compare number of AVAs first as this is quick and easy.
+        final int sz1 = avas.length;
+        final int sz2 = rdn.avas.length;
+        if (sz1 != sz2) {
+            return sz1 - sz2 > 0 ? 1 : -1;
+        }
+
+        // Fast path for common case.
+        if (sz1 == 1) {
+            return avas[0].compareTo(rdn.avas[0]);
+        }
+
+        // Need to sort the AVAs before comparing.
+        final AVA[] a1 = new AVA[sz1];
+        System.arraycopy(avas, 0, a1, 0, sz1);
+        Arrays.sort(a1);
+
+        final AVA[] a2 = new AVA[sz1];
+        System.arraycopy(rdn.avas, 0, a2, 0, sz1);
+        Arrays.sort(a2);
+
+        for (int i = 0; i < sz1; i++) {
+            final int result = a1[i].compareTo(a2[i]);
+            if (result != 0) {
+                return result;
+            }
+        }
+
+        return 0;
     }
 
-    // Need to sort the AVAs before comparing.
-    final AVA[] a1 = new AVA[sz1];
-    System.arraycopy(avas, 0, a1, 0, sz1);
-    Arrays.sort(a1);
-
-    final AVA[] a2 = new AVA[sz1];
-    System.arraycopy(rdn.avas, 0, a2, 0, sz1);
-    Arrays.sort(a2);
-
-    for (int i = 0; i < sz1; i++)
-    {
-      final int result = a1[i].compareTo(a2[i]);
-      if (result != 0)
-      {
-        return result;
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof RDN) {
+            return compareTo((RDN) obj) == 0;
+        } else {
+            return false;
+        }
     }
 
-    return 0;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
+    /**
+     * Returns the attribute value contained in this RDN which is associated
+     * with the provided attribute type, or {@code null} if this RDN does not
+     * include such an attribute value.
+     *
+     * @param attributeType
+     *            The attribute type.
+     * @return The attribute value.
+     */
+    public ByteString getAttributeValue(final AttributeType attributeType) {
+        for (final AVA ava : avas) {
+            if (ava.getAttributeType().equals(attributeType)) {
+                return ava.getAttributeValue();
+            }
+        }
+        return null;
     }
-    else if (obj instanceof RDN)
-    {
-      return compareTo((RDN) obj) == 0;
+
+    /**
+     * Returns the first AVA contained in this RDN.
+     *
+     * @return The first AVA contained in this RDN.
+     */
+    public AVA getFirstAVA() {
+        return avas[0];
     }
-    else
-    {
-      return false;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        // Avoid an algorithm that requires the AVAs to be sorted.
+        int hash = 0;
+        for (final AVA ava : avas) {
+            hash += ava.hashCode();
+        }
+        return hash;
     }
-  }
 
-
-
-  /**
-   * Returns the attribute value contained in this RDN which is associated with
-   * the provided attribute type, or {@code null} if this RDN does not include
-   * such an attribute value.
-   *
-   * @param attributeType
-   *          The attribute type.
-   * @return The attribute value.
-   */
-  public ByteString getAttributeValue(final AttributeType attributeType)
-  {
-    for (final AVA ava : avas)
-    {
-      if (ava.getAttributeType().equals(attributeType))
-      {
-        return ava.getAttributeValue();
-      }
+    /**
+     * Returns {@code true} if this RDN contains more than one AVA.
+     *
+     * @return {@code true} if this RDN contains more than one AVA, otherwise
+     *         {@code false}.
+     */
+    public boolean isMultiValued() {
+        return avas.length > 1;
     }
-    return null;
-  }
 
-
-
-  /**
-   * Returns the first AVA contained in this RDN.
-   *
-   * @return The first AVA contained in this RDN.
-   */
-  public AVA getFirstAVA()
-  {
-    return avas[0];
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    // Avoid an algorithm that requires the AVAs to be sorted.
-    int hash = 0;
-    for (final AVA ava : avas)
-    {
-      hash += ava.hashCode();
+    /**
+     * Returns an iterator of the AVAs contained in this RDN. The AVAs will be
+     * returned in the user provided order.
+     * <p>
+     * Attempts to remove AVAs using an iterator's {@code remove()} method are
+     * not permitted and will result in an {@code UnsupportedOperationException}
+     * being thrown.
+     *
+     * @return An iterator of the AVAs contained in this RDN.
+     */
+    public Iterator<AVA> iterator() {
+        return Iterators.arrayIterator(avas);
     }
-    return hash;
-  }
 
-
-
-  /**
-   * Returns {@code true} if this RDN contains more than one AVA.
-   *
-   * @return {@code true} if this RDN contains more than one AVA, otherwise
-   *         {@code false}.
-   */
-  public boolean isMultiValued()
-  {
-    return avas.length > 1;
-  }
-
-
-
-  /**
-   * Returns an iterator of the AVAs contained in this RDN. The AVAs will be
-   * returned in the user provided order.
-   * <p>
-   * Attempts to remove AVAs using an iterator's {@code remove()} method are not
-   * permitted and will result in an {@code UnsupportedOperationException} being
-   * thrown.
-   *
-   * @return An iterator of the AVAs contained in this RDN.
-   */
-  public Iterator<AVA> iterator()
-  {
-    return Iterators.arrayIterator(avas);
-  }
-
-
-
-  /**
-   * Returns the number of AVAs in this RDN.
-   *
-   * @return The number of AVAs in this RDN.
-   */
-  public int size()
-  {
-    return avas.length;
-  }
-
-
-
-  /**
-   * Returns the RFC 4514 string representation of this RDN.
-   *
-   * @return The RFC 4514 string representation of this RDN.
-   * @see <a href="http://tools.ietf.org/html/rfc4514">RFC 4514 - Lightweight
-   *      Directory Access Protocol (LDAP): String Representation of
-   *      Distinguished Names </a>
-   */
-  @Override
-  public String toString()
-  {
-    // We don't care about potential race conditions here.
-    if (stringValue == null)
-    {
-      final StringBuilder builder = new StringBuilder();
-      avas[0].toString(builder);
-      for (int i = 1; i < avas.length; i++)
-      {
-        builder.append('+');
-        avas[i].toString(builder);
-      }
-      stringValue = builder.toString();
+    /**
+     * Returns the number of AVAs in this RDN.
+     *
+     * @return The number of AVAs in this RDN.
+     */
+    public int size() {
+        return avas.length;
     }
-    return stringValue;
-  }
 
+    /**
+     * Returns the RFC 4514 string representation of this RDN.
+     *
+     * @return The RFC 4514 string representation of this RDN.
+     * @see <a href="http://tools.ietf.org/html/rfc4514">RFC 4514 - Lightweight
+     *      Directory Access Protocol (LDAP): String Representation of
+     *      Distinguished Names </a>
+     */
+    @Override
+    public String toString() {
+        // We don't care about potential race conditions here.
+        if (stringValue == null) {
+            final StringBuilder builder = new StringBuilder();
+            avas[0].toString(builder);
+            for (int i = 1; i < avas.length; i++) {
+                builder.append('+');
+                avas[i].toString(builder);
+            }
+            stringValue = builder.toString();
+        }
+        return stringValue;
+    }
 
-
-  StringBuilder toString(final StringBuilder builder)
-  {
-    return builder.append(toString());
-  }
+    StringBuilder toString(final StringBuilder builder) {
+        return builder.append(toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ReferralException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ReferralException.java
index 26cd100..37df786 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ReferralException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ReferralException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * could not be processed by the Directory Server because the target entry is
@@ -40,10 +35,8 @@
  * {@link ResultCode#REFERRAL REFERRAL} result code.
  */
 @SuppressWarnings("serial")
-public class ReferralException extends EntryNotFoundException
-{
-  ReferralException(final Result result)
-  {
-    super(result);
-  }
+public class ReferralException extends EntryNotFoundException {
+    ReferralException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestContext.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestContext.java
index 992a777..8122759 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestContext.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestContext.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * The context associated with a request currently being processed by a request
  * handler. A request context can be used to query state information about the
@@ -37,80 +34,73 @@
  * additional information, such as the associated schema, time-stamp
  * information, etc.
  */
-public interface RequestContext
-{
+public interface RequestContext {
 
-  /**
-   * Registers the provided cancellation listener with this request context so
-   * that it can be notified if a cancellation request is received and
-   * processing of the request should be aborted if possible.
-   * <p>
-   * Requests may be cancelled as a result of an abandon request or a cancel
-   * extended request sent from the client, or by the server itself (e.g. during
-   * server shutdown).
-   * <p>
-   * This method provides a event notification mechanism which can be used by
-   * asynchronous request handler implementations to detect cancellation of
-   * requests.
-   *
-   * @param listener
-   *          The listener which wants to be notified if a cancellation request
-   *          is received and processing of the request should be aborted if
-   *          possible.
-   * @throws NullPointerException
-   *           If the {@code listener} was {@code null}.
-   * @see #checkIfCancelled
-   */
-  void addCancelRequestListener(CancelRequestListener listener);
+    /**
+     * Registers the provided cancellation listener with this request context so
+     * that it can be notified if a cancellation request is received and
+     * processing of the request should be aborted if possible.
+     * <p>
+     * Requests may be cancelled as a result of an abandon request or a cancel
+     * extended request sent from the client, or by the server itself (e.g.
+     * during server shutdown).
+     * <p>
+     * This method provides a event notification mechanism which can be used by
+     * asynchronous request handler implementations to detect cancellation of
+     * requests.
+     *
+     * @param listener
+     *            The listener which wants to be notified if a cancellation
+     *            request is received and processing of the request should be
+     *            aborted if possible.
+     * @throws NullPointerException
+     *             If the {@code listener} was {@code null}.
+     * @see #checkIfCancelled
+     */
+    void addCancelRequestListener(CancelRequestListener listener);
 
+    /**
+     * Throws {@link CancelledResultException} if a cancellation request has
+     * been received and processing of the request should be aborted if
+     * possible.
+     * <p>
+     * Requests may be cancelled as a result of an abandon request or a cancel
+     * extended request sent from the client, or by the server itself (e.g.
+     * during server shutdown).
+     * <p>
+     * This method provides a polling mechanism which can be used by synchronous
+     * request handler implementations to detect cancellation of requests.
+     *
+     * @param signalTooLate
+     *            {@code true} to signal that, after this method returns,
+     *            processing of the request will have proceeded too far for it
+     *            to be aborted by subsequent cancellation requests.
+     * @throws CancelledResultException
+     *             If a cancellation request has been received and processing of
+     *             the request should be aborted if possible.
+     * @see #addCancelRequestListener
+     */
+    void checkIfCancelled(boolean signalTooLate) throws CancelledResultException;
 
+    /**
+     * Returns the message ID of the request, if available. Protocols, such as
+     * LDAP and internal connections, include a unique message ID with each
+     * request which may be useful for logging and auditing.
+     *
+     * @return The message ID of the request, or {@code -1} if there is no
+     *         message ID associated with the request.
+     */
+    int getMessageID();
 
-  /**
-   * Throws {@link CancelledResultException} if a cancellation request has been
-   * received and processing of the request should be aborted if possible.
-   * <p>
-   * Requests may be cancelled as a result of an abandon request or a cancel
-   * extended request sent from the client, or by the server itself (e.g. during
-   * server shutdown).
-   * <p>
-   * This method provides a polling mechanism which can be used by synchronous
-   * request handler implementations to detect cancellation of requests.
-   *
-   * @param signalTooLate
-   *          {@code true} to signal that, after this method returns, processing
-   *          of the request will have proceeded too far for it to be aborted by
-   *          subsequent cancellation requests.
-   * @throws CancelledResultException
-   *           If a cancellation request has been received and processing of the
-   *           request should be aborted if possible.
-   * @see #addCancelRequestListener
-   */
-  void checkIfCancelled(boolean signalTooLate)
-      throws CancelledResultException;
-
-
-
-  /**
-   * Returns the message ID of the request, if available. Protocols, such as
-   * LDAP and internal connections, include a unique message ID with each
-   * request which may be useful for logging and auditing.
-   *
-   * @return The message ID of the request, or {@code -1} if there is no message
-   *         ID associated with the request.
-   */
-  int getMessageID();
-
-
-
-  /**
-   * Removes the provided cancellation listener from this request context so
-   * that it will not be notified if a cancellation request has been received.
-   *
-   * @param listener
-   *          The listener which no longer wants to be notified if a
-   *          cancellation request has been received.
-   * @throws NullPointerException
-   *           If the {@code listener} was {@code null}.
-   */
-  void removeCancelRequestListener(CancelRequestListener listener);
+    /**
+     * Removes the provided cancellation listener from this request context so
+     * that it will not be notified if a cancellation request has been received.
+     *
+     * @param listener
+     *            The listener which no longer wants to be notified if a
+     *            cancellation request has been received.
+     * @throws NullPointerException
+     *             If the {@code listener} was {@code null}.
+     */
+    void removeCancelRequestListener(CancelRequestListener listener);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java
index eb055c2..8aadf26 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,16 +27,19 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
-import org.forgerock.opendj.ldap.requests.*;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
 import org.forgerock.opendj.ldap.responses.CompareResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * A handler interface for processing client requests.
  * <p>
@@ -52,188 +54,172 @@
  * result status.
  *
  * @param <C>
- *          The type of request context.
+ *            The type of request context.
  * @see ServerConnectionFactory
  */
-public interface RequestHandler<C>
-{
+public interface RequestHandler<C> {
 
-  /**
-   * Invoked when an add request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The add request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle add requests.
-   */
-  void handleAdd(C requestContext, AddRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
+    /**
+     * Invoked when an add request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The add request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle add requests.
+     */
+    void handleAdd(C requestContext, AddRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Invoked when a bind request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param version
+     *            The protocol version included with the bind request.
+     * @param request
+     *            The bind request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle bind requests.
+     */
+    void handleBind(C requestContext, int version, BindRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super BindResult> resultHandler);
 
+    /**
+     * Invoked when a compare request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The compare request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle compare requests.
+     */
+    void handleCompare(C requestContext, CompareRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super CompareResult> resultHandler);
 
-  /**
-   * Invoked when a bind request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param version
-   *          The protocol version included with the bind request.
-   * @param request
-   *          The bind request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle bind requests.
-   */
-  void handleBind(C requestContext, int version, BindRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super BindResult> resultHandler);
+    /**
+     * Invoked when a delete request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The delete request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle delete requests.
+     */
+    void handleDelete(C requestContext, DeleteRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
+    /**
+     * Invoked when an extended request is received from a client.
+     *
+     * @param <R>
+     *            The type of result returned by the extended request.
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The extended request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle extended requests.
+     */
+    <R extends ExtendedResult> void handleExtendedRequest(C requestContext,
+            ExtendedRequest<R> request, IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super R> resultHandler);
 
+    /**
+     * Invoked when a modify request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The modify request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle modify requests.
+     */
+    void handleModify(C requestContext, ModifyRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
-  /**
-   * Invoked when a compare request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The compare request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle compare requests.
-   */
-  void handleCompare(C requestContext, CompareRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super CompareResult> resultHandler);
+    /**
+     * Invoked when a modify DN request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The modify DN request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the result to
+     *            the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle modify DN requests.
+     */
+    void handleModifyDN(C requestContext, ModifyDNRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            ResultHandler<? super Result> resultHandler);
 
-
-
-  /**
-   * Invoked when a delete request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The delete request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle delete requests.
-   */
-  void handleDelete(C requestContext, DeleteRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Invoked when an extended request is received from a client.
-   *
-   * @param <R>
-   *          The type of result returned by the extended request.
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The extended request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle extended requests.
-   */
-  <R extends ExtendedResult> void handleExtendedRequest(C requestContext,
-      ExtendedRequest<R> request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super R> resultHandler);
-
-
-
-  /**
-   * Invoked when a modify request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The modify request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle modify requests.
-   */
-  void handleModify(C requestContext, ModifyRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Invoked when a modify DN request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The modify DN request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the result to the
-   *          client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle modify DN requests.
-   */
-  void handleModifyDN(C requestContext, ModifyDNRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      ResultHandler<? super Result> resultHandler);
-
-
-
-  /**
-   * Invoked when a search request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The search request.
-   * @param intermediateResponseHandler
-   *          The handler which should be used to send back any intermediate
-   *          responses to the client.
-   * @param resultHandler
-   *          The handler which should be used to send back the search results
-   *          to the client.
-   * @throws UnsupportedOperationException
-   *           If this request handler does not handle search requests.
-   */
-  void handleSearch(C requestContext, SearchRequest request,
-      IntermediateResponseHandler intermediateResponseHandler,
-      SearchResultHandler resultHandler);
+    /**
+     * Invoked when a search request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The search request.
+     * @param intermediateResponseHandler
+     *            The handler which should be used to send back any intermediate
+     *            responses to the client.
+     * @param resultHandler
+     *            The handler which should be used to send back the search
+     *            results to the client.
+     * @throws UnsupportedOperationException
+     *             If this request handler does not handle search requests.
+     */
+    void handleSearch(C requestContext, SearchRequest request,
+            IntermediateResponseHandler intermediateResponseHandler,
+            SearchResultHandler resultHandler);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java
index fe745fe..63babbe 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,35 +26,31 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A handler interface for accepting new connections from clients.
  *
  * @param <C>
- *          The type of client context.
+ *            The type of client context.
  * @param <R>
- *          The type of request context.
+ *            The type of request context.
  */
-public interface RequestHandlerFactory<C, R extends RequestContext>
-{
-  /**
-   * Invoked when a new client connection is accepted by the associated
-   * listener. Implementations should return a {@code RequestHandler} which will
-   * be used to handle requests from the client connection.
-   *
-   * @param clientContext
-   *          The protocol dependent context information associated with the
-   *          client connection. Depending on the protocol this may contain
-   *          information about the client such as their address and level
-   *          connection security. It may also be used to manage the state of
-   *          the client's connection.
-   * @return A {@code RequestHandler} which will be used to handle requests from
-   *         a client connection.
-   * @throws ErrorResultException
-   *           If this request handler factory cannot accept the client
-   *           connection.
-   */
-  RequestHandler<R> handleAccept(C clientContext)
-      throws ErrorResultException;
+public interface RequestHandlerFactory<C, R extends RequestContext> {
+    /**
+     * Invoked when a new client connection is accepted by the associated
+     * listener. Implementations should return a {@code RequestHandler} which
+     * will be used to handle requests from the client connection.
+     *
+     * @param clientContext
+     *            The protocol dependent context information associated with the
+     *            client connection. Depending on the protocol this may contain
+     *            information about the client such as their address and level
+     *            connection security. It may also be used to manage the state
+     *            of the client's connection.
+     * @return A {@code RequestHandler} which will be used to handle requests
+     *         from a client connection.
+     * @throws ErrorResultException
+     *             If this request handler factory cannot accept the client
+     *             connection.
+     */
+    RequestHandler<R> handleAccept(C clientContext) throws ErrorResultException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java
index 9165989..2f4ee76 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
@@ -39,918 +36,744 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CancelExtendedRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An adapter which converts a {@code RequestHandlerFactory} into a
  * {@code ServerConnectionFactory}.
  *
  * @param <C>
- *          The type of client context.
+ *            The type of client context.
  */
-final class RequestHandlerFactoryAdapter<C> implements
-    ServerConnectionFactory<C, Integer>
-{
-  /**
-   * Request context implementation.
-   */
-  private static class RequestContextImpl<S extends Result, H extends ResultHandler<? super S>>
-      implements RequestContext, ResultHandler<S>
-  {
-
-    // Adapter class which invokes cancel result handlers with correct result
-    // type.
-    private static final class ExtendedResultHandlerHolder<R extends ExtendedResult>
-    {
-      private final ExtendedRequest<R> request;
-      private final ResultHandler<? super R> resultHandler;
-
-
-
-      private ExtendedResultHandlerHolder(final ExtendedRequest<R> request,
-          final ResultHandler<? super R> resultHandler)
-      {
-        this.request = request;
-        this.resultHandler = resultHandler;
-      }
-
-
-
-      private void handleSuccess()
-      {
-        final R cancelResult = request.getResultDecoder()
-            .newExtendedErrorResult(ResultCode.SUCCESS, "", "");
-        resultHandler.handleResult(cancelResult);
-      }
-
-
-
-      private void handleTooLate()
-      {
-        final R cancelResult = request.getResultDecoder()
-            .newExtendedErrorResult(ResultCode.TOO_LATE, "", "");
-        resultHandler.handleErrorResult(ErrorResultException
-            .newErrorResult(cancelResult));
-      }
-    }
-
-
-
-    private static enum RequestState
-    {
-      // Request active
-      PENDING,
-
-      // Request active, cancel requested
-      CANCEL_REQUESTED,
-
-      // Request active, too late to cancel
-      TOO_LATE,
-
-      // Result sent, not cancelled
-      RESULT_SENT,
-
-      // Result sent, was cancelled
-      CANCELLED;
-    }
-
-
-
-    private final int messageID;
-
-    // Cancellation state guarded by lock.
-    private final Object stateLock = new Object();
-
-    // These should be notified when a cancel request arrives, at most once.
-    private List<CancelRequestListener> cancelRequestListeners = null;
-
-    // These should be notified when the result is set.
-    private List<ExtendedResultHandlerHolder<?>> cancelResultHandlers = null;
-
-    private RequestState state = RequestState.PENDING;
-
-    private LocalizableMessage cancelRequestReason = null;
-
-    private boolean sendResult = true;
-
-    private final boolean isCancelSupported;
-
-    private final ServerConnectionImpl<?> clientConnection;
-
-    protected final H resultHandler;
-
-
-
-    protected RequestContextImpl(
-        final ServerConnectionImpl<?> clientConnection, final H resultHandler,
-        final int messageID, final boolean isCancelSupported)
-    {
-      this.clientConnection = clientConnection;
-      this.resultHandler = resultHandler;
-      this.messageID = messageID;
-      this.isCancelSupported = isCancelSupported;
-    }
-
-
-
+final class RequestHandlerFactoryAdapter<C> implements ServerConnectionFactory<C, Integer> {
     /**
-     * {@inheritDoc}
+     * Request context implementation.
      */
-    @Override
-    public void addCancelRequestListener(final CancelRequestListener listener)
-    {
-      Validator.ensureNotNull(listener);
+    private static class RequestContextImpl<S extends Result, H extends ResultHandler<? super S>>
+            implements RequestContext, ResultHandler<S> {
 
-      boolean invokeImmediately = false;
-      synchronized (stateLock)
-      {
-        switch (state)
-        {
-        case PENDING:
-          if (cancelRequestListeners == null)
-          {
-            cancelRequestListeners = new LinkedList<CancelRequestListener>();
-          }
-          cancelRequestListeners.add(listener);
-          break;
-        case CANCEL_REQUESTED:
-          // Signal immediately outside lock.
-          invokeImmediately = true;
-          break;
-        case TOO_LATE:
-        case RESULT_SENT:
-        case CANCELLED:
-          // No point in registering the callback since the request can never be
-          // cancelled now.
-          break;
-        }
-      }
+        // Adapter class which invokes cancel result handlers with correct
+        // result
+        // type.
+        private static final class ExtendedResultHandlerHolder<R extends ExtendedResult> {
+            private final ExtendedRequest<R> request;
+            private final ResultHandler<? super R> resultHandler;
 
-      if (invokeImmediately)
-      {
-        listener.handleCancelRequest(cancelRequestReason);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void checkIfCancelled(final boolean signalTooLate)
-        throws CancelledResultException
-    {
-      synchronized (stateLock)
-      {
-        switch (state)
-        {
-        case PENDING:
-          // No cancel request, so no handlers, just switch state.
-          if (signalTooLate)
-          {
-            cancelRequestListeners = null;
-            state = RequestState.TOO_LATE;
-          }
-          break;
-        case CANCEL_REQUESTED:
-          // Don't change state: let the handler ack the cancellation request.
-          throw (CancelledResultException) newErrorResult(ResultCode.CANCELLED,
-              cancelRequestReason.toString());
-        case TOO_LATE:
-          // Already too late. Nothing to do.
-          break;
-        case RESULT_SENT:
-        case CANCELLED:
-          // This should not happen - could throw an illegal state exception?
-          break;
-        }
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int getMessageID()
-    {
-      return messageID;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      if (clientConnection.removePendingRequest(this))
-      {
-        if (setResult(error.getResult()))
-        {
-          // FIXME: we must invoke the result handler even when abandoned so
-          // that chained result handlers may clean up, log, etc. We really need
-          // to signal that the result must not be sent to the client.
-        }
-        resultHandler.handleErrorResult(error);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleResult(final S result)
-    {
-      if (clientConnection.removePendingRequest(this))
-      {
-        if (setResult(result))
-        {
-          // FIXME: we must invoke the result handler even when abandoned so
-          // that chained result handlers may clean up, log, etc. We really need
-          // to signal that the result must not be sent to the client.
-        }
-        resultHandler.handleResult(result);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void removeCancelRequestListener(final CancelRequestListener listener)
-    {
-      Validator.ensureNotNull(listener);
-
-      synchronized (stateLock)
-      {
-        if (cancelRequestListeners != null)
-        {
-          cancelRequestListeners.remove(listener);
-        }
-      }
-    }
-
-
-
-    private <R extends ExtendedResult> void cancel(
-        final LocalizableMessage reason,
-        final ExtendedRequest<R> cancelRequest,
-        final ResultHandler<? super R> cancelResultHandler,
-        final boolean sendResult)
-    {
-      Validator.ensureNotNull(reason);
-
-      if (!isCancelSupported)
-      {
-        if (cancelResultHandler != null)
-        {
-          final Result result = Responses
-              .newGenericExtendedResult(ResultCode.CANNOT_CANCEL);
-          cancelResultHandler.handleErrorResult(newErrorResult(result));
-        }
-        return;
-      }
-
-      List<CancelRequestListener> tmpListeners = null;
-      boolean invokeResultHandler = false;
-      boolean resultHandlerIsSuccess = false;
-
-      synchronized (stateLock)
-      {
-        switch (state)
-        {
-        case PENDING:
-          // Switch to CANCEL_REQUESTED state.
-          cancelRequestReason = reason;
-          if (cancelResultHandler != null)
-          {
-            cancelResultHandlers = new LinkedList<ExtendedResultHandlerHolder<?>>();
-            cancelResultHandlers.add(new ExtendedResultHandlerHolder<R>(
-                cancelRequest, cancelResultHandler));
-          }
-          tmpListeners = cancelRequestListeners;
-          cancelRequestListeners = null;
-          state = RequestState.CANCEL_REQUESTED;
-          this.sendResult &= sendResult;
-          break;
-        case CANCEL_REQUESTED:
-          // Cancel already request so listeners already invoked.
-          if (cancelResultHandler != null)
-          {
-            if (cancelResultHandlers == null)
-            {
-              cancelResultHandlers = new LinkedList<ExtendedResultHandlerHolder<?>>();
+            private ExtendedResultHandlerHolder(final ExtendedRequest<R> request,
+                    final ResultHandler<? super R> resultHandler) {
+                this.request = request;
+                this.resultHandler = resultHandler;
             }
-            cancelResultHandlers.add(new ExtendedResultHandlerHolder<R>(
-                cancelRequest, cancelResultHandler));
-          }
-          break;
-        case TOO_LATE:
-        case RESULT_SENT:
-          // Cannot cancel, so invoke result handler immediately outside of
-          // lock.
-          if (cancelResultHandler != null)
-          {
-            invokeResultHandler = true;
-            resultHandlerIsSuccess = false;
-          }
-          break;
-        case CANCELLED:
-          // Multiple cancellation attempts. Clients should not do this, but the
-          // cancel will effectively succeed immediately, so invoke result
-          // handler immediately outside of lock.
-          if (cancelResultHandler != null)
-          {
-            invokeResultHandler = true;
-            resultHandlerIsSuccess = true;
-          }
-          break;
-        }
-      }
 
-      // Invoke listeners outside of lock.
-      if (tmpListeners != null)
-      {
-        for (final CancelRequestListener listener : tmpListeners)
-        {
-          listener.handleCancelRequest(reason);
-        }
-      }
+            private void handleSuccess() {
+                final R cancelResult =
+                        request.getResultDecoder().newExtendedErrorResult(ResultCode.SUCCESS, "",
+                                "");
+                resultHandler.handleResult(cancelResult);
+            }
 
-      if (invokeResultHandler)
-      {
-        if (resultHandlerIsSuccess)
-        {
-          final R result = cancelRequest.getResultDecoder()
-              .newExtendedErrorResult(ResultCode.SUCCESS, "", "");
-          cancelResultHandler.handleResult(result);
+            private void handleTooLate() {
+                final R cancelResult =
+                        request.getResultDecoder().newExtendedErrorResult(ResultCode.TOO_LATE, "",
+                                "");
+                resultHandler.handleErrorResult(ErrorResultException.newErrorResult(cancelResult));
+            }
         }
-        else
-        {
-          final Result result = Responses
-              .newGenericExtendedResult(ResultCode.TOO_LATE);
-          cancelResultHandler.handleErrorResult(ErrorResultException
-              .newErrorResult(result));
+
+        private static enum RequestState {
+            // Request active
+            PENDING,
+
+            // Request active, cancel requested
+            CANCEL_REQUESTED,
+
+            // Request active, too late to cancel
+            TOO_LATE,
+
+            // Result sent, not cancelled
+            RESULT_SENT,
+
+            // Result sent, was cancelled
+            CANCELLED;
         }
-      }
+
+        private final int messageID;
+
+        // Cancellation state guarded by lock.
+        private final Object stateLock = new Object();
+
+        // These should be notified when a cancel request arrives, at most once.
+        private List<CancelRequestListener> cancelRequestListeners = null;
+
+        // These should be notified when the result is set.
+        private List<ExtendedResultHandlerHolder<?>> cancelResultHandlers = null;
+
+        private RequestState state = RequestState.PENDING;
+
+        private LocalizableMessage cancelRequestReason = null;
+
+        private boolean sendResult = true;
+
+        private final boolean isCancelSupported;
+
+        private final ServerConnectionImpl<?> clientConnection;
+
+        protected final H resultHandler;
+
+        protected RequestContextImpl(final ServerConnectionImpl<?> clientConnection,
+                final H resultHandler, final int messageID, final boolean isCancelSupported) {
+            this.clientConnection = clientConnection;
+            this.resultHandler = resultHandler;
+            this.messageID = messageID;
+            this.isCancelSupported = isCancelSupported;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void addCancelRequestListener(final CancelRequestListener listener) {
+            Validator.ensureNotNull(listener);
+
+            boolean invokeImmediately = false;
+            synchronized (stateLock) {
+                switch (state) {
+                case PENDING:
+                    if (cancelRequestListeners == null) {
+                        cancelRequestListeners = new LinkedList<CancelRequestListener>();
+                    }
+                    cancelRequestListeners.add(listener);
+                    break;
+                case CANCEL_REQUESTED:
+                    // Signal immediately outside lock.
+                    invokeImmediately = true;
+                    break;
+                case TOO_LATE:
+                case RESULT_SENT:
+                case CANCELLED:
+                    // No point in registering the callback since the request
+                    // can never be
+                    // cancelled now.
+                    break;
+                }
+            }
+
+            if (invokeImmediately) {
+                listener.handleCancelRequest(cancelRequestReason);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void checkIfCancelled(final boolean signalTooLate) throws CancelledResultException {
+            synchronized (stateLock) {
+                switch (state) {
+                case PENDING:
+                    // No cancel request, so no handlers, just switch state.
+                    if (signalTooLate) {
+                        cancelRequestListeners = null;
+                        state = RequestState.TOO_LATE;
+                    }
+                    break;
+                case CANCEL_REQUESTED:
+                    // Don't change state: let the handler ack the cancellation
+                    // request.
+                    throw (CancelledResultException) newErrorResult(ResultCode.CANCELLED,
+                            cancelRequestReason.toString());
+                case TOO_LATE:
+                    // Already too late. Nothing to do.
+                    break;
+                case RESULT_SENT:
+                case CANCELLED:
+                    // This should not happen - could throw an illegal state
+                    // exception?
+                    break;
+                }
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int getMessageID() {
+            return messageID;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            if (clientConnection.removePendingRequest(this)) {
+                if (setResult(error.getResult())) {
+                    // FIXME: we must invoke the result handler even when
+                    // abandoned so
+                    // that chained result handlers may clean up, log, etc. We
+                    // really need
+                    // to signal that the result must not be sent to the client.
+                }
+                resultHandler.handleErrorResult(error);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleResult(final S result) {
+            if (clientConnection.removePendingRequest(this)) {
+                if (setResult(result)) {
+                    // FIXME: we must invoke the result handler even when
+                    // abandoned so
+                    // that chained result handlers may clean up, log, etc. We
+                    // really need
+                    // to signal that the result must not be sent to the client.
+                }
+                resultHandler.handleResult(result);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void removeCancelRequestListener(final CancelRequestListener listener) {
+            Validator.ensureNotNull(listener);
+
+            synchronized (stateLock) {
+                if (cancelRequestListeners != null) {
+                    cancelRequestListeners.remove(listener);
+                }
+            }
+        }
+
+        private <R extends ExtendedResult> void cancel(final LocalizableMessage reason,
+                final ExtendedRequest<R> cancelRequest,
+                final ResultHandler<? super R> cancelResultHandler, final boolean sendResult) {
+            Validator.ensureNotNull(reason);
+
+            if (!isCancelSupported) {
+                if (cancelResultHandler != null) {
+                    final Result result =
+                            Responses.newGenericExtendedResult(ResultCode.CANNOT_CANCEL);
+                    cancelResultHandler.handleErrorResult(newErrorResult(result));
+                }
+                return;
+            }
+
+            List<CancelRequestListener> tmpListeners = null;
+            boolean invokeResultHandler = false;
+            boolean resultHandlerIsSuccess = false;
+
+            synchronized (stateLock) {
+                switch (state) {
+                case PENDING:
+                    // Switch to CANCEL_REQUESTED state.
+                    cancelRequestReason = reason;
+                    if (cancelResultHandler != null) {
+                        cancelResultHandlers = new LinkedList<ExtendedResultHandlerHolder<?>>();
+                        cancelResultHandlers.add(new ExtendedResultHandlerHolder<R>(cancelRequest,
+                                cancelResultHandler));
+                    }
+                    tmpListeners = cancelRequestListeners;
+                    cancelRequestListeners = null;
+                    state = RequestState.CANCEL_REQUESTED;
+                    this.sendResult &= sendResult;
+                    break;
+                case CANCEL_REQUESTED:
+                    // Cancel already request so listeners already invoked.
+                    if (cancelResultHandler != null) {
+                        if (cancelResultHandlers == null) {
+                            cancelResultHandlers = new LinkedList<ExtendedResultHandlerHolder<?>>();
+                        }
+                        cancelResultHandlers.add(new ExtendedResultHandlerHolder<R>(cancelRequest,
+                                cancelResultHandler));
+                    }
+                    break;
+                case TOO_LATE:
+                case RESULT_SENT:
+                    // Cannot cancel, so invoke result handler immediately
+                    // outside of
+                    // lock.
+                    if (cancelResultHandler != null) {
+                        invokeResultHandler = true;
+                        resultHandlerIsSuccess = false;
+                    }
+                    break;
+                case CANCELLED:
+                    // Multiple cancellation attempts. Clients should not do
+                    // this, but the
+                    // cancel will effectively succeed immediately, so invoke
+                    // result
+                    // handler immediately outside of lock.
+                    if (cancelResultHandler != null) {
+                        invokeResultHandler = true;
+                        resultHandlerIsSuccess = true;
+                    }
+                    break;
+                }
+            }
+
+            // Invoke listeners outside of lock.
+            if (tmpListeners != null) {
+                for (final CancelRequestListener listener : tmpListeners) {
+                    listener.handleCancelRequest(reason);
+                }
+            }
+
+            if (invokeResultHandler) {
+                if (resultHandlerIsSuccess) {
+                    final R result =
+                            cancelRequest.getResultDecoder().newExtendedErrorResult(
+                                    ResultCode.SUCCESS, "", "");
+                    cancelResultHandler.handleResult(result);
+                } else {
+                    final Result result = Responses.newGenericExtendedResult(ResultCode.TOO_LATE);
+                    cancelResultHandler.handleErrorResult(ErrorResultException
+                            .newErrorResult(result));
+                }
+            }
+        }
+
+        /**
+         * Sets the result associated with this request context and updates the
+         * state accordingly.
+         *
+         * @param result
+         *            The result.
+         */
+        private boolean setResult(final Result result) {
+            List<ExtendedResultHandlerHolder<?>> tmpHandlers = null;
+            boolean isCancelled = false;
+            boolean maySendResult;
+
+            synchronized (stateLock) {
+                maySendResult = sendResult;
+
+                switch (state) {
+                case PENDING:
+                case TOO_LATE:
+                    // Switch to appropriate final state.
+                    if (!result.getResultCode().equals(ResultCode.CANCELLED)) {
+                        state = RequestState.RESULT_SENT;
+                    } else {
+                        state = RequestState.CANCELLED;
+                    }
+                    break;
+                case CANCEL_REQUESTED:
+                    // Switch to appropriate final state and invoke any cancel
+                    // request
+                    // handlers.
+                    if (!result.getResultCode().equals(ResultCode.CANCELLED)) {
+                        state = RequestState.RESULT_SENT;
+                    } else {
+                        state = RequestState.CANCELLED;
+                    }
+
+                    isCancelled = (state == RequestState.CANCELLED);
+                    tmpHandlers = cancelResultHandlers;
+                    cancelResultHandlers = null;
+                    break;
+                case RESULT_SENT:
+                case CANCELLED:
+                    // This should not happen - could throw an illegal state
+                    // exception?
+                    maySendResult = false; // Prevent sending multiple results.
+                    break;
+                }
+            }
+
+            // Invoke handlers outside of lock.
+            if (tmpHandlers != null) {
+                for (final ExtendedResultHandlerHolder<?> handler : tmpHandlers) {
+                    if (isCancelled) {
+                        handler.handleSuccess();
+                    } else {
+                        handler.handleTooLate();
+                    }
+                }
+            }
+
+            return maySendResult;
+        }
     }
 
+    /**
+     * Search request context implementation.
+     */
+    private final static class SearchRequestContextImpl extends
+            RequestContextImpl<Result, SearchResultHandler> implements SearchResultHandler {
 
+        private SearchRequestContextImpl(final ServerConnectionImpl<?> clientConnection,
+                final SearchResultHandler resultHandler, final int messageID,
+                final boolean isCancelSupported) {
+            super(clientConnection, resultHandler, messageID, isCancelSupported);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            return resultHandler.handleEntry(entry);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            return resultHandler.handleReference(reference);
+        }
+    }
+
+    private static final class ServerConnectionImpl<C> implements ServerConnection<Integer> {
+        private final RequestHandler<RequestContext> requestHandler;
+        private final AtomicBoolean isClosed = new AtomicBoolean();
+        private final ConcurrentHashMap<Integer, RequestContextImpl<?, ?>> pendingRequests =
+                new ConcurrentHashMap<Integer, RequestContextImpl<?, ?>>();
+
+        private ServerConnectionImpl(final RequestHandler<RequestContext> requestHandler) {
+            this.requestHandler = requestHandler;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleAbandon(final Integer messageID, final AbandonRequest request) {
+            final RequestContextImpl<?, ?> abandonedRequest =
+                    getPendingRequest(request.getRequestID());
+            if (abandonedRequest != null) {
+                final LocalizableMessage abandonReason =
+                        INFO_CANCELED_BY_ABANDON_REQUEST.get(messageID);
+                abandonedRequest.cancel(abandonReason, null, null, false);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleAdd(final Integer messageID, final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
+                    new RequestContextImpl<Result, ResultHandler<? super Result>>(this,
+                            resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleAdd(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleBind(final Integer messageID, final int version,
+                final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler) {
+            final RequestContextImpl<BindResult, ResultHandler<? super BindResult>> requestContext =
+                    new RequestContextImpl<BindResult, ResultHandler<? super BindResult>>(this,
+                            resultHandler, messageID, false);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleBind(requestContext, version, request,
+                        intermediateResponseHandler, requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleCompare(final Integer messageID, final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler) {
+            final RequestContextImpl<CompareResult, ResultHandler<? super CompareResult>> requestContext =
+                    new RequestContextImpl<CompareResult, ResultHandler<? super CompareResult>>(
+                            this, resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleCompare(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionClosed(final Integer messageID, final UnbindRequest request) {
+            final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_DISCONNECT.get();
+            doClose(cancelReason);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionDisconnected(final ResultCode resultCode, final String message) {
+            final LocalizableMessage cancelReason = INFO_CANCELED_BY_SERVER_DISCONNECT.get();
+            doClose(cancelReason);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionError(final Throwable error) {
+            final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_ERROR.get();
+            doClose(cancelReason);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleDelete(final Integer messageID, final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
+                    new RequestContextImpl<Result, ResultHandler<? super Result>>(this,
+                            resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleDelete(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public <R extends ExtendedResult> void handleExtendedRequest(final Integer messageID,
+                final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) {
+            if (request.getOID().equals(CancelExtendedRequest.OID)) {
+                // Decode the request as a cancel request.
+                CancelExtendedRequest cancelRequest;
+                try {
+                    cancelRequest =
+                            CancelExtendedRequest.DECODER.decodeExtendedRequest(request,
+                                    new DecodeOptions());
+                } catch (final DecodeException e) {
+                    // Couldn't decode a cancel request.
+                    resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR, e
+                            .getLocalizedMessage()));
+                    return;
+                }
+
+                // Register the request in the pending requests table. Even
+                // though
+                // this request cannot be cancelled, it is important to do this
+                // in
+                // order to monitor the number of pending operations.
+                final RequestContextImpl<R, ResultHandler<? super R>> requestContext =
+                        new RequestContextImpl<R, ResultHandler<? super R>>(this, resultHandler,
+                                messageID, false);
+                if (addPendingRequest(requestContext)) {
+                    // Find and cancel the request.
+                    final RequestContextImpl<?, ?> cancelledRequest =
+                            getPendingRequest(cancelRequest.getRequestID());
+                    if (cancelledRequest != null) {
+                        final LocalizableMessage cancelReason =
+                                INFO_CANCELED_BY_CANCEL_REQUEST.get(messageID);
+                        cancelledRequest.cancel(cancelReason, request, requestContext, true);
+                    } else {
+                        // Couldn't find the request. Invoke on context in order
+                        // to remove
+                        // pending request.
+                        requestContext
+                                .handleErrorResult(newErrorResult(ResultCode.NO_SUCH_OPERATION));
+                    }
+                }
+            } else {
+                final RequestContextImpl<R, ResultHandler<? super R>> requestContext;
+                if (request.getOID().equals(StartTLSExtendedRequest.OID)) {
+                    // StartTLS requests cannot be cancelled.
+                    requestContext =
+                            new RequestContextImpl<R, ResultHandler<? super R>>(this,
+                                    resultHandler, messageID, false);
+                } else {
+                    requestContext =
+                            new RequestContextImpl<R, ResultHandler<? super R>>(this,
+                                    resultHandler, messageID, true);
+                }
+
+                if (addPendingRequest(requestContext)) {
+                    requestHandler.handleExtendedRequest(requestContext, request,
+                            intermediateResponseHandler, requestContext);
+                }
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModify(final Integer messageID, final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
+                    new RequestContextImpl<Result, ResultHandler<? super Result>>(this,
+                            resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleModify(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModifyDN(final Integer messageID, final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler) {
+            final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
+                    new RequestContextImpl<Result, ResultHandler<? super Result>>(this,
+                            resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleModifyDN(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleSearch(final Integer messageID, final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) {
+            final SearchRequestContextImpl requestContext =
+                    new SearchRequestContextImpl(this, resultHandler, messageID, true);
+            if (addPendingRequest(requestContext)) {
+                requestHandler.handleSearch(requestContext, request, intermediateResponseHandler,
+                        requestContext);
+            }
+        }
+
+        private boolean addPendingRequest(final RequestContextImpl<?, ?> requestContext) {
+            final Integer messageID = requestContext.getMessageID();
+
+            if (isClosed.get()) {
+                final LocalizableMessage message = INFO_CLIENT_CONNECTION_CLOSING.get();
+                requestContext.handleErrorResult(newErrorResult(ResultCode.UNWILLING_TO_PERFORM,
+                        message.toString()));
+                return false;
+            } else if (pendingRequests.putIfAbsent(messageID, requestContext) != null) {
+                final LocalizableMessage message =
+                        WARN_CLIENT_DUPLICATE_MESSAGE_ID.get(requestContext.getMessageID());
+                requestContext.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR, message
+                        .toString()));
+                return false;
+            } else if (isClosed.get()) {
+                // A concurrent close may have already removed the pending
+                // request but
+                // it will have only been notified for cancellation.
+                pendingRequests.remove(messageID);
+
+                final LocalizableMessage message = INFO_CLIENT_CONNECTION_CLOSING.get();
+                requestContext.handleErrorResult(newErrorResult(ResultCode.UNWILLING_TO_PERFORM,
+                        message.toString()));
+                return false;
+            } else {
+                // If the connection is closed now then we just have to pay the
+                // cost of
+                // invoking the request in the request handler.
+                return true;
+            }
+        }
+
+        private void doClose(final LocalizableMessage cancelReason) {
+            if (!isClosed.getAndSet(true)) {
+                // At this point if any pending requests are added then we may
+                // end up
+                // cancelling them, but this does not matter since
+                // addPendingRequest
+                // will fail the request immediately.
+                final Iterator<RequestContextImpl<?, ?>> iterator =
+                        pendingRequests.values().iterator();
+                while (iterator.hasNext()) {
+                    final RequestContextImpl<?, ?> pendingRequest = iterator.next();
+                    pendingRequest.cancel(cancelReason, null, null, false);
+                    iterator.remove();
+                }
+            }
+        }
+
+        /**
+         * Returns the pending request context having the specified message ID.
+         *
+         * @param messageID
+         *            The message ID associated with the request context.
+         * @return The pending request context.
+         */
+        private RequestContextImpl<?, ?> getPendingRequest(final Integer messageID) {
+            return pendingRequests.get(messageID);
+        }
+
+        /**
+         * Deregister a request context once it has completed.
+         *
+         * @param requestContext
+         *            The request context.
+         * @return {@code true} if the request context was found and removed.
+         */
+        private boolean removePendingRequest(final RequestContextImpl<?, ?> requestContext) {
+            return pendingRequests.remove(requestContext.getMessageID()) != null;
+        }
+
+    }
+
+    private final RequestHandlerFactory<C, RequestContext> factory;
 
     /**
-     * Sets the result associated with this request context and updates the
-     * state accordingly.
+     * Creates a new server connection factory using the provided request
+     * handler factory.
      *
-     * @param result
-     *          The result.
+     * @param factory
+     *            The request handler factory to be adapted into a server
+     *            connection factory.
      */
-    private boolean setResult(final Result result)
-    {
-      List<ExtendedResultHandlerHolder<?>> tmpHandlers = null;
-      boolean isCancelled = false;
-      boolean maySendResult;
-
-      synchronized (stateLock)
-      {
-        maySendResult = sendResult;
-
-        switch (state)
-        {
-        case PENDING:
-        case TOO_LATE:
-          // Switch to appropriate final state.
-          if (!result.getResultCode().equals(ResultCode.CANCELLED))
-          {
-            state = RequestState.RESULT_SENT;
-          }
-          else
-          {
-            state = RequestState.CANCELLED;
-          }
-          break;
-        case CANCEL_REQUESTED:
-          // Switch to appropriate final state and invoke any cancel request
-          // handlers.
-          if (!result.getResultCode().equals(ResultCode.CANCELLED))
-          {
-            state = RequestState.RESULT_SENT;
-          }
-          else
-          {
-            state = RequestState.CANCELLED;
-          }
-
-          isCancelled = (state == RequestState.CANCELLED);
-          tmpHandlers = cancelResultHandlers;
-          cancelResultHandlers = null;
-          break;
-        case RESULT_SENT:
-        case CANCELLED:
-          // This should not happen - could throw an illegal state exception?
-          maySendResult = false; // Prevent sending multiple results.
-          break;
-        }
-      }
-
-      // Invoke handlers outside of lock.
-      if (tmpHandlers != null)
-      {
-        for (final ExtendedResultHandlerHolder<?> handler : tmpHandlers)
-        {
-          if (isCancelled)
-          {
-            handler.handleSuccess();
-          }
-          else
-          {
-            handler.handleTooLate();
-          }
-        }
-      }
-
-      return maySendResult;
+    RequestHandlerFactoryAdapter(final RequestHandlerFactory<C, RequestContext> factory) {
+        this.factory = factory;
     }
-  }
-
-
-
-  /**
-   * Search request context implementation.
-   */
-  private final static class SearchRequestContextImpl extends
-      RequestContextImpl<Result, SearchResultHandler> implements
-      SearchResultHandler
-  {
-
-    private SearchRequestContextImpl(
-        final ServerConnectionImpl<?> clientConnection,
-        final SearchResultHandler resultHandler, final int messageID,
-        final boolean isCancelSupported)
-    {
-      super(clientConnection, resultHandler, messageID, isCancelSupported);
-    }
-
-
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      return resultHandler.handleEntry(entry);
+    public ServerConnection<Integer> handleAccept(final C clientContext)
+            throws ErrorResultException {
+        final RequestHandler<RequestContext> requestHandler = factory.handleAccept(clientContext);
+        return new ServerConnectionImpl<C>(requestHandler);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      return resultHandler.handleReference(reference);
-    }
-  }
-
-
-
-  private static final class ServerConnectionImpl<C> implements
-      ServerConnection<Integer>
-  {
-    private final RequestHandler<RequestContext> requestHandler;
-    private final AtomicBoolean isClosed = new AtomicBoolean();
-    private final ConcurrentHashMap<Integer, RequestContextImpl<?, ?>> pendingRequests =
-        new ConcurrentHashMap<Integer, RequestContextImpl<?, ?>>();
-
-
-
-    private ServerConnectionImpl(
-        final RequestHandler<RequestContext> requestHandler)
-    {
-      this.requestHandler = requestHandler;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAbandon(final Integer messageID,
-        final AbandonRequest request)
-    {
-      final RequestContextImpl<?, ?> abandonedRequest = getPendingRequest(request
-          .getRequestID());
-      if (abandonedRequest != null)
-      {
-        final LocalizableMessage abandonReason = INFO_CANCELED_BY_ABANDON_REQUEST
-            .get(messageID);
-        abandonedRequest.cancel(abandonReason, null, null, false);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAdd(final Integer messageID, final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
-          new RequestContextImpl<Result, ResultHandler<? super Result>>(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleAdd(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleBind(final Integer messageID, final int version,
-        final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-    {
-      final RequestContextImpl<BindResult, ResultHandler<? super BindResult>> requestContext =
-          new RequestContextImpl<BindResult, ResultHandler<? super BindResult>>(
-          this, resultHandler, messageID, false);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleBind(requestContext, version, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleCompare(final Integer messageID,
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-    {
-      final RequestContextImpl<CompareResult, ResultHandler<? super CompareResult>> requestContext =
-          new RequestContextImpl<CompareResult, ResultHandler<? super CompareResult>>(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleCompare(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionClosed(final Integer messageID,
-        final UnbindRequest request)
-    {
-      final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_DISCONNECT
-          .get();
-      doClose(cancelReason);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionDisconnected(final ResultCode resultCode,
-        final String message)
-    {
-      final LocalizableMessage cancelReason = INFO_CANCELED_BY_SERVER_DISCONNECT
-          .get();
-      doClose(cancelReason);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionError(final Throwable error)
-    {
-      final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_ERROR
-          .get();
-      doClose(cancelReason);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleDelete(final Integer messageID,
-        final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
-          new RequestContextImpl<Result, ResultHandler<? super Result>>(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleDelete(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <R extends ExtendedResult> void handleExtendedRequest(
-        final Integer messageID, final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-    {
-      if (request.getOID().equals(CancelExtendedRequest.OID))
-      {
-        // Decode the request as a cancel request.
-        CancelExtendedRequest cancelRequest;
-        try
-        {
-          cancelRequest = CancelExtendedRequest.DECODER.decodeExtendedRequest(
-              request, new DecodeOptions());
-        }
-        catch (final DecodeException e)
-        {
-          // Couldn't decode a cancel request.
-          resultHandler.handleErrorResult(newErrorResult(
-              ResultCode.PROTOCOL_ERROR, e.getLocalizedMessage()));
-          return;
-        }
-
-        // Register the request in the pending requests table. Even though
-        // this request cannot be cancelled, it is important to do this in
-        // order to monitor the number of pending operations.
-        final RequestContextImpl<R, ResultHandler<? super R>> requestContext =
-            new RequestContextImpl<R, ResultHandler<? super R>>(
-            this, resultHandler, messageID, false);
-        if (addPendingRequest(requestContext))
-        {
-          // Find and cancel the request.
-          final RequestContextImpl<?, ?> cancelledRequest = getPendingRequest(cancelRequest
-              .getRequestID());
-          if (cancelledRequest != null)
-          {
-            final LocalizableMessage cancelReason = INFO_CANCELED_BY_CANCEL_REQUEST
-                .get(messageID);
-            cancelledRequest
-                .cancel(cancelReason, request, requestContext, true);
-          }
-          else
-          {
-            // Couldn't find the request. Invoke on context in order to remove
-            // pending request.
-            requestContext
-                .handleErrorResult(newErrorResult(ResultCode.NO_SUCH_OPERATION));
-          }
-        }
-      }
-      else
-      {
-        final RequestContextImpl<R, ResultHandler<? super R>> requestContext;
-        if (request.getOID().equals(StartTLSExtendedRequest.OID))
-        {
-          // StartTLS requests cannot be cancelled.
-          requestContext = new RequestContextImpl<R, ResultHandler<? super R>>(
-              this, resultHandler, messageID, false);
-        }
-        else
-        {
-          requestContext = new RequestContextImpl<R, ResultHandler<? super R>>(
-              this, resultHandler, messageID, true);
-        }
-
-        if (addPendingRequest(requestContext))
-        {
-          requestHandler.handleExtendedRequest(requestContext, request,
-              intermediateResponseHandler, requestContext);
-        }
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModify(final Integer messageID,
-        final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
-          new RequestContextImpl<Result, ResultHandler<? super Result>>(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleModify(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModifyDN(final Integer messageID,
-        final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-    {
-      final RequestContextImpl<Result, ResultHandler<? super Result>> requestContext =
-          new RequestContextImpl<Result, ResultHandler<? super Result>>(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleModifyDN(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleSearch(final Integer messageID,
-        final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-    {
-      final SearchRequestContextImpl requestContext = new SearchRequestContextImpl(
-          this, resultHandler, messageID, true);
-      if (addPendingRequest(requestContext))
-      {
-        requestHandler.handleSearch(requestContext, request,
-            intermediateResponseHandler, requestContext);
-      }
-    }
-
-
-
-    private boolean addPendingRequest(
-        final RequestContextImpl<?, ?> requestContext)
-    {
-      final Integer messageID = requestContext.getMessageID();
-
-      if (isClosed.get())
-      {
-        final LocalizableMessage message = INFO_CLIENT_CONNECTION_CLOSING.get();
-        requestContext.handleErrorResult(newErrorResult(
-            ResultCode.UNWILLING_TO_PERFORM, message.toString()));
-        return false;
-      }
-      else if (pendingRequests.putIfAbsent(messageID, requestContext) != null)
-      {
-        final LocalizableMessage message = WARN_CLIENT_DUPLICATE_MESSAGE_ID
-            .get(requestContext.getMessageID());
-        requestContext.handleErrorResult(newErrorResult(
-            ResultCode.PROTOCOL_ERROR, message.toString()));
-        return false;
-      }
-      else if (isClosed.get())
-      {
-        // A concurrent close may have already removed the pending request but
-        // it will have only been notified for cancellation.
-        pendingRequests.remove(messageID);
-
-        final LocalizableMessage message = INFO_CLIENT_CONNECTION_CLOSING.get();
-        requestContext.handleErrorResult(newErrorResult(
-            ResultCode.UNWILLING_TO_PERFORM, message.toString()));
-        return false;
-      }
-      else
-      {
-        // If the connection is closed now then we just have to pay the cost of
-        // invoking the request in the request handler.
-        return true;
-      }
-    }
-
-
-
-    private void doClose(final LocalizableMessage cancelReason)
-    {
-      if (!isClosed.getAndSet(true))
-      {
-        // At this point if any pending requests are added then we may end up
-        // cancelling them, but this does not matter since addPendingRequest
-        // will fail the request immediately.
-        final Iterator<RequestContextImpl<?, ?>> iterator = pendingRequests
-            .values().iterator();
-        while (iterator.hasNext())
-        {
-          final RequestContextImpl<?, ?> pendingRequest = iterator.next();
-          pendingRequest.cancel(cancelReason, null, null, false);
-          iterator.remove();
-        }
-      }
-    }
-
-
-
-    /**
-     * Returns the pending request context having the specified message ID.
-     *
-     * @param messageID
-     *          The message ID associated with the request context.
-     * @return The pending request context.
-     */
-    private RequestContextImpl<?, ?> getPendingRequest(final Integer messageID)
-    {
-      return pendingRequests.get(messageID);
-    }
-
-
-
-    /**
-     * Deregister a request context once it has completed.
-     *
-     * @param requestContext
-     *          The request context.
-     * @return {@code true} if the request context was found and removed.
-     */
-    private boolean removePendingRequest(
-        final RequestContextImpl<?, ?> requestContext)
-    {
-      return pendingRequests.remove(requestContext.getMessageID()) != null;
-    }
-
-  }
-
-
-
-  private final RequestHandlerFactory<C, RequestContext> factory;
-
-
-
-  /**
-   * Creates a new server connection factory using the provided request handler
-   * factory.
-   *
-   * @param factory
-   *          The request handler factory to be adapted into a server connection
-   *          factory.
-   */
-  RequestHandlerFactoryAdapter(
-      final RequestHandlerFactory<C, RequestContext> factory)
-  {
-    this.factory = factory;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ServerConnection<Integer> handleAccept(final C clientContext)
-      throws ErrorResultException
-  {
-    final RequestHandler<RequestContext> requestHandler = factory
-        .handleAccept(clientContext);
-    return new ServerConnectionImpl<C>(requestHandler);
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultCode.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultCode.java
index 431448e..0773eaf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultCode.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultCode.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.util.Arrays;
@@ -37,8 +34,6 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * An operation result code as defined in RFC 4511 section 4.1.9 is used to
  * indicate the final status of an operation. If a server detects multiple
@@ -50,709 +45,672 @@
  * @see <a href="http://tools.ietf.org/html/rfc4511#section-4.1.9">RFC 4511 -
  *      Lightweight Directory Access Protocol (LDAP): The Protocol </a>
  */
-public final class ResultCode
-{
-  private static final ResultCode[] ELEMENTS = new ResultCode[16655];
+public final class ResultCode {
+    private static final ResultCode[] ELEMENTS = new ResultCode[16655];
 
-  private static final List<ResultCode> IMMUTABLE_ELEMENTS = Collections
-      .unmodifiableList(Arrays.asList(ELEMENTS));
+    private static final List<ResultCode> IMMUTABLE_ELEMENTS = Collections.unmodifiableList(Arrays
+            .asList(ELEMENTS));
 
-  /**
-   * The result code that indicates that the operation completed successfully.
-   */
-  public static final ResultCode SUCCESS = registerSuccessResultCode(0,
-      INFO_RESULT_SUCCESS.get());
+    /**
+     * The result code that indicates that the operation completed successfully.
+     */
+    public static final ResultCode SUCCESS =
+            registerSuccessResultCode(0, INFO_RESULT_SUCCESS.get());
 
-  /**
-   * The result code that indicates that an internal error prevented the
-   * operation from being processed properly.
-   */
-  public static final ResultCode OPERATIONS_ERROR = registerErrorResultCode(1,
-      INFO_RESULT_OPERATIONS_ERROR.get());
+    /**
+     * The result code that indicates that an internal error prevented the
+     * operation from being processed properly.
+     */
+    public static final ResultCode OPERATIONS_ERROR = registerErrorResultCode(1,
+            INFO_RESULT_OPERATIONS_ERROR.get());
 
-  /**
-   * The result code that indicates that the client sent a malformed or illegal
-   * request to the server.
-   */
-  public static final ResultCode PROTOCOL_ERROR = registerErrorResultCode(2,
-      INFO_RESULT_PROTOCOL_ERROR.get());
+    /**
+     * The result code that indicates that the client sent a malformed or
+     * illegal request to the server.
+     */
+    public static final ResultCode PROTOCOL_ERROR = registerErrorResultCode(2,
+            INFO_RESULT_PROTOCOL_ERROR.get());
 
-  /**
-   * The result code that indicates that a time limit was exceeded while
-   * attempting to process the request.
-   */
-  public static final ResultCode TIME_LIMIT_EXCEEDED = registerErrorResultCode(
-      3, INFO_RESULT_TIME_LIMIT_EXCEEDED.get());
+    /**
+     * The result code that indicates that a time limit was exceeded while
+     * attempting to process the request.
+     */
+    public static final ResultCode TIME_LIMIT_EXCEEDED = registerErrorResultCode(3,
+            INFO_RESULT_TIME_LIMIT_EXCEEDED.get());
 
-  /**
-   * The result code that indicates that a size limit was exceeded while
-   * attempting to process the request.
-   */
-  public static final ResultCode SIZE_LIMIT_EXCEEDED = registerErrorResultCode(
-      4, INFO_RESULT_SIZE_LIMIT_EXCEEDED.get());
+    /**
+     * The result code that indicates that a size limit was exceeded while
+     * attempting to process the request.
+     */
+    public static final ResultCode SIZE_LIMIT_EXCEEDED = registerErrorResultCode(4,
+            INFO_RESULT_SIZE_LIMIT_EXCEEDED.get());
 
-  /**
-   * The result code that indicates that the attribute value assertion included
-   * in a compare request did not match the targeted entry.
-   */
-  public static final ResultCode COMPARE_FALSE = registerSuccessResultCode(5,
-      INFO_RESULT_COMPARE_FALSE.get());
+    /**
+     * The result code that indicates that the attribute value assertion
+     * included in a compare request did not match the targeted entry.
+     */
+    public static final ResultCode COMPARE_FALSE = registerSuccessResultCode(5,
+            INFO_RESULT_COMPARE_FALSE.get());
 
-  /**
-   * The result code that indicates that the attribute value assertion included
-   * in a compare request did match the targeted entry.
-   */
-  public static final ResultCode COMPARE_TRUE = registerSuccessResultCode(6,
-      INFO_RESULT_COMPARE_TRUE.get());
+    /**
+     * The result code that indicates that the attribute value assertion
+     * included in a compare request did match the targeted entry.
+     */
+    public static final ResultCode COMPARE_TRUE = registerSuccessResultCode(6,
+            INFO_RESULT_COMPARE_TRUE.get());
 
-  /**
-   * The result code that indicates that the requested authentication attempt
-   * failed because it referenced an invalid SASL mechanism.
-   */
-  public static final ResultCode AUTH_METHOD_NOT_SUPPORTED = registerErrorResultCode(
-      7, INFO_RESULT_AUTH_METHOD_NOT_SUPPORTED.get());
+    /**
+     * The result code that indicates that the requested authentication attempt
+     * failed because it referenced an invalid SASL mechanism.
+     */
+    public static final ResultCode AUTH_METHOD_NOT_SUPPORTED = registerErrorResultCode(7,
+            INFO_RESULT_AUTH_METHOD_NOT_SUPPORTED.get());
 
-  /**
-   * The result code that indicates that the requested operation could not be
-   * processed because it requires that the client has completed a strong form
-   * of authentication.
-   */
-  public static final ResultCode STRONG_AUTH_REQUIRED = registerErrorResultCode(
-      8, INFO_RESULT_STRONG_AUTH_REQUIRED.get());
+    /**
+     * The result code that indicates that the requested operation could not be
+     * processed because it requires that the client has completed a strong form
+     * of authentication.
+     */
+    public static final ResultCode STRONG_AUTH_REQUIRED = registerErrorResultCode(8,
+            INFO_RESULT_STRONG_AUTH_REQUIRED.get());
 
-  /**
-   * The result code that indicates that a referral was encountered.
-   * <p>
-   * Strictly speaking this result code should not be exceptional since it is
-   * considered as a "success" response. However, referrals should occur rarely
-   * in practice and, when they do occur, should not be ignored since the
-   * application may believe that a request has succeeded when, in fact, nothing
-   * was done.
-   */
-  public static final ResultCode REFERRAL = registerErrorResultCode(10,
-      INFO_RESULT_REFERRAL.get());
+    /**
+     * The result code that indicates that a referral was encountered.
+     * <p>
+     * Strictly speaking this result code should not be exceptional since it is
+     * considered as a "success" response. However, referrals should occur
+     * rarely in practice and, when they do occur, should not be ignored since
+     * the application may believe that a request has succeeded when, in fact,
+     * nothing was done.
+     */
+    public static final ResultCode REFERRAL = registerErrorResultCode(10, INFO_RESULT_REFERRAL
+            .get());
 
-  /**
-   * The result code that indicates that processing on the requested operation
-   * could not continue because an administrative limit was exceeded.
-   */
-  public static final ResultCode ADMIN_LIMIT_EXCEEDED = registerErrorResultCode(
-      11, INFO_RESULT_ADMIN_LIMIT_EXCEEDED.get());
+    /**
+     * The result code that indicates that processing on the requested operation
+     * could not continue because an administrative limit was exceeded.
+     */
+    public static final ResultCode ADMIN_LIMIT_EXCEEDED = registerErrorResultCode(11,
+            INFO_RESULT_ADMIN_LIMIT_EXCEEDED.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it included a critical extension that is unsupported or inappropriate for
-   * that request.
-   */
-  public static final ResultCode UNAVAILABLE_CRITICAL_EXTENSION = registerErrorResultCode(
-      12, INFO_RESULT_UNAVAILABLE_CRITICAL_EXTENSION.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it included a critical extension that is unsupported or
+     * inappropriate for that request.
+     */
+    public static final ResultCode UNAVAILABLE_CRITICAL_EXTENSION = registerErrorResultCode(12,
+            INFO_RESULT_UNAVAILABLE_CRITICAL_EXTENSION.get());
 
-  /**
-   * The result code that indicates that the requested operation could not be
-   * processed because it requires confidentiality for the communication between
-   * the client and the server.
-   */
-  public static final ResultCode CONFIDENTIALITY_REQUIRED = registerErrorResultCode(
-      13, INFO_RESULT_CONFIDENTIALITY_REQUIRED.get());
+    /**
+     * The result code that indicates that the requested operation could not be
+     * processed because it requires confidentiality for the communication
+     * between the client and the server.
+     */
+    public static final ResultCode CONFIDENTIALITY_REQUIRED = registerErrorResultCode(13,
+            INFO_RESULT_CONFIDENTIALITY_REQUIRED.get());
 
-  /**
-   * The result code that should be used for intermediate responses in
-   * multi-stage SASL bind operations.
-   */
-  public static final ResultCode SASL_BIND_IN_PROGRESS = registerSuccessResultCode(
-      14, INFO_RESULT_SASL_BIND_IN_PROGRESS.get());
+    /**
+     * The result code that should be used for intermediate responses in
+     * multi-stage SASL bind operations.
+     */
+    public static final ResultCode SASL_BIND_IN_PROGRESS = registerSuccessResultCode(14,
+            INFO_RESULT_SASL_BIND_IN_PROGRESS.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it targeted an attribute or attribute value that did not exist in the
-   * specified entry.
-   */
-  public static final ResultCode NO_SUCH_ATTRIBUTE = registerErrorResultCode(
-      16, INFO_RESULT_NO_SUCH_ATTRIBUTE.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it targeted an attribute or attribute value that did not exist in
+     * the specified entry.
+     */
+    public static final ResultCode NO_SUCH_ATTRIBUTE = registerErrorResultCode(16,
+            INFO_RESULT_NO_SUCH_ATTRIBUTE.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it referenced an attribute that is not defined in the server schema.
-   */
-  public static final ResultCode UNDEFINED_ATTRIBUTE_TYPE = registerErrorResultCode(
-      17, INFO_RESULT_UNDEFINED_ATTRIBUTE_TYPE.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it referenced an attribute that is not defined in the server
+     * schema.
+     */
+    public static final ResultCode UNDEFINED_ATTRIBUTE_TYPE = registerErrorResultCode(17,
+            INFO_RESULT_UNDEFINED_ATTRIBUTE_TYPE.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it attempted to perform an inappropriate type of matching against an
-   * attribute.
-   */
-  public static final ResultCode INAPPROPRIATE_MATCHING = registerErrorResultCode(
-      18, INFO_RESULT_INAPPROPRIATE_MATCHING.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it attempted to perform an inappropriate type of matching against
+     * an attribute.
+     */
+    public static final ResultCode INAPPROPRIATE_MATCHING = registerErrorResultCode(18,
+            INFO_RESULT_INAPPROPRIATE_MATCHING.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have violated some constraint defined in the server.
-   */
-  public static final ResultCode CONSTRAINT_VIOLATION = registerErrorResultCode(
-      19, INFO_RESULT_CONSTRAINT_VIOLATION.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have violated some constraint defined in the server.
+     */
+    public static final ResultCode CONSTRAINT_VIOLATION = registerErrorResultCode(19,
+            INFO_RESULT_CONSTRAINT_VIOLATION.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have resulted in a conflict with an existing attribute or
-   * attribute value in the target entry.
-   */
-  public static final ResultCode ATTRIBUTE_OR_VALUE_EXISTS = registerErrorResultCode(
-      20, INFO_RESULT_ATTRIBUTE_OR_VALUE_EXISTS.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have resulted in a conflict with an existing attribute
+     * or attribute value in the target entry.
+     */
+    public static final ResultCode ATTRIBUTE_OR_VALUE_EXISTS = registerErrorResultCode(20,
+            INFO_RESULT_ATTRIBUTE_OR_VALUE_EXISTS.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it violated the syntax for a specified attribute.
-   */
-  public static final ResultCode INVALID_ATTRIBUTE_SYNTAX = registerErrorResultCode(
-      21, INFO_RESULT_INVALID_ATTRIBUTE_SYNTAX.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it violated the syntax for a specified attribute.
+     */
+    public static final ResultCode INVALID_ATTRIBUTE_SYNTAX = registerErrorResultCode(21,
+            INFO_RESULT_INVALID_ATTRIBUTE_SYNTAX.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it referenced an entry that does not exist.
-   */
-  public static final ResultCode NO_SUCH_OBJECT = registerErrorResultCode(32,
-      INFO_RESULT_NO_SUCH_OBJECT.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it referenced an entry that does not exist.
+     */
+    public static final ResultCode NO_SUCH_OBJECT = registerErrorResultCode(32,
+            INFO_RESULT_NO_SUCH_OBJECT.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it attempted to perform an illegal operation on an alias.
-   */
-  public static final ResultCode ALIAS_PROBLEM = registerErrorResultCode(33,
-      INFO_RESULT_ALIAS_PROBLEM.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it attempted to perform an illegal operation on an alias.
+     */
+    public static final ResultCode ALIAS_PROBLEM = registerErrorResultCode(33,
+            INFO_RESULT_ALIAS_PROBLEM.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have resulted in an entry with an invalid or malformed DN.
-   */
-  public static final ResultCode INVALID_DN_SYNTAX = registerErrorResultCode(
-      34, INFO_RESULT_INVALID_DN_SYNTAX.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have resulted in an entry with an invalid or malformed
+     * DN.
+     */
+    public static final ResultCode INVALID_DN_SYNTAX = registerErrorResultCode(34,
+            INFO_RESULT_INVALID_DN_SYNTAX.get());
 
-  /**
-   * The result code that indicates that a problem was encountered while
-   * attempting to dereference an alias for a search operation.
-   */
-  public static final ResultCode ALIAS_DEREFERENCING_PROBLEM = registerErrorResultCode(
-      36, INFO_RESULT_ALIAS_DEREFERENCING_PROBLEM.get());
+    /**
+     * The result code that indicates that a problem was encountered while
+     * attempting to dereference an alias for a search operation.
+     */
+    public static final ResultCode ALIAS_DEREFERENCING_PROBLEM = registerErrorResultCode(36,
+            INFO_RESULT_ALIAS_DEREFERENCING_PROBLEM.get());
 
-  /**
-   * The result code that indicates that an authentication attempt failed
-   * because the requested type of authentication was not appropriate for the
-   * targeted entry.
-   */
-  public static final ResultCode INAPPROPRIATE_AUTHENTICATION = registerErrorResultCode(
-      48, INFO_RESULT_INAPPROPRIATE_AUTHENTICATION.get());
+    /**
+     * The result code that indicates that an authentication attempt failed
+     * because the requested type of authentication was not appropriate for the
+     * targeted entry.
+     */
+    public static final ResultCode INAPPROPRIATE_AUTHENTICATION = registerErrorResultCode(48,
+            INFO_RESULT_INAPPROPRIATE_AUTHENTICATION.get());
 
-  /**
-   * The result code that indicates that an authentication attempt failed
-   * because the user did not provide a valid set of credentials.
-   */
-  public static final ResultCode INVALID_CREDENTIALS = registerErrorResultCode(
-      49, INFO_RESULT_INVALID_CREDENTIALS.get());
+    /**
+     * The result code that indicates that an authentication attempt failed
+     * because the user did not provide a valid set of credentials.
+     */
+    public static final ResultCode INVALID_CREDENTIALS = registerErrorResultCode(49,
+            INFO_RESULT_INVALID_CREDENTIALS.get());
 
-  /**
-   * The result code that indicates that the client does not have sufficient
-   * permission to perform the requested operation.
-   */
-  public static final ResultCode INSUFFICIENT_ACCESS_RIGHTS = registerErrorResultCode(
-      50, INFO_RESULT_INSUFFICIENT_ACCESS_RIGHTS.get());
+    /**
+     * The result code that indicates that the client does not have sufficient
+     * permission to perform the requested operation.
+     */
+    public static final ResultCode INSUFFICIENT_ACCESS_RIGHTS = registerErrorResultCode(50,
+            INFO_RESULT_INSUFFICIENT_ACCESS_RIGHTS.get());
 
-  /**
-   * The result code that indicates that the server is too busy to process the
-   * requested operation.
-   */
-  public static final ResultCode BUSY = registerErrorResultCode(51,
-      INFO_RESULT_BUSY.get());
+    /**
+     * The result code that indicates that the server is too busy to process the
+     * requested operation.
+     */
+    public static final ResultCode BUSY = registerErrorResultCode(51, INFO_RESULT_BUSY.get());
 
-  /**
-   * The result code that indicates that either the entire server or one or more
-   * required resources were not available for use in processing the request.
-   */
-  public static final ResultCode UNAVAILABLE = registerErrorResultCode(52,
-      INFO_RESULT_UNAVAILABLE.get());
+    /**
+     * The result code that indicates that either the entire server or one or
+     * more required resources were not available for use in processing the
+     * request.
+     */
+    public static final ResultCode UNAVAILABLE = registerErrorResultCode(52,
+            INFO_RESULT_UNAVAILABLE.get());
 
-  /**
-   * The result code that indicates that the server is unwilling to perform the
-   * requested operation.
-   */
-  public static final ResultCode UNWILLING_TO_PERFORM = registerErrorResultCode(
-      53, INFO_RESULT_UNWILLING_TO_PERFORM.get());
+    /**
+     * The result code that indicates that the server is unwilling to perform
+     * the requested operation.
+     */
+    public static final ResultCode UNWILLING_TO_PERFORM = registerErrorResultCode(53,
+            INFO_RESULT_UNWILLING_TO_PERFORM.get());
 
-  /**
-   * The result code that indicates that a referral or chaining loop was
-   * detected while processing the request.
-   */
-  public static final ResultCode LOOP_DETECT = registerErrorResultCode(54,
-      INFO_RESULT_LOOP_DETECT.get());
+    /**
+     * The result code that indicates that a referral or chaining loop was
+     * detected while processing the request.
+     */
+    public static final ResultCode LOOP_DETECT = registerErrorResultCode(54,
+            INFO_RESULT_LOOP_DETECT.get());
 
-  /**
-   * The result code that indicates that a search request included a VLV request
-   * control without a server-side sort control.
-   */
-  public static final ResultCode SORT_CONTROL_MISSING = registerErrorResultCode(
-      60, INFO_RESULT_SORT_CONTROL_MISSING.get());
+    /**
+     * The result code that indicates that a search request included a VLV
+     * request control without a server-side sort control.
+     */
+    public static final ResultCode SORT_CONTROL_MISSING = registerErrorResultCode(60,
+            INFO_RESULT_SORT_CONTROL_MISSING.get());
 
-  /**
-   * The result code that indicates that a search request included a VLV request
-   * control with an invalid offset.
-   */
-  public static final ResultCode OFFSET_RANGE_ERROR = registerErrorResultCode(
-      61, INFO_RESULT_OFFSET_RANGE_ERROR.get());
+    /**
+     * The result code that indicates that a search request included a VLV
+     * request control with an invalid offset.
+     */
+    public static final ResultCode OFFSET_RANGE_ERROR = registerErrorResultCode(61,
+            INFO_RESULT_OFFSET_RANGE_ERROR.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have violated the server's naming configuration.
-   */
-  public static final ResultCode NAMING_VIOLATION = registerErrorResultCode(64,
-      INFO_RESULT_NAMING_VIOLATION.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have violated the server's naming configuration.
+     */
+    public static final ResultCode NAMING_VIOLATION = registerErrorResultCode(64,
+            INFO_RESULT_NAMING_VIOLATION.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have resulted in an entry that violated the server schema.
-   */
-  public static final ResultCode OBJECTCLASS_VIOLATION = registerErrorResultCode(
-      65, INFO_RESULT_OBJECTCLASS_VIOLATION.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have resulted in an entry that violated the server
+     * schema.
+     */
+    public static final ResultCode OBJECTCLASS_VIOLATION = registerErrorResultCode(65,
+            INFO_RESULT_OBJECTCLASS_VIOLATION.get());
 
-  /**
-   * The result code that indicates that the requested operation is not allowed
-   * for non-leaf entries.
-   */
-  public static final ResultCode NOT_ALLOWED_ON_NONLEAF = registerErrorResultCode(
-      66, INFO_RESULT_NOT_ALLOWED_ON_NONLEAF.get());
+    /**
+     * The result code that indicates that the requested operation is not
+     * allowed for non-leaf entries.
+     */
+    public static final ResultCode NOT_ALLOWED_ON_NONLEAF = registerErrorResultCode(66,
+            INFO_RESULT_NOT_ALLOWED_ON_NONLEAF.get());
 
-  /**
-   * The result code that indicates that the requested operation is not allowed
-   * on an RDN attribute.
-   */
-  public static final ResultCode NOT_ALLOWED_ON_RDN = registerErrorResultCode(
-      67, INFO_RESULT_NOT_ALLOWED_ON_RDN.get());
+    /**
+     * The result code that indicates that the requested operation is not
+     * allowed on an RDN attribute.
+     */
+    public static final ResultCode NOT_ALLOWED_ON_RDN = registerErrorResultCode(67,
+            INFO_RESULT_NOT_ALLOWED_ON_RDN.get());
 
-  /**
-   * The result code that indicates that the requested operation failed because
-   * it would have resulted in an entry that conflicts with an entry that
-   * already exists.
-   */
-  public static final ResultCode ENTRY_ALREADY_EXISTS = registerErrorResultCode(
-      68, INFO_RESULT_ENTRY_ALREADY_EXISTS.get());
+    /**
+     * The result code that indicates that the requested operation failed
+     * because it would have resulted in an entry that conflicts with an entry
+     * that already exists.
+     */
+    public static final ResultCode ENTRY_ALREADY_EXISTS = registerErrorResultCode(68,
+            INFO_RESULT_ENTRY_ALREADY_EXISTS.get());
 
-  /**
-   * The result code that indicates that the operation could not be processed
-   * because it would have modified the objectclasses associated with an entry
-   * in an illegal manner.
-   */
-  public static final ResultCode OBJECTCLASS_MODS_PROHIBITED = registerErrorResultCode(
-      69, INFO_RESULT_OBJECTCLASS_MODS_PROHIBITED.get());
+    /**
+     * The result code that indicates that the operation could not be processed
+     * because it would have modified the objectclasses associated with an entry
+     * in an illegal manner.
+     */
+    public static final ResultCode OBJECTCLASS_MODS_PROHIBITED = registerErrorResultCode(69,
+            INFO_RESULT_OBJECTCLASS_MODS_PROHIBITED.get());
 
-  /**
-   * The result code that indicates that the operation could not be processed
-   * because it would impact multiple DSAs or other repositories.
-   */
-  public static final ResultCode AFFECTS_MULTIPLE_DSAS = registerErrorResultCode(
-      71, INFO_RESULT_AFFECTS_MULTIPLE_DSAS.get());
+    /**
+     * The result code that indicates that the operation could not be processed
+     * because it would impact multiple DSAs or other repositories.
+     */
+    public static final ResultCode AFFECTS_MULTIPLE_DSAS = registerErrorResultCode(71,
+            INFO_RESULT_AFFECTS_MULTIPLE_DSAS.get());
 
-  /**
-   * The result code that indicates that the operation could not be processed
-   * because there was an error while processing the virtual list view control.
-   */
-  public static final ResultCode VIRTUAL_LIST_VIEW_ERROR = registerErrorResultCode(
-      76, INFO_RESULT_VIRTUAL_LIST_VIEW_ERROR.get());
+    /**
+     * The result code that indicates that the operation could not be processed
+     * because there was an error while processing the virtual list view
+     * control.
+     */
+    public static final ResultCode VIRTUAL_LIST_VIEW_ERROR = registerErrorResultCode(76,
+            INFO_RESULT_VIRTUAL_LIST_VIEW_ERROR.get());
 
-  /**
-   * The result code that should be used if no other result code is appropriate.
-   */
-  public static final ResultCode OTHER = registerErrorResultCode(80,
-      INFO_RESULT_OTHER.get());
+    /**
+     * The result code that should be used if no other result code is
+     * appropriate.
+     */
+    public static final ResultCode OTHER = registerErrorResultCode(80, INFO_RESULT_OTHER.get());
 
-  /**
-   * The client-side result code that indicates that a previously-established
-   * connection to the server was lost. This is for client-side use only and
-   * should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_SERVER_DOWN = registerErrorResultCode(
-      81, INFO_RESULT_CLIENT_SIDE_SERVER_DOWN.get());
+    /**
+     * The client-side result code that indicates that a previously-established
+     * connection to the server was lost. This is for client-side use only and
+     * should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_SERVER_DOWN = registerErrorResultCode(81,
+            INFO_RESULT_CLIENT_SIDE_SERVER_DOWN.get());
 
-  /**
-   * The client-side result code that indicates that a local error occurred that
-   * had nothing to do with interaction with the server. This is for client-side
-   * use only and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_LOCAL_ERROR = registerErrorResultCode(
-      82, INFO_RESULT_CLIENT_SIDE_LOCAL_ERROR.get());
+    /**
+     * The client-side result code that indicates that a local error occurred
+     * that had nothing to do with interaction with the server. This is for
+     * client-side use only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_LOCAL_ERROR = registerErrorResultCode(82,
+            INFO_RESULT_CLIENT_SIDE_LOCAL_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that an error occurred while
-   * encoding a request to send to the server. This is for client-side use only
-   * and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_ENCODING_ERROR = registerErrorResultCode(
-      83, INFO_RESULT_CLIENT_SIDE_ENCODING_ERROR.get());
+    /**
+     * The client-side result code that indicates that an error occurred while
+     * encoding a request to send to the server. This is for client-side use
+     * only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_ENCODING_ERROR = registerErrorResultCode(83,
+            INFO_RESULT_CLIENT_SIDE_ENCODING_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that an error occurred while
-   * decoding a response from the server. This is for client-side use only and
-   * should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_DECODING_ERROR = registerErrorResultCode(
-      84, INFO_RESULT_CLIENT_SIDE_DECODING_ERROR.get());
+    /**
+     * The client-side result code that indicates that an error occurred while
+     * decoding a response from the server. This is for client-side use only and
+     * should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_DECODING_ERROR = registerErrorResultCode(84,
+            INFO_RESULT_CLIENT_SIDE_DECODING_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that the client did not receive
-   * an expected response in a timely manner. This is for client-side use only
-   * and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_TIMEOUT = registerErrorResultCode(
-      85, INFO_RESULT_CLIENT_SIDE_TIMEOUT.get());
+    /**
+     * The client-side result code that indicates that the client did not
+     * receive an expected response in a timely manner. This is for client-side
+     * use only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_TIMEOUT = registerErrorResultCode(85,
+            INFO_RESULT_CLIENT_SIDE_TIMEOUT.get());
 
-  /**
-   * The client-side result code that indicates that the user requested an
-   * unknown or unsupported authentication mechanism. This is for client-side
-   * use only and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_AUTH_UNKNOWN = registerErrorResultCode(
-      86, INFO_RESULT_CLIENT_SIDE_AUTH_UNKNOWN.get());
+    /**
+     * The client-side result code that indicates that the user requested an
+     * unknown or unsupported authentication mechanism. This is for client-side
+     * use only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_AUTH_UNKNOWN = registerErrorResultCode(86,
+            INFO_RESULT_CLIENT_SIDE_AUTH_UNKNOWN.get());
 
-  /**
-   * The client-side result code that indicates that the filter provided by the
-   * user was malformed and could not be parsed. This is for client-side use
-   * only and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_FILTER_ERROR = registerErrorResultCode(
-      87, INFO_RESULT_CLIENT_SIDE_FILTER_ERROR.get());
+    /**
+     * The client-side result code that indicates that the filter provided by
+     * the user was malformed and could not be parsed. This is for client-side
+     * use only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_FILTER_ERROR = registerErrorResultCode(87,
+            INFO_RESULT_CLIENT_SIDE_FILTER_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that the user cancelled an
-   * operation. This is for client-side use only and should never be transferred
-   * over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_USER_CANCELLED = registerErrorResultCode(
-      88, INFO_RESULT_CLIENT_SIDE_USER_CANCELLED.get());
+    /**
+     * The client-side result code that indicates that the user cancelled an
+     * operation. This is for client-side use only and should never be
+     * transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_USER_CANCELLED = registerErrorResultCode(88,
+            INFO_RESULT_CLIENT_SIDE_USER_CANCELLED.get());
 
-  /**
-   * The client-side result code that indicates that there was a problem with
-   * one or more of the parameters provided by the user. This is for client-side
-   * use only and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_PARAM_ERROR = registerErrorResultCode(
-      89, INFO_RESULT_CLIENT_SIDE_PARAM_ERROR.get());
+    /**
+     * The client-side result code that indicates that there was a problem with
+     * one or more of the parameters provided by the user. This is for
+     * client-side use only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_PARAM_ERROR = registerErrorResultCode(89,
+            INFO_RESULT_CLIENT_SIDE_PARAM_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that the client application was
-   * not able to allocate enough memory for the requested operation. This is for
-   * client-side use only and should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_NO_MEMORY = registerErrorResultCode(
-      90, INFO_RESULT_CLIENT_SIDE_NO_MEMORY.get());
+    /**
+     * The client-side result code that indicates that the client application
+     * was not able to allocate enough memory for the requested operation. This
+     * is for client-side use only and should never be transferred over
+     * protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_NO_MEMORY = registerErrorResultCode(90,
+            INFO_RESULT_CLIENT_SIDE_NO_MEMORY.get());
 
-  /**
-   * The client-side result code that indicates that the client was not able to
-   * establish a connection to the server. This is for client-side use only and
-   * should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_CONNECT_ERROR = registerErrorResultCode(
-      91, INFO_RESULT_CLIENT_SIDE_CONNECT_ERROR.get());
+    /**
+     * The client-side result code that indicates that the client was not able
+     * to establish a connection to the server. This is for client-side use only
+     * and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_CONNECT_ERROR = registerErrorResultCode(91,
+            INFO_RESULT_CLIENT_SIDE_CONNECT_ERROR.get());
 
-  /**
-   * The client-side result code that indicates that the user requested an
-   * operation that is not supported. This is for client-side use only and
-   * should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_NOT_SUPPORTED = registerErrorResultCode(
-      92, INFO_RESULT_CLIENT_SIDE_NOT_SUPPORTED.get());
+    /**
+     * The client-side result code that indicates that the user requested an
+     * operation that is not supported. This is for client-side use only and
+     * should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_NOT_SUPPORTED = registerErrorResultCode(92,
+            INFO_RESULT_CLIENT_SIDE_NOT_SUPPORTED.get());
 
-  /**
-   * The client-side result code that indicates that the client expected a
-   * control to be present in the response from the server but it was not
-   * included. This is for client-side use only and should never be transferred
-   * over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_CONTROL_NOT_FOUND = registerErrorResultCode(
-      93, INFO_RESULT_CLIENT_SIDE_CONTROL_NOT_FOUND.get());
+    /**
+     * The client-side result code that indicates that the client expected a
+     * control to be present in the response from the server but it was not
+     * included. This is for client-side use only and should never be
+     * transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_CONTROL_NOT_FOUND = registerErrorResultCode(93,
+            INFO_RESULT_CLIENT_SIDE_CONTROL_NOT_FOUND.get());
 
-  /**
-   * The client-side result code that indicates that the requested single entry
-   * search operation or read operation failed because the Directory Server did
-   * not return any matching entries. This is for client-side use only and
-   * should never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_NO_RESULTS_RETURNED = registerErrorResultCode(
-      94, INFO_RESULT_CLIENT_SIDE_NO_RESULTS_RETURNED.get());
+    /**
+     * The client-side result code that indicates that the requested single
+     * entry search operation or read operation failed because the Directory
+     * Server did not return any matching entries. This is for client-side use
+     * only and should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_NO_RESULTS_RETURNED = registerErrorResultCode(94,
+            INFO_RESULT_CLIENT_SIDE_NO_RESULTS_RETURNED.get());
 
-  /**
-   * The client-side result code that the requested single entry search
-   * operation or read operation failed because the Directory Server returned
-   * multiple matching entries (or search references) when only a single
-   * matching entry was expected. This is for client-side use only and should
-   * never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED = registerErrorResultCode(
-      95, INFO_RESULT_CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED.get());
+    /**
+     * The client-side result code that the requested single entry search
+     * operation or read operation failed because the Directory Server returned
+     * multiple matching entries (or search references) when only a single
+     * matching entry was expected. This is for client-side use only and should
+     * never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED =
+            registerErrorResultCode(95, INFO_RESULT_CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED.get());
 
-  /**
-   * The client-side result code that indicates that the client detected a
-   * referral loop caused by servers referencing each other in a circular
-   * manner. This is for client-side use only and should never be transferred
-   * over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_CLIENT_LOOP = registerErrorResultCode(
-      96, INFO_RESULT_CLIENT_SIDE_CLIENT_LOOP.get());
+    /**
+     * The client-side result code that indicates that the client detected a
+     * referral loop caused by servers referencing each other in a circular
+     * manner. This is for client-side use only and should never be transferred
+     * over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_CLIENT_LOOP = registerErrorResultCode(96,
+            INFO_RESULT_CLIENT_SIDE_CLIENT_LOOP.get());
 
-  /**
-   * The client-side result code that indicates that the client reached the
-   * maximum number of hops allowed when attempting to follow a referral (i.e.,
-   * following one referral resulted in another referral which resulted in
-   * another referral and so on). This is for client-side use only and should
-   * never be transferred over protocol.
-   */
-  public static final ResultCode CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED = registerErrorResultCode(
-      97, INFO_RESULT_CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED.get());
+    /**
+     * The client-side result code that indicates that the client reached the
+     * maximum number of hops allowed when attempting to follow a referral
+     * (i.e., following one referral resulted in another referral which resulted
+     * in another referral and so on). This is for client-side use only and
+     * should never be transferred over protocol.
+     */
+    public static final ResultCode CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED = registerErrorResultCode(
+            97, INFO_RESULT_CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED.get());
 
-  /**
-   * The result code that indicates that a cancel request was successful, or
-   * that the specified operation was canceled.
-   */
-  public static final ResultCode CANCELLED = registerErrorResultCode(118,
-      INFO_RESULT_CANCELED.get());
+    /**
+     * The result code that indicates that a cancel request was successful, or
+     * that the specified operation was canceled.
+     */
+    public static final ResultCode CANCELLED = registerErrorResultCode(118, INFO_RESULT_CANCELED
+            .get());
 
-  /**
-   * The result code that indicates that a cancel request was unsuccessful
-   * because the targeted operation did not exist or had already completed.
-   */
-  public static final ResultCode NO_SUCH_OPERATION = registerErrorResultCode(
-      119, INFO_RESULT_NO_SUCH_OPERATION.get());
+    /**
+     * The result code that indicates that a cancel request was unsuccessful
+     * because the targeted operation did not exist or had already completed.
+     */
+    public static final ResultCode NO_SUCH_OPERATION = registerErrorResultCode(119,
+            INFO_RESULT_NO_SUCH_OPERATION.get());
 
-  /**
-   * The result code that indicates that a cancel request was unsuccessful
-   * because processing on the targeted operation had already reached a point at
-   * which it could not be canceled.
-   */
-  public static final ResultCode TOO_LATE = registerErrorResultCode(120,
-      INFO_RESULT_TOO_LATE.get());
+    /**
+     * The result code that indicates that a cancel request was unsuccessful
+     * because processing on the targeted operation had already reached a point
+     * at which it could not be canceled.
+     */
+    public static final ResultCode TOO_LATE = registerErrorResultCode(120, INFO_RESULT_TOO_LATE
+            .get());
 
-  /**
-   * The result code that indicates that a cancel request was unsuccessful
-   * because the targeted operation was one that could not be canceled.
-   */
-  public static final ResultCode CANNOT_CANCEL = registerErrorResultCode(121,
-      INFO_RESULT_CANNOT_CANCEL.get());
+    /**
+     * The result code that indicates that a cancel request was unsuccessful
+     * because the targeted operation was one that could not be canceled.
+     */
+    public static final ResultCode CANNOT_CANCEL = registerErrorResultCode(121,
+            INFO_RESULT_CANNOT_CANCEL.get());
 
-  /**
-   * The result code that indicates that the filter contained in an assertion
-   * control failed to match the target entry.
-   */
-  public static final ResultCode ASSERTION_FAILED = registerErrorResultCode(
-      122, INFO_RESULT_ASSERTION_FAILED.get());
+    /**
+     * The result code that indicates that the filter contained in an assertion
+     * control failed to match the target entry.
+     */
+    public static final ResultCode ASSERTION_FAILED = registerErrorResultCode(122,
+            INFO_RESULT_ASSERTION_FAILED.get());
 
-  /**
-   * The result code that should be used if the server will not allow the client
-   * to use the requested authorization.
-   */
-  public static final ResultCode AUTHORIZATION_DENIED = registerErrorResultCode(
-      123, INFO_RESULT_AUTHORIZATION_DENIED.get());
+    /**
+     * The result code that should be used if the server will not allow the
+     * client to use the requested authorization.
+     */
+    public static final ResultCode AUTHORIZATION_DENIED = registerErrorResultCode(123,
+            INFO_RESULT_AUTHORIZATION_DENIED.get());
 
-  /**
-   * The result code that should be used if the server did not actually complete
-   * processing on the associated operation because the request included the
-   * LDAP No-Op control.
-   */
-  public static final ResultCode NO_OPERATION = registerSuccessResultCode(16654,
-      INFO_RESULT_NO_OPERATION.get());
+    /**
+     * The result code that should be used if the server did not actually
+     * complete processing on the associated operation because the request
+     * included the LDAP No-Op control.
+     */
+    public static final ResultCode NO_OPERATION = registerSuccessResultCode(16654,
+            INFO_RESULT_NO_OPERATION.get());
 
+    /**
+     * Returns the result code having the specified integer value as defined in
+     * RFC 4511 section 4.1.9. If there is no result code associated with the
+     * specified integer value then a temporary result code is automatically
+     * created in order to handle cases where unexpected result codes are
+     * returned from the server.
+     *
+     * @param intValue
+     *            The integer value of the result code.
+     * @return The result code.
+     */
+    public static ResultCode valueOf(final int intValue) {
+        ResultCode resultCode = null;
 
+        if (intValue >= 0 || intValue < ELEMENTS.length) {
+            resultCode = ELEMENTS[intValue];
+        }
 
-  /**
-   * Returns the result code having the specified integer value as defined in
-   * RFC 4511 section 4.1.9. If there is no result code associated with the
-   * specified integer value then a temporary result code is automatically
-   * created in order to handle cases where unexpected result codes are returned
-   * from the server.
-   *
-   * @param intValue
-   *          The integer value of the result code.
-   * @return The result code.
-   */
-  public static ResultCode valueOf(final int intValue)
-  {
-    ResultCode resultCode = null;
+        if (resultCode == null) {
+            resultCode =
+                    new ResultCode(intValue, LocalizableMessage.raw("undefined(" + intValue + ")"),
+                            true);
+        }
 
-    if (intValue >= 0 || intValue < ELEMENTS.length)
-    {
-      resultCode = ELEMENTS[intValue];
+        return resultCode;
     }
 
-    if (resultCode == null)
-    {
-      resultCode = new ResultCode(intValue, LocalizableMessage.raw("undefined("
-          + intValue + ")"), true);
+    /**
+     * Returns an unmodifiable list containing the set of available result codes
+     * indexed on their integer value as defined in RFC 4511 section 4.1.9.
+     *
+     * @return An unmodifiable list containing the set of available result
+     *         codes.
+     */
+    public static List<ResultCode> values() {
+        return IMMUTABLE_ELEMENTS;
     }
 
-    return resultCode;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the set of available result codes
-   * indexed on their integer value as defined in RFC 4511 section 4.1.9.
-   *
-   * @return An unmodifiable list containing the set of available result codes.
-   */
-  public static List<ResultCode> values()
-  {
-    return IMMUTABLE_ELEMENTS;
-  }
-
-
-
-  /**
-   * Creates and registers a new error result code with the application.
-   *
-   * @param intValue
-   *          The integer value of the error result code as defined in RFC 4511
-   *          section 4.1.9.
-   * @param name
-   *          The name of the error result code.
-   * @return The new error result code.
-   */
-  private static ResultCode registerErrorResultCode(final int intValue,
-      final LocalizableMessage name)
-  {
-    final ResultCode t = new ResultCode(intValue, name, true);
-    ELEMENTS[intValue] = t;
-    return t;
-  }
-
-
-
-  /**
-   * Creates and registers a new success result code with the application.
-   *
-   * @param intValue
-   *          The integer value of the success result code as defined in RFC
-   *          4511 section 4.1.9.
-   * @param name
-   *          The name of the success result code.
-   * @return The new success result code.
-   */
-  private static ResultCode registerSuccessResultCode(final int intValue,
-      final LocalizableMessage name)
-  {
-    final ResultCode t = new ResultCode(intValue, name, false);
-    ELEMENTS[intValue] = t;
-    return t;
-  }
-
-
-
-  private final int intValue;
-
-  private final LocalizableMessage name;
-
-  private final boolean exceptional;
-
-
-
-  // Prevent direct instantiation.
-  private ResultCode(final int intValue, final LocalizableMessage name,
-      final boolean exceptional)
-  {
-    this.intValue = intValue;
-    this.name = name;
-    this.exceptional = exceptional;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
+    /**
+     * Creates and registers a new error result code with the application.
+     *
+     * @param intValue
+     *            The integer value of the error result code as defined in RFC
+     *            4511 section 4.1.9.
+     * @param name
+     *            The name of the error result code.
+     * @return The new error result code.
+     */
+    private static ResultCode registerErrorResultCode(final int intValue,
+            final LocalizableMessage name) {
+        final ResultCode t = new ResultCode(intValue, name, true);
+        ELEMENTS[intValue] = t;
+        return t;
     }
-    else if (obj instanceof ResultCode)
-    {
-      return this.intValue == ((ResultCode) obj).intValue;
+
+    /**
+     * Creates and registers a new success result code with the application.
+     *
+     * @param intValue
+     *            The integer value of the success result code as defined in RFC
+     *            4511 section 4.1.9.
+     * @param name
+     *            The name of the success result code.
+     * @return The new success result code.
+     */
+    private static ResultCode registerSuccessResultCode(final int intValue,
+            final LocalizableMessage name) {
+        final ResultCode t = new ResultCode(intValue, name, false);
+        ELEMENTS[intValue] = t;
+        return t;
     }
-    else
-    {
-      return false;
+
+    private final int intValue;
+
+    private final LocalizableMessage name;
+
+    private final boolean exceptional;
+
+    // Prevent direct instantiation.
+    private ResultCode(final int intValue, final LocalizableMessage name, final boolean exceptional) {
+        this.intValue = intValue;
+        this.name = name;
+        this.exceptional = exceptional;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof ResultCode) {
+            return this.intValue == ((ResultCode) obj).intValue;
+        } else {
+            return false;
+        }
+    }
 
+    /**
+     * Returns the short human-readable name of this result code.
+     *
+     * @return The short human-readable name of this result code.
+     */
+    public LocalizableMessage getName() {
+        return name;
+    }
 
-  /**
-   * Returns the short human-readable name of this result code.
-   *
-   * @return The short human-readable name of this result code.
-   */
-  public LocalizableMessage getName()
-  {
-    return name;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return intValue;
+    }
 
+    /**
+     * Returns the integer value of this result code.
+     *
+     * @return The integer value of this result code.
+     */
+    public int intValue() {
+        return intValue;
+    }
 
+    /**
+     * Indicates whether or not this result code represents an error result.
+     * <p>
+     * The following result codes are NOT interpreted as error results:
+     * <ul>
+     * <li>{@link #SUCCESS}
+     * <li>{@link #COMPARE_FALSE}
+     * <li>{@link #COMPARE_TRUE}
+     * <li>{@link #SASL_BIND_IN_PROGRESS}
+     * <li>{@link #NO_OPERATION}
+     * </ul>
+     * In order to make it easier for application to detect referrals, the
+     * {@link #REFERRAL} result code is interpreted as an error result (the LDAP
+     * RFCs treat referrals as a success response).
+     *
+     * @return {@code true} if this result code represents an error result,
+     *         otherwise {@code false}.
+     */
+    public boolean isExceptional() {
+        return exceptional;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return intValue;
-  }
-
-
-
-  /**
-   * Returns the integer value of this result code.
-   *
-   * @return The integer value of this result code.
-   */
-  public int intValue()
-  {
-    return intValue;
-  }
-
-
-
-  /**
-   * Indicates whether or not this result code represents an error result.
-   * <p>
-   * The following result codes are NOT interpreted as error results:
-   * <ul>
-   * <li>{@link #SUCCESS}
-   * <li>{@link #COMPARE_FALSE}
-   * <li>{@link #COMPARE_TRUE}
-   * <li>{@link #SASL_BIND_IN_PROGRESS}
-   * <li>{@link #NO_OPERATION}
-   * </ul>
-   * In order to make it easier for application to detect referrals, the
-   * {@link #REFERRAL} result code is interpreted as an error result (the LDAP
-   * RFCs treat referrals as a success response).
-   *
-   * @return {@code true} if this result code represents an error result,
-   *         otherwise {@code false}.
-   */
-  public boolean isExceptional()
-  {
-    return exceptional;
-  }
-
-
-
-  /**
-   * Returns the string representation of this result code.
-   *
-   * @return The string representation of this result code.
-   */
-  @Override
-  public String toString()
-  {
-    return name.toString();
-  }
+    /**
+     * Returns the string representation of this result code.
+     *
+     * @return The string representation of this result code.
+     */
+    @Override
+    public String toString() {
+        return name.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java
index 8688336..316c7c9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A completion handler for consuming the result of an asynchronous operation or
  * connection attempts.
@@ -47,26 +44,23 @@
  * handlers.
  *
  * @param <S>
- *          The type of result handled by this result handler.
+ *            The type of result handled by this result handler.
  */
-public interface ResultHandler<S>
-{
-  /**
-   * Invoked when the asynchronous operation has failed.
-   *
-   * @param error
-   *          The error result exception indicating why the asynchronous
-   *          operation has failed.
-   */
-  void handleErrorResult(ErrorResultException error);
+public interface ResultHandler<S> {
+    /**
+     * Invoked when the asynchronous operation has failed.
+     *
+     * @param error
+     *            The error result exception indicating why the asynchronous
+     *            operation has failed.
+     */
+    void handleErrorResult(ErrorResultException error);
 
-
-
-  /**
-   * Invoked when the asynchronous operation has completed successfully.
-   *
-   * @param result
-   *          The result of the asynchronous operation.
-   */
-  void handleResult(S result);
+    /**
+     * Invoked when the asynchronous operation has completed successfully.
+     *
+     * @param result
+     *            The result of the asynchronous operation.
+     */
+    void handleResult(S result);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
index ef9e9e6..861e913 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 import java.util.Collections;
 
@@ -38,9 +35,11 @@
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.ldap.schema.CoreSchema;
 
-import com.forgerock.opendj.util.*;
-
-
+import com.forgerock.opendj.util.Collections2;
+import com.forgerock.opendj.util.Function;
+import com.forgerock.opendj.util.Functions;
+import com.forgerock.opendj.util.FutureResultTransformer;
+import com.forgerock.opendj.util.Validator;
 
 /**
  * The root DSE is a DSA-specific Entry (DSE) and not part of any naming context
@@ -82,435 +81,359 @@
  * @see <a href="http://tools.ietf.org/html/rfc3112">RFC 3112 - LDAP
  *      Authentication Password Schema </a>
  */
-public final class RootDSE
-{
-  private static final AttributeDescription ATTR_ALT_SERVER =
-    AttributeDescription.create(CoreSchema.getAltServerAttributeType());
+public final class RootDSE {
+    private static final AttributeDescription ATTR_ALT_SERVER = AttributeDescription
+            .create(CoreSchema.getAltServerAttributeType());
 
-  private static final AttributeDescription ATTR_NAMING_CONTEXTS =
-    AttributeDescription.create(CoreSchema.getNamingContextsAttributeType());
+    private static final AttributeDescription ATTR_NAMING_CONTEXTS = AttributeDescription
+            .create(CoreSchema.getNamingContextsAttributeType());
 
-  private static final AttributeDescription ATTR_SUBSCHEMA_SUBENTRY =
-    AttributeDescription.create(CoreSchema.getSubschemaSubentryAttributeType());
+    private static final AttributeDescription ATTR_SUBSCHEMA_SUBENTRY = AttributeDescription
+            .create(CoreSchema.getSubschemaSubentryAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES =
-    AttributeDescription.create(
-        CoreSchema.getSupportedAuthPasswordSchemesAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES =
+            AttributeDescription.create(CoreSchema.getSupportedAuthPasswordSchemesAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_CONTROL =
-    AttributeDescription.create(CoreSchema.getSupportedControlAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_CONTROL = AttributeDescription
+            .create(CoreSchema.getSupportedControlAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_EXTENSION =
-    AttributeDescription.create(
-        CoreSchema.getSupportedExtensionAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_EXTENSION = AttributeDescription
+            .create(CoreSchema.getSupportedExtensionAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_FEATURE =
-    AttributeDescription.create(CoreSchema.getSupportedFeaturesAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_FEATURE = AttributeDescription
+            .create(CoreSchema.getSupportedFeaturesAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_LDAP_VERSION =
-    AttributeDescription.create(
-        CoreSchema.getSupportedLDAPVersionAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_LDAP_VERSION = AttributeDescription
+            .create(CoreSchema.getSupportedLDAPVersionAttributeType());
 
-  private static final AttributeDescription ATTR_SUPPORTED_SASL_MECHANISMS =
-    AttributeDescription.create(
-        CoreSchema.getSupportedSASLMechanismsAttributeType());
+    private static final AttributeDescription ATTR_SUPPORTED_SASL_MECHANISMS = AttributeDescription
+            .create(CoreSchema.getSupportedSASLMechanismsAttributeType());
 
-  private static final AttributeDescription ATTR_VENDOR_NAME =
-    AttributeDescription.create(CoreSchema.getVendorNameAttributeType());
+    private static final AttributeDescription ATTR_VENDOR_NAME = AttributeDescription
+            .create(CoreSchema.getVendorNameAttributeType());
 
-  private static final AttributeDescription ATTR_VENDOR_VERSION =
-    AttributeDescription.create(CoreSchema.getVendorNameAttributeType());
+    private static final AttributeDescription ATTR_VENDOR_VERSION = AttributeDescription
+            .create(CoreSchema.getVendorNameAttributeType());
 
-  private static final SearchRequest SEARCH_REQUEST = Requests
-      .newSearchRequest(DN.rootDN(), SearchScope.BASE_OBJECT, Filter
-          .getObjectClassPresentFilter(), ATTR_ALT_SERVER.toString(),
-          ATTR_NAMING_CONTEXTS.toString(), ATTR_SUPPORTED_CONTROL.toString(),
-          ATTR_SUPPORTED_EXTENSION.toString(), ATTR_SUPPORTED_FEATURE
-              .toString(), ATTR_SUPPORTED_LDAP_VERSION.toString(),
-          ATTR_SUPPORTED_SASL_MECHANISMS.toString(), ATTR_VENDOR_NAME
-              .toString(), ATTR_VENDOR_VERSION.toString(),
-          ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES.toString(),
-          ATTR_SUBSCHEMA_SUBENTRY.toString(), "*");
+    private static final SearchRequest SEARCH_REQUEST = Requests.newSearchRequest(DN.rootDN(),
+            SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter(), ATTR_ALT_SERVER
+                    .toString(), ATTR_NAMING_CONTEXTS.toString(),
+            ATTR_SUPPORTED_CONTROL.toString(), ATTR_SUPPORTED_EXTENSION.toString(),
+            ATTR_SUPPORTED_FEATURE.toString(), ATTR_SUPPORTED_LDAP_VERSION.toString(),
+            ATTR_SUPPORTED_SASL_MECHANISMS.toString(), ATTR_VENDOR_NAME.toString(),
+            ATTR_VENDOR_VERSION.toString(), ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES.toString(),
+            ATTR_SUBSCHEMA_SUBENTRY.toString(), "*");
 
+    /**
+     * Asynchronously reads the Root DSE from the Directory Server using the
+     * provided connection.
+     * <p>
+     * If the Root DSE is not returned by the Directory Server then the request
+     * will fail with an {@link EntryNotFoundException}. More specifically, the
+     * returned future will never return {@code null}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose Root DSE is to be
+     *            read.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the result of the operation.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} was {@code null}.
+     */
+    public static FutureResult<RootDSE> readRootDSEAsync(final Connection connection,
+            final ResultHandler<? super RootDSE> handler) {
+        final FutureResultTransformer<SearchResultEntry, RootDSE> future =
+                new FutureResultTransformer<SearchResultEntry, RootDSE>(handler) {
 
+                    @Override
+                    protected RootDSE transformResult(final SearchResultEntry result)
+                            throws ErrorResultException {
+                        return valueOf(result);
+                    }
 
-  /**
-   * Asynchronously reads the Root DSE from the Directory Server using the
-   * provided connection.
-   * <p>
-   * If the Root DSE is not returned by the Directory Server then the request
-   * will fail with an {@link EntryNotFoundException}. More specifically, the
-   * returned future will never return {@code null}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose Root DSE is to be read.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the result of the operation.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} was {@code null}.
-   */
-  public static FutureResult<RootDSE> readRootDSEAsync(
-      final Connection connection, final ResultHandler<? super RootDSE> handler)
-  {
-    final FutureResultTransformer<SearchResultEntry, RootDSE> future =
-      new FutureResultTransformer<SearchResultEntry, RootDSE>(handler)
-    {
+                };
 
-      @Override
-      protected RootDSE transformResult(final SearchResultEntry result)
-          throws ErrorResultException
-      {
-        return valueOf(result);
-      }
-
-    };
-
-    final FutureResult<SearchResultEntry> innerFuture = connection
-        .searchSingleEntryAsync(SEARCH_REQUEST, future);
-    future.setFutureResult(innerFuture);
-    return future;
-  }
-
-
-
-  /**
-   * Reads the Root DSE from the Directory Server using the provided connection.
-   * <p>
-   * If the Root DSE is not returned by the Directory Server then the request
-   * will fail with an {@link EntryNotFoundException}. More specifically, this
-   * method will never return {@code null}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose Root DSE is to be read.
-   * @return The Directory Server's Root DSE.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if {@code
-   *           isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} was {@code null}.
-   */
-  public static RootDSE readRootDSE(final Connection connection)
-      throws ErrorResultException, InterruptedException
-  {
-    final Entry entry = connection.searchSingleEntry(SEARCH_REQUEST);
-    return valueOf(entry);
-  }
-
-
-
-  /**
-   * Creates a new Root DSE instance backed by the provided entry. Modifications
-   * made to {@code entry} will be reflected in the returned Root DSE. The
-   * returned Root DSE instance is unmodifiable and attempts to use modify any
-   * of the returned collections will result in a
-   * {@code UnsupportedOperationException}.
-   *
-   * @param entry
-   *          The Root DSE entry.
-   * @return A Root DSE instance backed by the provided entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  public static RootDSE valueOf(Entry entry)
-  {
-    Validator.ensureNotNull(entry);
-    return new RootDSE(entry);
-  }
-
-
-
-  private final Entry entry;
-
-
-
-  // Prevent direct instantiation.
-  private RootDSE(final Entry entry)
-  {
-    this.entry = entry;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of URIs referring to alternative Directory
-   * Servers that may be contacted when the Directory Server becomes
-   * unavailable.
-   * <p>
-   * URIs for Directory Servers implementing the LDAP protocol are written
-   * according to RFC 4516. Other kinds of URIs may be provided.
-   * <p>
-   * If the Directory Server does not know of any other Directory Servers that
-   * could be used, the returned list will be empty.
-   *
-   * @return An unmodifiable list of URIs referring to alternative Directory
-   *         Servers, which may be empty.
-   * @see <a href="http://tools.ietf.org/html/rfc4516">RFC 4516 - Lightweight
-   *      Directory Access Protocol (LDAP): Uniform Resource Locator </a>
-   */
-  public Collection<String> getAlternativeServers()
-  {
-    return getMultiValuedAttribute(ATTR_ALT_SERVER, Functions.valueToString());
-  }
-
-
-
-  /**
-   * Returns the entry which backs this Root DSE instance. Modifications made to
-   * the returned entry will be reflected in this Root DSE.
-   *
-   * @return The underlying Root DSE entry.
-   */
-  public Entry getEntry()
-  {
-    return entry;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of DNs identifying the context prefixes of the
-   * naming contexts that the Directory Server masters or shadows (in part or in
-   * whole).
-   * <p>
-   * If the Directory Server does not master or shadow any naming contexts, the
-   * returned list will be empty.
-   *
-   * @return An unmodifiable list of DNs identifying the context prefixes of the
-   *         naming contexts, which may be empty.
-   */
-  public Collection<DN> getNamingContexts()
-  {
-    return getMultiValuedAttribute(ATTR_NAMING_CONTEXTS, Functions.valueToDN());
-  }
-
-
-
-  /**
-   * Returns a string which represents the DN of the subschema subentry holding
-   * the schema controlling the Root DSE.
-   * <p>
-   * Clients SHOULD NOT assume that this subschema (sub)entry controls other
-   * entries held by the Directory Server.
-   *
-   * @return The DN of the subschema subentry holding the schema controlling the
-   *         Root DSE, or {@code null} if the DN is not provided.
-   */
-  public DN getSubschemaSubentry()
-  {
-    return getSingleValuedAttribute(ATTR_SUBSCHEMA_SUBENTRY, Functions
-        .valueToDN());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of supported authentication password schemes
-   * which the Directory Server supports.
-   * <p>
-   * If the Directory Server does not support any authentication password
-   * schemes, the returned list will be empty.
-   *
-   * @return An unmodifiable list of supported authentication password schemes,
-   *         which may be empty.
-   * @see <a href="http://tools.ietf.org/html/rfc3112">RFC 3112 - LDAP
-   *      Authentication Password Schema </a>
-   */
-  public Collection<String> getSupportedAuthenticationPasswordSchemes()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES,
-        Functions.valueToString());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of object identifiers identifying the request
-   * controls that the Directory Server supports.
-   * <p>
-   * If the Directory Server does not support any request controls, the returned
-   * list will be empty. Object identifiers identifying response controls may
-   * not be listed.
-   *
-   * @return An unmodifiable list of object identifiers identifying the request
-   *         controls, which may be empty.
-   */
-  public Collection<String> getSupportedControls()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_CONTROL, Functions
-        .valueToString());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of object identifiers identifying the extended
-   * operations that the Directory Server supports.
-   * <p>
-   * If the Directory Server does not support any extended operations, the
-   * returned list will be empty.
-   * <p>
-   * An extended operation generally consists of an extended request and an
-   * extended response but may also include other protocol data units (such as
-   * intermediate responses). The object identifier assigned to the extended
-   * request is used to identify the extended operation. Other object
-   * identifiers used in the extended operation may not be listed as values of
-   * this attribute.
-   *
-   * @return An unmodifiable list of object identifiers identifying the extended
-   *         operations, which may be empty.
-   */
-  public Collection<String> getSupportedExtendedOperations()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_EXTENSION, Functions
-        .valueToString());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of object identifiers identifying elective
-   * features that the Directory Server supports.
-   * <p>
-   * If the server does not support any discoverable elective features, the
-   * returned list will be empty.
-   *
-   * @return An unmodifiable list of object identifiers identifying the elective
-   *         features, which may be empty.
-   */
-  public Collection<String> getSupportedFeatures()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_FEATURE, Functions
-        .valueToString());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of the versions of LDAP that the Directory
-   * Server supports.
-   *
-   * @return An unmodifiable list of the versions.
-   */
-  public Collection<Integer> getSupportedLDAPVersions()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_LDAP_VERSION, Functions
-        .valueToInteger());
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of the SASL mechanisms that the Directory
-   * Server recognizes and/or supports.
-   * <p>
-   * The contents of the returned list may depend on the current session state
-   * and may be empty if the Directory Server does not support any SASL
-   * mechanisms.
-   *
-   * @return An unmodifiable list of the SASL mechanisms, which may be empty.
-   * @see <a href="http://tools.ietf.org/html/rfc4513">RFC 4513 - Lightweight
-   *      Directory Access Protocol (LDAP): Authentication Methods and Security
-   *      Mechanisms </a>
-   * @see <a href="http://tools.ietf.org/html/rfc4422">RFC 4422 - Simple
-   *      Authentication and Security Layer (SASL) </a>
-   */
-  public Collection<String> getSupportedSASLMechanisms()
-  {
-    return getMultiValuedAttribute(ATTR_SUPPORTED_SASL_MECHANISMS, Functions
-        .valueToString());
-  }
-
-
-
-  /**
-   * Returns a string which represents the name of the Directory Server
-   * implementer.
-   *
-   * @return The name of the Directory Server implementer, or {@code null} if
-   *         the vendor name is not provided.
-   * @see <a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing Vendor
-   *      Information in the LDAP Root DSE </a>
-   */
-  public String getVendorName()
-  {
-    return getSingleValuedAttribute(ATTR_VENDOR_NAME, Functions.valueToString());
-  }
-
-
-
-  /**
-   * Returns a string which represents the version of the Directory Server
-   * implementation.
-   * <p>
-   * Note that this value is typically a release value comprised of a string
-   * and/or a string of numbers used by the developer of the LDAP server
-   * product. The returned string will be unique between two versions of the
-   * Directory Server, but there are no other syntactic restrictions on the
-   * value or the way it is formatted.
-   *
-   * @return The version of the Directory Server implementation, or {@code null}
-   *         if the vendor version is not provided.
-   * @see <a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing Vendor
-   *      Information in the LDAP Root DSE </a>
-   */
-  public String getVendorVersion()
-  {
-    return getSingleValuedAttribute(ATTR_VENDOR_VERSION, Functions
-        .valueToString());
-  }
-
-
-
-  private <N> Collection<N> getMultiValuedAttribute(
-      final AttributeDescription attributeDescription,
-      final Function<ByteString, N, Void> function)
-  {
-    // The returned collection is unmodifiable because we may need to
-    // return an empty collection if the attribute does not exist in the
-    // underlying entry. If a value is then added to the returned empty
-    // collection it would require that an attribute is created in the
-    // underlying entry in order to maintain consistency.
-    final Attribute attr = entry.getAttribute(attributeDescription);
-    if (attr != null)
-    {
-      return Collections.unmodifiableCollection(Collections2.transformedCollection(attr,
-          function, Functions.objectToByteString()));
+        final FutureResult<SearchResultEntry> innerFuture =
+                connection.searchSingleEntryAsync(SEARCH_REQUEST, future);
+        future.setFutureResult(innerFuture);
+        return future;
     }
-    else
-    {
-      return Collections.emptySet();
-    }
-  }
 
-
-
-  private <N> N getSingleValuedAttribute(
-      final AttributeDescription attributeDescription,
-      final Function<ByteString, N, Void> function)
-  {
-    final Attribute attr = entry.getAttribute(attributeDescription);
-    if (attr == null || attr.isEmpty())
-    {
-      return null;
+    /**
+     * Reads the Root DSE from the Directory Server using the provided
+     * connection.
+     * <p>
+     * If the Root DSE is not returned by the Directory Server then the request
+     * will fail with an {@link EntryNotFoundException}. More specifically, this
+     * method will never return {@code null}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose Root DSE is to be
+     *            read.
+     * @return The Directory Server's Root DSE.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} was {@code null}.
+     */
+    public static RootDSE readRootDSE(final Connection connection) throws ErrorResultException,
+            InterruptedException {
+        final Entry entry = connection.searchSingleEntry(SEARCH_REQUEST);
+        return valueOf(entry);
     }
-    else
-    {
-      return function.apply(attr.firstValue(), null);
+
+    /**
+     * Creates a new Root DSE instance backed by the provided entry.
+     * Modifications made to {@code entry} will be reflected in the returned
+     * Root DSE. The returned Root DSE instance is unmodifiable and attempts to
+     * use modify any of the returned collections will result in a
+     * {@code UnsupportedOperationException}.
+     *
+     * @param entry
+     *            The Root DSE entry.
+     * @return A Root DSE instance backed by the provided entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    public static RootDSE valueOf(Entry entry) {
+        Validator.ensureNotNull(entry);
+        return new RootDSE(entry);
     }
-  }
+
+    private final Entry entry;
+
+    // Prevent direct instantiation.
+    private RootDSE(final Entry entry) {
+        this.entry = entry;
+    }
+
+    /**
+     * Returns an unmodifiable list of URIs referring to alternative Directory
+     * Servers that may be contacted when the Directory Server becomes
+     * unavailable.
+     * <p>
+     * URIs for Directory Servers implementing the LDAP protocol are written
+     * according to RFC 4516. Other kinds of URIs may be provided.
+     * <p>
+     * If the Directory Server does not know of any other Directory Servers that
+     * could be used, the returned list will be empty.
+     *
+     * @return An unmodifiable list of URIs referring to alternative Directory
+     *         Servers, which may be empty.
+     * @see <a href="http://tools.ietf.org/html/rfc4516">RFC 4516 - Lightweight
+     *      Directory Access Protocol (LDAP): Uniform Resource Locator </a>
+     */
+    public Collection<String> getAlternativeServers() {
+        return getMultiValuedAttribute(ATTR_ALT_SERVER, Functions.valueToString());
+    }
+
+    /**
+     * Returns the entry which backs this Root DSE instance. Modifications made
+     * to the returned entry will be reflected in this Root DSE.
+     *
+     * @return The underlying Root DSE entry.
+     */
+    public Entry getEntry() {
+        return entry;
+    }
+
+    /**
+     * Returns an unmodifiable list of DNs identifying the context prefixes of
+     * the naming contexts that the Directory Server masters or shadows (in part
+     * or in whole).
+     * <p>
+     * If the Directory Server does not master or shadow any naming contexts,
+     * the returned list will be empty.
+     *
+     * @return An unmodifiable list of DNs identifying the context prefixes of
+     *         the naming contexts, which may be empty.
+     */
+    public Collection<DN> getNamingContexts() {
+        return getMultiValuedAttribute(ATTR_NAMING_CONTEXTS, Functions.valueToDN());
+    }
+
+    /**
+     * Returns a string which represents the DN of the subschema subentry
+     * holding the schema controlling the Root DSE.
+     * <p>
+     * Clients SHOULD NOT assume that this subschema (sub)entry controls other
+     * entries held by the Directory Server.
+     *
+     * @return The DN of the subschema subentry holding the schema controlling
+     *         the Root DSE, or {@code null} if the DN is not provided.
+     */
+    public DN getSubschemaSubentry() {
+        return getSingleValuedAttribute(ATTR_SUBSCHEMA_SUBENTRY, Functions.valueToDN());
+    }
+
+    /**
+     * Returns an unmodifiable list of supported authentication password schemes
+     * which the Directory Server supports.
+     * <p>
+     * If the Directory Server does not support any authentication password
+     * schemes, the returned list will be empty.
+     *
+     * @return An unmodifiable list of supported authentication password
+     *         schemes, which may be empty.
+     * @see <a href="http://tools.ietf.org/html/rfc3112">RFC 3112 - LDAP
+     *      Authentication Password Schema </a>
+     */
+    public Collection<String> getSupportedAuthenticationPasswordSchemes() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES, Functions
+                .valueToString());
+    }
+
+    /**
+     * Returns an unmodifiable list of object identifiers identifying the
+     * request controls that the Directory Server supports.
+     * <p>
+     * If the Directory Server does not support any request controls, the
+     * returned list will be empty. Object identifiers identifying response
+     * controls may not be listed.
+     *
+     * @return An unmodifiable list of object identifiers identifying the
+     *         request controls, which may be empty.
+     */
+    public Collection<String> getSupportedControls() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_CONTROL, Functions.valueToString());
+    }
+
+    /**
+     * Returns an unmodifiable list of object identifiers identifying the
+     * extended operations that the Directory Server supports.
+     * <p>
+     * If the Directory Server does not support any extended operations, the
+     * returned list will be empty.
+     * <p>
+     * An extended operation generally consists of an extended request and an
+     * extended response but may also include other protocol data units (such as
+     * intermediate responses). The object identifier assigned to the extended
+     * request is used to identify the extended operation. Other object
+     * identifiers used in the extended operation may not be listed as values of
+     * this attribute.
+     *
+     * @return An unmodifiable list of object identifiers identifying the
+     *         extended operations, which may be empty.
+     */
+    public Collection<String> getSupportedExtendedOperations() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_EXTENSION, Functions.valueToString());
+    }
+
+    /**
+     * Returns an unmodifiable list of object identifiers identifying elective
+     * features that the Directory Server supports.
+     * <p>
+     * If the server does not support any discoverable elective features, the
+     * returned list will be empty.
+     *
+     * @return An unmodifiable list of object identifiers identifying the
+     *         elective features, which may be empty.
+     */
+    public Collection<String> getSupportedFeatures() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_FEATURE, Functions.valueToString());
+    }
+
+    /**
+     * Returns an unmodifiable list of the versions of LDAP that the Directory
+     * Server supports.
+     *
+     * @return An unmodifiable list of the versions.
+     */
+    public Collection<Integer> getSupportedLDAPVersions() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_LDAP_VERSION, Functions.valueToInteger());
+    }
+
+    /**
+     * Returns an unmodifiable list of the SASL mechanisms that the Directory
+     * Server recognizes and/or supports.
+     * <p>
+     * The contents of the returned list may depend on the current session state
+     * and may be empty if the Directory Server does not support any SASL
+     * mechanisms.
+     *
+     * @return An unmodifiable list of the SASL mechanisms, which may be empty.
+     * @see <a href="http://tools.ietf.org/html/rfc4513">RFC 4513 - Lightweight
+     *      Directory Access Protocol (LDAP): Authentication Methods and
+     *      Security Mechanisms </a>
+     * @see <a href="http://tools.ietf.org/html/rfc4422">RFC 4422 - Simple
+     *      Authentication and Security Layer (SASL) </a>
+     */
+    public Collection<String> getSupportedSASLMechanisms() {
+        return getMultiValuedAttribute(ATTR_SUPPORTED_SASL_MECHANISMS, Functions.valueToString());
+    }
+
+    /**
+     * Returns a string which represents the name of the Directory Server
+     * implementer.
+     *
+     * @return The name of the Directory Server implementer, or {@code null} if
+     *         the vendor name is not provided.
+     * @see <a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing
+     *      Vendor Information in the LDAP Root DSE </a>
+     */
+    public String getVendorName() {
+        return getSingleValuedAttribute(ATTR_VENDOR_NAME, Functions.valueToString());
+    }
+
+    /**
+     * Returns a string which represents the version of the Directory Server
+     * implementation.
+     * <p>
+     * Note that this value is typically a release value comprised of a string
+     * and/or a string of numbers used by the developer of the LDAP server
+     * product. The returned string will be unique between two versions of the
+     * Directory Server, but there are no other syntactic restrictions on the
+     * value or the way it is formatted.
+     *
+     * @return The version of the Directory Server implementation, or
+     *         {@code null} if the vendor version is not provided.
+     * @see <a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing
+     *      Vendor Information in the LDAP Root DSE </a>
+     */
+    public String getVendorVersion() {
+        return getSingleValuedAttribute(ATTR_VENDOR_VERSION, Functions.valueToString());
+    }
+
+    private <N> Collection<N> getMultiValuedAttribute(
+            final AttributeDescription attributeDescription,
+            final Function<ByteString, N, Void> function) {
+        // The returned collection is unmodifiable because we may need to
+        // return an empty collection if the attribute does not exist in the
+        // underlying entry. If a value is then added to the returned empty
+        // collection it would require that an attribute is created in the
+        // underlying entry in order to maintain consistency.
+        final Attribute attr = entry.getAttribute(attributeDescription);
+        if (attr != null) {
+            return Collections.unmodifiableCollection(Collections2.transformedCollection(attr,
+                    function, Functions.objectToByteString()));
+        } else {
+            return Collections.emptySet();
+        }
+    }
+
+    private <N> N getSingleValuedAttribute(final AttributeDescription attributeDescription,
+            final Function<ByteString, N, Void> function) {
+        final Attribute attr = entry.getAttribute(attributeDescription);
+        if (attr == null || attr.isEmpty()) {
+            return null;
+        } else {
+            return function.apply(attr.firstValue(), null);
+        }
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java
index b245fdd..a799503 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,15 +26,11 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Collection;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-
-
 /**
  * A round robin load balancing algorithm distributes connection requests across
  * a list of connection factories one at a time. When the end of the list is
@@ -58,121 +53,99 @@
  * @see FailoverLoadBalancingAlgorithm
  * @see Connections#newLoadBalancer(LoadBalancingAlgorithm)
  */
-public final class RoundRobinLoadBalancingAlgorithm extends
-    AbstractLoadBalancingAlgorithm
-{
-  private final int maxIndex;
+public final class RoundRobinLoadBalancingAlgorithm extends AbstractLoadBalancingAlgorithm {
+    private final int maxIndex;
 
-  private final AtomicInteger nextIndex = new AtomicInteger(-1);
+    private final AtomicInteger nextIndex = new AtomicInteger(-1);
 
-
-
-  /**
-   * Creates a new round robin load balancing algorithm which will monitor
-   * offline connection factories every 1 second using the default scheduler.
-   *
-   * @param factories
-   *          The ordered collection of connection factories.
-   */
-  public RoundRobinLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories)
-  {
-    super(factories);
-    this.maxIndex = factories.size();
-  }
-
-
-
-  /**
-   * Creates a new round robin load balancing algorithm which will monitor
-   * offline connection factories using the specified frequency using the
-   * default scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   */
-  public RoundRobinLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories, final long interval,
-      final TimeUnit unit)
-  {
-    super(factories, interval, unit);
-    this.maxIndex = factories.size();
-  }
-
-
-
-  /**
-   * Creates a new round robin load balancing algorithm which will monitor
-   * offline connection factories using the specified frequency and scheduler.
-   *
-   * @param factories
-   *          The connection factories.
-   * @param interval
-   *          The interval between attempts to poll offline factories.
-   * @param unit
-   *          The time unit for the interval between attempts to poll offline
-   *          factories.
-   * @param scheduler
-   *          The scheduler which should for periodically monitoring dead
-   *          connection factories to see if they are usable again.
-   */
-  public RoundRobinLoadBalancingAlgorithm(
-      final Collection<ConnectionFactory> factories, final long interval,
-      final TimeUnit unit, final ScheduledExecutorService scheduler)
-  {
-    super(factories, interval, unit, scheduler);
-    this.maxIndex = factories.size();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  String getAlgorithmName()
-  {
-    return "RoundRobin";
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  int getInitialConnectionFactoryIndex()
-  {
-    // A round robin pool of one connection factories is unlikely in practice
-    // and requires special treatment.
-    if (maxIndex == 1)
-    {
-      return 0;
+    /**
+     * Creates a new round robin load balancing algorithm which will monitor
+     * offline connection factories every 1 second using the default scheduler.
+     *
+     * @param factories
+     *            The ordered collection of connection factories.
+     */
+    public RoundRobinLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories) {
+        super(factories);
+        this.maxIndex = factories.size();
     }
 
-    // Determine the next factory to use: avoid blocking algorithm.
-    int oldNextIndex;
-    int newNextIndex;
-    do
-    {
-      oldNextIndex = nextIndex.get();
-      newNextIndex = oldNextIndex + 1;
-      if (newNextIndex == maxIndex)
-      {
-        newNextIndex = 0;
-      }
+    /**
+     * Creates a new round robin load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency using the
+     * default scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
+     */
+    public RoundRobinLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit) {
+        super(factories, interval, unit);
+        this.maxIndex = factories.size();
     }
-    while (!nextIndex.compareAndSet(oldNextIndex, newNextIndex));
 
-    // There's a potential, but benign, race condition here: other threads could
-    // jump in and rotate through the list before we return the connection
-    // factory.
-    return newNextIndex;
-  }
+    /**
+     * Creates a new round robin load balancing algorithm which will monitor
+     * offline connection factories using the specified frequency and scheduler.
+     *
+     * @param factories
+     *            The connection factories.
+     * @param interval
+     *            The interval between attempts to poll offline factories.
+     * @param unit
+     *            The time unit for the interval between attempts to poll
+     *            offline factories.
+     * @param scheduler
+     *            The scheduler which should for periodically monitoring dead
+     *            connection factories to see if they are usable again.
+     */
+    public RoundRobinLoadBalancingAlgorithm(final Collection<ConnectionFactory> factories,
+            final long interval, final TimeUnit unit, final ScheduledExecutorService scheduler) {
+        super(factories, interval, unit, scheduler);
+        this.maxIndex = factories.size();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    String getAlgorithmName() {
+        return "RoundRobin";
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    int getInitialConnectionFactoryIndex() {
+        // A round robin pool of one connection factories is unlikely in
+        // practice
+        // and requires special treatment.
+        if (maxIndex == 1) {
+            return 0;
+        }
+
+        // Determine the next factory to use: avoid blocking algorithm.
+        int oldNextIndex;
+        int newNextIndex;
+        do {
+            oldNextIndex = nextIndex.get();
+            newNextIndex = oldNextIndex + 1;
+            if (newNextIndex == maxIndex) {
+                newNextIndex = 0;
+            }
+        } while (!nextIndex.compareAndSet(oldNextIndex, newNextIndex));
+
+        // There's a potential, but benign, race condition here: other threads
+        // could
+        // jump in and rotate through the list before we return the connection
+        // factory.
+        return newNextIndex;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java
index 8bf6e4d..f6f8c9b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.security.GeneralSecurityException;
 import java.security.Provider;
 import java.security.SecureRandom;
@@ -37,219 +34,187 @@
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManager;
 
-
-
 /**
  * An SSL context builder provides an interface for incrementally constructing
  * {@link SSLContext} instances for use when securing connections with SSL or
  * the StartTLS extended operation. The {@link #getSSLContext()} should be
  * called in order to obtain the {@code SSLContext}.
  */
-public final class SSLContextBuilder
-{
+public final class SSLContextBuilder {
 
-  /**
-   * SSL protocol: supports some version of SSL; may support other versions.
-   */
-  public static final String PROTOCOL_SSL = "SSL";
+    /**
+     * SSL protocol: supports some version of SSL; may support other versions.
+     */
+    public static final String PROTOCOL_SSL = "SSL";
 
-  /**
-   * SSL protocol: supports SSL version 2 or higher; may support other versions.
-   */
-  public static final String PROTOCOL_SSL2 = "SSLv2";
+    /**
+     * SSL protocol: supports SSL version 2 or higher; may support other
+     * versions.
+     */
+    public static final String PROTOCOL_SSL2 = "SSLv2";
 
-  /**
-   * SSL protocol: supports SSL version 3; may support other versions.
-   */
-  public static final String PROTOCOL_SSL3 = "SSLv3";
+    /**
+     * SSL protocol: supports SSL version 3; may support other versions.
+     */
+    public static final String PROTOCOL_SSL3 = "SSLv3";
 
-  /**
-   * SSL protocol: supports some version of TLS; may support other versions.
-   */
-  public static final String PROTOCOL_TLS = "TLS";
+    /**
+     * SSL protocol: supports some version of TLS; may support other versions.
+     */
+    public static final String PROTOCOL_TLS = "TLS";
 
-  /**
-   * SSL protocol: supports RFC 2246: TLS version 1.0 ; may support other
-   * versions.
-   */
-  public static final String PROTOCOL_TLS1 = "TLSv1";
+    /**
+     * SSL protocol: supports RFC 2246: TLS version 1.0 ; may support other
+     * versions.
+     */
+    public static final String PROTOCOL_TLS1 = "TLSv1";
 
-  /**
-   * SSL protocol: supports RFC 4346: TLS version 1.1 ; may support other
-   * versions.
-   */
-  public static final String PROTOCOL_TLS1_1 = "TLSv1.1";
+    /**
+     * SSL protocol: supports RFC 4346: TLS version 1.1 ; may support other
+     * versions.
+     */
+    public static final String PROTOCOL_TLS1_1 = "TLSv1.1";
 
-  private TrustManager trustManager = null;
-  private KeyManager keyManager = null;
-  private String protocol = PROTOCOL_TLS1;
-  private SecureRandom random = null;
+    private TrustManager trustManager = null;
+    private KeyManager keyManager = null;
+    private String protocol = PROTOCOL_TLS1;
+    private SecureRandom random = null;
 
-  // These are mutually exclusive.
-  private Provider provider = null;
-  private String providerName = null;
+    // These are mutually exclusive.
+    private Provider provider = null;
+    private String providerName = null;
 
-
-
-  /**
-   * Creates a new SSL context builder using default parameters.
-   */
-  public SSLContextBuilder()
-  {
-    // Do nothing.
-  }
-
-
-
-  /**
-   * Creates a {@code SSLContext} using the parameters of this SSL context
-   * builder.
-   *
-   * @return A {@code SSLContext} using the parameters of this SSL context
-   *         builder.
-   * @throws GeneralSecurityException
-   *           If the SSL context could not be created, perhaps due to missing
-   *           algorithms.
-   */
-  public SSLContext getSSLContext() throws GeneralSecurityException
-  {
-    TrustManager[] tm = null;
-    if (trustManager != null)
-    {
-      tm = new TrustManager[] { trustManager };
+    /**
+     * Creates a new SSL context builder using default parameters.
+     */
+    public SSLContextBuilder() {
+        // Do nothing.
     }
 
-    KeyManager[] km = null;
-    if (keyManager != null)
-    {
-      km = new KeyManager[] { keyManager };
+    /**
+     * Creates a {@code SSLContext} using the parameters of this SSL context
+     * builder.
+     *
+     * @return A {@code SSLContext} using the parameters of this SSL context
+     *         builder.
+     * @throws GeneralSecurityException
+     *             If the SSL context could not be created, perhaps due to
+     *             missing algorithms.
+     */
+    public SSLContext getSSLContext() throws GeneralSecurityException {
+        TrustManager[] tm = null;
+        if (trustManager != null) {
+            tm = new TrustManager[] { trustManager };
+        }
+
+        KeyManager[] km = null;
+        if (keyManager != null) {
+            km = new KeyManager[] { keyManager };
+        }
+
+        SSLContext sslContext;
+        if (provider != null) {
+            sslContext = SSLContext.getInstance(protocol, provider);
+        } else if (providerName != null) {
+            sslContext = SSLContext.getInstance(protocol, providerName);
+        } else {
+            sslContext = SSLContext.getInstance(protocol);
+        }
+        sslContext.init(km, tm, random);
+
+        return sslContext;
     }
 
-    SSLContext sslContext;
-    if (provider != null)
-    {
-      sslContext = SSLContext.getInstance(protocol, provider);
+    /**
+     * Sets the key manager which the SSL context should use. By default, no key
+     * manager is specified indicating that no certificates will be used.
+     *
+     * @param keyManager
+     *            The key manager which the SSL context should use, which may be
+     *            {@code null} indicating that no certificates will be used.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setKeyManager(final KeyManager keyManager) {
+        this.keyManager = keyManager;
+        return this;
     }
-    else if (providerName != null)
-    {
-      sslContext = SSLContext.getInstance(protocol, providerName);
+
+    /**
+     * Sets the protocol which the SSL context should use. By default, TLSv1
+     * will be used.
+     *
+     * @param protocol
+     *            The protocol which the SSL context should use, which may be
+     *            {@code null} indicating that TLSv1 will be used.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setProtocol(final String protocol) {
+        this.protocol = protocol;
+        return this;
     }
-    else
-    {
-      sslContext = SSLContext.getInstance(protocol);
+
+    /**
+     * Sets the provider which the SSL context should use. By default, the
+     * default provider associated with this JVM will be used.
+     *
+     * @param provider
+     *            The provider which the SSL context should use, which may be
+     *            {@code null} indicating that the default provider associated
+     *            with this JVM will be used.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setProvider(final Provider provider) {
+        this.provider = provider;
+        this.providerName = null;
+        return this;
     }
-    sslContext.init(km, tm, random);
 
-    return sslContext;
-  }
+    /**
+     * Sets the provider which the SSL context should use. By default, the
+     * default provider associated with this JVM will be used.
+     *
+     * @param providerName
+     *            The name of the provider which the SSL context should use,
+     *            which may be {@code null} indicating that the default provider
+     *            associated with this JVM will be used.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setProvider(final String providerName) {
+        this.provider = null;
+        this.providerName = providerName;
+        return this;
+    }
 
+    /**
+     * Sets the secure random number generator which the SSL context should use.
+     * By default, the default secure random number generator associated with
+     * this JVM will be used.
+     *
+     * @param random
+     *            The secure random number generator which the SSL context
+     *            should use, which may be {@code null} indicating that the
+     *            default secure random number generator associated with this
+     *            JVM will be used.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setSecureRandom(final SecureRandom random) {
+        this.random = random;
+        return this;
+    }
 
-
-  /**
-   * Sets the key manager which the SSL context should use. By default, no key
-   * manager is specified indicating that no certificates will be used.
-   *
-   * @param keyManager
-   *          The key manager which the SSL context should use, which may be
-   *          {@code null} indicating that no certificates will be used.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setKeyManager(final KeyManager keyManager)
-  {
-    this.keyManager = keyManager;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the protocol which the SSL context should use. By default, TLSv1 will
-   * be used.
-   *
-   * @param protocol
-   *          The protocol which the SSL context should use, which may be
-   *          {@code null} indicating that TLSv1 will be used.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setProtocol(final String protocol)
-  {
-    this.protocol = protocol;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the provider which the SSL context should use. By default, the default
-   * provider associated with this JVM will be used.
-   *
-   * @param provider
-   *          The provider which the SSL context should use, which may be
-   *          {@code null} indicating that the default provider associated with
-   *          this JVM will be used.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setProvider(final Provider provider)
-  {
-    this.provider = provider;
-    this.providerName = null;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the provider which the SSL context should use. By default, the default
-   * provider associated with this JVM will be used.
-   *
-   * @param providerName
-   *          The name of the provider which the SSL context should use, which
-   *          may be {@code null} indicating that the default provider
-   *          associated with this JVM will be used.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setProvider(final String providerName)
-  {
-    this.provider = null;
-    this.providerName = providerName;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the secure random number generator which the SSL context should use.
-   * By default, the default secure random number generator associated with this
-   * JVM will be used.
-   *
-   * @param random
-   *          The secure random number generator which the SSL context should
-   *          use, which may be {@code null} indicating that the default secure
-   *          random number generator associated with this JVM will be used.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setSecureRandom(final SecureRandom random)
-  {
-    this.random = random;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the trust manager which the SSL context should use. By default, no
-   * trust manager is specified indicating that only certificates signed by the
-   * authorities associated with this JVM will be accepted.
-   *
-   * @param trustManager
-   *          The trust manager which the SSL context should use, which may be
-   *          {@code null} indicating that only certificates signed by the
-   *          authorities associated with this JVM will be accepted.
-   * @return This SSL context builder.
-   */
-  public SSLContextBuilder setTrustManager(final TrustManager trustManager)
-  {
-    this.trustManager = trustManager;
-    return this;
-  }
+    /**
+     * Sets the trust manager which the SSL context should use. By default, no
+     * trust manager is specified indicating that only certificates signed by
+     * the authorities associated with this JVM will be accepted.
+     *
+     * @param trustManager
+     *            The trust manager which the SSL context should use, which may
+     *            be {@code null} indicating that only certificates signed by
+     *            the authorities associated with this JVM will be accepted.
+     * @return This SSL context builder.
+     */
+    public SSLContextBuilder setTrustManager(final TrustManager trustManager) {
+        this.trustManager = trustManager;
+        return this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java
index 547f9c9..97bcd0b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,12 +27,8 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.schema.Schema;
 
-
-
 /**
  * Schema resolvers are included with a set of {@code DecodeOptions} in order to
  * allow application to control how {@code Schema} instances are selected when
@@ -46,33 +41,30 @@
  * @see Schema
  * @see DecodeOptions
  */
-public interface SchemaResolver
-{
-  /**
-   * A schema resolver which always returns the current default schema as
-   * returned by {@link Schema#getDefaultSchema()}.
-   */
-  public static final SchemaResolver DEFAULT = new SchemaResolver()
-  {
+public interface SchemaResolver {
+    /**
+     * A schema resolver which always returns the current default schema as
+     * returned by {@link Schema#getDefaultSchema()}.
+     */
+    public static final SchemaResolver DEFAULT = new SchemaResolver() {
 
-    public Schema resolveSchema(String dn)
-    {
-      return Schema.getDefaultSchema();
-    }
-  };
+        public Schema resolveSchema(String dn) {
+            return Schema.getDefaultSchema();
+        }
+    };
 
-
-
-  /**
-   * Finds the appropriate schema for use with the provided distinguished name.
-   * <p>
-   * Schema resolution must always succeed regardless of any errors that occur.
-   *
-   * @param dn
-   *          The string representation of a distinguished name associated with
-   *          an entry whose schema is to be located.
-   * @return The appropriate schema for use with the provided distinguished
-   *         name.
-   */
-  public abstract Schema resolveSchema(String dn);
+    /**
+     * Finds the appropriate schema for use with the provided distinguished
+     * name.
+     * <p>
+     * Schema resolution must always succeed regardless of any errors that
+     * occur.
+     *
+     * @param dn
+     *            The string representation of a distinguished name associated
+     *            with an entry whose schema is to be located.
+     * @return The appropriate schema for use with the provided distinguished
+     *         name.
+     */
+    public abstract Schema resolveSchema(String dn);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java
index 4a7b2da..773681e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,21 +27,17 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
-
-
 /**
  * A completion handler for consuming the results of a Search operation.
  * <p>
- * {@link Connection} and {@link Connection} objects allow a search
- * result completion handler to be specified when sending Search operation
- * requests to a Directory Server. The {@link #handleEntry} method is invoked
- * each time a Search Result Entry is returned from the Directory Server. The
+ * {@link Connection} and {@link Connection} objects allow a search result
+ * completion handler to be specified when sending Search operation requests to
+ * a Directory Server. The {@link #handleEntry} method is invoked each time a
+ * Search Result Entry is returned from the Directory Server. The
  * {@link #handleReference} method is invoked for each Search Result Reference
  * returned from the Directory Server.
  * <p>
@@ -50,33 +45,30 @@
  * avoid keeping the invoking thread from dispatching to other completion
  * handlers.
  */
-public interface SearchResultHandler extends ResultHandler<Result>
-{
-  /**
-   * Invoked each time a search result entry is returned from an asynchronous
-   * search operation.
-   *
-   * @param entry
-   *          The search result entry.
-   * @return {@code true} if this handler should continue to be notified of any
-   *         remaining entries and references, or {@code false} if the remaining
-   *         entries and references should be skipped for some reason (e.g. a
-   *         client side size limit has been reached).
-   */
-  boolean handleEntry(SearchResultEntry entry);
+public interface SearchResultHandler extends ResultHandler<Result> {
+    /**
+     * Invoked each time a search result entry is returned from an asynchronous
+     * search operation.
+     *
+     * @param entry
+     *            The search result entry.
+     * @return {@code true} if this handler should continue to be notified of
+     *         any remaining entries and references, or {@code false} if the
+     *         remaining entries and references should be skipped for some
+     *         reason (e.g. a client side size limit has been reached).
+     */
+    boolean handleEntry(SearchResultEntry entry);
 
-
-
-  /**
-   * Invoked each time a search result reference is returned from an
-   * asynchronous search operation.
-   *
-   * @param reference
-   *          The search result reference.
-   * @return {@code true} if this handler should continue to be notified of any
-   *         remaining entries and references, or {@code false} if the remaining
-   *         entries and references should be skipped for some reason (e.g. a
-   *         client side size limit has been reached).
-   */
-  boolean handleReference(SearchResultReference reference);
+    /**
+     * Invoked each time a search result reference is returned from an
+     * asynchronous search operation.
+     *
+     * @param reference
+     *            The search result reference.
+     * @return {@code true} if this handler should continue to be notified of
+     *         any remaining entries and references, or {@code false} if the
+     *         remaining entries and references should be skipped for some
+     *         reason (e.g. a client side size limit has been reached).
+     */
+    boolean handleReference(SearchResultReference reference);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java
index c46cc1a..6000ec3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,54 +27,43 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Thrown when an iteration over a set of search results using a
  * {@code ConnectionEntryReader} encounters a {@code SearchResultReference}.
  */
 @SuppressWarnings("serial")
-public final class SearchResultReferenceIOException extends IOException
-{
-  private final SearchResultReference reference;
+public final class SearchResultReferenceIOException extends IOException {
+    private final SearchResultReference reference;
 
+    /**
+     * Creates a new referral result IO exception with the provided
+     * {@code SearchResultReference}.
+     *
+     * @param reference
+     *            The {@code SearchResultReference} which may be later retrieved
+     *            by the {@link #getReference} method.
+     * @throws NullPointerException
+     *             If {@code reference} was {@code null}.
+     */
+    public SearchResultReferenceIOException(final SearchResultReference reference) {
+        super(Validator.ensureNotNull(reference).toString());
+        this.reference = reference;
+    }
 
-
-  /**
-   * Creates a new referral result IO exception with the provided
-   * {@code SearchResultReference}.
-   *
-   * @param reference
-   *          The {@code SearchResultReference} which may be later retrieved by
-   *          the {@link #getReference} method.
-   * @throws NullPointerException
-   *           If {@code reference} was {@code null}.
-   */
-  public SearchResultReferenceIOException(final SearchResultReference reference)
-  {
-    super(Validator.ensureNotNull(reference).toString());
-    this.reference = reference;
-  }
-
-
-
-  /**
-   * Returns the {@code SearchResultReference} which was encountered while
-   * processing the search results.
-   *
-   * @return The {@code SearchResultReference} which was encountered while
-   *         processing the search results.
-   */
-  public SearchResultReference getReference()
-  {
-    return reference;
-  }
+    /**
+     * Returns the {@code SearchResultReference} which was encountered while
+     * processing the search results.
+     *
+     * @return The {@code SearchResultReference} which was encountered while
+     *         processing the search results.
+     */
+    public SearchResultReference getReference() {
+        return reference;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchScope.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchScope.java
index f6974cc..8f84ec4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchScope.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SearchScope.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,10 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-
-
 /**
  * A Search operation search scope as defined in RFC 4511 section 4.5.1.2 is
  * used to specify the scope of a Search operation.
@@ -46,160 +41,130 @@
  *      draft-sermersheim-ldap-subordinate-scope - Subordinate Subtree Search
  *      Scope for LDAP </a>
  */
-public final class SearchScope
-{
-  private static final SearchScope[] ELEMENTS = new SearchScope[4];
+public final class SearchScope {
+    private static final SearchScope[] ELEMENTS = new SearchScope[4];
 
-  private static final List<SearchScope> IMMUTABLE_ELEMENTS = Collections
-      .unmodifiableList(Arrays.asList(ELEMENTS));
+    private static final List<SearchScope> IMMUTABLE_ELEMENTS = Collections.unmodifiableList(Arrays
+            .asList(ELEMENTS));
 
-  /**
-   * The scope is constrained to the search base entry.
-   */
-  public static final SearchScope BASE_OBJECT = register(0, "base");
+    /**
+     * The scope is constrained to the search base entry.
+     */
+    public static final SearchScope BASE_OBJECT = register(0, "base");
 
-  /**
-   * The scope is constrained to the immediate subordinates of the search base
-   * entry.
-   */
-  public static final SearchScope SINGLE_LEVEL = register(1, "one");
+    /**
+     * The scope is constrained to the immediate subordinates of the search base
+     * entry.
+     */
+    public static final SearchScope SINGLE_LEVEL = register(1, "one");
 
-  /**
-   * The scope is constrained to the search base entry and to all its
-   * subordinates.
-   */
-  public static final SearchScope WHOLE_SUBTREE = register(2, "sub");
+    /**
+     * The scope is constrained to the search base entry and to all its
+     * subordinates.
+     */
+    public static final SearchScope WHOLE_SUBTREE = register(2, "sub");
 
-  /**
-   * The scope is constrained to all the subordinates of the search base entry,
-   * but does not include the search base entry itself (as wholeSubtree does).
-   */
-  public static final SearchScope SUBORDINATES = register(3, "subordinates");
+    /**
+     * The scope is constrained to all the subordinates of the search base
+     * entry, but does not include the search base entry itself (as wholeSubtree
+     * does).
+     */
+    public static final SearchScope SUBORDINATES = register(3, "subordinates");
 
-
-
-  /**
-   * Returns the search scope having the specified integer value as defined in
-   * RFC 4511 section 4.5.1.2.
-   *
-   * @param intValue
-   *          The integer value of the search scope.
-   * @return The search scope, or {@code null} if there was no search scope
-   *         associated with {@code intValue}.
-   */
-  public static SearchScope valueOf(final int intValue)
-  {
-    if (intValue < 0 || intValue >= ELEMENTS.length)
-    {
-      return null;
+    /**
+     * Returns the search scope having the specified integer value as defined in
+     * RFC 4511 section 4.5.1.2.
+     *
+     * @param intValue
+     *            The integer value of the search scope.
+     * @return The search scope, or {@code null} if there was no search scope
+     *         associated with {@code intValue}.
+     */
+    public static SearchScope valueOf(final int intValue) {
+        if (intValue < 0 || intValue >= ELEMENTS.length) {
+            return null;
+        }
+        return ELEMENTS[intValue];
     }
-    return ELEMENTS[intValue];
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the set of available search scopes
-   * indexed on their integer value as defined in RFC 4511 section 4.5.1.2.
-   *
-   * @return An unmodifiable list containing the set of available search scopes.
-   */
-  public static List<SearchScope> values()
-  {
-    return IMMUTABLE_ELEMENTS;
-  }
-
-
-
-  /**
-   * Creates and registers a new search scope with the application.
-   *
-   * @param intValue
-   *          The integer value of the search scope as defined in RFC 4511
-   *          section 4.5.1.2.
-   * @param name
-   *          The name of the search scope as defined in RFC 4516.
-   * @return The new search scope.
-   */
-  private static SearchScope register(final int intValue, final String name)
-  {
-    final SearchScope t = new SearchScope(intValue, name);
-    ELEMENTS[intValue] = t;
-    return t;
-  }
-
-
-
-  private final int intValue;
-
-  private final String name;
-
-
-
-  // Prevent direct instantiation.
-  private SearchScope(final int intValue, final String name)
-  {
-    this.intValue = intValue;
-    this.name = name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object obj)
-  {
-    if (this == obj)
-    {
-      return true;
+    /**
+     * Returns an unmodifiable list containing the set of available search
+     * scopes indexed on their integer value as defined in RFC 4511 section
+     * 4.5.1.2.
+     *
+     * @return An unmodifiable list containing the set of available search
+     *         scopes.
+     */
+    public static List<SearchScope> values() {
+        return IMMUTABLE_ELEMENTS;
     }
-    else if (obj instanceof SearchScope)
-    {
-      return this.intValue == ((SearchScope) obj).intValue;
+
+    /**
+     * Creates and registers a new search scope with the application.
+     *
+     * @param intValue
+     *            The integer value of the search scope as defined in RFC 4511
+     *            section 4.5.1.2.
+     * @param name
+     *            The name of the search scope as defined in RFC 4516.
+     * @return The new search scope.
+     */
+    private static SearchScope register(final int intValue, final String name) {
+        final SearchScope t = new SearchScope(intValue, name);
+        ELEMENTS[intValue] = t;
+        return t;
     }
-    else
-    {
-      return false;
+
+    private final int intValue;
+
+    private final String name;
+
+    // Prevent direct instantiation.
+    private SearchScope(final int intValue, final String name) {
+        this.intValue = intValue;
+        this.name = name;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj instanceof SearchScope) {
+            return this.intValue == ((SearchScope) obj).intValue;
+        } else {
+            return false;
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return intValue;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value of this search scope as defined in RFC 4511
+     * section 4.5.1.2.
+     *
+     * @return The integer value of this search scope.
+     */
+    public int intValue() {
+        return intValue;
+    }
 
-
-
-  /**
-   * Returns the integer value of this search scope as defined in RFC 4511
-   * section 4.5.1.2.
-   *
-   * @return The integer value of this search scope.
-   */
-  public int intValue()
-  {
-    return intValue;
-  }
-
-
-
-  /**
-   * Returns the string representation of this search scope as defined in RFC
-   * 4516.
-   *
-   * @return The string representation of this search scope.
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
+    /**
+     * Returns the string representation of this search scope as defined in RFC
+     * 4516.
+     *
+     * @return The string representation of this search scope.
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java
index ead8b96..26c928b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.requests.AbandonRequest;
 import org.forgerock.opendj.ldap.requests.UnbindRequest;
 
-
-
 /**
  * A handler interface for interacting with client connections. A
  * {@code ServerConnection} is associated with a client connection when the
@@ -47,63 +42,57 @@
  * such as {@code StartTLS} and {@code Cancel} operations.
  *
  * @param <C>
- *          The type of request context.
+ *            The type of request context.
  * @see ServerConnectionFactory
  */
-public interface ServerConnection<C> extends RequestHandler<C>
-{
+public interface ServerConnection<C> extends RequestHandler<C> {
 
-  /**
-   * Invoked when an abandon request is received from a client.
-   *
-   * @param requestContext
-   *          The request context.
-   * @param request
-   *          The abandon request.
-   * @throws UnsupportedOperationException
-   *           If this server connection does not handle abandon requests.
-   */
-  void handleAbandon(C requestContext, AbandonRequest request);
+    /**
+     * Invoked when an abandon request is received from a client.
+     *
+     * @param requestContext
+     *            The request context.
+     * @param request
+     *            The abandon request.
+     * @throws UnsupportedOperationException
+     *             If this server connection does not handle abandon requests.
+     */
+    void handleAbandon(C requestContext, AbandonRequest request);
 
+    /**
+     * Invoked when the client closes the connection, possibly using an unbind
+     * request.
+     *
+     * @param requestContext
+     *            The request context which should be ignored if there was no
+     *            associated unbind request.
+     * @param request
+     *            The unbind request, which may be {@code null} if one was not
+     *            sent before the connection was closed.
+     */
+    void handleConnectionClosed(C requestContext, UnbindRequest request);
 
+    /**
+     * Invoked when the server disconnects the client connection, possibly using
+     * a disconnect notification.
+     *
+     * @param resultCode
+     *            The result code which was included with the disconnect
+     *            notification, or {@code null} if no disconnect notification
+     *            was sent.
+     * @param message
+     *            The diagnostic message, which may be empty or {@code null}
+     *            indicating that none was provided.
+     */
+    void handleConnectionDisconnected(ResultCode resultCode, String message);
 
-  /**
-   * Invoked when the client closes the connection, possibly using an unbind
-   * request.
-   *
-   * @param requestContext
-   *          The request context which should be ignored if there was no
-   *          associated unbind request.
-   * @param request
-   *          The unbind request, which may be {@code null} if one was not sent
-   *          before the connection was closed.
-   */
-  void handleConnectionClosed(C requestContext, UnbindRequest request);
-
-
-
-  /**
-   * Invoked when the server disconnects the client connection, possibly using a
-   * disconnect notification.
-   *
-   * @param resultCode
-   *          The result code which was included with the disconnect
-   *          notification, or {@code null} if no disconnect notification was
-   *          sent.
-   * @param message
-   *          The diagnostic message, which may be empty or {@code null}
-   *          indicating that none was provided.
-   */
-  void handleConnectionDisconnected(ResultCode resultCode, String message);
-
-
-
-  /**
-   * Invoked when an error occurs on the connection and it is no longer usable.
-   *
-   * @param error
-   *          The exception describing the problem that occurred.
-   */
-  void handleConnectionError(Throwable error);
+    /**
+     * Invoked when an error occurs on the connection and it is no longer
+     * usable.
+     *
+     * @param error
+     *            The exception describing the problem that occurred.
+     */
+    void handleConnectionError(Throwable error);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java
index 3b602b8..c036f99 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 /**
  * A handler interface for accepting new connections from clients.
  * <p>
@@ -38,31 +35,30 @@
  * client connection is accepted.
  *
  * @param <C>
- *          The type of client context.
+ *            The type of client context.
  * @param <R>
- *          The type of request context.
+ *            The type of request context.
  * @see LDAPListener
  * @see Connections#newInternalConnectionFactory(ServerConnectionFactory,
  *      Object) newInternalConnectionFactory
  */
-public interface ServerConnectionFactory<C, R>
-{
-  /**
-   * Invoked when a new client connection is accepted by the associated
-   * listener. Implementations should return a {@code ServerConnection} which
-   * will be used to handle requests from the client connection.
-   *
-   * @param clientContext
-   *          The protocol dependent context information associated with the
-   *          client connection. Depending on the protocol this may contain
-   *          information about the client such as their address and level
-   *          connection security. It may also be used to manage the state of
-   *          the client's connection.
-   * @return A {@code ServerConnection} which will be used to handle requests
-   *         from a client connection.
-   * @throws ErrorResultException
-   *           If this server connection factory cannot accept the client
-   *           connection.
-   */
-  ServerConnection<R> handleAccept(C clientContext) throws ErrorResultException;
+public interface ServerConnectionFactory<C, R> {
+    /**
+     * Invoked when a new client connection is accepted by the associated
+     * listener. Implementations should return a {@code ServerConnection} which
+     * will be used to handle requests from the client connection.
+     *
+     * @param clientContext
+     *            The protocol dependent context information associated with the
+     *            client connection. Depending on the protocol this may contain
+     *            information about the client such as their address and level
+     *            connection security. It may also be used to manage the state
+     *            of the client's connection.
+     * @return A {@code ServerConnection} which will be used to handle requests
+     *         from a client connection.
+     * @throws ErrorResultException
+     *             If this server connection factory cannot accept the client
+     *             connection.
+     */
+    ServerConnection<R> handleAccept(C clientContext) throws ErrorResultException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SortKey.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SortKey.java
index 949c1ab..a8d0325 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SortKey.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/SortKey.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,11 +26,14 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -40,14 +42,12 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A search result sort key as defined in RFC 2891 is used to specify how search
  * result entries should be ordered. Sort keys are used with the server side
  * sort request control
- * {@link org.forgerock.opendj.ldap.controls.ServerSideSortRequestControl}, but could also
- * be used for performing client side sorting as well.
+ * {@link org.forgerock.opendj.ldap.controls.ServerSideSortRequestControl}, but
+ * could also be used for performing client side sorting as well.
  * <p>
  * The following example illustrates how a single sort key may be used to sort
  * entries as they are returned from a search operation using the {@code cn}
@@ -72,624 +72,504 @@
  * @see <a href="http://tools.ietf.org/html/rfc2891">RFC 2891 - LDAP Control
  *      Extension for Server Side Sorting of Search Results </a>
  */
-public final class SortKey
-{
-  private static final class CompositeEntryComparator implements
-      Comparator<Entry>
-  {
-    private final List<Comparator<Entry>> comparators;
+public final class SortKey {
+    private static final class CompositeEntryComparator implements Comparator<Entry> {
+        private final List<Comparator<Entry>> comparators;
 
-
-
-    private CompositeEntryComparator(final List<Comparator<Entry>> comparators)
-    {
-      this.comparators = comparators;
-    }
-
-
-
-    public int compare(final Entry entry1, final Entry entry2)
-    {
-      for (final Comparator<Entry> comparator : comparators)
-      {
-        final int result = comparator.compare(entry1, entry2);
-        if (result != 0)
-        {
-          return result;
+        private CompositeEntryComparator(final List<Comparator<Entry>> comparators) {
+            this.comparators = comparators;
         }
-      }
-      return 0;
+
+        public int compare(final Entry entry1, final Entry entry2) {
+            for (final Comparator<Entry> comparator : comparators) {
+                final int result = comparator.compare(entry1, entry2);
+                if (result != 0) {
+                    return result;
+                }
+            }
+            return 0;
+        }
+
     }
 
-  }
-
-
-
-  /**
-   * A comparator which can be used to compare entries using a sort key.
-   */
-  private static final class EntryComparator implements Comparator<Entry>
-  {
-    private final AttributeDescription attributeDescription;
-    private final MatchingRule matchingRule;
-    private final Comparator<ByteSequence> valueComparator;
-    private final boolean isReverseOrder;
-
-
-
-    private EntryComparator(final AttributeDescription attributeDescription,
-        final MatchingRule matchingRule, final boolean isReverseOrder)
-
-    {
-      this.attributeDescription = attributeDescription;
-      this.matchingRule = matchingRule;
-      this.valueComparator = matchingRule.comparator();
-      this.isReverseOrder = isReverseOrder;
-    }
-
-
-
     /**
-     * We must use the lowest available value in both entries and missing
-     * attributes sort last.
+     * A comparator which can be used to compare entries using a sort key.
      */
-    public int compare(final Entry entry1, final Entry entry2)
-    {
-      // Find an normalize the lowest value attribute in entry1
-      ByteString lowestNormalizedValue1 = null;
-      for (final Attribute attribute : entry1
-          .getAllAttributes(attributeDescription))
-      {
-        for (final ByteString value : attribute)
-        {
-          try
-          {
-            final ByteString tmp = matchingRule.normalizeAttributeValue(value);
-            if (lowestNormalizedValue1 == null)
-            {
-              lowestNormalizedValue1 = tmp;
-            }
-            else if (valueComparator.compare(tmp, lowestNormalizedValue1) < 0)
-            {
-              lowestNormalizedValue1 = tmp;
-            }
-          }
-          catch (final DecodeException ignored)
-          {
-            // Ignore the error - treat the value as missing.
-          }
+    private static final class EntryComparator implements Comparator<Entry> {
+        private final AttributeDescription attributeDescription;
+        private final MatchingRule matchingRule;
+        private final Comparator<ByteSequence> valueComparator;
+        private final boolean isReverseOrder;
+
+        private EntryComparator(final AttributeDescription attributeDescription,
+                final MatchingRule matchingRule, final boolean isReverseOrder) {
+            this.attributeDescription = attributeDescription;
+            this.matchingRule = matchingRule;
+            this.valueComparator = matchingRule.comparator();
+            this.isReverseOrder = isReverseOrder;
         }
-      }
 
-      // Find an normalize the lowest value attribute in entry2
-      ByteString lowestNormalizedValue2 = null;
-      for (final Attribute attribute : entry2
-          .getAllAttributes(attributeDescription))
-      {
-        for (final ByteString value : attribute)
-        {
-          try
-          {
-            final ByteString tmp = matchingRule.normalizeAttributeValue(value);
-            if (lowestNormalizedValue2 == null)
-            {
-              lowestNormalizedValue2 = tmp;
+        /**
+         * We must use the lowest available value in both entries and missing
+         * attributes sort last.
+         */
+        public int compare(final Entry entry1, final Entry entry2) {
+            // Find an normalize the lowest value attribute in entry1
+            ByteString lowestNormalizedValue1 = null;
+            for (final Attribute attribute : entry1.getAllAttributes(attributeDescription)) {
+                for (final ByteString value : attribute) {
+                    try {
+                        final ByteString tmp = matchingRule.normalizeAttributeValue(value);
+                        if (lowestNormalizedValue1 == null) {
+                            lowestNormalizedValue1 = tmp;
+                        } else if (valueComparator.compare(tmp, lowestNormalizedValue1) < 0) {
+                            lowestNormalizedValue1 = tmp;
+                        }
+                    } catch (final DecodeException ignored) {
+                        // Ignore the error - treat the value as missing.
+                    }
+                }
             }
-            else if (valueComparator.compare(tmp, lowestNormalizedValue2) < 0)
-            {
-              lowestNormalizedValue2 = tmp;
+
+            // Find an normalize the lowest value attribute in entry2
+            ByteString lowestNormalizedValue2 = null;
+            for (final Attribute attribute : entry2.getAllAttributes(attributeDescription)) {
+                for (final ByteString value : attribute) {
+                    try {
+                        final ByteString tmp = matchingRule.normalizeAttributeValue(value);
+                        if (lowestNormalizedValue2 == null) {
+                            lowestNormalizedValue2 = tmp;
+                        } else if (valueComparator.compare(tmp, lowestNormalizedValue2) < 0) {
+                            lowestNormalizedValue2 = tmp;
+                        }
+                    } catch (final DecodeException ignored) {
+                        // Ignore the error - treat the value as missing.
+                    }
+                }
             }
-          }
-          catch (final DecodeException ignored)
-          {
-            // Ignore the error - treat the value as missing.
-          }
+
+            // Entries with missing attributes always sort after (regardless of
+            // order).
+            if (lowestNormalizedValue1 == null) {
+                return lowestNormalizedValue2 != null ? 1 : 0;
+            }
+
+            if (lowestNormalizedValue2 == null) {
+                return -1;
+            }
+
+            if (isReverseOrder) {
+                return valueComparator.compare(lowestNormalizedValue2, lowestNormalizedValue1);
+            } else {
+                return valueComparator.compare(lowestNormalizedValue1, lowestNormalizedValue2);
+            }
         }
-      }
 
-      // Entries with missing attributes always sort after (regardless of
-      // order).
-      if (lowestNormalizedValue1 == null)
-      {
-        return lowestNormalizedValue2 != null ? 1 : 0;
-      }
-
-      if (lowestNormalizedValue2 == null)
-      {
-        return -1;
-      }
-
-      if (isReverseOrder)
-      {
-        return valueComparator.compare(lowestNormalizedValue2,
-            lowestNormalizedValue1);
-      }
-      else
-      {
-        return valueComparator.compare(lowestNormalizedValue1,
-            lowestNormalizedValue2);
-      }
     }
 
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using the
-   * provided list of sort keys. The sort keys will be decoded using the default
-   * schema.
-   *
-   * @param keys
-   *          The list of sort keys.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If one of the sort keys could not be converted to a comparator.
-   * @throws IllegalArgumentException
-   *           If {@code keys} was empty.
-   * @throws NullPointerException
-   *           If {@code keys} was {@code null}.
-   */
-  public static Comparator<Entry> comparator(final Collection<SortKey> keys)
-  {
-    return comparator(Schema.getDefaultSchema(), keys);
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using the
-   * provided list of sort keys. The sort keys will be decoded using the
-   * provided schema.
-   *
-   * @param schema
-   *          The schema which should be used for decoding the sort keys.
-   * @param keys
-   *          The list of sort keys.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If one of the sort keys could not be converted to a comparator.
-   * @throws IllegalArgumentException
-   *           If {@code keys} was empty.
-   * @throws NullPointerException
-   *           If {@code schema} or {@code keys} was {@code null}.
-   */
-  public static Comparator<Entry> comparator(final Schema schema,
-      final Collection<SortKey> keys)
-  {
-    Validator.ensureNotNull(schema, keys);
-    Validator.ensureTrue(!keys.isEmpty(), "keys must not be empty");
-
-    final List<Comparator<Entry>> comparators = new ArrayList<Comparator<Entry>>(
-        keys.size());
-    for (final SortKey key : keys)
-    {
-      comparators.add(key.comparator(schema));
-    }
-    return new CompositeEntryComparator(comparators);
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using the
-   * provided list of sort keys. The sort keys will be decoded using the
-   * provided schema.
-   *
-   * @param schema
-   *          The schema which should be used for decoding the sort keys.
-   * @param firstKey
-   *          The first sort key.
-   * @param remainingKeys
-   *          The remaining sort keys.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If one of the sort keys could not be converted to a comparator.
-   * @throws NullPointerException
-   *           If {@code schema} or {@code firstKey} was {@code null}.
-   */
-  public static Comparator<Entry> comparator(final Schema schema,
-      final SortKey firstKey, final SortKey... remainingKeys)
-  {
-    Validator.ensureNotNull(schema, firstKey, remainingKeys);
-
-    final List<Comparator<Entry>> comparators = new ArrayList<Comparator<Entry>>(
-        1 + remainingKeys.length);
-    comparators.add(firstKey.comparator(schema));
-    for (final SortKey key : remainingKeys)
-    {
-      comparators.add(key.comparator(schema));
-    }
-    return new CompositeEntryComparator(comparators);
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using the
-   * provided list of sort keys. The sort keys will be decoded using the default
-   * schema.
-   *
-   * @param firstKey
-   *          The first sort key.
-   * @param remainingKeys
-   *          The remaining sort keys.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If one of the sort keys could not be converted to a comparator.
-   * @throws NullPointerException
-   *           If {@code firstKey} was {@code null}.
-   */
-  public static Comparator<Entry> comparator(final SortKey firstKey,
-      final SortKey... remainingKeys)
-  {
-    return comparator(Schema.getDefaultSchema(), firstKey, remainingKeys);
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using the
-   * provided string representation of a list of sort keys. The sort keys will
-   * be decoded using the default schema. The string representation is comprised
-   * of a comma separate list of sort keys as defined in
-   * {@link #valueOf(String)}. There must be at least one sort key present in
-   * the string representation.
-   *
-   * @param sortKeys
-   *          The list of sort keys.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code sortKeys} is not a valid string representation of a
-   *           list of sort keys, or if one of the sort keys could not be
-   *           converted to a comparator.
-   * @throws NullPointerException
-   *           If {@code sortKeys} was {@code null}.
-   */
-  public static Comparator<Entry> comparator(final String sortKeys)
-  {
-    Validator.ensureNotNull(sortKeys);
-
-    final List<Comparator<Entry>> comparators = new LinkedList<Comparator<Entry>>();
-    final StringTokenizer tokenizer = new StringTokenizer(sortKeys, ",");
-    while (tokenizer.hasMoreTokens())
-    {
-      final String token = tokenizer.nextToken().trim();
-      comparators.add(valueOf(token).comparator());
-    }
-    if (comparators.isEmpty())
-    {
-      final LocalizableMessage message = ERR_SORT_KEY_NO_SORT_KEYS
-          .get(sortKeys);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-    return new CompositeEntryComparator(comparators);
-  }
-
-
-
-  /**
-   * Parses the provided string representation of a sort key as a {@code
-   * SortKey}. The string representation has the following ABNF (see RFC 4512
-   * for definitions of the elements below):
-   *
-   * <pre>
-   *   SortKey = [ PLUS / HYPHEN ]    ; order specifier
-   *             attributedescription ; attribute description
-   *             [ COLON oid ]        ; ordering matching rule OID
-   * </pre>
-   *
-   * Examples:
-   *
-   * <pre>
-   *   cn                           ; case ignore ascending sort on "cn"
-   *   -cn                          ; case ignore descending sort on "cn"
-   *   +cn;lang-fr                  ; case ignore ascending sort on "cn;lang-fr"
-   *   -cn;lang-fr:caseExactMatch   ; case exact ascending sort on "cn;lang-fr"
-   * </pre>
-   *
-   * @param sortKey
-   *          The string representation of a sort key.
-   * @return The parsed {@code SortKey}.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code sortKey} is not a valid string representation of a sort
-   *           key.
-   * @throws NullPointerException
-   *           If {@code sortKey} was {@code null}.
-   */
-  public static final SortKey valueOf(String sortKey)
-  {
-    Validator.ensureNotNull(sortKey);
-
-    boolean reverseOrder = false;
-    if (sortKey.startsWith("-"))
-    {
-      reverseOrder = true;
-      sortKey = sortKey.substring(1);
-    }
-    else if (sortKey.startsWith("+"))
-    {
-      sortKey = sortKey.substring(1);
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * the provided list of sort keys. The sort keys will be decoded using the
+     * default schema.
+     *
+     * @param keys
+     *            The list of sort keys.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If one of the sort keys could not be converted to a
+     *             comparator.
+     * @throws IllegalArgumentException
+     *             If {@code keys} was empty.
+     * @throws NullPointerException
+     *             If {@code keys} was {@code null}.
+     */
+    public static Comparator<Entry> comparator(final Collection<SortKey> keys) {
+        return comparator(Schema.getDefaultSchema(), keys);
     }
 
-    final int colonPos = sortKey.indexOf(':');
-    if (colonPos < 0)
-    {
-      if (sortKey.length() == 0)
-      {
-        final LocalizableMessage message = ERR_SORT_KEY_NO_ATTR_NAME
-            .get(sortKey);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * the provided list of sort keys. The sort keys will be decoded using the
+     * provided schema.
+     *
+     * @param schema
+     *            The schema which should be used for decoding the sort keys.
+     * @param keys
+     *            The list of sort keys.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If one of the sort keys could not be converted to a
+     *             comparator.
+     * @throws IllegalArgumentException
+     *             If {@code keys} was empty.
+     * @throws NullPointerException
+     *             If {@code schema} or {@code keys} was {@code null}.
+     */
+    public static Comparator<Entry> comparator(final Schema schema, final Collection<SortKey> keys) {
+        Validator.ensureNotNull(schema, keys);
+        Validator.ensureTrue(!keys.isEmpty(), "keys must not be empty");
 
-      return new SortKey(sortKey, reverseOrder, null);
-    }
-    else if (colonPos == 0)
-    {
-      final LocalizableMessage message = ERR_SORT_KEY_NO_ATTR_NAME.get(sortKey);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-    else if (colonPos == (sortKey.length() - 1))
-    {
-      final LocalizableMessage message = ERR_SORT_KEY_NO_MATCHING_RULE
-          .get(sortKey);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-    else
-    {
-      final String attrName = sortKey.substring(0, colonPos);
-      final String ruleID = sortKey.substring(colonPos + 1);
-
-      return new SortKey(attrName, reverseOrder, ruleID);
-    }
-  }
-
-
-
-  private final String attributeDescription;
-
-  private final String orderingMatchingRule;
-
-  private final boolean isReverseOrder;
-
-
-
-  /**
-   * Creates a new sort key using the provided attribute description. The
-   * returned sort key will compare attributes in the order specified using the
-   * named ordering matching rule.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be sorted using this sort key.
-   * @param isReverseOrder
-   *          {@code true} if this sort key should be evaluated in reverse
-   *          (descending) order.
-   * @param orderingMatchingRule
-   *          The name or OID of the ordering matching rule, which should be
-   *          used when comparing attributes using this sort key, or {@code
-   *          null} if the default ordering matching rule associated with the
-   *          attribute should be used.
-   * @throws NullPointerException
-   *           If {@code AttributeDescription} was {@code null}.
-   */
-  public SortKey(final AttributeDescription attributeDescription,
-      final boolean isReverseOrder, final MatchingRule orderingMatchingRule)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    this.attributeDescription = attributeDescription.toString();
-    this.orderingMatchingRule = orderingMatchingRule != null ? orderingMatchingRule
-        .getNameOrOID()
-        : null;
-    this.isReverseOrder = isReverseOrder;
-  }
-
-
-
-  /**
-   * Creates a new sort key using the provided attribute description. The
-   * returned sort key will compare attributes in ascending order using the
-   * default ordering matching rule associated with the attribute.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be sorted using this sort key.
-   * @throws NullPointerException
-   *           If {@code AttributeDescription} was {@code null}.
-   */
-  public SortKey(final String attributeDescription)
-  {
-    this(attributeDescription, false, null);
-  }
-
-
-
-  /**
-   * Creates a new sort key using the provided attribute description. The
-   * returned sort key will compare attributes in the order specified using the
-   * default ordering matching rule associated with the attribute.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be sorted using this sort key.
-   * @param isReverseOrder
-   *          {@code true} if this sort key should be evaluated in reverse
-   *          (descending) order.
-   * @throws NullPointerException
-   *           If {@code AttributeDescription} was {@code null}.
-   */
-  public SortKey(final String attributeDescription, final boolean isReverseOrder)
-  {
-    this(attributeDescription, isReverseOrder, null);
-  }
-
-
-
-  /**
-   * Creates a new sort key using the provided attribute description. The
-   * returned sort key will compare attributes in the order specified using the
-   * named ordering matching rule.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be sorted using this sort key.
-   * @param isReverseOrder
-   *          {@code true} if this sort key should be evaluated in reverse
-   *          (descending) order.
-   * @param orderingMatchingRule
-   *          The name or OID of the ordering matching rule, which should be
-   *          used when comparing attributes using this sort key, or {@code
-   *          null} if the default ordering matching rule associated with the
-   *          attribute should be used.
-   * @throws NullPointerException
-   *           If {@code AttributeDescription} was {@code null}.
-   */
-  public SortKey(final String attributeDescription,
-      final boolean isReverseOrder, final String orderingMatchingRule)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    this.attributeDescription = attributeDescription;
-    this.orderingMatchingRule = orderingMatchingRule;
-    this.isReverseOrder = isReverseOrder;
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using
-   * this sort key. The attribute description and matching rule, if present,
-   * will be decoded using the default schema.
-   *
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If attributeDescription is not a valid LDAP string representation
-   *           of an attribute description, or if no ordering matching rule was
-   *           found.
-   */
-  public Comparator<Entry> comparator()
-  {
-    return comparator(Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns a {@code Comparator} which can be used to compare entries using
-   * this sort key. The attribute description and matching rule, if present,
-   * will be decoded using the provided schema.
-   *
-   * @param schema
-   *          The schema which should be used for decoding the attribute
-   *          description and matching rule.
-   * @return The {@code Comparator}.
-   * @throws LocalizedIllegalArgumentException
-   *           If attributeDescription is not a valid LDAP string representation
-   *           of an attribute description, or if no ordering matching rule was
-   *           found.
-   * @throws NullPointerException
-   *           If {@code schema} was {@code null}.
-   */
-  public Comparator<Entry> comparator(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-
-    final AttributeDescription ad = AttributeDescription.valueOf(
-        attributeDescription, schema);
-
-    MatchingRule mrule;
-    if (orderingMatchingRule != null)
-    {
-      // FIXME: need to check that the matching rule is a matching rule and can
-      // be used with the attribute.
-      mrule = schema.getMatchingRule(orderingMatchingRule);
-
-      if (mrule == null)
-      {
-        // Specified ordering matching rule not found.
-        final LocalizableMessage message = ERR_SORT_KEY_MRULE_NOT_FOUND.get(
-            toString(), orderingMatchingRule);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-    }
-    else
-    {
-      mrule = ad.getAttributeType().getOrderingMatchingRule();
-
-      if (mrule == null)
-      {
-        // No default ordering matching rule found.
-        final LocalizableMessage message = ERR_SORT_KEY_DEFAULT_MRULE_NOT_FOUND
-            .get(toString(), attributeDescription);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+        final List<Comparator<Entry>> comparators = new ArrayList<Comparator<Entry>>(keys.size());
+        for (final SortKey key : keys) {
+            comparators.add(key.comparator(schema));
+        }
+        return new CompositeEntryComparator(comparators);
     }
 
-    return new EntryComparator(ad, mrule, isReverseOrder);
-  }
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * the provided list of sort keys. The sort keys will be decoded using the
+     * provided schema.
+     *
+     * @param schema
+     *            The schema which should be used for decoding the sort keys.
+     * @param firstKey
+     *            The first sort key.
+     * @param remainingKeys
+     *            The remaining sort keys.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If one of the sort keys could not be converted to a
+     *             comparator.
+     * @throws NullPointerException
+     *             If {@code schema} or {@code firstKey} was {@code null}.
+     */
+    public static Comparator<Entry> comparator(final Schema schema, final SortKey firstKey,
+            final SortKey... remainingKeys) {
+        Validator.ensureNotNull(schema, firstKey, remainingKeys);
 
-
-
-  /**
-   * Returns the name of the attribute to be sorted using this sort key.
-   *
-   * @return The name of the attribute to be sorted using this sort key.
-   */
-  public String getAttributeDescription()
-  {
-    return attributeDescription;
-  }
-
-
-
-  /**
-   * Returns the name or OID of the ordering matching rule, if specified, which
-   * should be used when comparing attributes using this sort key.
-   *
-   * @return The name or OID of the ordering matching rule, if specified, which
-   *         should be used when comparing attributes using this sort key, or
-   *         {@code null} if the default ordering matching rule associated with
-   *         the attribute should be used.
-   */
-  public String getOrderingMatchingRule()
-  {
-    return orderingMatchingRule;
-  }
-
-
-
-  /**
-   * Returns {@code true} if this sort key should be evaluated in reverse
-   * (descending) order. More specifically, comparisons performed using the
-   * ordering matching rule associated with this sort key will have their
-   * results inverted.
-   *
-   * @return {@code true} if this sort key should be evaluated in reverse
-   *         (descending) order.
-   */
-  public boolean isReverseOrder()
-  {
-    return isReverseOrder;
-  }
-
-
-
-  /**
-   * Returns a string representation of this sort key using the format defined
-   * in {@link #valueOf(String)}.
-   *
-   * @return A string representation of this sort key.
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    if (isReverseOrder)
-    {
-      builder.append('-');
+        final List<Comparator<Entry>> comparators =
+                new ArrayList<Comparator<Entry>>(1 + remainingKeys.length);
+        comparators.add(firstKey.comparator(schema));
+        for (final SortKey key : remainingKeys) {
+            comparators.add(key.comparator(schema));
+        }
+        return new CompositeEntryComparator(comparators);
     }
-    builder.append(attributeDescription);
-    if (orderingMatchingRule != null)
-    {
-      builder.append(':');
-      builder.append(orderingMatchingRule);
+
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * the provided list of sort keys. The sort keys will be decoded using the
+     * default schema.
+     *
+     * @param firstKey
+     *            The first sort key.
+     * @param remainingKeys
+     *            The remaining sort keys.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If one of the sort keys could not be converted to a
+     *             comparator.
+     * @throws NullPointerException
+     *             If {@code firstKey} was {@code null}.
+     */
+    public static Comparator<Entry> comparator(final SortKey firstKey,
+            final SortKey... remainingKeys) {
+        return comparator(Schema.getDefaultSchema(), firstKey, remainingKeys);
     }
-    return builder.toString();
-  }
+
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * the provided string representation of a list of sort keys. The sort keys
+     * will be decoded using the default schema. The string representation is
+     * comprised of a comma separate list of sort keys as defined in
+     * {@link #valueOf(String)}. There must be at least one sort key present in
+     * the string representation.
+     *
+     * @param sortKeys
+     *            The list of sort keys.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code sortKeys} is not a valid string representation of a
+     *             list of sort keys, or if one of the sort keys could not be
+     *             converted to a comparator.
+     * @throws NullPointerException
+     *             If {@code sortKeys} was {@code null}.
+     */
+    public static Comparator<Entry> comparator(final String sortKeys) {
+        Validator.ensureNotNull(sortKeys);
+
+        final List<Comparator<Entry>> comparators = new LinkedList<Comparator<Entry>>();
+        final StringTokenizer tokenizer = new StringTokenizer(sortKeys, ",");
+        while (tokenizer.hasMoreTokens()) {
+            final String token = tokenizer.nextToken().trim();
+            comparators.add(valueOf(token).comparator());
+        }
+        if (comparators.isEmpty()) {
+            final LocalizableMessage message = ERR_SORT_KEY_NO_SORT_KEYS.get(sortKeys);
+            throw new LocalizedIllegalArgumentException(message);
+        }
+        return new CompositeEntryComparator(comparators);
+    }
+
+    /**
+     * Parses the provided string representation of a sort key as a
+     * {@code SortKey}. The string representation has the following ABNF (see
+     * RFC 4512 for definitions of the elements below):
+     *
+     * <pre>
+     *   SortKey = [ PLUS / HYPHEN ]    ; order specifier
+     *             attributedescription ; attribute description
+     *             [ COLON oid ]        ; ordering matching rule OID
+     * </pre>
+     *
+     * Examples:
+     *
+     * <pre>
+     *   cn                           ; case ignore ascending sort on "cn"
+     *   -cn                          ; case ignore descending sort on "cn"
+     *   +cn;lang-fr                  ; case ignore ascending sort on "cn;lang-fr"
+     *   -cn;lang-fr:caseExactMatch   ; case exact ascending sort on "cn;lang-fr"
+     * </pre>
+     *
+     * @param sortKey
+     *            The string representation of a sort key.
+     * @return The parsed {@code SortKey}.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code sortKey} is not a valid string representation of a
+     *             sort key.
+     * @throws NullPointerException
+     *             If {@code sortKey} was {@code null}.
+     */
+    public static final SortKey valueOf(String sortKey) {
+        Validator.ensureNotNull(sortKey);
+
+        boolean reverseOrder = false;
+        if (sortKey.startsWith("-")) {
+            reverseOrder = true;
+            sortKey = sortKey.substring(1);
+        } else if (sortKey.startsWith("+")) {
+            sortKey = sortKey.substring(1);
+        }
+
+        final int colonPos = sortKey.indexOf(':');
+        if (colonPos < 0) {
+            if (sortKey.length() == 0) {
+                final LocalizableMessage message = ERR_SORT_KEY_NO_ATTR_NAME.get(sortKey);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+
+            return new SortKey(sortKey, reverseOrder, null);
+        } else if (colonPos == 0) {
+            final LocalizableMessage message = ERR_SORT_KEY_NO_ATTR_NAME.get(sortKey);
+            throw new LocalizedIllegalArgumentException(message);
+        } else if (colonPos == (sortKey.length() - 1)) {
+            final LocalizableMessage message = ERR_SORT_KEY_NO_MATCHING_RULE.get(sortKey);
+            throw new LocalizedIllegalArgumentException(message);
+        } else {
+            final String attrName = sortKey.substring(0, colonPos);
+            final String ruleID = sortKey.substring(colonPos + 1);
+
+            return new SortKey(attrName, reverseOrder, ruleID);
+        }
+    }
+
+    private final String attributeDescription;
+
+    private final String orderingMatchingRule;
+
+    private final boolean isReverseOrder;
+
+    /**
+     * Creates a new sort key using the provided attribute description. The
+     * returned sort key will compare attributes in the order specified using
+     * the named ordering matching rule.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be sorted using this sort key.
+     * @param isReverseOrder
+     *            {@code true} if this sort key should be evaluated in reverse
+     *            (descending) order.
+     * @param orderingMatchingRule
+     *            The name or OID of the ordering matching rule, which should be
+     *            used when comparing attributes using this sort key, or
+     *            {@code null} if the default ordering matching rule associated
+     *            with the attribute should be used.
+     * @throws NullPointerException
+     *             If {@code AttributeDescription} was {@code null}.
+     */
+    public SortKey(final AttributeDescription attributeDescription, final boolean isReverseOrder,
+            final MatchingRule orderingMatchingRule) {
+        Validator.ensureNotNull(attributeDescription);
+        this.attributeDescription = attributeDescription.toString();
+        this.orderingMatchingRule =
+                orderingMatchingRule != null ? orderingMatchingRule.getNameOrOID() : null;
+        this.isReverseOrder = isReverseOrder;
+    }
+
+    /**
+     * Creates a new sort key using the provided attribute description. The
+     * returned sort key will compare attributes in ascending order using the
+     * default ordering matching rule associated with the attribute.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be sorted using this sort key.
+     * @throws NullPointerException
+     *             If {@code AttributeDescription} was {@code null}.
+     */
+    public SortKey(final String attributeDescription) {
+        this(attributeDescription, false, null);
+    }
+
+    /**
+     * Creates a new sort key using the provided attribute description. The
+     * returned sort key will compare attributes in the order specified using
+     * the default ordering matching rule associated with the attribute.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be sorted using this sort key.
+     * @param isReverseOrder
+     *            {@code true} if this sort key should be evaluated in reverse
+     *            (descending) order.
+     * @throws NullPointerException
+     *             If {@code AttributeDescription} was {@code null}.
+     */
+    public SortKey(final String attributeDescription, final boolean isReverseOrder) {
+        this(attributeDescription, isReverseOrder, null);
+    }
+
+    /**
+     * Creates a new sort key using the provided attribute description. The
+     * returned sort key will compare attributes in the order specified using
+     * the named ordering matching rule.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be sorted using this sort key.
+     * @param isReverseOrder
+     *            {@code true} if this sort key should be evaluated in reverse
+     *            (descending) order.
+     * @param orderingMatchingRule
+     *            The name or OID of the ordering matching rule, which should be
+     *            used when comparing attributes using this sort key, or
+     *            {@code null} if the default ordering matching rule associated
+     *            with the attribute should be used.
+     * @throws NullPointerException
+     *             If {@code AttributeDescription} was {@code null}.
+     */
+    public SortKey(final String attributeDescription, final boolean isReverseOrder,
+            final String orderingMatchingRule) {
+        Validator.ensureNotNull(attributeDescription);
+        this.attributeDescription = attributeDescription;
+        this.orderingMatchingRule = orderingMatchingRule;
+        this.isReverseOrder = isReverseOrder;
+    }
+
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * this sort key. The attribute description and matching rule, if present,
+     * will be decoded using the default schema.
+     *
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If attributeDescription is not a valid LDAP string
+     *             representation of an attribute description, or if no ordering
+     *             matching rule was found.
+     */
+    public Comparator<Entry> comparator() {
+        return comparator(Schema.getDefaultSchema());
+    }
+
+    /**
+     * Returns a {@code Comparator} which can be used to compare entries using
+     * this sort key. The attribute description and matching rule, if present,
+     * will be decoded using the provided schema.
+     *
+     * @param schema
+     *            The schema which should be used for decoding the attribute
+     *            description and matching rule.
+     * @return The {@code Comparator}.
+     * @throws LocalizedIllegalArgumentException
+     *             If attributeDescription is not a valid LDAP string
+     *             representation of an attribute description, or if no ordering
+     *             matching rule was found.
+     * @throws NullPointerException
+     *             If {@code schema} was {@code null}.
+     */
+    public Comparator<Entry> comparator(final Schema schema) {
+        Validator.ensureNotNull(schema);
+
+        final AttributeDescription ad = AttributeDescription.valueOf(attributeDescription, schema);
+
+        MatchingRule mrule;
+        if (orderingMatchingRule != null) {
+            // FIXME: need to check that the matching rule is a matching rule
+            // and can
+            // be used with the attribute.
+            mrule = schema.getMatchingRule(orderingMatchingRule);
+
+            if (mrule == null) {
+                // Specified ordering matching rule not found.
+                final LocalizableMessage message =
+                        ERR_SORT_KEY_MRULE_NOT_FOUND.get(toString(), orderingMatchingRule);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        } else {
+            mrule = ad.getAttributeType().getOrderingMatchingRule();
+
+            if (mrule == null) {
+                // No default ordering matching rule found.
+                final LocalizableMessage message =
+                        ERR_SORT_KEY_DEFAULT_MRULE_NOT_FOUND.get(toString(), attributeDescription);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        }
+
+        return new EntryComparator(ad, mrule, isReverseOrder);
+    }
+
+    /**
+     * Returns the name of the attribute to be sorted using this sort key.
+     *
+     * @return The name of the attribute to be sorted using this sort key.
+     */
+    public String getAttributeDescription() {
+        return attributeDescription;
+    }
+
+    /**
+     * Returns the name or OID of the ordering matching rule, if specified,
+     * which should be used when comparing attributes using this sort key.
+     *
+     * @return The name or OID of the ordering matching rule, if specified,
+     *         which should be used when comparing attributes using this sort
+     *         key, or {@code null} if the default ordering matching rule
+     *         associated with the attribute should be used.
+     */
+    public String getOrderingMatchingRule() {
+        return orderingMatchingRule;
+    }
+
+    /**
+     * Returns {@code true} if this sort key should be evaluated in reverse
+     * (descending) order. More specifically, comparisons performed using the
+     * ordering matching rule associated with this sort key will have their
+     * results inverted.
+     *
+     * @return {@code true} if this sort key should be evaluated in reverse
+     *         (descending) order.
+     */
+    public boolean isReverseOrder() {
+        return isReverseOrder;
+    }
+
+    /**
+     * Returns a string representation of this sort key using the format defined
+     * in {@link #valueOf(String)}.
+     *
+     * @return A string representation of this sort key.
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        if (isReverseOrder) {
+            builder.append('-');
+        }
+        builder.append(attributeDescription);
+        if (orderingMatchingRule != null) {
+            builder.append(':');
+            builder.append(orderingMatchingRule);
+        }
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java
index 0654612..88f0684 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,21 +26,15 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * Thrown when the result code returned in a Result indicates that the Request
  * was aborted because it did not complete in the required time out period.
  */
 @SuppressWarnings("serial")
-public class TimeoutResultException extends ErrorResultException
-{
-  TimeoutResultException(final Result result)
-  {
-    super(result);
-  }
+public class TimeoutResultException extends ErrorResultException {
+    TimeoutResultException(final Result result) {
+        super(result);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java
index 87e46a3..f0779f7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,13 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.TreeMap;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.requests.Requests;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An implementation of the {@code Entry} interface which uses a {@code TreeMap}
  * for storing attributes. Attributes are returned in ascending order of
@@ -56,132 +51,112 @@
  * and store a reference to the new attribute - neither the new or existing
  * attribute need to be modifiable in this case.
  */
-public final class TreeMapEntry extends AbstractMapEntry
-{
-  /**
-   * An entry factory which can be used to create new tree map entries.
-   */
-  public static final EntryFactory FACTORY = new EntryFactory()
-  {
-    public Entry newEntry(final DN name)
-    {
-      return new TreeMapEntry(name);
+public final class TreeMapEntry extends AbstractMapEntry {
+    /**
+     * An entry factory which can be used to create new tree map entries.
+     */
+    public static final EntryFactory FACTORY = new EntryFactory() {
+        public Entry newEntry(final DN name) {
+            return new TreeMapEntry(name);
+        }
+    };
+
+    /**
+     * Creates an entry having the same distinguished name, attributes, and
+     * object classes of the provided entry. This constructor performs a deep
+     * copy of {@code entry} and will copy each attribute as a
+     * {@link LinkedAttribute}.
+     * <p>
+     * A shallow copy constructor is provided by {@link #TreeMapEntry(Entry)}.
+     *
+     * @param entry
+     *            The entry to be copied.
+     * @return A deep copy of {@code entry}.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     * @see #TreeMapEntry(Entry)
+     */
+    public static TreeMapEntry deepCopyOfEntry(final Entry entry) {
+        TreeMapEntry copy = new TreeMapEntry(entry.getName());
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            copy.addAttribute(new LinkedAttribute(attribute));
+        }
+        return copy;
     }
-  };
 
-
-
-  /**
-   * Creates an entry having the same distinguished name, attributes, and object
-   * classes of the provided entry. This constructor performs a deep copy of
-   * {@code entry} and will copy each attribute as a {@link LinkedAttribute}.
-   * <p>
-   * A shallow copy constructor is provided by {@link #TreeMapEntry(Entry)}.
-   *
-   * @param entry
-   *          The entry to be copied.
-   * @return A deep copy of {@code entry}.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   * @see #TreeMapEntry(Entry)
-   */
-  public static TreeMapEntry deepCopyOfEntry(final Entry entry)
-  {
-    TreeMapEntry copy = new TreeMapEntry(entry.getName());
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      copy.addAttribute(new LinkedAttribute(attribute));
+    /**
+     * Creates an entry with an empty (root) distinguished name and no
+     * attributes.
+     */
+    public TreeMapEntry() {
+        this(DN.rootDN());
     }
-    return copy;
-  }
 
-
-
-  /**
-   * Creates an entry with an empty (root) distinguished name and no attributes.
-   */
-  public TreeMapEntry()
-  {
-    this(DN.rootDN());
-  }
-
-
-
-  /**
-   * Creates an empty entry using the provided distinguished name and no
-   * attributes.
-   *
-   * @param name
-   *          The distinguished name of this entry.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public TreeMapEntry(final DN name)
-  {
-    super(Validator.ensureNotNull(name),
-        new TreeMap<AttributeDescription, Attribute>());
-  }
-
-
-
-  /**
-   * Creates an entry having the same distinguished name, attributes, and object
-   * classes of the provided entry. This constructor performs a shallow copy of
-   * {@code entry} and will not copy the attributes contained in {@code entry}.
-   * <p>
-   * A deep copy constructor is provided by {@link #deepCopyOfEntry(Entry)}
-   *
-   * @param entry
-   *          The entry to be copied.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   * @see #deepCopyOfEntry(Entry)
-   */
-  public TreeMapEntry(final Entry entry)
-  {
-    this(entry.getName());
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      addAttribute(attribute);
+    /**
+     * Creates an empty entry using the provided distinguished name and no
+     * attributes.
+     *
+     * @param name
+     *            The distinguished name of this entry.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public TreeMapEntry(final DN name) {
+        super(Validator.ensureNotNull(name), new TreeMap<AttributeDescription, Attribute>());
     }
-  }
 
+    /**
+     * Creates an entry having the same distinguished name, attributes, and
+     * object classes of the provided entry. This constructor performs a shallow
+     * copy of {@code entry} and will not copy the attributes contained in
+     * {@code entry}.
+     * <p>
+     * A deep copy constructor is provided by {@link #deepCopyOfEntry(Entry)}
+     *
+     * @param entry
+     *            The entry to be copied.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     * @see #deepCopyOfEntry(Entry)
+     */
+    public TreeMapEntry(final Entry entry) {
+        this(entry.getName());
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            addAttribute(attribute);
+        }
+    }
 
+    /**
+     * Creates an empty entry using the provided distinguished name decoded
+     * using the default schema.
+     *
+     * @param name
+     *            The distinguished name of this entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public TreeMapEntry(final String name) {
+        this(DN.valueOf(name));
+    }
 
-  /**
-   * Creates an empty entry using the provided distinguished name decoded using
-   * the default schema.
-   *
-   * @param name
-   *          The distinguished name of this entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public TreeMapEntry(final String name)
-  {
-    this(DN.valueOf(name));
-  }
-
-
-
-  /**
-   * Creates a new entry using the provided lines of LDIF decoded using the
-   * default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing the an LDIF add change record or an LDIF
-   *          entry record.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public TreeMapEntry(final String... ldifLines)
-  {
-    this(Requests.newAddRequest(ldifLines));
-  }
+    /**
+     * Creates a new entry using the provided lines of LDIF decoded using the
+     * default schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing the an LDIF add change record or an
+     *            LDIF entry record.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public TreeMapEntry(final String... ldifLines) {
+        this(Requests.newAddRequest(ldifLines));
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java
index 6e5b01e..1fb030b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -52,501 +49,381 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains methods for creating common types of trust manager.
  */
-public final class TrustManagers
-{
-
-  /**
-   * An X509TrustManager which rejects certificate chains whose subject DN does
-   * not match a specified host name.
-   */
-  private static final class CheckHostName implements X509TrustManager
-  {
-
-    private final X509TrustManager trustManager;
-
-    private final String hostNamePattern;
-
-
-
-    private CheckHostName(final X509TrustManager trustManager,
-        final String hostNamePattern)
-    {
-      this.trustManager = trustManager;
-      this.hostNamePattern = hostNamePattern;
-    }
-
-
+public final class TrustManagers {
 
     /**
-     * {@inheritDoc}
+     * An X509TrustManager which rejects certificate chains whose subject DN
+     * does not match a specified host name.
      */
-    public void checkClientTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      verifyHostName(chain);
-      trustManager.checkClientTrusted(chain, authType);
+    private static final class CheckHostName implements X509TrustManager {
+
+        private final X509TrustManager trustManager;
+
+        private final String hostNamePattern;
+
+        private CheckHostName(final X509TrustManager trustManager, final String hostNamePattern) {
+            this.trustManager = trustManager;
+            this.hostNamePattern = hostNamePattern;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkClientTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            verifyHostName(chain);
+            trustManager.checkClientTrusted(chain, authType);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkServerTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            verifyHostName(chain);
+            trustManager.checkServerTrusted(chain, authType);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public X509Certificate[] getAcceptedIssuers() {
+            return trustManager.getAcceptedIssuers();
+        }
+
+        /**
+         * Checks whether a host name matches the provided pattern. It accepts
+         * the use of wildcards in the pattern, e.g. {@code *.example.com}.
+         *
+         * @param hostName
+         *            The host name.
+         * @param pattern
+         *            The host name pattern, which may contain wild cards.
+         * @return {@code true} if the host name matched the pattern, otherwise
+         *         {@code false}.
+         */
+        private boolean hostNameMatchesPattern(final String hostName, final String pattern) {
+            final String[] nameElements = hostName.split("\\.");
+            final String[] patternElements = pattern.split("\\.");
+
+            boolean hostMatch = nameElements.length == patternElements.length;
+            for (int i = 0; i < nameElements.length && hostMatch; i++) {
+                final String ne = nameElements[i];
+                final String pe = patternElements[i];
+                if (!pe.equals("*")) {
+                    hostMatch = ne.equalsIgnoreCase(pe);
+                }
+            }
+            return hostMatch;
+        }
+
+        private void verifyHostName(final X509Certificate[] chain) throws CertificateException {
+            try {
+                // TODO: NPE if root DN.
+                final DN dn =
+                        DN.valueOf(chain[0].getSubjectX500Principal().getName(), Schema
+                                .getCoreSchema());
+                final String value =
+                        dn.iterator().next().iterator().next().getAttributeValue().toString();
+                if (!hostNameMatchesPattern(value, hostNamePattern)) {
+                    throw new CertificateException(
+                            "The host name contained in the certificate chain subject DN \'"
+                                    + chain[0].getSubjectX500Principal()
+                                    + "' does not match the host name \'" + hostNamePattern + "'");
+                }
+            } catch (final Throwable t) {
+                LOG.log(Level.WARNING, "Error parsing subject dn: "
+                        + chain[0].getSubjectX500Principal(), t);
+            }
+        }
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * An X509TrustManager which rejects certificates which have expired or are
+     * not yet valid.
      */
-    public void checkServerTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      verifyHostName(chain);
-      trustManager.checkServerTrusted(chain, authType);
+    private static final class CheckValidatyDates implements X509TrustManager {
+
+        private final X509TrustManager trustManager;
+
+        private CheckValidatyDates(final X509TrustManager trustManager) {
+            this.trustManager = trustManager;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkClientTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            verifyExpiration(chain);
+            trustManager.checkClientTrusted(chain, authType);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkServerTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            verifyExpiration(chain);
+            trustManager.checkServerTrusted(chain, authType);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public X509Certificate[] getAcceptedIssuers() {
+            return trustManager.getAcceptedIssuers();
+        }
+
+        private void verifyExpiration(final X509Certificate[] chain) throws CertificateException {
+            final Date currentDate = new Date();
+            for (final X509Certificate c : chain) {
+                try {
+                    c.checkValidity(currentDate);
+                } catch (final CertificateExpiredException e) {
+                    LOG.log(Level.WARNING, "Refusing to trust security" + " certificate \""
+                            + c.getSubjectDN().getName() + "\" because it" + " expired on "
+                            + String.valueOf(c.getNotAfter()));
+
+                    throw e;
+                } catch (final CertificateNotYetValidException e) {
+                    LOG.log(Level.WARNING, "Refusing to trust security" + " certificate \""
+                            + c.getSubjectDN().getName() + "\" because it" + " is not valid until "
+                            + String.valueOf(c.getNotBefore()));
+
+                    throw e;
+                }
+            }
+        }
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * An X509TrustManager which does not trust any certificates.
      */
-    public X509Certificate[] getAcceptedIssuers()
-    {
-      return trustManager.getAcceptedIssuers();
+    private static final class DistrustAll implements X509TrustManager {
+        // Single instance.
+        private static final DistrustAll INSTANCE = new DistrustAll();
+
+        // Prevent instantiation.
+        private DistrustAll() {
+            // Nothing to do.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkClientTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            throw new CertificateException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkServerTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+            throw new CertificateException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public X509Certificate[] getAcceptedIssuers() {
+            return new X509Certificate[0];
+        }
     }
 
+    /**
+     * An X509TrustManager which trusts all certificates.
+     */
+    private static final class TrustAll implements X509TrustManager {
 
+        // Single instance.
+        private static final TrustAll INSTANCE = new TrustAll();
+
+        // Prevent instantiation.
+        private TrustAll() {
+            // Nothing to do.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkClientTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void checkServerTrusted(final X509Certificate[] chain, final String authType)
+                throws CertificateException {
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public X509Certificate[] getAcceptedIssuers() {
+            return new X509Certificate[0];
+        }
+    }
+
+    private static final Logger LOG = Logger.getLogger(TrustManagers.class.getName());
 
     /**
-     * Checks whether a host name matches the provided pattern. It accepts the
-     * use of wildcards in the pattern, e.g. {@code *.example.com}.
+     * Wraps the provided {@code X509TrustManager} by adding additional
+     * validation which rejects certificate chains whose subject DN does not
+     * match the specified host name pattern. The pattern may contain
+     * wild-cards, for example {@code *.example.com}.
      *
-     * @param hostName
-     *          The host name.
-     * @param pattern
-     *          The host name pattern, which may contain wild cards.
-     * @return {@code true} if the host name matched the pattern, otherwise
-     *         {@code false}.
+     * @param hostNamePattern
+     *            A host name pattern which the RDN value contained in
+     *            certificate subject DNs must match.
+     * @param trustManager
+     *            The trust manager to be wrapped.
+     * @return The wrapped trust manager.
+     * @throws NullPointerException
+     *             If {@code trustManager} or {@code hostNamePattern} was
+     *             {@code null}.
      */
-    private boolean hostNameMatchesPattern(final String hostName,
-        final String pattern)
-    {
-      final String[] nameElements = hostName.split("\\.");
-      final String[] patternElements = pattern.split("\\.");
+    public static X509TrustManager checkHostName(final String hostNamePattern,
+            final X509TrustManager trustManager) {
+        Validator.ensureNotNull(trustManager, hostNamePattern);
+        return new CheckHostName(trustManager, hostNamePattern);
+    }
 
-      boolean hostMatch = nameElements.length == patternElements.length;
-      for (int i = 0; i < nameElements.length && hostMatch; i++)
-      {
-        final String ne = nameElements[i];
-        final String pe = patternElements[i];
-        if (!pe.equals("*"))
-        {
-          hostMatch = ne.equalsIgnoreCase(pe);
+    /**
+     * Creates a new {@code X509TrustManager} which will use the named trust
+     * store file to determine whether to trust a certificate. It will use the
+     * default trust store format for the JVM (e.g. {@code JKS}) and will not
+     * use a password to open the trust store.
+     *
+     * @param file
+     *            The trust store file name.
+     * @return A new {@code X509TrustManager} which will use the named trust
+     *         store file to determine whether to trust a certificate.
+     * @throws GeneralSecurityException
+     *             If the trust store could not be loaded, perhaps due to
+     *             incorrect format, or missing algorithms.
+     * @throws IOException
+     *             If the trust store file could not be found or could not be
+     *             read.
+     * @throws NullPointerException
+     *             If {@code file} was {@code null}.
+     */
+    public static X509TrustManager checkUsingTrustStore(final String file)
+            throws GeneralSecurityException, IOException {
+        return checkUsingTrustStore(file, null, null);
+    }
+
+    /**
+     * Creates a new {@code X509TrustManager} which will use the named trust
+     * store file to determine whether to trust a certificate. It will use the
+     * provided trust store format and password.
+     *
+     * @param file
+     *            The trust store file name.
+     * @param password
+     *            The trust store password, which may be {@code null}.
+     * @param format
+     *            The trust store format, which may be {@code null} to indicate
+     *            that the default trust store format for the JVM (e.g.
+     *            {@code JKS}) should be used.
+     * @return A new {@code X509TrustManager} which will use the named trust
+     *         store file to determine whether to trust a certificate.
+     * @throws GeneralSecurityException
+     *             If the trust store could not be loaded, perhaps due to
+     *             incorrect format, or missing algorithms.
+     * @throws IOException
+     *             If the trust store file could not be found or could not be
+     *             read.
+     * @throws NullPointerException
+     *             If {@code file} was {@code null}.
+     */
+    public static X509TrustManager checkUsingTrustStore(final String file, final char[] password,
+            final String format) throws GeneralSecurityException, IOException {
+        Validator.ensureNotNull(file);
+
+        final File trustStoreFile = new File(file);
+        final String trustStoreFormat = format != null ? format : KeyStore.getDefaultType();
+
+        final KeyStore keyStore = KeyStore.getInstance(trustStoreFormat);
+
+        FileInputStream fos = null;
+        try {
+            fos = new FileInputStream(trustStoreFile);
+            keyStore.load(fos, password);
+        } finally {
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (final IOException ignored) {
+                    // Ignore.
+                }
+            }
         }
-      }
-      return hostMatch;
-    }
 
+        final TrustManagerFactory tmf =
+                TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+        tmf.init(keyStore);
 
-
-    private void verifyHostName(final X509Certificate[] chain)
-        throws CertificateException
-    {
-      try
-      {
-        // TODO: NPE if root DN.
-        final DN dn = DN.valueOf(chain[0].getSubjectX500Principal().getName(),
-            Schema.getCoreSchema());
-        final String value = dn.iterator().next().iterator().next()
-            .getAttributeValue().toString();
-        if (!hostNameMatchesPattern(value, hostNamePattern))
-        {
-          throw new CertificateException(
-              "The host name contained in the certificate chain subject DN \'"
-                  + chain[0].getSubjectX500Principal()
-                  + "' does not match the host name \'" + hostNamePattern + "'");
+        X509TrustManager x509tm = null;
+        for (final TrustManager tm : tmf.getTrustManagers()) {
+            if (tm instanceof X509TrustManager) {
+                x509tm = (X509TrustManager) tm;
+                break;
+            }
         }
-      }
-      catch (final Throwable t)
-      {
-        LOG.log(Level.WARNING, "Error parsing subject dn: "
-            + chain[0].getSubjectX500Principal(), t);
-      }
-    }
-  }
 
-
-
-  /**
-   * An X509TrustManager which rejects certificates which have expired or are
-   * not yet valid.
-   */
-  private static final class CheckValidatyDates implements X509TrustManager
-  {
-
-    private final X509TrustManager trustManager;
-
-
-
-    private CheckValidatyDates(final X509TrustManager trustManager)
-    {
-      this.trustManager = trustManager;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void checkClientTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      verifyExpiration(chain);
-      trustManager.checkClientTrusted(chain, authType);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void checkServerTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      verifyExpiration(chain);
-      trustManager.checkServerTrusted(chain, authType);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public X509Certificate[] getAcceptedIssuers()
-    {
-      return trustManager.getAcceptedIssuers();
-    }
-
-
-
-    private void verifyExpiration(final X509Certificate[] chain)
-        throws CertificateException
-    {
-      final Date currentDate = new Date();
-      for (final X509Certificate c : chain)
-      {
-        try
-        {
-          c.checkValidity(currentDate);
+        if (x509tm == null) {
+            throw new NoSuchAlgorithmException();
         }
-        catch (final CertificateExpiredException e)
-        {
-          LOG.log(Level.WARNING, "Refusing to trust security"
-              + " certificate \"" + c.getSubjectDN().getName()
-              + "\" because it" + " expired on "
-              + String.valueOf(c.getNotAfter()));
 
-          throw e;
-        }
-        catch (final CertificateNotYetValidException e)
-        {
-          LOG.log(Level.WARNING, "Refusing to trust security"
-              + " certificate \"" + c.getSubjectDN().getName()
-              + "\" because it" + " is not valid until "
-              + String.valueOf(c.getNotBefore()));
-
-          throw e;
-        }
-      }
+        return x509tm;
     }
-  }
-
-
-
-  /**
-   * An X509TrustManager which does not trust any certificates.
-   */
-  private static final class DistrustAll implements X509TrustManager
-  {
-    // Single instance.
-    private static final DistrustAll INSTANCE = new DistrustAll();
-
-
-
-    // Prevent instantiation.
-    private DistrustAll()
-    {
-      // Nothing to do.
-    }
-
-
 
     /**
-     * {@inheritDoc}
+     * Wraps the provided {@code X509TrustManager} by adding additional
+     * validation which rejects certificate chains containing certificates which
+     * have expired or are not yet valid.
+     *
+     * @param trustManager
+     *            The trust manager to be wrapped.
+     * @return The wrapped trust manager.
+     * @throws NullPointerException
+     *             If {@code trustManager} was {@code null}.
      */
-    public void checkClientTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      throw new CertificateException();
+    public static X509TrustManager checkValidityDates(final X509TrustManager trustManager) {
+        Validator.ensureNotNull(trustManager);
+        return new CheckValidatyDates(trustManager);
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns an {@code X509TrustManager} which does not trust any
+     * certificates.
+     *
+     * @return An {@code X509TrustManager} which does not trust any
+     *         certificates.
      */
-    public void checkServerTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-      throw new CertificateException();
+    public static X509TrustManager distrustAll() {
+        return DistrustAll.INSTANCE;
     }
 
-
-
     /**
-     * {@inheritDoc}
+     * Returns an {@code X509TrustManager} which trusts all certificates.
+     *
+     * @return An {@code X509TrustManager} which trusts all certificates.
      */
-    public X509Certificate[] getAcceptedIssuers()
-    {
-      return new X509Certificate[0];
-    }
-  }
-
-
-
-  /**
-   * An X509TrustManager which trusts all certificates.
-   */
-  private static final class TrustAll implements X509TrustManager
-  {
-
-    // Single instance.
-    private static final TrustAll INSTANCE = new TrustAll();
-
-
-
-    // Prevent instantiation.
-    private TrustAll()
-    {
-      // Nothing to do.
+    public static X509TrustManager trustAll() {
+        return TrustAll.INSTANCE;
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void checkClientTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
+    // Prevent insantiation.
+    private TrustManagers() {
+        // Nothing to do.
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void checkServerTrusted(final X509Certificate[] chain,
-        final String authType) throws CertificateException
-    {
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public X509Certificate[] getAcceptedIssuers()
-    {
-      return new X509Certificate[0];
-    }
-  }
-
-
-
-  private static final Logger LOG = Logger.getLogger(TrustManagers.class
-      .getName());
-
-
-
-  /**
-   * Wraps the provided {@code X509TrustManager} by adding additional validation
-   * which rejects certificate chains whose subject DN does not match the
-   * specified host name pattern. The pattern may contain wild-cards, for
-   * example {@code *.example.com}.
-   *
-   * @param hostNamePattern
-   *          A host name pattern which the RDN value contained in certificate
-   *          subject DNs must match.
-   * @param trustManager
-   *          The trust manager to be wrapped.
-   * @return The wrapped trust manager.
-   * @throws NullPointerException
-   *           If {@code trustManager} or {@code hostNamePattern} was {@code
-   *           null}.
-   */
-  public static X509TrustManager checkHostName(final String hostNamePattern,
-      final X509TrustManager trustManager)
-  {
-    Validator.ensureNotNull(trustManager, hostNamePattern);
-    return new CheckHostName(trustManager, hostNamePattern);
-  }
-
-
-
-  /**
-   * Creates a new {@code X509TrustManager} which will use the named trust store
-   * file to determine whether to trust a certificate. It will use the default
-   * trust store format for the JVM (e.g. {@code JKS}) and will not use a
-   * password to open the trust store.
-   *
-   * @param file
-   *          The trust store file name.
-   * @return A new {@code X509TrustManager} which will use the named trust store
-   *         file to determine whether to trust a certificate.
-   * @throws GeneralSecurityException
-   *           If the trust store could not be loaded, perhaps due to incorrect
-   *           format, or missing algorithms.
-   * @throws IOException
-   *           If the trust store file could not be found or could not be read.
-   * @throws NullPointerException
-   *           If {@code file} was {@code null}.
-   */
-  public static X509TrustManager checkUsingTrustStore(final String file)
-      throws GeneralSecurityException, IOException
-  {
-    return checkUsingTrustStore(file, null, null);
-  }
-
-
-
-  /**
-   * Creates a new {@code X509TrustManager} which will use the named trust store
-   * file to determine whether to trust a certificate. It will use the provided
-   * trust store format and password.
-   *
-   * @param file
-   *          The trust store file name.
-   * @param password
-   *          The trust store password, which may be {@code null}.
-   * @param format
-   *          The trust store format, which may be {@code null} to indicate that
-   *          the default trust store format for the JVM (e.g. {@code JKS})
-   *          should be used.
-   * @return A new {@code X509TrustManager} which will use the named trust store
-   *         file to determine whether to trust a certificate.
-   * @throws GeneralSecurityException
-   *           If the trust store could not be loaded, perhaps due to incorrect
-   *           format, or missing algorithms.
-   * @throws IOException
-   *           If the trust store file could not be found or could not be read.
-   * @throws NullPointerException
-   *           If {@code file} was {@code null}.
-   */
-  public static X509TrustManager checkUsingTrustStore(final String file,
-      final char[] password, final String format)
-      throws GeneralSecurityException, IOException
-  {
-    Validator.ensureNotNull(file);
-
-    final File trustStoreFile = new File(file);
-    final String trustStoreFormat = format != null ? format : KeyStore
-        .getDefaultType();
-
-    final KeyStore keyStore = KeyStore.getInstance(trustStoreFormat);
-
-    FileInputStream fos = null;
-    try
-    {
-      fos = new FileInputStream(trustStoreFile);
-      keyStore.load(fos, password);
-    }
-    finally
-    {
-      if (fos != null)
-      {
-        try
-        {
-          fos.close();
-        }
-        catch (final IOException ignored)
-        {
-          // Ignore.
-        }
-      }
-    }
-
-    final TrustManagerFactory tmf = TrustManagerFactory
-        .getInstance(TrustManagerFactory.getDefaultAlgorithm());
-    tmf.init(keyStore);
-
-    X509TrustManager x509tm = null;
-    for (final TrustManager tm : tmf.getTrustManagers())
-    {
-      if (tm instanceof X509TrustManager)
-      {
-        x509tm = (X509TrustManager) tm;
-        break;
-      }
-    }
-
-    if (x509tm == null)
-    {
-      throw new NoSuchAlgorithmException();
-    }
-
-    return x509tm;
-  }
-
-
-
-  /**
-   * Wraps the provided {@code X509TrustManager} by adding additional validation
-   * which rejects certificate chains containing certificates which have expired
-   * or are not yet valid.
-   *
-   * @param trustManager
-   *          The trust manager to be wrapped.
-   * @return The wrapped trust manager.
-   * @throws NullPointerException
-   *           If {@code trustManager} was {@code null}.
-   */
-  public static X509TrustManager checkValidityDates(
-      final X509TrustManager trustManager)
-  {
-    Validator.ensureNotNull(trustManager);
-    return new CheckValidatyDates(trustManager);
-  }
-
-
-
-  /**
-   * Returns an {@code X509TrustManager} which does not trust any certificates.
-   *
-   * @return An {@code X509TrustManager} which does not trust any certificates.
-   */
-  public static X509TrustManager distrustAll()
-  {
-    return DistrustAll.INSTANCE;
-  }
-
-
-
-  /**
-   * Returns an {@code X509TrustManager} which trusts all certificates.
-   *
-   * @return An {@code X509TrustManager} which trusts all certificates.
-   */
-  public static X509TrustManager trustAll()
-  {
-    return TrustAll.INSTANCE;
-  }
-
-
-
-  // Prevent insantiation.
-  private TrustManagers()
-  {
-    // Nothing to do.
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java
index c5fd3e4..c0a835c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDAPASSERT_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDAPASSERT_INVALID_CONTROL_VALUE;
@@ -41,13 +38,15 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Filter;
 
 import com.forgerock.opendj.ldap.LDAPUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The assertion request control as defined in RFC 4528. The Assertion control
  * allows a client to specify that a directory operation should only be
@@ -58,187 +57,144 @@
  * @see <a href="http://tools.ietf.org/html/rfc4528">RFC 4528 - Lightweight
  *      Directory Access Protocol (LDAP) Assertion Control </a>
  */
-public final class AssertionRequestControl implements Control
-{
-  /**
-   * The IANA-assigned OID for the LDAP assertion request control.
-   */
-  public static final String OID = "1.3.6.1.1.12";
+public final class AssertionRequestControl implements Control {
+    /**
+     * The IANA-assigned OID for the LDAP assertion request control.
+     */
+    public static final String OID = "1.3.6.1.1.12";
 
-  /**
-   * A decoder which can be used for decoding the LDAP assertion request
-   * control.
-   */
-  public static final ControlDecoder<AssertionRequestControl> DECODER =
-    new ControlDecoder<AssertionRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the LDAP assertion request
+     * control.
+     */
+    public static final ControlDecoder<AssertionRequestControl> DECODER =
+            new ControlDecoder<AssertionRequestControl>() {
 
-    public AssertionRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public AssertionRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof AssertionRequestControl)
-      {
-        return (AssertionRequestControl) control;
-      }
+                    if (control instanceof AssertionRequestControl) {
+                        return (AssertionRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_LDAPASSERT_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_LDAPASSERT_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_LDAPASSERT_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_LDAPASSERT_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      Filter filter;
-      try
-      {
-        filter = LDAPUtils.decodeFilter(reader);
-      }
-      catch (final IOException e)
-      {
-        throw DecodeException.error(ERR_LDAPASSERT_INVALID_CONTROL_VALUE
-            .get(getExceptionMessage(e)), e);
-      }
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    Filter filter;
+                    try {
+                        filter = LDAPUtils.decodeFilter(reader);
+                    } catch (final IOException e) {
+                        throw DecodeException.error(ERR_LDAPASSERT_INVALID_CONTROL_VALUE
+                                .get(getExceptionMessage(e)), e);
+                    }
 
-      return new AssertionRequestControl(control.isCritical(), filter);
+                    return new AssertionRequestControl(control.isCritical(), filter);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new assertion using the provided criticality and assertion
+     * filter.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param filter
+     *            The assertion filter.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code filter} was {@code null}.
+     */
+    public static AssertionRequestControl newControl(final boolean isCritical, final Filter filter) {
+        return new AssertionRequestControl(isCritical, filter);
     }
 
+    // The assertion filter.
+    private final Filter filter;
 
+    private final boolean isCritical;
 
-    public String getOID()
-    {
-      return OID;
+    // Prevent direct instantiation.
+    private AssertionRequestControl(final boolean isCritical, final Filter filter) {
+        Validator.ensureNotNull(filter);
+        this.isCritical = isCritical;
+        this.filter = filter;
     }
-  };
 
-
-
-  /**
-   * Creates a new assertion using the provided criticality and assertion
-   * filter.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param filter
-   *          The assertion filter.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code filter} was {@code null}.
-   */
-  public static AssertionRequestControl newControl(final boolean isCritical,
-      final Filter filter)
-  {
-    return new AssertionRequestControl(isCritical, filter);
-  }
-
-
-
-  // The assertion filter.
-  private final Filter filter;
-
-  private final boolean isCritical;
-
-
-
-  // Prevent direct instantiation.
-  private AssertionRequestControl(final boolean isCritical, final Filter filter)
-  {
-    Validator.ensureNotNull(filter);
-    this.isCritical = isCritical;
-    this.filter = filter;
-  }
-
-
-
-  /**
-   * Returns the assertion filter.
-   *
-   * @return The assertion filter.
-   */
-  public Filter getFilter()
-  {
-    return filter;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      LDAPUtils.encodeFilter(writer, filter);
-      return buffer.toByteString();
+    /**
+     * Returns the assertion filter.
+     *
+     * @return The assertion filter.
+     */
+    public Filter getFilter() {
+        return filter;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            LDAPUtils.encodeFilter(writer, filter);
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AssertionRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", filter=\"");
-    builder.append(filter.toString());
-    builder.append("\")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AssertionRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", filter=\"");
+        builder.append(filter.toString());
+        builder.append("\")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java
index a045072..143e468 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_AUTHZIDREQ_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_AUTHZIDREQ_CONTROL_HAS_VALUE;
 
@@ -38,8 +35,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The authorization request control as defined in RFC 3829. The authorization
  * identity control extends the Lightweight Directory Access Protocol (LDAP)
@@ -54,146 +49,113 @@
  * @see <a href="http://tools.ietf.org/html/rfc4532">RFC 4532 - Lightweight
  *      Directory Access Protocol (LDAP) "Who am I?" Operation </a>
  */
-public final class AuthorizationIdentityRequestControl implements Control
-{
-  /**
-   * The OID for the authorization identity request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.16";
+public final class AuthorizationIdentityRequestControl implements Control {
+    /**
+     * The OID for the authorization identity request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.16";
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final AuthorizationIdentityRequestControl CRITICAL_INSTANCE =
-    new AuthorizationIdentityRequestControl(true);
+    private static final AuthorizationIdentityRequestControl CRITICAL_INSTANCE =
+            new AuthorizationIdentityRequestControl(true);
 
-  private static final AuthorizationIdentityRequestControl
-    NONCRITICAL_INSTANCE= new AuthorizationIdentityRequestControl(false);
+    private static final AuthorizationIdentityRequestControl NONCRITICAL_INSTANCE =
+            new AuthorizationIdentityRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the authorization identity request
-   * control.
-   */
-  public static final ControlDecoder<AuthorizationIdentityRequestControl>
-    DECODER = new ControlDecoder<AuthorizationIdentityRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the authorization identity
+     * request control.
+     */
+    public static final ControlDecoder<AuthorizationIdentityRequestControl> DECODER =
+            new ControlDecoder<AuthorizationIdentityRequestControl>() {
 
-    public AuthorizationIdentityRequestControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public AuthorizationIdentityRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof AuthorizationIdentityRequestControl)
-      {
-        return (AuthorizationIdentityRequestControl) control;
-      }
+                    if (control instanceof AuthorizationIdentityRequestControl) {
+                        return (AuthorizationIdentityRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_AUTHZIDREQ_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_AUTHZIDREQ_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_AUTHZIDREQ_CONTROL_HAS_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message = ERR_AUTHZIDREQ_CONTROL_HAS_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new authorization identity request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static AuthorizationIdentityRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    // Prevent direct instantiation.
+    private AuthorizationIdentityRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new authorization identity request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static AuthorizationIdentityRequestControl newControl(
-      final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  // Prevent direct instantiation.
-  private AuthorizationIdentityRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AuthorizationIdentityRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AuthorizationIdentityRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java
index 9ab6133..9910b21 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_AUTHZIDRESP_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_AUTHZIDRESP_NO_CONTROL_VALUE;
 
@@ -39,16 +36,14 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The authorization response control as defined in RFC 3829. The authorization
  * identity control extends the Lightweight Directory Access Protocol (LDAP)
  * bind operation with a mechanism for requesting and returning the
  * authorization identity it establishes.
  * <p>
- * The authorization identity is specified using an authorization ID, or {@code
- * authzId}, as defined in RFC 4513 section 5.2.1.8.
+ * The authorization identity is specified using an authorization ID, or
+ * {@code authzId}, as defined in RFC 4513 section 5.2.1.8.
  *
  * @see AuthorizationIdentityRequestControl
  * @see org.forgerock.opendj.ldap.requests.WhoAmIExtendedRequest
@@ -60,168 +55,130 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public final class AuthorizationIdentityResponseControl implements Control
-{
+public final class AuthorizationIdentityResponseControl implements Control {
 
-  /**
-   * The OID for the authorization identity response control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.15";
+    /**
+     * The OID for the authorization identity response control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.15";
 
-
-
-  /**
-   * Creates a new authorization identity response control using the provided
-   * authorization ID.
-   *
-   * @param authorizationID
-   *          The authorization ID for this control.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code authorizationID} was {@code null}.
-   */
-  public static AuthorizationIdentityResponseControl newControl(
-      final String authorizationID)
-  {
-    return new AuthorizationIdentityResponseControl(false, authorizationID);
-  }
-
-
-
-  // The authorization ID for this control.
-  private final String authorizationID;
-
-  private final boolean isCritical;
-
-  /**
-   * A decoder which can be used for decoding the authorization identity
-   * response control.
-   */
-  public static final ControlDecoder<AuthorizationIdentityResponseControl>
-    DECODER = new ControlDecoder<AuthorizationIdentityResponseControl>()
-  {
-
-    public AuthorizationIdentityResponseControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control);
-
-      if (control instanceof AuthorizationIdentityResponseControl)
-      {
-        return (AuthorizationIdentityResponseControl) control;
-      }
-
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_AUTHZIDRESP_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
-
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_AUTHZIDRESP_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
-
-      final String authID = control.getValue().toString();
-      return new AuthorizationIdentityResponseControl(control.isCritical(),
-          authID);
+    /**
+     * Creates a new authorization identity response control using the provided
+     * authorization ID.
+     *
+     * @param authorizationID
+     *            The authorization ID for this control.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code authorizationID} was {@code null}.
+     */
+    public static AuthorizationIdentityResponseControl newControl(final String authorizationID) {
+        return new AuthorizationIdentityResponseControl(false, authorizationID);
     }
 
+    // The authorization ID for this control.
+    private final String authorizationID;
 
+    private final boolean isCritical;
 
-    public String getOID()
-    {
-      return OID;
+    /**
+     * A decoder which can be used for decoding the authorization identity
+     * response control.
+     */
+    public static final ControlDecoder<AuthorizationIdentityResponseControl> DECODER =
+            new ControlDecoder<AuthorizationIdentityResponseControl>() {
+
+                public AuthorizationIdentityResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
+
+                    if (control instanceof AuthorizationIdentityResponseControl) {
+                        return (AuthorizationIdentityResponseControl) control;
+                    }
+
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_AUTHZIDRESP_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
+
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_AUTHZIDRESP_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
+
+                    final String authID = control.getValue().toString();
+                    return new AuthorizationIdentityResponseControl(control.isCritical(), authID);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    // Prevent direct instantiation.
+    private AuthorizationIdentityResponseControl(final boolean isCritical,
+            final String authorizationID) {
+        Validator.ensureNotNull(authorizationID);
+        this.isCritical = isCritical;
+        this.authorizationID = authorizationID;
     }
-  };
 
+    /**
+     * Returns the authorization ID of the user. The authorization ID usually
+     * has the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authorization ID of the user.
+     */
+    public String getAuthorizationID() {
+        return authorizationID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
-  // Prevent direct instantiation.
-  private AuthorizationIdentityResponseControl(final boolean isCritical,
-      final String authorizationID)
-  {
-    Validator.ensureNotNull(authorizationID);
-    this.isCritical = isCritical;
-    this.authorizationID = authorizationID;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return ByteString.valueOf(authorizationID);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  /**
-   * Returns the authorization ID of the user. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user.
-   */
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return ByteString.valueOf(authorizationID);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AuthorizationIdentityResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", authzID=\"");
-    builder.append(authorizationID);
-    builder.append("\")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AuthorizationIdentityResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", authzID=\"");
+        builder.append(authorizationID);
+        builder.append("\")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/Control.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/Control.java
index 319bb0f..4a021ef 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/Control.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/Control.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,12 +25,8 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Controls provide a mechanism whereby the semantics and arguments of existing
  * LDAP operations may be extended. One or more controls may be attached to a
@@ -42,55 +37,48 @@
  * @see <a href="http://tools.ietf.org/html/rfc4511">RFC 4511 - Lightweight
  *      Directory Access Protocol (LDAP): The Protocol </a>
  */
-public interface Control
-{
+public interface Control {
 
-  /**
-   * Returns the numeric OID associated with this control.
-   *
-   * @return The numeric OID associated with this control.
-   */
-  String getOID();
+    /**
+     * Returns the numeric OID associated with this control.
+     *
+     * @return The numeric OID associated with this control.
+     */
+    String getOID();
 
+    /**
+     * Returns the value, if any, associated with this control. Its format is
+     * defined by the specification of this control.
+     *
+     * @return The value associated with this control, or {@code null} if there
+     *         is no value.
+     */
+    ByteString getValue();
 
+    /**
+     * Returns {@code true} if this control has a value. In some circumstances
+     * it may be useful to determine if a control has a value, without actually
+     * calculating the value and incurring any performance costs.
+     *
+     * @return {@code true} if this control has a value, or {@code false} if
+     *         there is no value.
+     */
+    boolean hasValue();
 
-  /**
-   * Returns the value, if any, associated with this control. Its format is
-   * defined by the specification of this control.
-   *
-   * @return The value associated with this control, or {@code null} if there is
-   *         no value.
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * Returns {@code true} if this control has a value. In some circumstances it
-   * may be useful to determine if a control has a value, without actually
-   * calculating the value and incurring any performance costs.
-   *
-   * @return {@code true} if this control has a value, or {@code false} if there
-   *         is no value.
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Returns {@code true} if it is unacceptable to perform the operation without
-   * applying the semantics of this control.
-   * <p>
-   * The criticality field only has meaning in controls attached to request
-   * messages (except UnbindRequest). For controls attached to response messages
-   * and the UnbindRequest, the criticality field SHOULD be {@code false}, and
-   * MUST be ignored by the receiving protocol peer. A value of {@code true}
-   * indicates that it is unacceptable to perform the operation without applying
-   * the semantics of the control.
-   *
-   * @return {@code true} if this control must be processed by the Directory
-   *         Server, or {@code false} if it can be ignored.
-   */
-  boolean isCritical();
+    /**
+     * Returns {@code true} if it is unacceptable to perform the operation
+     * without applying the semantics of this control.
+     * <p>
+     * The criticality field only has meaning in controls attached to request
+     * messages (except UnbindRequest). For controls attached to response
+     * messages and the UnbindRequest, the criticality field SHOULD be
+     * {@code false}, and MUST be ignored by the receiving protocol peer. A
+     * value of {@code true} indicates that it is unacceptable to perform the
+     * operation without applying the semantics of the control.
+     *
+     * @return {@code true} if this control must be processed by the Directory
+     *         Server, or {@code false} if it can be ignored.
+     */
+    boolean isCritical();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java
index 682334c..04a85f3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,43 +26,35 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 
-
-
 /**
  * A factory interface for decoding a control as a control of specific type.
  *
  * @param <C>
- *          The type of control decoded by this control decoder.
+ *            The type of control decoded by this control decoder.
  */
-public interface ControlDecoder<C extends Control>
-{
-  /**
-   * Decodes the provided control as a {@code Control} of type {@code C}.
-   *
-   * @param control
-   *          The control to be decoded.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          control.
-   * @return The decoded control.
-   * @throws DecodeException
-   *           If the control contained the wrong OID, it did not have a value,
-   *           or if its value could not be decoded.
-   */
-  C decodeControl(Control control, DecodeOptions options)
-      throws DecodeException;
+public interface ControlDecoder<C extends Control> {
+    /**
+     * Decodes the provided control as a {@code Control} of type {@code C}.
+     *
+     * @param control
+     *            The control to be decoded.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the control.
+     * @return The decoded control.
+     * @throws DecodeException
+     *             If the control contained the wrong OID, it did not have a
+     *             value, or if its value could not be decoded.
+     */
+    C decodeControl(Control control, DecodeOptions options) throws DecodeException;
 
-
-
-  /**
-   * Returns the numeric OID associated with this control decoder.
-   *
-   * @return The numeric OID associated with this control decoder.
-   */
-  String getOID();
+    /**
+     * Returns the numeric OID associated with this control decoder.
+     *
+     * @return The numeric OID associated with this control decoder.
+     */
+    String getOID();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java
index 83b37e1..1a9eda3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.asn1.ASN1Constants.UNIVERSAL_INTEGER_TYPE;
 import static org.forgerock.opendj.asn1.ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE;
@@ -41,14 +38,16 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The entry change notification response control as defined in
  * draft-ietf-ldapext-psearch. This control provides additional information
@@ -61,341 +60,279 @@
  *      href="http://tools.ietf.org/html/draft-ietf-ldapext-psearch">draft-ietf-ldapext-psearch
  *      - Persistent Search: A Simple LDAP Change Notification Mechanism </a>
  */
-public final class EntryChangeNotificationResponseControl implements Control
-{
-  /**
-   * The OID for the entry change notification response control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.7";
+public final class EntryChangeNotificationResponseControl implements Control {
+    /**
+     * The OID for the entry change notification response control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.7";
 
-  /**
-   * A decoder which can be used for decoding the entry change notification
-   * response control.
-   */
-  public static final ControlDecoder<EntryChangeNotificationResponseControl>
-    DECODER = new ControlDecoder<EntryChangeNotificationResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the entry change notification
+     * response control.
+     */
+    public static final ControlDecoder<EntryChangeNotificationResponseControl> DECODER =
+            new ControlDecoder<EntryChangeNotificationResponseControl>() {
 
-    public EntryChangeNotificationResponseControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control, options);
+                public EntryChangeNotificationResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control, options);
 
-      if (control instanceof EntryChangeNotificationResponseControl)
-      {
-        return (EntryChangeNotificationResponseControl) control;
-      }
+                    if (control instanceof EntryChangeNotificationResponseControl) {
+                        return (EntryChangeNotificationResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_ECN_CONTROL_BAD_OID.get(control
-            .getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_ECN_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_ECN_NO_CONTROL_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_ECN_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      String previousDNString = null;
-      long changeNumber = -1;
-      PersistentSearchChangeType changeType;
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
+                    String previousDNString = null;
+                    long changeNumber = -1;
+                    PersistentSearchChangeType changeType;
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
 
-        final int changeTypeInt = reader.readEnumerated();
-        switch (changeTypeInt)
-        {
-        case 1:
-          changeType = PersistentSearchChangeType.ADD;
-          break;
-        case 2:
-          changeType = PersistentSearchChangeType.DELETE;
-          break;
-        case 4:
-          changeType = PersistentSearchChangeType.MODIFY;
-          break;
-        case 8:
-          changeType = PersistentSearchChangeType.MODIFY_DN;
-          break;
-        default:
-          final LocalizableMessage message = ERR_ECN_BAD_CHANGE_TYPE
-              .get(changeTypeInt);
-          throw DecodeException.error(message);
-        }
+                        final int changeTypeInt = reader.readEnumerated();
+                        switch (changeTypeInt) {
+                        case 1:
+                            changeType = PersistentSearchChangeType.ADD;
+                            break;
+                        case 2:
+                            changeType = PersistentSearchChangeType.DELETE;
+                            break;
+                        case 4:
+                            changeType = PersistentSearchChangeType.MODIFY;
+                            break;
+                        case 8:
+                            changeType = PersistentSearchChangeType.MODIFY_DN;
+                            break;
+                        default:
+                            final LocalizableMessage message =
+                                    ERR_ECN_BAD_CHANGE_TYPE.get(changeTypeInt);
+                            throw DecodeException.error(message);
+                        }
 
-        if (reader.hasNextElement()
-            && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE))
-        {
-          if (changeType != PersistentSearchChangeType.MODIFY_DN)
-          {
-            final LocalizableMessage message = ERR_ECN_ILLEGAL_PREVIOUS_DN
-                .get(String.valueOf(changeType));
-            throw DecodeException.error(message);
-          }
+                        if (reader.hasNextElement()
+                                && (reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE)) {
+                            if (changeType != PersistentSearchChangeType.MODIFY_DN) {
+                                final LocalizableMessage message =
+                                        ERR_ECN_ILLEGAL_PREVIOUS_DN.get(String.valueOf(changeType));
+                                throw DecodeException.error(message);
+                            }
 
-          previousDNString = reader.readOctetStringAsString();
-        }
-        if (reader.hasNextElement()
-            && (reader.peekType() == UNIVERSAL_INTEGER_TYPE))
-        {
-          changeNumber = reader.readInteger();
-        }
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing(
-            "EntryChangeNotificationControl.Decoder", "decode", e);
+                            previousDNString = reader.readOctetStringAsString();
+                        }
+                        if (reader.hasNextElement()
+                                && (reader.peekType() == UNIVERSAL_INTEGER_TYPE)) {
+                            changeNumber = reader.readInteger();
+                        }
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("EntryChangeNotificationControl.Decoder",
+                                "decode", e);
 
-        final LocalizableMessage message = ERR_ECN_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_ECN_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      final Schema schema = options.getSchemaResolver().resolveSchema(
-          previousDNString);
-      DN previousDN = null;
-      if (previousDNString != null)
-      {
-        try
-        {
-          previousDN = DN.valueOf(previousDNString, schema);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          final LocalizableMessage message = ERR_ECN_INVALID_PREVIOUS_DN
-              .get(getExceptionMessage(e));
-          throw DecodeException.error(message, e);
-        }
-      }
+                    final Schema schema =
+                            options.getSchemaResolver().resolveSchema(previousDNString);
+                    DN previousDN = null;
+                    if (previousDNString != null) {
+                        try {
+                            previousDN = DN.valueOf(previousDNString, schema);
+                        } catch (final LocalizedIllegalArgumentException e) {
+                            final LocalizableMessage message =
+                                    ERR_ECN_INVALID_PREVIOUS_DN.get(getExceptionMessage(e));
+                            throw DecodeException.error(message, e);
+                        }
+                    }
 
-      return new EntryChangeNotificationResponseControl(control.isCritical(),
-          changeType, previousDN, changeNumber);
+                    return new EntryChangeNotificationResponseControl(control.isCritical(),
+                            changeType, previousDN, changeNumber);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new entry change notification response control with the
+     * provided change type and optional previous distinguished name and change
+     * number.
+     *
+     * @param type
+     *            The change type for this change notification control.
+     * @param previousName
+     *            The distinguished name that the entry had prior to a modify DN
+     *            operation, or <CODE>null</CODE> if the operation was not a
+     *            modify DN.
+     * @param changeNumber
+     *            The change number for the associated change, or a negative
+     *            value if no change number is available.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code type} was {@code null}.
+     */
+    public static EntryChangeNotificationResponseControl newControl(
+            final PersistentSearchChangeType type, final DN previousName, final long changeNumber) {
+        return new EntryChangeNotificationResponseControl(false, type, previousName, changeNumber);
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * Creates a new entry change notification response control with the
+     * provided change type and optional previous distinguished name and change
+     * number. The previous distinguished name, if provided, will be decoded
+     * using the default schema.
+     *
+     * @param type
+     *            The change type for this change notification control.
+     * @param previousName
+     *            The distinguished name that the entry had prior to a modify DN
+     *            operation, or <CODE>null</CODE> if the operation was not a
+     *            modify DN.
+     * @param changeNumber
+     *            The change number for the associated change, or a negative
+     *            value if no change number is available.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code previousName} is not a valid LDAP string
+     *             representation of a DN.
+     * @throws NullPointerException
+     *             If {@code type} was {@code null}.
+     */
+    public static EntryChangeNotificationResponseControl newControl(
+            final PersistentSearchChangeType type, final String previousName,
+            final long changeNumber) {
+        return new EntryChangeNotificationResponseControl(false, type, DN.valueOf(previousName),
+                changeNumber);
     }
-  };
 
+    // The previous DN for this change notification control.
+    private final DN previousName;
 
+    // The change number for this change notification control.
+    private final long changeNumber;
 
-  /**
-   * Creates a new entry change notification response control with the provided
-   * change type and optional previous distinguished name and change number.
-   *
-   * @param type
-   *          The change type for this change notification control.
-   * @param previousName
-   *          The distinguished name that the entry had prior to a modify DN
-   *          operation, or <CODE>null</CODE> if the operation was not a modify
-   *          DN.
-   * @param changeNumber
-   *          The change number for the associated change, or a negative value
-   *          if no change number is available.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code type} was {@code null}.
-   */
-  public static EntryChangeNotificationResponseControl newControl(
-      final PersistentSearchChangeType type, final DN previousName,
-      final long changeNumber)
-  {
-    return new EntryChangeNotificationResponseControl(false, type,
-        previousName, changeNumber);
-  }
+    // The change type for this change notification control.
+    private final PersistentSearchChangeType changeType;
 
+    private final boolean isCritical;
 
-
-  /**
-   * Creates a new entry change notification response control with the provided
-   * change type and optional previous distinguished name and change number. The
-   * previous distinguished name, if provided, will be decoded using the default
-   * schema.
-   *
-   * @param type
-   *          The change type for this change notification control.
-   * @param previousName
-   *          The distinguished name that the entry had prior to a modify DN
-   *          operation, or <CODE>null</CODE> if the operation was not a modify
-   *          DN.
-   * @param changeNumber
-   *          The change number for the associated change, or a negative value
-   *          if no change number is available.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code previousName} is not a valid LDAP string representation
-   *           of a DN.
-   * @throws NullPointerException
-   *           If {@code type} was {@code null}.
-   */
-  public static EntryChangeNotificationResponseControl newControl(
-      final PersistentSearchChangeType type, final String previousName,
-      final long changeNumber)
-  {
-    return new EntryChangeNotificationResponseControl(false, type, DN
-        .valueOf(previousName), changeNumber);
-  }
-
-
-
-  // The previous DN for this change notification control.
-  private final DN previousName;
-
-  // The change number for this change notification control.
-  private final long changeNumber;
-
-  // The change type for this change notification control.
-  private final PersistentSearchChangeType changeType;
-
-  private final boolean isCritical;
-
-
-
-  private EntryChangeNotificationResponseControl(final boolean isCritical,
-      final PersistentSearchChangeType changeType, final DN previousName,
-      final long changeNumber)
-  {
-    Validator.ensureNotNull(changeType);
-    this.isCritical = isCritical;
-    this.changeType = changeType;
-    this.previousName = previousName;
-    this.changeNumber = changeNumber;
-  }
-
-
-
-  /**
-   * Returns the change number for this entry change notification control.
-   *
-   * @return The change number for this entry change notification control, or a
-   *         negative value if no change number is available.
-   */
-  public long getChangeNumber()
-  {
-    return changeNumber;
-  }
-
-
-
-  /**
-   * Returns the change type for this entry change notification control.
-   *
-   * @return The change type for this entry change notification control.
-   */
-  public PersistentSearchChangeType getChangeType()
-  {
-    return changeType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns the distinguished name that the entry had prior to a modify DN
-   * operation, or <CODE>null</CODE> if the operation was not a modify DN.
-   *
-   * @return The distinguished name that the entry had prior to a modify DN
-   *         operation.
-   */
-  public DN getPreviousName()
-  {
-    return previousName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeInteger(changeType.intValue());
-
-      if (previousName != null)
-      {
-        writer.writeOctetString(previousName.toString());
-      }
-
-      if (changeNumber > 0)
-      {
-        writer.writeInteger(changeNumber);
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    private EntryChangeNotificationResponseControl(final boolean isCritical,
+            final PersistentSearchChangeType changeType, final DN previousName,
+            final long changeNumber) {
+        Validator.ensureNotNull(changeType);
+        this.isCritical = isCritical;
+        this.changeType = changeType;
+        this.previousName = previousName;
+        this.changeNumber = changeNumber;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * Returns the change number for this entry change notification control.
+     *
+     * @return The change number for this entry change notification control, or
+     *         a negative value if no change number is available.
+     */
+    public long getChangeNumber() {
+        return changeNumber;
     }
-  }
 
+    /**
+     * Returns the change type for this entry change notification control.
+     *
+     * @return The change type for this entry change notification control.
+     */
+    public PersistentSearchChangeType getChangeType() {
+        return changeType;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * Returns the distinguished name that the entry had prior to a modify DN
+     * operation, or <CODE>null</CODE> if the operation was not a modify DN.
+     *
+     * @return The distinguished name that the entry had prior to a modify DN
+     *         operation.
+     */
+    public DN getPreviousName() {
+        return previousName;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeInteger(changeType.intValue());
 
+            if (previousName != null) {
+                writer.writeOctetString(previousName.toString());
+            }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
+            if (changeNumber > 0) {
+                writer.writeInteger(changeNumber);
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("EntryChangeNotificationResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", changeType=");
-    builder.append(changeType.toString());
-    builder.append(", previousDN=\"");
-    builder.append(previousName);
-    builder.append("\"");
-    builder.append(", changeNumber=");
-    builder.append(changeNumber);
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("EntryChangeNotificationResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", changeType=");
+        builder.append(changeType.toString());
+        builder.append(", previousDN=\"");
+        builder.append(previousName);
+        builder.append("\"");
+        builder.append(", changeNumber=");
+        builder.append(changeNumber);
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java
index 3356d32..1f8d1f1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,192 +26,152 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A generic control which can be used to represent arbitrary raw request and
  * response controls.
  */
-public final class GenericControl implements Control
-{
+public final class GenericControl implements Control {
 
-  /**
-   * Creates a new control having the same OID, criticality, and value as the
-   * provided control.
-   *
-   * @param control
-   *          The control to be copied.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code control} was {@code null}.
-   */
-  public static GenericControl newControl(final Control control)
-  {
-    Validator.ensureNotNull(control);
+    /**
+     * Creates a new control having the same OID, criticality, and value as the
+     * provided control.
+     *
+     * @param control
+     *            The control to be copied.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code control} was {@code null}.
+     */
+    public static GenericControl newControl(final Control control) {
+        Validator.ensureNotNull(control);
 
-    if (control instanceof GenericControl)
-    {
-      return (GenericControl) control;
+        if (control instanceof GenericControl) {
+            return (GenericControl) control;
+        }
+
+        return new GenericControl(control.getOID(), control.isCritical(), control.getValue());
     }
 
-    return new GenericControl(control.getOID(), control.isCritical(), control
-        .getValue());
-  }
-
-
-
-  /**
-   * Creates a new non-critical control having the provided OID and no value.
-   *
-   * @param oid
-   *          The numeric OID associated with this control.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code oid} was {@code null}.
-   */
-  public static GenericControl newControl(final String oid)
-  {
-    return new GenericControl(oid, false, null);
-  }
-
-
-
-  /**
-   * Creates a new control having the provided OID and criticality, but no
-   * value.
-   *
-   * @param oid
-   *          The numeric OID associated with this control.
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code oid} was {@code null}.
-   */
-  public static GenericControl newControl(final String oid,
-      final boolean isCritical)
-  {
-    return new GenericControl(oid, isCritical, null);
-  }
-
-
-
-  /**
-   * Creates a new control having the provided OID, criticality, and value.
-   * <p>
-   * If {@code value} is not an instance of {@code ByteString} then it will be
-   * converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param oid
-   *          The numeric OID associated with this control.
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param value
-   *          The value associated with this control, or {@code null} if there
-   *          is no value. Its format is defined by the specification of this
-   *          control.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code oid} was {@code null}.
-   */
-  public static GenericControl newControl(final String oid,
-      final boolean isCritical, final Object value)
-  {
-    return new GenericControl(oid, isCritical, (value == null) ? null
-        : ByteString.valueOf(value));
-  }
-
-
-
-  private final String oid;
-
-  private final boolean isCritical;
-
-  private final ByteString value;
-
-
-
-  // Prevent direct instantiation.
-  private GenericControl(final String oid, final boolean isCritical,
-      final ByteString value)
-  {
-    Validator.ensureNotNull(oid);
-    this.oid = oid;
-    this.isCritical = isCritical;
-    this.value = value;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return oid;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return value;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return value != null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("Control(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    if (value != null)
-    {
-      builder.append(", value=");
-      StaticUtils.toHexPlusAscii(value, builder, 4);
+    /**
+     * Creates a new non-critical control having the provided OID and no value.
+     *
+     * @param oid
+     *            The numeric OID associated with this control.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code oid} was {@code null}.
+     */
+    public static GenericControl newControl(final String oid) {
+        return new GenericControl(oid, false, null);
     }
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * Creates a new control having the provided OID and criticality, but no
+     * value.
+     *
+     * @param oid
+     *            The numeric OID associated with this control.
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code oid} was {@code null}.
+     */
+    public static GenericControl newControl(final String oid, final boolean isCritical) {
+        return new GenericControl(oid, isCritical, null);
+    }
+
+    /**
+     * Creates a new control having the provided OID, criticality, and value.
+     * <p>
+     * If {@code value} is not an instance of {@code ByteString} then it will be
+     * converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param oid
+     *            The numeric OID associated with this control.
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param value
+     *            The value associated with this control, or {@code null} if
+     *            there is no value. Its format is defined by the specification
+     *            of this control.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code oid} was {@code null}.
+     */
+    public static GenericControl newControl(final String oid, final boolean isCritical,
+            final Object value) {
+        return new GenericControl(oid, isCritical, (value == null) ? null : ByteString
+                .valueOf(value));
+    }
+
+    private final String oid;
+
+    private final boolean isCritical;
+
+    private final ByteString value;
+
+    // Prevent direct instantiation.
+    private GenericControl(final String oid, final boolean isCritical, final ByteString value) {
+        Validator.ensureNotNull(oid);
+        this.oid = oid;
+        this.isCritical = isCritical;
+        this.value = value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return oid;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return value != null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("Control(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        if (value != null) {
+            builder.append(", value=");
+            StaticUtils.toHexPlusAscii(value, builder, 4);
+        }
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java
index 57ae6f8..1a47e21 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,28 +26,32 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A partial implementation of the get effective rights request control as
  * defined in draft-ietf-ldapext-acl-model. The main differences are:
@@ -74,356 +77,293 @@
  *      href="http://tools.ietf.org/html/draft-ietf-ldapext-acl-model">draft-ietf-ldapext-acl-model
  *      - Access Control Model for LDAPv3 </a>
  **/
-public final class GetEffectiveRightsRequestControl implements Control
-{
-  /**
-   * The OID for the get effective rights request control.
-   */
-  public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.2";
+public final class GetEffectiveRightsRequestControl implements Control {
+    /**
+     * The OID for the get effective rights request control.
+     */
+    public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.2";
 
-  /**
-   * A decoder which can be used for decoding the get effective rights request
-   * control.
-   */
-  public static final ControlDecoder<GetEffectiveRightsRequestControl> DECODER =
-    new ControlDecoder<GetEffectiveRightsRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the get effective rights request
+     * control.
+     */
+    public static final ControlDecoder<GetEffectiveRightsRequestControl> DECODER =
+            new ControlDecoder<GetEffectiveRightsRequestControl>() {
 
-    public GetEffectiveRightsRequestControl decodeControl(
-        final Control control, final DecodeOptions options)
-        throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public GetEffectiveRightsRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof GetEffectiveRightsRequestControl)
-      {
-        return (GetEffectiveRightsRequestControl) control;
-      }
+                    if (control instanceof GetEffectiveRightsRequestControl) {
+                        return (GetEffectiveRightsRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_GETEFFECTIVERIGHTS_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_GETEFFECTIVERIGHTS_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      DN authorizationDN = null;
-      List<AttributeType> attributes = Collections.emptyList();
+                    DN authorizationDN = null;
+                    List<AttributeType> attributes = Collections.emptyList();
 
-      if (control.hasValue())
-      {
-        final ASN1Reader reader = ASN1.getReader(control.getValue());
-        try
-        {
-          reader.readStartSequence();
-          final String authzIDString = reader.readOctetStringAsString();
-          final String lowerAuthzIDString = authzIDString.toLowerCase();
-          Schema schema;
+                    if (control.hasValue()) {
+                        final ASN1Reader reader = ASN1.getReader(control.getValue());
+                        try {
+                            reader.readStartSequence();
+                            final String authzIDString = reader.readOctetStringAsString();
+                            final String lowerAuthzIDString = authzIDString.toLowerCase();
+                            Schema schema;
 
-          // Make sure authzId starts with "dn:" and is a valid DN.
-          if (lowerAuthzIDString.startsWith("dn:"))
-          {
-            final String authorizationDNString = authzIDString.substring(3);
-            schema = options.getSchemaResolver().resolveSchema(
-                authorizationDNString);
-            try
-            {
-              authorizationDN = DN.valueOf(authorizationDNString, schema);
+                            // Make sure authzId starts with "dn:" and is a
+                            // valid DN.
+                            if (lowerAuthzIDString.startsWith("dn:")) {
+                                final String authorizationDNString = authzIDString.substring(3);
+                                schema =
+                                        options.getSchemaResolver().resolveSchema(
+                                                authorizationDNString);
+                                try {
+                                    authorizationDN = DN.valueOf(authorizationDNString, schema);
+                                } catch (final LocalizedIllegalArgumentException e) {
+                                    final LocalizableMessage message =
+                                            ERR_GETEFFECTIVERIGHTS_INVALID_AUTHZIDDN
+                                                    .get(getExceptionMessage(e));
+                                    throw DecodeException.error(message, e);
+                                }
+                            } else {
+                                final LocalizableMessage message =
+                                        INFO_GETEFFECTIVERIGHTS_INVALID_AUTHZID
+                                                .get(lowerAuthzIDString);
+                                throw DecodeException.error(message);
+                            }
+
+                            // There is an sequence containing an attribute
+                            // list, try to
+                            // decode it.
+                            if (reader.hasNextElement()) {
+                                attributes = new LinkedList<AttributeType>();
+                                reader.readStartSequence();
+                                while (reader.hasNextElement()) {
+                                    // Decode as an attribute type.
+                                    final String attributeName = reader.readOctetStringAsString();
+                                    AttributeType attributeType;
+                                    try {
+                                        // FIXME: we're using the schema
+                                        // associated with the authzid
+                                        // which is not really correct. We
+                                        // should really use the schema
+                                        // associated with the entry.
+                                        attributeType = schema.getAttributeType(attributeName);
+                                    } catch (final UnknownSchemaElementException e) {
+                                        final LocalizableMessage message =
+                                                ERR_GETEFFECTIVERIGHTS_UNKNOWN_ATTRIBUTE
+                                                        .get(attributeName);
+                                        throw DecodeException.error(message, e);
+                                    }
+                                    attributes.add(attributeType);
+                                }
+                                reader.readEndSequence();
+                                attributes = Collections.unmodifiableList(attributes);
+                            }
+                            reader.readEndSequence();
+                        } catch (final IOException e) {
+                            final LocalizableMessage message =
+                                    INFO_GETEFFECTIVERIGHTS_DECODE_ERROR.get(e.getMessage());
+                            throw DecodeException.error(message);
+                        }
+                    }
+
+                    return new GetEffectiveRightsRequestControl(control.isCritical(),
+                            authorizationDN, attributes);
+
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new get effective rights request control with the provided
+     * criticality, optional authorization name and attribute list.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param authorizationName
+     *            The distinguished name of the user for which effective rights
+     *            are to be returned, or {@code null} if the client's
+     *            authentication ID is to be used.
+     * @param attributes
+     *            The list of attributes for which effective rights are to be
+     *            returned, which may be empty indicating that no attribute
+     *            rights are to be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static GetEffectiveRightsRequestControl newControl(final boolean isCritical,
+            final DN authorizationName, final Collection<AttributeType> attributes) {
+        Validator.ensureNotNull(attributes);
+
+        final Collection<AttributeType> copyOfAttributes =
+                Collections.unmodifiableList(new ArrayList<AttributeType>(attributes));
+        return new GetEffectiveRightsRequestControl(isCritical, authorizationName, copyOfAttributes);
+    }
+
+    /**
+     * Creates a new get effective rights request control with the provided
+     * criticality, optional authorization name and attribute list. The
+     * authorization name and attributes, if provided, will be decoded using the
+     * default schema.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param authorizationName
+     *            The distinguished name of the user for which effective rights
+     *            are to be returned, or {@code null} if the client's
+     *            authentication ID is to be used.
+     * @param attributes
+     *            The list of attributes for which effective rights are to be
+     *            returned, which may be empty indicating that no attribute
+     *            rights are to be returned.
+     * @return The new control.
+     * @throws UnknownSchemaElementException
+     *             If the default schema is a strict schema and one or more of
+     *             the requested attribute types were not recognized.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationName} is not a valid LDAP string
+     *             representation of a DN.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static GetEffectiveRightsRequestControl newControl(final boolean isCritical,
+            final String authorizationName, final String... attributes) {
+        Validator.ensureNotNull((Object) attributes);
+
+        final DN dn = authorizationName == null ? null : DN.valueOf(authorizationName);
+
+        List<AttributeType> copyOfAttributes;
+        if (attributes != null && attributes.length > 0) {
+            copyOfAttributes = new ArrayList<AttributeType>(attributes.length);
+            for (final String attribute : attributes) {
+                copyOfAttributes.add(Schema.getDefaultSchema().getAttributeType(attribute));
             }
-            catch (final LocalizedIllegalArgumentException e)
-            {
-              final LocalizableMessage message = ERR_GETEFFECTIVERIGHTS_INVALID_AUTHZIDDN
-                  .get(getExceptionMessage(e));
-              throw DecodeException.error(message, e);
+            copyOfAttributes = Collections.unmodifiableList(copyOfAttributes);
+        } else {
+            copyOfAttributes = Collections.emptyList();
+        }
+
+        return new GetEffectiveRightsRequestControl(isCritical, dn, copyOfAttributes);
+    }
+
+    // The DN representing the authzId (may be null meaning use the client's
+    // DN).
+    private final DN authorizationName;
+
+    // The unmodifiable list of attributes to be queried (may be empty).
+    private final Collection<AttributeType> attributes;
+
+    private final boolean isCritical;
+
+    private GetEffectiveRightsRequestControl(final boolean isCritical, final DN authorizationName,
+            final Collection<AttributeType> attributes) {
+        this.isCritical = isCritical;
+        this.authorizationName = authorizationName;
+        this.attributes = attributes;
+    }
+
+    /**
+     * Returns an unmodifiable list of attributes for which effective rights are
+     * to be returned, which may be empty indicating that no attribute rights
+     * are to be returned.
+     *
+     * @return The unmodifiable list of attributes for which effective rights
+     *         are to be returned.
+     */
+    public Collection<AttributeType> getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * Returns the distinguished name of the user for which effective rights are
+     * to be returned, or {@code null} if the client's authentication ID is to
+     * be used.
+     *
+     * @return The distinguished name of the user for which effective rights are
+     *         to be returned.
+     */
+    public DN getAuthorizationName() {
+        return authorizationName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            if (authorizationName != null) {
+                writer.writeOctetString("dn:" + authorizationName);
             }
-          }
-          else
-          {
-            final LocalizableMessage message = INFO_GETEFFECTIVERIGHTS_INVALID_AUTHZID
-                .get(lowerAuthzIDString);
-            throw DecodeException.error(message);
-          }
 
-          // There is an sequence containing an attribute list, try to
-          // decode it.
-          if (reader.hasNextElement())
-          {
-            attributes = new LinkedList<AttributeType>();
-            reader.readStartSequence();
-            while (reader.hasNextElement())
-            {
-              // Decode as an attribute type.
-              final String attributeName = reader.readOctetStringAsString();
-              AttributeType attributeType;
-              try
-              {
-                // FIXME: we're using the schema associated with the authzid
-                // which is not really correct. We should really use the schema
-                // associated with the entry.
-                attributeType = schema.getAttributeType(attributeName);
-              }
-              catch (final UnknownSchemaElementException e)
-              {
-                final LocalizableMessage message = ERR_GETEFFECTIVERIGHTS_UNKNOWN_ATTRIBUTE
-                    .get(attributeName);
-                throw DecodeException.error(message, e);
-              }
-              attributes.add(attributeType);
+            if (!attributes.isEmpty()) {
+                writer.writeStartSequence();
+                for (final AttributeType attribute : attributes) {
+                    writer.writeOctetString(attribute.getNameOrOID());
+                }
+                writer.writeEndSequence();
             }
-            reader.readEndSequence();
-            attributes = Collections.unmodifiableList(attributes);
-          }
-          reader.readEndSequence();
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-        catch (final IOException e)
-        {
-          final LocalizableMessage message = INFO_GETEFFECTIVERIGHTS_DECODE_ERROR
-              .get(e.getMessage());
-          throw DecodeException.error(message);
-        }
-      }
-
-      return new GetEffectiveRightsRequestControl(control.isCritical(),
-          authorizationDN, attributes);
-
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new get effective rights request control with the provided
-   * criticality, optional authorization name and attribute list.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param authorizationName
-   *          The distinguished name of the user for which effective rights are
-   *          to be returned, or {@code null} if the client's authentication ID
-   *          is to be used.
-   * @param attributes
-   *          The list of attributes for which effective rights are to be
-   *          returned, which may be empty indicating that no attribute rights
-   *          are to be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static GetEffectiveRightsRequestControl newControl(
-      final boolean isCritical, final DN authorizationName,
-      final Collection<AttributeType> attributes)
-  {
-    Validator.ensureNotNull(attributes);
-
-    final Collection<AttributeType> copyOfAttributes = Collections
-        .unmodifiableList(new ArrayList<AttributeType>(attributes));
-    return new GetEffectiveRightsRequestControl(isCritical, authorizationName,
-        copyOfAttributes);
-  }
-
-
-
-  /**
-   * Creates a new get effective rights request control with the provided
-   * criticality, optional authorization name and attribute list. The
-   * authorization name and attributes, if provided, will be decoded using the
-   * default schema.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param authorizationName
-   *          The distinguished name of the user for which effective rights are
-   *          to be returned, or {@code null} if the client's authentication ID
-   *          is to be used.
-   * @param attributes
-   *          The list of attributes for which effective rights are to be
-   *          returned, which may be empty indicating that no attribute rights
-   *          are to be returned.
-   * @return The new control.
-   * @throws UnknownSchemaElementException
-   *           If the default schema is a strict schema and one or more of the
-   *           requested attribute types were not recognized.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationName} is not a valid LDAP string
-   *           representation of a DN.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static GetEffectiveRightsRequestControl newControl(
-      final boolean isCritical, final String authorizationName,
-      final String... attributes)
-  {
-    Validator.ensureNotNull((Object) attributes);
-
-    final DN dn = authorizationName == null ? null : DN
-        .valueOf(authorizationName);
-
-    List<AttributeType> copyOfAttributes;
-    if (attributes != null && attributes.length > 0)
-    {
-      copyOfAttributes = new ArrayList<AttributeType>(attributes.length);
-      for (final String attribute : attributes)
-      {
-        copyOfAttributes.add(Schema.getDefaultSchema().getAttributeType(
-            attribute));
-      }
-      copyOfAttributes = Collections.unmodifiableList(copyOfAttributes);
-    }
-    else
-    {
-      copyOfAttributes = Collections.emptyList();
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return authorizationName != null || !attributes.isEmpty();
     }
 
-    return new GetEffectiveRightsRequestControl(isCritical, dn,
-        copyOfAttributes);
-  }
-
-
-
-  // The DN representing the authzId (may be null meaning use the client's DN).
-  private final DN authorizationName;
-
-  // The unmodifiable list of attributes to be queried (may be empty).
-  private final Collection<AttributeType> attributes;
-
-  private final boolean isCritical;
-
-
-
-  private GetEffectiveRightsRequestControl(final boolean isCritical,
-      final DN authorizationName, final Collection<AttributeType> attributes)
-  {
-    this.isCritical = isCritical;
-    this.authorizationName = authorizationName;
-    this.attributes = attributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list of attributes for which effective rights are
-   * to be returned, which may be empty indicating that no attribute rights are
-   * to be returned.
-   *
-   * @return The unmodifiable list of attributes for which effective rights are
-   *         to be returned.
-   */
-  public Collection<AttributeType> getAttributes()
-  {
-    return attributes;
-  }
-
-
-
-  /**
-   * Returns the distinguished name of the user for which effective rights are
-   * to be returned, or {@code null} if the client's authentication ID is to be
-   * used.
-   *
-   * @return The distinguished name of the user for which effective rights are
-   *         to be returned.
-   */
-  public DN getAuthorizationName()
-  {
-    return authorizationName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      if (authorizationName != null)
-      {
-        writer.writeOctetString("dn:" + authorizationName);
-      }
-
-      if (!attributes.isEmpty())
-      {
-        writer.writeStartSequence();
-        for (final AttributeType attribute : attributes)
-        {
-          writer.writeOctetString(attribute.getNameOrOID());
-        }
-        writer.writeEndSequence();
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GetEffectiveRightsRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", authorizationDN=\"");
+        builder.append(authorizationName);
+        builder.append("\"");
+        builder.append(", attributes=(");
+        builder.append(attributes);
+        builder.append("))");
+        return builder.toString();
     }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return authorizationName != null || !attributes.isEmpty();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GetEffectiveRightsRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", authorizationDN=\"");
-    builder.append(authorizationName);
-    builder.append("\"");
-    builder.append(", attributes=(");
-    builder.append(attributes);
-    builder.append("))");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java
index 22804bc..96c921d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_MANAGEDSAIT_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_MANAGEDSAIT_INVALID_CONTROL_VALUE;
 
@@ -38,8 +35,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The ManageDsaIT request control as defined in RFC 3296. This control allows
  * manipulation of referral and other special objects as normal objects.
@@ -53,142 +48,112 @@
  *      Subordinate References in Lightweight Directory Access Protocol (LDAP)
  *      Directories </a>
  */
-public final class ManageDsaITRequestControl implements Control
-{
-  /**
-   * The OID for the ManageDsaIT request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.2";
+public final class ManageDsaITRequestControl implements Control {
+    /**
+     * The OID for the ManageDsaIT request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.2";
 
-  private static final ManageDsaITRequestControl CRITICAL_INSTANCE = new ManageDsaITRequestControl(
-      true);
-  private static final ManageDsaITRequestControl NONCRITICAL_INSTANCE =
-    new ManageDsaITRequestControl(false);
+    private static final ManageDsaITRequestControl CRITICAL_INSTANCE =
+            new ManageDsaITRequestControl(true);
+    private static final ManageDsaITRequestControl NONCRITICAL_INSTANCE =
+            new ManageDsaITRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the Manage DsaIT request control.
-   */
-  public static final ControlDecoder<ManageDsaITRequestControl> DECODER =
-    new ControlDecoder<ManageDsaITRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the Manage DsaIT request
+     * control.
+     */
+    public static final ControlDecoder<ManageDsaITRequestControl> DECODER =
+            new ControlDecoder<ManageDsaITRequestControl>() {
 
-    public ManageDsaITRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public ManageDsaITRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof ManageDsaITRequestControl)
-      {
-        return (ManageDsaITRequestControl) control;
-      }
+                    if (control instanceof ManageDsaITRequestControl) {
+                        return (ManageDsaITRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_MANAGEDSAIT_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_MANAGEDSAIT_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_MANAGEDSAIT_INVALID_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_MANAGEDSAIT_INVALID_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new ManageDsaIT request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static ManageDsaITRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
+    private final boolean isCritical;
 
-
-    public String getOID()
-    {
-      return OID;
+    private ManageDsaITRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new ManageDsaIT request control having the provided criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static ManageDsaITRequestControl newControl(final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private final boolean isCritical;
-
-
-
-  private ManageDsaITRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ManageDsaITRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ManageDsaITRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java
index 2e85d65..b488e53 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,27 +27,32 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AbstractFilterVisitor;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Filter;
 
 import com.forgerock.opendj.ldap.LDAPUtils;
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The matched values request control as defined in RFC 3876. The matched values
  * control may be included in a search request to indicate that only attribute
@@ -81,382 +85,290 @@
  *      Matched Values with the Lightweight Directory Access Protocol version 3
  *      (LDAPv3) </a>
  */
-public final class MatchedValuesRequestControl implements Control
-{
-  /**
-   * Visitor for validating matched values filters.
-   */
-  private static final class FilterValidator extends
-      AbstractFilterVisitor<LocalizedIllegalArgumentException, Filter>
-  {
+public final class MatchedValuesRequestControl implements Control {
+    /**
+     * Visitor for validating matched values filters.
+     */
+    private static final class FilterValidator extends
+            AbstractFilterVisitor<LocalizedIllegalArgumentException, Filter> {
 
-    @Override
-    public LocalizedIllegalArgumentException visitAndFilter(final Filter p,
-        final List<Filter> subFilters)
-    {
-      final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_AND.get(p
-          .toString());
-      return new LocalizedIllegalArgumentException(message);
-    }
-
-
-
-    @Override
-    public LocalizedIllegalArgumentException visitExtensibleMatchFilter(
-        final Filter p, final String matchingRule,
-        final String attributeDescription, final ByteString assertionValue,
-        final boolean dnAttributes)
-    {
-      if (dnAttributes)
-      {
-        final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_EXT.get(p
-            .toString());
-        return new LocalizedIllegalArgumentException(message);
-      }
-      else
-      {
-        return null;
-      }
-    }
-
-
-
-    @Override
-    public LocalizedIllegalArgumentException visitNotFilter(final Filter p,
-        final Filter subFilter)
-    {
-      final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_NOT.get(p
-          .toString());
-      return new LocalizedIllegalArgumentException(message);
-    }
-
-
-
-    @Override
-    public LocalizedIllegalArgumentException visitOrFilter(final Filter p,
-        final List<Filter> subFilters)
-    {
-      final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_OR.get(p
-          .toString());
-      return new LocalizedIllegalArgumentException(message);
-    }
-
-
-
-    @Override
-    public LocalizedIllegalArgumentException visitUnrecognizedFilter(
-        final Filter p, final byte filterTag, final ByteString filterBytes)
-    {
-      final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_UNRECOGNIZED
-          .get(p.toString(), filterTag);
-      return new LocalizedIllegalArgumentException(message);
-    }
-  }
-
-
-
-  /**
-   * The OID for the matched values request control used to specify which
-   * particular attribute values should be returned in a search result entry.
-   */
-  public static final String OID = "1.2.826.0.1.3344810.2.3";
-
-  /**
-   * A decoder which can be used for decoding the matched values request
-   * control.
-   */
-  public static final ControlDecoder<MatchedValuesRequestControl> DECODER =
-    new ControlDecoder<MatchedValuesRequestControl>()
-  {
-
-    public MatchedValuesRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
-
-      if (control instanceof MatchedValuesRequestControl)
-      {
-        return (MatchedValuesRequestControl) control;
-      }
-
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_MATCHEDVALUES_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
-
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_MATCHEDVALUES_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
-
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
-        if (!reader.hasNextElement())
-        {
-          final LocalizableMessage message = ERR_MATCHEDVALUES_NO_FILTERS.get();
-          throw DecodeException.error(message);
+        @Override
+        public LocalizedIllegalArgumentException visitAndFilter(final Filter p,
+                final List<Filter> subFilters) {
+            final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_AND.get(p.toString());
+            return new LocalizedIllegalArgumentException(message);
         }
 
-        final LinkedList<Filter> filters = new LinkedList<Filter>();
-        do
-        {
-          final Filter filter = LDAPUtils.decodeFilter(reader);
-
-          try
-          {
-            validateFilter(filter);
-          }
-          catch (final LocalizedIllegalArgumentException e)
-          {
-            throw DecodeException.error(e.getMessageObject());
-          }
-
-          filters.add(filter);
+        @Override
+        public LocalizedIllegalArgumentException visitExtensibleMatchFilter(final Filter p,
+                final String matchingRule, final String attributeDescription,
+                final ByteString assertionValue, final boolean dnAttributes) {
+            if (dnAttributes) {
+                final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_EXT.get(p.toString());
+                return new LocalizedIllegalArgumentException(message);
+            } else {
+                return null;
+            }
         }
-        while (reader.hasNextElement());
 
-        reader.readEndSequence();
+        @Override
+        public LocalizedIllegalArgumentException visitNotFilter(final Filter p,
+                final Filter subFilter) {
+            final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_NOT.get(p.toString());
+            return new LocalizedIllegalArgumentException(message);
+        }
 
-        return new MatchedValuesRequestControl(control.isCritical(),
-            Collections.unmodifiableList(filters));
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("MatchedValuesControl.Decoder",
-            "decode", e);
+        @Override
+        public LocalizedIllegalArgumentException visitOrFilter(final Filter p,
+                final List<Filter> subFilters) {
+            final LocalizableMessage message = ERR_MVFILTER_BAD_FILTER_OR.get(p.toString());
+            return new LocalizedIllegalArgumentException(message);
+        }
 
-        final LocalizableMessage message = ERR_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message);
-      }
+        @Override
+        public LocalizedIllegalArgumentException visitUnrecognizedFilter(final Filter p,
+                final byte filterTag, final ByteString filterBytes) {
+            final LocalizableMessage message =
+                    ERR_MVFILTER_BAD_FILTER_UNRECOGNIZED.get(p.toString(), filterTag);
+            return new LocalizedIllegalArgumentException(message);
+        }
     }
 
+    /**
+     * The OID for the matched values request control used to specify which
+     * particular attribute values should be returned in a search result entry.
+     */
+    public static final String OID = "1.2.826.0.1.3344810.2.3";
 
+    /**
+     * A decoder which can be used for decoding the matched values request
+     * control.
+     */
+    public static final ControlDecoder<MatchedValuesRequestControl> DECODER =
+            new ControlDecoder<MatchedValuesRequestControl>() {
 
-    public String getOID()
-    {
-      return OID;
-    }
-  };
+                public MatchedValuesRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-  private static final FilterValidator FILTER_VALIDATOR = new FilterValidator();
+                    if (control instanceof MatchedValuesRequestControl) {
+                        return (MatchedValuesRequestControl) control;
+                    }
 
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_MATCHEDVALUES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_MATCHEDVALUES_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-  /**
-   * Creates a new matched values request control with the provided criticality
-   * and list of filters.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param filters
-   *          The list of filters of which at least one must match an attribute
-   *          value in order for the attribute value to be returned to the
-   *          client. The list must not be empty.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If one or more filters failed to conform to the filter
-   *           constraints defined in RFC 3876.
-   * @throws IllegalArgumentException
-   *           If {@code filters} was empty.
-   * @throws NullPointerException
-   *           If {@code filters} was {@code null}.
-   */
-  public static MatchedValuesRequestControl newControl(
-      final boolean isCritical, final Collection<Filter> filters)
-  {
-    Validator.ensureNotNull(filters);
-    Validator.ensureTrue(filters.size() > 0, "filters is empty");
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
+                        if (!reader.hasNextElement()) {
+                            final LocalizableMessage message = ERR_MATCHEDVALUES_NO_FILTERS.get();
+                            throw DecodeException.error(message);
+                        }
 
-    List<Filter> copyOfFilters;
-    if (filters.size() == 1)
-    {
-      copyOfFilters = Collections.singletonList(validateFilter(filters
-          .iterator().next()));
-    }
-    else
-    {
-      copyOfFilters = new ArrayList<Filter>(filters.size());
-      for (final Filter filter : filters)
-      {
-        copyOfFilters.add(validateFilter(filter));
-      }
-      copyOfFilters = Collections.unmodifiableList(copyOfFilters);
+                        final LinkedList<Filter> filters = new LinkedList<Filter>();
+                        do {
+                            final Filter filter = LDAPUtils.decodeFilter(reader);
+
+                            try {
+                                validateFilter(filter);
+                            } catch (final LocalizedIllegalArgumentException e) {
+                                throw DecodeException.error(e.getMessageObject());
+                            }
+
+                            filters.add(filter);
+                        } while (reader.hasNextElement());
+
+                        reader.readEndSequence();
+
+                        return new MatchedValuesRequestControl(control.isCritical(), Collections
+                                .unmodifiableList(filters));
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("MatchedValuesControl.Decoder", "decode", e);
+
+                        final LocalizableMessage message =
+                                ERR_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE
+                                        .get(getExceptionMessage(e));
+                        throw DecodeException.error(message);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    private static final FilterValidator FILTER_VALIDATOR = new FilterValidator();
+
+    /**
+     * Creates a new matched values request control with the provided
+     * criticality and list of filters.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param filters
+     *            The list of filters of which at least one must match an
+     *            attribute value in order for the attribute value to be
+     *            returned to the client. The list must not be empty.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If one or more filters failed to conform to the filter
+     *             constraints defined in RFC 3876.
+     * @throws IllegalArgumentException
+     *             If {@code filters} was empty.
+     * @throws NullPointerException
+     *             If {@code filters} was {@code null}.
+     */
+    public static MatchedValuesRequestControl newControl(final boolean isCritical,
+            final Collection<Filter> filters) {
+        Validator.ensureNotNull(filters);
+        Validator.ensureTrue(filters.size() > 0, "filters is empty");
+
+        List<Filter> copyOfFilters;
+        if (filters.size() == 1) {
+            copyOfFilters = Collections.singletonList(validateFilter(filters.iterator().next()));
+        } else {
+            copyOfFilters = new ArrayList<Filter>(filters.size());
+            for (final Filter filter : filters) {
+                copyOfFilters.add(validateFilter(filter));
+            }
+            copyOfFilters = Collections.unmodifiableList(copyOfFilters);
+        }
+
+        return new MatchedValuesRequestControl(isCritical, copyOfFilters);
     }
 
-    return new MatchedValuesRequestControl(isCritical, copyOfFilters);
-  }
+    /**
+     * Creates a new matched values request control with the provided
+     * criticality and list of filters.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param firstFilter
+     *            The first matched values filter.
+     * @param remainingFilters
+     *            The remaining matched values filter, may be {@code null} or
+     *            empty.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If one or more filters could not be parsed, or if one or more
+     *             filters failed to conform to the filter constraints defined
+     *             in RFC 3876.
+     * @throws NullPointerException
+     *             If {@code firstFilter} was {@code null}.
+     */
+    public static MatchedValuesRequestControl newControl(final boolean isCritical,
+            final String firstFilter, final String... remainingFilters) {
+        Validator.ensureNotNull(firstFilter);
 
+        List<Filter> filters;
+        if (remainingFilters == null || remainingFilters.length == 0) {
+            filters = Collections.singletonList(validateFilter(Filter.valueOf(firstFilter)));
+        } else {
+            filters = new ArrayList<Filter>(1 + remainingFilters.length);
+            filters.add(validateFilter(Filter.valueOf(firstFilter)));
+            for (final String filter : remainingFilters) {
+                filters.add(validateFilter(Filter.valueOf(filter)));
+            }
+            filters = Collections.unmodifiableList(filters);
+        }
 
-
-  /**
-   * Creates a new matched values request control with the provided criticality
-   * and list of filters.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param firstFilter
-   *          The first matched values filter.
-   * @param remainingFilters
-   *          The remaining matched values filter, may be {@code null} or empty.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If one or more filters could not be parsed, or if one or more
-   *           filters failed to conform to the filter constraints defined in
-   *           RFC 3876.
-   * @throws NullPointerException
-   *           If {@code firstFilter} was {@code null}.
-   */
-  public static MatchedValuesRequestControl newControl(
-      final boolean isCritical, final String firstFilter,
-      final String... remainingFilters)
-  {
-    Validator.ensureNotNull(firstFilter);
-
-    List<Filter> filters;
-    if (remainingFilters == null || remainingFilters.length == 0)
-    {
-      filters = Collections.singletonList(validateFilter(Filter
-          .valueOf(firstFilter)));
-    }
-    else
-    {
-      filters = new ArrayList<Filter>(1 + remainingFilters.length);
-      filters.add(validateFilter(Filter.valueOf(firstFilter)));
-      for (final String filter : remainingFilters)
-      {
-        filters.add(validateFilter(Filter.valueOf(filter)));
-      }
-      filters = Collections.unmodifiableList(filters);
+        return new MatchedValuesRequestControl(isCritical, filters);
     }
 
-    return new MatchedValuesRequestControl(isCritical, filters);
-  }
-
-
-
-  private static Filter validateFilter(final Filter filter)
-  {
-    final LocalizedIllegalArgumentException e = filter.accept(FILTER_VALIDATOR,
-        filter);
-    if (e != null)
-    {
-      throw e;
+    private static Filter validateFilter(final Filter filter) {
+        final LocalizedIllegalArgumentException e = filter.accept(FILTER_VALIDATOR, filter);
+        if (e != null) {
+            throw e;
+        }
+        return filter;
     }
-    return filter;
-  }
 
+    private final Collection<Filter> filters;
 
+    private final boolean isCritical;
 
-  private final Collection<Filter> filters;
-
-  private final boolean isCritical;
-
-
-
-  private MatchedValuesRequestControl(final boolean isCritical,
-      final Collection<Filter> filters)
-  {
-    this.isCritical = isCritical;
-    this.filters = filters;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing the list of filters
-   * associated with this matched values control.
-   *
-   * @return An unmodifiable collection containing the list of filters
-   *         associated with this matched values control.
-   */
-  public Collection<Filter> getFilters()
-  {
-    return filters;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      for (final Filter f : filters)
-      {
-        LDAPUtils.encodeFilter(writer, f);
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    private MatchedValuesRequestControl(final boolean isCritical, final Collection<Filter> filters) {
+        this.isCritical = isCritical;
+        this.filters = filters;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * Returns an unmodifiable collection containing the list of filters
+     * associated with this matched values control.
+     *
+     * @return An unmodifiable collection containing the list of filters
+     *         associated with this matched values control.
+     */
+    public Collection<Filter> getFilters() {
+        return filters;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            for (final Filter f : filters) {
+                LDAPUtils.encodeFilter(writer, f);
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("MatchedValuesRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("MatchedValuesRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java
index c37bebd..53a0a86 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRED_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRED_CONTROL_INVALID_VALUE;
 
@@ -38,8 +35,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Netscape password expired response control as defined in
  * draft-vchu-ldap-pwd-policy. This control indicates to a client that their
@@ -50,145 +45,112 @@
  *      href="http://tools.ietf.org/html/draft-vchu-ldap-pwd-policy">draft-vchu-ldap-pwd-policy
  *      - Password Policy for LDAP Directories </a>
  */
-public final class PasswordExpiredResponseControl implements Control
-{
-  /**
-   * The OID for the Netscape password expired response control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.4";
+public final class PasswordExpiredResponseControl implements Control {
+    /**
+     * The OID for the Netscape password expired response control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.4";
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final PasswordExpiredResponseControl CRITICAL_INSTANCE =
-    new PasswordExpiredResponseControl(true);
-  private static final PasswordExpiredResponseControl NONCRITICAL_INSTANCE =
-    new PasswordExpiredResponseControl(false);
+    private static final PasswordExpiredResponseControl CRITICAL_INSTANCE =
+            new PasswordExpiredResponseControl(true);
+    private static final PasswordExpiredResponseControl NONCRITICAL_INSTANCE =
+            new PasswordExpiredResponseControl(false);
 
-  /**
-   * A decoder which can be used for decoding the password expired response
-   * control.
-   */
-  public static final ControlDecoder<PasswordExpiredResponseControl> DECODER =
-    new ControlDecoder<PasswordExpiredResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the password expired response
+     * control.
+     */
+    public static final ControlDecoder<PasswordExpiredResponseControl> DECODER =
+            new ControlDecoder<PasswordExpiredResponseControl>() {
 
-    public PasswordExpiredResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PasswordExpiredResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PasswordExpiredResponseControl)
-      {
-        return (PasswordExpiredResponseControl) control;
-      }
+                    if (control instanceof PasswordExpiredResponseControl) {
+                        return (PasswordExpiredResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PWEXPIRED_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PWEXPIRED_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        try
-        {
-          Integer.parseInt(control.getValue().toString());
-        }
-        catch (final Exception e)
-        {
-          final LocalizableMessage message = ERR_PWEXPIRED_CONTROL_INVALID_VALUE
-              .get();
-          throw DecodeException.error(message);
-        }
-      }
+                    if (control.hasValue()) {
+                        try {
+                            Integer.parseInt(control.getValue().toString());
+                        } catch (final Exception e) {
+                            final LocalizableMessage message =
+                                    ERR_PWEXPIRED_CONTROL_INVALID_VALUE.get();
+                            throw DecodeException.error(message);
+                        }
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    private final static ByteString CONTROL_VALUE = ByteString.valueOf("0");
+
+    /**
+     * Creates a new Netscape password expired response control.
+     *
+     * @return The new control.
+     */
+    public static PasswordExpiredResponseControl newControl() {
+        return NONCRITICAL_INSTANCE;
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    private PasswordExpiredResponseControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
-  private final static ByteString CONTROL_VALUE = ByteString.valueOf("0");
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return CONTROL_VALUE;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
-  /**
-   * Creates a new Netscape password expired response control.
-   *
-   * @return The new control.
-   */
-  public static PasswordExpiredResponseControl newControl()
-  {
-    return NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-
-  private PasswordExpiredResponseControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return CONTROL_VALUE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordExpiredResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordExpiredResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
index 7c56be4..0efaebf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,10 +25,10 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CONTROL_BAD_OID;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_NO_CONTROL_VALUE;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,8 +38,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Netscape password expiring response control as defined in
  * draft-vchu-ldap-pwd-policy. This control serves as a warning to clients that
@@ -52,173 +49,136 @@
  *      href="http://tools.ietf.org/html/draft-vchu-ldap-pwd-policy">draft-vchu-ldap-pwd-policy
  *      - Password Policy for LDAP Directories </a>
  */
-public final class PasswordExpiringResponseControl implements Control
-{
-  /**
-   * The OID for the Netscape password expiring response control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.5";
+public final class PasswordExpiringResponseControl implements Control {
+    /**
+     * The OID for the Netscape password expiring response control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.5";
 
-  /**
-   * A decoder which can be used for decoding the password expiring response
-   * control.
-   */
-  public static final ControlDecoder<PasswordExpiringResponseControl> DECODER =
-    new ControlDecoder<PasswordExpiringResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the password expiring response
+     * control.
+     */
+    public static final ControlDecoder<PasswordExpiringResponseControl> DECODER =
+            new ControlDecoder<PasswordExpiringResponseControl>() {
 
-    public PasswordExpiringResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PasswordExpiringResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PasswordExpiringResponseControl)
-      {
-        return (PasswordExpiringResponseControl) control;
-      }
+                    if (control instanceof PasswordExpiringResponseControl) {
+                        return (PasswordExpiringResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PWEXPIRING_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PWEXPIRING_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        final LocalizableMessage message = ERR_PWEXPIRING_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        final LocalizableMessage message = ERR_PWEXPIRING_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      int secondsUntilExpiration;
-      try
-      {
-        secondsUntilExpiration = Integer
-            .parseInt(control.getValue().toString());
-      }
-      catch (final Exception e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PasswordExpiringControl.Decoder",
-            "decode", e);
+                    int secondsUntilExpiration;
+                    try {
+                        secondsUntilExpiration = Integer.parseInt(control.getValue().toString());
+                    } catch (final Exception e) {
+                        StaticUtils.DEBUG_LOG.throwing("PasswordExpiringControl.Decoder", "decode",
+                                e);
 
-        final LocalizableMessage message = ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message);
-      }
+                        final LocalizableMessage message =
+                                ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION
+                                        .get(getExceptionMessage(e));
+                        throw DecodeException.error(message);
+                    }
 
-      return new PasswordExpiringResponseControl(control.isCritical(),
-          secondsUntilExpiration);
+                    return new PasswordExpiringResponseControl(control.isCritical(),
+                            secondsUntilExpiration);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new Netscape password expiring response control with the
+     * provided amount of time until expiration.
+     *
+     * @param secondsUntilExpiration
+     *            The length of time in seconds until the password actually
+     *            expires.
+     * @return The new control.
+     */
+    public static PasswordExpiringResponseControl newControl(final int secondsUntilExpiration) {
+        return new PasswordExpiringResponseControl(false, secondsUntilExpiration);
     }
 
+    // The length of time in seconds until the password actually expires.
+    private final int secondsUntilExpiration;
 
+    private final boolean isCritical;
 
-    public String getOID()
-    {
-      return OID;
+    private PasswordExpiringResponseControl(final boolean isCritical,
+            final int secondsUntilExpiration) {
+        this.isCritical = isCritical;
+        this.secondsUntilExpiration = secondsUntilExpiration;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * Returns the length of time in seconds until the password actually
+     * expires.
+     *
+     * @return The length of time in seconds until the password actually
+     *         expires.
+     */
+    public int getSecondsUntilExpiration() {
+        return secondsUntilExpiration;
+    }
 
-  /**
-   * Creates a new Netscape password expiring response control with the provided
-   * amount of time until expiration.
-   *
-   * @param secondsUntilExpiration
-   *          The length of time in seconds until the password actually expires.
-   * @return The new control.
-   */
-  public static PasswordExpiringResponseControl newControl(
-      final int secondsUntilExpiration)
-  {
-    return new PasswordExpiringResponseControl(false, secondsUntilExpiration);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return ByteString.valueOf(String.valueOf(secondsUntilExpiration));
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  // The length of time in seconds until the password actually expires.
-  private final int secondsUntilExpiration;
-
-  private final boolean isCritical;
-
-
-
-  private PasswordExpiringResponseControl(final boolean isCritical,
-      final int secondsUntilExpiration)
-  {
-    this.isCritical = isCritical;
-    this.secondsUntilExpiration = secondsUntilExpiration;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns the length of time in seconds until the password actually expires.
-   *
-   * @return The length of time in seconds until the password actually expires.
-   */
-  public int getSecondsUntilExpiration()
-  {
-    return secondsUntilExpiration;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return ByteString.valueOf(String.valueOf(secondsUntilExpiration));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordExpiringResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", secondsUntilExpiration=");
-    builder.append(secondsUntilExpiration);
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordExpiringResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", secondsUntilExpiration=");
+        builder.append(secondsUntilExpiration);
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java
index 75ed015..b31a9c2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 /**
  * A password policy error type as defined in draft-behera-ldap-password-policy
  * is used to indicate problems concerning a user's account or password.
@@ -39,91 +36,81 @@
  *      draft-behera-ldap-password-policy - Password Policy for LDAP Directories
  *      </a>
  */
-public enum PasswordPolicyErrorType
-{
+public enum PasswordPolicyErrorType {
 
-  /**
-   * Indicates that the password has expired and must be reset.
-   */
-  PASSWORD_EXPIRED(0, "passwordExpired"),
+    /**
+     * Indicates that the password has expired and must be reset.
+     */
+    PASSWORD_EXPIRED(0, "passwordExpired"),
 
-  /**
-   * Indicates that the user's account has been locked.
-   */
-  ACCOUNT_LOCKED(1, "accountLocked"),
+    /**
+     * Indicates that the user's account has been locked.
+     */
+    ACCOUNT_LOCKED(1, "accountLocked"),
 
-  /**
-   * Indicates that the password must be changed before the user will be allowed
-   * to perform any operation other than bind and modify.
-   */
-  CHANGE_AFTER_RESET(2, "changeAfterReset"),
+    /**
+     * Indicates that the password must be changed before the user will be
+     * allowed to perform any operation other than bind and modify.
+     */
+    CHANGE_AFTER_RESET(2, "changeAfterReset"),
 
-  /**
-   * Indicates that a user is restricted from changing her password.
-   */
-  PASSWORD_MOD_NOT_ALLOWED(3, "passwordModNotAllowed"),
+    /**
+     * Indicates that a user is restricted from changing her password.
+     */
+    PASSWORD_MOD_NOT_ALLOWED(3, "passwordModNotAllowed"),
 
-  /**
-   * Indicates that the old password must be supplied in order to modify the
-   * password.
-   */
-  MUST_SUPPLY_OLD_PASSWORD(4, "mustSupplyOldPassword"),
+    /**
+     * Indicates that the old password must be supplied in order to modify the
+     * password.
+     */
+    MUST_SUPPLY_OLD_PASSWORD(4, "mustSupplyOldPassword"),
 
-  /**
-   * Indicates that a password doesn't pass quality checking.
-   */
-  INSUFFICIENT_PASSWORD_QUALITY(5, "insufficientPasswordQuality"),
+    /**
+     * Indicates that a password doesn't pass quality checking.
+     */
+    INSUFFICIENT_PASSWORD_QUALITY(5, "insufficientPasswordQuality"),
 
-  /**
-   * Indicates that a password is not long enough.
-   */
-  PASSWORD_TOO_SHORT(6, "passwordTooShort"),
+    /**
+     * Indicates that a password is not long enough.
+     */
+    PASSWORD_TOO_SHORT(6, "passwordTooShort"),
 
-  /**
-   * Indicates that the age of the password to be modified is not yet old
-   * enough.
-   */
-  PASSWORD_TOO_YOUNG(7, "passwordTooYoung"),
+    /**
+     * Indicates that the age of the password to be modified is not yet old
+     * enough.
+     */
+    PASSWORD_TOO_YOUNG(7, "passwordTooYoung"),
 
-  /**
-   * Indicates that a password has already been used and the user must choose a
-   * different one.
-   */
-  PASSWORD_IN_HISTORY(8, "passwordInHistory");
+    /**
+     * Indicates that a password has already been used and the user must choose
+     * a different one.
+     */
+    PASSWORD_IN_HISTORY(8, "passwordInHistory");
 
-  private final int intValue;
+    private final int intValue;
 
-  private final String name;
+    private final String name;
 
+    private PasswordPolicyErrorType(final int intValue, final String name) {
+        this.intValue = intValue;
+        this.name = name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 
-  private PasswordPolicyErrorType(final int intValue, final String name)
-  {
-    this.intValue = intValue;
-    this.name = name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * Returns the integer value for this password policy error type.
-   *
-   * @return The integer value for this password policy error type.
-   */
-  int intValue()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value for this password policy error type.
+     *
+     * @return The integer value for this password policy error type.
+     */
+    int intValue() {
+        return intValue;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java
index b371196..19655de 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWPOLICYREQ_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PWPOLICYREQ_CONTROL_HAS_VALUE;
 
@@ -38,8 +35,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The password policy request control as defined in
  * draft-behera-ldap-password-policy.
@@ -51,145 +46,115 @@
  *
  * @see PasswordPolicyResponseControl
  * @see <a href="http://tools.ietf.org/html/draft-behera-ldap-password-policy">
- *         draft-behera-ldap-password-policy - Password Policy for LDAP Directories </a>
+ *      draft-behera-ldap-password-policy - Password Policy for LDAP Directories
+ *      </a>
  */
-public final class PasswordPolicyRequestControl implements Control
-{
-  /**
-   * The OID for the password policy control from
-   * draft-behera-ldap-password-policy.
-   */
-  public static final String OID = "1.3.6.1.4.1.42.2.27.8.5.1";
+public final class PasswordPolicyRequestControl implements Control {
+    /**
+     * The OID for the password policy control from
+     * draft-behera-ldap-password-policy.
+     */
+    public static final String OID = "1.3.6.1.4.1.42.2.27.8.5.1";
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final PasswordPolicyRequestControl CRITICAL_INSTANCE =
-    new PasswordPolicyRequestControl(true);
-  private static final PasswordPolicyRequestControl NONCRITICAL_INSTANCE =
-    new PasswordPolicyRequestControl(false);
+    private static final PasswordPolicyRequestControl CRITICAL_INSTANCE =
+            new PasswordPolicyRequestControl(true);
+    private static final PasswordPolicyRequestControl NONCRITICAL_INSTANCE =
+            new PasswordPolicyRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the password policy request
-   * control.
-   */
-  public static final ControlDecoder<PasswordPolicyRequestControl> DECODER =
-    new ControlDecoder<PasswordPolicyRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the password policy request
+     * control.
+     */
+    public static final ControlDecoder<PasswordPolicyRequestControl> DECODER =
+            new ControlDecoder<PasswordPolicyRequestControl>() {
 
-    public PasswordPolicyRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PasswordPolicyRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PasswordPolicyRequestControl)
-      {
-        return (PasswordPolicyRequestControl) control;
-      }
+                    if (control instanceof PasswordPolicyRequestControl) {
+                        return (PasswordPolicyRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PWPOLICYREQ_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PWPOLICYREQ_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_PWPOLICYREQ_CONTROL_HAS_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message = ERR_PWPOLICYREQ_CONTROL_HAS_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new password policy request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static PasswordPolicyRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    private PasswordPolicyRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new password policy request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static PasswordPolicyRequestControl newControl(final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private PasswordPolicyRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordPolicyRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordPolicyRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
index 1c6c23c..5e6baec 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.byteToHex;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
@@ -47,8 +44,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The password policy response control as defined in
  * draft-behera-ldap-password-policy.
@@ -64,358 +59,289 @@
  * @see PasswordPolicyWarningType
  * @see PasswordPolicyErrorType
  * @see <a href="http://tools.ietf.org/html/draft-behera-ldap-password-policy">
- *         draft-behera-ldap-password-policy - Password Policy for LDAP
- *         Directories </a>
+ *      draft-behera-ldap-password-policy - Password Policy for LDAP Directories
+ *      </a>
  */
-public final class PasswordPolicyResponseControl implements Control
-{
-  /**
-   * The OID for the password policy control from
-   * draft-behera-ldap-password-policy.
-   */
-  public static final String OID = PasswordPolicyRequestControl.OID;
+public final class PasswordPolicyResponseControl implements Control {
+    /**
+     * The OID for the password policy control from
+     * draft-behera-ldap-password-policy.
+     */
+    public static final String OID = PasswordPolicyRequestControl.OID;
 
-  private final int warningValue;
+    private final int warningValue;
 
-  private final PasswordPolicyErrorType errorType;
+    private final PasswordPolicyErrorType errorType;
 
-  private final PasswordPolicyWarningType warningType;
+    private final PasswordPolicyWarningType warningType;
 
-  /**
-   * A decoder which can be used for decoding the password policy response
-   * control.
-   */
-  public static final ControlDecoder<PasswordPolicyResponseControl> DECODER =
-    new ControlDecoder<PasswordPolicyResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the password policy response
+     * control.
+     */
+    public static final ControlDecoder<PasswordPolicyResponseControl> DECODER =
+            new ControlDecoder<PasswordPolicyResponseControl>() {
 
-    public PasswordPolicyResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PasswordPolicyResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PasswordPolicyResponseControl)
-      {
-        return (PasswordPolicyResponseControl) control;
-      }
+                    if (control instanceof PasswordPolicyResponseControl) {
+                        return (PasswordPolicyResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PWPOLICYRES_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PWPOLICYRES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_PWPOLICYRES_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_PWPOLICYRES_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        PasswordPolicyWarningType warningType = null;
-        PasswordPolicyErrorType errorType = null;
-        int warningValue = -1;
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        PasswordPolicyWarningType warningType = null;
+                        PasswordPolicyErrorType errorType = null;
+                        int warningValue = -1;
 
-        reader.readStartSequence();
+                        reader.readStartSequence();
 
-        if (reader.hasNextElement()
-            && (reader.peekType() == TYPE_WARNING_ELEMENT))
-        {
-          // Its a CHOICE element. Read as sequence to retrieve
-          // nested element.
-          reader.readStartSequence();
-          final int warningChoiceValue = (0x7F & reader.peekType());
-          if (warningChoiceValue < 0
-              || warningChoiceValue >= PasswordPolicyWarningType.values().length)
-          {
-            final LocalizableMessage message = ERR_PWPOLICYRES_INVALID_WARNING_TYPE
-                .get(byteToHex(reader.peekType()));
-            throw DecodeException.error(message);
-          }
-          else
-          {
-            warningType = PasswordPolicyWarningType.values()[warningChoiceValue];
-          }
-          warningValue = (int) reader.readInteger();
-          reader.readEndSequence();
+                        if (reader.hasNextElement() && (reader.peekType() == TYPE_WARNING_ELEMENT)) {
+                            // Its a CHOICE element. Read as sequence to
+                            // retrieve
+                            // nested element.
+                            reader.readStartSequence();
+                            final int warningChoiceValue = (0x7F & reader.peekType());
+                            if (warningChoiceValue < 0
+                                    || warningChoiceValue >= PasswordPolicyWarningType.values().length) {
+                                final LocalizableMessage message =
+                                        ERR_PWPOLICYRES_INVALID_WARNING_TYPE.get(byteToHex(reader
+                                                .peekType()));
+                                throw DecodeException.error(message);
+                            } else {
+                                warningType =
+                                        PasswordPolicyWarningType.values()[warningChoiceValue];
+                            }
+                            warningValue = (int) reader.readInteger();
+                            reader.readEndSequence();
+                        }
+
+                        if (reader.hasNextElement() && (reader.peekType() == TYPE_ERROR_ELEMENT)) {
+                            final int errorValue = reader.readEnumerated();
+                            if (errorValue < 0
+                                    || errorValue >= PasswordPolicyErrorType.values().length) {
+                                final LocalizableMessage message =
+                                        ERR_PWPOLICYRES_INVALID_ERROR_TYPE.get(errorValue);
+                                throw DecodeException.error(message);
+                            } else {
+                                errorType = PasswordPolicyErrorType.values()[errorValue];
+                            }
+                        }
+
+                        reader.readEndSequence();
+
+                        return new PasswordPolicyResponseControl(control.isCritical(), warningType,
+                                warningValue, errorType);
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("PasswordPolicyControl.ResponseDecoder",
+                                "decode", e);
+
+                        final LocalizableMessage message =
+                                ERR_PWPOLICYRES_DECODE_ERROR.get(getExceptionMessage(e));
+                        throw DecodeException.error(message);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new password policy response control with the provided error.
+     *
+     * @param errorType
+     *            The password policy error type.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code errorType} was {@code null}.
+     */
+    public static PasswordPolicyResponseControl newControl(final PasswordPolicyErrorType errorType) {
+        Validator.ensureNotNull(errorType);
+
+        return new PasswordPolicyResponseControl(false, null, -1, errorType);
+    }
+
+    /**
+     * Creates a new password policy response control with the provided warning.
+     *
+     * @param warningType
+     *            The password policy warning type.
+     * @param warningValue
+     *            The password policy warning value.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code warningValue} was negative.
+     * @throws NullPointerException
+     *             If {@code warningType} was {@code null}.
+     */
+    public static PasswordPolicyResponseControl newControl(
+            final PasswordPolicyWarningType warningType, final int warningValue) {
+        Validator.ensureNotNull(warningType);
+        Validator.ensureTrue(warningValue >= 0, "warningValue is negative");
+
+        return new PasswordPolicyResponseControl(false, warningType, warningValue, null);
+    }
+
+    /**
+     * Creates a new password policy response control with the provided warning
+     * and error.
+     *
+     * @param warningType
+     *            The password policy warning type.
+     * @param warningValue
+     *            The password policy warning value.
+     * @param errorType
+     *            The password policy error type.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code warningValue} was negative.
+     * @throws NullPointerException
+     *             If {@code warningType} or {@code errorType} was {@code null}.
+     */
+    public static PasswordPolicyResponseControl newControl(
+            final PasswordPolicyWarningType warningType, final int warningValue,
+            final PasswordPolicyErrorType errorType) {
+        Validator.ensureNotNull(warningType, errorType);
+        Validator.ensureTrue(warningValue >= 0, "warningValue is negative");
+
+        return new PasswordPolicyResponseControl(false, warningType, warningValue, errorType);
+    }
+
+    private final boolean isCritical;
+
+    /**
+     * The BER type value for the warning element of the control value.
+     */
+    private static final byte TYPE_WARNING_ELEMENT = (byte) 0xA0;
+
+    /**
+     * The BER type value for the error element of the control value.
+     */
+    private static final byte TYPE_ERROR_ELEMENT = (byte) 0x81;
+
+    private PasswordPolicyResponseControl(final boolean isCritical,
+            final PasswordPolicyWarningType warningType, final int warningValue,
+            final PasswordPolicyErrorType errorType) {
+        this.isCritical = isCritical;
+        this.warningType = warningType;
+        this.warningValue = warningValue;
+        this.errorType = errorType;
+    }
+
+    /**
+     * Returns the password policy error type, if available.
+     *
+     * @return The password policy error type, or {@code null} if this control
+     *         does not contain a error.
+     */
+    public PasswordPolicyErrorType getErrorType() {
+        return errorType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            if (warningType != null) {
+                // Just write the CHOICE element as a single element SEQUENCE.
+                writer.writeStartSequence(TYPE_WARNING_ELEMENT);
+                writer.writeInteger((byte) (0x80 | warningType.intValue()), warningValue);
+                writer.writeEndSequence();
+            }
+
+            if (errorType != null) {
+                writer.writeInteger(TYPE_ERROR_ELEMENT, errorType.intValue());
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
+    }
 
-        if (reader.hasNextElement()
-            && (reader.peekType() == TYPE_ERROR_ELEMENT))
-        {
-          final int errorValue = reader.readEnumerated();
-          if (errorValue < 0
-              || errorValue >= PasswordPolicyErrorType.values().length)
-          {
-            final LocalizableMessage message = ERR_PWPOLICYRES_INVALID_ERROR_TYPE
-                .get(errorValue);
-            throw DecodeException.error(message);
-          }
-          else
-          {
-            errorType = PasswordPolicyErrorType.values()[errorValue];
-          }
+    /**
+     * Returns the password policy warning type, if available.
+     *
+     * @return The password policy warning type, or {@code null} if this control
+     *         does not contain a warning.
+     */
+    public PasswordPolicyWarningType getWarningType() {
+        return warningType;
+    }
+
+    /**
+     * Returns the password policy warning value, if available. The value is
+     * undefined if this control does not contain a warning.
+     *
+     * @return The password policy warning value, or {@code -1} if this control
+     *         does not contain a warning.
+     */
+    public int getWarningValue() {
+        return warningValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordPolicyResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        if (warningType != null) {
+            builder.append(", warningType=");
+            builder.append(warningType);
+            builder.append(", warningValue=");
+            builder.append(warningValue);
         }
-
-        reader.readEndSequence();
-
-        return new PasswordPolicyResponseControl(control.isCritical(),
-            warningType, warningValue, errorType);
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PasswordPolicyControl.ResponseDecoder",
-            "decode", e);
-
-        final LocalizableMessage message = ERR_PWPOLICYRES_DECODE_ERROR
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message);
-      }
+        if (errorType != null) {
+            builder.append(", errorType=");
+            builder.append(errorType);
+        }
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new password policy response control with the provided error.
-   *
-   * @param errorType
-   *          The password policy error type.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code errorType} was {@code null}.
-   */
-  public static PasswordPolicyResponseControl newControl(
-      final PasswordPolicyErrorType errorType)
-  {
-    Validator.ensureNotNull(errorType);
-
-    return new PasswordPolicyResponseControl(false, null, -1, errorType);
-  }
-
-
-
-  /**
-   * Creates a new password policy response control with the provided warning.
-   *
-   * @param warningType
-   *          The password policy warning type.
-   * @param warningValue
-   *          The password policy warning value.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code warningValue} was negative.
-   * @throws NullPointerException
-   *           If {@code warningType} was {@code null}.
-   */
-  public static PasswordPolicyResponseControl newControl(
-      final PasswordPolicyWarningType warningType, final int warningValue)
-  {
-    Validator.ensureNotNull(warningType);
-    Validator.ensureTrue(warningValue >= 0, "warningValue is negative");
-
-    return new PasswordPolicyResponseControl(false, warningType, warningValue,
-        null);
-  }
-
-
-
-  /**
-   * Creates a new password policy response control with the provided warning
-   * and error.
-   *
-   * @param warningType
-   *          The password policy warning type.
-   * @param warningValue
-   *          The password policy warning value.
-   * @param errorType
-   *          The password policy error type.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code warningValue} was negative.
-   * @throws NullPointerException
-   *           If {@code warningType} or {@code errorType} was {@code null}.
-   */
-  public static PasswordPolicyResponseControl newControl(
-      final PasswordPolicyWarningType warningType, final int warningValue,
-      final PasswordPolicyErrorType errorType)
-  {
-    Validator.ensureNotNull(warningType, errorType);
-    Validator.ensureTrue(warningValue >= 0, "warningValue is negative");
-
-    return new PasswordPolicyResponseControl(false, warningType, warningValue,
-        errorType);
-  }
-
-
-
-  private final boolean isCritical;
-
-  /**
-   * The BER type value for the warning element of the control value.
-   */
-  private static final byte TYPE_WARNING_ELEMENT = (byte) 0xA0;
-
-  /**
-   * The BER type value for the error element of the control value.
-   */
-  private static final byte TYPE_ERROR_ELEMENT = (byte) 0x81;
-
-
-
-  private PasswordPolicyResponseControl(final boolean isCritical,
-      final PasswordPolicyWarningType warningType, final int warningValue,
-      final PasswordPolicyErrorType errorType)
-  {
-    this.isCritical = isCritical;
-    this.warningType = warningType;
-    this.warningValue = warningValue;
-    this.errorType = errorType;
-  }
-
-
-
-  /**
-   * Returns the password policy error type, if available.
-   *
-   * @return The password policy error type, or {@code null} if this control
-   *         does not contain a error.
-   */
-  public PasswordPolicyErrorType getErrorType()
-  {
-    return errorType;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      if (warningType != null)
-      {
-        // Just write the CHOICE element as a single element SEQUENCE.
-        writer.writeStartSequence(TYPE_WARNING_ELEMENT);
-        writer.writeInteger((byte) (0x80 | warningType.intValue()),
-            warningValue);
-        writer.writeEndSequence();
-      }
-
-      if (errorType != null)
-      {
-        writer.writeInteger(TYPE_ERROR_ELEMENT, errorType.intValue());
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * Returns the password policy warning type, if available.
-   *
-   * @return The password policy warning type, or {@code null} if this control
-   *         does not contain a warning.
-   */
-  public PasswordPolicyWarningType getWarningType()
-  {
-    return warningType;
-  }
-
-
-
-  /**
-   * Returns the password policy warning value, if available. The value is
-   * undefined if this control does not contain a warning.
-   *
-   * @return The password policy warning value, or {@code -1} if this control
-   *         does not contain a warning.
-   */
-  public int getWarningValue()
-  {
-    return warningValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordPolicyResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    if (warningType != null)
-    {
-      builder.append(", warningType=");
-      builder.append(warningType);
-      builder.append(", warningValue=");
-      builder.append(warningValue);
-    }
-    if (errorType != null)
-    {
-      builder.append(", errorType=");
-      builder.append(errorType);
-    }
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java
index b643408..f499247 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 /**
  * A password policy warning type as defined in
  * draft-behera-ldap-password-policy is used to indicate the current state of a
@@ -39,54 +36,44 @@
  * @see PasswordPolicyResponseControl
  * @see PasswordPolicyErrorType
  * @see <a href="http://tools.ietf.org/html/draft-behera-ldap-password-policy">
- *         draft-behera-ldap-password-policy - Password Policy for LDAP
- *         Directories </a>
+ *      draft-behera-ldap-password-policy - Password Policy for LDAP Directories
+ *      </a>
  */
-public enum PasswordPolicyWarningType
-{
-  /**
-   * Indicates the number of seconds before a password will expire.
-   */
-  TIME_BEFORE_EXPIRATION(0, "timeBeforeExpiration"),
+public enum PasswordPolicyWarningType {
+    /**
+     * Indicates the number of seconds before a password will expire.
+     */
+    TIME_BEFORE_EXPIRATION(0, "timeBeforeExpiration"),
 
-  /**
-   * Indicates the remaining number of times a user will be allowed to
-   * authenticate with an expired password.
-   */
-  GRACE_LOGINS_REMAINING(1, "graceAuthNsRemaining");
+    /**
+     * Indicates the remaining number of times a user will be allowed to
+     * authenticate with an expired password.
+     */
+    GRACE_LOGINS_REMAINING(1, "graceAuthNsRemaining");
 
-  private final int intValue;
+    private final int intValue;
 
-  private final String name;
+    private final String name;
 
+    private PasswordPolicyWarningType(final int intValue, final String name) {
+        this.intValue = intValue;
+        this.name = name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 
-  private PasswordPolicyWarningType(final int intValue, final String name)
-  {
-    this.intValue = intValue;
-    this.name = name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * Returns the integer value for this password policy warning type.
-   *
-   * @return The integer value for this password policy warning type.
-   */
-  int intValue()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value for this password policy warning type.
+     *
+     * @return The integer value for this password policy warning type.
+     */
+    int intValue() {
+        return intValue;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java
index 38c5aeb..777cca6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,18 +25,16 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PERMISSIVE_MODIFY_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PERMISSIVE_MODIFY_INVALID_CONTROL_VALUE;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The Microsoft defined permissive modify request control. The OID for this
  * control is 1.2.840.113556.1.4.1413, and it does not have a value.
@@ -46,10 +43,12 @@
  * behavior of the modify operation as follows:
  * <ul>
  * <li>Attempts to add an attribute value which already exists will be ignored
- * and will not cause an {@link ResultCode#ATTRIBUTE_OR_VALUE_EXISTS
+ * and will not cause an
+ * {@link org.forgerock.opendj.ldap.ResultCode#ATTRIBUTE_OR_VALUE_EXISTS
  * AttributeValueExists} error result to be returned.
  * <li>Attempts to delete an attribute value which does not exist will be
- * ignored and will not cause an {@link ResultCode#NO_SUCH_ATTRIBUTE
+ * ignored and will not cause an
+ * {@link org.forgerock.opendj.ldap.ResultCode#NO_SUCH_ATTRIBUTE
  * NoSuchAttribute} error result to be returned.
  * </ul>
  * In other words, a modify request {@code add} modification <i>ensures</i> that
@@ -57,146 +56,113 @@
  * modification <i>ensures</i> that the attribute does not contain the specified
  * attribute value.
  */
-public final class PermissiveModifyRequestControl implements Control
-{
-  /**
-   * The OID for the permissive modify request control.
-   */
-  public static final String OID = "1.2.840.113556.1.4.1413";
+public final class PermissiveModifyRequestControl implements Control {
+    /**
+     * The OID for the permissive modify request control.
+     */
+    public static final String OID = "1.2.840.113556.1.4.1413";
 
-  private static final PermissiveModifyRequestControl CRITICAL_INSTANCE =
-    new PermissiveModifyRequestControl(true);
+    private static final PermissiveModifyRequestControl CRITICAL_INSTANCE =
+            new PermissiveModifyRequestControl(true);
 
-  private static final PermissiveModifyRequestControl NONCRITICAL_INSTANCE =
-    new PermissiveModifyRequestControl(false);
+    private static final PermissiveModifyRequestControl NONCRITICAL_INSTANCE =
+            new PermissiveModifyRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the permissive modify request
-   * control.
-   */
-  public static final ControlDecoder<PermissiveModifyRequestControl> DECODER =
-    new ControlDecoder<PermissiveModifyRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the permissive modify request
+     * control.
+     */
+    public static final ControlDecoder<PermissiveModifyRequestControl> DECODER =
+            new ControlDecoder<PermissiveModifyRequestControl>() {
 
-    public PermissiveModifyRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PermissiveModifyRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PermissiveModifyRequestControl)
-      {
-        return (PermissiveModifyRequestControl) control;
-      }
+                    if (control instanceof PermissiveModifyRequestControl) {
+                        return (PermissiveModifyRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PERMISSIVE_MODIFY_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PERMISSIVE_MODIFY_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_PERMISSIVE_MODIFY_INVALID_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_PERMISSIVE_MODIFY_INVALID_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new permissive modify request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static PermissiveModifyRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
+    private final boolean isCritical;
 
-
-    public String getOID()
-    {
-      return OID;
+    private PermissiveModifyRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new permissive modify request control having the provided
-   * criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static PermissiveModifyRequestControl newControl(
-      final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private final boolean isCritical;
-
-
-
-  private PermissiveModifyRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PermissiveModifyRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PermissiveModifyRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java
index 56b587b..287d79c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 /**
  * A persistent search change type as defined in draft-ietf-ldapext-psearch is
  * used to indicate the type of update operation that caused an entry change
@@ -39,61 +36,53 @@
  *      href="http://tools.ietf.org/html/draft-ietf-ldapext-psearch">draft-ietf-ldapext-psearch
  *      - Persistent Search: A Simple LDAP Change Notification Mechanism </a>
  */
-public enum PersistentSearchChangeType
-{
-  /**
-   * Indicates that an Add operation triggered the entry change notification.
-   */
-  ADD(1, "add"),
+public enum PersistentSearchChangeType {
+    /**
+     * Indicates that an Add operation triggered the entry change notification.
+     */
+    ADD(1, "add"),
 
-  /**
-   * Indicates that an Delete operation triggered the entry change notification.
-   */
-  DELETE(2, "delete"),
+    /**
+     * Indicates that an Delete operation triggered the entry change
+     * notification.
+     */
+    DELETE(2, "delete"),
 
-  /**
-   * Indicates that an Modify operation triggered the entry change notification.
-   */
-  MODIFY(4, "modify"),
+    /**
+     * Indicates that an Modify operation triggered the entry change
+     * notification.
+     */
+    MODIFY(4, "modify"),
 
-  /**
-   * Indicates that an Modify DN operation triggered the entry change
-   * notification.
-   */
-  MODIFY_DN(8, "modifyDN");
+    /**
+     * Indicates that an Modify DN operation triggered the entry change
+     * notification.
+     */
+    MODIFY_DN(8, "modifyDN");
 
-  private final String name;
+    private final String name;
 
-  private final int intValue;
+    private final int intValue;
 
+    private PersistentSearchChangeType(final int intValue, final String name) {
+        this.name = name;
+        this.intValue = intValue;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return name;
+    }
 
-  private PersistentSearchChangeType(final int intValue, final String name)
-  {
-    this.name = name;
-    this.intValue = intValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * Returns the integer value for this change type.
-   *
-   * @return The integer value for this change type.
-   */
-  int intValue()
-  {
-    return intValue;
-  }
+    /**
+     * Returns the integer value for this change type.
+     *
+     * @return The integer value for this change type.
+     */
+    int intValue() {
+        return intValue;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java
index 2e4fa54..4ce9171 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_BAD_CHANGE_TYPES;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_CANNOT_DECODE_VALUE;
@@ -36,7 +33,11 @@
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_NO_CONTROL_VALUE;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.asn1.ASN1;
@@ -50,8 +51,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The persistent search request control as defined in
  * draft-ietf-ldapext-psearch. This control allows a client to receive
@@ -63,355 +62,296 @@
  *      href="http://tools.ietf.org/html/draft-ietf-ldapext-psearch">draft-ietf-ldapext-psearch
  *      - Persistent Search: A Simple LDAP Change Notification Mechanism </a>
  */
-public final class PersistentSearchRequestControl implements Control
-{
-  /**
-   * The OID for the persistent search request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.3";
+public final class PersistentSearchRequestControl implements Control {
+    /**
+     * The OID for the persistent search request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.3";
 
-  /**
-   * A decoder which can be used for decoding the persistent search request
-   * control.
-   */
-  public static final ControlDecoder<PersistentSearchRequestControl> DECODER =
-    new ControlDecoder<PersistentSearchRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the persistent search request
+     * control.
+     */
+    public static final ControlDecoder<PersistentSearchRequestControl> DECODER =
+            new ControlDecoder<PersistentSearchRequestControl>() {
 
-    public PersistentSearchRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PersistentSearchRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PersistentSearchRequestControl)
-      {
-        return (PersistentSearchRequestControl) control;
-      }
+                    if (control instanceof PersistentSearchRequestControl) {
+                        return (PersistentSearchRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PSEARCH_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PSEARCH_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_PSEARCH_NO_CONTROL_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_PSEARCH_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      boolean changesOnly;
-      boolean returnECs;
-      int changeTypes;
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    boolean changesOnly;
+                    boolean returnECs;
+                    int changeTypes;
 
-      try
-      {
-        reader.readStartSequence();
+                    try {
+                        reader.readStartSequence();
 
-        changeTypes = (int) reader.readInteger();
-        changesOnly = reader.readBoolean();
-        returnECs = reader.readBoolean();
+                        changeTypes = (int) reader.readInteger();
+                        changesOnly = reader.readBoolean();
+                        returnECs = reader.readBoolean();
 
-        reader.readEndSequence();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PersistentSearchControl.Decoder",
-            "decode", e);
+                        reader.readEndSequence();
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("PersistentSearchControl.Decoder", "decode",
+                                e);
 
-        final LocalizableMessage message = ERR_PSEARCH_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_PSEARCH_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      final Set<PersistentSearchChangeType> changeTypeSet = EnumSet
-          .noneOf(PersistentSearchChangeType.class);
+                    final Set<PersistentSearchChangeType> changeTypeSet =
+                            EnumSet.noneOf(PersistentSearchChangeType.class);
 
-      if ((changeTypes & 15) != 0)
-      {
-        final LocalizableMessage message = ERR_PSEARCH_BAD_CHANGE_TYPES
-            .get(changeTypes);
-        throw DecodeException.error(message);
-      }
+                    if ((changeTypes & 15) != 0) {
+                        final LocalizableMessage message =
+                                ERR_PSEARCH_BAD_CHANGE_TYPES.get(changeTypes);
+                        throw DecodeException.error(message);
+                    }
 
-      if ((changeTypes & 1) != 0)
-      {
-        changeTypeSet.add(PersistentSearchChangeType.ADD);
-      }
+                    if ((changeTypes & 1) != 0) {
+                        changeTypeSet.add(PersistentSearchChangeType.ADD);
+                    }
 
-      if ((changeTypes & 2) != 0)
-      {
-        changeTypeSet.add(PersistentSearchChangeType.DELETE);
-      }
+                    if ((changeTypes & 2) != 0) {
+                        changeTypeSet.add(PersistentSearchChangeType.DELETE);
+                    }
 
-      if ((changeTypes & 4) != 0)
-      {
-        changeTypeSet.add(PersistentSearchChangeType.MODIFY);
-      }
+                    if ((changeTypes & 4) != 0) {
+                        changeTypeSet.add(PersistentSearchChangeType.MODIFY);
+                    }
 
-      if ((changeTypes & 8) != 0)
-      {
-        changeTypeSet.add(PersistentSearchChangeType.MODIFY_DN);
-      }
+                    if ((changeTypes & 8) != 0) {
+                        changeTypeSet.add(PersistentSearchChangeType.MODIFY_DN);
+                    }
 
-      return new PersistentSearchRequestControl(control.isCritical(),
-          changesOnly, returnECs, Collections.unmodifiableSet(changeTypeSet));
+                    return new PersistentSearchRequestControl(control.isCritical(), changesOnly,
+                            returnECs, Collections.unmodifiableSet(changeTypeSet));
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new persistent search request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param changesOnly
+     *            Indicates whether or not only updated entries should be
+     *            returned (added, modified, deleted, or subject to a modifyDN
+     *            operation). If this parameter is {@code false} then the search
+     *            will initially return all the existing entries which match the
+     *            filter.
+     * @param returnECs
+     *            Indicates whether or not the entry change notification control
+     *            should be included in updated entries that match the
+     *            associated search criteria.
+     * @param changeTypes
+     *            The types of update operation for which change notifications
+     *            should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code changeTypes} was {@code null}.
+     */
+    public static PersistentSearchRequestControl newControl(final boolean isCritical,
+            final boolean changesOnly, final boolean returnECs,
+            final Collection<PersistentSearchChangeType> changeTypes) {
+        Validator.ensureNotNull(changeTypes);
+
+        final Set<PersistentSearchChangeType> copyOfChangeTypes =
+                EnumSet.noneOf(PersistentSearchChangeType.class);
+        copyOfChangeTypes.addAll(changeTypes);
+        return new PersistentSearchRequestControl(isCritical, changesOnly, returnECs, Collections
+                .unmodifiableSet(copyOfChangeTypes));
     }
 
+    /**
+     * Creates a new persistent search request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param changesOnly
+     *            Indicates whether or not only updated entries should be
+     *            returned (added, modified, deleted, or subject to a modifyDN
+     *            operation). If this parameter is {@code false} then the search
+     *            will initially return all the existing entries which match the
+     *            filter.
+     * @param returnECs
+     *            Indicates whether or not the entry change notification control
+     *            should be included in updated entries that match the
+     *            associated search criteria.
+     * @param changeTypes
+     *            The types of update operation for which change notifications
+     *            should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code changeTypes} was {@code null}.
+     */
+    public static PersistentSearchRequestControl newControl(final boolean isCritical,
+            final boolean changesOnly, final boolean returnECs,
+            final PersistentSearchChangeType... changeTypes) {
+        Validator.ensureNotNull((Object) changeTypes);
 
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new persistent search request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param changesOnly
-   *          Indicates whether or not only updated entries should be returned
-   *          (added, modified, deleted, or subject to a modifyDN operation). If
-   *          this parameter is {@code false} then the search will initially
-   *          return all the existing entries which match the filter.
-   * @param returnECs
-   *          Indicates whether or not the entry change notification control
-   *          should be included in updated entries that match the associated
-   *          search criteria.
-   * @param changeTypes
-   *          The types of update operation for which change notifications
-   *          should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code changeTypes} was {@code null}.
-   */
-  public static PersistentSearchRequestControl newControl(
-      final boolean isCritical, final boolean changesOnly,
-      final boolean returnECs,
-      final Collection<PersistentSearchChangeType> changeTypes)
-  {
-    Validator.ensureNotNull(changeTypes);
-
-    final Set<PersistentSearchChangeType> copyOfChangeTypes = EnumSet
-        .noneOf(PersistentSearchChangeType.class);
-    copyOfChangeTypes.addAll(changeTypes);
-    return new PersistentSearchRequestControl(isCritical, changesOnly,
-        returnECs, Collections.unmodifiableSet(copyOfChangeTypes));
-  }
-
-
-
-  /**
-   * Creates a new persistent search request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param changesOnly
-   *          Indicates whether or not only updated entries should be returned
-   *          (added, modified, deleted, or subject to a modifyDN operation). If
-   *          this parameter is {@code false} then the search will initially
-   *          return all the existing entries which match the filter.
-   * @param returnECs
-   *          Indicates whether or not the entry change notification control
-   *          should be included in updated entries that match the associated
-   *          search criteria.
-   * @param changeTypes
-   *          The types of update operation for which change notifications
-   *          should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code changeTypes} was {@code null}.
-   */
-  public static PersistentSearchRequestControl newControl(
-      final boolean isCritical, final boolean changesOnly,
-      final boolean returnECs, final PersistentSearchChangeType... changeTypes)
-  {
-    Validator.ensureNotNull((Object) changeTypes);
-
-    return newControl(isCritical, changesOnly, returnECs, Arrays
-        .asList(changeTypes));
-  }
-
-
-
-  // Indicates whether to only return entries that have been updated
-  // since the beginning of the search.
-  private final boolean changesOnly;
-
-  // Indicates whether entries returned as a result of changes to
-  // directory data should include the entry change notification control.
-  private final boolean returnECs;
-
-  // The logical OR of change types associated with this control.
-  private final Set<PersistentSearchChangeType> changeTypes;
-
-  private final boolean isCritical;
-
-
-
-  private PersistentSearchRequestControl(final boolean isCritical,
-      final boolean changesOnly, final boolean returnECs,
-      final Set<PersistentSearchChangeType> changeTypes)
-  {
-    this.isCritical = isCritical;
-    this.changesOnly = changesOnly;
-    this.returnECs = returnECs;
-    this.changeTypes = changeTypes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the types of update operation for
-   * which change notifications should be returned.
-   *
-   * @return An unmodifiable set containing the types of update operation for
-   *         which change notifications should be returned.
-   */
-  public Set<PersistentSearchChangeType> getChangeTypes()
-  {
-    return changeTypes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-
-      int changeTypesInt = 0;
-      for (final PersistentSearchChangeType changeType : changeTypes)
-      {
-        changeTypesInt |= changeType.intValue();
-      }
-      writer.writeInteger(changeTypesInt);
-
-      writer.writeBoolean(changesOnly);
-      writer.writeBoolean(returnECs);
-      writer.writeEndSequence();
-      return buffer.toByteString();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Returns {@code true} if only updated entries should be returned (added,
-   * modified, deleted, or subject to a modifyDN operation), otherwise {@code
-   * false} if the search will initially return all the existing entries which
-   * match the filter.
-   *
-   * @return {@code true} if only updated entries should be returned (added,
-   *         modified, deleted, or subject to a modifyDN operation), otherwise
-   *         {@code false} if the search will initially return all the existing
-   *         entries which match the filter.
-   */
-  public boolean isChangesOnly()
-  {
-    return changesOnly;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the entry change notification control should be
-   * included in updated entries that match the associated search criteria.
-   *
-   * @return {@code true} if the entry change notification control should be
-   *         included in updated entries that match the associated search
-   *         criteria.
-   */
-  public boolean isReturnECs()
-  {
-    return returnECs;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PersistentSearchRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", changeTypes=[");
-
-    boolean comma = false;
-    for (final PersistentSearchChangeType type : changeTypes)
-    {
-      if (comma)
-      {
-        builder.append(", ");
-      }
-      builder.append(type);
-      comma = true;
+        return newControl(isCritical, changesOnly, returnECs, Arrays.asList(changeTypes));
     }
 
-    builder.append("](");
-    builder.append(changeTypes);
-    builder.append("), changesOnly=");
-    builder.append(changesOnly);
-    builder.append(", returnECs=");
-    builder.append(returnECs);
-    builder.append(")");
-    return builder.toString();
-  }
+    // Indicates whether to only return entries that have been updated
+    // since the beginning of the search.
+    private final boolean changesOnly;
+
+    // Indicates whether entries returned as a result of changes to
+    // directory data should include the entry change notification control.
+    private final boolean returnECs;
+
+    // The logical OR of change types associated with this control.
+    private final Set<PersistentSearchChangeType> changeTypes;
+
+    private final boolean isCritical;
+
+    private PersistentSearchRequestControl(final boolean isCritical, final boolean changesOnly,
+            final boolean returnECs, final Set<PersistentSearchChangeType> changeTypes) {
+        this.isCritical = isCritical;
+        this.changesOnly = changesOnly;
+        this.returnECs = returnECs;
+        this.changeTypes = changeTypes;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the types of update operation for
+     * which change notifications should be returned.
+     *
+     * @return An unmodifiable set containing the types of update operation for
+     *         which change notifications should be returned.
+     */
+    public Set<PersistentSearchChangeType> getChangeTypes() {
+        return changeTypes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+
+            int changeTypesInt = 0;
+            for (final PersistentSearchChangeType changeType : changeTypes) {
+                changeTypesInt |= changeType.intValue();
+            }
+            writer.writeInteger(changeTypesInt);
+
+            writer.writeBoolean(changesOnly);
+            writer.writeBoolean(returnECs);
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
+
+    /**
+     * Returns {@code true} if only updated entries should be returned (added,
+     * modified, deleted, or subject to a modifyDN operation), otherwise
+     * {@code false} if the search will initially return all the existing
+     * entries which match the filter.
+     *
+     * @return {@code true} if only updated entries should be returned (added,
+     *         modified, deleted, or subject to a modifyDN operation), otherwise
+     *         {@code false} if the search will initially return all the
+     *         existing entries which match the filter.
+     */
+    public boolean isChangesOnly() {
+        return changesOnly;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
+
+    /**
+     * Returns {@code true} if the entry change notification control should be
+     * included in updated entries that match the associated search criteria.
+     *
+     * @return {@code true} if the entry change notification control should be
+     *         included in updated entries that match the associated search
+     *         criteria.
+     */
+    public boolean isReturnECs() {
+        return returnECs;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PersistentSearchRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", changeTypes=[");
+
+        boolean comma = false;
+        for (final PersistentSearchChangeType type : changeTypes) {
+            if (comma) {
+                builder.append(", ");
+            }
+            builder.append(type);
+            comma = true;
+        }
+
+        builder.append("](");
+        builder.append(changeTypes);
+        builder.append("), changesOnly=");
+        builder.append(changesOnly);
+        builder.append(", returnECs=");
+        builder.append(returnECs);
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java
index e700a18..254faa3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,14 +27,16 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_CANNOT_DECODE_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_NO_CONTROL_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREAD_CONTROL_BAD_OID;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.asn1.ASN1;
@@ -49,8 +50,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The post-read request control as defined in RFC 4527. This control allows the
  * client to read the target entry of an update operation immediately after the
@@ -61,299 +60,228 @@
  * @see <a href="http://tools.ietf.org/html/rfc4527">RFC 4527 - Lightweight
  *      Directory Access Protocol (LDAP) Read Entry Controls </a>
  */
-public final class PostReadRequestControl implements Control
-{
-  /**
-   * The IANA-assigned OID for the LDAP post-read request control used for
-   * retrieving an entry in the state it had immediately after an update was
-   * applied.
-   */
-  public static final String OID = "1.3.6.1.1.13.2";
+public final class PostReadRequestControl implements Control {
+    /**
+     * The IANA-assigned OID for the LDAP post-read request control used for
+     * retrieving an entry in the state it had immediately after an update was
+     * applied.
+     */
+    public static final String OID = "1.3.6.1.1.13.2";
 
-  // The set of raw attributes to return in the entry.
-  private final Set<String> attributes;
+    // The set of raw attributes to return in the entry.
+    private final Set<String> attributes;
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final PostReadRequestControl CRITICAL_EMPTY_INSTANCE =
-    new PostReadRequestControl(true, Collections.<String> emptySet());
+    private static final PostReadRequestControl CRITICAL_EMPTY_INSTANCE =
+            new PostReadRequestControl(true, Collections.<String> emptySet());
 
-  private static final PostReadRequestControl NONCRITICAL_EMPTY_INSTANCE =
-    new PostReadRequestControl(false, Collections.<String> emptySet());
+    private static final PostReadRequestControl NONCRITICAL_EMPTY_INSTANCE =
+            new PostReadRequestControl(false, Collections.<String> emptySet());
 
-  /**
-   * A decoder which can be used for decoding the post-read request control.
-   */
-  public static final ControlDecoder<PostReadRequestControl> DECODER =
-    new ControlDecoder<PostReadRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the post-read request control.
+     */
+    public static final ControlDecoder<PostReadRequestControl> DECODER =
+            new ControlDecoder<PostReadRequestControl>() {
 
-    public PostReadRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PostReadRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PostReadRequestControl)
-      {
-        return (PostReadRequestControl) control;
-      }
+                    if (control instanceof PostReadRequestControl) {
+                        return (PostReadRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_POSTREAD_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_POSTREAD_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_POSTREADREQ_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_POSTREADREQ_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      Set<String> attributes;
-      try
-      {
-        reader.readStartSequence();
-        if (reader.hasNextElement())
-        {
-          final String firstAttribute = reader.readOctetStringAsString();
-          if (reader.hasNextElement())
-          {
-            attributes = new LinkedHashSet<String>();
-            attributes.add(firstAttribute);
-            do
-            {
-              attributes.add(reader.readOctetStringAsString());
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    Set<String> attributes;
+                    try {
+                        reader.readStartSequence();
+                        if (reader.hasNextElement()) {
+                            final String firstAttribute = reader.readOctetStringAsString();
+                            if (reader.hasNextElement()) {
+                                attributes = new LinkedHashSet<String>();
+                                attributes.add(firstAttribute);
+                                do {
+                                    attributes.add(reader.readOctetStringAsString());
+                                } while (reader.hasNextElement());
+                                attributes = Collections.unmodifiableSet(attributes);
+                            } else {
+                                attributes = Collections.singleton(firstAttribute);
+                            }
+                        } else {
+                            attributes = Collections.emptySet();
+                        }
+                        reader.readEndSequence();
+                    } catch (final Exception ae) {
+                        StaticUtils.DEBUG_LOG.throwing("PostReadRequestControl", "decodeControl",
+                                ae);
+
+                        final LocalizableMessage message =
+                                ERR_POSTREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage());
+                        throw DecodeException.error(message, ae);
+                    }
+
+                    if (attributes.isEmpty()) {
+                        return control.isCritical() ? CRITICAL_EMPTY_INSTANCE
+                                : NONCRITICAL_EMPTY_INSTANCE;
+                    } else {
+                        return new PostReadRequestControl(control.isCritical(), attributes);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new post-read request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param attributes
+     *            The list of attributes to be included with the response
+     *            control. Attributes that are sub-types of listed attributes
+     *            are implicitly included. The list may be empty, indicating
+     *            that all user attributes should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static PostReadRequestControl newControl(final boolean isCritical,
+            final Collection<String> attributes) {
+        Validator.ensureNotNull(attributes);
+
+        if (attributes.isEmpty()) {
+            return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+        } else if (attributes.size() == 1) {
+            return new PostReadRequestControl(isCritical, Collections.singleton(attributes
+                    .iterator().next()));
+        } else {
+            final Set<String> attributeSet = new LinkedHashSet<String>(attributes);
+            return new PostReadRequestControl(isCritical, Collections.unmodifiableSet(attributeSet));
+        }
+    }
+
+    /**
+     * Creates a new post-read request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param attributes
+     *            The list of attributes to be included with the response
+     *            control. Attributes that are sub-types of listed attributes
+     *            are implicitly included. The list may be empty, indicating
+     *            that all user attributes should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static PostReadRequestControl newControl(final boolean isCritical,
+            final String... attributes) {
+        Validator.ensureNotNull((Object) attributes);
+
+        if (attributes.length == 0) {
+            return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+        } else if (attributes.length == 1) {
+            return new PostReadRequestControl(isCritical, Collections.singleton(attributes[0]));
+        } else {
+            final Set<String> attributeSet = new LinkedHashSet<String>(Arrays.asList(attributes));
+            return new PostReadRequestControl(isCritical, Collections.unmodifiableSet(attributeSet));
+        }
+    }
+
+    private PostReadRequestControl(final boolean isCritical, final Set<String> attributes) {
+        this.isCritical = isCritical;
+        this.attributes = attributes;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the names of attributes to be
+     * included with the response control. Attributes that are sub-types of
+     * listed attributes are implicitly included. The returned set may be empty,
+     * indicating that all user attributes should be returned.
+     *
+     * @return An unmodifiable set containing the names of attributes to be
+     *         included with the response control.
+     */
+    public Set<String> getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            if (attributes != null) {
+                for (final String attr : attributes) {
+                    writer.writeOctetString(attr);
+                }
             }
-            while (reader.hasNextElement());
-            attributes = Collections.unmodifiableSet(attributes);
-          }
-          else
-          {
-            attributes = Collections.singleton(firstAttribute);
-          }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-        else
-        {
-          attributes = Collections.emptySet();
-        }
-        reader.readEndSequence();
-      }
-      catch (final Exception ae)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PostReadRequestControl",
-            "decodeControl", ae);
-
-        final LocalizableMessage message = ERR_POSTREADREQ_CANNOT_DECODE_VALUE
-            .get(ae.getMessage());
-        throw DecodeException.error(message, ae);
-      }
-
-      if (attributes.isEmpty())
-      {
-        return control.isCritical() ? CRITICAL_EMPTY_INSTANCE
-            : NONCRITICAL_EMPTY_INSTANCE;
-      }
-      else
-      {
-        return new PostReadRequestControl(control.isCritical(), attributes);
-      }
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-  };
 
-
-
-  /**
-   * Creates a new post-read request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param attributes
-   *          The list of attributes to be included with the response control.
-   *          Attributes that are sub-types of listed attributes are implicitly
-   *          included. The list may be empty, indicating that all user
-   *          attributes should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static PostReadRequestControl newControl(final boolean isCritical,
-      final Collection<String> attributes)
-  {
-    Validator.ensureNotNull(attributes);
-
-    if (attributes.isEmpty())
-    {
-      return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
     }
-    else if (attributes.size() == 1)
-    {
-      return new PostReadRequestControl(isCritical, Collections
-          .singleton(attributes.iterator().next()));
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PostReadRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", attributes=");
+        builder.append(attributes);
+        builder.append(")");
+        return builder.toString();
     }
-    else
-    {
-      final Set<String> attributeSet = new LinkedHashSet<String>(attributes);
-      return new PostReadRequestControl(isCritical, Collections
-          .unmodifiableSet(attributeSet));
-    }
-  }
-
-
-
-  /**
-   * Creates a new post-read request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param attributes
-   *          The list of attributes to be included with the response control.
-   *          Attributes that are sub-types of listed attributes are implicitly
-   *          included. The list may be empty, indicating that all user
-   *          attributes should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static PostReadRequestControl newControl(final boolean isCritical,
-      final String... attributes)
-  {
-    Validator.ensureNotNull((Object) attributes);
-
-    if (attributes.length == 0)
-    {
-      return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
-    }
-    else if (attributes.length == 1)
-    {
-      return new PostReadRequestControl(isCritical, Collections
-          .singleton(attributes[0]));
-    }
-    else
-    {
-      final Set<String> attributeSet = new LinkedHashSet<String>(Arrays
-          .asList(attributes));
-      return new PostReadRequestControl(isCritical, Collections
-          .unmodifiableSet(attributeSet));
-    }
-  }
-
-
-
-  private PostReadRequestControl(final boolean isCritical,
-      final Set<String> attributes)
-  {
-    this.isCritical = isCritical;
-    this.attributes = attributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the names of attributes to be
-   * included with the response control. Attributes that are sub-types of listed
-   * attributes are implicitly included. The returned set may be empty,
-   * indicating that all user attributes should be returned.
-   *
-   * @return An unmodifiable set containing the names of attributes to be
-   *         included with the response control.
-   */
-  public Set<String> getAttributes()
-  {
-    return attributes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      if (attributes != null)
-      {
-        for (final String attr : attributes)
-        {
-          writer.writeOctetString(attr);
-        }
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PostReadRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", attributes=");
-    builder.append(attributes);
-    builder.append(")");
-    return builder.toString();
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java
index d963b13..ce2f435 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADRESP_CANNOT_DECODE_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADRESP_NO_CONTROL_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_POSTREAD_CONTROL_BAD_OID;
@@ -40,7 +37,12 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Entries;
+import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.responses.Responses;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
@@ -48,8 +50,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The post-read response control as defined in RFC 4527. This control is
  * returned by the server in response to a successful update operation which
@@ -61,200 +61,159 @@
  * @see <a href="http://tools.ietf.org/html/rfc4527">RFC 4527 - Lightweight
  *      Directory Access Protocol (LDAP) Read Entry Controls </a>
  */
-public final class PostReadResponseControl implements Control
-{
-  /**
-   * The IANA-assigned OID for the LDAP post-read response control used for
-   * retrieving an entry in the state it had immediately after an update was
-   * applied.
-   */
-  public static final String OID = PostReadRequestControl.OID;
-
-  /**
-   * A decoder which can be used for decoding the post-read response control.
-   */
-  public static final ControlDecoder<PostReadResponseControl> DECODER =
-    new ControlDecoder<PostReadResponseControl>()
-  {
-
-    public PostReadResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
-
-      if (control instanceof PostReadResponseControl)
-      {
-        return (PostReadResponseControl) control;
-      }
-
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_POSTREAD_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
-
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_POSTREADRESP_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
-
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      SearchResultEntry searchEntry;
-      try
-      {
-        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
-      }
-      catch (final IOException le)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PostReadResponseControl",
-            "decodeControl", le);
-
-        final LocalizableMessage message = ERR_POSTREADRESP_CANNOT_DECODE_VALUE
-            .get(le.getMessage());
-        throw DecodeException.error(message, le);
-      }
-
-      /**
-       * FIXME: the RFC states that the control contains a SearchResultEntry
-       * rather than an Entry. Can we assume that the response will not contain
-       * a nested set of controls?
-       */
-      return new PostReadResponseControl(control.isCritical(), Entries
-          .unmodifiableEntry(searchEntry));
-    }
-
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new post-read response control.
-   *
-   * @param entry
-   *          The entry whose contents reflect the state of the updated entry
-   *          immediately after the update operation was performed.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public static PostReadResponseControl newControl(final Entry entry)
-  {
+public final class PostReadResponseControl implements Control {
     /**
-     * FIXME: all other control implementations are fully immutable. We should
-     * really do a defensive copy here in order to be consistent, rather than
-     * just wrap it. Also, the RFC states that the control contains a
-     * SearchResultEntry rather than an Entry. Can we assume that the response
-     * will not contain a nested set of controls?
+     * The IANA-assigned OID for the LDAP post-read response control used for
+     * retrieving an entry in the state it had immediately after an update was
+     * applied.
      */
-    return new PostReadResponseControl(false, Entries.unmodifiableEntry(entry));
-  }
+    public static final String OID = PostReadRequestControl.OID;
 
+    /**
+     * A decoder which can be used for decoding the post-read response control.
+     */
+    public static final ControlDecoder<PostReadResponseControl> DECODER =
+            new ControlDecoder<PostReadResponseControl>() {
 
+                public PostReadResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-  private final Entry entry;
+                    if (control instanceof PostReadResponseControl) {
+                        return (PostReadResponseControl) control;
+                    }
 
-  private final boolean isCritical;
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_POSTREAD_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_POSTREADRESP_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    SearchResultEntry searchEntry;
+                    try {
+                        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
+                    } catch (final IOException le) {
+                        StaticUtils.DEBUG_LOG.throwing("PostReadResponseControl", "decodeControl",
+                                le);
 
-  private PostReadResponseControl(final boolean isCritical, final Entry entry)
-  {
-    this.isCritical = isCritical;
-    this.entry = entry;
-  }
+                        final LocalizableMessage message =
+                                ERR_POSTREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
+                        throw DecodeException.error(message, le);
+                    }
 
+                    /**
+                     * FIXME: the RFC states that the control contains a
+                     * SearchResultEntry rather than an Entry. Can we assume
+                     * that the response will not contain a nested set of
+                     * controls?
+                     */
+                    return new PostReadResponseControl(control.isCritical(), Entries
+                            .unmodifiableEntry(searchEntry));
+                }
 
+                public String getOID() {
+                    return OID;
+                }
+            };
 
-  /**
-   * Returns an unmodifiable entry whose contents reflect the state of the
-   * updated entry immediately after the update operation was performed.
-   *
-   * @return The unmodifiable entry whose contents reflect the state of the
-   *         updated entry immediately after the update operation was performed.
-   */
-  public Entry getEntry()
-  {
-    return entry;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      LDAPUtils.encodeSearchResultEntry(writer, Responses
-          .newSearchResultEntry(entry));
-      return buffer.toByteString();
+    /**
+     * Creates a new post-read response control.
+     *
+     * @param entry
+     *            The entry whose contents reflect the state of the updated
+     *            entry immediately after the update operation was performed.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public static PostReadResponseControl newControl(final Entry entry) {
+        /**
+         * FIXME: all other control implementations are fully immutable. We
+         * should really do a defensive copy here in order to be consistent,
+         * rather than just wrap it. Also, the RFC states that the control
+         * contains a SearchResultEntry rather than an Entry. Can we assume that
+         * the response will not contain a nested set of controls?
+         */
+        return new PostReadResponseControl(false, Entries.unmodifiableEntry(entry));
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    private final Entry entry;
+
+    private final boolean isCritical;
+
+    private PostReadResponseControl(final boolean isCritical, final Entry entry) {
+        this.isCritical = isCritical;
+        this.entry = entry;
     }
-  }
 
+    /**
+     * Returns an unmodifiable entry whose contents reflect the state of the
+     * updated entry immediately after the update operation was performed.
+     *
+     * @return The unmodifiable entry whose contents reflect the state of the
+     *         updated entry immediately after the update operation was
+     *         performed.
+     */
+    public Entry getEntry() {
+        return entry;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            LDAPUtils.encodeSearchResultEntry(writer, Responses.newSearchResultEntry(entry));
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PostReadResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", entry=");
-    builder.append(entry);
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PostReadResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", entry=");
+        builder.append(entry);
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java
index d361972..51653cc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,14 +27,16 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_CANNOT_DECODE_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_NO_CONTROL_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREAD_CONTROL_BAD_OID;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.asn1.ASN1;
@@ -49,8 +50,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The pre-read request control as defined in RFC 4527. This control allows the
  * client to read the target entry of an update operation immediately before the
@@ -61,299 +60,228 @@
  * @see <a href="http://tools.ietf.org/html/rfc4527">RFC 4527 - Lightweight
  *      Directory Access Protocol (LDAP) Read Entry Controls </a>
  */
-public final class PreReadRequestControl implements Control
-{
-  /**
-   * The IANA-assigned OID for the LDAP pre-read request control used for
-   * retrieving an entry in the state it had immediately before an update was
-   * applied.
-   */
-  public static final String OID = "1.3.6.1.1.13.1";
+public final class PreReadRequestControl implements Control {
+    /**
+     * The IANA-assigned OID for the LDAP pre-read request control used for
+     * retrieving an entry in the state it had immediately before an update was
+     * applied.
+     */
+    public static final String OID = "1.3.6.1.1.13.1";
 
-  // The set of raw attributes to return in the entry.
-  private final Set<String> attributes;
+    // The set of raw attributes to return in the entry.
+    private final Set<String> attributes;
 
-  private final boolean isCritical;
+    private final boolean isCritical;
 
-  private static final PreReadRequestControl CRITICAL_EMPTY_INSTANCE = new PreReadRequestControl(
-      true, Collections.<String> emptySet());
+    private static final PreReadRequestControl CRITICAL_EMPTY_INSTANCE = new PreReadRequestControl(
+            true, Collections.<String> emptySet());
 
-  private static final PreReadRequestControl NONCRITICAL_EMPTY_INSTANCE = new PreReadRequestControl(
-      false, Collections.<String> emptySet());
+    private static final PreReadRequestControl NONCRITICAL_EMPTY_INSTANCE =
+            new PreReadRequestControl(false, Collections.<String> emptySet());
 
-  /**
-   * A decoder which can be used for decoding the pre-read request control.
-   */
-  public static final ControlDecoder<PreReadRequestControl> DECODER =
-    new ControlDecoder<PreReadRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the pre-read request control.
+     */
+    public static final ControlDecoder<PreReadRequestControl> DECODER =
+            new ControlDecoder<PreReadRequestControl>() {
 
-    public PreReadRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public PreReadRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof PreReadRequestControl)
-      {
-        return (PreReadRequestControl) control;
-      }
+                    if (control instanceof PreReadRequestControl) {
+                        return (PreReadRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PREREAD_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PREREAD_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_PREREADREQ_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_PREREADREQ_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      Set<String> attributes;
-      try
-      {
-        reader.readStartSequence();
-        if (reader.hasNextElement())
-        {
-          final String firstAttribute = reader.readOctetStringAsString();
-          if (reader.hasNextElement())
-          {
-            attributes = new LinkedHashSet<String>();
-            attributes.add(firstAttribute);
-            do
-            {
-              attributes.add(reader.readOctetStringAsString());
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    Set<String> attributes;
+                    try {
+                        reader.readStartSequence();
+                        if (reader.hasNextElement()) {
+                            final String firstAttribute = reader.readOctetStringAsString();
+                            if (reader.hasNextElement()) {
+                                attributes = new LinkedHashSet<String>();
+                                attributes.add(firstAttribute);
+                                do {
+                                    attributes.add(reader.readOctetStringAsString());
+                                } while (reader.hasNextElement());
+                                attributes = Collections.unmodifiableSet(attributes);
+                            } else {
+                                attributes = Collections.singleton(firstAttribute);
+                            }
+                        } else {
+                            attributes = Collections.emptySet();
+                        }
+                        reader.readEndSequence();
+                    } catch (final Exception ae) {
+                        StaticUtils.DEBUG_LOG
+                                .throwing("PreReadRequestControl", "decodeControl", ae);
+
+                        final LocalizableMessage message =
+                                ERR_PREREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage());
+                        throw DecodeException.error(message, ae);
+                    }
+
+                    if (attributes.isEmpty()) {
+                        return control.isCritical() ? CRITICAL_EMPTY_INSTANCE
+                                : NONCRITICAL_EMPTY_INSTANCE;
+                    } else {
+                        return new PreReadRequestControl(control.isCritical(), attributes);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new pre-read request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param attributes
+     *            The list of attributes to be included with the response
+     *            control. Attributes that are sub-types of listed attributes
+     *            are implicitly included. The list may be empty, indicating
+     *            that all user attributes should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static PreReadRequestControl newControl(final boolean isCritical,
+            final Collection<String> attributes) {
+        Validator.ensureNotNull(attributes);
+
+        if (attributes.isEmpty()) {
+            return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+        } else if (attributes.size() == 1) {
+            return new PreReadRequestControl(isCritical, Collections.singleton(attributes
+                    .iterator().next()));
+        } else {
+            final Set<String> attributeSet = new LinkedHashSet<String>(attributes);
+            return new PreReadRequestControl(isCritical, Collections.unmodifiableSet(attributeSet));
+        }
+    }
+
+    /**
+     * Creates a new pre-read request control.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored
+     * @param attributes
+     *            The list of attributes to be included with the response
+     *            control. Attributes that are sub-types of listed attributes
+     *            are implicitly included. The list may be empty, indicating
+     *            that all user attributes should be returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code attributes} was {@code null}.
+     */
+    public static PreReadRequestControl newControl(final boolean isCritical,
+            final String... attributes) {
+        Validator.ensureNotNull((Object) attributes);
+
+        if (attributes.length == 0) {
+            return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+        } else if (attributes.length == 1) {
+            return new PreReadRequestControl(isCritical, Collections.singleton(attributes[0]));
+        } else {
+            final Set<String> attributeSet = new LinkedHashSet<String>(Arrays.asList(attributes));
+            return new PreReadRequestControl(isCritical, Collections.unmodifiableSet(attributeSet));
+        }
+    }
+
+    private PreReadRequestControl(final boolean isCritical, final Set<String> attributes) {
+        this.isCritical = isCritical;
+        this.attributes = attributes;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the names of attributes to be
+     * included with the response control. Attributes that are sub-types of
+     * listed attributes are implicitly included. The returned set may be empty,
+     * indicating that all user attributes should be returned.
+     *
+     * @return An unmodifiable set containing the names of attributes to be
+     *         included with the response control.
+     */
+    public Set<String> getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            if (attributes != null) {
+                for (final String attr : attributes) {
+                    writer.writeOctetString(attr);
+                }
             }
-            while (reader.hasNextElement());
-            attributes = Collections.unmodifiableSet(attributes);
-          }
-          else
-          {
-            attributes = Collections.singleton(firstAttribute);
-          }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-        else
-        {
-          attributes = Collections.emptySet();
-        }
-        reader.readEndSequence();
-      }
-      catch (final Exception ae)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PreReadRequestControl",
-            "decodeControl", ae);
-
-        final LocalizableMessage message = ERR_PREREADREQ_CANNOT_DECODE_VALUE
-            .get(ae.getMessage());
-        throw DecodeException.error(message, ae);
-      }
-
-      if (attributes.isEmpty())
-      {
-        return control.isCritical() ? CRITICAL_EMPTY_INSTANCE
-            : NONCRITICAL_EMPTY_INSTANCE;
-      }
-      else
-      {
-        return new PreReadRequestControl(control.isCritical(), attributes);
-      }
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-  };
 
-
-
-  /**
-   * Creates a new pre-read request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param attributes
-   *          The list of attributes to be included with the response control.
-   *          Attributes that are sub-types of listed attributes are implicitly
-   *          included. The list may be empty, indicating that all user
-   *          attributes should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static PreReadRequestControl newControl(final boolean isCritical,
-      final Collection<String> attributes)
-  {
-    Validator.ensureNotNull(attributes);
-
-    if (attributes.isEmpty())
-    {
-      return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
     }
-    else if (attributes.size() == 1)
-    {
-      return new PreReadRequestControl(isCritical, Collections
-          .singleton(attributes.iterator().next()));
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PreReadRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", attributes=");
+        builder.append(attributes);
+        builder.append(")");
+        return builder.toString();
     }
-    else
-    {
-      final Set<String> attributeSet = new LinkedHashSet<String>(attributes);
-      return new PreReadRequestControl(isCritical, Collections
-          .unmodifiableSet(attributeSet));
-    }
-  }
-
-
-
-  /**
-   * Creates a new pre-read request control.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored
-   * @param attributes
-   *          The list of attributes to be included with the response control.
-   *          Attributes that are sub-types of listed attributes are implicitly
-   *          included. The list may be empty, indicating that all user
-   *          attributes should be returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code attributes} was {@code null}.
-   */
-  public static PreReadRequestControl newControl(final boolean isCritical,
-      final String... attributes)
-  {
-    Validator.ensureNotNull((Object) attributes);
-
-    if (attributes.length == 0)
-    {
-      return isCritical ? CRITICAL_EMPTY_INSTANCE : NONCRITICAL_EMPTY_INSTANCE;
-    }
-    else if (attributes.length == 1)
-    {
-      return new PreReadRequestControl(isCritical, Collections
-          .singleton(attributes[0]));
-    }
-    else
-    {
-      final Set<String> attributeSet = new LinkedHashSet<String>(Arrays
-          .asList(attributes));
-      return new PreReadRequestControl(isCritical, Collections
-          .unmodifiableSet(attributeSet));
-    }
-  }
-
-
-
-  private PreReadRequestControl(final boolean isCritical,
-      final Set<String> attributes)
-  {
-    this.isCritical = isCritical;
-    this.attributes = attributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the names of attributes to be
-   * included with the response control. Attributes that are sub-types of listed
-   * attributes are implicitly included. The returned set may be empty,
-   * indicating that all user attributes should be returned.
-   *
-   * @return An unmodifiable set containing the names of attributes to be
-   *         included with the response control.
-   */
-  public Set<String> getAttributes()
-  {
-    return attributes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      if (attributes != null)
-      {
-        for (final String attr : attributes)
-        {
-          writer.writeOctetString(attr);
-        }
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PreReadRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", attributes=");
-    builder.append(attributes);
-    builder.append(")");
-    return builder.toString();
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java
index df384db..7275bae 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREADRESP_CANNOT_DECODE_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREADRESP_NO_CONTROL_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_PREREAD_CONTROL_BAD_OID;
@@ -40,7 +37,12 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Entries;
+import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.responses.Responses;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
@@ -48,8 +50,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The pre-read response control as defined in RFC 4527. This control is
  * returned by the server in response to a successful update operation which
@@ -61,201 +61,159 @@
  * @see <a href="http://tools.ietf.org/html/rfc4527">RFC 4527 - Lightweight
  *      Directory Access Protocol (LDAP) Read Entry Controls </a>
  */
-public final class PreReadResponseControl implements Control
-{
-  /**
-   * The IANA-assigned OID for the LDAP pre-read response control used for
-   * retrieving an entry in the state it had immediately before an update was
-   * applied.
-   */
-  public static final String OID = PreReadRequestControl.OID;
-
-  /**
-   * A decoder which can be used for decoding the pre-read response control.
-   */
-  public static final ControlDecoder<PreReadResponseControl> DECODER =
-    new ControlDecoder<PreReadResponseControl>()
-  {
-
-    public PreReadResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
-
-      if (control instanceof PreReadResponseControl)
-      {
-        return (PreReadResponseControl) control;
-      }
-
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PREREAD_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
-
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_PREREADRESP_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
-
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      SearchResultEntry searchEntry;
-      try
-      {
-        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
-      }
-      catch (final IOException le)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PreReadResponseControl",
-            "decodeControl", le);
-
-        final LocalizableMessage message = ERR_PREREADRESP_CANNOT_DECODE_VALUE
-            .get(le.getMessage());
-        throw DecodeException.error(message, le);
-      }
-
-      /**
-       * FIXME: the RFC states that the control contains a SearchResultEntry
-       * rather than an Entry. Can we assume that the response will not contain
-       * a nested set of controls?
-       */
-      return new PreReadResponseControl(control.isCritical(), Entries
-          .unmodifiableEntry(searchEntry));
-    }
-
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new pre-read response control.
-   *
-   * @param entry
-   *          The entry whose contents reflect the state of the updated entry
-   *          immediately before the update operation was performed.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public static PreReadResponseControl newControl(final Entry entry)
-  {
+public final class PreReadResponseControl implements Control {
     /**
-     * FIXME: all other control implementations are fully immutable. We should
-     * really do a defensive copy here in order to be consistent, rather than
-     * just wrap it. Also, the RFC states that the control contains a
-     * SearchResultEntry rather than an Entry. Can we assume that the response
-     * will not contain a nested set of controls?
+     * The IANA-assigned OID for the LDAP pre-read response control used for
+     * retrieving an entry in the state it had immediately before an update was
+     * applied.
      */
-    return new PreReadResponseControl(false, Entries.unmodifiableEntry(entry));
-  }
+    public static final String OID = PreReadRequestControl.OID;
 
+    /**
+     * A decoder which can be used for decoding the pre-read response control.
+     */
+    public static final ControlDecoder<PreReadResponseControl> DECODER =
+            new ControlDecoder<PreReadResponseControl>() {
 
+                public PreReadResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-  private final Entry entry;
+                    if (control instanceof PreReadResponseControl) {
+                        return (PreReadResponseControl) control;
+                    }
 
-  private final boolean isCritical;
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PREREAD_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_PREREADRESP_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    SearchResultEntry searchEntry;
+                    try {
+                        searchEntry = LDAPUtils.decodeSearchResultEntry(reader, options);
+                    } catch (final IOException le) {
+                        StaticUtils.DEBUG_LOG.throwing("PreReadResponseControl", "decodeControl",
+                                le);
 
-  private PreReadResponseControl(final boolean isCritical, final Entry entry)
-  {
-    this.isCritical = isCritical;
-    this.entry = entry;
-  }
+                        final LocalizableMessage message =
+                                ERR_PREREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage());
+                        throw DecodeException.error(message, le);
+                    }
 
+                    /**
+                     * FIXME: the RFC states that the control contains a
+                     * SearchResultEntry rather than an Entry. Can we assume
+                     * that the response will not contain a nested set of
+                     * controls?
+                     */
+                    return new PreReadResponseControl(control.isCritical(), Entries
+                            .unmodifiableEntry(searchEntry));
+                }
 
+                public String getOID() {
+                    return OID;
+                }
+            };
 
-  /**
-   * Returns an unmodifiable entry whose contents reflect the state of the
-   * updated entry immediately before the update operation was performed.
-   *
-   * @return The unmodifiable entry whose contents reflect the state of the
-   *         updated entry immediately before the update operation was
-   *         performed.
-   */
-  public Entry getEntry()
-  {
-    return entry;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      LDAPUtils.encodeSearchResultEntry(writer, Responses
-          .newSearchResultEntry(entry));
-      return buffer.toByteString();
+    /**
+     * Creates a new pre-read response control.
+     *
+     * @param entry
+     *            The entry whose contents reflect the state of the updated
+     *            entry immediately before the update operation was performed.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public static PreReadResponseControl newControl(final Entry entry) {
+        /**
+         * FIXME: all other control implementations are fully immutable. We
+         * should really do a defensive copy here in order to be consistent,
+         * rather than just wrap it. Also, the RFC states that the control
+         * contains a SearchResultEntry rather than an Entry. Can we assume that
+         * the response will not contain a nested set of controls?
+         */
+        return new PreReadResponseControl(false, Entries.unmodifiableEntry(entry));
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    private final Entry entry;
+
+    private final boolean isCritical;
+
+    private PreReadResponseControl(final boolean isCritical, final Entry entry) {
+        this.isCritical = isCritical;
+        this.entry = entry;
     }
-  }
 
+    /**
+     * Returns an unmodifiable entry whose contents reflect the state of the
+     * updated entry immediately before the update operation was performed.
+     *
+     * @return The unmodifiable entry whose contents reflect the state of the
+     *         updated entry immediately before the update operation was
+     *         performed.
+     */
+    public Entry getEntry() {
+        return entry;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            LDAPUtils.encodeSearchResultEntry(writer, Responses.newSearchResultEntry(entry));
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PreReadResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", entry=");
-    builder.append(entry);
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PreReadResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", entry=");
+        builder.append(entry);
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java
index 1448fe8..c0279e6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
@@ -39,14 +36,16 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The proxy authorization v1 request control as defined in
  * draft-weltman-ldapv3-proxy-04. This control allows a user to request that an
@@ -62,235 +61,184 @@
  * should use the v2 version of this control in preference.
  *
  * @see <a href="http://tools.ietf.org/html/draft-weltman-ldapv3-proxy-04">
- *         draft-weltman-ldapv3-proxy-04 - LDAP Proxied Authorization Control </a>
+ *      draft-weltman-ldapv3-proxy-04 - LDAP Proxied Authorization Control </a>
  */
-public final class ProxiedAuthV1RequestControl implements Control
-{
-  /**
-   * The OID for the proxied authorization v1 control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.12";
+public final class ProxiedAuthV1RequestControl implements Control {
+    /**
+     * The OID for the proxied authorization v1 control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.12";
 
-  /**
-   * A decoder which can be used for decoding the proxied authorization v1
-   * request control.
-   */
-  public static final ControlDecoder<ProxiedAuthV1RequestControl> DECODER =
-    new ControlDecoder<ProxiedAuthV1RequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the proxied authorization v1
+     * request control.
+     */
+    public static final ControlDecoder<ProxiedAuthV1RequestControl> DECODER =
+            new ControlDecoder<ProxiedAuthV1RequestControl>() {
 
-    public ProxiedAuthV1RequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public ProxiedAuthV1RequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof ProxiedAuthV1RequestControl)
-      {
-        return (ProxiedAuthV1RequestControl) control;
-      }
+                    if (control instanceof ProxiedAuthV1RequestControl) {
+                        return (ProxiedAuthV1RequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH1_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH1_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.isCritical())
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH1_CONTROL_NOT_CRITICAL
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.isCritical()) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH1_CONTROL_NOT_CRITICAL.get();
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_PROXYAUTH1_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_PROXYAUTH1_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      String authorizationDNString;
-      try
-      {
-        reader.readStartSequence();
-        authorizationDNString = reader.readOctetStringAsString();
-        reader.readEndSequence();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV1RequestControl",
-            "decodeControl", e);
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    String authorizationDNString;
+                    try {
+                        reader.readStartSequence();
+                        authorizationDNString = reader.readOctetStringAsString();
+                        reader.readEndSequence();
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV1RequestControl",
+                                "decodeControl", e);
 
-        final LocalizableMessage message = ERR_PROXYAUTH1_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH1_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      final Schema schema = options.getSchemaResolver().resolveSchema(
-          authorizationDNString);
-      DN authorizationDN;
-      try
-      {
-        authorizationDN = DN.valueOf(authorizationDNString, schema);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH1_INVALID_AUTHZIDDN
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
+                    final Schema schema =
+                            options.getSchemaResolver().resolveSchema(authorizationDNString);
+                    DN authorizationDN;
+                    try {
+                        authorizationDN = DN.valueOf(authorizationDNString, schema);
+                    } catch (final LocalizedIllegalArgumentException e) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH1_INVALID_AUTHZIDDN.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      return new ProxiedAuthV1RequestControl(authorizationDN);
+                    return new ProxiedAuthV1RequestControl(authorizationDN);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new proxy authorization v1 request control with the provided
+     * authorization name.
+     *
+     * @param authorizationName
+     *            The distinguished name of the user whose authorization is to
+     *            be used when performing the operation.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code authorizationName} was {@code null}.
+     */
+    public static ProxiedAuthV1RequestControl newControl(final DN authorizationName) {
+        Validator.ensureNotNull(authorizationName);
+        return new ProxiedAuthV1RequestControl(authorizationName);
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * Creates a new proxy authorization v1 request control with the provided
+     * authorization name decoded using the default schema.
+     *
+     * @param authorizationName
+     *            The distinguished name of the user whose authorization is to
+     *            be used when performing the operation.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationName} is not a valid LDAP string
+     *             representation of a DN.
+     * @throws NullPointerException
+     *             If {@code authorizationName} was {@code null}.
+     */
+    public static ProxiedAuthV1RequestControl newControl(final String authorizationName) {
+        Validator.ensureNotNull(authorizationName);
+        return new ProxiedAuthV1RequestControl(DN.valueOf(authorizationName));
     }
-  };
 
+    private final DN authorizationName;
 
-
-  /**
-   * Creates a new proxy authorization v1 request control with the provided
-   * authorization name.
-   *
-   * @param authorizationName
-   *          The distinguished name of the user whose authorization is to be
-   *          used when performing the operation.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code authorizationName} was {@code null}.
-   */
-  public static ProxiedAuthV1RequestControl newControl(
-      final DN authorizationName)
-  {
-    Validator.ensureNotNull(authorizationName);
-    return new ProxiedAuthV1RequestControl(authorizationName);
-  }
-
-
-
-  /**
-   * Creates a new proxy authorization v1 request control with the provided
-   * authorization name decoded using the default schema.
-   *
-   * @param authorizationName
-   *          The distinguished name of the user whose authorization is to be
-   *          used when performing the operation.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationName} is not a valid LDAP string
-   *           representation of a DN.
-   * @throws NullPointerException
-   *           If {@code authorizationName} was {@code null}.
-   */
-  public static ProxiedAuthV1RequestControl newControl(
-      final String authorizationName)
-  {
-    Validator.ensureNotNull(authorizationName);
-    return new ProxiedAuthV1RequestControl(DN.valueOf(authorizationName));
-  }
-
-
-
-  private final DN authorizationName;
-
-
-
-  private ProxiedAuthV1RequestControl(final DN authorizationName)
-  {
-    this.authorizationName = authorizationName;
-  }
-
-
-
-  /**
-   * Returns the distinguished name of the user whose authorization is to be
-   * used when performing the operation.
-   *
-   * @return The distinguished name of the user whose authorization is to be
-   *         used when performing the operation.
-   */
-  public DN getAuthorizationDNName()
-  {
-    return authorizationName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeOctetString(authorizationName.toString());
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    private ProxiedAuthV1RequestControl(final DN authorizationName) {
+        this.authorizationName = authorizationName;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * Returns the distinguished name of the user whose authorization is to be
+     * used when performing the operation.
+     *
+     * @return The distinguished name of the user whose authorization is to be
+     *         used when performing the operation.
+     */
+    public DN getAuthorizationDNName() {
+        return authorizationName;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeOctetString(authorizationName.toString());
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return true;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder buffer = new StringBuilder();
-    buffer.append("ProxiedAuthorizationV1Control(oid=");
-    buffer.append(getOID());
-    buffer.append(", criticality=");
-    buffer.append(isCritical());
-    buffer.append(", proxyDN=\"");
-    buffer.append(authorizationName);
-    buffer.append("\")");
-    return buffer.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder buffer = new StringBuilder();
+        buffer.append("ProxiedAuthorizationV1Control(oid=");
+        buffer.append(getOID());
+        buffer.append(", criticality=");
+        buffer.append(isCritical());
+        buffer.append(", proxyDN=\"");
+        buffer.append(authorizationName);
+        buffer.append("\")");
+        return buffer.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
index a67306a..9817746 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
@@ -45,8 +42,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The proxy authorization v2 request control as defined in RFC 4370. This
  * control allows a user to request that an operation be performed using the
@@ -60,228 +55,181 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public final class ProxiedAuthV2RequestControl implements Control
-{
-  /**
-   * The OID for the proxied authorization v2 control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.18";
+public final class ProxiedAuthV2RequestControl implements Control {
+    /**
+     * The OID for the proxied authorization v2 control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.18";
 
-  private static final ProxiedAuthV2RequestControl ANONYMOUS = new ProxiedAuthV2RequestControl(
-      "");
+    private static final ProxiedAuthV2RequestControl ANONYMOUS =
+            new ProxiedAuthV2RequestControl("");
 
-  /**
-   * A decoder which can be used for decoding the proxied authorization v2
-   * request control.
-   */
-  public static final ControlDecoder<ProxiedAuthV2RequestControl> DECODER =
-    new ControlDecoder<ProxiedAuthV2RequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the proxied authorization v2
+     * request control.
+     */
+    public static final ControlDecoder<ProxiedAuthV2RequestControl> DECODER =
+            new ControlDecoder<ProxiedAuthV2RequestControl>() {
 
-    public ProxiedAuthV2RequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public ProxiedAuthV2RequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof ProxiedAuthV2RequestControl)
-      {
-        return (ProxiedAuthV2RequestControl) control;
-      }
+                    if (control instanceof ProxiedAuthV2RequestControl) {
+                        return (ProxiedAuthV2RequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH2_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH2_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.isCritical())
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH2_CONTROL_NOT_CRITICAL
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.isCritical()) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH2_CONTROL_NOT_CRITICAL.get();
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_PROXYAUTH2_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_PROXYAUTH2_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      String authorizationID;
-      try
-      {
-        if (reader.elementAvailable())
-        {
-          // Try the legacy encoding where the value is wrapped by an
-          // extra octet string
-          authorizationID = reader.readOctetStringAsString();
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    String authorizationID;
+                    try {
+                        if (reader.elementAvailable()) {
+                            // Try the legacy encoding where the value is
+                            // wrapped by an
+                            // extra octet string
+                            authorizationID = reader.readOctetStringAsString();
+                        } else {
+                            authorizationID = control.getValue().toString();
+                        }
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV2RequestControl",
+                                "decodeControl", e);
+
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH2_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+
+                    if (authorizationID.length() == 0) {
+                        // Anonymous.
+                        return ANONYMOUS;
+                    }
+
+                    final int colonIndex = authorizationID.indexOf(':');
+                    if (colonIndex < 0) {
+                        final LocalizableMessage message =
+                                ERR_PROXYAUTH2_INVALID_AUTHZID_TYPE.get(authorizationID);
+                        throw DecodeException.error(message);
+                    }
+
+                    return new ProxiedAuthV2RequestControl(authorizationID);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new proxy authorization v2 request control with the provided
+     * authorization ID. The authorization ID usually has the form "dn:"
+     * immediately followed by the distinguished name of the user, or "u:"
+     * followed by a user ID string, but other forms are permitted.
+     *
+     * @param authorizationID
+     *            The authorization ID of the user whose authorization is to be
+     *            used when performing the operation.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws NullPointerException
+     *             If {@code authorizationName} was {@code null}.
+     */
+    public static final ProxiedAuthV2RequestControl newControl(final String authorizationID) {
+        if (authorizationID.length() == 0) {
+            // Anonymous.
+            return ANONYMOUS;
         }
-        else
-        {
-          authorizationID = control.getValue().toString();
+
+        final int colonIndex = authorizationID.indexOf(':');
+        if (colonIndex < 0) {
+            final LocalizableMessage message =
+                    ERR_PROXYAUTH2_INVALID_AUTHZID_TYPE.get(authorizationID);
+            throw new LocalizedIllegalArgumentException(message);
         }
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("ProxiedAuthV2RequestControl",
-            "decodeControl", e);
 
-        final LocalizableMessage message = ERR_PROXYAUTH2_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
-
-      if (authorizationID.length() == 0)
-      {
-        // Anonymous.
-        return ANONYMOUS;
-      }
-
-      final int colonIndex = authorizationID.indexOf(':');
-      if (colonIndex < 0)
-      {
-        final LocalizableMessage message = ERR_PROXYAUTH2_INVALID_AUTHZID_TYPE
-            .get(authorizationID);
-        throw DecodeException.error(message);
-      }
-
-      return new ProxiedAuthV2RequestControl(authorizationID);
+        return new ProxiedAuthV2RequestControl(authorizationID);
     }
 
+    // The authorization ID from the control value.
+    private final String authorizationID;
 
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new proxy authorization v2 request control with the provided
-   * authorization ID. The authorization ID usually has the form "dn:"
-   * immediately followed by the distinguished name of the user, or "u:"
-   * followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The authorization ID of the user whose authorization is to be used
-   *          when performing the operation.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws NullPointerException
-   *           If {@code authorizationName} was {@code null}.
-   */
-  public static final ProxiedAuthV2RequestControl newControl(
-      final String authorizationID)
-  {
-    if (authorizationID.length() == 0)
-    {
-      // Anonymous.
-      return ANONYMOUS;
+    private ProxiedAuthV2RequestControl(final String authorizationID) {
+        this.authorizationID = authorizationID;
     }
 
-    final int colonIndex = authorizationID.indexOf(':');
-    if (colonIndex < 0)
-    {
-      final LocalizableMessage message = ERR_PROXYAUTH2_INVALID_AUTHZID_TYPE
-          .get(authorizationID);
-      throw new LocalizedIllegalArgumentException(message);
+    /**
+     * Returns the authorization ID of the user whose authorization is to be
+     * used when performing the operation. The authorization ID usually has the
+     * form "dn:" immediately followed by the distinguished name of the user, or
+     * "u:" followed by a user ID string, but other forms are permitted.
+     *
+     * @return The authorization ID of the user whose authorization is to be
+     *         used when performing the operation.
+     */
+    public String getAuthorizationID() {
+        return authorizationID;
     }
 
-    return new ProxiedAuthV2RequestControl(authorizationID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return ByteString.valueOf(authorizationID);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
-  // The authorization ID from the control value.
-  private final String authorizationID;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return true;
+    }
 
-
-
-  private ProxiedAuthV2RequestControl(final String authorizationID)
-  {
-    this.authorizationID = authorizationID;
-  }
-
-
-
-  /**
-   * Returns the authorization ID of the user whose authorization is to be used
-   * when performing the operation. The authorization ID usually has the form
-   * "dn:" immediately followed by the distinguished name of the user, or "u:"
-   * followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user whose authorization is to be used
-   *         when performing the operation.
-   */
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return ByteString.valueOf(authorizationID);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ProxiedAuthorizationV2Control(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", authorizationID=\"");
-    builder.append(authorizationID);
-    builder.append("\")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ProxiedAuthorizationV2Control(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", authorizationID=\"");
+        builder.append(authorizationID);
+        builder.append("\")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java
index 79cc62a..e17868c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,25 +26,30 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.SortKey;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The server-side sort request control as defined in RFC 2891. This control may
  * be included in a search request to indicate that search result entries should
@@ -63,332 +67,271 @@
  * @see <a href="http://tools.ietf.org/html/rfc2891">RFC 2891 - LDAP Control
  *      Extension for Server Side Sorting of Search Results </a>
  */
-public final class ServerSideSortRequestControl implements Control
-{
-  /**
-   * The OID for the server-side sort request control.
-   */
-  public static final String OID = "1.2.840.113556.1.4.473";
+public final class ServerSideSortRequestControl implements Control {
+    /**
+     * The OID for the server-side sort request control.
+     */
+    public static final String OID = "1.2.840.113556.1.4.473";
 
-  /**
-   * The BER type to use when encoding the orderingRule element.
-   */
-  private static final byte TYPE_ORDERING_RULE_ID = (byte) 0x80;
+    /**
+     * The BER type to use when encoding the orderingRule element.
+     */
+    private static final byte TYPE_ORDERING_RULE_ID = (byte) 0x80;
 
-  /**
-   * The BER type to use when encoding the reverseOrder element.
-   */
-  private static final byte TYPE_REVERSE_ORDER = (byte) 0x81;
+    /**
+     * The BER type to use when encoding the reverseOrder element.
+     */
+    private static final byte TYPE_REVERSE_ORDER = (byte) 0x81;
 
-  /**
-   * A decoder which can be used for decoding the server side sort request
-   * control.
-   */
-  public static final ControlDecoder<ServerSideSortRequestControl> DECODER =
-    new ControlDecoder<ServerSideSortRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the server side sort request
+     * control.
+     */
+    public static final ControlDecoder<ServerSideSortRequestControl> DECODER =
+            new ControlDecoder<ServerSideSortRequestControl>() {
 
-    public ServerSideSortRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public ServerSideSortRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof ServerSideSortRequestControl)
-      {
-        return (ServerSideSortRequestControl) control;
-      }
+                    if (control instanceof ServerSideSortRequestControl) {
+                        return (ServerSideSortRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_SORTREQ_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_SORTREQ_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The request control must always have a value.
-        final LocalizableMessage message = INFO_SORTREQ_CONTROL_NO_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The request control must always have a value.
+                        final LocalizableMessage message = INFO_SORTREQ_CONTROL_NO_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
-        if (!reader.hasNextElement())
-        {
-          final LocalizableMessage message = INFO_SORTREQ_CONTROL_NO_SORT_KEYS
-              .get();
-          throw DecodeException.error(message);
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
+                        if (!reader.hasNextElement()) {
+                            final LocalizableMessage message =
+                                    INFO_SORTREQ_CONTROL_NO_SORT_KEYS.get();
+                            throw DecodeException.error(message);
+                        }
+
+                        final List<SortKey> keys = new LinkedList<SortKey>();
+                        while (reader.hasNextElement()) {
+                            reader.readStartSequence();
+                            final String attrName = reader.readOctetStringAsString();
+
+                            String orderingRule = null;
+                            boolean reverseOrder = false;
+                            if (reader.hasNextElement()
+                                    && (reader.peekType() == TYPE_ORDERING_RULE_ID)) {
+                                orderingRule = reader.readOctetStringAsString();
+                            }
+                            if (reader.hasNextElement()
+                                    && (reader.peekType() == TYPE_REVERSE_ORDER)) {
+                                reverseOrder = reader.readBoolean();
+                            }
+                            reader.readEndSequence();
+
+                            keys.add(new SortKey(attrName, reverseOrder, orderingRule));
+                        }
+                        reader.readEndSequence();
+
+                        return new ServerSideSortRequestControl(control.isCritical(), Collections
+                                .unmodifiableList(keys));
+                    } catch (final IOException e) {
+                        final LocalizableMessage message =
+                                INFO_SORTREQ_CONTROL_CANNOT_DECODE_VALUE
+                                        .get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new server side sort request control with the provided
+     * criticality and list of sort keys.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param keys
+     *            The list of sort keys.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code keys} was empty.
+     * @throws NullPointerException
+     *             If {@code keys} was {@code null}.
+     */
+    public static ServerSideSortRequestControl newControl(final boolean isCritical,
+            final Collection<SortKey> keys) {
+        Validator.ensureNotNull(keys);
+        Validator.ensureTrue(!keys.isEmpty(), "keys must not be empty");
+
+        return new ServerSideSortRequestControl(isCritical, Collections
+                .unmodifiableList(new ArrayList<SortKey>(keys)));
+    }
+
+    /**
+     * Creates a new server side sort request control with the provided
+     * criticality and list of sort keys.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param firstKey
+     *            The first sort key.
+     * @param remainingKeys
+     *            The remaining sort keys.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code firstKey} was {@code null}.
+     */
+    public static ServerSideSortRequestControl newControl(final boolean isCritical,
+            final SortKey firstKey, final SortKey... remainingKeys) {
+        Validator.ensureNotNull(firstKey, remainingKeys);
+
+        final List<SortKey> keys = new ArrayList<SortKey>(1 + remainingKeys.length);
+        keys.add(firstKey);
+        for (final SortKey key : remainingKeys) {
+            keys.add(key);
         }
+        return new ServerSideSortRequestControl(isCritical, Collections.unmodifiableList(keys));
+    }
+
+    /**
+     * Creates a new server side sort request control with the provided
+     * criticality and string representation of a list of sort keys. The string
+     * representation is comprised of a comma separate list of sort keys as
+     * defined in {@link SortKey#valueOf(String)}. There must be at least one
+     * sort key present in the string representation.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param sortKeys
+     *            The list of sort keys.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code sortKeys} is not a valid string representation of a
+     *             list of sort keys.
+     * @throws NullPointerException
+     *             If {@code sortKeys} was {@code null}.
+     */
+    public static ServerSideSortRequestControl newControl(final boolean isCritical,
+            final String sortKeys) {
+        Validator.ensureNotNull(sortKeys);
 
         final List<SortKey> keys = new LinkedList<SortKey>();
-        while (reader.hasNextElement())
-        {
-          reader.readStartSequence();
-          final String attrName = reader.readOctetStringAsString();
-
-          String orderingRule = null;
-          boolean reverseOrder = false;
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_ORDERING_RULE_ID))
-          {
-            orderingRule = reader.readOctetStringAsString();
-          }
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_REVERSE_ORDER))
-          {
-            reverseOrder = reader.readBoolean();
-          }
-          reader.readEndSequence();
-
-          keys.add(new SortKey(attrName, reverseOrder, orderingRule));
+        final StringTokenizer tokenizer = new StringTokenizer(sortKeys, ",");
+        while (tokenizer.hasMoreTokens()) {
+            final String token = tokenizer.nextToken().trim();
+            keys.add(SortKey.valueOf(token));
         }
-        reader.readEndSequence();
-
-        return new ServerSideSortRequestControl(control.isCritical(),
-            Collections.unmodifiableList(keys));
-      }
-      catch (final IOException e)
-      {
-        final LocalizableMessage message = INFO_SORTREQ_CONTROL_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
-    }
-
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-
-
-  /**
-   * Creates a new server side sort request control with the provided
-   * criticality and list of sort keys.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param keys
-   *          The list of sort keys.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code keys} was empty.
-   * @throws NullPointerException
-   *           If {@code keys} was {@code null}.
-   */
-  public static ServerSideSortRequestControl newControl(
-      final boolean isCritical, final Collection<SortKey> keys)
-  {
-    Validator.ensureNotNull(keys);
-    Validator.ensureTrue(!keys.isEmpty(), "keys must not be empty");
-
-    return new ServerSideSortRequestControl(isCritical, Collections
-        .unmodifiableList(new ArrayList<SortKey>(keys)));
-  }
-
-
-
-  /**
-   * Creates a new server side sort request control with the provided
-   * criticality and list of sort keys.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param firstKey
-   *          The first sort key.
-   * @param remainingKeys
-   *          The remaining sort keys.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code firstKey} was {@code null}.
-   */
-  public static ServerSideSortRequestControl newControl(
-      final boolean isCritical, final SortKey firstKey,
-      final SortKey... remainingKeys)
-  {
-    Validator.ensureNotNull(firstKey, remainingKeys);
-
-    final List<SortKey> keys = new ArrayList<SortKey>(1 + remainingKeys.length);
-    keys.add(firstKey);
-    for (final SortKey key : remainingKeys)
-    {
-      keys.add(key);
-    }
-    return new ServerSideSortRequestControl(isCritical, Collections
-        .unmodifiableList(keys));
-  }
-
-
-
-  /**
-   * Creates a new server side sort request control with the provided
-   * criticality and string representation of a list of sort keys. The string
-   * representation is comprised of a comma separate list of sort keys as
-   * defined in {@link SortKey#valueOf(String)}. There must be at least one sort
-   * key present in the string representation.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param sortKeys
-   *          The list of sort keys.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code sortKeys} is not a valid string representation of a
-   *           list of sort keys.
-   * @throws NullPointerException
-   *           If {@code sortKeys} was {@code null}.
-   */
-  public static ServerSideSortRequestControl newControl(
-      final boolean isCritical, final String sortKeys)
-  {
-    Validator.ensureNotNull(sortKeys);
-
-    final List<SortKey> keys = new LinkedList<SortKey>();
-    final StringTokenizer tokenizer = new StringTokenizer(sortKeys, ",");
-    while (tokenizer.hasMoreTokens())
-    {
-      final String token = tokenizer.nextToken().trim();
-      keys.add(SortKey.valueOf(token));
-    }
-    if (keys.isEmpty())
-    {
-      final LocalizableMessage message = ERR_SORT_KEY_NO_SORT_KEYS
-          .get(sortKeys);
-      throw new LocalizedIllegalArgumentException(message);
-    }
-    return new ServerSideSortRequestControl(isCritical, Collections
-        .unmodifiableList(keys));
-  }
-
-
-
-  private final List<SortKey> sortKeys;
-
-  private final boolean isCritical;
-
-
-
-  private ServerSideSortRequestControl(final boolean isCritical,
-      final List<SortKey> keys)
-  {
-    this.isCritical = isCritical;
-    this.sortKeys = keys;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the sort keys associated with this
-   * server side sort request control. The list will contain at least one sort
-   * key.
-   *
-   * @return An unmodifiable list containing the sort keys associated with this
-   *         server side sort request control.
-   */
-  public List<SortKey> getSortKeys()
-  {
-    return sortKeys;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      for (final SortKey sortKey : sortKeys)
-      {
-        writer.writeStartSequence();
-        writer.writeOctetString(sortKey.getAttributeDescription());
-
-        if (sortKey.getOrderingMatchingRule() != null)
-        {
-          writer.writeOctetString(TYPE_ORDERING_RULE_ID, sortKey
-              .getOrderingMatchingRule());
+        if (keys.isEmpty()) {
+            final LocalizableMessage message = ERR_SORT_KEY_NO_SORT_KEYS.get(sortKeys);
+            throw new LocalizedIllegalArgumentException(message);
         }
+        return new ServerSideSortRequestControl(isCritical, Collections.unmodifiableList(keys));
+    }
 
-        if (!sortKey.isReverseOrder())
-        {
-          writer.writeBoolean(TYPE_REVERSE_ORDER, true);
+    private final List<SortKey> sortKeys;
+
+    private final boolean isCritical;
+
+    private ServerSideSortRequestControl(final boolean isCritical, final List<SortKey> keys) {
+        this.isCritical = isCritical;
+        this.sortKeys = keys;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * Returns an unmodifiable list containing the sort keys associated with
+     * this server side sort request control. The list will contain at least one
+     * sort key.
+     *
+     * @return An unmodifiable list containing the sort keys associated with
+     *         this server side sort request control.
+     */
+    public List<SortKey> getSortKeys() {
+        return sortKeys;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            for (final SortKey sortKey : sortKeys) {
+                writer.writeStartSequence();
+                writer.writeOctetString(sortKey.getAttributeDescription());
+
+                if (sortKey.getOrderingMatchingRule() != null) {
+                    writer.writeOctetString(TYPE_ORDERING_RULE_ID, sortKey
+                            .getOrderingMatchingRule());
+                }
+
+                if (!sortKey.isReverseOrder()) {
+                    writer.writeBoolean(TYPE_REVERSE_ORDER, true);
+                }
+
+                writer.writeEndSequence();
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-
-        writer.writeEndSequence();
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder buffer = new StringBuilder();
-    buffer.append("ServerSideSortRequestControl(oid=");
-    buffer.append(getOID());
-    buffer.append(", criticality=");
-    buffer.append(isCritical());
-    buffer.append(", sortKeys=");
-    buffer.append(sortKeys);
-    buffer.append(")");
-    return buffer.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder buffer = new StringBuilder();
+        buffer.append("ServerSideSortRequestControl(oid=");
+        buffer.append(getOID());
+        buffer.append(", criticality=");
+        buffer.append(isCritical());
+        buffer.append(", sortKeys=");
+        buffer.append(sortKeys);
+        buffer.append(")");
+        return buffer.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java
index c1678f9..865e85e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_SORTRES_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE;
@@ -41,13 +38,16 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The server-side sort response control as defined in RFC 2891. This control is
  * included with a search result in response to a server-side sort request
@@ -61,316 +61,262 @@
  * @see <a href="http://tools.ietf.org/html/rfc2891">RFC 2891 - LDAP Control
  *      Extension for Server Side Sorting of Search Results </a>
  */
-public final class ServerSideSortResponseControl implements Control
-{
-  /**
-   * The OID for the server-side sort response control.
-   */
-  public static final String OID = "1.2.840.113556.1.4.474";
+public final class ServerSideSortResponseControl implements Control {
+    /**
+     * The OID for the server-side sort response control.
+     */
+    public static final String OID = "1.2.840.113556.1.4.474";
 
-  /**
-   * A decoder which can be used for decoding the server side sort response
-   * control.
-   */
-  public static final ControlDecoder<ServerSideSortResponseControl> DECODER =
-    new ControlDecoder<ServerSideSortResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the server side sort response
+     * control.
+     */
+    public static final ControlDecoder<ServerSideSortResponseControl> DECODER =
+            new ControlDecoder<ServerSideSortResponseControl>() {
 
-    public ServerSideSortResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control, options);
+                public ServerSideSortResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control, options);
 
-      if (control instanceof ServerSideSortResponseControl)
-      {
-        return (ServerSideSortResponseControl) control;
-      }
+                    if (control instanceof ServerSideSortResponseControl) {
+                        return (ServerSideSortResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_SORTRES_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_SORTRES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The request control must always have a value.
-        final LocalizableMessage message = INFO_SORTRES_CONTROL_NO_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The request control must always have a value.
+                        final LocalizableMessage message = INFO_SORTRES_CONTROL_NO_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
 
-        // FIXME: should really check that result code is one of the expected
-        // values listed in the RFC.
-        final ResultCode result = ResultCode.valueOf(reader.readEnumerated());
+                        // FIXME: should really check that result code is one of
+                        // the expected
+                        // values listed in the RFC.
+                        final ResultCode result = ResultCode.valueOf(reader.readEnumerated());
 
-        AttributeDescription attributeDescription = null;
-        if (reader.hasNextElement())
-        {
-          // FIXME: which schema should we use?
-          final Schema schema = options.getSchemaResolver().resolveSchema("");
-          final String ads = reader.readOctetStringAsString();
-          attributeDescription = AttributeDescription.valueOf(ads, schema);
+                        AttributeDescription attributeDescription = null;
+                        if (reader.hasNextElement()) {
+                            // FIXME: which schema should we use?
+                            final Schema schema = options.getSchemaResolver().resolveSchema("");
+                            final String ads = reader.readOctetStringAsString();
+                            attributeDescription = AttributeDescription.valueOf(ads, schema);
+                        }
+
+                        return new ServerSideSortResponseControl(control.isCritical(), result,
+                                attributeDescription);
+                    } catch (final IOException e) {
+                        final LocalizableMessage message =
+                                INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
+                                        .get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    } catch (final LocalizedIllegalArgumentException e) {
+                        final LocalizableMessage message =
+                                INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
+                                        .get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * The BER type to use when encoding the attribute type element.
+     */
+    private static final byte TYPE_ATTRIBUTE_TYPE = (byte) 0x80;
+
+    /**
+     * Creates a new server-side response control with the provided sort result
+     * and no attribute description.
+     *
+     * @param result
+     *            The result code indicating the outcome of the server-side sort
+     *            request. {@link ResultCode#SUCCESS} if the search results were
+     *            sorted in accordance with the keys specified in the
+     *            server-side sort request control, or an error code indicating
+     *            why the results could not be sorted (such as
+     *            {@link ResultCode#NO_SUCH_ATTRIBUTE} or
+     *            {@link ResultCode#INAPPROPRIATE_MATCHING}).
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static ServerSideSortResponseControl newControl(final ResultCode result) {
+        Validator.ensureNotNull(result);
+
+        return new ServerSideSortResponseControl(false, result, null);
+    }
+
+    /**
+     * Creates a new server-side response control with the provided sort result
+     * and attribute description.
+     *
+     * @param result
+     *            The result code indicating the outcome of the server-side sort
+     *            request. {@link ResultCode#SUCCESS} if the search results were
+     *            sorted in accordance with the keys specified in the
+     *            server-side sort request control, or an error code indicating
+     *            why the results could not be sorted (such as
+     *            {@link ResultCode#NO_SUCH_ATTRIBUTE} or
+     *            {@link ResultCode#INAPPROPRIATE_MATCHING}).
+     * @param attributeDescription
+     *            The first attribute description specified in the list of sort
+     *            keys that was in error, may be {@code null}.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static ServerSideSortResponseControl newControl(final ResultCode result,
+            final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(result);
+
+        return new ServerSideSortResponseControl(false, result, attributeDescription);
+    }
+
+    /**
+     * Creates a new server-side response control with the provided sort result
+     * and attribute description. The attribute description will be decoded
+     * using the default schema.
+     *
+     * @param result
+     *            The result code indicating the outcome of the server-side sort
+     *            request. {@link ResultCode#SUCCESS} if the search results were
+     *            sorted in accordance with the keys specified in the
+     *            server-side sort request control, or an error code indicating
+     *            why the results could not be sorted (such as
+     *            {@link ResultCode#NO_SUCH_ATTRIBUTE} or
+     *            {@link ResultCode#INAPPROPRIATE_MATCHING}).
+     * @param attributeDescription
+     *            The first attribute description specified in the list of sort
+     *            keys that was in error, may be {@code null}.
+     * @return The new control.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be parsed using the
+     *             default schema.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static ServerSideSortResponseControl newControl(final ResultCode result,
+            final String attributeDescription) {
+        Validator.ensureNotNull(result);
+
+        if (attributeDescription != null) {
+            return new ServerSideSortResponseControl(false, result, AttributeDescription
+                    .valueOf(attributeDescription));
+        } else {
+            return new ServerSideSortResponseControl(false, result, null);
         }
-
-        return new ServerSideSortResponseControl(control.isCritical(), result,
-            attributeDescription);
-      }
-      catch (final IOException e)
-      {
-        final LocalizableMessage message = INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage message = INFO_SORTRES_CONTROL_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
     }
 
+    private final ResultCode result;
 
+    private final AttributeDescription attributeDescription;
 
-    public String getOID()
-    {
-      return OID;
+    private final boolean isCritical;
+
+    private ServerSideSortResponseControl(final boolean isCritical, final ResultCode result,
+            final AttributeDescription attributeDescription) {
+        this.isCritical = isCritical;
+        this.result = result;
+        this.attributeDescription = attributeDescription;
     }
-  };
 
-  /**
-   * The BER type to use when encoding the attribute type element.
-   */
-  private static final byte TYPE_ATTRIBUTE_TYPE = (byte) 0x80;
-
-
-
-  /**
-   * Creates a new server-side response control with the provided sort result
-   * and no attribute description.
-   *
-   * @param result
-   *          The result code indicating the outcome of the server-side sort
-   *          request. {@link ResultCode#SUCCESS} if the search results were
-   *          sorted in accordance with the keys specified in the server-side
-   *          sort request control, or an error code indicating why the results
-   *          could not be sorted (such as {@link ResultCode#NO_SUCH_ATTRIBUTE}
-   *          or {@link ResultCode#INAPPROPRIATE_MATCHING}).
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static ServerSideSortResponseControl newControl(final ResultCode result)
-  {
-    Validator.ensureNotNull(result);
-
-    return new ServerSideSortResponseControl(false, result, null);
-  }
-
-
-
-  /**
-   * Creates a new server-side response control with the provided sort result
-   * and attribute description.
-   *
-   * @param result
-   *          The result code indicating the outcome of the server-side sort
-   *          request. {@link ResultCode#SUCCESS} if the search results were
-   *          sorted in accordance with the keys specified in the server-side
-   *          sort request control, or an error code indicating why the results
-   *          could not be sorted (such as {@link ResultCode#NO_SUCH_ATTRIBUTE}
-   *          or {@link ResultCode#INAPPROPRIATE_MATCHING}).
-   * @param attributeDescription
-   *          The first attribute description specified in the list of sort keys
-   *          that was in error, may be {@code null}.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static ServerSideSortResponseControl newControl(
-      final ResultCode result, final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(result);
-
-    return new ServerSideSortResponseControl(false, result,
-        attributeDescription);
-  }
-
-
-
-  /**
-   * Creates a new server-side response control with the provided sort result
-   * and attribute description. The attribute description will be decoded using
-   * the default schema.
-   *
-   * @param result
-   *          The result code indicating the outcome of the server-side sort
-   *          request. {@link ResultCode#SUCCESS} if the search results were
-   *          sorted in accordance with the keys specified in the server-side
-   *          sort request control, or an error code indicating why the results
-   *          could not be sorted (such as {@link ResultCode#NO_SUCH_ATTRIBUTE}
-   *          or {@link ResultCode#INAPPROPRIATE_MATCHING}).
-   * @param attributeDescription
-   *          The first attribute description specified in the list of sort keys
-   *          that was in error, may be {@code null}.
-   * @return The new control.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be parsed using the
-   *           default schema.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static ServerSideSortResponseControl newControl(
-      final ResultCode result, final String attributeDescription)
-  {
-    Validator.ensureNotNull(result);
-
-    if (attributeDescription != null)
-    {
-      return new ServerSideSortResponseControl(false, result,
-          AttributeDescription.valueOf(attributeDescription));
+    /**
+     * Returns the first attribute description specified in the list of sort
+     * keys that was in error, or {@code null} if the attribute description was
+     * not included with this control.
+     *
+     * @return The first attribute description specified in the list of sort
+     *         keys that was in error.
+     */
+    public AttributeDescription getAttributeDescription() {
+        return attributeDescription;
     }
-    else
-    {
-      return new ServerSideSortResponseControl(false, result, null);
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
     }
-  }
 
-
-
-  private final ResultCode result;
-
-  private final AttributeDescription attributeDescription;
-
-  private final boolean isCritical;
-
-
-
-  private ServerSideSortResponseControl(final boolean isCritical,
-      final ResultCode result, final AttributeDescription attributeDescription)
-  {
-    this.isCritical = isCritical;
-    this.result = result;
-    this.attributeDescription = attributeDescription;
-  }
-
-
-
-  /**
-   * Returns the first attribute description specified in the list of sort keys
-   * that was in error, or {@code null} if the attribute description was not
-   * included with this control.
-   *
-   * @return The first attribute description specified in the list of sort keys
-   *         that was in error.
-   */
-  public AttributeDescription getAttributeDescription()
-  {
-    return attributeDescription;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns a result code indicating the outcome of the server-side sort
-   * request. This will be {@link ResultCode#SUCCESS} if the search results were
-   * sorted in accordance with the keys specified in the server-side sort
-   * request control, or an error code indicating why the results could not be
-   * sorted (such as {@link ResultCode#NO_SUCH_ATTRIBUTE} or
-   * {@link ResultCode#INAPPROPRIATE_MATCHING}).
-   *
-   * @return The result code indicating the outcome of the server-side sort
-   *         request.
-   */
-  public ResultCode getResult()
-  {
-    return result;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeEnumerated(result.intValue());
-      if (attributeDescription != null)
-      {
-        writer.writeOctetString(TYPE_ATTRIBUTE_TYPE, attributeDescription
-            .toString());
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    /**
+     * Returns a result code indicating the outcome of the server-side sort
+     * request. This will be {@link ResultCode#SUCCESS} if the search results
+     * were sorted in accordance with the keys specified in the server-side sort
+     * request control, or an error code indicating why the results could not be
+     * sorted (such as {@link ResultCode#NO_SUCH_ATTRIBUTE} or
+     * {@link ResultCode#INAPPROPRIATE_MATCHING}).
+     *
+     * @return The result code indicating the outcome of the server-side sort
+     *         request.
+     */
+    public ResultCode getResult() {
+        return result;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeEnumerated(result.intValue());
+            if (attributeDescription != null) {
+                writer.writeOctetString(TYPE_ATTRIBUTE_TYPE, attributeDescription.toString());
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
     }
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ServerSideSortResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", result=");
-    builder.append(result);
-    if (attributeDescription != null)
-    {
-      builder.append(", attributeDescription=");
-      builder.append(attributeDescription);
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ServerSideSortResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", result=");
+        builder.append(result);
+        if (attributeDescription != null) {
+            builder.append(", attributeDescription=");
+            builder.append(attributeDescription);
+        }
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
index d49abe1..26fdad1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
@@ -45,8 +42,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The simple paged results request and response control as defined in RFC 2696.
  * This control allows a client to control the rate at which an LDAP server
@@ -70,280 +65,225 @@
  * @see <a href="http://tools.ietf.org/html/rfc2696">RFC 2696 - LDAP Control
  *      Extension for Simple Paged Results Manipulation </a>
  */
-public final class SimplePagedResultsControl implements Control
-{
-  /**
-   * The OID for the paged results request/response control defined in RFC 2696.
-   */
-  public static final String OID = "1.2.840.113556.1.4.319";
+public final class SimplePagedResultsControl implements Control {
+    /**
+     * The OID for the paged results request/response control defined in RFC
+     * 2696.
+     */
+    public static final String OID = "1.2.840.113556.1.4.319";
 
-  /**
-   * A decoder which can be used for decoding the simple paged results control.
-   */
-  public static final ControlDecoder<SimplePagedResultsControl> DECODER =
-    new ControlDecoder<SimplePagedResultsControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the simple paged results
+     * control.
+     */
+    public static final ControlDecoder<SimplePagedResultsControl> DECODER =
+            new ControlDecoder<SimplePagedResultsControl>() {
 
-    public SimplePagedResultsControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public SimplePagedResultsControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof SimplePagedResultsControl)
-      {
-        return (SimplePagedResultsControl) control;
-      }
+                    if (control instanceof SimplePagedResultsControl) {
+                        return (SimplePagedResultsControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The control must always have a value.
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_NULL
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The control must always have a value.
+                        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_NULL.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
-      }
-      catch (final Exception e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode",
-            e);
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
+                    } catch (final Exception e) {
+                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
 
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE
-            .get(String.valueOf(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      int size;
-      try
-      {
-        size = (int) reader.readInteger();
-      }
-      catch (final Exception e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode",
-            e);
+                    int size;
+                    try {
+                        size = (int) reader.readInteger();
+                    } catch (final Exception e) {
+                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
 
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_SIZE
-            .get(String.valueOf(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(String.valueOf(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      ByteString cookie;
-      try
-      {
-        cookie = reader.readOctetString();
-      }
-      catch (final Exception e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode",
-            e);
+                    ByteString cookie;
+                    try {
+                        cookie = reader.readOctetString();
+                    } catch (final Exception e) {
+                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
 
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE
-            .get(String.valueOf(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(String.valueOf(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      try
-      {
-        reader.readEndSequence();
-      }
-      catch (final Exception e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode",
-            e);
+                    try {
+                        reader.readEndSequence();
+                    } catch (final Exception e) {
+                        StaticUtils.DEBUG_LOG.throwing("PagedResultsControl.Decoder", "decode", e);
 
-        final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE
-            .get(String.valueOf(e));
-        throw DecodeException.error(message, e);
-      }
+                        final LocalizableMessage message =
+                                ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e));
+                        throw DecodeException.error(message, e);
+                    }
 
-      return new SimplePagedResultsControl(control.isCritical(), size, cookie);
+                    return new SimplePagedResultsControl(control.isCritical(), size, cookie);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new simple paged results control with the provided criticality,
+     * size, and cookie.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param size
+     *            The requested page size when used in a request control from
+     *            the client, or an estimate of the result set size when used in
+     *            a response control from the server (may be 0, indicating that
+     *            the server does not know).
+     * @param cookie
+     *            An opaque cookie which is used by the server to track its
+     *            position in the set of search results. The cookie must be
+     *            empty in the initial search request sent by the client. For
+     *            subsequent search requests the client must include the cookie
+     *            returned with the previous search result, until the server
+     *            returns an empty cookie indicating that the final page of
+     *            results has been returned.
+     * @return The new control.
+     * @throws NullPointerException
+     *             If {@code cookie} was {@code null}.
+     */
+    public static SimplePagedResultsControl newControl(final boolean isCritical, final int size,
+            final ByteString cookie) {
+        Validator.ensureNotNull(cookie);
+        return new SimplePagedResultsControl(isCritical, size, cookie);
     }
 
+    /**
+     * The control value size element, which is either the requested page size
+     * from the client, or the result set size estimate from the server.
+     */
+    private final int size;
 
+    /**
+     * The control value cookie element.
+     */
+    private final ByteString cookie;
 
-    public String getOID()
-    {
-      return OID;
+    private final boolean isCritical;
+
+    private SimplePagedResultsControl(final boolean isCritical, final int size,
+            final ByteString cookie) {
+        this.isCritical = isCritical;
+        this.size = size;
+        this.cookie = cookie;
     }
-  };
 
-
-
-  /**
-   * Creates a new simple paged results control with the provided criticality,
-   * size, and cookie.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param size
-   *          The requested page size when used in a request control from the
-   *          client, or an estimate of the result set size when used in a
-   *          response control from the server (may be 0, indicating that the
-   *          server does not know).
-   * @param cookie
-   *          An opaque cookie which is used by the server to track its position
-   *          in the set of search results. The cookie must be empty in the
-   *          initial search request sent by the client. For subsequent search
-   *          requests the client must include the cookie returned with the
-   *          previous search result, until the server returns an empty cookie
-   *          indicating that the final page of results has been returned.
-   * @return The new control.
-   * @throws NullPointerException
-   *           If {@code cookie} was {@code null}.
-   */
-  public static SimplePagedResultsControl newControl(final boolean isCritical,
-      final int size, final ByteString cookie)
-  {
-    Validator.ensureNotNull(cookie);
-    return new SimplePagedResultsControl(isCritical, size, cookie);
-  }
-
-
-
-  /**
-   * The control value size element, which is either the requested page size
-   * from the client, or the result set size estimate from the server.
-   */
-  private final int size;
-
-  /**
-   * The control value cookie element.
-   */
-  private final ByteString cookie;
-
-  private final boolean isCritical;
-
-
-
-  private SimplePagedResultsControl(final boolean isCritical, final int size,
-      final ByteString cookie)
-  {
-    this.isCritical = isCritical;
-    this.size = size;
-    this.cookie = cookie;
-  }
-
-
-
-  /**
-   * Returns the opaque cookie which is used by the server to track its position
-   * in the set of search results. The cookie must be empty in the initial
-   * search request sent by the client. For subsequent search requests the
-   * client must include the cookie returned with the previous search result,
-   * until the server returns an empty cookie indicating that the final page of
-   * results has been returned.
-   *
-   * @return The opaque cookie which is used by the server to track its position
-   *         in the set of search results.
-   */
-  public ByteString getCookie()
-  {
-    return cookie;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns the requested page size when used in a request control from the
-   * client, or an estimate of the result set size when used in a response
-   * control from the server (may be 0, indicating that the server does not
-   * know).
-   *
-   * @return The requested page size when used in a request control from the
-   *         client, or an estimate of the result set size when used in a
-   *         response control from the server.
-   */
-  public int getSize()
-  {
-    return size;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeInteger(size);
-      writer.writeOctetString(cookie);
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    /**
+     * Returns the opaque cookie which is used by the server to track its
+     * position in the set of search results. The cookie must be empty in the
+     * initial search request sent by the client. For subsequent search requests
+     * the client must include the cookie returned with the previous search
+     * result, until the server returns an empty cookie indicating that the
+     * final page of results has been returned.
+     *
+     * @return The opaque cookie which is used by the server to track its
+     *         position in the set of search results.
+     */
+    public ByteString getCookie() {
+        return cookie;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
     }
-  }
 
+    /**
+     * Returns the requested page size when used in a request control from the
+     * client, or an estimate of the result set size when used in a response
+     * control from the server (may be 0, indicating that the server does not
+     * know).
+     *
+     * @return The requested page size when used in a request control from the
+     *         client, or an estimate of the result set size when used in a
+     *         response control from the server.
+     */
+    public int getSize() {
+        return size;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeInteger(size);
+            writer.writeOctetString(cookie);
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SimplePagedResultsControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", size=");
-    builder.append(size);
-    builder.append(", cookie=");
-    builder.append(cookie);
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SimplePagedResultsControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", size=");
+        builder.append(size);
+        builder.append(", cookie=");
+        builder.append(cookie);
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java
index cd49828..da85f1d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,10 +26,10 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_SUBENTRIES_CANNOT_DECODE_VALUE;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_SUBENTRIES_CONTROL_BAD_OID;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_SUBENTRIES_NO_CONTROL_VALUE;
 
 import java.io.IOException;
 
@@ -44,8 +43,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The sub-entries request control as defined in RFC 3672. This control may be
  * included in a search request to indicate that sub-entries should be included
@@ -59,197 +56,152 @@
  * @see <a href="http://tools.ietf.org/html/rfc3672">RFC 3672 - Subentries in
  *      the Lightweight Directory Access Protocol </a>
  */
-public final class SubentriesRequestControl implements Control
-{
-  /**
-   * The OID for the sub-entries request control.
-   */
-  public static final String OID = "1.3.6.1.4.1.4203.1.10.1";
+public final class SubentriesRequestControl implements Control {
+    /**
+     * The OID for the sub-entries request control.
+     */
+    public static final String OID = "1.3.6.1.4.1.4203.1.10.1";
 
-  private static final SubentriesRequestControl CRITICAL_VISIBLE_INSTANCE =
-    new SubentriesRequestControl(true, true);
-  private static final SubentriesRequestControl NONCRITICAL_VISIBLE_INSTANCE =
-    new SubentriesRequestControl(false, true);
-  private static final SubentriesRequestControl CRITICAL_INVISIBLE_INSTANCE =
-    new SubentriesRequestControl(true, false);
-  private static final SubentriesRequestControl NONCRITICAL_INVISIBLE_INSTANCE =
-    new SubentriesRequestControl(false, false);
+    private static final SubentriesRequestControl CRITICAL_VISIBLE_INSTANCE =
+            new SubentriesRequestControl(true, true);
+    private static final SubentriesRequestControl NONCRITICAL_VISIBLE_INSTANCE =
+            new SubentriesRequestControl(false, true);
+    private static final SubentriesRequestControl CRITICAL_INVISIBLE_INSTANCE =
+            new SubentriesRequestControl(true, false);
+    private static final SubentriesRequestControl NONCRITICAL_INVISIBLE_INSTANCE =
+            new SubentriesRequestControl(false, false);
 
-  /**
-   * A decoder which can be used for decoding the sub-entries request control.
-   */
-  public static final ControlDecoder<SubentriesRequestControl> DECODER =
-    new ControlDecoder<SubentriesRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the sub-entries request control.
+     */
+    public static final ControlDecoder<SubentriesRequestControl> DECODER =
+            new ControlDecoder<SubentriesRequestControl>() {
 
-    public SubentriesRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public SubentriesRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof SubentriesRequestControl)
-      {
-        return (SubentriesRequestControl) control;
-      }
+                    if (control instanceof SubentriesRequestControl) {
+                        return (SubentriesRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_SUBENTRIES_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_SUBENTRIES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = ERR_SUBENTRIES_NO_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = ERR_SUBENTRIES_NO_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      final boolean visibility;
-      try
-      {
-        visibility = reader.readBoolean();
-      }
-      catch (final IOException e)
-      {
-        StaticUtils.DEBUG_LOG.throwing("SubentriesRequestControl.Decoder",
-            "decode", e);
-        final LocalizableMessage message = ERR_SUBENTRIES_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message);
-      }
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    final boolean visibility;
+                    try {
+                        visibility = reader.readBoolean();
+                    } catch (final IOException e) {
+                        StaticUtils.DEBUG_LOG.throwing("SubentriesRequestControl.Decoder",
+                                "decode", e);
+                        final LocalizableMessage message =
+                                ERR_SUBENTRIES_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message);
+                    }
 
-      return newControl(control.isCritical(), visibility);
+                    return newControl(control.isCritical(), visibility);
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new sub-entries request control having the provided criticality
+     * and sub-entry visibility.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param visibility
+     *            {@code true} if sub-entries should be included in the search
+     *            results and normal entries excluded, or {@code false} if
+     *            normal entries should be included and sub-entries excluded.
+     * @return The new control.
+     */
+    public static SubentriesRequestControl newControl(final boolean isCritical,
+            final boolean visibility) {
+        if (isCritical) {
+            return visibility ? CRITICAL_VISIBLE_INSTANCE : CRITICAL_INVISIBLE_INSTANCE;
+        } else {
+            return visibility ? NONCRITICAL_VISIBLE_INSTANCE : NONCRITICAL_INVISIBLE_INSTANCE;
+        }
     }
 
+    private final boolean isCritical;
+    private final boolean visibility;
 
-
-    public String getOID()
-    {
-      return OID;
+    private SubentriesRequestControl(final boolean isCritical, final boolean visibility) {
+        this.isCritical = isCritical;
+        this.visibility = visibility;
     }
-  };
 
-
-
-  /**
-   * Creates a new sub-entries request control having the provided criticality
-   * and sub-entry visibility.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param visibility
-   *          {@code true} if sub-entries should be included in the search
-   *          results and normal entries excluded, or {@code false} if normal
-   *          entries should be included and sub-entries excluded.
-   * @return The new control.
-   */
-  public static SubentriesRequestControl newControl(final boolean isCritical,
-      final boolean visibility)
-  {
-    if (isCritical)
-    {
-      return visibility ? CRITICAL_VISIBLE_INSTANCE
-          : CRITICAL_INVISIBLE_INSTANCE;
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
     }
-    else
-    {
-      return visibility ? NONCRITICAL_VISIBLE_INSTANCE
-          : NONCRITICAL_INVISIBLE_INSTANCE;
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
     }
-  }
 
+    /**
+     * Returns a boolean indicating whether or not sub-entries should be
+     * included in the search results.
+     *
+     * @return {@code true} if sub-entries should be included in the search
+     *         results and normal entries excluded, or {@code false} if normal
+     *         entries should be included and sub-entries excluded.
+     */
+    public boolean getVisibility() {
+        return visibility;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
-  private final boolean isCritical;
-  private final boolean visibility;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-
-  private SubentriesRequestControl(final boolean isCritical,
-      final boolean visibility)
-  {
-    this.isCritical = isCritical;
-    this.visibility = visibility;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * Returns a boolean indicating whether or not sub-entries should be included
-   * in the search results.
-   *
-   * @return {@code true} if sub-entries should be included in the search results
-   *         and normal entries excluded, or {@code false} if normal entries
-   *         should be included and sub-entries excluded.
-   */
-  public boolean getVisibility()
-  {
-    return visibility;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SubentriesRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", visibility=");
-    builder.append(getVisibility());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SubentriesRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", visibility=");
+        builder.append(getVisibility());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java
index 591171a..b2e23da 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_SUBTREE_DELETE_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_SUBTREE_DELETE_INVALID_CONTROL_VALUE;
 
@@ -38,8 +35,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The tree delete request control as defined in draft-armijo-ldap-treedelete.
  * This control allows a client to delete an entire subtree of a container entry
@@ -49,144 +44,113 @@
  *      href="http://tools.ietf.org/html/draft-armijo-ldap-treedelete">draft-armijo-ldap-treedelete
  *      - Tree Delete Control </a>
  */
-public final class SubtreeDeleteRequestControl implements Control
-{
-  /**
-   * The OID for the subtree delete request control.
-   */
-  public static final String OID = "1.2.840.113556.1.4.805";
+public final class SubtreeDeleteRequestControl implements Control {
+    /**
+     * The OID for the subtree delete request control.
+     */
+    public static final String OID = "1.2.840.113556.1.4.805";
 
-  private static final SubtreeDeleteRequestControl CRITICAL_INSTANCE =
-    new SubtreeDeleteRequestControl(true);
+    private static final SubtreeDeleteRequestControl CRITICAL_INSTANCE =
+            new SubtreeDeleteRequestControl(true);
 
-  private static final SubtreeDeleteRequestControl NONCRITICAL_INSTANCE =
-    new SubtreeDeleteRequestControl(false);
+    private static final SubtreeDeleteRequestControl NONCRITICAL_INSTANCE =
+            new SubtreeDeleteRequestControl(false);
 
-  /**
-   * A decoder which can be used for decoding the sub-tree delete request
-   * control.
-   */
-  public static final ControlDecoder<SubtreeDeleteRequestControl> DECODER =
-    new ControlDecoder<SubtreeDeleteRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the sub-tree delete request
+     * control.
+     */
+    public static final ControlDecoder<SubtreeDeleteRequestControl> DECODER =
+            new ControlDecoder<SubtreeDeleteRequestControl>() {
 
-    public SubtreeDeleteRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public SubtreeDeleteRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof SubtreeDeleteRequestControl)
-      {
-        return (SubtreeDeleteRequestControl) control;
-      }
+                    if (control instanceof SubtreeDeleteRequestControl) {
+                        return (SubtreeDeleteRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_SUBTREE_DELETE_CONTROL_BAD_OID
-            .get(control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_SUBTREE_DELETE_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (control.hasValue())
-      {
-        final LocalizableMessage message = ERR_SUBTREE_DELETE_INVALID_CONTROL_VALUE
-            .get();
-        throw DecodeException.error(message);
-      }
+                    if (control.hasValue()) {
+                        final LocalizableMessage message =
+                                ERR_SUBTREE_DELETE_INVALID_CONTROL_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                    return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new tree delete request control having the provided
+     * criticality.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @return The new control.
+     */
+    public static SubtreeDeleteRequestControl newControl(final boolean isCritical) {
+        return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
     }
 
+    private final boolean isCritical;
 
-
-    public String getOID()
-    {
-      return OID;
+    private SubtreeDeleteRequestControl(final boolean isCritical) {
+        this.isCritical = isCritical;
     }
-  };
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return null;
+    }
 
-  /**
-   * Creates a new tree delete request control having the provided criticality.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @return The new control.
-   */
-  public static SubtreeDeleteRequestControl newControl(final boolean isCritical)
-  {
-    return isCritical ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
 
-
-  private final boolean isCritical;
-
-
-
-  private SubtreeDeleteRequestControl(final boolean isCritical)
-  {
-    this.isCritical = isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SubtreeDeleteRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SubtreeDeleteRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java
index b993807..ade0038 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.byteToHex;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_VLVREQ_CONTROL_BAD_OID;
@@ -49,8 +46,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The virtual list view request control as defined in
  * draft-ietf-ldapext-ldapv3-vlv. This control allows a client to specify that
@@ -68,461 +63,386 @@
  * @see VirtualListViewResponseControl
  * @see ServerSideSortRequestControl
  * @see <a href="http://tools.ietf.org/html/draft-ietf-ldapext-ldapv3-vlv">
- *         draft-ietf-ldapext-ldapv3-vlv - LDAP Extensions for Scrolling View
- *         Browsing of Search Results </a>
+ *      draft-ietf-ldapext-ldapv3-vlv - LDAP Extensions for Scrolling View
+ *      Browsing of Search Results </a>
  */
-public final class VirtualListViewRequestControl implements Control
-{
-  /**
-   * The OID for the virtual list view request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.9";
+public final class VirtualListViewRequestControl implements Control {
+    /**
+     * The OID for the virtual list view request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.9";
 
-  /**
-   * A decoder which can be used for decoding the virtual list view request
-   * control.
-   */
-  public static final ControlDecoder<VirtualListViewRequestControl> DECODER =
-    new ControlDecoder<VirtualListViewRequestControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the virtual list view request
+     * control.
+     */
+    public static final ControlDecoder<VirtualListViewRequestControl> DECODER =
+            new ControlDecoder<VirtualListViewRequestControl>() {
 
-    public VirtualListViewRequestControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public VirtualListViewRequestControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof VirtualListViewRequestControl)
-      {
-        return (VirtualListViewRequestControl) control;
-      }
+                    if (control instanceof VirtualListViewRequestControl) {
+                        return (VirtualListViewRequestControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_VLVREQ_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_VLVREQ_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The request control must always have a value.
-        final LocalizableMessage message = INFO_VLVREQ_CONTROL_NO_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The request control must always have a value.
+                        final LocalizableMessage message = INFO_VLVREQ_CONTROL_NO_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
 
-        final int beforeCount = (int) reader.readInteger();
-        final int afterCount = (int) reader.readInteger();
+                        final int beforeCount = (int) reader.readInteger();
+                        final int afterCount = (int) reader.readInteger();
 
-        int offset = -1;
-        int contentCount = -1;
-        ByteString assertionValue = null;
-        final byte targetType = reader.peekType();
-        switch (targetType)
-        {
-        case TYPE_TARGET_BYOFFSET:
-          reader.readStartSequence();
-          offset = (int) reader.readInteger();
-          contentCount = (int) reader.readInteger();
-          reader.readEndSequence();
-          break;
-        case TYPE_TARGET_GREATERTHANOREQUAL:
-          assertionValue = reader.readOctetString();
-          break;
-        default:
-          final LocalizableMessage message = INFO_VLVREQ_CONTROL_INVALID_TARGET_TYPE
-              .get(byteToHex(targetType));
-          throw DecodeException.error(message);
+                        int offset = -1;
+                        int contentCount = -1;
+                        ByteString assertionValue = null;
+                        final byte targetType = reader.peekType();
+                        switch (targetType) {
+                        case TYPE_TARGET_BYOFFSET:
+                            reader.readStartSequence();
+                            offset = (int) reader.readInteger();
+                            contentCount = (int) reader.readInteger();
+                            reader.readEndSequence();
+                            break;
+                        case TYPE_TARGET_GREATERTHANOREQUAL:
+                            assertionValue = reader.readOctetString();
+                            break;
+                        default:
+                            final LocalizableMessage message =
+                                    INFO_VLVREQ_CONTROL_INVALID_TARGET_TYPE
+                                            .get(byteToHex(targetType));
+                            throw DecodeException.error(message);
+                        }
+
+                        ByteString contextID = null;
+                        if (reader.hasNextElement()) {
+                            contextID = reader.readOctetString();
+                        }
+
+                        return new VirtualListViewRequestControl(control.isCritical(), beforeCount,
+                                afterCount, contentCount, offset, assertionValue, contextID);
+                    } catch (final IOException e) {
+                        final LocalizableMessage message =
+                                INFO_VLVREQ_CONTROL_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * The BER type to use when encoding the byOffset target element.
+     */
+    private static final byte TYPE_TARGET_BYOFFSET = (byte) 0xA0;
+
+    /**
+     * The BER type to use when encoding the greaterThanOrEqual target element.
+     */
+    private static final byte TYPE_TARGET_GREATERTHANOREQUAL = (byte) 0x81;
+
+    /**
+     * Creates a new virtual list view request control that will identify the
+     * target entry by an assertion value. The assertion value is encoded
+     * according to the ORDERING matching rule for the attribute description in
+     * the sort control. The assertion value is used to determine the target
+     * entry by comparison with the values of the attribute specified as the
+     * primary sort key. The first list entry who's value is no less than (less
+     * than or equal to when the sort order is reversed) the supplied value is
+     * the target entry.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param assertionValue
+     *            The assertion value that will be used to locate the target
+     *            entry.
+     * @param beforeCount
+     *            The number of entries before the target entry to be included
+     *            in the search results.
+     * @param afterCount
+     *            The number of entries after the target entry to be included in
+     *            the search results.
+     * @param contextID
+     *            The context ID provided by the server in the last virtual list
+     *            view response for the same set of criteria, or {@code null} if
+     *            there was no previous virtual list view response or the server
+     *            did not include a context ID in the last response.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code beforeCount} or {@code afterCount} were less than
+     *             {@code 0}.
+     * @throws NullPointerException
+     *             If {@code assertionValue} was {@code null}.
+     */
+    public static VirtualListViewRequestControl newAssertionControl(final boolean isCritical,
+            final ByteString assertionValue, final int beforeCount, final int afterCount,
+            final ByteString contextID) {
+        Validator.ensureNotNull(assertionValue);
+        Validator.ensureTrue(beforeCount >= 0, "beforeCount is less than 0");
+        Validator.ensureTrue(afterCount >= 0, "afterCount is less than 0");
+
+        return new VirtualListViewRequestControl(isCritical, beforeCount, afterCount, -1, -1,
+                assertionValue, contextID);
+    }
+
+    /**
+     * Creates a new virtual list view request control that will identify the
+     * target entry by a positional offset within the complete result set.
+     *
+     * @param isCritical
+     *            {@code true} if it is unacceptable to perform the operation
+     *            without applying the semantics of this control, or
+     *            {@code false} if it can be ignored.
+     * @param offset
+     *            The positional offset of the target entry in the result set,
+     *            where {@code 1} is the first entry.
+     * @param contentCount
+     *            The content count returned by the server in the last virtual
+     *            list view response, or {@code 0} if this is the first virtual
+     *            list view request.
+     * @param beforeCount
+     *            The number of entries before the target entry to be included
+     *            in the search results.
+     * @param afterCount
+     *            The number of entries after the target entry to be included in
+     *            the search results.
+     * @param contextID
+     *            The context ID provided by the server in the last virtual list
+     *            view response for the same set of criteria, or {@code null} if
+     *            there was no previous virtual list view response or the server
+     *            did not include a context ID in the last response.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code beforeCount}, {@code afterCount}, or
+     *             {@code contentCount} were less than {@code 0}, or if
+     *             {@code offset} was less than {@code 1}.
+     */
+    public static VirtualListViewRequestControl newOffsetControl(final boolean isCritical,
+            final int offset, final int contentCount, final int beforeCount, final int afterCount,
+            final ByteString contextID) {
+        Validator.ensureTrue(beforeCount >= 0, "beforeCount is less than 0");
+        Validator.ensureTrue(afterCount >= 0, "afterCount is less than 0");
+        Validator.ensureTrue(offset > 0, "beforeCount is less than 1");
+        Validator.ensureTrue(contentCount >= 0, "afterCount is less than 0");
+
+        return new VirtualListViewRequestControl(isCritical, beforeCount, afterCount, offset,
+                contentCount, null, contextID);
+    }
+
+    private final int beforeCount;
+
+    private final int afterCount;
+
+    private final ByteString contextID;
+
+    private final boolean isCritical;
+
+    private final int contentCount;
+
+    private final int offset;
+
+    private final ByteString assertionValue;
+
+    private VirtualListViewRequestControl(final boolean isCritical, final int beforeCount,
+            final int afterCount, final int contentCount, final int offset,
+            final ByteString assertionValue, final ByteString contextID) {
+        this.isCritical = isCritical;
+        this.beforeCount = beforeCount;
+        this.afterCount = afterCount;
+        this.contentCount = contentCount;
+        this.offset = offset;
+        this.assertionValue = assertionValue;
+        this.contextID = contextID;
+    }
+
+    /**
+     * Returns the number of entries after the target entry to be included in
+     * the search results.
+     *
+     * @return The number of entries after the target entry to be included in
+     *         the search results.
+     */
+    public int getAfterCount() {
+        return afterCount;
+    }
+
+    /**
+     * Returns the assertion value that will be used to locate the target entry,
+     * if applicable.
+     *
+     * @return The assertion value that will be used to locate the target entry,
+     *         or {@code null} if this control is using a target offset.
+     */
+    public ByteString getAssertionValue() {
+        return assertionValue;
+    }
+
+    /**
+     * Returns the assertion value that will be used to locate the target entry,
+     * if applicable, decoded as a UTF-8 string.
+     *
+     * @return The assertion value that will be used to locate the target entry
+     *         decoded as a UTF-8 string, or {@code null} if this control is
+     *         using a target offset.
+     */
+    public String getAssertionValueAsString() {
+        return assertionValue != null ? assertionValue.toString() : null;
+    }
+
+    /**
+     * Returns the number of entries before the target entry to be included in
+     * the search results.
+     *
+     * @return The number of entries before the target entry to be included in
+     *         the search results.
+     */
+    public int getBeforeCount() {
+        return beforeCount;
+    }
+
+    /**
+     * Returns the content count returned by the server in the last virtual list
+     * view response, if applicable.
+     *
+     * @return The content count returned by the server in the last virtual list
+     *         view response, which may be {@code 0} if this is the first
+     *         virtual list view request, or {@code -1} if this control is using
+     *         a target assertion.
+     */
+    public int getContentCount() {
+        return contentCount;
+    }
+
+    /**
+     * Returns the context ID provided by the server in the last virtual list
+     * view response for the same set of criteria, or {@code null} if there was
+     * no previous virtual list view response or the server did not include a
+     * context ID in the last response.
+     *
+     * @return The context ID provided by the server in the last virtual list
+     *         view response, or {@code null} if unavailable.
+     */
+    public ByteString getContextID() {
+        return contextID;
+    }
+
+    /**
+     * Returns the positional offset of the target entry in the result set, if
+     * applicable, where {@code 1} is the first entry.
+     *
+     * @return The positional offset of the target entry in the result set, or
+     *         {@code -1} if this control is using a target assertion.
+     */
+    public int getOffset() {
+        return offset;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeInteger(beforeCount);
+            writer.writeInteger(afterCount);
+            if (hasTargetOffset()) {
+                writer.writeStartSequence(TYPE_TARGET_BYOFFSET);
+                writer.writeInteger(offset);
+                writer.writeInteger(contentCount);
+                writer.writeEndSequence();
+            } else {
+                writer.writeOctetString(TYPE_TARGET_GREATERTHANOREQUAL, assertionValue);
+            }
+            if (contextID != null) {
+                writer.writeOctetString(contextID);
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
+    }
 
-        ByteString contextID = null;
-        if (reader.hasNextElement())
-        {
-          contextID = reader.readOctetString();
+    /**
+     * Returns {@code true} if this control is using a target offset, or
+     * {@code false} if this control is using a target assertion.
+     *
+     * @return {@code true} if this control is using a target offset, or
+     *         {@code false} if this control is using a target assertion.
+     */
+    public boolean hasTargetOffset() {
+        return assertionValue != null ? false : true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("VirtualListViewRequestControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", beforeCount=");
+        builder.append(beforeCount);
+        builder.append(", afterCount=");
+        builder.append(afterCount);
+        if (hasTargetOffset()) {
+            builder.append(", offset=");
+            builder.append(offset);
+            builder.append(", contentCount=");
+            builder.append(contentCount);
+        } else {
+            builder.append(", greaterThanOrEqual=");
+            builder.append(assertionValue);
         }
-
-        return new VirtualListViewRequestControl(control.isCritical(),
-            beforeCount, afterCount, contentCount, offset, assertionValue,
-            contextID);
-      }
-      catch (final IOException e)
-      {
-        final LocalizableMessage message = INFO_VLVREQ_CONTROL_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
+        if (contextID != null) {
+            builder.append(", contextID=");
+            builder.append(contextID);
+        }
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    public String getOID()
-    {
-      return OID;
-    }
-  };
-
-  /**
-   * The BER type to use when encoding the byOffset target element.
-   */
-  private static final byte TYPE_TARGET_BYOFFSET = (byte) 0xA0;
-
-  /**
-   * The BER type to use when encoding the greaterThanOrEqual target element.
-   */
-  private static final byte TYPE_TARGET_GREATERTHANOREQUAL = (byte) 0x81;
-
-
-
-  /**
-   * Creates a new virtual list view request control that will identify the
-   * target entry by an assertion value. The assertion value is encoded
-   * according to the ORDERING matching rule for the attribute description in
-   * the sort control. The assertion value is used to determine the target entry
-   * by comparison with the values of the attribute specified as the primary
-   * sort key. The first list entry who's value is no less than (less than or
-   * equal to when the sort order is reversed) the supplied value is the target
-   * entry.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param assertionValue
-   *          The assertion value that will be used to locate the target entry.
-   * @param beforeCount
-   *          The number of entries before the target entry to be included in
-   *          the search results.
-   * @param afterCount
-   *          The number of entries after the target entry to be included in the
-   *          search results.
-   * @param contextID
-   *          The context ID provided by the server in the last virtual list
-   *          view response for the same set of criteria, or {@code null} if
-   *          there was no previous virtual list view response or the server did
-   *          not include a context ID in the last response.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code beforeCount} or {@code afterCount} were less than
-   *           {@code 0}.
-   * @throws NullPointerException
-   *           If {@code assertionValue} was {@code null}.
-   */
-  public static VirtualListViewRequestControl newAssertionControl(
-      final boolean isCritical, final ByteString assertionValue,
-      final int beforeCount, final int afterCount, final ByteString contextID)
-  {
-    Validator.ensureNotNull(assertionValue);
-    Validator.ensureTrue(beforeCount >= 0, "beforeCount is less than 0");
-    Validator.ensureTrue(afterCount >= 0, "afterCount is less than 0");
-
-    return new VirtualListViewRequestControl(isCritical, beforeCount,
-        afterCount, -1, -1, assertionValue, contextID);
-  }
-
-
-
-  /**
-   * Creates a new virtual list view request control that will identify the
-   * target entry by a positional offset within the complete result set.
-   *
-   * @param isCritical
-   *          {@code true} if it is unacceptable to perform the operation
-   *          without applying the semantics of this control, or {@code false}
-   *          if it can be ignored.
-   * @param offset
-   *          The positional offset of the target entry in the result set, where
-   *          {@code 1} is the first entry.
-   * @param contentCount
-   *          The content count returned by the server in the last virtual list
-   *          view response, or {@code 0} if this is the first virtual list view
-   *          request.
-   * @param beforeCount
-   *          The number of entries before the target entry to be included in
-   *          the search results.
-   * @param afterCount
-   *          The number of entries after the target entry to be included in the
-   *          search results.
-   * @param contextID
-   *          The context ID provided by the server in the last virtual list
-   *          view response for the same set of criteria, or {@code null} if
-   *          there was no previous virtual list view response or the server did
-   *          not include a context ID in the last response.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code beforeCount}, {@code afterCount}, or {@code
-   *           contentCount} were less than {@code 0}, or if {@code offset} was
-   *           less than {@code 1}.
-   */
-  public static VirtualListViewRequestControl newOffsetControl(
-      final boolean isCritical, final int offset, final int contentCount,
-      final int beforeCount, final int afterCount, final ByteString contextID)
-  {
-    Validator.ensureTrue(beforeCount >= 0, "beforeCount is less than 0");
-    Validator.ensureTrue(afterCount >= 0, "afterCount is less than 0");
-    Validator.ensureTrue(offset > 0, "beforeCount is less than 1");
-    Validator.ensureTrue(contentCount >= 0, "afterCount is less than 0");
-
-    return new VirtualListViewRequestControl(isCritical, beforeCount,
-        afterCount, offset, contentCount, null, contextID);
-  }
-
-
-
-  private final int beforeCount;
-
-  private final int afterCount;
-
-  private final ByteString contextID;
-
-  private final boolean isCritical;
-
-  private final int contentCount;
-
-  private final int offset;
-
-  private final ByteString assertionValue;
-
-
-
-  private VirtualListViewRequestControl(final boolean isCritical,
-      final int beforeCount, final int afterCount, final int contentCount,
-      final int offset, final ByteString assertionValue,
-      final ByteString contextID)
-  {
-    this.isCritical = isCritical;
-    this.beforeCount = beforeCount;
-    this.afterCount = afterCount;
-    this.contentCount = contentCount;
-    this.offset = offset;
-    this.assertionValue = assertionValue;
-    this.contextID = contextID;
-  }
-
-
-
-  /**
-   * Returns the number of entries after the target entry to be included in the
-   * search results.
-   *
-   * @return The number of entries after the target entry to be included in the
-   *         search results.
-   */
-  public int getAfterCount()
-  {
-    return afterCount;
-  }
-
-
-
-  /**
-   * Returns the assertion value that will be used to locate the target entry,
-   * if applicable.
-   *
-   * @return The assertion value that will be used to locate the target entry,
-   *         or {@code null} if this control is using a target offset.
-   */
-  public ByteString getAssertionValue()
-  {
-    return assertionValue;
-  }
-
-
-
-  /**
-   * Returns the assertion value that will be used to locate the target entry,
-   * if applicable, decoded as a UTF-8 string.
-   *
-   * @return The assertion value that will be used to locate the target entry
-   *         decoded as a UTF-8 string, or {@code null} if this control is using
-   *         a target offset.
-   */
-  public String getAssertionValueAsString()
-  {
-    return assertionValue != null ? assertionValue.toString() : null;
-  }
-
-
-
-  /**
-   * Returns the number of entries before the target entry to be included in the
-   * search results.
-   *
-   * @return The number of entries before the target entry to be included in the
-   *         search results.
-   */
-  public int getBeforeCount()
-  {
-    return beforeCount;
-  }
-
-
-
-  /**
-   * Returns the content count returned by the server in the last virtual list
-   * view response, if applicable.
-   *
-   * @return The content count returned by the server in the last virtual list
-   *         view response, which may be {@code 0} if this is the first virtual
-   *         list view request, or {@code -1} if this control is using a target
-   *         assertion.
-   */
-  public int getContentCount()
-  {
-    return contentCount;
-  }
-
-
-
-  /**
-   * Returns the context ID provided by the server in the last virtual list view
-   * response for the same set of criteria, or {@code null} if there was no
-   * previous virtual list view response or the server did not include a context
-   * ID in the last response.
-   *
-   * @return The context ID provided by the server in the last virtual list view
-   *         response, or {@code null} if unavailable.
-   */
-  public ByteString getContextID()
-  {
-    return contextID;
-  }
-
-
-
-  /**
-   * Returns the positional offset of the target entry in the result set, if
-   * applicable, where {@code 1} is the first entry.
-   *
-   * @return The positional offset of the target entry in the result set, or
-   *         {@code -1} if this control is using a target assertion.
-   */
-  public int getOffset()
-  {
-    return offset;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeInteger(beforeCount);
-      writer.writeInteger(afterCount);
-      if (hasTargetOffset())
-      {
-        writer.writeStartSequence(TYPE_TARGET_BYOFFSET);
-        writer.writeInteger(offset);
-        writer.writeInteger(contentCount);
-        writer.writeEndSequence();
-      }
-      else
-      {
-        writer.writeOctetString(TYPE_TARGET_GREATERTHANOREQUAL, assertionValue);
-      }
-      if (contextID != null)
-      {
-        writer.writeOctetString(contextID);
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
-    }
-  }
-
-
-
-  /**
-   * Returns {@code true} if this control is using a target offset, or {@code
-   * false} if this control is using a target assertion.
-   *
-   * @return {@code true} if this control is using a target offset, or {@code
-   *         false} if this control is using a target assertion.
-   */
-  public boolean hasTargetOffset()
-  {
-    return assertionValue != null ? false : true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("VirtualListViewRequestControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", beforeCount=");
-    builder.append(beforeCount);
-    builder.append(", afterCount=");
-    builder.append(afterCount);
-    if (hasTargetOffset())
-    {
-      builder.append(", offset=");
-      builder.append(offset);
-      builder.append(", contentCount=");
-      builder.append(contentCount);
-    }
-    else
-    {
-      builder.append(", greaterThanOrEqual=");
-      builder.append(assertionValue);
-    }
-    if (contextID != null)
-    {
-      builder.append(", contextID=");
-      builder.append(contextID);
-    }
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java
index 2c7d246..da58acd 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_VLVRES_CONTROL_BAD_OID;
 import static org.forgerock.opendj.ldap.CoreMessages.INFO_VLVRES_CONTROL_CANNOT_DECODE_VALUE;
@@ -40,12 +37,14 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * The virtual list view response control as defined in
  * draft-ietf-ldapext-ldapv3-vlv. This control is included with a search result
@@ -61,279 +60,224 @@
  *
  * @see VirtualListViewRequestControl
  * @see <a href="http://tools.ietf.org/html/draft-ietf-ldapext-ldapv3-vlv">
- *         draft-ietf-ldapext-ldapv3-vlv - LDAP Extensions for Scrolling View
- *         Browsing of Search Results </a>
+ *      draft-ietf-ldapext-ldapv3-vlv - LDAP Extensions for Scrolling View
+ *      Browsing of Search Results </a>
  */
-public final class VirtualListViewResponseControl implements Control
-{
-  /**
-   * The OID for the virtual list view request control.
-   */
-  public static final String OID = "2.16.840.1.113730.3.4.10";
+public final class VirtualListViewResponseControl implements Control {
+    /**
+     * The OID for the virtual list view request control.
+     */
+    public static final String OID = "2.16.840.1.113730.3.4.10";
 
-  /**
-   * A decoder which can be used for decoding the virtual list view response
-   * control.
-   */
-  public static final ControlDecoder<VirtualListViewResponseControl> DECODER =
-    new ControlDecoder<VirtualListViewResponseControl>()
-  {
+    /**
+     * A decoder which can be used for decoding the virtual list view response
+     * control.
+     */
+    public static final ControlDecoder<VirtualListViewResponseControl> DECODER =
+            new ControlDecoder<VirtualListViewResponseControl>() {
 
-    public VirtualListViewResponseControl decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      Validator.ensureNotNull(control);
+                public VirtualListViewResponseControl decodeControl(final Control control,
+                        final DecodeOptions options) throws DecodeException {
+                    Validator.ensureNotNull(control);
 
-      if (control instanceof VirtualListViewResponseControl)
-      {
-        return (VirtualListViewResponseControl) control;
-      }
+                    if (control instanceof VirtualListViewResponseControl) {
+                        return (VirtualListViewResponseControl) control;
+                    }
 
-      if (!control.getOID().equals(OID))
-      {
-        final LocalizableMessage message = ERR_VLVRES_CONTROL_BAD_OID.get(
-            control.getOID(), OID);
-        throw DecodeException.error(message);
-      }
+                    if (!control.getOID().equals(OID)) {
+                        final LocalizableMessage message =
+                                ERR_VLVRES_CONTROL_BAD_OID.get(control.getOID(), OID);
+                        throw DecodeException.error(message);
+                    }
 
-      if (!control.hasValue())
-      {
-        // The response control must always have a value.
-        final LocalizableMessage message = INFO_VLVRES_CONTROL_NO_VALUE.get();
-        throw DecodeException.error(message);
-      }
+                    if (!control.hasValue()) {
+                        // The response control must always have a value.
+                        final LocalizableMessage message = INFO_VLVRES_CONTROL_NO_VALUE.get();
+                        throw DecodeException.error(message);
+                    }
 
-      final ASN1Reader reader = ASN1.getReader(control.getValue());
-      try
-      {
-        reader.readStartSequence();
+                    final ASN1Reader reader = ASN1.getReader(control.getValue());
+                    try {
+                        reader.readStartSequence();
 
-        final int targetPosition = (int) reader.readInteger();
-        final int contentCount = (int) reader.readInteger();
-        final ResultCode result = ResultCode.valueOf(reader.readEnumerated());
-        ByteString contextID = null;
-        if (reader.hasNextElement())
-        {
-          contextID = reader.readOctetString();
+                        final int targetPosition = (int) reader.readInteger();
+                        final int contentCount = (int) reader.readInteger();
+                        final ResultCode result = ResultCode.valueOf(reader.readEnumerated());
+                        ByteString contextID = null;
+                        if (reader.hasNextElement()) {
+                            contextID = reader.readOctetString();
+                        }
+
+                        return new VirtualListViewResponseControl(control.isCritical(),
+                                targetPosition, contentCount, result, contextID);
+                    } catch (final IOException e) {
+                        final LocalizableMessage message =
+                                INFO_VLVRES_CONTROL_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+                }
+
+                public String getOID() {
+                    return OID;
+                }
+            };
+
+    /**
+     * Creates a new virtual list view response control.
+     *
+     * @param targetPosition
+     *            The position of the target entry in the result set.
+     * @param contentCount
+     *            An estimate of the total number of entries in the result set.
+     * @param result
+     *            The result code indicating the outcome of the virtual list
+     *            view request.
+     * @param contextID
+     *            A server-defined octet string. If present, the contextID
+     *            should be sent back to the server by the client in a
+     *            subsequent virtual list request.
+     * @return The new control.
+     * @throws IllegalArgumentException
+     *             If {@code targetPosition} or {@code contentCount} were less
+     *             than {@code 0}.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static VirtualListViewResponseControl newControl(final int targetPosition,
+            final int contentCount, final ResultCode result, final ByteString contextID) {
+        Validator.ensureNotNull(result);
+        Validator.ensureTrue(targetPosition >= 0, "targetPosition is less than 0");
+        Validator.ensureTrue(contentCount >= 0, "contentCount is less than 0");
+
+        return new VirtualListViewResponseControl(false, targetPosition, contentCount, result,
+                contextID);
+    }
+
+    private final int targetPosition;
+
+    private final int contentCount;
+
+    private final ResultCode result;
+
+    private final ByteString contextID;
+
+    private final boolean isCritical;
+
+    private VirtualListViewResponseControl(final boolean isCritical, final int targetPosition,
+            final int contentCount, final ResultCode result, final ByteString contextID) {
+        this.isCritical = isCritical;
+        this.targetPosition = targetPosition;
+        this.contentCount = contentCount;
+        this.result = result;
+        this.contextID = contextID;
+    }
+
+    /**
+     * Returns the estimated total number of entries in the result set.
+     *
+     * @return The estimated total number of entries in the result set.
+     */
+    public int getContentCount() {
+        return contentCount;
+    }
+
+    /**
+     * Returns a server-defined octet string which, if present, should be sent
+     * back to the server by the client in a subsequent virtual list request.
+     *
+     * @return A server-defined octet string which, if present, should be sent
+     *         back to the server by the client in a subsequent virtual list
+     *         request, or {@code null} if there is no context ID.
+     */
+    public ByteString getContextID() {
+        return contextID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * Returns result code indicating the outcome of the virtual list view
+     * request.
+     *
+     * @return The result code indicating the outcome of the virtual list view
+     *         request.
+     */
+    public ResultCode getResult() {
+        return result;
+    }
+
+    /**
+     * Returns the position of the target entry in the result set.
+     *
+     * @return The position of the target entry in the result set.
+     */
+    public int getTargetPosition() {
+        return targetPosition;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+        try {
+            writer.writeStartSequence();
+            writer.writeInteger(targetPosition);
+            writer.writeInteger(contentCount);
+            writer.writeEnumerated(result.intValue());
+            if (contextID != null) {
+                writer.writeOctetString(contextID);
+            }
+            writer.writeEndSequence();
+            return buffer.toByteString();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
-
-        return new VirtualListViewResponseControl(control.isCritical(),
-            targetPosition, contentCount, result, contextID);
-      }
-      catch (final IOException e)
-      {
-        final LocalizableMessage message = INFO_VLVRES_CONTROL_CANNOT_DECODE_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
     }
 
-
-
-    public String getOID()
-    {
-      return OID;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return true;
     }
-  };
 
-
-
-  /**
-   * Creates a new virtual list view response control.
-   *
-   * @param targetPosition
-   *          The position of the target entry in the result set.
-   * @param contentCount
-   *          An estimate of the total number of entries in the result set.
-   * @param result
-   *          The result code indicating the outcome of the virtual list view
-   *          request.
-   * @param contextID
-   *          A server-defined octet string. If present, the contextID should be
-   *          sent back to the server by the client in a subsequent virtual list
-   *          request.
-   * @return The new control.
-   * @throws IllegalArgumentException
-   *           If {@code targetPosition} or {@code contentCount} were less than
-   *           {@code 0}.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static VirtualListViewResponseControl newControl(
-      final int targetPosition, final int contentCount,
-      final ResultCode result, final ByteString contextID)
-  {
-    Validator.ensureNotNull(result);
-    Validator.ensureTrue(targetPosition >= 0, "targetPosition is less than 0");
-    Validator.ensureTrue(contentCount >= 0, "contentCount is less than 0");
-
-    return new VirtualListViewResponseControl(false, targetPosition,
-        contentCount, result, contextID);
-  }
-
-
-
-  private final int targetPosition;
-
-  private final int contentCount;
-
-  private final ResultCode result;
-
-  private final ByteString contextID;
-
-  private final boolean isCritical;
-
-
-
-  private VirtualListViewResponseControl(final boolean isCritical,
-      final int targetPosition, final int contentCount,
-      final ResultCode result, final ByteString contextID)
-  {
-    this.isCritical = isCritical;
-    this.targetPosition = targetPosition;
-    this.contentCount = contentCount;
-    this.result = result;
-    this.contextID = contextID;
-  }
-
-
-
-  /**
-   * Returns the estimated total number of entries in the result set.
-   *
-   * @return The estimated total number of entries in the result set.
-   */
-  public int getContentCount()
-  {
-    return contentCount;
-  }
-
-
-
-  /**
-   * Returns a server-defined octet string which, if present, should be sent
-   * back to the server by the client in a subsequent virtual list request.
-   *
-   * @return A server-defined octet string which, if present, should be sent
-   *         back to the server by the client in a subsequent virtual list
-   *         request, or {@code null} if there is no context ID.
-   */
-  public ByteString getContextID()
-  {
-    return contextID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * Returns result code indicating the outcome of the virtual list view
-   * request.
-   *
-   * @return The result code indicating the outcome of the virtual list view
-   *         request.
-   */
-  public ResultCode getResult()
-  {
-    return result;
-  }
-
-
-
-  /**
-   * Returns the position of the target entry in the result set.
-   *
-   * @return The position of the target entry in the result set.
-   */
-  public int getTargetPosition()
-  {
-    return targetPosition;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeInteger(targetPosition);
-      writer.writeInteger(contentCount);
-      writer.writeEnumerated(result.intValue());
-      if (contextID != null)
-      {
-        writer.writeOctetString(contextID);
-      }
-      writer.writeEndSequence();
-      return buffer.toByteString();
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical() {
+        return isCritical;
     }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("VirtualListViewResponseControl(oid=");
+        builder.append(getOID());
+        builder.append(", criticality=");
+        builder.append(isCritical());
+        builder.append(", targetPosition=");
+        builder.append(targetPosition);
+        builder.append(", contentCount=");
+        builder.append(contentCount);
+        builder.append(", result=");
+        builder.append(result);
+        if (contextID != null) {
+            builder.append(", contextID=");
+            builder.append(contextID);
+        }
+        builder.append(")");
+        return builder.toString();
     }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isCritical()
-  {
-    return isCritical;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("VirtualListViewResponseControl(oid=");
-    builder.append(getOID());
-    builder.append(", criticality=");
-    builder.append(isCritical());
-    builder.append(", targetPosition=");
-    builder.append(targetPosition);
-    builder.append(", contentCount=");
-    builder.append(contentCount);
-    builder.append(", result=");
-    builder.append(result);
-    if (contextID != null)
-    {
-      builder.append(", contextID=");
-      builder.append(contextID);
-    }
-    builder.append(")");
-    return builder.toString();
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java
index b1335ff..bbffb97 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package org.forgerock.opendj.ldap.controls;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/package-info.java
index e17b90f..40d6bd0 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -31,5 +30,3 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java
index 15b12d9..d29b230 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,56 +34,46 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Abandon operation allows a client to request that the server abandon an
  * uncompleted operation.
  * <p>
  * Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned.
  */
-public interface AbandonRequest extends Request
-{
-  /**
-   * {@inheritDoc}
-   */
-  AbandonRequest addControl(Control control);
+public interface AbandonRequest extends Request {
+    /**
+     * {@inheritDoc}
+     */
+    AbandonRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the request ID of the request to be abandoned.
+     *
+     * @return The request ID of the request to be abandoned.
+     */
+    int getRequestID();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the request ID of the request to be abandoned.
-   *
-   * @return The request ID of the request to be abandoned.
-   */
-  int getRequestID();
-
-
-
-  /**
-   * Sets the request ID of the request to be abandoned.
-   *
-   * @param id
-   *          The request ID of the request to be abandoned.
-   * @return This abandon request.
-   * @throws UnsupportedOperationException
-   *           If this abandon request does not permit the request ID to be set.
-   */
-  AbandonRequest setRequestID(int id);
+    /**
+     * Sets the request ID of the request to be abandoned.
+     *
+     * @param id
+     *            The request ID of the request to be abandoned.
+     * @return This abandon request.
+     * @throws UnsupportedOperationException
+     *             If this abandon request does not permit the request ID to be
+     *             set.
+     */
+    AbandonRequest setRequestID(int id);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java
index fbd555e..a8f0915 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,88 +27,67 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Abandon request implementation.
  */
-final class AbandonRequestImpl extends AbstractRequestImpl<AbandonRequest>
-    implements AbandonRequest
-{
+final class AbandonRequestImpl extends AbstractRequestImpl<AbandonRequest> implements
+        AbandonRequest {
 
-  private int requestID;
+    private int requestID;
 
+    /**
+     * Creates a new abandon request using the provided message ID.
+     *
+     * @param requestID
+     *            The message ID of the request to be abandoned.
+     */
+    AbandonRequestImpl(final int requestID) {
+        this.requestID = requestID;
+    }
 
+    /**
+     * Creates a new abandon request that is an exact copy of the provided
+     * request.
+     *
+     * @param abandonRequest
+     *            The abandon request to be copied.
+     * @throws NullPointerException
+     *             If {@code abandonRequest} was {@code null} .
+     */
+    AbandonRequestImpl(final AbandonRequest abandonRequest) {
+        super(abandonRequest);
+        this.requestID = abandonRequest.getRequestID();
+    }
 
-  /**
-   * Creates a new abandon request using the provided message ID.
-   *
-   * @param requestID
-   *          The message ID of the request to be abandoned.
-   */
-  AbandonRequestImpl(final int requestID)
-  {
-    this.requestID = requestID;
-  }
+    public int getRequestID() {
+        return requestID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AbandonRequest setRequestID(final int id) {
+        this.requestID = id;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AbandonRequest(requestID=");
+        builder.append(getRequestID());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * Creates a new abandon request that is an exact copy of the provided
-   * request.
-   *
-   * @param abandonRequest
-   *          The abandon request to be copied.
-   * @throws NullPointerException
-   *           If {@code abandonRequest} was {@code null} .
-   */
-  AbandonRequestImpl(final AbandonRequest abandonRequest)
-  {
-    super(abandonRequest);
-    this.requestID = abandonRequest.getRequestID();
-  }
-
-
-
-  public int getRequestID()
-  {
-    return requestID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AbandonRequest setRequestID(final int id)
-  {
-    this.requestID = id;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AbandonRequest(requestID=");
-    builder.append(getRequestID());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  AbandonRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    AbandonRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java
index 4e8130e..e2f5c14 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,60 +26,48 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * An abstract Bind request which can be used as the basis for implementing new
  * authentication methods.
  *
  * @param <R>
- *          The type of Bind request.
+ *            The type of Bind request.
  */
-abstract class AbstractBindRequest<R extends BindRequest> extends
-    AbstractRequestImpl<R> implements BindRequest
-{
+abstract class AbstractBindRequest<R extends BindRequest> extends AbstractRequestImpl<R> implements
+        BindRequest {
 
-  /**
-   * Creates a new abstract bind request.
-   */
-  protected AbstractBindRequest()
-  {
-    // Nothing to do.
-  }
+    /**
+     * Creates a new abstract bind request.
+     */
+    protected AbstractBindRequest() {
+        // Nothing to do.
+    }
 
+    /**
+     * Creates a new abstract bind request that is an exact copy of the provided
+     * request.
+     *
+     * @param bindRequest
+     *            The bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code bindRequest} was {@code null} .
+     */
+    protected AbstractBindRequest(BindRequest bindRequest) {
+        super(bindRequest);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public abstract String getName();
 
-  /**
-   * Creates a new abstract bind request that is an exact copy of the provided
-   * request.
-   *
-   * @param bindRequest
-   *          The bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code bindRequest} was {@code null} .
-   */
-  protected AbstractBindRequest(BindRequest bindRequest)
-  {
-    super(bindRequest);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract String getName();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @SuppressWarnings("unchecked")
-  final R getThis()
-  {
-    return (R) this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    final R getThis() {
+        return (R) this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java
index b00bd70..029893a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,114 +27,89 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An abstract Extended request which can be used as the basis for implementing
  * new Extended operations.
  *
  * @param <R>
- *          The type of extended request.
+ *            The type of extended request.
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-public abstract class AbstractExtendedRequest<R extends ExtendedRequest<S>,
-                                              S extends ExtendedResult>
-    extends AbstractRequestImpl<R> implements ExtendedRequest<S>
-{
+public abstract class AbstractExtendedRequest<R extends ExtendedRequest<S>, S extends ExtendedResult>
+        extends AbstractRequestImpl<R> implements ExtendedRequest<S> {
 
-  /**
-   * Creates a new abstract extended request.
-   */
-  protected AbstractExtendedRequest()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * Creates a new extended request that is an exact copy of the provided
-   * request.
-   *
-   * @param extendedRequest
-   *          The extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code extendedRequest} was {@code null} .
-   */
-  protected AbstractExtendedRequest(ExtendedRequest<S> extendedRequest)
-  {
-    super(extendedRequest);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract ExtendedResultDecoder<S> getResultDecoder();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ExtendedRequest(requestName=");
-    builder.append(getOID());
-    if (hasValue())
-    {
-      builder.append(", requestValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new abstract extended request.
+     */
+    protected AbstractExtendedRequest() {
+        // Nothing to do.
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 
+    /**
+     * Creates a new extended request that is an exact copy of the provided
+     * request.
+     *
+     * @param extendedRequest
+     *            The extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code extendedRequest} was {@code null} .
+     */
+    protected AbstractExtendedRequest(ExtendedRequest<S> extendedRequest) {
+        super(extendedRequest);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public abstract String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @SuppressWarnings("unchecked")
-  final R getThis()
-  {
-    return (R) this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public abstract ExtendedResultDecoder<S> getResultDecoder();
+
+    /**
+     * {@inheritDoc}
+     */
+    public abstract ByteString getValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    public abstract boolean hasValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ExtendedRequest(requestName=");
+        builder.append(getOID());
+        if (hasValue()) {
+            builder.append(", requestValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    final R getThis() {
+        return (R) this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java
index 447c885..90f8fd5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
@@ -41,106 +38,79 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Abstract request implementation.
  *
  * @param <R>
- *          The type of request.
+ *            The type of request.
  */
-abstract class AbstractRequestImpl<R extends Request> implements Request
-{
-  private final List<Control> controls = new LinkedList<Control>();
+abstract class AbstractRequestImpl<R extends Request> implements Request {
+    private final List<Control> controls = new LinkedList<Control>();
 
-
-
-  /**
-   * Creates a new abstract request implementation.
-   */
-  AbstractRequestImpl()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * Creates a new abstract request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The request to be copied.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  AbstractRequestImpl(Request request)
-  {
-    Validator.ensureNotNull(request);
-    for (Control control : request.getControls())
-    {
-      // Create defensive copy.
-      controls.add(GenericControl.newControl(control));
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final R addControl(final Control control)
-  {
-    Validator.ensureNotNull(control);
-    controls.add(control);
-    return getThis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final <C extends Control> C getControl(
-      final ControlDecoder<C> decoder, final DecodeOptions options)
-      throws DecodeException
-  {
-    Validator.ensureNotNull(decoder, options);
-
-    // Avoid creating an iterator if possible.
-    if (controls.isEmpty())
-    {
-      return null;
+    /**
+     * Creates a new abstract request implementation.
+     */
+    AbstractRequestImpl() {
+        // No implementation required.
     }
 
-    for (final Control control : controls)
-    {
-      if (control.getOID().equals(decoder.getOID()))
-      {
-        return decoder.decodeControl(control, options);
-      }
+    /**
+     * Creates a new abstract request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The request to be copied.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    AbstractRequestImpl(Request request) {
+        Validator.ensureNotNull(request);
+        for (Control control : request.getControls()) {
+            // Create defensive copy.
+            controls.add(GenericControl.newControl(control));
+        }
     }
 
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final R addControl(final Control control) {
+        Validator.ensureNotNull(control);
+        controls.add(control);
+        return getThis();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final <C extends Control> C getControl(final ControlDecoder<C> decoder,
+            final DecodeOptions options) throws DecodeException {
+        Validator.ensureNotNull(decoder, options);
 
+        // Avoid creating an iterator if possible.
+        if (controls.isEmpty()) {
+            return null;
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final List<Control> getControls()
-  {
-    return controls;
-  }
+        for (final Control control : controls) {
+            if (control.getOID().equals(decoder.getOID())) {
+                return decoder.decodeControl(control, options);
+            }
+        }
 
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final List<Control> getControls() {
+        return controls;
+    }
 
-  @Override
-  public abstract String toString();
+    @Override
+    public abstract String toString();
 
-
-
-  abstract R getThis();
+    abstract R getThis();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java
index 473f136..a2bb3a8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,48 +26,33 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.TYPE_AUTHENTICATION_SASL;
 
-
-
 /**
  * An abstract SASL Bind request which can be used as the basis for implementing
  * new SASL authentication methods.
  *
  * @param <R>
- *          The type of SASL Bind request.
+ *            The type of SASL Bind request.
  */
-abstract class AbstractSASLBindRequest<R extends SASLBindRequest> extends
-    AbstractBindRequest<R> implements SASLBindRequest
-{
+abstract class AbstractSASLBindRequest<R extends SASLBindRequest> extends AbstractBindRequest<R>
+        implements SASLBindRequest {
 
-  AbstractSASLBindRequest()
-  {
+    AbstractSASLBindRequest() {
 
-  }
+    }
 
+    AbstractSASLBindRequest(SASLBindRequest saslBindRequest) {
+        super(saslBindRequest);
+    }
 
+    public final byte getAuthenticationType() {
+        return TYPE_AUTHENTICATION_SASL;
+    }
 
-  AbstractSASLBindRequest(SASLBindRequest saslBindRequest)
-  {
-    super(saslBindRequest);
-  }
-
-
-
-  public final byte getAuthenticationType()
-  {
-    return TYPE_AUTHENTICATION_SASL;
-  }
-
-
-
-  @Override
-  public final String getName()
-  {
-    return "".intern();
-  }
+    @Override
+    public final String getName() {
+        return "".intern();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java
index 7314755..927400e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -34,25 +33,24 @@
  * implementing new unmodifiable authentication methods.
  *
  * @param <R>
- *          The type of Bind request.
+ *            The type of Bind request.
  */
 abstract class AbstractUnmodifiableBindRequest<R extends BindRequest> extends
-    AbstractUnmodifiableRequest<R> implements BindRequest {
+        AbstractUnmodifiableRequest<R> implements BindRequest {
 
-  AbstractUnmodifiableBindRequest(R impl) {
-    super(impl);
-  }
+    AbstractUnmodifiableBindRequest(R impl) {
+        super(impl);
+    }
 
-  public BindClient createBindClient(String serverName)
-      throws ErrorResultException {
-    return impl.createBindClient(serverName);
-  }
+    public BindClient createBindClient(String serverName) throws ErrorResultException {
+        return impl.createBindClient(serverName);
+    }
 
-  public byte getAuthenticationType() {
-    return impl.getAuthenticationType();
-  }
+    public byte getAuthenticationType() {
+        return impl.getAuthenticationType();
+    }
 
-  public String getName() {
-    return impl.getName();
-  }
+    public String getName() {
+        return impl.getName();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java
index c64d534..b158ac0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -36,33 +35,29 @@
  * implementing new unmodifiable Extended operations.
  *
  * @param <R>
- *          The type of extended request.
+ *            The type of extended request.
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-abstract class
-    AbstractUnmodifiableExtendedRequest<R extends ExtendedRequest<S>,
-                                        S extends ExtendedResult>
-    extends AbstractUnmodifiableRequest<R>
-    implements ExtendedRequest<S>
-{
-  AbstractUnmodifiableExtendedRequest(R impl) {
-    super(impl);
-  }
+abstract class AbstractUnmodifiableExtendedRequest<R extends ExtendedRequest<S>, S extends ExtendedResult>
+        extends AbstractUnmodifiableRequest<R> implements ExtendedRequest<S> {
+    AbstractUnmodifiableExtendedRequest(R impl) {
+        super(impl);
+    }
 
-  public final String getOID() {
-    return impl.getOID();
-  }
+    public final String getOID() {
+        return impl.getOID();
+    }
 
-  public final ExtendedResultDecoder<S> getResultDecoder() {
-    return impl.getResultDecoder();
-  }
+    public final ExtendedResultDecoder<S> getResultDecoder() {
+        return impl.getResultDecoder();
+    }
 
-  public final ByteString getValue() {
-    return impl.getValue();
-  }
+    public final ByteString getValue() {
+        return impl.getValue();
+    }
 
-  public final boolean hasValue() {
-    return impl.hasValue();
-  }
+    public final boolean hasValue() {
+        return impl.hasValue();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
index 7d86444..db301c8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
@@ -44,130 +41,102 @@
 import com.forgerock.opendj.util.Functions;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Unmodifiable request implementation.
  *
  * @param <R>
- *          The type of request.
+ *            The type of request.
  */
-abstract class AbstractUnmodifiableRequest<R extends Request> implements
-    Request
-{
+abstract class AbstractUnmodifiableRequest<R extends Request> implements Request {
 
-  protected final R impl;
+    protected final R impl;
 
-
-
-  /**
-   * Creates a new unmodifiable request implementation.
-   *
-   * @param impl
-   *          The underlying request implementation to be made unmodifiable.
-   */
-  AbstractUnmodifiableRequest(final R impl)
-  {
-    this.impl = impl;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final R addControl(final Control control)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final <C extends Control> C getControl(
-      final ControlDecoder<C> decoder, final DecodeOptions options)
-      throws DecodeException
-  {
-    Validator.ensureNotNull(decoder, options);
-
-    final List<Control> controls = impl.getControls();
-
-    // Avoid creating an iterator if possible.
-    if (controls.isEmpty())
-    {
-      return null;
+    /**
+     * Creates a new unmodifiable request implementation.
+     *
+     * @param impl
+     *            The underlying request implementation to be made unmodifiable.
+     */
+    AbstractUnmodifiableRequest(final R impl) {
+        this.impl = impl;
     }
 
-    for (final Control control : controls)
-    {
-      if (control.getOID().equals(decoder.getOID()))
-      {
-        // Got a match. Return a defensive copy only if necessary.
-        final C decodedControl = decoder.decodeControl(control, options);
-
-        if (decodedControl != control)
-        {
-          // This was not the original control so return it immediately.
-          return decodedControl;
-        }
-        else if (decodedControl instanceof GenericControl)
-        {
-          // Generic controls are immutable, so return it immediately.
-          return decodedControl;
-        }
-        else
-        {
-          // Re-decode to get defensive copy.
-          final GenericControl genericControl = GenericControl
-              .newControl(control);
-          return decoder.decodeControl(genericControl, options);
-        }
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final R addControl(final Control control) {
+        throw new UnsupportedOperationException();
     }
 
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final <C extends Control> C getControl(final ControlDecoder<C> decoder,
+            final DecodeOptions options) throws DecodeException {
+        Validator.ensureNotNull(decoder, options);
 
+        final List<Control> controls = impl.getControls();
 
+        // Avoid creating an iterator if possible.
+        if (controls.isEmpty()) {
+            return null;
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final List<Control> getControls()
-  {
-    // We need to make all controls unmodifiable as well, which implies making
-    // defensive copies where necessary.
-    final Function<Control, Control, Void> function = new Function<Control, Control, Void>()
-    {
+        for (final Control control : controls) {
+            if (control.getOID().equals(decoder.getOID())) {
+                // Got a match. Return a defensive copy only if necessary.
+                final C decodedControl = decoder.decodeControl(control, options);
 
-      @Override
-      public Control apply(final Control value, final Void p)
-      {
-        // Return defensive copy.
-        return GenericControl.newControl(value);
-      }
+                if (decodedControl != control) {
+                    // This was not the original control so return it
+                    // immediately.
+                    return decodedControl;
+                } else if (decodedControl instanceof GenericControl) {
+                    // Generic controls are immutable, so return it immediately.
+                    return decodedControl;
+                } else {
+                    // Re-decode to get defensive copy.
+                    final GenericControl genericControl = GenericControl.newControl(control);
+                    return decoder.decodeControl(genericControl, options);
+                }
+            }
+        }
 
-    };
+        return null;
+    }
 
-    final List<Control> unmodifiableControls = Collections2.transformedList(
-        impl.getControls(), function, Functions.<Control> identityFunction());
-    return Collections.unmodifiableList(unmodifiableControls);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final List<Control> getControls() {
+        // We need to make all controls unmodifiable as well, which implies
+        // making
+        // defensive copies where necessary.
+        final Function<Control, Control, Void> function = new Function<Control, Control, Void>() {
 
+            @Override
+            public Control apply(final Control value, final Void p) {
+                // Return defensive copy.
+                return GenericControl.newControl(value);
+            }
 
+        };
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final String toString()
-  {
-    return impl.toString();
-  }
+        final List<Control> unmodifiableControls =
+                Collections2.transformedList(impl.getControls(), function, Functions
+                        .<Control> identityFunction());
+        return Collections.unmodifiableList(unmodifiableControls);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final String toString() {
+        return impl.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java
index cb93cfb..a82329e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -32,19 +31,17 @@
  * implementing new unmodifiable SASL authentication methods.
  *
  * @param <R>
- *          The type of SASL Bind request.
+ *            The type of SASL Bind request.
  */
-abstract class AbstractUnmodifiableSASLBindRequest
-    <R extends SASLBindRequest> extends
-    AbstractUnmodifiableBindRequest<R> implements SASLBindRequest
-{
+abstract class AbstractUnmodifiableSASLBindRequest<R extends SASLBindRequest> extends
+        AbstractUnmodifiableBindRequest<R> implements SASLBindRequest {
 
-  AbstractUnmodifiableSASLBindRequest(R impl) {
-    super(impl);
-  }
+    AbstractUnmodifiableSASLBindRequest(R impl) {
+        super(impl);
+    }
 
-  @Override
-  public String getSASLMechanism() {
-    return impl.getSASLMechanism();
-  }
+    @Override
+    public String getSASLMechanism() {
+        return impl.getSASLMechanism();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java
index eb5d727..6feb17e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,21 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collection;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 import org.forgerock.opendj.ldif.ChangeRecord;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * The Add operation allows a client to request the addition of an entry into
  * the Directory.
@@ -50,176 +51,126 @@
  * {@code creatorsName} attributes must not be included, since the server
  * maintains these automatically.
  */
-public interface AddRequest extends Request, ChangeRecord, Entry
-{
-  /**
-   * {@inheritDoc}
-   */
-  <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
+public interface AddRequest extends Request, ChangeRecord, Entry {
+    /**
+     * {@inheritDoc}
+     */
+    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean addAttribute(Attribute attribute);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean addAttribute(Attribute attribute, Collection<ByteString> duplicateValues);
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean addAttribute(Attribute attribute);
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest addAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest clearAttributes();
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean addAttribute(Attribute attribute,
-      Collection<ByteString> duplicateValues);
+    /**
+     * {@inheritDoc}
+     */
+    boolean containsAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean containsAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes();
 
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest addAttribute(String attributeDescription, Object... values);
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes(String attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    Attribute getAttribute(AttributeDescription attributeDescription);
 
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    Attribute getAttribute(String attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    int getAttributeCount();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest clearAttributes();
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    DN getName();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean removeAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean containsAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
+    /**
+     * {@inheritDoc}
+     */
+    boolean removeAttribute(AttributeDescription attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest removeAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean replaceAttribute(Attribute attribute);
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean containsAttribute(String attributeDescription, Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes(String attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Attribute getAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Attribute getAttribute(String attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  int getAttributeCount();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  DN getName();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean removeAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean removeAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest removeAttribute(String attributeDescription, Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean replaceAttribute(Attribute attribute);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest replaceAttribute(String attributeDescription, Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest setName(DN dn);
-
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest replaceAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest setName(DN dn);
 
-  /**
-   * {@inheritDoc}
-   */
-  AddRequest setName(String dn);
+    /**
+     * {@inheritDoc}
+     */
+    AddRequest setName(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java
index 1661f1c..35b24eb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,329 +27,245 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * Add request implementation.
  */
-final class AddRequestImpl extends AbstractRequestImpl<AddRequest> implements
-    AddRequest
-{
+final class AddRequestImpl extends AbstractRequestImpl<AddRequest> implements AddRequest {
 
-  private final Entry entry;
+    private final Entry entry;
 
+    /**
+     * Creates a new add request backed by the provided entry. Modifications
+     * made to {@code entry} will be reflected in the returned add request. The
+     * returned add request supports updates to its list of controls, as well as
+     * updates to the name and attributes if the underlying entry allows.
+     *
+     * @param entry
+     *            The entry to be added.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    AddRequestImpl(final Entry entry) {
+        this.entry = entry;
+    }
 
+    /**
+     * Creates a new add request that is an exact copy of the provided request.
+     *
+     * @param addRequest
+     *            The add request to be copied.
+     * @throws NullPointerException
+     *             If {@code addRequest} was {@code null} .
+     */
+    AddRequestImpl(final AddRequest addRequest) {
+        super(addRequest);
+        this.entry = LinkedHashMapEntry.deepCopyOfEntry(addRequest);
+    }
 
-  /**
-   * Creates a new add request backed by the provided entry. Modifications made
-   * to {@code entry} will be reflected in the returned add request. The
-   * returned add request supports updates to its list of controls, as well as
-   * updates to the name and attributes if the underlying entry allows.
-   *
-   * @param entry
-   *          The entry to be added.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  AddRequestImpl(final Entry entry)
-  {
-    this.entry = entry;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAttribute(final Attribute attribute) {
+        return entry.addAttribute(attribute);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAttribute(final Attribute attribute,
+            final Collection<ByteString> duplicateValues) {
+        return entry.addAttribute(attribute, duplicateValues);
+    }
 
-  /**
-   * Creates a new add request that is an exact copy of the provided
-   * request.
-   *
-   * @param addRequest
-   *          The add request to be copied.
-   * @throws NullPointerException
-   *           If {@code addRequest} was {@code null} .
-   */
-  AddRequestImpl(final AddRequest addRequest)
-  {
-    super(addRequest);
-    this.entry = LinkedHashMapEntry.deepCopyOfEntry(addRequest);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest addAttribute(final String attributeDescription, final Object... values) {
+        entry.addAttribute(attributeDescription, values);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest clearAttributes() {
+        entry.clearAttributes();
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        return entry.containsAttribute(attribute, missingValues);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final String attributeDescription, final Object... values) {
+        return entry.containsAttribute(attributeDescription, values);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes() {
+        return entry.getAllAttributes();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) {
+        return entry.getAllAttributes(attributeDescription);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAttribute(final Attribute attribute)
-  {
-    return entry.addAttribute(attribute);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final String attributeDescription) {
+        return entry.getAllAttributes(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Attribute getAttribute(final AttributeDescription attributeDescription) {
+        return entry.getAttribute(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Attribute getAttribute(final String attributeDescription) {
+        return entry.getAttribute(attributeDescription);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAttribute(final Attribute attribute,
-      final Collection<ByteString> duplicateValues)
-  {
-    return entry.addAttribute(attribute, duplicateValues);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int getAttributeCount() {
+        return entry.getAttributeCount();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return entry.getName();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean removeAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        return entry.removeAttribute(attribute, missingValues);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest addAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.addAttribute(attributeDescription, values);
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean removeAttribute(final AttributeDescription attributeDescription) {
+        return entry.removeAttribute(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest removeAttribute(final String attributeDescription, final Object... values) {
+        entry.removeAttribute(attributeDescription, values);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean replaceAttribute(final Attribute attribute) {
+        return entry.replaceAttribute(attribute);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest clearAttributes()
-  {
-    entry.clearAttributes();
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest replaceAttribute(final String attributeDescription, final Object... values) {
+        entry.replaceAttribute(attributeDescription, values);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest setName(final DN dn) {
+        entry.setName(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AddRequest setName(final String dn) {
+        entry.setName(dn);
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    return entry.containsAttribute(attribute, missingValues);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    return entry.containsAttribute(attributeDescription, values);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes()
-  {
-    return entry.getAllAttributes();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(
-      final AttributeDescription attributeDescription)
-  {
-    return entry.getAllAttributes(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(final String attributeDescription)
-  {
-    return entry.getAllAttributes(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Attribute getAttribute(final AttributeDescription attributeDescription)
-  {
-    return entry.getAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Attribute getAttribute(final String attributeDescription)
-  {
-    return entry.getAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int getAttributeCount()
-  {
-    return entry.getAttributeCount();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return entry.getName();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean removeAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    return entry.removeAttribute(attribute, missingValues);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean removeAttribute(final AttributeDescription attributeDescription)
-  {
-    return entry.removeAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest removeAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.removeAttribute(attributeDescription, values);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean replaceAttribute(final Attribute attribute)
-  {
-    return entry.replaceAttribute(attribute);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest replaceAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.replaceAttribute(attributeDescription, values);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest setName(final DN dn)
-  {
-    entry.setName(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AddRequest setName(final String dn)
-  {
-    entry.setName(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AddRequest(name=");
-    builder.append(getName());
-    builder.append(", attributes=");
-    builder.append(getAllAttributes());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AddRequest(name=");
+        builder.append(getName());
+        builder.append(", attributes=");
+        builder.append(getAllAttributes());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  AddRequest getThis()
-  {
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    AddRequest getThis() {
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return entry.hashCode();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return entry.hashCode();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object object)
-  {
-    return entry.equals(object);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object object) {
+        return entry.equals(object);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java
index e657089..dd25f87 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,8 +35,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The anonymous SASL bind request as defined in RFC 4505. This SASL mechanism
  * allows a client to authenticate to the server without requiring the user to
@@ -58,97 +53,79 @@
  * @see <a href="http://tools.ietf.org/html/rfc4505">RFC 4505 - Anonymous Simple
  *      Authentication and Security Layer (SASL) Mechanism </a>
  */
-public interface AnonymousSASLBindRequest extends SASLBindRequest
-{
+public interface AnonymousSASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism that does not provide any authentication but
-   * rather uses anonymous access.
-   */
-  public static final String SASL_MECHANISM_NAME = "ANONYMOUS";
+    /**
+     * The name of the SASL mechanism that does not provide any authentication
+     * but rather uses anonymous access.
+     */
+    public static final String SASL_MECHANISM_NAME = "ANONYMOUS";
 
+    /**
+     * {@inheritDoc}
+     */
+    AnonymousSASLBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
-  /**
-   * {@inheritDoc}
-   */
-  AnonymousSASLBindRequest addControl(Control control);
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getSASLMechanism();
 
+    /**
+     * Returns the trace information, which has no semantic value, and can be
+     * used by administrators in order to identify the user.
+     *
+     * @return The trace information, which has no semantic value, and can be
+     *         used by administrators in order to identify the user.
+     */
+    String getTraceString();
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getSASLMechanism();
-
-
-
-  /**
-   * Returns the trace information, which has no semantic value, and can be used
-   * by administrators in order to identify the user.
-   *
-   * @return The trace information, which has no semantic value, and can be used
-   *         by administrators in order to identify the user.
-   */
-  String getTraceString();
-
-
-
-  /**
-   * Sets the trace information, which has no semantic value, and can be used by
-   * administrators in order to identify the user.
-   *
-   * @param traceString
-   *          The trace information, which has no semantic value, and can be
-   *          used by administrators in order to identify the user.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this anonymous SASL request does not permit the trace
-   *           information to be set.
-   * @throws NullPointerException
-   *           If {@code traceString} was {@code null}.
-   */
-  AnonymousSASLBindRequest setTraceString(String traceString);
+    /**
+     * Sets the trace information, which has no semantic value, and can be used
+     * by administrators in order to identify the user.
+     *
+     * @param traceString
+     *            The trace information, which has no semantic value, and can be
+     *            used by administrators in order to identify the user.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this anonymous SASL request does not permit the trace
+     *             information to be set.
+     * @throws NullPointerException
+     *             If {@code traceString} was {@code null}.
+     */
+    AnonymousSASLBindRequest setTraceString(String traceString);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java
index 853aabc..d5bd1ac 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,120 +27,87 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Anonymous SASL bind request implementation.
  */
-final class AnonymousSASLBindRequestImpl extends
-    AbstractSASLBindRequest<AnonymousSASLBindRequest> implements
-    AnonymousSASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private Client(final AnonymousSASLBindRequestImpl initialBindRequest,
-        final String serverName)
-    {
-      super(initialBindRequest);
-      setNextSASLCredentials(ByteString.valueOf(initialBindRequest
-          .getTraceString()));
+final class AnonymousSASLBindRequestImpl extends AbstractSASLBindRequest<AnonymousSASLBindRequest>
+        implements AnonymousSASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private Client(final AnonymousSASLBindRequestImpl initialBindRequest,
+                final String serverName) {
+            super(initialBindRequest);
+            setNextSASLCredentials(ByteString.valueOf(initialBindRequest.getTraceString()));
+        }
     }
-  }
 
+    private String traceString;
 
+    AnonymousSASLBindRequestImpl(final String traceString) {
+        Validator.ensureNotNull(traceString);
+        this.traceString = traceString;
+    }
 
-  private String traceString;
+    /**
+     * Creates a new anonymous SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param anonymousSASLBindRequest
+     *            The anonymous SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code anonymousSASLBindRequest} was {@code null} .
+     */
+    AnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest anonymousSASLBindRequest) {
+        super(anonymousSASLBindRequest);
+        this.traceString = anonymousSASLBindRequest.getTraceString();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public BindClient createBindClient(final String serverName) {
+        return new Client(this, serverName);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
 
-  AnonymousSASLBindRequestImpl(final String traceString)
-  {
-    Validator.ensureNotNull(traceString);
-    this.traceString = traceString;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String getTraceString() {
+        return traceString;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AnonymousSASLBindRequest setTraceString(final String traceString) {
+        Validator.ensureNotNull(traceString);
+        this.traceString = traceString;
+        return this;
+    }
 
-
-  /**
-   * Creates a new anonymous SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param anonymousSASLBindRequest
-   *          The anonymous SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code anonymousSASLBindRequest} was {@code null} .
-   */
-  AnonymousSASLBindRequestImpl(
-      final AnonymousSASLBindRequest anonymousSASLBindRequest)
-  {
-    super(anonymousSASLBindRequest);
-    this.traceString = anonymousSASLBindRequest.getTraceString();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public BindClient createBindClient(final String serverName)
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getTraceString()
-  {
-    return traceString;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AnonymousSASLBindRequest setTraceString(final String traceString)
-  {
-    Validator.ensureNotNull(traceString);
-    this.traceString = traceString;
-    return this;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AnonymousSASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    builder.append(", traceString=");
-    builder.append(traceString);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AnonymousSASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        builder.append(", traceString=");
+        builder.append(traceString);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java
index 039ca1b..250fe15 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,73 +26,62 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.responses.BindResult;
 
-
-
 /**
  * An authentication client which can be used to bind to a server. Specifically,
  * a bind client manages the state associated with multi-stage authentication
  * attempts and responds to any challenges returned by the server.
  */
-public interface BindClient
-{
-  /**
-   * Disposes of any system resources or security-sensitive information that
-   * this bind client might be using. Invoking this method invalidates this
-   * instance.
-   */
-  void dispose();
+public interface BindClient {
+    /**
+     * Disposes of any system resources or security-sensitive information that
+     * this bind client might be using. Invoking this method invalidates this
+     * instance.
+     */
+    void dispose();
 
+    /**
+     * Evaluates the provided bind result and returns {@code true} if
+     * authentication has completed successfully, or {@code false} if additional
+     * authentication steps are required (for example during a multi-stage SASL
+     * authentication attempt).
+     * <p>
+     * If additional steps are required then implementations must update their
+     * internal state based on information contained in the bind result (for
+     * example, using the server provided SASL credentials).
+     *
+     * @param result
+     *            The bind result to be evaluated.
+     * @return {@code true} if authentication has completed successfully, of
+     *         {@code false} if additional steps are required.
+     * @throws ErrorResultException
+     *             If the evaluation failed for some reason and authentication
+     *             cannot continue.
+     */
+    boolean evaluateResult(BindResult result) throws ErrorResultException;
 
+    /**
+     * Returns a connection security layer, but only if this bind client has
+     * negotiated integrity and/or privacy protection for the underlying
+     * connection. This method should only be called once authentication has
+     * completed.
+     *
+     * @return A connection security layer, or {@code null} if none was
+     *         negotiated.
+     */
+    ConnectionSecurityLayer getConnectionSecurityLayer();
 
-  /**
-   * Evaluates the provided bind result and returns {@code true} if
-   * authentication has completed successfully, or {@code false} if additional
-   * authentication steps are required (for example during a multi-stage SASL
-   * authentication attempt).
-   * <p>
-   * If additional steps are required then implementations must update their
-   * internal state based on information contained in the bind result (for
-   * example, using the server provided SASL credentials).
-   *
-   * @param result
-   *          The bind result to be evaluated.
-   * @return {@code true} if authentication has completed successfully, of
-   *         {@code false} if additional steps are required.
-   * @throws ErrorResultException
-   *           If the evaluation failed for some reason and authentication
-   *           cannot continue.
-   */
-  boolean evaluateResult(BindResult result) throws ErrorResultException;
-
-
-
-  /**
-   * Returns a connection security layer, but only if this bind client has
-   * negotiated integrity and/or privacy protection for the underlying
-   * connection. This method should only be called once authentication has
-   * completed.
-   *
-   * @return A connection security layer, or {@code null} if none was
-   *         negotiated.
-   */
-  ConnectionSecurityLayer getConnectionSecurityLayer();
-
-
-
-  /**
-   * Returns the next bind request which should be used for the next stage of
-   * authentication. Initially, this will be a copy of the original bind request
-   * used to create this bind client.
-   *
-   * @return The next bind request which should be used for the next stage of
-   *         authentication.
-   */
-  GenericBindRequest nextBindRequest();
+    /**
+     * Returns the next bind request which should be used for the next stage of
+     * authentication. Initially, this will be a copy of the original bind
+     * request used to create this bind client.
+     *
+     * @return The next bind request which should be used for the next stage of
+     *         authentication.
+     */
+    GenericBindRequest nextBindRequest();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java
index 8396e18..13e8ad0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,123 +27,92 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.responses.BindResult;
 
-
-
 /**
  * Bind client implementation.
  */
-class BindClientImpl implements BindClient, ConnectionSecurityLayer
-{
-  private final GenericBindRequest nextBindRequest;
+class BindClientImpl implements BindClient, ConnectionSecurityLayer {
+    private final GenericBindRequest nextBindRequest;
 
-
-
-  /**
-   * Creates a new abstract bind client. The next bind request will be a copy of
-   * the provided initial bind request which should be updated in subsequent
-   * bind requests forming part of this authentication.
-   *
-   * @param initialBindRequest
-   *          The initial bind request.
-   */
-  BindClientImpl(final BindRequest initialBindRequest)
-  {
-    this.nextBindRequest = new GenericBindRequestImpl(
-        initialBindRequest.getName(),
-        initialBindRequest.getAuthenticationType(), new byte[0], this);
-    for (final Control control : initialBindRequest.getControls())
-    {
-      this.nextBindRequest.addControl(control);
+    /**
+     * Creates a new abstract bind client. The next bind request will be a copy
+     * of the provided initial bind request which should be updated in
+     * subsequent bind requests forming part of this authentication.
+     *
+     * @param initialBindRequest
+     *            The initial bind request.
+     */
+    BindClientImpl(final BindRequest initialBindRequest) {
+        this.nextBindRequest =
+                new GenericBindRequestImpl(initialBindRequest.getName(), initialBindRequest
+                        .getAuthenticationType(), new byte[0], this);
+        for (final Control control : initialBindRequest.getControls()) {
+            this.nextBindRequest.addControl(control);
+        }
     }
-  }
 
+    /**
+     * Default implementation does nothing.
+     */
+    public void dispose() {
+        // Do nothing.
+    }
 
+    /**
+     * Default implementation does nothing and always returns {@code true}.
+     */
+    public boolean evaluateResult(final BindResult result) throws ErrorResultException {
+        return true;
+    }
 
-  /**
-   * Default implementation does nothing.
-   */
-  public void dispose()
-  {
-    // Do nothing.
-  }
+    /**
+     * Default implementation always returns {@code null}.
+     */
+    public ConnectionSecurityLayer getConnectionSecurityLayer() {
+        return null;
+    }
 
+    /**
+     * Returns the next bind request.
+     */
+    public final GenericBindRequest nextBindRequest() {
+        return nextBindRequest;
+    }
 
+    /**
+     * Default implementation just returns the copy of the bytes.
+     */
+    public byte[] unwrap(final byte[] incoming, final int offset, final int len)
+            throws ErrorResultException {
+        final byte[] copy = new byte[len];
+        System.arraycopy(incoming, offset, copy, 0, len);
+        return copy;
+    }
 
-  /**
-   * Default implementation does nothing and always returns {@code true}.
-   */
-  public boolean evaluateResult(final BindResult result)
-      throws ErrorResultException
-  {
-    return true;
-  }
+    /**
+     * Default implementation just returns the copy of the bytes.
+     */
+    public byte[] wrap(final byte[] outgoing, final int offset, final int len)
+            throws ErrorResultException {
+        final byte[] copy = new byte[len];
+        System.arraycopy(outgoing, offset, copy, 0, len);
+        return copy;
+    }
 
-
-
-  /**
-   * Default implementation always returns {@code null}.
-   */
-  public ConnectionSecurityLayer getConnectionSecurityLayer()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * Returns the next bind request.
-   */
-  public final GenericBindRequest nextBindRequest()
-  {
-    return nextBindRequest;
-  }
-
-
-
-  /**
-   * Default implementation just returns the copy of the bytes.
-   */
-  public byte[] unwrap(final byte[] incoming, final int offset, final int len)
-      throws ErrorResultException
-  {
-    final byte[] copy = new byte[len];
-    System.arraycopy(incoming, offset, copy, 0, len);
-    return copy;
-  }
-
-
-
-  /**
-   * Default implementation just returns the copy of the bytes.
-   */
-  public byte[] wrap(final byte[] outgoing, final int offset, final int len)
-      throws ErrorResultException
-  {
-    final byte[] copy = new byte[len];
-    System.arraycopy(outgoing, offset, copy, 0, len);
-    return copy;
-  }
-
-
-
-  /**
-   * Sets the authentication value to be used in the next bind request.
-   *
-   * @param authenticationValue
-   *          The authentication value to be used in the next bind request.
-   * @return A reference to this bind client.
-   */
-  final BindClient setNextAuthenticationValue(final byte[] authenticationValue)
-  {
-    nextBindRequest.setAuthenticationValue(authenticationValue);
-    return this;
-  }
+    /**
+     * Sets the authentication value to be used in the next bind request.
+     *
+     * @param authenticationValue
+     *            The authentication value to be used in the next bind request.
+     * @return A reference to this bind client.
+     */
+    final BindClient setNextAuthenticationValue(final byte[] authenticationValue) {
+        nextBindRequest.setAuthenticationValue(authenticationValue);
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
index ed875f3..ab91f5f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,77 +35,65 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Bind operation allows authentication information to be exchanged between
  * the client and server. The Bind operation should be thought of as the
  * "authenticate" operation.
  */
-public interface BindRequest extends Request
-{
-  /**
-   * {@inheritDoc}
-   */
-  BindRequest addControl(Control control);
+public interface BindRequest extends Request {
+    /**
+     * {@inheritDoc}
+     */
+    BindRequest addControl(Control control);
 
+    /**
+     * Creates a new bind client which can be used to perform the authentication
+     * process. This method is called by protocol implementations and is not
+     * intended for use by applications.
+     *
+     * @param serverName
+     *            The non-null fully-qualified host name of the server to
+     *            authenticate to.
+     * @return The new bind client.
+     * @throws ErrorResultException
+     *             If an error occurred while creating the bind client context.
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
+    /**
+     * Returns the authentication mechanism identifier for this generic bind
+     * request as defined by the LDAP protocol. Note that value {@code 0x80} is
+     * reserved for simple authentication and {@code 0xA3} is reserved for SASL
+     * authentication.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
-  /**
-   * Creates a new bind client which can be used to perform the authentication
-   * process. This method is called by protocol implementations and is not
-   * intended for use by applications.
-   *
-   * @param serverName
-   *          The non-null fully-qualified host name of the server to
-   *          authenticate to.
-   * @return The new bind client.
-   * @throws ErrorResultException
-   *           If an error occurred while creating the bind client context.
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-
-  /**
-   * Returns the authentication mechanism identifier for this generic bind
-   * request as defined by the LDAP protocol. Note that value {@code 0x80} is
-   * reserved for simple authentication and {@code 0xA3} is reserved for SASL
-   * authentication.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as.
-   * The name may be empty (but never {@code null}) when used for of anonymous
-   * binds, or when using SASL authentication. The server shall not dereference
-   * any aliases in locating the named object.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as. The name may be empty (but never {@code null}) when used for of
+     * anonymous binds, or when using SASL authentication. The server shall not
+     * dereference any aliases in locating the named object.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java
index 995e983..2cc31c8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,15 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The CRAM-MD5 SASL bind request as defined in draft-ietf-sasl-crammd5. This
  * SASL mechanism allows a client to perform a simple challenge-response
@@ -60,149 +55,127 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface CRAMMD5SASLBindRequest extends SASLBindRequest
-{
+public interface CRAMMD5SASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism based on CRAM-MD5 authentication.
-   */
-  public static final String SASL_MECHANISM_NAME = "CRAM-MD5";
+    /**
+     * The name of the SASL mechanism based on CRAM-MD5 authentication.
+     */
+    public static final String SASL_MECHANISM_NAME = "CRAM-MD5";
 
+    /**
+     * {@inheritDoc}
+     */
+    CRAMMD5SASLBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
-  /**
-   * {@inheritDoc}
-   */
-  CRAMMD5SASLBindRequest addControl(Control control);
+    /**
+     * Returns the authentication ID of the user. The authentication ID usually
+     * has the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authentication ID of the user.
+     */
+    String getAuthenticationID();
 
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
+    /**
+     * Returns the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @return The password of the user that the client wishes to bind as.
+     */
+    byte[] getPassword();
 
-  /**
-   * Returns the authentication ID of the user. The authentication ID usually
-   * has the form "dn:" immediately followed by the distinguished name of the
-   * user, or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authentication ID of the user.
-   */
-  String getAuthenticationID();
+    /**
+     * {@inheritDoc}
+     */
+    String getSASLMechanism();
 
+    /**
+     * Sets the authentication ID of the user. The authentication ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user.
+     * @return This bind request
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the authentication ID to
+     *             be set..
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authenticationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws NullPointerException
+     *             If {@code authenticationID} was {@code null}.
+     */
+    CRAMMD5SASLBindRequest setAuthenticationID(String authenticationID);
 
+    /**
+     * Sets the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * provided password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as,
+     *            which may be empty.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    CRAMMD5SASLBindRequest setPassword(byte[] password);
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
-
-
-
-  /**
-   * Returns the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @return The password of the user that the client wishes to bind as.
-   */
-  byte[] getPassword();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getSASLMechanism();
-
-
-
-  /**
-   * Sets the authentication ID of the user. The authentication ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user.
-   * @return This bind request
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the authentication ID to be
-   *           set..
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authenticationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws NullPointerException
-   *           If {@code authenticationID} was {@code null}.
-   */
-  CRAMMD5SASLBindRequest setAuthenticationID(String authenticationID);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * provided password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as, which
-   *          may be empty.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  CRAMMD5SASLBindRequest setPassword(byte[] password);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as. The
-   * password will be converted to a UTF-8 octet string.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  CRAMMD5SASLBindRequest setPassword(char[] password);
+    /**
+     * Sets the password of the user that the client wishes to bind as. The
+     * password will be converted to a UTF-8 octet string.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    CRAMMD5SASLBindRequest setPassword(char[] password);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java
index 0d10530..8910740 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
@@ -49,245 +46,172 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * CRAM-MD5 SASL bind request implementation.
  */
-final class CRAMMD5SASLBindRequestImpl extends
-    AbstractSASLBindRequest<CRAMMD5SASLBindRequest> implements
-    CRAMMD5SASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private final SaslClient saslClient;
-    private final String authenticationID;
-    private final ByteString password;
+final class CRAMMD5SASLBindRequestImpl extends AbstractSASLBindRequest<CRAMMD5SASLBindRequest>
+        implements CRAMMD5SASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private final SaslClient saslClient;
+        private final String authenticationID;
+        private final ByteString password;
 
+        private Client(final CRAMMD5SASLBindRequestImpl initialBindRequest, final String serverName)
+                throws ErrorResultException {
+            super(initialBindRequest);
 
+            this.authenticationID = initialBindRequest.getAuthenticationID();
+            this.password = ByteString.wrap(initialBindRequest.getPassword());
 
-    private Client(final CRAMMD5SASLBindRequestImpl initialBindRequest,
-        final String serverName) throws ErrorResultException
-    {
-      super(initialBindRequest);
-
-      this.authenticationID = initialBindRequest.getAuthenticationID();
-      this.password = ByteString.wrap(initialBindRequest.getPassword());
-
-      try
-      {
-        saslClient = Sasl.createSaslClient(
-            new String[] { SASL_MECHANISM_NAME }, null, SASL_DEFAULT_PROTOCOL,
-            serverName, null, this);
-        if (saslClient.hasInitialResponse())
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+            try {
+                saslClient =
+                        Sasl.createSaslClient(new String[] { SASL_MECHANISM_NAME }, null,
+                                SASL_DEFAULT_PROTOCOL, serverName, null, this);
+                if (saslClient.hasInitialResponse()) {
+                    setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+                } else {
+                    setNextSASLCredentials((ByteString) null);
+                }
+            } catch (final SaslException e) {
+                throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
+            }
         }
-        else
-        {
-          setNextSASLCredentials((ByteString) null);
+
+        @Override
+        public void dispose() {
+            try {
+                saslClient.dispose();
+            } catch (final SaslException ignored) {
+                // Ignore the SASL exception.
+            }
         }
-      }
-      catch (final SaslException e)
-      {
-        throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
-      }
+
+        @Override
+        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
+            if (saslClient.isComplete()) {
+                return true;
+            }
+
+            try {
+                setNextSASLCredentials(saslClient.evaluateChallenge(result
+                        .getServerSASLCredentials() == null ? new byte[0] : result
+                        .getServerSASLCredentials().toByteArray()));
+                return saslClient.isComplete();
+            } catch (final SaslException e) {
+                // FIXME: I18N need to have a better error message.
+                // FIXME: Is this the best result code?
+                throw ErrorResultException.newErrorResult(Responses.newResult(
+                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                        "An error occurred during multi-stage authentication").setCause(e));
+            }
+        }
+
+        @Override
+        void handle(final NameCallback callback) throws UnsupportedCallbackException {
+            callback.setName(authenticationID);
+        }
+
+        @Override
+        void handle(final PasswordCallback callback) throws UnsupportedCallbackException {
+            callback.setPassword(password.toString().toCharArray());
+        }
     }
 
+    private String authenticationID;
 
+    private byte[] password;
+
+    CRAMMD5SASLBindRequestImpl(final String authenticationID, final byte[] password) {
+        Validator.ensureNotNull(authenticationID, password);
+        this.authenticationID = authenticationID;
+        this.password = password;
+    }
+
+    /**
+     * Creates a new CRAM MD5 SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param cramMD5SASLBindRequest
+     *            The CRAM MD5 SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code cramMD5SASLBindRequest} was {@code null} .
+     */
+    CRAMMD5SASLBindRequestImpl(final CRAMMD5SASLBindRequest cramMD5SASLBindRequest) {
+        super(cramMD5SASLBindRequest);
+        this.authenticationID = cramMD5SASLBindRequest.getAuthenticationID();
+        this.password = copyOfBytes(cramMD5SASLBindRequest.getPassword());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new Client(this, serverName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getAuthenticationID() {
+        return authenticationID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getPassword() {
+        return password;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CRAMMD5SASLBindRequest setAuthenticationID(final String authenticationID) {
+        Validator.ensureNotNull(authenticationID);
+        this.authenticationID = authenticationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CRAMMD5SASLBindRequest setPassword(final byte[] password) {
+        Validator.ensureNotNull(password);
+        this.password = password;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CRAMMD5SASLBindRequest setPassword(final char[] password) {
+        Validator.ensureNotNull(password);
+        this.password = StaticUtils.getBytes(password);
+        return this;
+    }
 
     @Override
-    public void dispose()
-    {
-      try
-      {
-        saslClient.dispose();
-      }
-      catch (final SaslException ignored)
-      {
-        // Ignore the SASL exception.
-      }
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("CRAMMD5SASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        builder.append(", authenticationID=");
+        builder.append(authenticationID);
+        builder.append(", password=");
+        builder.append(ByteString.wrap(password));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    @Override
-    public boolean evaluateResult(final BindResult result)
-        throws ErrorResultException
-    {
-      if (saslClient.isComplete())
-      {
-        return true;
-      }
-
-      try
-      {
-        setNextSASLCredentials(saslClient.evaluateChallenge(result
-            .getServerSASLCredentials() == null ? new byte[0] :
-            result.getServerSASLCredentials().toByteArray()));
-        return saslClient.isComplete();
-      }
-      catch (final SaslException e)
-      {
-        // FIXME: I18N need to have a better error message.
-        // FIXME: Is this the best result code?
-        throw ErrorResultException.newErrorResult(Responses.newResult(
-            ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-            "An error occurred during multi-stage authentication")
-            .setCause(e));
-      }
-    }
-
-
-
-    @Override
-    void handle(final NameCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setName(authenticationID);
-    }
-
-
-
-    @Override
-    void handle(final PasswordCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setPassword(password.toString().toCharArray());
-    }
-  }
-
-
-
-  private String authenticationID;
-
-  private byte[] password;
-
-
-
-  CRAMMD5SASLBindRequestImpl(final String authenticationID,
-      final byte[] password)
-  {
-    Validator.ensureNotNull(authenticationID, password);
-    this.authenticationID = authenticationID;
-    this.password = password;
-  }
-
-
-
-  /**
-   * Creates a new CRAM MD5 SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param cramMD5SASLBindRequest
-   *          The CRAM MD5 SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code cramMD5SASLBindRequest} was {@code null} .
-   */
-  CRAMMD5SASLBindRequestImpl(
-      final CRAMMD5SASLBindRequest cramMD5SASLBindRequest)
-  {
-    super(cramMD5SASLBindRequest);
-    this.authenticationID = cramMD5SASLBindRequest.getAuthenticationID();
-    this.password = copyOfBytes(cramMD5SASLBindRequest.getPassword());
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getAuthenticationID()
-  {
-    return authenticationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] getPassword()
-  {
-    return password;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CRAMMD5SASLBindRequest setAuthenticationID(
-      final String authenticationID)
-  {
-    Validator.ensureNotNull(authenticationID);
-    this.authenticationID = authenticationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CRAMMD5SASLBindRequest setPassword(final byte[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CRAMMD5SASLBindRequest setPassword(final char[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = StaticUtils.getBytes(password);
-    return this;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("CRAMMD5SASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    builder.append(", authenticationID=");
-    builder.append(authenticationID);
-    builder.append(", password=");
-    builder.append(ByteString.wrap(password));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java
index 52b7f2e..ddf14c8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -40,8 +37,6 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 
-
-
 /**
  * The cancel extended request as defined in RFC 3909. This operation is similar
  * to the abandon operation, except that it has a response and also requires the
@@ -53,90 +48,71 @@
  * @see <a href="http://tools.ietf.org/html/rfc3909">RFC 3909 - Lightweight
  *      Directory Access Protocol (LDAP) Cancel Operation </a>
  */
-public interface CancelExtendedRequest extends ExtendedRequest<ExtendedResult>
-{
+public interface CancelExtendedRequest extends ExtendedRequest<ExtendedResult> {
 
-  /**
-   * The OID for the cancel extended operation request.
-   */
-  public static final String OID = "1.3.6.1.1.8";
+    /**
+     * The OID for the cancel extended operation request.
+     */
+    public static final String OID = "1.3.6.1.1.8";
 
-  /**
-   * A decoder which can be used to decode cancel extended operation requests.
-   */
-  public static final ExtendedRequestDecoder<CancelExtendedRequest,
-                                             ExtendedResult> DECODER =
-    new CancelExtendedRequestImpl.RequestDecoder();
+    /**
+     * A decoder which can be used to decode cancel extended operation requests.
+     */
+    public static final ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> DECODER =
+            new CancelExtendedRequestImpl.RequestDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    CancelExtendedRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  CancelExtendedRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * Returns the request ID of the request to be abandoned.
+     *
+     * @return The request ID of the request to be abandoned.
+     */
+    int getRequestID();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResultDecoder<ExtendedResult> getResultDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * Returns the request ID of the request to be abandoned.
-   *
-   * @return The request ID of the request to be abandoned.
-   */
-  int getRequestID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResultDecoder<ExtendedResult> getResultDecoder();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Sets the request ID of the request to be abandoned.
-   *
-   * @param id
-   *          The request ID of the request to be abandoned.
-   * @return This abandon request.
-   * @throws UnsupportedOperationException
-   *           If this abandon request does not permit the request ID to be set.
-   */
-  CancelExtendedRequest setRequestID(int id);
+    /**
+     * Sets the request ID of the request to be abandoned.
+     *
+     * @param id
+     *            The request ID of the request to be abandoned.
+     * @return This abandon request.
+     * @throws UnsupportedOperationException
+     *             If this abandon request does not permit the request ID to be
+     *             set.
+     */
+    CancelExtendedRequest setRequestID(int id);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java
index 60c3ce3..89291c7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_EXTOP_CANCEL_CANNOT_DECODE_REQUEST_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_EXTOP_CANCEL_NO_REQUEST_VALUE;
@@ -40,211 +37,163 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.responses.AbstractExtendedResultDecoder;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 import org.forgerock.opendj.ldap.responses.Responses;
 
-
-
 /**
  * Cancel extended request implementation.
  */
 final class CancelExtendedRequestImpl extends
-    AbstractExtendedRequest<CancelExtendedRequest, ExtendedResult> implements
-    CancelExtendedRequest
-{
-  static final class RequestDecoder implements
-      ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult>
-  {
-    public CancelExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      final ByteString requestValue = request.getValue();
-      if ((requestValue == null) || (requestValue.length() <= 0))
-      {
-        throw DecodeException.error(ERR_EXTOP_CANCEL_NO_REQUEST_VALUE.get());
-      }
+        AbstractExtendedRequest<CancelExtendedRequest, ExtendedResult> implements
+        CancelExtendedRequest {
+    static final class RequestDecoder implements
+            ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> {
+        public CancelExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request,
+                final DecodeOptions options) throws DecodeException {
+            final ByteString requestValue = request.getValue();
+            if ((requestValue == null) || (requestValue.length() <= 0)) {
+                throw DecodeException.error(ERR_EXTOP_CANCEL_NO_REQUEST_VALUE.get());
+            }
 
-      try
-      {
-        final ASN1Reader reader = ASN1.getReader(requestValue);
-        reader.readStartSequence();
-        final int idToCancel = (int) reader.readInteger();
-        reader.readEndSequence();
+            try {
+                final ASN1Reader reader = ASN1.getReader(requestValue);
+                reader.readStartSequence();
+                final int idToCancel = (int) reader.readInteger();
+                reader.readEndSequence();
 
-        final CancelExtendedRequest newRequest = new CancelExtendedRequestImpl(
-            idToCancel);
+                final CancelExtendedRequest newRequest = new CancelExtendedRequestImpl(idToCancel);
 
-        for (final Control control : request.getControls())
-        {
-          newRequest.addControl(control);
+                for (final Control control : request.getControls()) {
+                    newRequest.addControl(control);
+                }
+
+                return newRequest;
+            } catch (final IOException e) {
+                final LocalizableMessage message =
+                        ERR_EXTOP_CANCEL_CANNOT_DECODE_REQUEST_VALUE.get(getExceptionMessage(e));
+                throw DecodeException.error(message, e);
+            }
+        }
+    }
+
+    private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> {
+        public ExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
         }
 
-        return newRequest;
-      }
-      catch (final IOException e)
-      {
-        final LocalizableMessage message = ERR_EXTOP_CANCEL_CANNOT_DECODE_REQUEST_VALUE
-            .get(getExceptionMessage(e));
-        throw DecodeException.error(message, e);
-      }
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<ExtendedResult>
-  {
-    public ExtendedResult newExtendedErrorResult(final ResultCode resultCode,
-        final String matchedDN, final String diagnosticMessage)
-    {
-      return Responses.newGenericExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
+        public ExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            // TODO: Should we check to make sure OID and value is null?
+            return result;
+        }
     }
 
+    private int requestID;
 
+    // No need to expose this.
+    private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder();
 
-    public ExtendedResult decodeExtendedResult(final ExtendedResult result,
-        final DecodeOptions options) throws DecodeException
-    {
-      // TODO: Should we check to make sure OID and value is null?
-      return result;
-    }
-  }
-
-
-
-  private int requestID;
-
-  // No need to expose this.
-  private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder();
-
-
-
-  // Instantiation via factory.
-  CancelExtendedRequestImpl(final int requestID)
-  {
-    this.requestID = requestID;
-  }
-
-
-
-  /**
-   * Creates a new cancel extended request that is an exact copy of the provided
-   * request.
-   *
-   * @param cancelExtendedRequest
-   *          The cancel extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code cancelExtendedRequest} was {@code null} .
-   */
-  CancelExtendedRequestImpl(final CancelExtendedRequest cancelExtendedRequest)
-  {
-    super(cancelExtendedRequest);
-    this.requestID = cancelExtendedRequest.getRequestID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int getRequestID()
-  {
-    return requestID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<ExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder(6);
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-
-    try
-    {
-      writer.writeStartSequence();
-      writer.writeInteger(requestID);
-      writer.writeEndSequence();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+    // Instantiation via factory.
+    CancelExtendedRequestImpl(final int requestID) {
+        this.requestID = requestID;
     }
 
-    return buffer.toByteString();
-  }
+    /**
+     * Creates a new cancel extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param cancelExtendedRequest
+     *            The cancel extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code cancelExtendedRequest} was {@code null} .
+     */
+    CancelExtendedRequestImpl(final CancelExtendedRequest cancelExtendedRequest) {
+        super(cancelExtendedRequest);
+        this.requestID = cancelExtendedRequest.getRequestID();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getRequestID() {
+        return requestID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<ExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder(6);
+        final ASN1Writer writer = ASN1.getWriter(buffer);
 
+        try {
+            writer.writeStartSequence();
+            writer.writeInteger(requestID);
+            writer.writeEndSequence();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  public CancelExtendedRequest setRequestID(final int id)
-  {
-    this.requestID = id;
-    return this;
-  }
+        return buffer.toByteString();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public CancelExtendedRequest setRequestID(final int id) {
+        this.requestID = id;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("CancelExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", requestID=");
-    builder.append(requestID);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("CancelExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", requestID=");
+        builder.append(requestID);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java
index 003b6b1..9ad8d85 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,17 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Compare operation allows a client to compare an assertion value with the
  * values of a particular attribute in a particular entry in the Directory.
@@ -47,170 +46,144 @@
  * the values of certain attributes (such as {@code userPassword} ) to be
  * compared but not interrogated by other means.
  */
-public interface CompareRequest extends Request
-{
-  /**
-   * {@inheritDoc}
-   */
-  CompareRequest addControl(Control control);
+public interface CompareRequest extends Request {
+    /**
+     * {@inheritDoc}
+     */
+    CompareRequest addControl(Control control);
 
+    /**
+     * Returns the assertion value to be compared.
+     *
+     * @return The assertion value.
+     */
+    ByteString getAssertionValue();
 
+    /**
+     * Returns the assertion value to be compared decoded as a UTF-8 string.
+     *
+     * @return The assertion value decoded as a UTF-8 string.
+     */
+    String getAssertionValueAsString();
 
-  /**
-   * Returns the assertion value to be compared.
-   *
-   * @return The assertion value.
-   */
-  ByteString getAssertionValue();
+    /**
+     * Returns the name of the attribute to be compared.
+     *
+     * @return The name of the attribute.
+     */
+    AttributeDescription getAttributeDescription();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * Returns the assertion value to be compared decoded as a UTF-8 string.
-   *
-   * @return The assertion value decoded as a UTF-8 string.
-   */
-  String getAssertionValueAsString();
+    /**
+     * Returns the distinguished name of the entry to be compared. The server
+     * shall not dereference any aliases in locating the entry to be compared.
+     *
+     * @return The distinguished name of the entry.
+     */
+    DN getName();
 
+    /**
+     * Sets the assertion value to be compared.
+     *
+     * @param value
+     *            The assertion value to be compared.
+     * @return This compare request.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the assertion value
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code value} was {@code null}.
+     */
+    CompareRequest setAssertionValue(ByteString value);
 
+    /**
+     * Sets the assertion value to be compared.
+     * <p>
+     * If the assertion value is not an instance of {@code ByteString} then it
+     * will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param value
+     *            The assertion value to be compared.
+     * @return This compare request.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the assertion value
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code value} was {@code null}.
+     */
+    CompareRequest setAssertionValue(Object value);
 
-  /**
-   * Returns the name of the attribute to be compared.
-   *
-   * @return The name of the attribute.
-   */
-  AttributeDescription getAttributeDescription();
+    /**
+     * Sets the name of the attribute to be compared.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @return This compare request.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the attribute
+     *             description to be set.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    CompareRequest setAttributeDescription(AttributeDescription attributeDescription);
 
+    /**
+     * Sets the name of the attribute to be compared.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @return This compare request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the default schema.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the attribute
+     *             description to be set.
+     * @throws NullPointerException
+     *             If {@code attributeDescription} was {@code null}.
+     */
+    CompareRequest setAttributeDescription(String attributeDescription);
 
+    /**
+     * Sets the distinguished name of the entry to be compared. The server shall
+     * not dereference any aliases in locating the entry to be compared.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be compared.
+     * @return This compare request.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the distinguished
+     *             name to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    CompareRequest setName(DN dn);
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the distinguished name of the entry to be compared. The server
-   * shall not dereference any aliases in locating the entry to be compared.
-   *
-   * @return The distinguished name of the entry.
-   */
-  DN getName();
-
-
-
-  /**
-   * Sets the assertion value to be compared.
-   *
-   * @param value
-   *          The assertion value to be compared.
-   * @return This compare request.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the assertion value to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code value} was {@code null}.
-   */
-  CompareRequest setAssertionValue(ByteString value);
-
-
-
-  /**
-   * Sets the assertion value to be compared.
-   * <p>
-   * If the assertion value is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param value
-   *          The assertion value to be compared.
-   * @return This compare request.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the assertion value to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code value} was {@code null}.
-   */
-  CompareRequest setAssertionValue(Object value);
-
-
-
-  /**
-   * Sets the name of the attribute to be compared.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @return This compare request.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the attribute description
-   *           to be set.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  CompareRequest setAttributeDescription(
-      AttributeDescription attributeDescription);
-
-
-
-  /**
-   * Sets the name of the attribute to be compared.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @return This compare request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           default schema.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the attribute description
-   *           to be set.
-   * @throws NullPointerException
-   *           If {@code attributeDescription} was {@code null}.
-   */
-  CompareRequest setAttributeDescription(String attributeDescription);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be compared. The server shall
-   * not dereference any aliases in locating the entry to be compared.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be compared.
-   * @return This compare request.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  CompareRequest setName(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be compared. The server shall
-   * not dereference any aliases in locating the entry to be compared.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be compared.
-   * @return This compare request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this compare request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  CompareRequest setName(String dn);
+    /**
+     * Sets the distinguished name of the entry to be compared. The server shall
+     * not dereference any aliases in locating the entry to be compared.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be compared.
+     * @return This compare request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this compare request does not permit the distinguished
+     *             name to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    CompareRequest setName(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java
index 6246adb..85b6c4e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,215 +27,164 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Compare request implementation.
  */
-final class CompareRequestImpl extends AbstractRequestImpl<CompareRequest>
-    implements CompareRequest
-{
+final class CompareRequestImpl extends AbstractRequestImpl<CompareRequest> implements
+        CompareRequest {
 
-  private AttributeDescription attributeDescription;
+    private AttributeDescription attributeDescription;
 
-  private ByteString assertionValue;
+    private ByteString assertionValue;
 
-  private DN name;
+    private DN name;
 
+    /**
+     * Creates a new compare request using the provided distinguished name,
+     * attribute name, and assertion value.
+     *
+     * @param name
+     *            The distinguished name of the entry to be compared.
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @param assertionValue
+     *            The assertion value to be compared.
+     * @throws NullPointerException
+     *             If {@code name}, {@code attributeDescription}, or
+     *             {@code assertionValue} was {@code null}.
+     */
+    CompareRequestImpl(final DN name, final AttributeDescription attributeDescription,
+            final ByteString assertionValue) {
+        this.name = name;
+        this.attributeDescription = attributeDescription;
+        this.assertionValue = assertionValue;
+    }
 
+    /**
+     * Creates a new compare request that is an exact copy of the provided
+     * request.
+     *
+     * @param compareRequest
+     *            The compare request to be copied.
+     * @throws NullPointerException
+     *             If {@code compareRequest} was {@code null} .
+     */
+    CompareRequestImpl(final CompareRequest compareRequest) {
+        super(compareRequest);
+        this.name = compareRequest.getName();
+        this.attributeDescription = compareRequest.getAttributeDescription();
+        this.assertionValue = compareRequest.getAssertionValue();
+    }
 
-  /**
-   * Creates a new compare request using the provided distinguished name,
-   * attribute name, and assertion value.
-   *
-   * @param name
-   *          The distinguished name of the entry to be compared.
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @param assertionValue
-   *          The assertion value to be compared.
-   * @throws NullPointerException
-   *           If {@code name}, {@code attributeDescription}, or {@code
-   *           assertionValue} was {@code null}.
-   */
-  CompareRequestImpl(final DN name,
-      final AttributeDescription attributeDescription,
-      final ByteString assertionValue)
-  {
-    this.name = name;
-    this.attributeDescription = attributeDescription;
-    this.assertionValue = assertionValue;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getAssertionValue() {
+        return assertionValue;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getAssertionValueAsString() {
+        return assertionValue.toString();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeDescription getAttributeDescription() {
+        return attributeDescription;
+    }
 
-  /**
-   * Creates a new compare request that is an exact copy of the provided
-   * request.
-   *
-   * @param compareRequest
-   *          The compare request to be copied.
-   * @throws NullPointerException
-   *           If {@code compareRequest} was {@code null} .
-   */
-  CompareRequestImpl(final CompareRequest compareRequest)
-  {
-    super(compareRequest);
-    this.name = compareRequest.getName();
-    this.attributeDescription = compareRequest.getAttributeDescription();
-    this.assertionValue = compareRequest.getAssertionValue();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setAssertionValue(final ByteString value) {
+        Validator.ensureNotNull(value);
+        this.assertionValue = value;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setAssertionValue(final Object value) {
+        Validator.ensureNotNull(value);
+        this.assertionValue = ByteString.valueOf(value);
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getAssertionValue()
-  {
-    return assertionValue;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setAttributeDescription(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        this.attributeDescription = attributeDescription;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setAttributeDescription(final String attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        this.attributeDescription = AttributeDescription.valueOf(attributeDescription);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setName(final DN dn) {
+        Validator.ensureNotNull(dn);
+        this.name = dn;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String getAssertionValueAsString()
-  {
-    return assertionValue.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public CompareRequest setName(final String dn) {
+        Validator.ensureNotNull(dn);
+        this.name = DN.valueOf(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("CompareRequest(name=");
+        builder.append(getName());
+        builder.append(", attributeDescription=");
+        builder.append(getAttributeDescription());
+        builder.append(", assertionValue=");
+        builder.append(getAssertionValueAsString());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public AttributeDescription getAttributeDescription()
-  {
-    return attributeDescription;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setAssertionValue(final ByteString value)
-  {
-    Validator.ensureNotNull(value);
-    this.assertionValue = value;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setAssertionValue(final Object value)
-  {
-    Validator.ensureNotNull(value);
-    this.assertionValue = ByteString.valueOf(value);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setAttributeDescription(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    this.attributeDescription = attributeDescription;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setAttributeDescription(
-      final String attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    this.attributeDescription = AttributeDescription
-        .valueOf(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public CompareRequest setName(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = DN.valueOf(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("CompareRequest(name=");
-    builder.append(getName());
-    builder.append(", attributeDescription=");
-    builder.append(getAttributeDescription());
-    builder.append(", assertionValue=");
-    builder.append(getAssertionValueAsString());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  CompareRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    CompareRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java
index 81f166d..e2f08d2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,9 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
@@ -41,8 +38,6 @@
 import org.forgerock.opendj.ldif.ChangeRecord;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * The Delete operation allows a client to request the removal of an entry from
  * the Directory.
@@ -51,79 +46,66 @@
  * this operation. However, addition of the {@code SubtreeDeleteControl} permits
  * whole sub-trees to be deleted using a single Delete request.
  */
-public interface DeleteRequest extends Request, ChangeRecord
-{
-  /**
-   * {@inheritDoc}
-   */
-  <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
+public interface DeleteRequest extends Request, ChangeRecord {
+    /**
+     * {@inheritDoc}
+     */
+    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
 
+    /**
+     * {@inheritDoc}
+     */
+    DeleteRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  DeleteRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the distinguished name of the entry to be deleted. The server
+     * shall not dereference any aliases in locating the entry to be deleted.
+     *
+     * @return The distinguished name of the entry.
+     */
+    DN getName();
 
+    /**
+     * Sets the distinguished name of the entry to be deleted. The server shall
+     * not dereference any aliases in locating the entry to be deleted.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be deleted.
+     * @return This delete request.
+     * @throws UnsupportedOperationException
+     *             If this delete request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    DeleteRequest setName(DN dn);
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the distinguished name of the entry to be deleted. The server shall
-   * not dereference any aliases in locating the entry to be deleted.
-   *
-   * @return The distinguished name of the entry.
-   */
-  DN getName();
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be deleted. The server shall
-   * not dereference any aliases in locating the entry to be deleted.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be deleted.
-   * @return This delete request.
-   * @throws UnsupportedOperationException
-   *           If this delete request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  DeleteRequest setName(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be deleted. The server shall
-   * not dereference any aliases in locating the entry to be deleted.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be deleted.
-   * @return This delete request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this delete request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  DeleteRequest setName(String dn);
+    /**
+     * Sets the distinguished name of the entry to be deleted. The server shall
+     * not dereference any aliases in locating the entry to be deleted.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be deleted.
+     * @return This delete request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this delete request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    DeleteRequest setName(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java
index 5d7279e..771a6e5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,122 +27,92 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Delete request implementation.
  */
-final class DeleteRequestImpl extends AbstractRequestImpl<DeleteRequest>
-    implements DeleteRequest
-{
-  private DN name;
+final class DeleteRequestImpl extends AbstractRequestImpl<DeleteRequest> implements DeleteRequest {
+    private DN name;
 
+    /**
+     * Creates a new delete request using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry to be deleted.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    DeleteRequestImpl(final DN name) {
+        this.name = name;
+    }
 
+    /**
+     * Creates a new delete request that is an exact copy of the provided
+     * request.
+     *
+     * @param deleteRequest
+     *            The add request to be copied.
+     * @throws NullPointerException
+     *             If {@code addRequest} was {@code null} .
+     */
+    DeleteRequestImpl(final DeleteRequest deleteRequest) {
+        super(deleteRequest);
+        this.name = deleteRequest.getName();
+    }
 
-  /**
-   * Creates a new delete request using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry to be deleted.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  DeleteRequestImpl(final DN name)
-  {
-    this.name = name;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DeleteRequest setName(final DN dn) {
+        Validator.ensureNotNull(dn);
+        this.name = dn;
+        return this;
+    }
 
-  /**
-   * Creates a new delete request that is an exact copy of the provided
-   * request.
-   *
-   * @param deleteRequest
-   *          The add request to be copied.
-   * @throws NullPointerException
-   *           If {@code addRequest} was {@code null} .
-   */
-  DeleteRequestImpl(final DeleteRequest deleteRequest)
-  {
-    super(deleteRequest);
-    this.name = deleteRequest.getName();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public DeleteRequest setName(final String dn) {
+        Validator.ensureNotNull(dn);
+        this.name = DN.valueOf(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("DeleteRequest(name=");
+        builder.append(getName());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DeleteRequest setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DeleteRequest setName(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = DN.valueOf(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("DeleteRequest(name=");
-    builder.append(getName());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  DeleteRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    DeleteRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java
index 10e37db..c9b0960 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,20 +27,16 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 import java.util.Map;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The DIGEST-MD5 SASL bind request as defined in RFC 2831. This SASL mechanism
  * allows a client to perform a challenge-response authentication method,
@@ -61,485 +56,436 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface DigestMD5SASLBindRequest extends SASLBindRequest
-{
+public interface DigestMD5SASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism based on DIGEST-MD5 authentication.
-   */
-  public static final String SASL_MECHANISM_NAME = "DIGEST-MD5";
+    /**
+     * The name of the SASL mechanism based on DIGEST-MD5 authentication.
+     */
+    public static final String SASL_MECHANISM_NAME = "DIGEST-MD5";
 
-  /**
-   * Indicates that the client will accept authentication only. More
-   * specifically, the underlying connection will not be protected using
-   * integrity protection or encryption, unless previously established using
-   * SSL/TLS. This is the default if no QOP option is present in the bind
-   * request.
-   */
-  public static final String QOP_AUTH = "auth";
+    /**
+     * Indicates that the client will accept authentication only. More
+     * specifically, the underlying connection will not be protected using
+     * integrity protection or encryption, unless previously established using
+     * SSL/TLS. This is the default if no QOP option is present in the bind
+     * request.
+     */
+    public static final String QOP_AUTH = "auth";
 
-  /**
-   * Indicates that the client will accept authentication with connection
-   * integrity protection. More specifically, the underlying connection will not
-   * be encrypted, unless previously established using SSL/TLS.
-   */
-  public static final String QOP_AUTH_INT = "auth-int";
+    /**
+     * Indicates that the client will accept authentication with connection
+     * integrity protection. More specifically, the underlying connection will
+     * not be encrypted, unless previously established using SSL/TLS.
+     */
+    public static final String QOP_AUTH_INT = "auth-int";
 
-  /**
-   * Indicates that the client will accept authentication with connection
-   * integrity protection and encryption.
-   */
-  public static final String QOP_AUTH_CONF = "auth-conf";
+    /**
+     * Indicates that the client will accept authentication with connection
+     * integrity protection and encryption.
+     */
+    public static final String QOP_AUTH_CONF = "auth-conf";
 
-  /**
-   * Indicates that the client will accept connection encryption using the high
-   * strength triple-DES cipher.
-   */
-  public static final String CIPHER_3DES = "3des";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * high strength triple-DES cipher.
+     */
+    public static final String CIPHER_3DES = "3des";
 
-  /**
-   * Indicates that the client will accept connection encryption using the high
-   * strength 128-bit RC4 cipher.
-   */
-  public static final String CIPHER_RC4_128 = "rc4";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * high strength 128-bit RC4 cipher.
+     */
+    public static final String CIPHER_RC4_128 = "rc4";
 
-  /**
-   * Indicates that the client will accept connection encryption using the
-   * medium strength DES cipher.
-   */
-  public static final String CIPHER_DES = "des";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * medium strength DES cipher.
+     */
+    public static final String CIPHER_DES = "des";
 
-  /**
-   * Indicates that the client will accept connection encryption using the
-   * medium strength 56-bit RC4 cipher.
-   */
-  public static final String CIPHER_RC4_56 = "rc4-56";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * medium strength 56-bit RC4 cipher.
+     */
+    public static final String CIPHER_RC4_56 = "rc4-56";
 
-  /**
-   * Indicates that the client will accept connection encryption using the low
-   * strength 40-bit RC4 cipher.
-   */
-  public static final String CIPHER_RC4_40 = "rc4-40";
+    /**
+     * Indicates that the client will accept connection encryption using the low
+     * strength 40-bit RC4 cipher.
+     */
+    public static final String CIPHER_RC4_40 = "rc4-40";
 
-  /**
-   * Indicates that the client will accept connection encryption using the
-   * strongest supported cipher, as long as the cipher is considered to be high
-   * strength.
-   */
-  public static final String CIPHER_HIGH = "high";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * strongest supported cipher, as long as the cipher is considered to be
+     * high strength.
+     */
+    public static final String CIPHER_HIGH = "high";
 
-  /**
-   * Indicates that the client will accept connection encryption using the
-   * strongest supported cipher, as long as the cipher is considered to be high
-   * or medium strength.
-   */
-  public static final String CIPHER_MEDIUM = "medium";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * strongest supported cipher, as long as the cipher is considered to be
+     * high or medium strength.
+     */
+    public static final String CIPHER_MEDIUM = "medium";
 
-  /**
-   * Indicates that the client will accept connection encryption using the
-   * strongest supported cipher, even if the strongest cipher is considered to
-   * be medium or low strength.
-   */
-  public static final String CIPHER_LOW = "low";
+    /**
+     * Indicates that the client will accept connection encryption using the
+     * strongest supported cipher, even if the strongest cipher is considered to
+     * be medium or low strength.
+     */
+    public static final String CIPHER_LOW = "low";
 
+    /**
+     * Adds the provided additional authentication parameter to the list of
+     * parameters to be passed to the underlying mechanism implementation. This
+     * method is provided in order to allow for future extensions.
+     *
+     * @param name
+     *            The name of the additional authentication parameter.
+     * @param value
+     *            The value of the additional authentication parameter.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit additional
+     *             authentication parameters to be added.
+     * @throws NullPointerException
+     *             If {@code name} or {@code value} was {@code null}.
+     */
+    DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value);
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    DigestMD5SASLBindRequest addControl(Control control);
 
-  /**
-   * Adds the provided additional authentication parameter to the list of
-   * parameters to be passed to the underlying mechanism implementation. This
-   * method is provided in order to allow for future extensions.
-   *
-   * @param name
-   *          The name of the additional authentication parameter.
-   * @param value
-   *          The value of the additional authentication parameter.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit additional authentication
-   *           parameters to be added.
-   * @throws NullPointerException
-   *           If {@code name} or {@code value} was {@code null}.
-   */
-  DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value);
+    /**
+     * Adds the provided quality of protection (QOP) values to the ordered list
+     * of QOP values that the client is willing to accept. The order of the list
+     * specifies the preference order, high to low. Authentication will fail if
+     * no QOP values are recognized or accepted by the server.
+     * <p>
+     * By default the client will accept {@link #QOP_AUTH AUTH}.
+     *
+     * @param qopValues
+     *            The quality of protection values that the client is willing to
+     *            accept.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit QOP values to be added.
+     * @throws NullPointerException
+     *             If {@code qopValues} was {@code null}.
+     * @see #QOP_AUTH
+     * @see #QOP_AUTH_INT
+     * @see #QOP_AUTH_CONF
+     */
+    DigestMD5SASLBindRequest addQOP(String... qopValues);
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
+    /**
+     * Returns a map containing the provided additional authentication
+     * parameters to be passed to the underlying mechanism implementation. This
+     * method is provided in order to allow for future extensions.
+     *
+     * @return A map containing the provided additional authentication
+     *         parameters to be passed to the underlying mechanism
+     *         implementation.
+     */
+    Map<String, String> getAdditionalAuthParams();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  DigestMD5SASLBindRequest addControl(Control control);
+    /**
+     * Returns the authentication ID of the user. The authentication ID usually
+     * has the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authentication ID of the user.
+     */
+    String getAuthenticationID();
 
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    @Override
+    byte getAuthenticationType();
 
+    /**
+     * Returns the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authorization ID of the user, which may be {@code null}.
+     */
+    String getAuthorizationID();
 
-  /**
-   * Adds the provided quality of protection (QOP) values to the ordered list of
-   * QOP values that the client is willing to accept. The order of the list
-   * specifies the preference order, high to low. Authentication will fail if no
-   * QOP values are recognized or accepted by the server.
-   * <p>
-   * By default the client will accept {@link #QOP_AUTH AUTH}.
-   *
-   * @param qopValues
-   *          The quality of protection values that the client is willing to
-   *          accept.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit QOP values to be added.
-   * @throws NullPointerException
-   *           If {@code qopValues} was {@code null}.
-   * @see #QOP_AUTH
-   * @see #QOP_AUTH_INT
-   * @see #QOP_AUTH_CONF
-   */
-  DigestMD5SASLBindRequest addQOP(String... qopValues);
+    /**
+     * Returns the cipher name or strength that the client is willing to use
+     * when connection encryption quality of protection, {@link #QOP_AUTH_CONF
+     * AUTH-CONF}, is requested.
+     * <p>
+     * By default the client will accept connection encryption using the
+     * strongest supported cipher, even if the strongest cipher is considered to
+     * be medium or low strength. This is equivalent to {@link #CIPHER_LOW}.
+     *
+     * @return The cipher that the client is willing to use if connection
+     *         encryption QOP is negotiated. May be {@code null}, indicating
+     *         that the default cipher should be used.
+     */
+    String getCipher();
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * Returns the maximum size of the receive buffer in bytes. The actual
+     * maximum number of bytes will be the minimum of this number and the peer's
+     * maximum send buffer size. The default size is 65536.
+     *
+     * @return The maximum size of the receive buffer in bytes.
+     */
+    int getMaxReceiveBufferSize();
 
+    /**
+     * Returns the maximum size of the send buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * receive buffer size. The default size is 65536.
+     *
+     * @return The maximum size of the send buffer in bytes.
+     */
+    int getMaxSendBufferSize();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    @Override
+    String getName();
 
-  /**
-   * Returns a map containing the provided additional authentication parameters
-   * to be passed to the underlying mechanism implementation. This method is
-   * provided in order to allow for future extensions.
-   *
-   * @return A map containing the provided additional authentication parameters
-   *         to be passed to the underlying mechanism implementation.
-   */
-  Map<String, String> getAdditionalAuthParams();
+    /**
+     * Returns the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @return The password of the user that the client wishes to bind as.
+     */
+    byte[] getPassword();
 
+    /**
+     * Returns the ordered list of quality of protection (QOP) values that the
+     * client is willing to accept. The order of the list specifies the
+     * preference order, high to low. Authentication will fail if no QOP values
+     * are recognized or accepted by the server.
+     * <p>
+     * By default the client will accept {@link #QOP_AUTH AUTH}.
+     *
+     * @return The list of quality of protection values that the client is
+     *         willing to accept. The returned list may be empty indicating that
+     *         the default QOP will be accepted.
+     */
+    List<String> getQOPs();
 
+    /**
+     * Returns the optional realm containing the user's account.
+     *
+     * @return The name of the realm containing the user's account, which may be
+     *         {@code null}.
+     */
+    String getRealm();
 
-  /**
-   * Returns the authentication ID of the user. The authentication ID usually
-   * has the form "dn:" immediately followed by the distinguished name of the
-   * user, or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authentication ID of the user.
-   */
-  String getAuthenticationID();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    String getSASLMechanism();
 
+    /**
+     * Returns {@code true} if the server must authenticate to the client. The
+     * default is {@code false}.
+     *
+     * @return {@code true} if the server must authenticate to the client.
+     */
+    boolean isServerAuth();
 
+    /**
+     * Sets the authentication ID of the user. The authentication ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user.
+     * @return This bind request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authenticationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the authentication ID to
+     *             be set.
+     * @throws NullPointerException
+     *             If {@code authenticationID} was {@code null}.
+     */
+    DigestMD5SASLBindRequest setAuthenticationID(String authenticationID);
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  @Override
-  byte getAuthenticationType();
-
-
-
-  /**
-   * Returns the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user, which may be {@code null}.
-   */
-  String getAuthorizationID();
-
-
-
-  /**
-   * Returns the cipher name or strength that the client is willing to use when
-   * connection encryption quality of protection, {@link #QOP_AUTH_CONF
-   * AUTH-CONF}, is requested.
-   * <p>
-   * By default the client will accept connection encryption using the strongest
-   * supported cipher, even if the strongest cipher is considered to be medium
-   * or low strength. This is equivalent to {@link #CIPHER_LOW}.
-   *
-   * @return The cipher that the client is willing to use if connection
-   *         encryption QOP is negotiated. May be {@code null}, indicating that
-   *         the default cipher should be used.
-   */
-  String getCipher();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the maximum size of the receive buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * send buffer size. The default size is 65536.
-   *
-   * @return The maximum size of the receive buffer in bytes.
-   */
-  int getMaxReceiveBufferSize();
-
-
-
-  /**
-   * Returns the maximum size of the send buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * receive buffer size. The default size is 65536.
-   *
-   * @return The maximum size of the send buffer in bytes.
-   */
-  int getMaxSendBufferSize();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  @Override
-  String getName();
-
-
-
-  /**
-   * Returns the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @return The password of the user that the client wishes to bind as.
-   */
-  byte[] getPassword();
-
-
-
-  /**
-   * Returns the ordered list of quality of protection (QOP) values that the
-   * client is willing to accept. The order of the list specifies the preference
-   * order, high to low. Authentication will fail if no QOP values are
-   * recognized or accepted by the server.
-   * <p>
-   * By default the client will accept {@link #QOP_AUTH AUTH}.
-   *
-   * @return The list of quality of protection values that the client is willing
-   *         to accept. The returned list may be empty indicating that the
-   *         default QOP will be accepted.
-   */
-  List<String> getQOPs();
-
-
-
-  /**
-   * Returns the optional realm containing the user's account.
-   *
-   * @return The name of the realm containing the user's account, which may be
-   *         {@code null}.
-   */
-  String getRealm();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  String getSASLMechanism();
-
-
-
-  /**
-   * Returns {@code true} if the server must authenticate to the client. The
-   * default is {@code false}.
-   *
-   * @return {@code true} if the server must authenticate to the client.
-   */
-  boolean isServerAuth();
-
-
-
-  /**
-   * Sets the authentication ID of the user. The authentication ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user.
-   * @return This bind request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authenticationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the authentication ID to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code authenticationID} was {@code null}.
-   */
-  DigestMD5SASLBindRequest setAuthenticationID(String authenticationID);
-
-
-
-  /**
-   * Sets the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The authorization ID of the user, which may be {@code null}.
-   * @return This bind request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the authorization ID to be
-   *           set.
-   */
-  DigestMD5SASLBindRequest setAuthorizationID(String authorizationID);
-
-
-
-  /**
-   * Sets the cipher name or strength that the client is willing to use when
-   * connection encryption quality of protection, {@link #QOP_AUTH_CONF
-   * AUTH-CONF}, is requested.
-   * <p>
-   * By default the client will accept connection encryption using the strongest
-   * supported cipher, even if the strongest cipher is considered to be medium
-   * or low strength. This is equivalent to {@link #CIPHER_LOW}.
-   *
-   * @param cipher
-   *          The cipher that the client is willing to use if connection
-   *          encryption QOP is negotiated. May be {@code null}, indicating that
-   *          the default cipher should be used.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the cipher name or strength
-   *           to be set.
-   * @see #QOP_AUTH_CONF
-   * @see #CIPHER_3DES
-   * @see #CIPHER_RC4_128
-   * @see #CIPHER_DES
-   * @see #CIPHER_RC4_56
-   * @see #CIPHER_RC4_40
-   * @see #CIPHER_HIGH
-   * @see #CIPHER_MEDIUM
-   * @see #CIPHER_LOW
-   */
-  DigestMD5SASLBindRequest setCipher(String cipher);
-
-
-
-  /**
-   * Sets the maximum size of the receive buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * send buffer size. The default size is 65536.
-   *
-   * @param size
-   *          The maximum size of the receive buffer in bytes.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the buffer size to be set.
-   */
-  DigestMD5SASLBindRequest setMaxReceiveBufferSize(int size);
-
-
-
-  /**
-   * Sets the maximum size of the send buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * receive buffer size. The default size is 65536.
-   *
-   * @param size
-   *          The maximum size of the send buffer in bytes.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the buffer size to be set.
-   */
-  DigestMD5SASLBindRequest setMaxSendBufferSize(int size);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * provided password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as, which
-   *          may be empty.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  DigestMD5SASLBindRequest setPassword(byte[] password);
-
-
+    /**
+     * Sets the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authorizationID
+     *            The authorization ID of the user, which may be {@code null}.
+     * @return This bind request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the authorization ID to
+     *             be set.
+     */
+    DigestMD5SASLBindRequest setAuthorizationID(String authorizationID);
 
-  /**
-   * Sets the password of the user that the client wishes to bind as. The
-   * password will be converted to a UTF-8 octet string.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  DigestMD5SASLBindRequest setPassword(char[] password);
+    /**
+     * Sets the cipher name or strength that the client is willing to use when
+     * connection encryption quality of protection, {@link #QOP_AUTH_CONF
+     * AUTH-CONF}, is requested.
+     * <p>
+     * By default the client will accept connection encryption using the
+     * strongest supported cipher, even if the strongest cipher is considered to
+     * be medium or low strength. This is equivalent to {@link #CIPHER_LOW}.
+     *
+     * @param cipher
+     *            The cipher that the client is willing to use if connection
+     *            encryption QOP is negotiated. May be {@code null}, indicating
+     *            that the default cipher should be used.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the cipher name or
+     *             strength to be set.
+     * @see #QOP_AUTH_CONF
+     * @see #CIPHER_3DES
+     * @see #CIPHER_RC4_128
+     * @see #CIPHER_DES
+     * @see #CIPHER_RC4_56
+     * @see #CIPHER_RC4_40
+     * @see #CIPHER_HIGH
+     * @see #CIPHER_MEDIUM
+     * @see #CIPHER_LOW
+     */
+    DigestMD5SASLBindRequest setCipher(String cipher);
 
+    /**
+     * Sets the maximum size of the receive buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * send buffer size. The default size is 65536.
+     *
+     * @param size
+     *            The maximum size of the receive buffer in bytes.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the buffer size to be
+     *             set.
+     */
+    DigestMD5SASLBindRequest setMaxReceiveBufferSize(int size);
 
+    /**
+     * Sets the maximum size of the send buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * receive buffer size. The default size is 65536.
+     *
+     * @param size
+     *            The maximum size of the send buffer in bytes.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the buffer size to be
+     *             set.
+     */
+    DigestMD5SASLBindRequest setMaxSendBufferSize(int size);
 
-  /**
-   * Sets the optional realm containing the user's account.
-   *
-   * @param realm
-   *          The name of the realm containing the user's account, which may be
-   *          {@code null}.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the realm to be set.
-   * @throws NullPointerException
-   *           If {@code realm} was {@code null}.
-   */
-  DigestMD5SASLBindRequest setRealm(String realm);
+    /**
+     * Sets the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * provided password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as,
+     *            which may be empty.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    DigestMD5SASLBindRequest setPassword(byte[] password);
 
+    /**
+     * Sets the password of the user that the client wishes to bind as. The
+     * password will be converted to a UTF-8 octet string.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    DigestMD5SASLBindRequest setPassword(char[] password);
 
+    /**
+     * Sets the optional realm containing the user's account.
+     *
+     * @param realm
+     *            The name of the realm containing the user's account, which may
+     *            be {@code null}.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the realm to be set.
+     * @throws NullPointerException
+     *             If {@code realm} was {@code null}.
+     */
+    DigestMD5SASLBindRequest setRealm(String realm);
 
-  /**
-   * Specifies whether or not the server must authenticate to the client. The
-   * default is {@code false}.
-   *
-   * @param serverAuth
-   *          {@code true} if the server must authenticate to the client or
-   *          {@code false} otherwise.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit server auth to be set.
-   */
-  DigestMD5SASLBindRequest setServerAuth(boolean serverAuth);
+    /**
+     * Specifies whether or not the server must authenticate to the client. The
+     * default is {@code false}.
+     *
+     * @param serverAuth
+     *            {@code true} if the server must authenticate to the client or
+     *            {@code false} otherwise.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit server auth to be set.
+     */
+    DigestMD5SASLBindRequest setServerAuth(boolean serverAuth);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java
index bf66b09..9920bbd 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,15 +27,17 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static com.forgerock.opendj.util.StaticUtils.joinCollection;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_SASL_PROTOCOL_ERROR;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
-import java.util.*;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
@@ -56,598 +57,434 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Digest-MD5 SASL bind request implementation.
  */
-final class DigestMD5SASLBindRequestImpl extends
-    AbstractSASLBindRequest<DigestMD5SASLBindRequest> implements
-    DigestMD5SASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private final SaslClient saslClient;
-    private final String authenticationID;
-    private final ByteString password;
-    private final String realm;
+final class DigestMD5SASLBindRequestImpl extends AbstractSASLBindRequest<DigestMD5SASLBindRequest>
+        implements DigestMD5SASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private final SaslClient saslClient;
+        private final String authenticationID;
+        private final ByteString password;
+        private final String realm;
 
+        private Client(final DigestMD5SASLBindRequestImpl initialBindRequest,
+                final String serverName) throws ErrorResultException {
+            super(initialBindRequest);
 
+            this.authenticationID = initialBindRequest.getAuthenticationID();
+            this.password = ByteString.wrap(initialBindRequest.getPassword());
+            this.realm = initialBindRequest.getRealm();
 
-    private Client(final DigestMD5SASLBindRequestImpl initialBindRequest,
-        final String serverName) throws ErrorResultException
-    {
-      super(initialBindRequest);
+            // Create property map containing all the parameters.
+            final Map<String, String> props = new HashMap<String, String>();
 
-      this.authenticationID = initialBindRequest.getAuthenticationID();
-      this.password = ByteString.wrap(initialBindRequest.getPassword());
-      this.realm = initialBindRequest.getRealm();
+            final List<String> qopValues = initialBindRequest.getQOPs();
+            if (!qopValues.isEmpty()) {
+                props.put(Sasl.QOP, joinCollection(qopValues, ","));
+            }
 
-      // Create property map containing all the parameters.
-      final Map<String, String> props = new HashMap<String, String>();
+            final String cipher = initialBindRequest.getCipher();
+            if (cipher != null) {
+                if (cipher.equalsIgnoreCase(CIPHER_LOW)) {
+                    props.put(Sasl.STRENGTH, "high,medium,low");
+                } else if (cipher.equalsIgnoreCase(CIPHER_MEDIUM)) {
+                    props.put(Sasl.STRENGTH, "high,medium");
+                } else if (cipher.equalsIgnoreCase(CIPHER_HIGH)) {
+                    props.put(Sasl.STRENGTH, "high");
+                } else {
+                    // Default strength allows all ciphers, so specifying a
+                    // single cipher
+                    // cannot be incompatible with the strength.
+                    props.put("com.sun.security.sasl.digest.cipher", cipher);
+                }
+            }
 
-      final List<String> qopValues = initialBindRequest.getQOPs();
-      if (!qopValues.isEmpty())
-      {
-        props.put(Sasl.QOP, joinCollection(qopValues, ","));
-      }
+            final Boolean serverAuth = initialBindRequest.isServerAuth();
+            if (serverAuth != null) {
+                props.put(Sasl.SERVER_AUTH, String.valueOf(serverAuth));
+            }
 
-      final String cipher = initialBindRequest.getCipher();
-      if (cipher != null)
-      {
-        if (cipher.equalsIgnoreCase(CIPHER_LOW))
-        {
-          props.put(Sasl.STRENGTH, "high,medium,low");
+            Integer size = initialBindRequest.getMaxReceiveBufferSize();
+            if (size != null) {
+                props.put(Sasl.MAX_BUFFER, String.valueOf(size));
+            }
+
+            size = initialBindRequest.getMaxSendBufferSize();
+            if (size != null) {
+                props.put("javax.security.sasl.sendmaxbuffer", String.valueOf(size));
+            }
+
+            for (final Map.Entry<String, String> e : initialBindRequest.getAdditionalAuthParams()
+                    .entrySet()) {
+                props.put(e.getKey(), e.getValue());
+            }
+
+            // Now create the client.
+            try {
+                saslClient =
+                        Sasl.createSaslClient(new String[] { SASL_MECHANISM_NAME },
+                                initialBindRequest.getAuthorizationID(), SASL_DEFAULT_PROTOCOL,
+                                serverName, props, this);
+                if (saslClient.hasInitialResponse()) {
+                    setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+                } else {
+                    setNextSASLCredentials((ByteString) null);
+                }
+            } catch (final SaslException e) {
+                throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
+            }
         }
-        else if (cipher.equalsIgnoreCase(CIPHER_MEDIUM))
-        {
-          props.put(Sasl.STRENGTH, "high,medium");
-        }
-        else if (cipher.equalsIgnoreCase(CIPHER_HIGH))
-        {
-          props.put(Sasl.STRENGTH, "high");
-        }
-        else
-        {
-          // Default strength allows all ciphers, so specifying a single cipher
-          // cannot be incompatible with the strength.
-          props.put("com.sun.security.sasl.digest.cipher", cipher);
-        }
-      }
 
-      final Boolean serverAuth = initialBindRequest.isServerAuth();
-      if (serverAuth != null)
-      {
-        props.put(Sasl.SERVER_AUTH, String.valueOf(serverAuth));
-      }
-
-      Integer size = initialBindRequest.getMaxReceiveBufferSize();
-      if (size != null)
-      {
-        props.put(Sasl.MAX_BUFFER, String.valueOf(size));
-      }
-
-      size = initialBindRequest.getMaxSendBufferSize();
-      if (size != null)
-      {
-        props.put("javax.security.sasl.sendmaxbuffer", String.valueOf(size));
-      }
-
-      for (final Map.Entry<String, String> e : initialBindRequest
-          .getAdditionalAuthParams().entrySet())
-      {
-        props.put(e.getKey(), e.getValue());
-      }
-
-      // Now create the client.
-      try
-      {
-        saslClient = Sasl.createSaslClient(
-            new String[] { SASL_MECHANISM_NAME },
-            initialBindRequest.getAuthorizationID(), SASL_DEFAULT_PROTOCOL,
-            serverName, props, this);
-        if (saslClient.hasInitialResponse())
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+        @Override
+        public void dispose() {
+            try {
+                saslClient.dispose();
+            } catch (final SaslException ignored) {
+                // Ignore the SASL exception.
+            }
         }
-        else
-        {
-          setNextSASLCredentials((ByteString) null);
+
+        @Override
+        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
+            if (saslClient.isComplete()) {
+                return true;
+            }
+
+            try {
+                setNextSASLCredentials(saslClient.evaluateChallenge(result
+                        .getServerSASLCredentials() == null ? new byte[0] : result
+                        .getServerSASLCredentials().toByteArray()));
+                return saslClient.isComplete();
+            } catch (final SaslException e) {
+                // FIXME: I18N need to have a better error message.
+                // FIXME: Is this the best result code?
+                throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR,
+                        "An error occurred during multi-stage authentication", e);
+            }
         }
-      }
-      catch (final SaslException e)
-      {
-        throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
-      }
+
+        @Override
+        public ConnectionSecurityLayer getConnectionSecurityLayer() {
+            final String qop = (String) saslClient.getNegotiatedProperty(Sasl.QOP);
+            if (qop.equalsIgnoreCase("auth-int") || qop.equalsIgnoreCase("auth-conf")) {
+                return this;
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public byte[] unwrap(final byte[] incoming, final int offset, final int len)
+                throws ErrorResultException {
+            try {
+                return saslClient.unwrap(incoming, offset, len);
+            } catch (final SaslException e) {
+                final LocalizableMessage msg =
+                        ERR_SASL_PROTOCOL_ERROR.get(SASL_MECHANISM_NAME, getExceptionMessage(e));
+                throw newErrorResult(ResultCode.CLIENT_SIDE_DECODING_ERROR, msg.toString(), e);
+            }
+        }
+
+        @Override
+        public byte[] wrap(final byte[] outgoing, final int offset, final int len)
+                throws ErrorResultException {
+            try {
+                return saslClient.wrap(outgoing, offset, len);
+            } catch (final SaslException e) {
+                final LocalizableMessage msg =
+                        ERR_SASL_PROTOCOL_ERROR.get(SASL_MECHANISM_NAME, getExceptionMessage(e));
+                throw newErrorResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR, msg.toString(), e);
+            }
+        }
+
+        @Override
+        void handle(final NameCallback callback) throws UnsupportedCallbackException {
+            callback.setName(authenticationID);
+        }
+
+        @Override
+        void handle(final PasswordCallback callback) throws UnsupportedCallbackException {
+            callback.setPassword(password.toString().toCharArray());
+        }
+
+        @Override
+        void handle(final RealmCallback callback) throws UnsupportedCallbackException {
+            if (realm == null) {
+                callback.setText(callback.getDefaultText());
+            } else {
+                callback.setText(realm);
+            }
+        }
+
     }
 
+    private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>();
+    private final List<String> qopValues = new LinkedList<String>();
+    private String cipher = null;
 
+    // Don't use primitives for these so that we can distinguish between default
+    // settings (null) and values set by the caller.
+    private Boolean serverAuth = null;
+    private Integer maxReceiveBufferSize = null;
+    private Integer maxSendBufferSize = null;
 
-    @Override
-    public void dispose()
-    {
-      try
-      {
-        saslClient.dispose();
-      }
-      catch (final SaslException ignored)
-      {
-        // Ignore the SASL exception.
-      }
+    private String authenticationID;
+    private String authorizationID = null;
+    private byte[] password;
+    private String realm = null;
+
+    DigestMD5SASLBindRequestImpl(final String authenticationID, final byte[] password) {
+        Validator.ensureNotNull(authenticationID, password);
+        this.authenticationID = authenticationID;
+        this.password = password;
     }
 
+    /**
+     * Creates a new digest MD5 SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param digestMD5SASLBindRequest
+     *            The digest MD5 SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code digestMD5SASLBindRequest} was {@code null} .
+     */
+    DigestMD5SASLBindRequestImpl(final DigestMD5SASLBindRequest digestMD5SASLBindRequest) {
+        super(digestMD5SASLBindRequest);
+        this.additionalAuthParams.putAll(digestMD5SASLBindRequest.getAdditionalAuthParams());
+        this.qopValues.addAll(digestMD5SASLBindRequest.getQOPs());
+        this.cipher = digestMD5SASLBindRequest.getCipher();
 
+        this.serverAuth = digestMD5SASLBindRequest.isServerAuth();
+        this.maxReceiveBufferSize = digestMD5SASLBindRequest.getMaxReceiveBufferSize();
+        this.maxSendBufferSize = digestMD5SASLBindRequest.getMaxSendBufferSize();
 
-    @Override
-    public boolean evaluateResult(final BindResult result)
-        throws ErrorResultException
-    {
-      if (saslClient.isComplete())
-      {
-        return true;
-      }
-
-      try
-      {
-        setNextSASLCredentials(saslClient.evaluateChallenge(result
-            .getServerSASLCredentials() == null ? new byte[0] : result
-            .getServerSASLCredentials().toByteArray()));
-        return saslClient.isComplete();
-      }
-      catch (final SaslException e)
-      {
-        // FIXME: I18N need to have a better error message.
-        // FIXME: Is this the best result code?
-        throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR,
-            "An error occurred during multi-stage authentication", e);
-      }
+        this.authenticationID = digestMD5SASLBindRequest.getAuthenticationID();
+        this.authorizationID = digestMD5SASLBindRequest.getAuthorizationID();
+        this.password = copyOfBytes(digestMD5SASLBindRequest.getPassword());
+        this.realm = digestMD5SASLBindRequest.getRealm();
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public ConnectionSecurityLayer getConnectionSecurityLayer()
-    {
-      final String qop = (String) saslClient.getNegotiatedProperty(Sasl.QOP);
-      if (qop.equalsIgnoreCase("auth-int") || qop.equalsIgnoreCase("auth-conf"))
-      {
+    public DigestMD5SASLBindRequest addAdditionalAuthParam(final String name, final String value) {
+        Validator.ensureNotNull(name, value);
+        additionalAuthParams.put(name, value);
         return this;
-      }
-      else
-      {
-        return null;
-      }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest addQOP(final String... qopValues) {
+        for (final String qopValue : qopValues) {
+            this.qopValues.add(Validator.ensureNotNull(qopValue));
+        }
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new Client(this, serverName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Map<String, String> getAdditionalAuthParams() {
+        return additionalAuthParams;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getAuthenticationID() {
+        return authenticationID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getAuthorizationID() {
+        return authorizationID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getCipher() {
+        return cipher;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getMaxReceiveBufferSize() {
+        return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getMaxSendBufferSize() {
+        return maxSendBufferSize == null ? 65536 : maxSendBufferSize;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public byte[] getPassword() {
+        return password;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<String> getQOPs() {
+        return qopValues;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getRealm() {
+        return realm;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isServerAuth() {
+        return serverAuth == null ? false : serverAuth;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setAuthenticationID(final String authenticationID) {
+        Validator.ensureNotNull(authenticationID);
+        this.authenticationID = authenticationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setAuthorizationID(final String authorizationID) {
+        this.authorizationID = authorizationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setCipher(final String cipher) {
+        this.cipher = cipher;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setMaxReceiveBufferSize(final int size) {
+        maxReceiveBufferSize = size;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setMaxSendBufferSize(final int size) {
+        maxSendBufferSize = size;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setPassword(final byte[] password) {
+        Validator.ensureNotNull(password);
+        this.password = password;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setPassword(final char[] password) {
+        Validator.ensureNotNull(password);
+        this.password = StaticUtils.getBytes(password);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setRealm(final String realm) {
+        this.realm = realm;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DigestMD5SASLBindRequest setServerAuth(final boolean serverAuth) {
+        this.serverAuth = serverAuth;
+        return this;
+    }
 
     @Override
-    public byte[] unwrap(final byte[] incoming, final int offset, final int len)
-        throws ErrorResultException
-    {
-      try
-      {
-        return saslClient.unwrap(incoming, offset, len);
-      }
-      catch (final SaslException e)
-      {
-        final LocalizableMessage msg = ERR_SASL_PROTOCOL_ERROR.get(
-            SASL_MECHANISM_NAME, getExceptionMessage(e));
-        throw newErrorResult(ResultCode.CLIENT_SIDE_DECODING_ERROR,
-            msg.toString(), e);
-      }
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("DigestMD5SASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        builder.append(", authenticationID=");
+        builder.append(authenticationID);
+        builder.append(", authorizationID=");
+        builder.append(authorizationID);
+        builder.append(", realm=");
+        builder.append(realm);
+        builder.append(", password=");
+        builder.append(ByteString.wrap(password));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    @Override
-    public byte[] wrap(final byte[] outgoing, final int offset, final int len)
-        throws ErrorResultException
-    {
-      try
-      {
-        return saslClient.wrap(outgoing, offset, len);
-      }
-      catch (final SaslException e)
-      {
-        final LocalizableMessage msg = ERR_SASL_PROTOCOL_ERROR.get(
-            SASL_MECHANISM_NAME, getExceptionMessage(e));
-        throw newErrorResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR,
-            msg.toString(), e);
-      }
-    }
-
-
-
-    @Override
-    void handle(final NameCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setName(authenticationID);
-    }
-
-
-
-    @Override
-    void handle(final PasswordCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setPassword(password.toString().toCharArray());
-    }
-
-
-
-    @Override
-    void handle(final RealmCallback callback)
-        throws UnsupportedCallbackException
-    {
-      if (realm == null)
-      {
-        callback.setText(callback.getDefaultText());
-      }
-      else
-      {
-        callback.setText(realm);
-      }
-    }
-
-  }
-
-
-
-  private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>();
-  private final List<String> qopValues = new LinkedList<String>();
-  private String cipher = null;
-
-  // Don't use primitives for these so that we can distinguish between default
-  // settings (null) and values set by the caller.
-  private Boolean serverAuth = null;
-  private Integer maxReceiveBufferSize = null;
-  private Integer maxSendBufferSize = null;
-
-  private String authenticationID;
-  private String authorizationID = null;
-  private byte[] password;
-  private String realm = null;
-
-
-
-  DigestMD5SASLBindRequestImpl(final String authenticationID,
-      final byte[] password)
-  {
-    Validator.ensureNotNull(authenticationID, password);
-    this.authenticationID = authenticationID;
-    this.password = password;
-  }
-
-
-
-  /**
-   * Creates a new digest MD5 SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param digestMD5SASLBindRequest
-   *          The digest MD5 SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code digestMD5SASLBindRequest} was {@code null} .
-   */
-  DigestMD5SASLBindRequestImpl(
-      final DigestMD5SASLBindRequest digestMD5SASLBindRequest)
-  {
-    super(digestMD5SASLBindRequest);
-    this.additionalAuthParams.putAll(
-        digestMD5SASLBindRequest.getAdditionalAuthParams());
-    this.qopValues.addAll(digestMD5SASLBindRequest.getQOPs());
-    this.cipher = digestMD5SASLBindRequest.getCipher();
-
-    this.serverAuth = digestMD5SASLBindRequest.isServerAuth();
-    this.maxReceiveBufferSize =
-        digestMD5SASLBindRequest.getMaxReceiveBufferSize();
-    this.maxSendBufferSize = digestMD5SASLBindRequest.getMaxSendBufferSize();
-
-    this.authenticationID = digestMD5SASLBindRequest.getAuthenticationID();
-    this.authorizationID = digestMD5SASLBindRequest.getAuthorizationID();
-    this.password = copyOfBytes(digestMD5SASLBindRequest.getPassword());
-    this.realm = digestMD5SASLBindRequest.getRealm();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest addAdditionalAuthParam(final String name,
-      final String value)
-  {
-    Validator.ensureNotNull(name, value);
-    additionalAuthParams.put(name, value);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest addQOP(final String... qopValues)
-  {
-    for (final String qopValue : qopValues)
-    {
-      this.qopValues.add(Validator.ensureNotNull(qopValue));
-    }
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Map<String, String> getAdditionalAuthParams()
-  {
-    return additionalAuthParams;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getAuthenticationID()
-  {
-    return authenticationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getCipher()
-  {
-    return cipher;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int getMaxReceiveBufferSize()
-  {
-    return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int getMaxSendBufferSize()
-  {
-    return maxSendBufferSize == null ? 65536 : maxSendBufferSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public byte[] getPassword()
-  {
-    return password;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public List<String> getQOPs()
-  {
-    return qopValues;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getRealm()
-  {
-    return realm;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isServerAuth()
-  {
-    return serverAuth == null ? false : serverAuth;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setAuthenticationID(
-      final String authenticationID)
-  {
-    Validator.ensureNotNull(authenticationID);
-    this.authenticationID = authenticationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setAuthorizationID(
-      final String authorizationID)
-  {
-    this.authorizationID = authorizationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setCipher(final String cipher)
-  {
-    this.cipher = cipher;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setMaxReceiveBufferSize(final int size)
-  {
-    maxReceiveBufferSize = size;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setMaxSendBufferSize(final int size)
-  {
-    maxSendBufferSize = size;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setPassword(final byte[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setPassword(final char[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = StaticUtils.getBytes(password);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setRealm(final String realm)
-  {
-    this.realm = realm;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DigestMD5SASLBindRequest setServerAuth(final boolean serverAuth)
-  {
-    this.serverAuth = serverAuth;
-    return this;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("DigestMD5SASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    builder.append(", authenticationID=");
-    builder.append(authenticationID);
-    builder.append(", authorizationID=");
-    builder.append(authorizationID);
-    builder.append(", realm=");
-    builder.append(realm);
-    builder.append(", password=");
-    builder.append(ByteString.wrap(password));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java
index 4753da2..fdb4948 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,8 +36,6 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 
-
-
 /**
  * The Extended operation allows additional operations to be defined for
  * services not already available in the protocol; for example, to implement an
@@ -48,72 +43,59 @@
  * {@link StartTLSExtendedRequest}).
  *
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-public interface ExtendedRequest<S extends ExtendedResult> extends Request
-{
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedRequest<S> addControl(Control control);
+public interface ExtendedRequest<S extends ExtendedResult> extends Request {
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedRequest<S> addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the numeric OID associated with this extended request.
+     *
+     * @return The numeric OID associated with this extended request.
+     */
+    String getOID();
 
+    /**
+     * Returns a decoder which can be used to decoded responses to this extended
+     * request.
+     *
+     * @return A decoder which can be used to decoded responses to this extended
+     *         request.
+     */
+    ExtendedResultDecoder<S> getResultDecoder();
 
+    /**
+     * Returns the value, if any, associated with this extended request. Its
+     * format is defined by the specification of this extended request.
+     *
+     * @return The value associated with this extended request, or {@code null}
+     *         if there is no value.
+     */
+    ByteString getValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the numeric OID associated with this extended request.
-   *
-   * @return The numeric OID associated with this extended request.
-   */
-  String getOID();
-
-
-
-  /**
-   * Returns a decoder which can be used to decoded responses to this extended
-   * request.
-   *
-   * @return A decoder which can be used to decoded responses to this extended
-   *         request.
-   */
-  ExtendedResultDecoder<S> getResultDecoder();
-
-
-
-  /**
-   * Returns the value, if any, associated with this extended request. Its
-   * format is defined by the specification of this extended request.
-   *
-   * @return The value associated with this extended request, or {@code null} if
-   *         there is no value.
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * Returns {@code true} if this extended request has a value. In some
-   * circumstances it may be useful to determine if a extended request has a
-   * value, without actually calculating the value and incurring any performance
-   * costs.
-   *
-   * @return {@code true} if this extended request has a value, or {@code false}
-   *         if there is no value.
-   */
-  boolean hasValue();
+    /**
+     * Returns {@code true} if this extended request has a value. In some
+     * circumstances it may be useful to determine if a extended request has a
+     * value, without actually calculating the value and incurring any
+     * performance costs.
+     *
+     * @return {@code true} if this extended request has a value, or
+     *         {@code false} if there is no value.
+     */
+    boolean hasValue();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java
index 9398ade..3533592 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,41 +26,36 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * A factory interface for decoding a generic extended request as an extended
  * request of specific type.
  *
  * @param <R>
- *          The type of extended request.
+ *            The type of extended request.
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-public interface ExtendedRequestDecoder<R extends ExtendedRequest<S>, S extends ExtendedResult>
-{
-  /**
-   * Decodes the provided extended operation request as an {@code
-   * ExtendedRequest} of type {@code R}.
-   *
-   * @param request
-   *          The extended operation request to be decoded.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          extended operation request.
-   * @return The decoded extended operation request.
-   * @throws DecodeException
-   *           If the provided extended operation request could not be decoded.
-   *           For example, if the request name was wrong, or if the request
-   *           value was invalid.
-   */
-  R decodeExtendedRequest(ExtendedRequest<?> request, DecodeOptions options)
-      throws DecodeException;
+public interface ExtendedRequestDecoder<R extends ExtendedRequest<S>, S extends ExtendedResult> {
+    /**
+     * Decodes the provided extended operation request as an
+     * {@code ExtendedRequest} of type {@code R}.
+     *
+     * @param request
+     *            The extended operation request to be decoded.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the extended operation request.
+     * @return The decoded extended operation request.
+     * @throws DecodeException
+     *             If the provided extended operation request could not be
+     *             decoded. For example, if the request name was wrong, or if
+     *             the request value was invalid.
+     */
+    R decodeExtendedRequest(ExtendedRequest<?> request, DecodeOptions options)
+            throws DecodeException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java
index 3756e7d..2e29c6a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,15 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The External SASL bind request as defined in RFC 4422. This SASL mechanism
  * allows a client to request the server to use credentials established by means
@@ -59,103 +54,86 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface ExternalSASLBindRequest extends SASLBindRequest
-{
+public interface ExternalSASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism based on external authentication.
-   */
-  public static final String SASL_MECHANISM_NAME = "EXTERNAL";
+    /**
+     * The name of the SASL mechanism based on external authentication.
+     */
+    public static final String SASL_MECHANISM_NAME = "EXTERNAL";
 
+    /**
+     * {@inheritDoc}
+     */
+    ExternalSASLBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
-  /**
-   * {@inheritDoc}
-   */
-  ExternalSASLBindRequest addControl(Control control);
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
+    /**
+     * Returns the optional desired authorization ID of the user, or
+     * {@code null} if the authorization ID should derived from authentication
+     * credentials exchanged at a lower security layer. The authorization ID
+     * usually has the form "dn:" immediately followed by the distinguished name
+     * of the user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The desired authorization ID of the user, which may be
+     *         {@code null} .
+     */
+    String getAuthorizationID();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getSASLMechanism();
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
-
-
-
-  /**
-   * Returns the optional desired authorization ID of the user, or {@code null}
-   * if the authorization ID should derived from authentication credentials
-   * exchanged at a lower security layer. The authorization ID usually has the
-   * form "dn:" immediately followed by the distinguished name of the user, or
-   * "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The desired authorization ID of the user, which may be {@code null}
-   *         .
-   */
-  String getAuthorizationID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getSASLMechanism();
-
-
-
-  /**
-   * Sets the optional desired authorization ID of the user, or {@code null} if
-   * the authorization ID should derived from authentication credentials
-   * exchanged at a lower security layer. The authorization ID usually has the
-   * form "dn:" immediately followed by the distinguished name of the user, or
-   * "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The desired authorization ID of the user, which may be {@code
-   *          null}.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this external SASL request does not permit the authorization
-   *           ID to be set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   */
-  ExternalSASLBindRequest setAuthorizationID(String authorizationID);
+    /**
+     * Sets the optional desired authorization ID of the user, or {@code null}
+     * if the authorization ID should derived from authentication credentials
+     * exchanged at a lower security layer. The authorization ID usually has the
+     * form "dn:" immediately followed by the distinguished name of the user, or
+     * "u:" followed by a user ID string, but other forms are permitted.
+     *
+     * @param authorizationID
+     *            The desired authorization ID of the user, which may be
+     *            {@code null}.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this external SASL request does not permit the
+     *             authorization ID to be set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     */
+    ExternalSASLBindRequest setAuthorizationID(String authorizationID);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java
index e144f09..824cf11 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import javax.security.sasl.Sasl;
@@ -42,179 +39,125 @@
 import org.forgerock.opendj.ldap.responses.BindResult;
 import org.forgerock.opendj.ldap.responses.Responses;
 
-
-
 /**
  * External SASL bind request implementation.
  */
-final class ExternalSASLBindRequestImpl extends
-    AbstractSASLBindRequest<ExternalSASLBindRequest> implements
-    ExternalSASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private final SaslClient saslClient;
+final class ExternalSASLBindRequestImpl extends AbstractSASLBindRequest<ExternalSASLBindRequest>
+        implements ExternalSASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private final SaslClient saslClient;
 
+        private Client(final ExternalSASLBindRequestImpl initialBindRequest, final String serverName)
+                throws ErrorResultException {
+            super(initialBindRequest);
 
-
-    private Client(final ExternalSASLBindRequestImpl initialBindRequest,
-        final String serverName) throws ErrorResultException
-    {
-      super(initialBindRequest);
-
-      try
-      {
-        saslClient = Sasl.createSaslClient(
-            new String[] { SASL_MECHANISM_NAME }, initialBindRequest
-                .getAuthorizationID(), SASL_DEFAULT_PROTOCOL, serverName, null,
-            this);
-        if (saslClient.hasInitialResponse())
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+            try {
+                saslClient =
+                        Sasl.createSaslClient(new String[] { SASL_MECHANISM_NAME },
+                                initialBindRequest.getAuthorizationID(), SASL_DEFAULT_PROTOCOL,
+                                serverName, null, this);
+                if (saslClient.hasInitialResponse()) {
+                    setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+                } else {
+                    setNextSASLCredentials((ByteString) null);
+                }
+            } catch (final SaslException e) {
+                throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
+            }
         }
-        else
-        {
-          setNextSASLCredentials((ByteString) null);
+
+        @Override
+        public void dispose() {
+            try {
+                saslClient.dispose();
+            } catch (final SaslException ignored) {
+                // Ignore the SASL exception.
+            }
         }
-      }
-      catch (final SaslException e)
-      {
-        throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
-      }
+
+        @Override
+        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
+            if (saslClient.isComplete()) {
+                return true;
+            }
+
+            try {
+                setNextSASLCredentials(saslClient.evaluateChallenge(result
+                        .getServerSASLCredentials() == null ? new byte[0] : result
+                        .getServerSASLCredentials().toByteArray()));
+                return saslClient.isComplete();
+            } catch (final SaslException e) {
+                // FIXME: I18N need to have a better error message.
+                // FIXME: Is this the best result code?
+                throw ErrorResultException.newErrorResult(Responses.newResult(
+                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                        "An error occurred during multi-stage authentication").setCause(e));
+            }
+        }
     }
 
+    private String authorizationID = null;
 
+    ExternalSASLBindRequestImpl() {
+        // Nothing to do.
+    }
+
+    /**
+     * Creates a new external SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param externalSASLBindRequest
+     *            The external SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code externalSASLBindRequest} was {@code null} .
+     */
+    ExternalSASLBindRequestImpl(final ExternalSASLBindRequest externalSASLBindRequest) {
+        super(externalSASLBindRequest);
+        this.authorizationID = externalSASLBindRequest.getAuthorizationID();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new Client(this, serverName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getAuthorizationID() {
+        return authorizationID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) {
+        this.authorizationID = authorizationID;
+        return this;
+    }
 
     @Override
-    public void dispose()
-    {
-      try
-      {
-        saslClient.dispose();
-      }
-      catch (final SaslException ignored)
-      {
-        // Ignore the SASL exception.
-      }
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ExternalSASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        builder.append(", authorizationID=");
+        builder.append(authorizationID);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    @Override
-    public boolean evaluateResult(final BindResult result)
-        throws ErrorResultException
-    {
-      if (saslClient.isComplete())
-      {
-        return true;
-      }
-
-      try
-      {
-        setNextSASLCredentials(saslClient.evaluateChallenge(result
-            .getServerSASLCredentials() == null ? new byte[0] :
-            result.getServerSASLCredentials().toByteArray()));
-        return saslClient.isComplete();
-      }
-      catch (final SaslException e)
-      {
-        // FIXME: I18N need to have a better error message.
-        // FIXME: Is this the best result code?
-        throw ErrorResultException.newErrorResult(Responses.newResult(
-            ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-            "An error occurred during multi-stage authentication")
-            .setCause(e));
-      }
-    }
-  }
-
-
-
-  private String authorizationID = null;
-
-
-
-  ExternalSASLBindRequestImpl()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * Creates a new external SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param externalSASLBindRequest
-   *          The external SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code externalSASLBindRequest} was {@code null} .
-   */
-  ExternalSASLBindRequestImpl(
-      final ExternalSASLBindRequest externalSASLBindRequest)
-  {
-    super(externalSASLBindRequest);
-    this.authorizationID = externalSASLBindRequest.getAuthorizationID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ExternalSASLBindRequest setAuthorizationID(final String authorizationID)
-  {
-    this.authorizationID = authorizationID;
-    return this;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ExternalSASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    builder.append(", authorizationID=");
-    builder.append(authorizationID);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java
index d13a210..f2b2c72 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,22 +27,18 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 import java.util.Map;
 
 import javax.security.auth.Subject;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The GSSAPI SASL bind request as defined in RFC 2831. This SASL mechanism
  * allows a client to use the Generic Security Service Application Program
@@ -60,457 +55,404 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface GSSAPISASLBindRequest extends SASLBindRequest
-{
+public interface GSSAPISASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism based on GSS-API authentication.
-   */
-  public static final String SASL_MECHANISM_NAME = "GSSAPI";
+    /**
+     * The name of the SASL mechanism based on GSS-API authentication.
+     */
+    public static final String SASL_MECHANISM_NAME = "GSSAPI";
 
-  /**
-   * Indicates that the client will accept authentication only. More
-   * specifically, the underlying connection will not be protected using
-   * integrity protection or encryption, unless previously established using
-   * SSL/TLS. This is the default if no QOP option is present in the bind
-   * request.
-   */
-  public static final String QOP_AUTH = "auth";
+    /**
+     * Indicates that the client will accept authentication only. More
+     * specifically, the underlying connection will not be protected using
+     * integrity protection or encryption, unless previously established using
+     * SSL/TLS. This is the default if no QOP option is present in the bind
+     * request.
+     */
+    public static final String QOP_AUTH = "auth";
 
-  /**
-   * Indicates that the client will accept authentication with connection
-   * integrity protection. More specifically, the underlying connection will not
-   * be encrypted, unless previously established using SSL/TLS.
-   */
-  public static final String QOP_AUTH_INT = "auth-int";
+    /**
+     * Indicates that the client will accept authentication with connection
+     * integrity protection. More specifically, the underlying connection will
+     * not be encrypted, unless previously established using SSL/TLS.
+     */
+    public static final String QOP_AUTH_INT = "auth-int";
 
-  /**
-   * Indicates that the client will accept authentication with connection
-   * integrity protection and encryption.
-   */
-  public static final String QOP_AUTH_CONF = "auth-conf";
+    /**
+     * Indicates that the client will accept authentication with connection
+     * integrity protection and encryption.
+     */
+    public static final String QOP_AUTH_CONF = "auth-conf";
 
+    /**
+     * Adds the provided additional authentication parameter to the list of
+     * parameters to be passed to the underlying mechanism implementation. This
+     * method is provided in order to allow for future extensions.
+     *
+     * @param name
+     *            The name of the additional authentication parameter.
+     * @param value
+     *            The value of the additional authentication parameter.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit additional
+     *             authentication parameters to be added.
+     * @throws NullPointerException
+     *             If {@code name} or {@code value} was {@code null}.
+     */
+    GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value);
 
+    /**
+     * Returns a map containing the provided additional authentication
+     * parameters to be passed to the underlying mechanism implementation. This
+     * method is provided in order to allow for future extensions.
+     *
+     * @return A map containing the provided additional authentication
+     *         parameters to be passed to the underlying mechanism
+     *         implementation.
+     */
+    Map<String, String> getAdditionalAuthParams();
 
-  /**
-   * Adds the provided additional authentication parameter to the list of
-   * parameters to be passed to the underlying mechanism implementation. This
-   * method is provided in order to allow for future extensions.
-   *
-   * @param name
-   *          The name of the additional authentication parameter.
-   * @param value
-   *          The value of the additional authentication parameter.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit additional authentication
-   *           parameters to be added.
-   * @throws NullPointerException
-   *           If {@code name} or {@code value} was {@code null}.
-   */
-  GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    GSSAPISASLBindRequest addControl(Control control);
 
+    /**
+     * Adds the provided quality of protection (QOP) values to the ordered list
+     * of QOP values that the client is willing to accept. The order of the list
+     * specifies the preference order, high to low. Authentication will fail if
+     * no QOP values are recognized or accepted by the server.
+     * <p>
+     * By default the client will accept {@link #QOP_AUTH AUTH}.
+     *
+     * @param qopValues
+     *            The quality of protection values that the client is willing to
+     *            accept.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit QOP values to be added.
+     * @throws NullPointerException
+     *             If {@code qopValues} was {@code null}.
+     * @see #QOP_AUTH
+     * @see #QOP_AUTH_INT
+     * @see #QOP_AUTH_CONF
+     */
+    GSSAPISASLBindRequest addQOP(String... qopValues);
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
-  /**
-   * Returns a map containing the provided additional authentication parameters
-   * to be passed to the underlying mechanism implementation. This method is
-   * provided in order to allow for future extensions.
-   *
-   * @return A map containing the provided additional authentication parameters
-   *         to be passed to the underlying mechanism implementation.
-   */
-  Map<String, String> getAdditionalAuthParams();
+    /**
+     * Returns the authentication ID of the user, which should be the user's
+     * Kerberos principal. The authentication ID usually has the form "dn:"
+     * immediately followed by the distinguished name of the user, or "u:"
+     * followed by a user ID string, but other forms are permitted.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @return The authentication ID of the user.
+     */
+    String getAuthenticationID();
 
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    @Override
+    byte getAuthenticationType();
 
+    /**
+     * Returns the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authorization ID of the user, which may be {@code null}.
+     */
+    String getAuthorizationID();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  GSSAPISASLBindRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    List<Control> getControls();
 
+    /**
+     * Returns the optional address of the Kerberos KDC (Key Distribution
+     * Center).
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @return The address of the Kerberos KDC (Key Distribution Center), which
+     *         may be {@code null}.
+     */
+    String getKDCAddress();
 
-  /**
-   * Adds the provided quality of protection (QOP) values to the ordered list of
-   * QOP values that the client is willing to accept. The order of the list
-   * specifies the preference order, high to low. Authentication will fail if no
-   * QOP values are recognized or accepted by the server.
-   * <p>
-   * By default the client will accept {@link #QOP_AUTH AUTH}.
-   *
-   * @param qopValues
-   *          The quality of protection values that the client is willing to
-   *          accept.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit QOP values to be added.
-   * @throws NullPointerException
-   *           If {@code qopValues} was {@code null}.
-   * @see #QOP_AUTH
-   * @see #QOP_AUTH_INT
-   * @see #QOP_AUTH_CONF
-   */
-  GSSAPISASLBindRequest addQOP(String... qopValues);
+    /**
+     * Returns the maximum size of the receive buffer in bytes. The actual
+     * maximum number of bytes will be the minimum of this number and the peer's
+     * maximum send buffer size. The default size is 65536.
+     *
+     * @return The maximum size of the receive buffer in bytes.
+     */
+    int getMaxReceiveBufferSize();
 
+    /**
+     * Returns the maximum size of the send buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * receive buffer size. The default size is 65536.
+     *
+     * @return The maximum size of the send buffer in bytes.
+     */
+    int getMaxSendBufferSize();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    @Override
+    String getName();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * Returns the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @return The password of the user that the client wishes to bind as.
+     */
+    byte[] getPassword();
 
+    /**
+     * Returns the ordered list of quality of protection (QOP) values that the
+     * client is willing to accept. The order of the list specifies the
+     * preference order, high to low. Authentication will fail if no QOP values
+     * are recognized or accepted by the server.
+     * <p>
+     * By default the client will accept {@link #QOP_AUTH AUTH}.
+     *
+     * @return The list of quality of protection values that the client is
+     *         willing to accept. The returned list may be empty indicating that
+     *         the default QOP will be accepted.
+     */
+    List<String> getQOPs();
 
+    /**
+     * Returns the optional realm containing the user's account.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @return The name of the realm containing the user's account, which may be
+     *         {@code null}.
+     */
+    String getRealm();
 
-  /**
-   * Returns the authentication ID of the user, which should be the user's
-   * Kerberos principal. The authentication ID usually has the form "dn:"
-   * immediately followed by the distinguished name of the user, or "u:"
-   * followed by a user ID string, but other forms are permitted.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @return The authentication ID of the user.
-   */
-  String getAuthenticationID();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    String getSASLMechanism();
 
+    /**
+     * Returns the Kerberos subject of the user to be authenticated.
+     * <p>
+     * <b>NOTE</b>: if a {@code Subject} is specified then the authentication
+     * ID, KDC address, password, and realm, will be ignored.
+     *
+     * @return The Kerberos subject of the user to be authenticated.
+     */
+    Subject getSubject();
 
+    /**
+     * Returns {@code true} if the server must authenticate to the client. The
+     * default is {@code false}.
+     *
+     * @return {@code true} if the server must authenticate to the client.
+     */
+    boolean isServerAuth();
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  @Override
-  byte getAuthenticationType();
+    /**
+     * Sets the authentication ID of the user, which should be the user's
+     * Kerberos principal. The authentication ID usually has the form "dn:"
+     * immediately followed by the distinguished name of the user, or "u:"
+     * followed by a user ID string, but other forms are permitted.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user.
+     * @return This bind request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authenticationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws NullPointerException
+     *             If {@code authenticationID} was {@code null}.
+     */
+    GSSAPISASLBindRequest setAuthenticationID(String authenticationID);
 
+    /**
+     * Sets the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authorizationID
+     *            The authorization ID of the user, which may be {@code null}.
+     * @return This bind request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     */
+    GSSAPISASLBindRequest setAuthorizationID(String authorizationID);
 
+    /**
+     * Sets the optional address of the Kerberos KDC (Key Distribution Center).
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @param address
+     *            The address of the Kerberos KDC (Key Distribution Center),
+     *            which may be {@code null}.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the KDC address to be
+     *             set.
+     * @throws NullPointerException
+     *             If {@code address} was {@code null}.
+     */
+    GSSAPISASLBindRequest setKDCAddress(String address);
 
-  /**
-   * Returns the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user, which may be {@code null}.
-   */
-  String getAuthorizationID();
+    /**
+     * Sets the maximum size of the receive buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * send buffer size. The default size is 65536.
+     *
+     * @param size
+     *            The maximum size of the receive buffer in bytes.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the buffer size to be
+     *             set.
+     */
+    GSSAPISASLBindRequest setMaxReceiveBufferSize(int size);
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the optional address of the Kerberos KDC (Key Distribution Center).
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @return The address of the Kerberos KDC (Key Distribution Center), which
-   *         may be {@code null}.
-   */
-  String getKDCAddress();
-
-
-
-  /**
-   * Returns the maximum size of the receive buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * send buffer size. The default size is 65536.
-   *
-   * @return The maximum size of the receive buffer in bytes.
-   */
-  int getMaxReceiveBufferSize();
-
-
-
-  /**
-   * Returns the maximum size of the send buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * receive buffer size. The default size is 65536.
-   *
-   * @return The maximum size of the send buffer in bytes.
-   */
-  int getMaxSendBufferSize();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  @Override
-  String getName();
-
-
-
-  /**
-   * Returns the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @return The password of the user that the client wishes to bind as.
-   */
-  byte[] getPassword();
-
-
-
-  /**
-   * Returns the ordered list of quality of protection (QOP) values that the
-   * client is willing to accept. The order of the list specifies the preference
-   * order, high to low. Authentication will fail if no QOP values are
-   * recognized or accepted by the server.
-   * <p>
-   * By default the client will accept {@link #QOP_AUTH AUTH}.
-   *
-   * @return The list of quality of protection values that the client is willing
-   *         to accept. The returned list may be empty indicating that the
-   *         default QOP will be accepted.
-   */
-  List<String> getQOPs();
-
-
-
-  /**
-   * Returns the optional realm containing the user's account.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @return The name of the realm containing the user's account, which may be
-   *         {@code null}.
-   */
-  String getRealm();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  String getSASLMechanism();
-
-
-
-  /**
-   * Returns the Kerberos subject of the user to be authenticated.
-   * <p>
-   * <b>NOTE</b>: if a {@code Subject} is specified then the authentication ID,
-   * KDC address, password, and realm, will be ignored.
-   *
-   * @return The Kerberos subject of the user to be authenticated.
-   */
-  Subject getSubject();
-
-
-
-  /**
-   * Returns {@code true} if the server must authenticate to the client. The
-   * default is {@code false}.
-   *
-   * @return {@code true} if the server must authenticate to the client.
-   */
-  boolean isServerAuth();
-
-
-
-  /**
-   * Sets the authentication ID of the user, which should be the user's Kerberos
-   * principal. The authentication ID usually has the form "dn:" immediately
-   * followed by the distinguished name of the user, or "u:" followed by a user
-   * ID string, but other forms are permitted.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user.
-   * @return This bind request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authenticationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws NullPointerException
-   *           If {@code authenticationID} was {@code null}.
-   */
-  GSSAPISASLBindRequest setAuthenticationID(String authenticationID);
-
-
-
-  /**
-   * Sets the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The authorization ID of the user, which may be {@code null}.
-   * @return This bind request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   */
-  GSSAPISASLBindRequest setAuthorizationID(String authorizationID);
-
-
-
-  /**
-   * Sets the optional address of the Kerberos KDC (Key Distribution Center).
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @param address
-   *          The address of the Kerberos KDC (Key Distribution Center), which
-   *          may be {@code null}.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the KDC address to be set.
-   * @throws NullPointerException
-   *           If {@code address} was {@code null}.
-   */
-  GSSAPISASLBindRequest setKDCAddress(String address);
-
-
-
-  /**
-   * Sets the maximum size of the receive buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * send buffer size. The default size is 65536.
-   *
-   * @param size
-   *          The maximum size of the receive buffer in bytes.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the buffer size to be set.
-   */
-  GSSAPISASLBindRequest setMaxReceiveBufferSize(int size);
-
-
-
-  /**
-   * Sets the maximum size of the send buffer in bytes. The actual maximum
-   * number of bytes will be the minimum of this number and the peer's maximum
-   * receive buffer size. The default size is 65536.
-   *
-   * @param size
-   *          The maximum size of the send buffer in bytes.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the buffer size to be set.
-   */
-  GSSAPISASLBindRequest setMaxSendBufferSize(int size);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * provided password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as, which
-   *          may be empty.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  GSSAPISASLBindRequest setPassword(byte[] password);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as. The
-   * password will be converted to a UTF-8 octet string.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  GSSAPISASLBindRequest setPassword(char[] password);
-
-
-
-  /**
-   * Sets the optional realm containing the user's account.
-   * <p>
-   * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
-   *
-   * @param realm
-   *          The name of the realm containing the user's account, which may be
-   *          {@code null}.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the realm to be set.
-   * @throws NullPointerException
-   *           If {@code realm} was {@code null}.
-   */
-  GSSAPISASLBindRequest setRealm(String realm);
-
+    /**
+     * Sets the maximum size of the send buffer in bytes. The actual maximum
+     * number of bytes will be the minimum of this number and the peer's maximum
+     * receive buffer size. The default size is 65536.
+     *
+     * @param size
+     *            The maximum size of the send buffer in bytes.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the buffer size to be
+     *             set.
+     */
+    GSSAPISASLBindRequest setMaxSendBufferSize(int size);
 
+    /**
+     * Sets the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * provided password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as,
+     *            which may be empty.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    GSSAPISASLBindRequest setPassword(byte[] password);
 
-  /**
-   * Specifies whether or not the server must authenticate to the client. The
-   * default is {@code false}.
-   *
-   * @param serverAuth
-   *          {@code true} if the server must authenticate to the client or
-   *          {@code false} otherwise.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit server auth to be set.
-   */
-  GSSAPISASLBindRequest setServerAuth(boolean serverAuth);
+    /**
+     * Sets the password of the user that the client wishes to bind as. The
+     * password will be converted to a UTF-8 octet string.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    GSSAPISASLBindRequest setPassword(char[] password);
 
+    /**
+     * Sets the optional realm containing the user's account.
+     * <p>
+     * <b>NOTE</b>: this will not be used if a {@code Subject} is specified.
+     *
+     * @param realm
+     *            The name of the realm containing the user's account, which may
+     *            be {@code null}.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the realm to be set.
+     * @throws NullPointerException
+     *             If {@code realm} was {@code null}.
+     */
+    GSSAPISASLBindRequest setRealm(String realm);
 
+    /**
+     * Specifies whether or not the server must authenticate to the client. The
+     * default is {@code false}.
+     *
+     * @param serverAuth
+     *            {@code true} if the server must authenticate to the client or
+     *            {@code false} otherwise.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit server auth to be set.
+     */
+    GSSAPISASLBindRequest setServerAuth(boolean serverAuth);
 
-  /**
-   * Sets the Kerberos subject of the user to be authenticated.
-   * <p>
-   * <b>NOTE</b>: if a {@code Subject} is specified then the authentication ID,
-   * KDC address, password, and realm, will be ignored.
-   *
-   * @param subject
-   *          The Kerberos subject of the user to be authenticated.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the Kerberos subject to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code subject} was {@code null}.
-   */
-  GSSAPISASLBindRequest setSubject(Subject subject);
+    /**
+     * Sets the Kerberos subject of the user to be authenticated.
+     * <p>
+     * <b>NOTE</b>: if a {@code Subject} is specified then the authentication
+     * ID, KDC address, password, and realm, will be ignored.
+     *
+     * @param subject
+     *            The Kerberos subject of the user to be authenticated.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the Kerberos subject to
+     *             be set.
+     * @throws NullPointerException
+     *             If {@code subject} was {@code null}.
+     */
+    GSSAPISASLBindRequest setSubject(Subject subject);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java
index 6a9161b..6b704e0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,21 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static com.forgerock.opendj.util.StaticUtils.joinCollection;
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDAPAUTH_GSSAPI_LOCAL_AUTHENTICATION_FAILED;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_SASL_CONTEXT_CREATE_ERROR;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_SASL_PROTOCOL_ERROR;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.util.*;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
@@ -59,724 +62,546 @@
 import com.sun.security.auth.callback.TextCallbackHandler;
 import com.sun.security.auth.module.Krb5LoginModule;
 
-
-
 /**
  * GSSAPI SASL bind request implementation.
  */
 @SuppressWarnings("restriction")
-final class GSSAPISASLBindRequestImpl extends
-    AbstractSASLBindRequest<GSSAPISASLBindRequest> implements
-    GSSAPISASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private static Subject kerberos5Login(final String authenticationID,
-        final ByteString password, final String realm, final String kdc)
-        throws ErrorResultException
-    {
-      if (authenticationID == null)
-      {
-        // FIXME: I18N need to have a better error message.
-        // FIXME: Is this the best result code?
-        throw ErrorResultException.newErrorResult(Responses.newResult(
-            ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-            "No authentication ID specified for GSSAPI SASL authentication"));
-      }
+final class GSSAPISASLBindRequestImpl extends AbstractSASLBindRequest<GSSAPISASLBindRequest>
+        implements GSSAPISASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private static Subject kerberos5Login(final String authenticationID,
+                final ByteString password, final String realm, final String kdc)
+                throws ErrorResultException {
+            if (authenticationID == null) {
+                // FIXME: I18N need to have a better error message.
+                // FIXME: Is this the best result code?
+                throw ErrorResultException.newErrorResult(Responses.newResult(
+                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                        "No authentication ID specified for GSSAPI SASL authentication"));
+            }
 
-      if (password == null)
-      {
-        // FIXME: I18N need to have a better error message.
-        // FIXME: Is this the best result code?
-        throw ErrorResultException.newErrorResult(Responses.newResult(
-            ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-            "No password specified for GSSAPI SASL authentication"));
-      }
+            if (password == null) {
+                // FIXME: I18N need to have a better error message.
+                // FIXME: Is this the best result code?
+                throw ErrorResultException.newErrorResult(Responses.newResult(
+                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                        "No password specified for GSSAPI SASL authentication"));
+            }
 
-      final Map<String, Object> state = new HashMap<String, Object>();
-      state.put("javax.security.auth.login.name", authenticationID);
-      state.put("javax.security.auth.login.password", password.toString()
-          .toCharArray());
-      state.put("javax.security.auth.useSubjectCredsOnly", "true");
-      state.put("java.security.krb5.realm", realm);
-      state.put("java.security.krb5.kdc", kdc);
+            final Map<String, Object> state = new HashMap<String, Object>();
+            state.put("javax.security.auth.login.name", authenticationID);
+            state.put("javax.security.auth.login.password", password.toString().toCharArray());
+            state.put("javax.security.auth.useSubjectCredsOnly", "true");
+            state.put("java.security.krb5.realm", realm);
+            state.put("java.security.krb5.kdc", kdc);
 
-      final Map<String, Object> options = new HashMap<String, Object>();
-      options.put("tryFirstPass", "true");
-      options.put("useTicketCache", "true");
-      options.put("doNotPrompt", "true");
-      options.put("storePass", "false");
-      options.put("forwardable", "true");
+            final Map<String, Object> options = new HashMap<String, Object>();
+            options.put("tryFirstPass", "true");
+            options.put("useTicketCache", "true");
+            options.put("doNotPrompt", "true");
+            options.put("storePass", "false");
+            options.put("forwardable", "true");
 
-      final Subject subject = new Subject();
-      final Krb5LoginModule login = new Krb5LoginModule();
-      login.initialize(subject, new TextCallbackHandler(), state, options);
-      try
-      {
-        if (login.login())
-        {
-          login.commit();
+            final Subject subject = new Subject();
+            final Krb5LoginModule login = new Krb5LoginModule();
+            login.initialize(subject, new TextCallbackHandler(), state, options);
+            try {
+                if (login.login()) {
+                    login.commit();
+                }
+            } catch (final LoginException e) {
+                // FIXME: Is this the best result code?
+                final LocalizableMessage message =
+                        ERR_LDAPAUTH_GSSAPI_LOCAL_AUTHENTICATION_FAILED.get(StaticUtils
+                                .getExceptionMessage(e));
+                throw ErrorResultException.newErrorResult(Responses.newResult(
+                        ResultCode.CLIENT_SIDE_LOCAL_ERROR)
+                        .setDiagnosticMessage(message.toString()).setCause(e));
+            }
+            return subject;
         }
-      }
-      catch (final LoginException e)
-      {
-        // FIXME: Is this the best result code?
-        final LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_LOCAL_AUTHENTICATION_FAILED
-            .get(StaticUtils.getExceptionMessage(e));
-        throw ErrorResultException.newErrorResult(Responses
-            .newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
-            .setDiagnosticMessage(message.toString()).setCause(e));
-      }
-      return subject;
+
+        private final SaslClient saslClient;
+        private final String authorizationID;
+        private final Subject subject;
+
+        private BindResult lastResult;
+
+        private final PrivilegedExceptionAction<Boolean> evaluateAction =
+                new PrivilegedExceptionAction<Boolean>() {
+                    @Override
+                    public Boolean run() throws ErrorResultException {
+                        if (saslClient.isComplete()) {
+                            return true;
+                        }
+
+                        try {
+                            setNextSASLCredentials(saslClient.evaluateChallenge(lastResult
+                                    .getServerSASLCredentials() == null ? new byte[0] : lastResult
+                                    .getServerSASLCredentials().toByteArray()));
+                            return saslClient.isComplete();
+                        } catch (final SaslException e) {
+                            // FIXME: I18N need to have a better error message.
+                            // FIXME: Is this the best result code?
+                            throw ErrorResultException.newErrorResult(Responses.newResult(
+                                    ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+                                    "An error occurred during multi-stage authentication")
+                                    .setCause(e));
+                        }
+                    }
+                };
+
+        private Client(final GSSAPISASLBindRequestImpl initialBindRequest, final String serverName)
+                throws ErrorResultException {
+            super(initialBindRequest);
+
+            this.authorizationID = initialBindRequest.getAuthorizationID();
+            if (initialBindRequest.getSubject() != null) {
+                this.subject = initialBindRequest.getSubject();
+            } else {
+                this.subject =
+                        kerberos5Login(initialBindRequest.getAuthenticationID(), ByteString
+                                .wrap(initialBindRequest.getPassword()), initialBindRequest
+                                .getRealm(), initialBindRequest.getKDCAddress());
+            }
+
+            try {
+                this.saslClient =
+                        Subject.doAs(subject, new PrivilegedExceptionAction<SaslClient>() {
+                            @Override
+                            public SaslClient run() throws ErrorResultException {
+                                // Create property map containing all the
+                                // parameters.
+                                final Map<String, String> props = new HashMap<String, String>();
+
+                                final List<String> qopValues = initialBindRequest.getQOPs();
+                                if (!qopValues.isEmpty()) {
+                                    props.put(Sasl.QOP, joinCollection(qopValues, ","));
+                                }
+
+                                final Boolean serverAuth = initialBindRequest.isServerAuth();
+                                if (serverAuth != null) {
+                                    props.put(Sasl.SERVER_AUTH, String.valueOf(serverAuth));
+                                }
+
+                                Integer size = initialBindRequest.getMaxReceiveBufferSize();
+                                if (size != null) {
+                                    props.put(Sasl.MAX_BUFFER, String.valueOf(size));
+                                }
+
+                                size = initialBindRequest.getMaxSendBufferSize();
+                                if (size != null) {
+                                    props.put("javax.security.sasl.sendmaxbuffer", String
+                                            .valueOf(size));
+                                }
+
+                                for (final Map.Entry<String, String> e : initialBindRequest
+                                        .getAdditionalAuthParams().entrySet()) {
+                                    props.put(e.getKey(), e.getValue());
+                                }
+
+                                try {
+                                    final SaslClient saslClient =
+                                            Sasl.createSaslClient(
+                                                    new String[] { SASL_MECHANISM_NAME },
+                                                    authorizationID, SASL_DEFAULT_PROTOCOL,
+                                                    serverName, props, Client.this);
+                                    if (saslClient.hasInitialResponse()) {
+                                        setNextSASLCredentials(saslClient
+                                                .evaluateChallenge(new byte[0]));
+                                    } else {
+                                        setNextSASLCredentials((ByteString) null);
+                                    }
+                                    return saslClient;
+                                } catch (final SaslException e) {
+                                    throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
+                                }
+                            }
+                        });
+            } catch (final PrivilegedActionException e) {
+                if (e.getCause() instanceof ErrorResultException) {
+                    throw (ErrorResultException) e.getCause();
+                } else {
+                    // This should not happen. Must be a bug.
+                    final LocalizableMessage msg =
+                            ERR_SASL_CONTEXT_CREATE_ERROR.get(SASL_MECHANISM_NAME,
+                                    getExceptionMessage(e));
+                    throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, msg.toString(), e);
+                }
+            }
+        }
+
+        @Override
+        public void dispose() {
+            try {
+                saslClient.dispose();
+            } catch (final SaslException ignored) {
+                // Ignore the SASL exception.
+            }
+        }
+
+        @Override
+        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
+            this.lastResult = result;
+            try {
+                return Subject.doAs(subject, evaluateAction);
+            } catch (final PrivilegedActionException e) {
+                if (e.getCause() instanceof ErrorResultException) {
+                    throw (ErrorResultException) e.getCause();
+                } else {
+                    // This should not happen. Must be a bug.
+                    final LocalizableMessage msg =
+                            ERR_SASL_PROTOCOL_ERROR
+                                    .get(SASL_MECHANISM_NAME, getExceptionMessage(e));
+                    throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, msg.toString(), e);
+                }
+            }
+        }
+
+        @Override
+        public ConnectionSecurityLayer getConnectionSecurityLayer() {
+            final String qop = (String) saslClient.getNegotiatedProperty(Sasl.QOP);
+            if (qop.equalsIgnoreCase("auth-int") || qop.equalsIgnoreCase("auth-conf")) {
+                return this;
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public byte[] unwrap(final byte[] incoming, final int offset, final int len)
+                throws ErrorResultException {
+            try {
+                return saslClient.unwrap(incoming, offset, len);
+            } catch (final SaslException e) {
+                final LocalizableMessage msg =
+                        ERR_SASL_PROTOCOL_ERROR.get(SASL_MECHANISM_NAME, getExceptionMessage(e));
+                throw newErrorResult(ResultCode.CLIENT_SIDE_DECODING_ERROR, msg.toString(), e);
+            }
+        }
+
+        @Override
+        public byte[] wrap(final byte[] outgoing, final int offset, final int len)
+                throws ErrorResultException {
+            try {
+                return saslClient.wrap(outgoing, offset, len);
+            } catch (final SaslException e) {
+                final LocalizableMessage msg =
+                        ERR_SASL_PROTOCOL_ERROR.get(SASL_MECHANISM_NAME, getExceptionMessage(e));
+                throw newErrorResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR, msg.toString(), e);
+            }
+        }
+
     }
 
+    // If null then authenticationID and password must be present.
+    private Subject subject = null;
 
+    // Ignored if subject is non-null.
+    private String authenticationID = null;
+    private byte[] password = null;
+    private String realm = null;
 
-    private final SaslClient saslClient;
-    private final String authorizationID;
-    private final Subject subject;
+    private String kdcAddress = null;
 
-    private BindResult lastResult;
+    // Optional authorization ID.
+    private String authorizationID = null;
 
-    private final PrivilegedExceptionAction<Boolean> evaluateAction =
-      new PrivilegedExceptionAction<Boolean>()
-    {
-      @Override
-      public Boolean run() throws ErrorResultException
-      {
-        if (saslClient.isComplete())
-        {
-          return true;
-        }
+    private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>();
+    private final List<String> qopValues = new LinkedList<String>();
 
-        try
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(lastResult
-              .getServerSASLCredentials() == null ? new byte[0] : lastResult
-              .getServerSASLCredentials().toByteArray()));
-          return saslClient.isComplete();
-        }
-        catch (final SaslException e)
-        {
-          // FIXME: I18N need to have a better error message.
-          // FIXME: Is this the best result code?
-          throw ErrorResultException.newErrorResult(Responses
-              .newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
-              .setDiagnosticMessage(
-                  "An error occurred during multi-stage authentication")
-              .setCause(e));
-        }
-      }
-    };
+    // Don't use primitives for these so that we can distinguish between default
+    // settings (null) and values set by the caller.
+    private Boolean serverAuth = null;
+    private Integer maxReceiveBufferSize = null;
+    private Integer maxSendBufferSize = null;
 
-
-
-    private Client(final GSSAPISASLBindRequestImpl initialBindRequest,
-        final String serverName) throws ErrorResultException
-    {
-      super(initialBindRequest);
-
-      this.authorizationID = initialBindRequest.getAuthorizationID();
-      if (initialBindRequest.getSubject() != null)
-      {
-        this.subject = initialBindRequest.getSubject();
-      }
-      else
-      {
-        this.subject = kerberos5Login(
-            initialBindRequest.getAuthenticationID(),
-            ByteString.wrap(initialBindRequest.getPassword()),
-            initialBindRequest.getRealm(),
-            initialBindRequest.getKDCAddress());
-      }
-
-      try
-      {
-        this.saslClient = Subject.doAs(subject,
-            new PrivilegedExceptionAction<SaslClient>()
-            {
-              @Override
-              public SaslClient run() throws ErrorResultException
-              {
-                // Create property map containing all the parameters.
-                final Map<String, String> props = new HashMap<String, String>();
-
-                final List<String> qopValues = initialBindRequest.getQOPs();
-                if (!qopValues.isEmpty())
-                {
-                  props.put(Sasl.QOP, joinCollection(qopValues, ","));
-                }
-
-                final Boolean serverAuth = initialBindRequest.isServerAuth();
-                if (serverAuth != null)
-                {
-                  props.put(Sasl.SERVER_AUTH, String.valueOf(serverAuth));
-                }
-
-                Integer size = initialBindRequest.getMaxReceiveBufferSize();
-                if (size != null)
-                {
-                  props.put(Sasl.MAX_BUFFER, String.valueOf(size));
-                }
-
-                size = initialBindRequest.getMaxSendBufferSize();
-                if (size != null)
-                {
-                  props.put("javax.security.sasl.sendmaxbuffer",
-                      String.valueOf(size));
-                }
-
-                for (final Map.Entry<String, String> e : initialBindRequest
-                    .getAdditionalAuthParams().entrySet())
-                {
-                  props.put(e.getKey(), e.getValue());
-                }
-
-                try
-                {
-                  final SaslClient saslClient = Sasl.createSaslClient(
-                      new String[] { SASL_MECHANISM_NAME }, authorizationID,
-                      SASL_DEFAULT_PROTOCOL, serverName, props, Client.this);
-                  if (saslClient.hasInitialResponse())
-                  {
-                    setNextSASLCredentials(saslClient
-                        .evaluateChallenge(new byte[0]));
-                  }
-                  else
-                  {
-                    setNextSASLCredentials((ByteString) null);
-                  }
-                  return saslClient;
-                }
-                catch (final SaslException e)
-                {
-                  throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
-                }
-              }
-            });
-      }
-      catch (final PrivilegedActionException e)
-      {
-        if (e.getCause() instanceof ErrorResultException)
-        {
-          throw (ErrorResultException) e.getCause();
-        }
-        else
-        {
-          // This should not happen. Must be a bug.
-          final LocalizableMessage msg = ERR_SASL_CONTEXT_CREATE_ERROR
-              .get(SASL_MECHANISM_NAME, getExceptionMessage(e));
-          throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR,
-              msg.toString(), e);
-        }
-      }
+    GSSAPISASLBindRequestImpl(final String authenticationID, final byte[] password) {
+        Validator.ensureNotNull(authenticationID, password);
+        this.authenticationID = authenticationID;
+        this.password = password;
     }
 
+    /**
+     * Creates a new GSSAPI SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param gssapiSASLBindRequest
+     *            The GSSAPI SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code gssAPISASLBindRequest} was {@code null}.
+     */
+    GSSAPISASLBindRequestImpl(final GSSAPISASLBindRequest gssapiSASLBindRequest) {
+        super(gssapiSASLBindRequest);
+        this.subject = gssapiSASLBindRequest.getSubject();
 
+        this.authenticationID = gssapiSASLBindRequest.getAuthenticationID();
+        this.password = copyOfBytes(gssapiSASLBindRequest.getPassword());
+        this.realm = gssapiSASLBindRequest.getRealm();
 
+        this.kdcAddress = gssapiSASLBindRequest.getKDCAddress();
+
+        this.authorizationID = gssapiSASLBindRequest.getAuthorizationID();
+
+        this.additionalAuthParams.putAll(gssapiSASLBindRequest.getAdditionalAuthParams());
+        this.qopValues.addAll(gssapiSASLBindRequest.getQOPs());
+
+        this.serverAuth = gssapiSASLBindRequest.isServerAuth();
+        this.maxReceiveBufferSize = gssapiSASLBindRequest.getMaxReceiveBufferSize();
+        this.maxSendBufferSize = gssapiSASLBindRequest.getMaxSendBufferSize();
+    }
+
+    GSSAPISASLBindRequestImpl(final Subject subject) {
+        Validator.ensureNotNull(subject);
+        this.subject = subject;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void dispose()
-    {
-      try
-      {
-        saslClient.dispose();
-      }
-      catch (final SaslException ignored)
-      {
-        // Ignore the SASL exception.
-      }
-    }
-
-
-
-    @Override
-    public boolean evaluateResult(final BindResult result)
-        throws ErrorResultException
-    {
-      this.lastResult = result;
-      try
-      {
-        return Subject.doAs(subject, evaluateAction);
-      }
-      catch (final PrivilegedActionException e)
-      {
-        if (e.getCause() instanceof ErrorResultException)
-        {
-          throw (ErrorResultException) e.getCause();
-        }
-        else
-        {
-          // This should not happen. Must be a bug.
-          final LocalizableMessage msg = ERR_SASL_PROTOCOL_ERROR.get(
-              SASL_MECHANISM_NAME, getExceptionMessage(e));
-          throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR,
-              msg.toString(), e);
-        }
-      }
-    }
-
-
-
-    @Override
-    public ConnectionSecurityLayer getConnectionSecurityLayer()
-    {
-      final String qop = (String) saslClient.getNegotiatedProperty(Sasl.QOP);
-      if (qop.equalsIgnoreCase("auth-int") || qop.equalsIgnoreCase("auth-conf"))
-      {
+    public GSSAPISASLBindRequest addAdditionalAuthParam(final String name, final String value) {
+        Validator.ensureNotNull(name, value);
+        additionalAuthParams.put(name, value);
         return this;
-      }
-      else
-      {
-        return null;
-      }
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public byte[] unwrap(final byte[] incoming, final int offset, final int len)
-        throws ErrorResultException
-    {
-      try
-      {
-        return saslClient.unwrap(incoming, offset, len);
-      }
-      catch (final SaslException e)
-      {
-        final LocalizableMessage msg = ERR_SASL_PROTOCOL_ERROR.get(
-            SASL_MECHANISM_NAME, getExceptionMessage(e));
-        throw newErrorResult(ResultCode.CLIENT_SIDE_DECODING_ERROR,
-            msg.toString(), e);
-      }
+    public GSSAPISASLBindRequest addQOP(final String... qopValues) {
+        for (final String qopValue : qopValues) {
+            this.qopValues.add(Validator.ensureNotNull(qopValue));
+        }
+        return this;
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public byte[] wrap(final byte[] outgoing, final int offset, final int len)
-        throws ErrorResultException
-    {
-      try
-      {
-        return saslClient.wrap(outgoing, offset, len);
-      }
-      catch (final SaslException e)
-      {
-        final LocalizableMessage msg = ERR_SASL_PROTOCOL_ERROR.get(
-            SASL_MECHANISM_NAME, getExceptionMessage(e));
-        throw newErrorResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR,
-            msg.toString(), e);
-      }
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new Client(this, serverName);
     }
 
-  }
-
-
-
-  // If null then authenticationID and password must be present.
-  private Subject subject = null;
-
-  // Ignored if subject is non-null.
-  private String authenticationID = null;
-  private byte[] password = null;
-  private String realm = null;
-
-  private String kdcAddress = null;
-
-  // Optional authorization ID.
-  private String authorizationID = null;
-
-  private final Map<String, String> additionalAuthParams = new LinkedHashMap<String, String>();
-  private final List<String> qopValues = new LinkedList<String>();
-
-  // Don't use primitives for these so that we can distinguish between default
-  // settings (null) and values set by the caller.
-  private Boolean serverAuth = null;
-  private Integer maxReceiveBufferSize = null;
-  private Integer maxSendBufferSize = null;
-
-
-
-  GSSAPISASLBindRequestImpl(final String authenticationID,
-      final byte[] password)
-  {
-    Validator.ensureNotNull(authenticationID, password);
-    this.authenticationID = authenticationID;
-    this.password = password;
-  }
-
-
-
-  /**
-   * Creates a new GSSAPI SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param gssapiSASLBindRequest
-   *          The GSSAPI SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code gssAPISASLBindRequest} was {@code null}.
-   */
-  GSSAPISASLBindRequestImpl(
-      final GSSAPISASLBindRequest gssapiSASLBindRequest)
-  {
-    super(gssapiSASLBindRequest);
-    this.subject = gssapiSASLBindRequest.getSubject();
-
-    this.authenticationID = gssapiSASLBindRequest.getAuthenticationID();
-    this.password = copyOfBytes(gssapiSASLBindRequest.getPassword());
-    this.realm = gssapiSASLBindRequest.getRealm();
-
-    this.kdcAddress = gssapiSASLBindRequest.getKDCAddress();
-
-    this.authorizationID = gssapiSASLBindRequest.getAuthorizationID();
-
-    this.additionalAuthParams.putAll(
-        gssapiSASLBindRequest.getAdditionalAuthParams());
-    this.qopValues.addAll(gssapiSASLBindRequest.getQOPs());
-
-    this.serverAuth = gssapiSASLBindRequest.isServerAuth();
-    this.maxReceiveBufferSize = gssapiSASLBindRequest.getMaxReceiveBufferSize();
-    this.maxSendBufferSize = gssapiSASLBindRequest.getMaxSendBufferSize();
-  }
-
-
-
-  GSSAPISASLBindRequestImpl(final Subject subject)
-  {
-    Validator.ensureNotNull(subject);
-    this.subject = subject;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest addAdditionalAuthParam(final String name,
-      final String value)
-  {
-    Validator.ensureNotNull(name, value);
-    additionalAuthParams.put(name, value);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest addQOP(final String... qopValues)
-  {
-    for (final String qopValue : qopValues)
-    {
-      this.qopValues.add(Validator.ensureNotNull(qopValue));
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Map<String, String> getAdditionalAuthParams() {
+        return additionalAuthParams;
     }
-    return this;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Map<String, String> getAdditionalAuthParams()
-  {
-    return additionalAuthParams;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getAuthenticationID()
-  {
-    return authenticationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getKDCAddress()
-  {
-    return kdcAddress;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int getMaxReceiveBufferSize()
-  {
-    return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int getMaxSendBufferSize()
-  {
-    return maxSendBufferSize == null ? 65536 : maxSendBufferSize;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public byte[] getPassword()
-  {
-    return password;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public List<String> getQOPs()
-  {
-    return qopValues;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getRealm()
-  {
-    return realm;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Subject getSubject()
-  {
-    return subject;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isServerAuth()
-  {
-    return serverAuth == null ? false : serverAuth;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setAuthenticationID(final String authenticationID)
-  {
-    Validator.ensureNotNull(authenticationID);
-    this.authenticationID = authenticationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setAuthorizationID(final String authorizationID)
-  {
-    this.authorizationID = authorizationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setKDCAddress(final String address)
-  {
-    this.kdcAddress = address;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setMaxReceiveBufferSize(final int size)
-  {
-    maxReceiveBufferSize = size;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setMaxSendBufferSize(final int size)
-  {
-    maxSendBufferSize = size;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setPassword(final byte[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setPassword(final char[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = StaticUtils.getBytes(password);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setRealm(final String realm)
-  {
-    this.realm = realm;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setServerAuth(final boolean serverAuth)
-  {
-    this.serverAuth = serverAuth;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GSSAPISASLBindRequest setSubject(final Subject subject)
-  {
-    this.subject = subject;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GSSAPISASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    if (subject != null)
-    {
-      builder.append(", subject=");
-      builder.append(subject);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getAuthenticationID() {
+        return authenticationID;
     }
-    else
-    {
-      builder.append(", authenticationID=");
-      builder.append(authenticationID);
-      builder.append(", authorizationID=");
-      builder.append(authorizationID);
-      builder.append(", realm=");
-      builder.append(realm);
-      builder.append(", password=");
-      builder.append(ByteString.wrap(password));
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getAuthorizationID() {
+        return authorizationID;
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getKDCAddress() {
+        return kdcAddress;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getMaxReceiveBufferSize() {
+        return maxReceiveBufferSize == null ? 65536 : maxReceiveBufferSize;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getMaxSendBufferSize() {
+        return maxSendBufferSize == null ? 65536 : maxSendBufferSize;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public byte[] getPassword() {
+        return password;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<String> getQOPs() {
+        return qopValues;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getRealm() {
+        return realm;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Subject getSubject() {
+        return subject;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isServerAuth() {
+        return serverAuth == null ? false : serverAuth;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setAuthenticationID(final String authenticationID) {
+        Validator.ensureNotNull(authenticationID);
+        this.authenticationID = authenticationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setAuthorizationID(final String authorizationID) {
+        this.authorizationID = authorizationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setKDCAddress(final String address) {
+        this.kdcAddress = address;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setMaxReceiveBufferSize(final int size) {
+        maxReceiveBufferSize = size;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setMaxSendBufferSize(final int size) {
+        maxSendBufferSize = size;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setPassword(final byte[] password) {
+        Validator.ensureNotNull(password);
+        this.password = password;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setPassword(final char[] password) {
+        Validator.ensureNotNull(password);
+        this.password = StaticUtils.getBytes(password);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setRealm(final String realm) {
+        this.realm = realm;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setServerAuth(final boolean serverAuth) {
+        this.serverAuth = serverAuth;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public GSSAPISASLBindRequest setSubject(final Subject subject) {
+        this.subject = subject;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GSSAPISASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        if (subject != null) {
+            builder.append(", subject=");
+            builder.append(subject);
+        } else {
+            builder.append(", authenticationID=");
+            builder.append(authenticationID);
+            builder.append(", authorizationID=");
+            builder.append(authorizationID);
+            builder.append(", realm=");
+            builder.append(realm);
+            builder.append(", password=");
+            builder.append(ByteString.wrap(password));
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java
index c8859ed..02f321d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,140 +27,121 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A generic Bind request which should be used for unsupported authentication
  * methods. Servers that do not support a choice supplied by a client return a
  * Bind response with the result code set to
  * {@link ResultCode#AUTH_METHOD_NOT_SUPPORTED}.
  */
-public interface GenericBindRequest extends BindRequest
-{
-  /**
-   * {@inheritDoc}
-   */
-  GenericBindRequest addControl(Control control);
+public interface GenericBindRequest extends BindRequest {
+    /**
+     * {@inheritDoc}
+     */
+    GenericBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
+    /**
+     * {@inheritDoc}
+     */
+    byte getAuthenticationType();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * Returns the authentication information for this bind request. The content
+     * is defined by the authentication mechanism.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned byte array, allowing applications to overwrite any sensitive
+     * data such as passwords after it has been used.
+     *
+     * @return The authentication information.
+     */
+    byte[] getAuthenticationValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  byte getAuthenticationType();
+    /**
+     * {@inheritDoc}
+     */
+    String getName();
 
+    /**
+     * Sets the authentication mechanism identifier for this generic bind
+     * request. Note that value {@code 0} is reserved for simple authentication,
+     * {@code 1} and {@code 2} are reserved but unused, and {@code 3} is
+     * reserved for SASL authentication.
+     *
+     * @param type
+     *            The authentication mechanism identifier for this generic bind
+     *            request.
+     * @return This generic bind request.
+     * @throws UnsupportedOperationException
+     *             If this generic bind request does not permit the
+     *             authentication type to be set.
+     */
+    GenericBindRequest setAuthenticationType(byte type);
 
+    /**
+     * Sets the authentication information for this generic bind request in a
+     * form defined by the authentication mechanism.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned byte array, allowing applications to overwrite any sensitive
+     * data such as passwords after it has been used.
+     *
+     * @param bytes
+     *            The authentication information for this generic bind request
+     *            in a form defined by the authentication mechanism.
+     * @return This generic bind request.
+     * @throws UnsupportedOperationException
+     *             If this generic bind request does not permit the
+     *             authentication bytes to be set.
+     * @throws NullPointerException
+     *             If {@code bytes} was {@code null}.
+     */
+    GenericBindRequest setAuthenticationValue(byte[] bytes);
 
-  /**
-   * Returns the authentication information for this bind request. The content
-   * is defined by the authentication mechanism.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned byte array, allowing applications to overwrite any sensitive data
-   * such as passwords after it has been used.
-   *
-   * @return The authentication information.
-   */
-  byte[] getAuthenticationValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getName();
-
-
-
-  /**
-   * Sets the authentication mechanism identifier for this generic bind request.
-   * Note that value {@code 0} is reserved for simple authentication, {@code 1}
-   * and {@code 2} are reserved but unused, and {@code 3} is reserved for SASL
-   * authentication.
-   *
-   * @param type
-   *          The authentication mechanism identifier for this generic bind
-   *          request.
-   * @return This generic bind request.
-   * @throws UnsupportedOperationException
-   *           If this generic bind request does not permit the authentication
-   *           type to be set.
-   */
-  GenericBindRequest setAuthenticationType(byte type);
-
-
-
-  /**
-   * Sets the authentication information for this generic bind request in a form
-   * defined by the authentication mechanism.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned byte array, allowing applications to overwrite any sensitive data
-   * such as passwords after it has been used.
-   *
-   * @param bytes
-   *          The authentication information for this generic bind request in a
-   *          form defined by the authentication mechanism.
-   * @return This generic bind request.
-   * @throws UnsupportedOperationException
-   *           If this generic bind request does not permit the authentication
-   *           bytes to be set.
-   * @throws NullPointerException
-   *           If {@code bytes} was {@code null}.
-   */
-  GenericBindRequest setAuthenticationValue(byte[] bytes);
-
-
-  /**
-   * Sets the name of the Directory object that the client wishes to bind as.
-   * The name may be empty (but never {@code null} when used for of anonymous
-   * binds, or when using SASL authentication. The server shall not dereference
-   * any aliases in locating the named object.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind
-   *          as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the distinguished name to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  GenericBindRequest setName(String name);
+    /**
+     * Sets the name of the Directory object that the client wishes to bind as.
+     * The name may be empty (but never {@code null} when used for of anonymous
+     * binds, or when using SASL authentication. The server shall not
+     * dereference any aliases in locating the named object.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    GenericBindRequest setName(String name);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java
index 4490154..5e444e8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -37,176 +34,132 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Generic bind request implementation.
  */
-final class GenericBindRequestImpl extends
-    AbstractBindRequest<GenericBindRequest> implements GenericBindRequest
-{
-  private final BindClient bindClient;
+final class GenericBindRequestImpl extends AbstractBindRequest<GenericBindRequest> implements
+        GenericBindRequest {
+    private final BindClient bindClient;
 
-  private String name;
+    private String name;
 
-  private byte[] authenticationValue;
+    private byte[] authenticationValue;
 
-  private byte authenticationType;
+    private byte authenticationType;
 
-
-
-  /**
-   * Creates a new generic bind request using a generic bind client.
-   */
-  GenericBindRequestImpl(final String name, final byte authenticationType,
-      final byte[] authenticationValue)
-  {
-    this.name = name;
-    this.authenticationType = authenticationType;
-    this.authenticationValue = authenticationValue;
-    this.bindClient = null; // Create a new bind client each time.
-  }
-
-
-
-  /**
-   * Creates a new generic bind request using the provided bind client.
-   * <p>
-   * This is intended for use by other bind client implementations in this
-   * package.
-   */
-  GenericBindRequestImpl(final String name, final byte authenticationType,
-      final byte[] authenticationValue, final BindClient bindClient)
-  {
-    this.name = name;
-    this.authenticationType = authenticationType;
-    this.authenticationValue = authenticationValue;
-    this.bindClient = bindClient; // Always return same bind client.
-  }
-
-
-
-  /**
-   * Creates a new generic bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param genericBindRequest
-   *          The generic bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code genericBindRequest} was {@code null} .
-   */
-  GenericBindRequestImpl(
-      final GenericBindRequest genericBindRequest)
-  {
-    super(genericBindRequest);
-    this.name = genericBindRequest.getName();
-    this.authenticationType = genericBindRequest
-        .getAuthenticationType();
-    this.authenticationValue = copyOfBytes(genericBindRequest
-        .getAuthenticationValue());
-    this.bindClient = null; // Create a new bind client each time.
-  }
-
-
-
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    if (bindClient == null)
-    {
-      return new BindClientImpl(this)
-          .setNextAuthenticationValue(authenticationValue);
+    /**
+     * Creates a new generic bind request using a generic bind client.
+     */
+    GenericBindRequestImpl(final String name, final byte authenticationType,
+            final byte[] authenticationValue) {
+        this.name = name;
+        this.authenticationType = authenticationType;
+        this.authenticationValue = authenticationValue;
+        this.bindClient = null; // Create a new bind client each time.
     }
-    else
-    {
-      return bindClient;
+
+    /**
+     * Creates a new generic bind request using the provided bind client.
+     * <p>
+     * This is intended for use by other bind client implementations in this
+     * package.
+     */
+    GenericBindRequestImpl(final String name, final byte authenticationType,
+            final byte[] authenticationValue, final BindClient bindClient) {
+        this.name = name;
+        this.authenticationType = authenticationType;
+        this.authenticationValue = authenticationValue;
+        this.bindClient = bindClient; // Always return same bind client.
     }
-  }
 
+    /**
+     * Creates a new generic bind request that is an exact copy of the provided
+     * request.
+     *
+     * @param genericBindRequest
+     *            The generic bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code genericBindRequest} was {@code null} .
+     */
+    GenericBindRequestImpl(final GenericBindRequest genericBindRequest) {
+        super(genericBindRequest);
+        this.name = genericBindRequest.getName();
+        this.authenticationType = genericBindRequest.getAuthenticationType();
+        this.authenticationValue = copyOfBytes(genericBindRequest.getAuthenticationValue());
+        this.bindClient = null; // Create a new bind client each time.
+    }
 
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        if (bindClient == null) {
+            return new BindClientImpl(this).setNextAuthenticationValue(authenticationValue);
+        } else {
+            return bindClient;
+        }
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public byte getAuthenticationType()
-  {
-    return authenticationType;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public byte getAuthenticationType() {
+        return authenticationType;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getAuthenticationValue() {
+        return authenticationValue;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] getAuthenticationValue()
-  {
-    return authenticationValue;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public GenericBindRequest setAuthenticationType(final byte type) {
+        this.authenticationType = type;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public GenericBindRequest setAuthenticationValue(final byte[] bytes) {
+        Validator.ensureNotNull(bytes);
+        this.authenticationValue = bytes;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public GenericBindRequest setName(final String name) {
+        Validator.ensureNotNull(name);
+        this.name = name;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericBindRequest setAuthenticationType(final byte type)
-  {
-    this.authenticationType = type;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericBindRequest setAuthenticationValue(final byte[] bytes)
-  {
-    Validator.ensureNotNull(bytes);
-    this.authenticationValue = bytes;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericBindRequest setName(final String name)
-  {
-    Validator.ensureNotNull(name);
-    this.name = name;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GenericBindRequest(name=");
-    builder.append(getName());
-    builder.append(", authenticationType=");
-    builder.append(getAuthenticationType());
-    builder.append(", authenticationValue=");
-    builder.append(ByteString.wrap(getAuthenticationValue()));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GenericBindRequest(name=");
+        builder.append(getName());
+        builder.append(", authenticationType=");
+        builder.append(getAuthenticationType());
+        builder.append(", authenticationValue=");
+        builder.append(ByteString.wrap(getAuthenticationValue()));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java
index 6d61cfe..ae5c6bb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -40,104 +37,83 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
 
-
-
 /**
  * A generic Extended request which should be used for unsupported extended
  * operations. Servers list the names of Extended requests they recognize in the
  * {@code supportedExtension} attribute in the root DSE. Where the name is not
  * recognized, the server returns
- * {@link org.forgerock.opendj.ldap.ResultCode#PROTOCOL_ERROR} (the server may return this
- * error in other cases).
+ * {@link org.forgerock.opendj.ldap.ResultCode#PROTOCOL_ERROR} (the server may
+ * return this error in other cases).
  */
-public interface GenericExtendedRequest extends
-    ExtendedRequest<GenericExtendedResult>
-{
-  /**
-   * A decoder which can be used to decode generic extended operation requests.
-   */
-  public static final ExtendedRequestDecoder<GenericExtendedRequest,
-                                             GenericExtendedResult> DECODER =
-    new GenericExtendedRequestImpl.RequestDecoder();
+public interface GenericExtendedRequest extends ExtendedRequest<GenericExtendedResult> {
+    /**
+     * A decoder which can be used to decode generic extended operation
+     * requests.
+     */
+    public static final ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> DECODER =
+            new GenericExtendedRequestImpl.RequestDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResultDecoder<GenericExtendedResult> getResultDecoder();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
+    /**
+     * Sets the numeric OID associated with this extended request.
+     *
+     * @param oid
+     *            The numeric OID associated with this extended request.
+     * @return This generic extended request.
+     * @throws UnsupportedOperationException
+     *             If this generic extended request does not permit the request
+     *             name to be set.
+     * @throws NullPointerException
+     *             If {@code oid} was {@code null}.
+     */
+    GenericExtendedRequest setOID(String oid);
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResultDecoder<GenericExtendedResult> getResultDecoder();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Sets the numeric OID associated with this extended request.
-   *
-   * @param oid
-   *          The numeric OID associated with this extended request.
-   * @return This generic extended request.
-   * @throws UnsupportedOperationException
-   *           If this generic extended request does not permit the request name
-   *           to be set.
-   * @throws NullPointerException
-   *           If {@code oid} was {@code null}.
-   */
-  GenericExtendedRequest setOID(String oid);
-
-
-  /**
-   * Sets the value, if any, associated with this extended request. Its format
-   * is defined by the specification of this extended request.
-   *
-   * @param bytes
-   *          The value associated with this extended request, or {@code null}
-   *          if there is no value.
-   * @return This generic extended request.
-   * @throws UnsupportedOperationException
-   *           If this generic extended request does not permit the request
-   *           value to be set.
-   */
-  GenericExtendedRequest setValue(ByteString bytes);
+    /**
+     * Sets the value, if any, associated with this extended request. Its format
+     * is defined by the specification of this extended request.
+     *
+     * @param bytes
+     *            The value associated with this extended request, or
+     *            {@code null} if there is no value.
+     * @return This generic extended request.
+     * @throws UnsupportedOperationException
+     *             If this generic extended request does not permit the request
+     *             value to be set.
+     */
+    GenericExtendedRequest setValue(ByteString bytes);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java
index 88da759..9c3a919 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,230 +27,178 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.responses.AbstractExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Generic extended request implementation.
  */
 final class GenericExtendedRequestImpl extends
-    AbstractExtendedRequest<GenericExtendedRequest, GenericExtendedResult>
-    implements GenericExtendedRequest
-{
+        AbstractExtendedRequest<GenericExtendedRequest, GenericExtendedResult> implements
+        GenericExtendedRequest {
 
-  static final class RequestDecoder implements
-      ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult>
-  {
-    public GenericExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      if (request instanceof GenericExtendedRequest)
-      {
-        return (GenericExtendedRequest) request;
-      }
-      else
-      {
-        final GenericExtendedRequest newRequest = new GenericExtendedRequestImpl(
-            request.getOID(), request.getValue());
+    static final class RequestDecoder implements
+            ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> {
+        public GenericExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request,
+                final DecodeOptions options) throws DecodeException {
+            if (request instanceof GenericExtendedRequest) {
+                return (GenericExtendedRequest) request;
+            } else {
+                final GenericExtendedRequest newRequest =
+                        new GenericExtendedRequestImpl(request.getOID(), request.getValue());
 
-        for (final Control control : request.getControls())
-        {
-          newRequest.addControl(control);
+                for (final Control control : request.getControls()) {
+                    newRequest.addControl(control);
+                }
+
+                return newRequest;
+            }
+        }
+    }
+
+    private static final class GenericExtendedResultDecoder extends
+            AbstractExtendedResultDecoder<GenericExtendedResult> {
+
+        public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
         }
 
-        return newRequest;
-      }
-    }
-  }
-
-
-
-  private static final class GenericExtendedResultDecoder extends
-      AbstractExtendedResultDecoder<GenericExtendedResult>
-  {
-
-    public GenericExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      return Responses.newGenericExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
-    }
-
-
-
-    public GenericExtendedResult decodeExtendedResult(
-        final ExtendedResult result, final DecodeOptions options)
-        throws DecodeException
-    {
-      if (result instanceof GenericExtendedResult)
-      {
-        return (GenericExtendedResult) result;
-      }
-      else
-      {
-        final GenericExtendedResult newResult = Responses
-            .newGenericExtendedResult(result.getResultCode()).setMatchedDN(
-                result.getMatchedDN()).setDiagnosticMessage(
-                result.getDiagnosticMessage()).setOID(result.getOID())
-            .setValue(result.getValue());
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+        public GenericExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            if (result instanceof GenericExtendedResult) {
+                return (GenericExtendedResult) result;
+            } else {
+                final GenericExtendedResult newResult =
+                        Responses.newGenericExtendedResult(result.getResultCode()).setMatchedDN(
+                                result.getMatchedDN()).setDiagnosticMessage(
+                                result.getDiagnosticMessage()).setOID(result.getOID()).setValue(
+                                result.getValue());
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+                return newResult;
+            }
         }
-        return newResult;
-      }
     }
-  }
 
+    private static final GenericExtendedResultDecoder RESULT_DECODER =
+            new GenericExtendedResultDecoder();
 
+    private ByteString requestValue = ByteString.empty();
 
-  private static final GenericExtendedResultDecoder RESULT_DECODER =
-    new GenericExtendedResultDecoder();
+    private String requestName;
 
-  private ByteString requestValue = ByteString.empty();
-
-  private String requestName;
-
-
-
-  /**
-   * Creates a new generic extended request using the provided name and optional
-   * value.
-   *
-   * @param requestName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to this extended request.
-   * @param requestValue
-   *          The content of this generic extended request in a form defined by
-   *          the extended operation, or {@code null} if there is no content.
-   * @throws NullPointerException
-   *           If {@code requestName} was {@code null}.
-   */
-  GenericExtendedRequestImpl(final String requestName,
-      final ByteString requestValue)
-  {
-    this.requestName = requestName;
-    this.requestValue = requestValue;
-  }
-
-
-
-  /**
-   * Creates a new generic extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param genericExtendedRequest
-   *          The generic extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code extendedRequest} was {@code null} .
-   */
-  protected GenericExtendedRequestImpl(
-      GenericExtendedRequest genericExtendedRequest)
-  {
-    super(genericExtendedRequest);
-    this.requestName = genericExtendedRequest.getOID();
-    this.requestValue = genericExtendedRequest.getValue();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return requestName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<GenericExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return requestValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return requestValue != null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericExtendedRequest setOID(final String oid)
-  {
-    Validator.ensureNotNull(oid);
-    this.requestName = oid;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericExtendedRequest setValue(final ByteString bytes)
-  {
-    this.requestValue = bytes;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GenericExtendedRequest(requestName=");
-    builder.append(getOID());
-    if (hasValue())
-    {
-      builder.append(", requestValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new generic extended request using the provided name and
+     * optional value.
+     *
+     * @param requestName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to this extended request.
+     * @param requestValue
+     *            The content of this generic extended request in a form defined
+     *            by the extended operation, or {@code null} if there is no
+     *            content.
+     * @throws NullPointerException
+     *             If {@code requestName} was {@code null}.
+     */
+    GenericExtendedRequestImpl(final String requestName, final ByteString requestValue) {
+        this.requestName = requestName;
+        this.requestValue = requestValue;
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * Creates a new generic extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param genericExtendedRequest
+     *            The generic extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code extendedRequest} was {@code null} .
+     */
+    protected GenericExtendedRequestImpl(GenericExtendedRequest genericExtendedRequest) {
+        super(genericExtendedRequest);
+        this.requestName = genericExtendedRequest.getOID();
+        this.requestValue = genericExtendedRequest.getValue();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return requestName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<GenericExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return requestValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return requestValue != null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericExtendedRequest setOID(final String oid) {
+        Validator.ensureNotNull(oid);
+        this.requestName = oid;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericExtendedRequest setValue(final ByteString bytes) {
+        this.requestValue = bytes;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GenericExtendedRequest(requestName=");
+        builder.append(getOID());
+        if (hasValue()) {
+            builder.append(", requestValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java
index 60d3d4c..86ad5d0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,9 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
@@ -42,219 +39,190 @@
 import org.forgerock.opendj.ldif.ChangeRecord;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * The Modify DN operation allows a client to change the Relative Distinguished
  * Name (RDN) of an entry in the Directory and/or to move a subtree of entries
  * to a new location in the Directory.
  */
-public interface ModifyDNRequest extends Request, ChangeRecord
-{
-  /**
-   * {@inheritDoc}
-   */
-  <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
+public interface ModifyDNRequest extends Request, ChangeRecord {
+    /**
+     * {@inheritDoc}
+     */
+    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
 
+    /**
+     * {@inheritDoc}
+     */
+    ModifyDNRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  ModifyDNRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the distinguished name of the entry to be renamed. This entry may
+     * or may not have subordinate entries. The server shall not dereference any
+     * aliases in locating the entry to be renamed.
+     *
+     * @return The distinguished name of the entry.
+     */
+    DN getName();
 
+    /**
+     * Returns the new RDN of the entry to be renamed. The value of the old RDN
+     * is supplied when moving the entry to a new superior without changing its
+     * RDN. Attribute values of the new RDN not matching any attribute value of
+     * the entry are added to the entry, and an appropriate error is returned if
+     * this fails.
+     *
+     * @return The new RDN of the entry.
+     */
+    RDN getNewRDN();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the distinguished name of an existing entry that will become the
+     * immediate superior (parent) of the entry to be renamed. The server shall
+     * not dereference any aliases in locating the new superior entry.
+     *
+     * @return The distinguished name of the new superior entry, or {@code null}
+     *         if the entry is to remain under the same parent entry.
+     */
+    DN getNewSuperior();
 
+    /**
+     * Indicates whether the old RDN attribute values are to be retained as
+     * attributes of the entry or deleted from the entry.
+     *
+     * @return {@code true} if the old RDN attribute values are to be deleted
+     *         from the entry, or {@code false} if they are to be retained.
+     */
+    boolean isDeleteOldRDN();
 
+    /**
+     * Specifies whether the old RDN attribute values are to be retained as
+     * attributes of the entry or deleted from the entry.
+     *
+     * @param deleteOldRDN
+     *            {@code true} if the old RDN attribute values are to be deleted
+     *            from the entry, or {@code false} if they are to be retained.
+     * @return This modify DN request.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the delete old RDN
+     *             parameter to be set.
+     */
+    ModifyDNRequest setDeleteOldRDN(boolean deleteOldRDN);
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Sets the distinguished name of the entry to be renamed. This entry may or
+     * may not have subordinate entries. The server shall not dereference any
+     * aliases in locating the entry to be renamed.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be renamed.
+     * @return This modify DN request.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the distinguished
+     *             name to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    ModifyDNRequest setName(DN dn);
 
+    /**
+     * Sets the distinguished name of the entry to be renamed. This entry may or
+     * may not have subordinate entries. The server shall not dereference any
+     * aliases in locating the entry to be renamed.
+     *
+     * @param dn
+     *            The distinguished name of the entry to be renamed.
+     * @return This modify DN request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the distinguished
+     *             name to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    ModifyDNRequest setName(String dn);
 
+    /**
+     * Sets the new RDN of the entry to be renamed. The value of the old RDN is
+     * supplied when moving the entry to a new superior without changing its
+     * RDN. Attribute values of the new RDN not matching any attribute value of
+     * the entry are added to the entry, and an appropriate error is returned if
+     * this fails.
+     *
+     * @param rdn
+     *            The new RDN of the entry to be renamed.
+     * @return This modify DN request.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the new RDN to be
+     *             set.
+     * @throws NullPointerException
+     *             If {@code rdn} was {@code null}.
+     */
+    ModifyDNRequest setNewRDN(RDN rdn);
 
-  /**
-   * Returns the distinguished name of the entry to be renamed. This entry may
-   * or may not have subordinate entries. The server shall not dereference any
-   * aliases in locating the entry to be renamed.
-   *
-   * @return The distinguished name of the entry.
-   */
-  DN getName();
+    /**
+     * Sets the new RDN of the entry to be renamed. The value of the old RDN is
+     * supplied when moving the entry to a new superior without changing its
+     * RDN. Attribute values of the new RDN not matching any attribute value of
+     * the entry are added to the entry, and an appropriate error is returned if
+     * this fails.
+     *
+     * @param rdn
+     *            The new RDN of the entry to be renamed.
+     * @return This modify DN request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code rdn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the new RDN to be
+     *             set.
+     * @throws NullPointerException
+     *             If {@code rdn} was {@code null}.
+     */
+    ModifyDNRequest setNewRDN(String rdn);
 
+    /**
+     * Sets the distinguished name of an existing entry that will become the
+     * immediate superior (parent) of the entry to be renamed. The server shall
+     * not dereference any aliases in locating the new superior entry.
+     *
+     * @param dn
+     *            The distinguished name of an existing entry that will become
+     *            the immediate superior (parent) of the entry to be renamed,
+     *            may be {@code null}.
+     * @return This modify DN request.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the new superior to
+     *             be set.
+     */
+    ModifyDNRequest setNewSuperior(DN dn);
 
-
-  /**
-   * Returns the new RDN of the entry to be renamed. The value of the old RDN is
-   * supplied when moving the entry to a new superior without changing its RDN.
-   * Attribute values of the new RDN not matching any attribute value of the
-   * entry are added to the entry, and an appropriate error is returned if this
-   * fails.
-   *
-   * @return The new RDN of the entry.
-   */
-  RDN getNewRDN();
-
-
-
-  /**
-   * Returns the distinguished name of an existing entry that will become the
-   * immediate superior (parent) of the entry to be renamed. The server shall
-   * not dereference any aliases in locating the new superior entry.
-   *
-   * @return The distinguished name of the new superior entry, or {@code null}
-   *         if the entry is to remain under the same parent entry.
-   */
-  DN getNewSuperior();
-
-
-
-  /**
-   * Indicates whether the old RDN attribute values are to be retained as
-   * attributes of the entry or deleted from the entry.
-   *
-   * @return {@code true} if the old RDN attribute values are to be deleted from
-   *         the entry, or {@code false} if they are to be retained.
-   */
-  boolean isDeleteOldRDN();
-
-
-
-  /**
-   * Specifies whether the old RDN attribute values are to be retained as
-   * attributes of the entry or deleted from the entry.
-   *
-   * @param deleteOldRDN
-   *          {@code true} if the old RDN attribute values are to be deleted
-   *          from the entry, or {@code false} if they are to be retained.
-   * @return This modify DN request.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the delete old RDN
-   *           parameter to be set.
-   */
-  ModifyDNRequest setDeleteOldRDN(boolean deleteOldRDN);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be renamed. This entry may or
-   * may not have subordinate entries. The server shall not dereference any
-   * aliases in locating the entry to be renamed.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be renamed.
-   * @return This modify DN request.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the distinguished name
-   *           to be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  ModifyDNRequest setName(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be renamed. This entry may or
-   * may not have subordinate entries. The server shall not dereference any
-   * aliases in locating the entry to be renamed.
-   *
-   * @param dn
-   *          The distinguished name of the entry to be renamed.
-   * @return This modify DN request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the distinguished name
-   *           to be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  ModifyDNRequest setName(String dn);
-
-
-
-  /**
-   * Sets the new RDN of the entry to be renamed. The value of the old RDN is
-   * supplied when moving the entry to a new superior without changing its RDN.
-   * Attribute values of the new RDN not matching any attribute value of the
-   * entry are added to the entry, and an appropriate error is returned if this
-   * fails.
-   *
-   * @param rdn
-   *          The new RDN of the entry to be renamed.
-   * @return This modify DN request.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the new RDN to be set.
-   * @throws NullPointerException
-   *           If {@code rdn} was {@code null}.
-   */
-  ModifyDNRequest setNewRDN(RDN rdn);
-
-
-
-  /**
-   * Sets the new RDN of the entry to be renamed. The value of the old RDN is
-   * supplied when moving the entry to a new superior without changing its RDN.
-   * Attribute values of the new RDN not matching any attribute value of the
-   * entry are added to the entry, and an appropriate error is returned if this
-   * fails.
-   *
-   * @param rdn
-   *          The new RDN of the entry to be renamed.
-   * @return This modify DN request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code rdn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the new RDN to be set.
-   * @throws NullPointerException
-   *           If {@code rdn} was {@code null}.
-   */
-  ModifyDNRequest setNewRDN(String rdn);
-
-
-
-  /**
-   * Sets the distinguished name of an existing entry that will become the
-   * immediate superior (parent) of the entry to be renamed. The server shall
-   * not dereference any aliases in locating the new superior entry.
-   *
-   * @param dn
-   *          The distinguished name of an existing entry that will become the
-   *          immediate superior (parent) of the entry to be renamed, may be
-   *          {@code null}.
-   * @return This modify DN request.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the new superior to be
-   *           set.
-   */
-  ModifyDNRequest setNewSuperior(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of an existing entry that will become the
-   * immediate superior (parent) of the entry to be renamed. The server shall
-   * not dereference any aliases in locating the new superior entry.
-   *
-   * @param dn
-   *          The distinguished name of an existing entry that will become the
-   *          immediate superior (parent) of the entry to be renamed, may be
-   *          {@code null}.
-   * @return This modify DN request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this modify DN request does not permit the new superior to be
-   *           set.
-   */
-  ModifyDNRequest setNewSuperior(String dn);
+    /**
+     * Sets the distinguished name of an existing entry that will become the
+     * immediate superior (parent) of the entry to be renamed. The server shall
+     * not dereference any aliases in locating the new superior entry.
+     *
+     * @param dn
+     *            The distinguished name of an existing entry that will become
+     *            the immediate superior (parent) of the entry to be renamed,
+     *            may be {@code null}.
+     * @return This modify DN request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this modify DN request does not permit the new superior to
+     *             be set.
+     */
+    ModifyDNRequest setNewSuperior(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java
index 2486d54..ce1047d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,229 +27,176 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.RDN;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Modify DN request implementation.
  */
-final class ModifyDNRequestImpl extends AbstractRequestImpl<ModifyDNRequest>
-    implements ModifyDNRequest
-{
-  private DN name;
+final class ModifyDNRequestImpl extends AbstractRequestImpl<ModifyDNRequest> implements
+        ModifyDNRequest {
+    private DN name;
 
-  private DN newSuperior = null;
+    private DN newSuperior = null;
 
-  private RDN newRDN;
+    private RDN newRDN;
 
-  private boolean deleteOldRDN = false;
+    private boolean deleteOldRDN = false;
 
+    /**
+     * Creates a new modify DN request using the provided distinguished name and
+     * new RDN.
+     *
+     * @param name
+     *            The distinguished name of the entry to be renamed.
+     * @param newRDN
+     *            The new RDN of the entry.
+     * @throws NullPointerException
+     *             If {@code name} or {@code newRDN} was {@code null}.
+     */
+    ModifyDNRequestImpl(final DN name, final RDN newRDN) {
+        this.name = name;
+        this.newRDN = newRDN;
+    }
 
+    /**
+     * Creates a new modify DN request that is an exact copy of the provided
+     * request.
+     *
+     * @param modifyDNRequest
+     *            The modify DN request to be copied.
+     * @throws NullPointerException
+     *             If {@code modifyDNRequest} was {@code null} .
+     */
+    ModifyDNRequestImpl(final ModifyDNRequest modifyDNRequest) {
+        super(modifyDNRequest);
+        this.name = modifyDNRequest.getName();
+        this.newSuperior = modifyDNRequest.getNewSuperior();
+        this.newRDN = modifyDNRequest.getNewRDN();
+        this.deleteOldRDN = modifyDNRequest.isDeleteOldRDN();
+    }
 
-  /**
-   * Creates a new modify DN request using the provided distinguished name and
-   * new RDN.
-   *
-   * @param name
-   *          The distinguished name of the entry to be renamed.
-   * @param newRDN
-   *          The new RDN of the entry.
-   * @throws NullPointerException
-   *           If {@code name} or {@code newRDN} was {@code null}.
-   */
-  ModifyDNRequestImpl(final DN name, final RDN newRDN)
-  {
-    this.name = name;
-    this.newRDN = newRDN;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public RDN getNewRDN() {
+        return newRDN;
+    }
 
-  /**
-   * Creates a new modify DN request that is an exact copy of the provided
-   * request.
-   *
-   * @param modifyDNRequest
-   *          The modify DN request to be copied.
-   * @throws NullPointerException
-   *           If {@code modifyDNRequest} was {@code null} .
-   */
-  ModifyDNRequestImpl(final ModifyDNRequest modifyDNRequest)
-  {
-    super(modifyDNRequest);
-    this.name = modifyDNRequest.getName();
-    this.newSuperior = modifyDNRequest.getNewSuperior();
-    this.newRDN = modifyDNRequest.getNewRDN();
-    this.deleteOldRDN = modifyDNRequest.isDeleteOldRDN();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public DN getNewSuperior() {
+        return newSuperior;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDeleteOldRDN() {
+        return deleteOldRDN;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequestImpl setDeleteOldRDN(final boolean deleteOldRDN) {
+        this.deleteOldRDN = deleteOldRDN;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setName(final DN dn) {
+        Validator.ensureNotNull(dn);
+        this.name = dn;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setName(final String dn) {
+        Validator.ensureNotNull(dn);
+        this.name = DN.valueOf(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setNewRDN(final RDN rdn) {
+        Validator.ensureNotNull(rdn);
+        this.newRDN = rdn;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return name;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setNewRDN(final String rdn) {
+        Validator.ensureNotNull(rdn);
+        this.newRDN = RDN.valueOf(rdn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setNewSuperior(final DN dn) {
+        this.newSuperior = dn;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyDNRequest setNewSuperior(final String dn) {
+        this.newSuperior = (dn != null) ? DN.valueOf(dn) : null;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public RDN getNewRDN()
-  {
-    return newRDN;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ModifyDNRequest(name=");
+        builder.append(getName());
+        builder.append(", newRDN=");
+        builder.append(getNewRDN());
+        builder.append(", deleteOldRDN=");
+        builder.append(isDeleteOldRDN());
+        builder.append(", newSuperior=");
+        builder.append(String.valueOf(getNewSuperior()));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getNewSuperior()
-  {
-    return newSuperior;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isDeleteOldRDN()
-  {
-    return deleteOldRDN;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequestImpl setDeleteOldRDN(final boolean deleteOldRDN)
-  {
-    this.deleteOldRDN = deleteOldRDN;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setName(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = DN.valueOf(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setNewRDN(final RDN rdn)
-  {
-    Validator.ensureNotNull(rdn);
-    this.newRDN = rdn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setNewRDN(final String rdn)
-  {
-    Validator.ensureNotNull(rdn);
-    this.newRDN = RDN.valueOf(rdn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setNewSuperior(final DN dn)
-  {
-    this.newSuperior = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyDNRequest setNewSuperior(final String dn)
-  {
-    this.newSuperior = (dn != null) ? DN.valueOf(dn) : null;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ModifyDNRequest(name=");
-    builder.append(getName());
-    builder.append(", newRDN=");
-    builder.append(getNewRDN());
-    builder.append(", deleteOldRDN=");
-    builder.append(isDeleteOldRDN());
-    builder.append(", newSuperior=");
-    builder.append(String.valueOf(getNewSuperior()));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  ModifyDNRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    ModifyDNRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java
index 29f178f..2f8f539 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,154 +27,138 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 import org.forgerock.opendj.ldif.ChangeRecord;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * The Modify operation allows a client to request that a modification of an
  * entry be performed on its behalf by a server.
  */
-public interface ModifyRequest extends Request, ChangeRecord
-{
-  /**
-   * {@inheritDoc}
-   */
-  <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
+public interface ModifyRequest extends Request, ChangeRecord {
+    /**
+     * {@inheritDoc}
+     */
+    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
 
+    /**
+     * {@inheritDoc}
+     */
+    ModifyRequest addControl(Control control);
 
+    /**
+     * Appends the provided modification to the list of modifications included
+     * with this modify request.
+     *
+     * @param modification
+     *            The modification to be performed.
+     * @return This modify request.
+     * @throws UnsupportedOperationException
+     *             If this modify request does not permit modifications to be
+     *             added.
+     * @throws NullPointerException
+     *             If {@code modification} was {@code null}.
+     */
+    ModifyRequest addModification(Modification modification);
 
-  /**
-   * {@inheritDoc}
-   */
-  ModifyRequest addControl(Control control);
+    /**
+     * Appends the provided modification to the list of modifications included
+     * with this modify request.
+     * <p>
+     * If the attribute value is not an instance of {@code ByteString} then it
+     * will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param type
+     *            The type of modification to be performed.
+     * @param attributeDescription
+     *            The name of the attribute to be modified.
+     * @param values
+     *            The attribute values to be modified.
+     * @return This modify request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code attributeDescription} could not be decoded using
+     *             the default schema.
+     * @throws UnsupportedOperationException
+     *             If this modify request does not permit modifications to be
+     *             added.
+     * @throws NullPointerException
+     *             If {@code type}, {@code attributeDescription}, or
+     *             {@code value} was {@code null}.
+     */
+    ModifyRequest addModification(ModificationType type, String attributeDescription,
+            Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * Appends the provided modification to the list of modifications included
-   * with this modify request.
-   *
-   * @param modification
-   *          The modification to be performed.
-   * @return This modify request.
-   * @throws UnsupportedOperationException
-   *           If this modify request does not permit modifications to be added.
-   * @throws NullPointerException
-   *           If {@code modification} was {@code null}.
-   */
-  ModifyRequest addModification(Modification modification);
+    /**
+     * Returns a {@code List} containing the modifications included with this
+     * modify request. The returned {@code List} may be modified if permitted by
+     * this modify request.
+     *
+     * @return A {@code List} containing the modifications.
+     */
+    List<Modification> getModifications();
 
+    /**
+     * Returns the distinguished name of the entry to be modified. The server
+     * shall not perform any alias dereferencing in determining the object to be
+     * modified.
+     *
+     * @return The distinguished name of the entry to be modified.
+     */
+    DN getName();
 
+    /**
+     * Sets the distinguished name of the entry to be modified. The server shall
+     * not perform any alias dereferencing in determining the object to be
+     * modified.
+     *
+     * @param dn
+     *            The the distinguished name of the entry to be modified.
+     * @return This modify request.
+     * @throws UnsupportedOperationException
+     *             If this modify request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    ModifyRequest setName(DN dn);
 
-  /**
-   * Appends the provided modification to the list of modifications included
-   * with this modify request.
-   * <p>
-   * If the attribute value is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param type
-   *          The type of modification to be performed.
-   * @param attributeDescription
-   *          The name of the attribute to be modified.
-   * @param values
-   *          The attribute values to be modified.
-   * @return This modify request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code attributeDescription} could not be decoded using the
-   *           default schema.
-   * @throws UnsupportedOperationException
-   *           If this modify request does not permit modifications to be added.
-   * @throws NullPointerException
-   *           If {@code type}, {@code attributeDescription}, or {@code value}
-   *           was {@code null}.
-   */
-  ModifyRequest addModification(ModificationType type,
-      String attributeDescription, Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns a {@code List} containing the modifications included with this
-   * modify request. The returned {@code List} may be modified if permitted by
-   * this modify request.
-   *
-   * @return A {@code List} containing the modifications.
-   */
-  List<Modification> getModifications();
-
-
-
-  /**
-   * Returns the distinguished name of the entry to be modified. The server
-   * shall not perform any alias dereferencing in determining the object to be
-   * modified.
-   *
-   * @return The distinguished name of the entry to be modified.
-   */
-  DN getName();
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be modified. The server shall
-   * not perform any alias dereferencing in determining the object to be
-   * modified.
-   *
-   * @param dn
-   *          The the distinguished name of the entry to be modified.
-   * @return This modify request.
-   * @throws UnsupportedOperationException
-   *           If this modify request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  ModifyRequest setName(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of the entry to be modified. The server shall
-   * not perform any alias dereferencing in determining the object to be
-   * modified.
-   *
-   * @param dn
-   *          The the distinguished name of the entry to be modified.
-   * @return This modify request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this modify request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  ModifyRequest setName(String dn);
+    /**
+     * Sets the distinguished name of the entry to be modified. The server shall
+     * not perform any alias dereferencing in determining the object to be
+     * modified.
+     *
+     * @param dn
+     *            The the distinguished name of the entry to be modified.
+     * @return This modify request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this modify request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    ModifyRequest setName(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java
index 49b4553..a3f589d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,184 +27,143 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.LinkedAttribute;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Modify request implementation.
  */
-final class ModifyRequestImpl extends AbstractRequestImpl<ModifyRequest>
-    implements ModifyRequest
-{
-  private final List<Modification> changes = new LinkedList<Modification>();
+final class ModifyRequestImpl extends AbstractRequestImpl<ModifyRequest> implements ModifyRequest {
+    private final List<Modification> changes = new LinkedList<Modification>();
 
-  private DN name;
+    private DN name;
 
-
-
-  /**
-   * Creates a new modify request using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry to be modified.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  ModifyRequestImpl(final DN name)
-  {
-    this.name = name;
-  }
-
-
-
-  /**
-   * Creates a new modify request that is an exact copy of the provided
-   * request.
-   *
-   * @param modifyRequest
-   *          The modify request to be copied.
-   * @throws NullPointerException
-   *           If {@code modifyRequest} was {@code null} .
-   */
-  ModifyRequestImpl(final ModifyRequest modifyRequest)
-  {
-    super(modifyRequest);
-    this.name = modifyRequest.getName();
-
-    // Deep copy.
-    for (Modification modification : modifyRequest.getModifications())
-    {
-      ModificationType type = modification.getModificationType();
-      Attribute attribute = new LinkedAttribute(modification.getAttribute());
-      Modification copy = new Modification(type, attribute);
-      this.changes.add(copy);
+    /**
+     * Creates a new modify request using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry to be modified.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    ModifyRequestImpl(final DN name) {
+        this.name = name;
     }
-  }
 
+    /**
+     * Creates a new modify request that is an exact copy of the provided
+     * request.
+     *
+     * @param modifyRequest
+     *            The modify request to be copied.
+     * @throws NullPointerException
+     *             If {@code modifyRequest} was {@code null} .
+     */
+    ModifyRequestImpl(final ModifyRequest modifyRequest) {
+        super(modifyRequest);
+        this.name = modifyRequest.getName();
 
+        // Deep copy.
+        for (Modification modification : modifyRequest.getModifications()) {
+            ModificationType type = modification.getModificationType();
+            Attribute attribute = new LinkedAttribute(modification.getAttribute());
+            Modification copy = new Modification(type, attribute);
+            this.changes.add(copy);
+        }
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public <R, P> R accept(final ChangeRecordVisitor<R, P> v, final P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    public ModifyRequest addChange(final ModificationType type, final String attributeDescription,
+            final Object firstValue, final Object... remainingValues) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyRequest addModification(final Modification change) {
+        Validator.ensureNotNull(change);
+        changes.add(change);
+        return this;
+    }
 
-  public ModifyRequest addChange(final ModificationType type,
-      final String attributeDescription, final Object firstValue,
-      final Object... remainingValues)
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyRequest addModification(final ModificationType type,
+            final String attributeDescription, final Object... values) {
+        Validator.ensureNotNull(type, attributeDescription, values);
+        changes.add(new Modification(type, new LinkedAttribute(attributeDescription, values)));
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public List<Modification> getModifications() {
+        return changes;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return name;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyRequest addModification(final Modification change)
-  {
-    Validator.ensureNotNull(change);
-    changes.add(change);
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyRequest setName(final DN dn) {
+        Validator.ensureNotNull(dn);
+        this.name = dn;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ModifyRequest setName(final String dn) {
+        Validator.ensureNotNull(dn);
+        this.name = DN.valueOf(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ModifyRequest(dn=");
+        builder.append(getName());
+        builder.append(", changes=");
+        builder.append(getModifications());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyRequest addModification(final ModificationType type,
-      final String attributeDescription, final Object... values)
-  {
-    Validator.ensureNotNull(type, attributeDescription, values);
-    changes.add(new Modification(type, new LinkedAttribute(
-        attributeDescription, values)));
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public List<Modification> getModifications()
-  {
-    return changes;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyRequest setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ModifyRequest setName(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-    this.name = DN.valueOf(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ModifyRequest(dn=");
-    builder.append(getName());
-    builder.append(", changes=");
-    builder.append(getModifications());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  ModifyRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    ModifyRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java
index 3d7af45..fc33192 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -40,8 +37,6 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult;
 
-
-
 /**
  * The password modify extended request as defined in RFC 3062. This operation
  * allows directory clients to update user passwords. The user may or may not be
@@ -55,216 +50,180 @@
  *      Modify Extended Operation </a>
  */
 public interface PasswordModifyExtendedRequest extends
-    ExtendedRequest<PasswordModifyExtendedResult>
-{
+        ExtendedRequest<PasswordModifyExtendedResult> {
 
-  /**
-   * The OID for the password modify extended operation request.
-   */
-  public static final String OID = "1.3.6.1.4.1.4203.1.11.1";
+    /**
+     * The OID for the password modify extended operation request.
+     */
+    public static final String OID = "1.3.6.1.4.1.4203.1.11.1";
 
-  /**
-   * A decoder which can be used to decode password modify extended operation
-   * requests.
-   */
-  public static final ExtendedRequestDecoder<PasswordModifyExtendedRequest,
-                                             PasswordModifyExtendedResult>
-    DECODER = new PasswordModifyExtendedRequestImpl.RequestDecoder();
+    /**
+     * A decoder which can be used to decode password modify extended operation
+     * requests.
+     */
+    public static final ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> DECODER =
+            new PasswordModifyExtendedRequestImpl.RequestDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the desired password for the user, or {@code null} if a new
+     * password should be generated.
+     *
+     * @return The desired password for the user, or {@code null} if a new
+     *         password should be generated.
+     */
+    ByteString getNewPassword();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the current password for the user, if known.
+     *
+     * @return The current password for the user, or {@code null} if the
+     *         password is not known.
+     */
+    ByteString getOldPassword();
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder();
 
+    /**
+     * Returns the identity of the user whose password is to be modified, or
+     * {@code null} if the request should be applied to the user currently
+     * associated with the session. The returned identity may or may not be a
+     * distinguished name.
+     *
+     * @return The identity of the user whose password is to be modified, or
+     *         {@code null} if the request should be applied to the user
+     *         currently associated with the session.
+     */
+    ByteString getUserIdentity();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Returns the identity of the user whose password is to be modified decoded
+     * as a UTF-8 string, or {@code null} if the request should be applied to
+     * the user currently associated with the session. The returned identity may
+     * or may not be a distinguished name.
+     *
+     * @return The identity of the user whose password is to be modified decoded
+     *         as a UTF-8 string, or {@code null} if the request should be
+     *         applied to the user currently associated with the session.
+     */
+    String getUserIdentityAsString();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
-  /**
-   * Returns the desired password for the user, or {@code null} if a new
-   * password should be generated.
-   *
-   * @return The desired password for the user, or {@code null} if a new
-   *         password should be generated.
-   */
-  ByteString getNewPassword();
+    /**
+     * Sets the desired password for the user.
+     *
+     * @param newPassword
+     *            The desired password for the user, or {@code null} if a new
+     *            password should be generated.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             new password to be set.
+     */
+    PasswordModifyExtendedRequest setNewPassword(ByteString newPassword);
 
+    /**
+     * Sets the desired password for the user. The password will be converted to
+     * a UTF-8 octet string.
+     *
+     * @param newPassword
+     *            The desired password for the user, or {@code null} if a new
+     *            password should be generated.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             new password to be set.
+     */
+    PasswordModifyExtendedRequest setNewPassword(char[] newPassword);
 
+    /**
+     * Sets the current password for the user.
+     *
+     * @param oldPassword
+     *            The current password for the user, or {@code null} if the
+     *            password is not known.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             old password to be set.
+     */
+    PasswordModifyExtendedRequest setOldPassword(ByteString oldPassword);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
+    /**
+     * Sets the current password for the user. The password will be converted to
+     * a UTF-8 octet string.
+     *
+     * @param oldPassword
+     *            The current password for the user, or {@code null} if the
+     *            password is not known.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             old password to be set.
+     */
+    PasswordModifyExtendedRequest setOldPassword(char[] oldPassword);
 
+    /**
+     * Sets the identity of the user whose password is to be modified. The
+     * identity may or may not be a distinguished name.
+     *
+     * @param userIdentity
+     *            The identity of the user whose password is to be modified, or
+     *            {@code null} if the request should be applied to the user
+     *            currently associated with the session.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             user identity to be set.
+     */
+    PasswordModifyExtendedRequest setUserIdentity(ByteString userIdentity);
 
-
-  /**
-   * Returns the current password for the user, if known.
-   *
-   * @return The current password for the user, or {@code null} if the password
-   *         is not known.
-   */
-  ByteString getOldPassword();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder();
-
-
-
-  /**
-   * Returns the identity of the user whose password is to be modified, or
-   * {@code null} if the request should be applied to the user currently
-   * associated with the session. The returned identity may or may not be a
-   * distinguished name.
-   *
-   * @return The identity of the user whose password is to be modified, or
-   *         {@code null} if the request should be applied to the user currently
-   *         associated with the session.
-   */
-  ByteString getUserIdentity();
-
-
-
-  /**
-   * Returns the identity of the user whose password is to be modified decoded
-   * as a UTF-8 string, or {@code null} if the request should be applied to the
-   * user currently associated with the session. The returned identity may or
-   * may not be a distinguished name.
-   *
-   * @return The identity of the user whose password is to be modified decoded
-   *         as a UTF-8 string, or {@code null} if the request should be applied
-   *         to the user currently associated with the session.
-   */
-  String getUserIdentityAsString();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Sets the desired password for the user.
-   *
-   * @param newPassword
-   *          The desired password for the user, or {@code null} if a new
-   *          password should be generated.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the new
-   *           password to be set.
-   */
-  PasswordModifyExtendedRequest setNewPassword(ByteString newPassword);
-
-
-
-  /**
-   * Sets the desired password for the user. The password will be converted to a
-   * UTF-8 octet string.
-   *
-   * @param newPassword
-   *          The desired password for the user, or {@code null} if a new
-   *          password should be generated.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the new
-   *           password to be set.
-   */
-  PasswordModifyExtendedRequest setNewPassword(char[] newPassword);
-
-
-
-  /**
-   * Sets the current password for the user.
-   *
-   * @param oldPassword
-   *          The current password for the user, or {@code null} if the password
-   *          is not known.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the old
-   *           password to be set.
-   */
-  PasswordModifyExtendedRequest setOldPassword(ByteString oldPassword);
-
-
-
-  /**
-   * Sets the current password for the user. The password will be converted to a
-   * UTF-8 octet string.
-   *
-   * @param oldPassword
-   *          The current password for the user, or {@code null} if the password
-   *          is not known.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the old
-   *           password to be set.
-   */
-  PasswordModifyExtendedRequest setOldPassword(char[] oldPassword);
-
-
-
-  /**
-   * Sets the identity of the user whose password is to be modified. The
-   * identity may or may not be a distinguished name.
-   *
-   * @param userIdentity
-   *          The identity of the user whose password is to be modified, or
-   *          {@code null} if the request should be applied to the user
-   *          currently associated with the session.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the user
-   *           identity to be set.
-   */
-  PasswordModifyExtendedRequest setUserIdentity(ByteString userIdentity);
-
-
-
-  /**
-   * Sets the identity of the user whose password is to be modified. The
-   * identity may or may not be a distinguished name. The identity will be
-   * converted to a UTF-8 octet string.
-   *
-   * @param userIdentity
-   *          The identity of the user whose password is to be modified, or
-   *          {@code null} if the request should be applied to the user
-   *          currently associated with the session.
-   * @return This password modify request.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended request does not permit the user
-   *           identity to be set.
-   */
-  PasswordModifyExtendedRequest setUserIdentity(String userIdentity);
+    /**
+     * Sets the identity of the user whose password is to be modified. The
+     * identity may or may not be a distinguished name. The identity will be
+     * converted to a UTF-8 octet string.
+     *
+     * @param userIdentity
+     *            The identity of the user whose password is to be modified, or
+     *            {@code null} if the request should be applied to the user
+     *            currently associated with the session.
+     * @return This password modify request.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended request does not permit the
+     *             user identity to be set.
+     */
+    PasswordModifyExtendedRequest setUserIdentity(String userIdentity);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java
index 7d7aef3..00ab4b8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST;
 
@@ -39,398 +36,309 @@
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.asn1.ASN1Writer;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.responses.*;
-
-
+import org.forgerock.opendj.ldap.responses.AbstractExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
 
 /**
  * Password modify extended request implementation.
  */
-final class PasswordModifyExtendedRequestImpl
-    extends
-    AbstractExtendedRequest<PasswordModifyExtendedRequest, PasswordModifyExtendedResult>
-    implements PasswordModifyExtendedRequest
-{
-  static final class RequestDecoder
-      implements
-      ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult>
-  {
-    public PasswordModifyExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      final PasswordModifyExtendedRequest newRequest = new PasswordModifyExtendedRequestImpl();
-      if (request.getValue() != null)
-      {
-        try
-        {
-          final ASN1Reader reader = ASN1.getReader(request.getValue());
-          reader.readStartSequence();
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_PASSWORD_MODIFY_USER_ID))
-          {
-            newRequest.setUserIdentity(reader.readOctetStringAsString());
-          }
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_PASSWORD_MODIFY_OLD_PASSWORD))
-          {
-            newRequest.setOldPassword(reader.readOctetString());
-          }
-          if (reader.hasNextElement()
-              && (reader.peekType() == TYPE_PASSWORD_MODIFY_NEW_PASSWORD))
-          {
-            newRequest.setNewPassword(reader.readOctetString());
-          }
-          reader.readEndSequence();
-        }
-        catch (final IOException e)
-        {
-          final LocalizableMessage message = ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST
-              .get(getExceptionMessage(e));
-          throw DecodeException.error(message, e);
-        }
-      }
-
-      for (final Control control : request.getControls())
-      {
-        newRequest.addControl(control);
-      }
-
-      return newRequest;
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<PasswordModifyExtendedResult>
-  {
-    public PasswordModifyExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      return Responses.newPasswordModifyExtendedResult(resultCode)
-          .setMatchedDN(matchedDN).setDiagnosticMessage(diagnosticMessage);
-    }
-
-
-
-    public PasswordModifyExtendedResult decodeExtendedResult(
-        final ExtendedResult result, final DecodeOptions options)
-        throws DecodeException
-    {
-      if (result instanceof PasswordModifyExtendedResult)
-      {
-        return (PasswordModifyExtendedResult) result;
-      }
-      else
-      {
-        final ResultCode resultCode = result.getResultCode();
-
-        final PasswordModifyExtendedResult newResult = Responses
-            .newPasswordModifyExtendedResult(resultCode).setMatchedDN(
-                result.getMatchedDN()).setDiagnosticMessage(
-                result.getDiagnosticMessage());
-
-        // TODO: Should we check to make sure OID is null?
-        final ByteString responseValue = result.getValue();
-        if (resultCode == ResultCode.SUCCESS && responseValue != null)
-        {
-          try
-          {
-            final ASN1Reader asn1Reader = ASN1.getReader(responseValue);
-            asn1Reader.readStartSequence();
-            if (asn1Reader.peekType() == TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD)
-            {
-              newResult.setGeneratedPassword(asn1Reader.readOctetString());
+final class PasswordModifyExtendedRequestImpl extends
+        AbstractExtendedRequest<PasswordModifyExtendedRequest, PasswordModifyExtendedResult>
+        implements PasswordModifyExtendedRequest {
+    static final class RequestDecoder implements
+            ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> {
+        public PasswordModifyExtendedRequest decodeExtendedRequest(
+                final ExtendedRequest<?> request, final DecodeOptions options)
+                throws DecodeException {
+            final PasswordModifyExtendedRequest newRequest =
+                    new PasswordModifyExtendedRequestImpl();
+            if (request.getValue() != null) {
+                try {
+                    final ASN1Reader reader = ASN1.getReader(request.getValue());
+                    reader.readStartSequence();
+                    if (reader.hasNextElement()
+                            && (reader.peekType() == TYPE_PASSWORD_MODIFY_USER_ID)) {
+                        newRequest.setUserIdentity(reader.readOctetStringAsString());
+                    }
+                    if (reader.hasNextElement()
+                            && (reader.peekType() == TYPE_PASSWORD_MODIFY_OLD_PASSWORD)) {
+                        newRequest.setOldPassword(reader.readOctetString());
+                    }
+                    if (reader.hasNextElement()
+                            && (reader.peekType() == TYPE_PASSWORD_MODIFY_NEW_PASSWORD)) {
+                        newRequest.setNewPassword(reader.readOctetString());
+                    }
+                    reader.readEndSequence();
+                } catch (final IOException e) {
+                    final LocalizableMessage message =
+                            ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST.get(getExceptionMessage(e));
+                    throw DecodeException.error(message, e);
+                }
             }
-            asn1Reader.readEndSequence();
-          }
-          catch (final IOException e)
-          {
-            final LocalizableMessage message = ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST
-                .get(getExceptionMessage(e));
-            throw DecodeException.error(message, e);
-          }
+
+            for (final Control control : request.getControls()) {
+                newRequest.addControl(control);
+            }
+
+            return newRequest;
+        }
+    }
+
+    private static final class ResultDecoder extends
+            AbstractExtendedResultDecoder<PasswordModifyExtendedResult> {
+        public PasswordModifyExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newPasswordModifyExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
         }
 
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+        public PasswordModifyExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            if (result instanceof PasswordModifyExtendedResult) {
+                return (PasswordModifyExtendedResult) result;
+            } else {
+                final ResultCode resultCode = result.getResultCode();
+
+                final PasswordModifyExtendedResult newResult =
+                        Responses.newPasswordModifyExtendedResult(resultCode).setMatchedDN(
+                                result.getMatchedDN()).setDiagnosticMessage(
+                                result.getDiagnosticMessage());
+
+                // TODO: Should we check to make sure OID is null?
+                final ByteString responseValue = result.getValue();
+                if (resultCode == ResultCode.SUCCESS && responseValue != null) {
+                    try {
+                        final ASN1Reader asn1Reader = ASN1.getReader(responseValue);
+                        asn1Reader.readStartSequence();
+                        if (asn1Reader.peekType() == TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD) {
+                            newResult.setGeneratedPassword(asn1Reader.readOctetString());
+                        }
+                        asn1Reader.readEndSequence();
+                    } catch (final IOException e) {
+                        final LocalizableMessage message =
+                                ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST.get(getExceptionMessage(e));
+                        throw DecodeException.error(message, e);
+                    }
+                }
+
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+
+                return newResult;
+            }
+        }
+    }
+
+    /**
+     * The ASN.1 element type that will be used to encode the userIdentity
+     * component in a password modify extended request.
+     */
+    private static final byte TYPE_PASSWORD_MODIFY_USER_ID = (byte) 0x80;
+
+    /**
+     * The ASN.1 element type that will be used to encode the oldPasswd
+     * component in a password modify extended request.
+     */
+    private static final byte TYPE_PASSWORD_MODIFY_OLD_PASSWORD = (byte) 0x81;
+
+    /**
+     * The ASN.1 element type that will be used to encode the newPasswd
+     * component in a password modify extended request.
+     */
+    private static final byte TYPE_PASSWORD_MODIFY_NEW_PASSWORD = (byte) 0x82;
+
+    /**
+     * The ASN.1 element type that will be used to encode the genPasswd
+     * component in a password modify extended response.
+     */
+    private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80;
+
+    private ByteString userIdentity = null;
+
+    private ByteString oldPassword = null;
+
+    private ByteString newPassword = null;
+
+    private static final ExtendedResultDecoder<PasswordModifyExtendedResult> RESULT_DECODER =
+            new ResultDecoder();
+
+    // Instantiation via factory.
+    PasswordModifyExtendedRequestImpl() {
+
+    }
+
+    /**
+     * Creates a new password modify extended request that is an exact copy of
+     * the provided request.
+     *
+     * @param passwordModifyExtendedRequest
+     *            The password modify extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code passwordModifyExtendedRequest} was {@code null} .
+     */
+    PasswordModifyExtendedRequestImpl(
+            final PasswordModifyExtendedRequest passwordModifyExtendedRequest) {
+        super(passwordModifyExtendedRequest);
+        this.userIdentity = passwordModifyExtendedRequest.getUserIdentity();
+        this.oldPassword = passwordModifyExtendedRequest.getOldPassword();
+        this.newPassword = passwordModifyExtendedRequest.getNewPassword();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getNewPassword() {
+        return newPassword;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return OID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getOldPassword() {
+        return oldPassword;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getUserIdentity() {
+        return userIdentity;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getUserIdentityAsString() {
+        return userIdentity != null ? userIdentity.toString() : null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        final ByteStringBuilder buffer = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(buffer);
+
+        try {
+            writer.writeStartSequence();
+            if (userIdentity != null) {
+                writer.writeOctetString(TYPE_PASSWORD_MODIFY_USER_ID, userIdentity);
+            }
+            if (oldPassword != null) {
+                writer.writeOctetString(TYPE_PASSWORD_MODIFY_OLD_PASSWORD, oldPassword);
+            }
+            if (newPassword != null) {
+                writer.writeOctetString(TYPE_PASSWORD_MODIFY_NEW_PASSWORD, newPassword);
+            }
+            writer.writeEndSequence();
+        } catch (final IOException ioe) {
+            // This should never happen unless there is a bug somewhere.
+            throw new RuntimeException(ioe);
         }
 
-        return newResult;
-      }
-    }
-  }
-
-
-
-  /**
-   * The ASN.1 element type that will be used to encode the userIdentity
-   * component in a password modify extended request.
-   */
-  private static final byte TYPE_PASSWORD_MODIFY_USER_ID = (byte) 0x80;
-
-  /**
-   * The ASN.1 element type that will be used to encode the oldPasswd component
-   * in a password modify extended request.
-   */
-  private static final byte TYPE_PASSWORD_MODIFY_OLD_PASSWORD = (byte) 0x81;
-
-  /**
-   * The ASN.1 element type that will be used to encode the newPasswd component
-   * in a password modify extended request.
-   */
-  private static final byte TYPE_PASSWORD_MODIFY_NEW_PASSWORD = (byte) 0x82;
-
-  /**
-   * The ASN.1 element type that will be used to encode the genPasswd component
-   * in a password modify extended response.
-   */
-  private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80;
-
-  private ByteString userIdentity = null;
-
-  private ByteString oldPassword = null;
-
-  private ByteString newPassword = null;
-
-  private static final ExtendedResultDecoder<PasswordModifyExtendedResult>
-    RESULT_DECODER = new ResultDecoder();
-
-
-
-  // Instantiation via factory.
-  PasswordModifyExtendedRequestImpl()
-  {
-
-  }
-
-
-
-  /**
-   * Creates a new password modify extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param passwordModifyExtendedRequest
-   *          The password modify extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code passwordModifyExtendedRequest} was {@code null} .
-   */
-  PasswordModifyExtendedRequestImpl(
-      final PasswordModifyExtendedRequest passwordModifyExtendedRequest)
-  {
-    super(passwordModifyExtendedRequest);
-    this.userIdentity = passwordModifyExtendedRequest.getUserIdentity();
-    this.oldPassword = passwordModifyExtendedRequest.getOldPassword();
-    this.newPassword = passwordModifyExtendedRequest.getNewPassword();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getNewPassword()
-  {
-    return newPassword;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getOldPassword()
-  {
-    return oldPassword;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getUserIdentity()
-  {
-    return userIdentity;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getUserIdentityAsString()
-  {
-    return userIdentity != null ? userIdentity.toString() : null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    final ByteStringBuilder buffer = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(buffer);
-
-    try
-    {
-      writer.writeStartSequence();
-      if (userIdentity != null)
-      {
-        writer.writeOctetString(TYPE_PASSWORD_MODIFY_USER_ID, userIdentity);
-      }
-      if (oldPassword != null)
-      {
-        writer.writeOctetString(TYPE_PASSWORD_MODIFY_OLD_PASSWORD, oldPassword);
-      }
-      if (newPassword != null)
-      {
-        writer.writeOctetString(TYPE_PASSWORD_MODIFY_NEW_PASSWORD, newPassword);
-      }
-      writer.writeEndSequence();
-    }
-    catch (final IOException ioe)
-    {
-      // This should never happen unless there is a bug somewhere.
-      throw new RuntimeException(ioe);
+        return buffer.toByteString();
     }
 
-    return buffer.toByteString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setNewPassword(final ByteString newPassword) {
+        this.newPassword = newPassword;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setNewPassword(final char[] newPassword) {
+        this.newPassword = (newPassword != null) ? ByteString.valueOf(newPassword) : null;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return true;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setOldPassword(final ByteString oldPassword) {
+        this.oldPassword = oldPassword;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setOldPassword(final char[] oldPassword) {
+        this.oldPassword = (oldPassword != null) ? ByteString.valueOf(oldPassword) : null;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setUserIdentity(final ByteString userIdentity) {
+        this.userIdentity = userIdentity;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setNewPassword(
-      final ByteString newPassword)
-  {
-    this.newPassword = newPassword;
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedRequest setUserIdentity(final String userIdentity) {
+        this.userIdentity = (userIdentity != null) ? ByteString.valueOf(userIdentity) : null;
+        return this;
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setNewPassword(final char[] newPassword)
-  {
-    this.newPassword = (newPassword != null) ? ByteString.valueOf(newPassword)
-        : null;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setOldPassword(
-      final ByteString oldPassword)
-  {
-    this.oldPassword = oldPassword;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setOldPassword(final char[] oldPassword)
-  {
-    this.oldPassword = (oldPassword != null) ? ByteString.valueOf(oldPassword)
-        : null;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setUserIdentity(
-      final ByteString userIdentity)
-  {
-    this.userIdentity = userIdentity;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedRequest setUserIdentity(final String userIdentity)
-  {
-    this.userIdentity = (userIdentity != null) ? ByteString
-        .valueOf(userIdentity) : null;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordModifyExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", userIdentity=");
-    builder.append(userIdentity);
-    builder.append(", oldPassword=");
-    builder.append(oldPassword);
-    builder.append(", newPassword=");
-    builder.append(newPassword);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordModifyExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", userIdentity=");
+        builder.append(userIdentity);
+        builder.append(", oldPassword=");
+        builder.append(oldPassword);
+        builder.append(", newPassword=");
+        builder.append(newPassword);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java
index acd9f1c..334bd36 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,15 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ErrorResultException;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Plain SASL bind request as defined in RFC 4616. This SASL mechanism
  * allows a client to authenticate to the server with an authentication ID and
@@ -54,182 +49,158 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface PlainSASLBindRequest extends SASLBindRequest
-{
+public interface PlainSASLBindRequest extends SASLBindRequest {
 
-  /**
-   * The name of the SASL mechanism based on PLAIN authentication.
-   */
-  public static final String SASL_MECHANISM_NAME = "PLAIN";
+    /**
+     * The name of the SASL mechanism based on PLAIN authentication.
+     */
+    public static final String SASL_MECHANISM_NAME = "PLAIN";
 
+    /**
+     * {@inheritDoc}
+     */
+    PlainSASLBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
-  /**
-   * {@inheritDoc}
-   */
-  PlainSASLBindRequest addControl(Control control);
+    /**
+     * Returns the authentication ID of the user. The authentication ID usually
+     * has the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authentication ID of the user.
+     */
+    String getAuthenticationID();
 
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
+    /**
+     * Returns the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authorization ID of the user, which may be {@code null}.
+     */
+    String getAuthorizationID();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
-  /**
-   * Returns the authentication ID of the user. The authentication ID usually
-   * has the form "dn:" immediately followed by the distinguished name of the
-   * user, or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authentication ID of the user.
-   */
-  String getAuthenticationID();
+    /**
+     * Returns the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @return The password of the user that the client wishes to bind as.
+     */
+    byte[] getPassword();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getSASLMechanism();
 
+    /**
+     * Sets the authentication ID of the user. The authentication ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the authentication ID to
+     *             be set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authenticationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws NullPointerException
+     *             If {@code authenticationID} was {@code null}.
+     */
+    PlainSASLBindRequest setAuthenticationID(String authenticationID);
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
+    /**
+     * Sets the optional authorization ID of the user which represents an
+     * alternate authorization identity which should be used for subsequent
+     * operations performed on the connection. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authorizationID
+     *            The authorization ID of the user, which may be {@code null}.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the authorization ID to
+     *             be set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     */
+    PlainSASLBindRequest setAuthorizationID(String authorizationID);
 
+    /**
+     * Sets the password of the user that the client wishes to bind as.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * provided password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as,
+     *            which may be empty.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    PlainSASLBindRequest setPassword(byte[] password);
 
-
-  /**
-   * Returns the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user, which may be {@code null}.
-   */
-  String getAuthorizationID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
-
-
-
-  /**
-   * Returns the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @return The password of the user that the client wishes to bind as.
-   */
-  byte[] getPassword();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getSASLMechanism();
-
-
-
-  /**
-   * Sets the authentication ID of the user. The authentication ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the authentication ID to be
-   *           set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authenticationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws NullPointerException
-   *           If {@code authenticationID} was {@code null}.
-   */
-  PlainSASLBindRequest setAuthenticationID(String authenticationID);
-
-
-
-  /**
-   * Sets the optional authorization ID of the user which represents an
-   * alternate authorization identity which should be used for subsequent
-   * operations performed on the connection. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The authorization ID of the user, which may be {@code null}.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the authorization ID to be
-   *           set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   */
-  PlainSASLBindRequest setAuthorizationID(String authorizationID);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * provided password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as, which
-   *          may be empty.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  PlainSASLBindRequest setPassword(byte[] password);
-
-
-
-  /**
-   * Sets the password of the user that the client wishes to bind as. The
-   * password will be converted to a UTF-8 octet string.
-   *
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the password to be set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  PlainSASLBindRequest setPassword(char[] password);
+    /**
+     * Sets the password of the user that the client wishes to bind as. The
+     * password will be converted to a UTF-8 octet string.
+     *
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the password to be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    PlainSASLBindRequest setPassword(char[] password);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java
index 433d37e..b552909 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import javax.security.auth.callback.NameCallback;
@@ -47,229 +44,157 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Plain SASL bind request implementation.
  */
-final class PlainSASLBindRequestImpl extends
-    AbstractSASLBindRequest<PlainSASLBindRequest> implements
-    PlainSASLBindRequest
-{
-  private final static class Client extends SASLBindClientImpl
-  {
-    private final SaslClient saslClient;
-    private final String authenticationID;
-    private final ByteString password;
+final class PlainSASLBindRequestImpl extends AbstractSASLBindRequest<PlainSASLBindRequest>
+        implements PlainSASLBindRequest {
+    private final static class Client extends SASLBindClientImpl {
+        private final SaslClient saslClient;
+        private final String authenticationID;
+        private final ByteString password;
 
+        private Client(final PlainSASLBindRequestImpl initialBindRequest, final String serverName)
+                throws ErrorResultException {
+            super(initialBindRequest);
 
+            this.authenticationID = initialBindRequest.getAuthenticationID();
+            this.password = ByteString.wrap(initialBindRequest.getPassword());
 
-    private Client(final PlainSASLBindRequestImpl initialBindRequest,
-        final String serverName) throws ErrorResultException
-    {
-      super(initialBindRequest);
+            try {
+                saslClient =
+                        Sasl.createSaslClient(new String[] { SASL_MECHANISM_NAME },
+                                initialBindRequest.getAuthorizationID(), SASL_DEFAULT_PROTOCOL,
+                                serverName, null, this);
 
-      this.authenticationID = initialBindRequest.getAuthenticationID();
-      this.password = ByteString.wrap(initialBindRequest.getPassword());
-
-      try
-      {
-        saslClient = Sasl.createSaslClient(
-            new String[] { SASL_MECHANISM_NAME }, initialBindRequest
-                .getAuthorizationID(), SASL_DEFAULT_PROTOCOL, serverName, null,
-            this);
-
-        if (saslClient.hasInitialResponse())
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+                if (saslClient.hasInitialResponse()) {
+                    setNextSASLCredentials(saslClient.evaluateChallenge(new byte[0]));
+                } else {
+                    setNextSASLCredentials((ByteString) null);
+                }
+            } catch (final SaslException e) {
+                throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
+            }
         }
-        else
-        {
-          setNextSASLCredentials((ByteString) null);
+
+        @Override
+        public void dispose() {
+            try {
+                saslClient.dispose();
+            } catch (final SaslException ignored) {
+                // Ignore the SASL exception.
+            }
         }
-      }
-      catch (final SaslException e)
-      {
-        throw newErrorResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR, e);
-      }
+
+        @Override
+        public boolean evaluateResult(final BindResult result) {
+            return saslClient.isComplete();
+        }
+
+        @Override
+        void handle(final NameCallback callback) throws UnsupportedCallbackException {
+            callback.setName(authenticationID);
+        }
+
+        @Override
+        void handle(final PasswordCallback callback) throws UnsupportedCallbackException {
+            callback.setPassword(password.toString().toCharArray());
+        }
     }
 
+    private String authenticationID;
+    private String authorizationID;
 
+    private byte[] password;
+
+    PlainSASLBindRequestImpl(final String authenticationID, final byte[] password) {
+        Validator.ensureNotNull(authenticationID, password);
+        this.authenticationID = authenticationID;
+        this.password = password;
+    }
+
+    /**
+     * Creates a new plain SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param plainSASLBindRequest
+     *            The plain SASL bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code plainSASLBindRequest} was {@code null} .
+     */
+    PlainSASLBindRequestImpl(final PlainSASLBindRequest plainSASLBindRequest) {
+        super(plainSASLBindRequest);
+        this.authenticationID = plainSASLBindRequest.getAuthenticationID();
+        this.authorizationID = plainSASLBindRequest.getAuthorizationID();
+        this.password = StaticUtils.copyOfBytes(plainSASLBindRequest.getPassword());
+    }
+
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new Client(this, serverName);
+    }
+
+    public String getAuthenticationID() {
+        return authenticationID;
+    }
+
+    public String getAuthorizationID() {
+        return authorizationID;
+    }
+
+    public byte[] getPassword() {
+        return password;
+    }
+
+    public String getSASLMechanism() {
+        return SASL_MECHANISM_NAME;
+    }
+
+    public PlainSASLBindRequest setAuthenticationID(final String authenticationID) {
+        Validator.ensureNotNull(authenticationID);
+        this.authenticationID = authenticationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PlainSASLBindRequest setAuthorizationID(final String authorizationID) {
+        this.authorizationID = authorizationID;
+        return this;
+    }
+
+    public PlainSASLBindRequest setPassword(final byte[] password) {
+        Validator.ensureNotNull(password);
+        this.password = password;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PlainSASLBindRequest setPassword(final char[] password) {
+        Validator.ensureNotNull(password);
+        this.password = StaticUtils.getBytes(password);
+        return this;
+    }
 
     @Override
-    public void dispose()
-    {
-      try
-      {
-        saslClient.dispose();
-      }
-      catch (final SaslException ignored)
-      {
-        // Ignore the SASL exception.
-      }
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PlainSASLBindRequest(bindDN=");
+        builder.append(getName());
+        builder.append(", authentication=SASL");
+        builder.append(", saslMechanism=");
+        builder.append(getSASLMechanism());
+        builder.append(", authenticationID=");
+        builder.append(authenticationID);
+        builder.append(", authorizationID=");
+        builder.append(authorizationID);
+        builder.append(", password=");
+        builder.append(ByteString.wrap(password));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
     }
-
-
-
-    @Override
-    public boolean evaluateResult(final BindResult result)
-    {
-      return saslClient.isComplete();
-    }
-
-
-
-    @Override
-    void handle(final NameCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setName(authenticationID);
-    }
-
-
-
-    @Override
-    void handle(final PasswordCallback callback)
-        throws UnsupportedCallbackException
-    {
-      callback.setPassword(password.toString().toCharArray());
-    }
-  }
-
-
-
-  private String authenticationID;
-  private String authorizationID;
-
-  private byte[] password;
-
-
-
-  PlainSASLBindRequestImpl(final String authenticationID,
-      final byte[] password)
-  {
-    Validator.ensureNotNull(authenticationID, password);
-    this.authenticationID = authenticationID;
-    this.password = password;
-  }
-
-
-
-  /**
-   * Creates a new plain SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param plainSASLBindRequest
-   *          The plain SASL bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code plainSASLBindRequest} was {@code null} .
-   */
-  PlainSASLBindRequestImpl(
-      final PlainSASLBindRequest plainSASLBindRequest)
-  {
-    super(plainSASLBindRequest);
-    this.authenticationID = plainSASLBindRequest.getAuthenticationID();
-    this.authorizationID = plainSASLBindRequest.getAuthorizationID();
-    this.password = StaticUtils.copyOfBytes(plainSASLBindRequest.getPassword());
-  }
-
-
-
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new Client(this, serverName);
-  }
-
-
-
-  public String getAuthenticationID()
-  {
-    return authenticationID;
-  }
-
-
-
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  public byte[] getPassword()
-  {
-    return password;
-  }
-
-
-
-  public String getSASLMechanism()
-  {
-    return SASL_MECHANISM_NAME;
-  }
-
-
-
-  public PlainSASLBindRequest setAuthenticationID(final String authenticationID)
-  {
-    Validator.ensureNotNull(authenticationID);
-    this.authenticationID = authenticationID;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PlainSASLBindRequest setAuthorizationID(final String authorizationID)
-  {
-    this.authorizationID = authorizationID;
-    return this;
-  }
-
-
-
-  public PlainSASLBindRequest setPassword(final byte[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PlainSASLBindRequest setPassword(final char[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = StaticUtils.getBytes(password);
-    return this;
-  }
-
-
-
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PlainSASLBindRequest(bindDN=");
-    builder.append(getName());
-    builder.append(", authentication=SASL");
-    builder.append(", saslMechanism=");
-    builder.append(getSASLMechanism());
-    builder.append(", authenticationID=");
-    builder.append(authenticationID);
-    builder.append(", authorizationID=");
-    builder.append(authorizationID);
-    builder.append(", password=");
-    builder.append(ByteString.wrap(password));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Request.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Request.java
index 048f6ee..668f552 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Request.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Request.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,61 +34,55 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The base class of all Requests provides methods for querying and manipulating
  * the set of Controls included with a Request.
  */
-public interface Request
-{
+public interface Request {
 
-  /**
-   * Adds the provided control to this request.
-   *
-   * @param control
-   *          The control to be added to this request.
-   * @return This request.
-   * @throws UnsupportedOperationException
-   *           If this request does not permit controls to be added.
-   * @throws NullPointerException
-   *           If {@code control} was {@code null}.
-   */
-  Request addControl(Control control);
+    /**
+     * Adds the provided control to this request.
+     *
+     * @param control
+     *            The control to be added to this request.
+     * @return This request.
+     * @throws UnsupportedOperationException
+     *             If this request does not permit controls to be added.
+     * @throws NullPointerException
+     *             If {@code control} was {@code null}.
+     */
+    Request addControl(Control control);
 
+    /**
+     * Decodes and returns the first control in this request having an OID
+     * corresponding to the provided control decoder.
+     *
+     * @param <C>
+     *            The type of control to be decoded and returned.
+     * @param decoder
+     *            The control decoder.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the control.
+     * @return The decoded control, or {@code null} if the control is not
+     *         included with this request.
+     * @throws DecodeException
+     *             If the control could not be decoded because it was malformed
+     *             in some way (e.g. the control value was missing, or its
+     *             content could not be decoded).
+     * @throws NullPointerException
+     *             If {@code decoder} or {@code options} was {@code null}.
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-
-  /**
-   * Decodes and returns the first control in this request having an OID
-   * corresponding to the provided control decoder.
-   *
-   * @param <C>
-   *          The type of control to be decoded and returned.
-   * @param decoder
-   *          The control decoder.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          control.
-   * @return The decoded control, or {@code null} if the control is not included
-   *         with this request.
-   * @throws DecodeException
-   *           If the control could not be decoded because it was malformed in
-   *           some way (e.g. the control value was missing, or its content
-   *           could not be decoded).
-   * @throws NullPointerException
-   *           If {@code decoder} or {@code options} was {@code null}.
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * Returns a {@code List} containing the controls included with this request.
-   * The returned {@code List} may be modified if permitted by this request.
-   *
-   * @return A {@code List} containing the controls.
-   */
-  List<Control> getControls();
+    /**
+     * Returns a {@code List} containing the controls included with this
+     * request. The returned {@code List} may be modified if permitted by this
+     * request.
+     *
+     * @return A {@code List} containing the controls.
+     */
+    List<Control> getControls();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
index b9cdf9e..6d8aa97 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_READ_LDIF_RECORD_CHANGE_RECORD_WRONG_TYPE;
@@ -39,14 +36,21 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entries;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RDN;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldif.ChangeRecord;
 import org.forgerock.opendj.ldif.LDIFChangeRecordReader;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains various methods for creating and manipulating requests.
  * <p>
@@ -60,1769 +64,1479 @@
  * request parameter. More specifically, any controls, modifications, and
  * attributes contained within the returned request will be unmodifiable.
  */
-public final class Requests
-{
+public final class Requests {
 
-  // TODO: search request from LDAP URL.
+    // TODO: search request from LDAP URL.
 
-  // TODO: update request from persistent search result.
+    // TODO: update request from persistent search result.
 
-  // TODO: synchronized requests?
+    // TODO: synchronized requests?
 
-  /**
-   * Creates a new abandon request using the provided message ID.
-   *
-   * @param requestID
-   *          The request ID of the request to be abandoned.
-   * @return The new abandon request.
-   */
-  public static AbandonRequest newAbandonRequest(final int requestID)
-  {
-    return new AbandonRequestImpl(requestID);
-  }
-
-
-
-  /**
-   * Creates a new add request using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry to be added.
-   * @return The new add request.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static AddRequest newAddRequest(final DN name)
-  {
-    final Entry entry = new LinkedHashMapEntry().setName(name);
-    return new AddRequestImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new add request backed by the provided entry. Modifications made
-   * to {@code entry} will be reflected in the returned add request. The
-   * returned add request supports updates to its list of controls, as well as
-   * updates to the name and attributes if the underlying entry allows.
-   *
-   * @param entry
-   *          The entry to be added.
-   * @return The new add request.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  public static AddRequest newAddRequest(final Entry entry)
-  {
-    Validator.ensureNotNull(entry);
-    return new AddRequestImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new add request using the provided distinguished name decoded
-   * using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the entry to be added.
-   * @return The new add request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static AddRequest newAddRequest(final String name)
-  {
-    final Entry entry = new LinkedHashMapEntry().setName(name);
-    return new AddRequestImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new add request using the provided lines of LDIF decoded using
-   * the default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing an LDIF add change record or an LDIF
-   *          entry record.
-   * @return The new add request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public static AddRequest newAddRequest(final String... ldifLines)
-  {
-    // LDIF change record reader is tolerant to missing change types.
-    final ChangeRecord record = LDIFChangeRecordReader
-        .valueOfLDIFChangeRecord(ldifLines);
-
-    if (record instanceof AddRequest)
-    {
-      return (AddRequest) record;
+    /**
+     * Creates a new abandon request using the provided message ID.
+     *
+     * @param requestID
+     *            The request ID of the request to be abandoned.
+     * @return The new abandon request.
+     */
+    public static AbandonRequest newAbandonRequest(final int requestID) {
+        return new AbandonRequestImpl(requestID);
     }
-    else
-    {
-      // Wrong change type.
-      final LocalizableMessage message = WARN_READ_LDIF_RECORD_CHANGE_RECORD_WRONG_TYPE
-          .get("add");
-      throw new LocalizedIllegalArgumentException(message);
+
+    /**
+     * Creates a new add request using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry to be added.
+     * @return The new add request.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static AddRequest newAddRequest(final DN name) {
+        final Entry entry = new LinkedHashMapEntry().setName(name);
+        return new AddRequestImpl(entry);
     }
-  }
 
-
-
-  /**
-   * Creates a new anonymous SASL bind request having the provided trace string.
-   *
-   * @param traceString
-   *          The trace information, which has no semantic value, and can be
-   *          used by administrators in order to identify the user.
-   * @return The new anonymous SASL bind request.
-   * @throws NullPointerException
-   *           If {@code traceString} was {@code null}.
-   */
-  public static AnonymousSASLBindRequest newAnonymousSASLBindRequest(
-      final String traceString)
-  {
-    return new AnonymousSASLBindRequestImpl(traceString);
-  }
-
-
-
-  /**
-   * Creates a new cancel extended request using the provided message ID.
-   *
-   * @param requestID
-   *          The request ID of the request to be abandoned.
-   * @return The new cancel extended request.
-   */
-  public static CancelExtendedRequest newCancelExtendedRequest(
-      final int requestID)
-  {
-    return new CancelExtendedRequestImpl(requestID);
-  }
-
-
-
-  /**
-   * Creates a new change record (an add, delete, modify, or modify DN request)
-   * using the provided lines of LDIF decoded using the default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing an LDIF change record or an LDIF entry
-   *          record.
-   * @return The new change record.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public static ChangeRecord newChangeRecord(final String... ldifLines)
-  {
-    // LDIF change record reader is tolerant to missing change types.
-    return LDIFChangeRecordReader.valueOfLDIFChangeRecord(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new compare request using the provided distinguished name,
-   * attribute name, and assertion value.
-   *
-   * @param name
-   *          The distinguished name of the entry to be compared.
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @param assertionValue
-   *          The assertion value to be compared.
-   * @return The new compare request.
-   * @throws NullPointerException
-   *           If {@code name}, {@code attributeDescription}, or
-   *           {@code assertionValue} was {@code null}.
-   */
-  public static CompareRequest newCompareRequest(final DN name,
-      final AttributeDescription attributeDescription,
-      final ByteString assertionValue)
-  {
-    Validator.ensureNotNull(name, attributeDescription, assertionValue);
-    return new CompareRequestImpl(name, attributeDescription, assertionValue);
-  }
-
-
-
-  /**
-   * Creates a new compare request using the provided distinguished name,
-   * attribute name, and assertion value decoded using the default schema.
-   * <p>
-   * If the assertion value is not an instance of {@code ByteString} then it
-   * will be converted using the {@link ByteString#valueOf(Object)} method.
-   *
-   * @param name
-   *          The distinguished name of the entry to be compared.
-   * @param attributeDescription
-   *          The name of the attribute to be compared.
-   * @param assertionValue
-   *          The assertion value to be compared.
-   * @return The new compare request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} or {@code attributeDescription} could not be
-   *           decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name}, {@code attributeDescription}, or
-   *           {@code assertionValue} was {@code null}.
-   */
-  public static CompareRequest newCompareRequest(final String name,
-      final String attributeDescription, final Object assertionValue)
-  {
-    Validator.ensureNotNull(name, attributeDescription, assertionValue);
-    return new CompareRequestImpl(DN.valueOf(name),
-        AttributeDescription.valueOf(attributeDescription),
-        ByteString.valueOf(assertionValue));
-  }
-
-
-
-  /**
-   * Creates a new CRAM-MD5 SASL bind request having the provided authentication
-   * ID and password.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return The new CRAM-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static CRAMMD5SASLBindRequest newCRAMMD5SASLBindRequest(
-      final String authenticationID, final byte[] password)
-  {
-    return new CRAMMD5SASLBindRequestImpl(authenticationID, password);
-  }
-
-
-
-  /**
-   * Creates a new CRAM-MD5 SASL bind request having the provided authentication
-   * ID and password.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as. The
-   *          password will be converted to a UTF-8 octet string.
-   * @return The new CRAM-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static CRAMMD5SASLBindRequest newCRAMMD5SASLBindRequest(
-      final String authenticationID, final char[] password)
-  {
-    return new CRAMMD5SASLBindRequestImpl(authenticationID, getBytes(password));
-  }
-
-
-
-  /**
-   * Creates a new delete request using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry to be deleted.
-   * @return The new delete request.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static DeleteRequest newDeleteRequest(final DN name)
-  {
-    Validator.ensureNotNull(name);
-    return new DeleteRequestImpl(name);
-  }
-
-
-
-  /**
-   * Creates a new delete request using the provided distinguished name decoded
-   * using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the entry to be deleted.
-   * @return The new delete request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static DeleteRequest newDeleteRequest(final String name)
-  {
-    Validator.ensureNotNull(name);
-    return new DeleteRequestImpl(DN.valueOf(name));
-  }
-
-
-
-  /**
-   * Creates a new DIGEST-MD5 SASL bind request having the provided
-   * authentication ID and password, but no realm or authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return The new DIGEST-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static DigestMD5SASLBindRequest newDigestMD5SASLBindRequest(
-      final String authenticationID, final byte[] password)
-  {
-    return new DigestMD5SASLBindRequestImpl(authenticationID, password);
-  }
-
-
-
-  /**
-   * Creates a new DIGEST-MD5 SASL bind request having the provided
-   * authentication ID and password, but no realm or authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as. The
-   *          password will be converted to a UTF-8 octet string.
-   * @return The new DIGEST-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static DigestMD5SASLBindRequest newDigestMD5SASLBindRequest(
-      final String authenticationID, final char[] password)
-  {
-    return new DigestMD5SASLBindRequestImpl(authenticationID,
-        getBytes(password));
-  }
-
-
-
-  /**
-   * Creates a new External SASL bind request with no authorization ID.
-   *
-   * @return The new External SASL bind request.
-   */
-  public static ExternalSASLBindRequest newExternalSASLBindRequest()
-  {
-    return new ExternalSASLBindRequestImpl();
-  }
-
-
-
-  /**
-   * Creates a new generic bind request using an empty distinguished name,
-   * authentication type, and authentication information.
-   *
-   * @param authenticationType
-   *          The authentication mechanism identifier for this generic bind
-   *          request.
-   * @param authenticationValue
-   *          The authentication information for this generic bind request in a
-   *          form defined by the authentication mechanism.
-   * @return The new generic bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationValue} was {@code null}.
-   */
-  public static GenericBindRequest newGenericBindRequest(
-      final byte authenticationType, final byte[] authenticationValue)
-  {
-    Validator.ensureNotNull(authenticationValue);
-    return new GenericBindRequestImpl("", authenticationType,
-        authenticationValue);
-  }
-
-
-
-  /**
-   * Creates a new generic bind request using the provided name, authentication
-   * type, and authentication information.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind as
-   *          (may be empty).
-   * @param authenticationType
-   *          The authentication mechanism identifier for this generic bind
-   *          request.
-   * @param authenticationValue
-   *          The authentication information for this generic bind request in a
-   *          form defined by the authentication mechanism.
-   * @return The new generic bind request.
-   * @throws NullPointerException
-   *           If {@code name} or {@code authenticationValue} was {@code null}.
-   */
-  public static GenericBindRequest newGenericBindRequest(final String name,
-      final byte authenticationType, final byte[] authenticationValue)
-  {
-    Validator.ensureNotNull(name, authenticationValue);
-    return new GenericBindRequestImpl(name, authenticationType,
-        authenticationValue);
-  }
-
-
-
-  /**
-   * Creates a new generic extended request using the provided name and no
-   * value.
-   *
-   * @param requestName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to this extended request.
-   * @return The new generic extended request.
-   * @throws NullPointerException
-   *           If {@code requestName} was {@code null}.
-   */
-  public static GenericExtendedRequest newGenericExtendedRequest(
-      final String requestName)
-  {
-    Validator.ensureNotNull(requestName);
-    return new GenericExtendedRequestImpl(requestName, null);
-  }
-
-
-
-  /**
-   * Creates a new generic extended request using the provided name and optional
-   * value.
-   *
-   * @param requestName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to this extended request.
-   * @param requestValue
-   *          The content of this generic extended request in a form defined by
-   *          the extended operation, or {@code null} if there is no content.
-   * @return The new generic extended request.
-   * @throws NullPointerException
-   *           If {@code requestName} was {@code null}.
-   */
-  public static GenericExtendedRequest newGenericExtendedRequest(
-      final String requestName, final ByteString requestValue)
-  {
-    Validator.ensureNotNull(requestName);
-    return new GenericExtendedRequestImpl(requestName, requestValue);
-  }
-
-
-
-  /**
-   * Creates a new GSSAPI SASL bind request having the provided authentication
-   * ID and password, but no realm, KDC address, or authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return The new GSSAPI SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(
-      final String authenticationID, final byte[] password)
-  {
-    return new GSSAPISASLBindRequestImpl(authenticationID, password);
-  }
-
-
-
-  /**
-   * Creates a new GSSAPI SASL bind request having the provided authentication
-   * ID and password, but no realm, KDC address, or authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as. The
-   *          password will be converted to a UTF-8 octet string.
-   * @return The new GSSAPI SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(
-      final String authenticationID, final char[] password)
-  {
-    return new GSSAPISASLBindRequestImpl(authenticationID, getBytes(password));
-  }
-
-
-
-  /**
-   * Creates a new GSSAPI SASL bind request having the provided subject, but no
-   * authorization ID.
-   *
-   * @param subject
-   *          The Kerberos subject of the user to be authenticated.
-   * @return The new GSSAPI SASL bind request.
-   * @throws NullPointerException
-   *           If {@code subject} was {@code null}.
-   */
-  public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(
-      final Subject subject)
-  {
-    return new GSSAPISASLBindRequestImpl(subject);
-  }
-
-
-
-  /**
-   * Creates a new modify DN request using the provided distinguished name and
-   * new RDN.
-   *
-   * @param name
-   *          The distinguished name of the entry to be renamed.
-   * @param newRDN
-   *          The new RDN of the entry.
-   * @return The new modify DN request.
-   * @throws NullPointerException
-   *           If {@code name} or {@code newRDN} was {@code null}.
-   */
-  public static ModifyDNRequest newModifyDNRequest(final DN name,
-      final RDN newRDN)
-  {
-    Validator.ensureNotNull(name, newRDN);
-    return new ModifyDNRequestImpl(name, newRDN);
-  }
-
-
-
-  /**
-   * Creates a new modify DN request using the provided distinguished name and
-   * new RDN decoded using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the entry to be renamed.
-   * @param newRDN
-   *          The new RDN of the entry.
-   * @return The new modify DN request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} or {@code newRDN} could not be decoded using the
-   *           default schema.
-   * @throws NullPointerException
-   *           If {@code name} or {@code newRDN} was {@code null}.
-   */
-  public static ModifyDNRequest newModifyDNRequest(final String name,
-      final String newRDN)
-  {
-    Validator.ensureNotNull(name, newRDN);
-    return new ModifyDNRequestImpl(DN.valueOf(name), RDN.valueOf(newRDN));
-  }
-
-
-
-  /**
-   * Creates a new modify request using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry to be modified.
-   * @return The new modify request.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static ModifyRequest newModifyRequest(final DN name)
-  {
-    Validator.ensureNotNull(name);
-    return new ModifyRequestImpl(name);
-  }
-
-
-
-  /**
-   * Creates a new modify request containing a list of modifications which can
-   * be used to transform {@code fromEntry} into entry {@code toEntry}.
-   * <p>
-   * The modify request is reversible: it will contain only modifications of
-   * type {@link ModificationType#ADD ADD} and {@link ModificationType#DELETE
-   * DELETE}.
-   * <p>
-   * Finally, the modify request will use the distinguished name taken from
-   * {@code fromEntry}. Moreover, this method will not check to see if both
-   * {@code fromEntry} and {@code toEntry} have the same distinguished name.
-   * <p>
-   * This method is equivalent to:
-   *
-   * <pre>
-   * ModifyRequest request = Entries.diffEntries(fromEntry, toEntry);
-   * </pre>
-   *
-   * @param fromEntry
-   *          The source entry.
-   * @param toEntry
-   *          The destination entry.
-   * @return A modify request containing a list of modifications which can be
-   *         used to transform {@code fromEntry} into entry {@code toEntry}.
-   * @throws NullPointerException
-   *           If {@code fromEntry} or {@code toEntry} were {@code null}.
-   * @see Entries#diffEntries(Entry, Entry)
-   */
-  public static final ModifyRequest newModifyRequest(Entry fromEntry,
-      Entry toEntry)
-  {
-    return Entries.diffEntries(fromEntry, toEntry);
-  }
-
-
-
-  /**
-   * Creates a new modify request using the provided distinguished name decoded
-   * using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the entry to be modified.
-   * @return The new modify request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static ModifyRequest newModifyRequest(final String name)
-  {
-    Validator.ensureNotNull(name);
-    return new ModifyRequestImpl(DN.valueOf(name));
-  }
-
-
-
-  /**
-   * Creates a new modify request using the provided lines of LDIF decoded using
-   * the default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing a single LDIF modify change record.
-   * @return The new modify request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public static ModifyRequest newModifyRequest(final String... ldifLines)
-  {
-    // LDIF change record reader is tolerant to missing change types.
-    final ChangeRecord record = LDIFChangeRecordReader
-        .valueOfLDIFChangeRecord(ldifLines);
-
-    if (record instanceof ModifyRequest)
-    {
-      return (ModifyRequest) record;
+    /**
+     * Creates a new add request backed by the provided entry. Modifications
+     * made to {@code entry} will be reflected in the returned add request. The
+     * returned add request supports updates to its list of controls, as well as
+     * updates to the name and attributes if the underlying entry allows.
+     *
+     * @param entry
+     *            The entry to be added.
+     * @return The new add request.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    public static AddRequest newAddRequest(final Entry entry) {
+        Validator.ensureNotNull(entry);
+        return new AddRequestImpl(entry);
     }
-    else
-    {
-      // Wrong change type.
-      final LocalizableMessage message = WARN_READ_LDIF_RECORD_CHANGE_RECORD_WRONG_TYPE
-          .get("modify");
-      throw new LocalizedIllegalArgumentException(message);
+
+    /**
+     * Creates a new add request using the provided distinguished name decoded
+     * using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the entry to be added.
+     * @return The new add request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static AddRequest newAddRequest(final String name) {
+        final Entry entry = new LinkedHashMapEntry().setName(name);
+        return new AddRequestImpl(entry);
     }
-  }
 
+    /**
+     * Creates a new add request using the provided lines of LDIF decoded using
+     * the default schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing an LDIF add change record or an LDIF
+     *            entry record.
+     * @return The new add request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public static AddRequest newAddRequest(final String... ldifLines) {
+        // LDIF change record reader is tolerant to missing change types.
+        final ChangeRecord record = LDIFChangeRecordReader.valueOfLDIFChangeRecord(ldifLines);
 
-
-  /**
-   * Creates a new password modify extended request, with no user identity, old
-   * password, or new password.
-   *
-   * @return The new password modify extended request.
-   */
-  public static PasswordModifyExtendedRequest newPasswordModifyExtendedRequest()
-  {
-    return new PasswordModifyExtendedRequestImpl();
-  }
-
-
-
-  /**
-   * Creates a new Plain SASL bind request having the provided authentication ID
-   * and password, but no authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as.
-   * @return The new Plain SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static PlainSASLBindRequest newPlainSASLBindRequest(
-      final String authenticationID, final byte[] password)
-  {
-    return new PlainSASLBindRequestImpl(authenticationID, password);
-  }
-
-
-
-  /**
-   * Creates a new Plain SASL bind request having the provided authentication ID
-   * and password, but no authorization ID.
-   *
-   * @param authenticationID
-   *          The authentication ID of the user. The authentication ID usually
-   *          has the form "dn:" immediately followed by the distinguished name
-   *          of the user, or "u:" followed by a user ID string, but other forms
-   *          are permitted.
-   * @param password
-   *          The password of the user that the client wishes to bind as. The
-   *          password will be converted to a UTF-8 octet string.
-   * @return The new Plain SASL bind request.
-   * @throws NullPointerException
-   *           If {@code authenticationID} or {@code password} was {@code null}.
-   */
-  public static PlainSASLBindRequest newPlainSASLBindRequest(
-      final String authenticationID, final char[] password)
-  {
-    return new PlainSASLBindRequestImpl(authenticationID, getBytes(password));
-  }
-
-
-
-  /**
-   * Creates a new search request using the provided distinguished name, scope,
-   * and filter, decoded using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @param scope
-   *          The scope of the search.
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with each entry.
-   * @return The new search request.
-   * @throws NullPointerException
-   *           If the {@code name}, {@code scope}, or {@code filter} were
-   *           {@code null}.
-   */
-  public static SearchRequest newSearchRequest(final DN name,
-      final SearchScope scope, final Filter filter,
-      final String... attributeDescriptions)
-  {
-    Validator.ensureNotNull(name, scope, filter);
-    final SearchRequest request = new SearchRequestImpl(name, scope, filter);
-    for (final String attributeDescription : attributeDescriptions)
-    {
-      request.addAttribute(attributeDescription);
+        if (record instanceof AddRequest) {
+            return (AddRequest) record;
+        } else {
+            // Wrong change type.
+            final LocalizableMessage message =
+                    WARN_READ_LDIF_RECORD_CHANGE_RECORD_WRONG_TYPE.get("add");
+            throw new LocalizedIllegalArgumentException(message);
+        }
     }
-    return request;
-  }
 
-
-
-  /**
-   * Creates a new search request using the provided distinguished name, scope,
-   * and filter, decoded using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @param scope
-   *          The scope of the search.
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @param attributeDescriptions
-   *          The names of the attributes to be included with each entry.
-   * @return The new search request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema, or
-   *           if {@code filter} is not a valid LDAP string representation of a
-   *           filter.
-   * @throws NullPointerException
-   *           If the {@code name}, {@code scope}, or {@code filter} were
-   *           {@code null}.
-   */
-  public static SearchRequest newSearchRequest(final String name,
-      final SearchScope scope, final String filter,
-      final String... attributeDescriptions)
-  {
-    Validator.ensureNotNull(name, scope, filter);
-    final SearchRequest request = new SearchRequestImpl(DN.valueOf(name),
-        scope, Filter.valueOf(filter));
-    for (final String attributeDescription : attributeDescriptions)
-    {
-      request.addAttribute(attributeDescription);
+    /**
+     * Creates a new anonymous SASL bind request having the provided trace
+     * string.
+     *
+     * @param traceString
+     *            The trace information, which has no semantic value, and can be
+     *            used by administrators in order to identify the user.
+     * @return The new anonymous SASL bind request.
+     * @throws NullPointerException
+     *             If {@code traceString} was {@code null}.
+     */
+    public static AnonymousSASLBindRequest newAnonymousSASLBindRequest(final String traceString) {
+        return new AnonymousSASLBindRequestImpl(traceString);
     }
-    return request;
-  }
 
-
-
-  /**
-   * Creates a new simple bind request having an empty name and password
-   * suitable for anonymous authentication.
-   *
-   * @return The new simple bind request.
-   */
-  public static SimpleBindRequest newSimpleBindRequest()
-  {
-    return new SimpleBindRequestImpl("", EMPTY_BYTES);
-  }
-
-
-
-  /**
-   * Creates a new simple bind request having the provided name and password
-   * suitable for name/password authentication. The name will be decoded using
-   * the default schema.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind
-   *          as, which may be empty.
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty indicating that an unauthenticated
-   *          bind is to be performed.
-   * @return The new simple bind request.
-   * @throws NullPointerException
-   *           If {@code name} or {@code password} was {@code null}.
-   */
-  public static SimpleBindRequest newSimpleBindRequest(final String name,
-      final byte[] password)
-  {
-    Validator.ensureNotNull(name, password);
-    return new SimpleBindRequestImpl(name, password);
-  }
-
-
-
-  /**
-   * Creates a new simple bind request having the provided name and password
-   * suitable for name/password authentication. The name will be decoded using
-   * the default schema.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind
-   *          as, which may be empty.
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty indicating that an unauthenticated
-   *          bind is to be performed. The password will be converted to a UTF-8
-   *          octet string.
-   * @return The new simple bind request.
-   * @throws NullPointerException
-   *           If {@code name} or {@code password} was {@code null}.
-   */
-  public static SimpleBindRequest newSimpleBindRequest(final String name,
-      final char[] password)
-  {
-    Validator.ensureNotNull(name, password);
-    return new SimpleBindRequestImpl(name, getBytes(password));
-  }
-
-
-
-  /**
-   * Creates a new start TLS extended request which will use the provided SSL
-   * context.
-   *
-   * @param sslContext
-   *          The SSLContext that should be used when installing the TLS layer.
-   * @return The new start TLS extended request.
-   * @throws NullPointerException
-   *           If {@code sslContext} was {@code null}.
-   */
-  public static StartTLSExtendedRequest newStartTLSExtendedRequest(
-      final SSLContext sslContext)
-  {
-    return new StartTLSExtendedRequestImpl(sslContext);
-  }
-
-
-
-  /**
-   * Creates a new unbind request.
-   *
-   * @return The new unbind request.
-   */
-  public static UnbindRequest newUnbindRequest()
-  {
-    return new UnbindRequestImpl();
-  }
-
-
-
-  /**
-   * Creates a new Who Am I extended request.
-   *
-   * @return The new Who Am I extended request.
-   */
-  public static WhoAmIExtendedRequest newWhoAmIExtendedRequest()
-  {
-    return new WhoAmIExtendedRequestImpl();
-  }
-
-
-
-  /**
-   * Creates an unmodifiable abandon request of the provided request.
-   *
-   * @param request
-   *          The abandon request to be copied.
-   * @return The new abandon request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}
-   */
-  public static AbandonRequest unmodifiableAbandonRequest(
-      final AbandonRequest request)
-  {
-    if (request instanceof UnmodifiableAbandonRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new cancel extended request using the provided message ID.
+     *
+     * @param requestID
+     *            The request ID of the request to be abandoned.
+     * @return The new cancel extended request.
+     */
+    public static CancelExtendedRequest newCancelExtendedRequest(final int requestID) {
+        return new CancelExtendedRequestImpl(requestID);
     }
-    return new UnmodifiableAbandonRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable add request of the provided request.
-   *
-   * @param request
-   *          The add request to be copied.
-   * @return The new add request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static AddRequest unmodifiableAddRequest(final AddRequest request)
-  {
-    if (request instanceof UnmodifiableAddRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new change record (an add, delete, modify, or modify DN
+     * request) using the provided lines of LDIF decoded using the default
+     * schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing an LDIF change record or an LDIF
+     *            entry record.
+     * @return The new change record.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public static ChangeRecord newChangeRecord(final String... ldifLines) {
+        // LDIF change record reader is tolerant to missing change types.
+        return LDIFChangeRecordReader.valueOfLDIFChangeRecord(ldifLines);
     }
-    return new UnmodifiableAddRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable anonymous SASL bind request of the provided
-   * request.
-   *
-   * @param request
-   *          The anonymous SASL bind request to be copied.
-   * @return The new anonymous SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static AnonymousSASLBindRequest unmodifiableAnonymousSASLBindRequest(
-      final AnonymousSASLBindRequest request)
-  {
-    if (request instanceof UnmodifiableAnonymousSASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new compare request using the provided distinguished name,
+     * attribute name, and assertion value.
+     *
+     * @param name
+     *            The distinguished name of the entry to be compared.
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @param assertionValue
+     *            The assertion value to be compared.
+     * @return The new compare request.
+     * @throws NullPointerException
+     *             If {@code name}, {@code attributeDescription}, or
+     *             {@code assertionValue} was {@code null}.
+     */
+    public static CompareRequest newCompareRequest(final DN name,
+            final AttributeDescription attributeDescription, final ByteString assertionValue) {
+        Validator.ensureNotNull(name, attributeDescription, assertionValue);
+        return new CompareRequestImpl(name, attributeDescription, assertionValue);
     }
-    return new UnmodifiableAnonymousSASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable cancel extended request of the provided request.
-   *
-   * @param request
-   *          The cancel extended request to be copied.
-   * @return The new cancel extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static CancelExtendedRequest unmodifiableCancelExtendedRequest(
-      final CancelExtendedRequest request)
-  {
-    if (request instanceof UnmodifiableCancelExtendedRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new compare request using the provided distinguished name,
+     * attribute name, and assertion value decoded using the default schema.
+     * <p>
+     * If the assertion value is not an instance of {@code ByteString} then it
+     * will be converted using the {@link ByteString#valueOf(Object)} method.
+     *
+     * @param name
+     *            The distinguished name of the entry to be compared.
+     * @param attributeDescription
+     *            The name of the attribute to be compared.
+     * @param assertionValue
+     *            The assertion value to be compared.
+     * @return The new compare request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} or {@code attributeDescription} could not be
+     *             decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code name}, {@code attributeDescription}, or
+     *             {@code assertionValue} was {@code null}.
+     */
+    public static CompareRequest newCompareRequest(final String name,
+            final String attributeDescription, final Object assertionValue) {
+        Validator.ensureNotNull(name, attributeDescription, assertionValue);
+        return new CompareRequestImpl(DN.valueOf(name), AttributeDescription
+                .valueOf(attributeDescription), ByteString.valueOf(assertionValue));
     }
-    return new UnmodifiableCancelExtendedRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable compare request of the provided request.
-   *
-   * @param request
-   *          The compare request to be copied.
-   * @return The new compare request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static CompareRequest unmodifiableCompareRequest(
-      final CompareRequest request)
-  {
-    if (request instanceof UnmodifiableCompareRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new CRAM-MD5 SASL bind request having the provided
+     * authentication ID and password.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return The new CRAM-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static CRAMMD5SASLBindRequest newCRAMMD5SASLBindRequest(final String authenticationID,
+            final byte[] password) {
+        return new CRAMMD5SASLBindRequestImpl(authenticationID, password);
     }
-    return new UnmodifiableCompareRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable CRAM MD5 SASL bind request of the provided request.
-   * <p>
-   * The returned bind request creates defensive copies of the password in order
-   * to maintain immutability.
-   *
-   * @param request
-   *          The CRAM MD5 SASL bind request to be copied.
-   * @return The new CRAM-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static CRAMMD5SASLBindRequest unmodifiableCRAMMD5SASLBindRequest(
-      final CRAMMD5SASLBindRequest request)
-  {
-    if (request instanceof UnmodifiableCRAMMD5SASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new CRAM-MD5 SASL bind request having the provided
+     * authentication ID and password.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     *            The password will be converted to a UTF-8 octet string.
+     * @return The new CRAM-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static CRAMMD5SASLBindRequest newCRAMMD5SASLBindRequest(final String authenticationID,
+            final char[] password) {
+        return new CRAMMD5SASLBindRequestImpl(authenticationID, getBytes(password));
     }
-    return new UnmodifiableCRAMMD5SASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable delete request of the provided request.
-   *
-   * @param request
-   *          The add request to be copied.
-   * @return The new delete request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static DeleteRequest unmodifiableDeleteRequest(
-      final DeleteRequest request)
-  {
-    if (request instanceof UnmodifiableDeleteRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new delete request using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry to be deleted.
+     * @return The new delete request.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static DeleteRequest newDeleteRequest(final DN name) {
+        Validator.ensureNotNull(name);
+        return new DeleteRequestImpl(name);
     }
-    return new UnmodifiableDeleteRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable digest MD5 SASL bind request of the provided
-   * request.
-   * <p>
-   * The returned bind request creates defensive copies of the password in order
-   * to maintain immutability.
-   *
-   * @param request
-   *          The digest MD5 SASL bind request to be copied.
-   * @return The new DIGEST-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static DigestMD5SASLBindRequest unmodifiableDigestMD5SASLBindRequest(
-      final DigestMD5SASLBindRequest request)
-  {
-    if (request instanceof UnmodifiableDigestMD5SASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new delete request using the provided distinguished name
+     * decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the entry to be deleted.
+     * @return The new delete request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static DeleteRequest newDeleteRequest(final String name) {
+        Validator.ensureNotNull(name);
+        return new DeleteRequestImpl(DN.valueOf(name));
     }
-    return new UnmodifiableDigestMD5SASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable external SASL bind request of the provided request.
-   *
-   * @param request
-   *          The external SASL bind request to be copied.
-   * @return The new External SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ExternalSASLBindRequest unmodifiableExternalSASLBindRequest(
-      final ExternalSASLBindRequest request)
-  {
-    if (request instanceof UnmodifiableExternalSASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new DIGEST-MD5 SASL bind request having the provided
+     * authentication ID and password, but no realm or authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return The new DIGEST-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static DigestMD5SASLBindRequest newDigestMD5SASLBindRequest(
+            final String authenticationID, final byte[] password) {
+        return new DigestMD5SASLBindRequestImpl(authenticationID, password);
     }
-    return new UnmodifiableExternalSASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable generic bind request of the provided request.
-   * <p>
-   * The returned bind request creates defensive copies of the authentication
-   * value in order to maintain immutability.
-   *
-   * @param request
-   *          The generic bind request to be copied.
-   * @return The new generic bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static GenericBindRequest unmodifiableGenericBindRequest(
-      final GenericBindRequest request)
-  {
-    if (request instanceof UnmodifiableGenericBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new DIGEST-MD5 SASL bind request having the provided
+     * authentication ID and password, but no realm or authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     *            The password will be converted to a UTF-8 octet string.
+     * @return The new DIGEST-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static DigestMD5SASLBindRequest newDigestMD5SASLBindRequest(
+            final String authenticationID, final char[] password) {
+        return new DigestMD5SASLBindRequestImpl(authenticationID, getBytes(password));
     }
-    return new UnmodifiableGenericBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable generic extended request of the provided request.
-   *
-   * @param request
-   *          The generic extended request to be copied.
-   * @return The new generic extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static GenericExtendedRequest unmodifiableGenericExtendedRequest(
-      GenericExtendedRequest request)
-  {
-    if (request instanceof UnmodifiableGenericExtendedRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new External SASL bind request with no authorization ID.
+     *
+     * @return The new External SASL bind request.
+     */
+    public static ExternalSASLBindRequest newExternalSASLBindRequest() {
+        return new ExternalSASLBindRequestImpl();
     }
-    return new UnmodifiableGenericExtendedRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable GSSAPI SASL bind request of the provided request.
-   * <p>
-   * The returned bind request creates defensive copies of the password in order
-   * to maintain immutability.
-   *
-   * @param request
-   *          The GSSAPI SASL bind request to be copied.
-   * @return The new GSSAPI SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static GSSAPISASLBindRequest unmodifiableGSSAPISASLBindRequest(
-      final GSSAPISASLBindRequest request)
-  {
-    if (request instanceof UnmodifiableGSSAPISASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new generic bind request using an empty distinguished name,
+     * authentication type, and authentication information.
+     *
+     * @param authenticationType
+     *            The authentication mechanism identifier for this generic bind
+     *            request.
+     * @param authenticationValue
+     *            The authentication information for this generic bind request
+     *            in a form defined by the authentication mechanism.
+     * @return The new generic bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationValue} was {@code null}.
+     */
+    public static GenericBindRequest newGenericBindRequest(final byte authenticationType,
+            final byte[] authenticationValue) {
+        Validator.ensureNotNull(authenticationValue);
+        return new GenericBindRequestImpl("", authenticationType, authenticationValue);
     }
-    return new UnmodifiableGSSAPISASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable modify DN request of the provided request.
-   *
-   * @param request
-   *          The modify DN request to be copied.
-   * @return The new modify DN request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ModifyDNRequest unmodifiableModifyDNRequest(
-      final ModifyDNRequest request)
-  {
-    if (request instanceof UnmodifiableModifyDNRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new generic bind request using the provided name,
+     * authentication type, and authentication information.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as (may be empty).
+     * @param authenticationType
+     *            The authentication mechanism identifier for this generic bind
+     *            request.
+     * @param authenticationValue
+     *            The authentication information for this generic bind request
+     *            in a form defined by the authentication mechanism.
+     * @return The new generic bind request.
+     * @throws NullPointerException
+     *             If {@code name} or {@code authenticationValue} was
+     *             {@code null}.
+     */
+    public static GenericBindRequest newGenericBindRequest(final String name,
+            final byte authenticationType, final byte[] authenticationValue) {
+        Validator.ensureNotNull(name, authenticationValue);
+        return new GenericBindRequestImpl(name, authenticationType, authenticationValue);
     }
-    return new UnmodifiableModifyDNRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable modify request of the provided request.
-   *
-   * @param request
-   *          The modify request to be copied.
-   * @return The new modify request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ModifyRequest unmodifiableModifyRequest(
-      final ModifyRequest request)
-  {
-    if (request instanceof UnmodifiableModifyRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new generic extended request using the provided name and no
+     * value.
+     *
+     * @param requestName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to this extended request.
+     * @return The new generic extended request.
+     * @throws NullPointerException
+     *             If {@code requestName} was {@code null}.
+     */
+    public static GenericExtendedRequest newGenericExtendedRequest(final String requestName) {
+        Validator.ensureNotNull(requestName);
+        return new GenericExtendedRequestImpl(requestName, null);
     }
-    return new UnmodifiableModifyRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable password modify extended request of the provided
-   * request.
-   *
-   * @param request
-   *          The password modify extended request to be copied.
-   * @return The new password modify extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static PasswordModifyExtendedRequest unmodifiablePasswordModifyExtendedRequest(
-      final PasswordModifyExtendedRequest request)
-  {
-    if (request instanceof UnmodifiablePasswordModifyExtendedRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new generic extended request using the provided name and
+     * optional value.
+     *
+     * @param requestName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to this extended request.
+     * @param requestValue
+     *            The content of this generic extended request in a form defined
+     *            by the extended operation, or {@code null} if there is no
+     *            content.
+     * @return The new generic extended request.
+     * @throws NullPointerException
+     *             If {@code requestName} was {@code null}.
+     */
+    public static GenericExtendedRequest newGenericExtendedRequest(final String requestName,
+            final ByteString requestValue) {
+        Validator.ensureNotNull(requestName);
+        return new GenericExtendedRequestImpl(requestName, requestValue);
     }
-    return new UnmodifiablePasswordModifyExtendedRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable plain SASL bind request of the provided request.
-   * <p>
-   * The returned bind request creates defensive copies of the password in order
-   * to maintain immutability.
-   *
-   * @param request
-   *          The plain SASL bind request to be copied.
-   * @return The new Plain SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static PlainSASLBindRequest unmodifiablePlainSASLBindRequest(
-      final PlainSASLBindRequest request)
-  {
-    if (request instanceof UnmodifiablePlainSASLBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new GSSAPI SASL bind request having the provided authentication
+     * ID and password, but no realm, KDC address, or authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return The new GSSAPI SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(final String authenticationID,
+            final byte[] password) {
+        return new GSSAPISASLBindRequestImpl(authenticationID, password);
     }
-    return new UnmodifiablePlainSASLBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable search request of the provided request.
-   *
-   * @param request
-   *          The search request to be copied.
-   * @return The new search request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static SearchRequest unmodifiableSearchRequest(
-      final SearchRequest request)
-  {
-    if (request instanceof UnmodifiableSearchRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new GSSAPI SASL bind request having the provided authentication
+     * ID and password, but no realm, KDC address, or authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     *            The password will be converted to a UTF-8 octet string.
+     * @return The new GSSAPI SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(final String authenticationID,
+            final char[] password) {
+        return new GSSAPISASLBindRequestImpl(authenticationID, getBytes(password));
     }
-    return new UnmodifiableSearchRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable simple bind request of the provided request.
-   * <p>
-   * The returned bind request creates defensive copies of the password in order
-   * to maintain immutability.
-   *
-   * @param request
-   *          The simple bind request to be copied.
-   * @return The new simple bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static SimpleBindRequest unmodifiableSimpleBindRequest(
-      final SimpleBindRequest request)
-  {
-    if (request instanceof UnmodifiableSimpleBindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new GSSAPI SASL bind request having the provided subject, but
+     * no authorization ID.
+     *
+     * @param subject
+     *            The Kerberos subject of the user to be authenticated.
+     * @return The new GSSAPI SASL bind request.
+     * @throws NullPointerException
+     *             If {@code subject} was {@code null}.
+     */
+    public static GSSAPISASLBindRequest newGSSAPISASLBindRequest(final Subject subject) {
+        return new GSSAPISASLBindRequestImpl(subject);
     }
-    return new UnmodifiableSimpleBindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable startTLS extended request of the provided request.
-   *
-   * @param request
-   *          The startTLS extended request to be copied.
-   * @return The new start TLS extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static StartTLSExtendedRequest unmodifiableStartTLSExtendedRequest(
-      final StartTLSExtendedRequest request)
-  {
-    if (request instanceof UnmodifiableStartTLSExtendedRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new modify DN request using the provided distinguished name and
+     * new RDN.
+     *
+     * @param name
+     *            The distinguished name of the entry to be renamed.
+     * @param newRDN
+     *            The new RDN of the entry.
+     * @return The new modify DN request.
+     * @throws NullPointerException
+     *             If {@code name} or {@code newRDN} was {@code null}.
+     */
+    public static ModifyDNRequest newModifyDNRequest(final DN name, final RDN newRDN) {
+        Validator.ensureNotNull(name, newRDN);
+        return new ModifyDNRequestImpl(name, newRDN);
     }
-    return new UnmodifiableStartTLSExtendedRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable unbind request of the provided request.
-   *
-   * @param request
-   *          The unbind request to be copied.
-   * @return The new unbind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static UnbindRequest unmodifiableUnbindRequest(
-      final UnbindRequest request)
-  {
-    if (request instanceof UnmodifiableUnbindRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new modify DN request using the provided distinguished name and
+     * new RDN decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the entry to be renamed.
+     * @param newRDN
+     *            The new RDN of the entry.
+     * @return The new modify DN request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} or {@code newRDN} could not be decoded using
+     *             the default schema.
+     * @throws NullPointerException
+     *             If {@code name} or {@code newRDN} was {@code null}.
+     */
+    public static ModifyDNRequest newModifyDNRequest(final String name, final String newRDN) {
+        Validator.ensureNotNull(name, newRDN);
+        return new ModifyDNRequestImpl(DN.valueOf(name), RDN.valueOf(newRDN));
     }
-    return new UnmodifiableUnbindRequestImpl(request);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable new Who Am I extended request of the provided
-   * request.
-   *
-   * @param request
-   *          The who Am I extended request to be copied.
-   * @return The new Who Am I extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static WhoAmIExtendedRequest unmodifiableWhoAmIExtendedRequest(
-      final WhoAmIExtendedRequest request)
-  {
-    if (request instanceof UnmodifiableWhoAmIExtendedRequestImpl)
-    {
-      return request;
+    /**
+     * Creates a new modify request using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry to be modified.
+     * @return The new modify request.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static ModifyRequest newModifyRequest(final DN name) {
+        Validator.ensureNotNull(name);
+        return new ModifyRequestImpl(name);
     }
-    return new UnmodifiableWhoAmIExtendedRequestImpl(request);
-  }
 
+    /**
+     * Creates a new modify request containing a list of modifications which can
+     * be used to transform {@code fromEntry} into entry {@code toEntry}.
+     * <p>
+     * The modify request is reversible: it will contain only modifications of
+     * type {@link ModificationType#ADD ADD} and {@link ModificationType#DELETE
+     * DELETE}.
+     * <p>
+     * Finally, the modify request will use the distinguished name taken from
+     * {@code fromEntry}. Moreover, this method will not check to see if both
+     * {@code fromEntry} and {@code toEntry} have the same distinguished name.
+     * <p>
+     * This method is equivalent to:
+     *
+     * <pre>
+     * ModifyRequest request = Entries.diffEntries(fromEntry, toEntry);
+     * </pre>
+     *
+     * @param fromEntry
+     *            The source entry.
+     * @param toEntry
+     *            The destination entry.
+     * @return A modify request containing a list of modifications which can be
+     *         used to transform {@code fromEntry} into entry {@code toEntry}.
+     * @throws NullPointerException
+     *             If {@code fromEntry} or {@code toEntry} were {@code null}.
+     * @see Entries#diffEntries(Entry, Entry)
+     */
+    public static final ModifyRequest newModifyRequest(Entry fromEntry, Entry toEntry) {
+        return Entries.diffEntries(fromEntry, toEntry);
+    }
 
+    /**
+     * Creates a new modify request using the provided distinguished name
+     * decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the entry to be modified.
+     * @return The new modify request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static ModifyRequest newModifyRequest(final String name) {
+        Validator.ensureNotNull(name);
+        return new ModifyRequestImpl(DN.valueOf(name));
+    }
 
-  /**
-   * Creates a new abandon request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The abandon request to be copied.
-   * @return The new abandon request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}
-   */
-  public static AbandonRequest copyOfAbandonRequest(final AbandonRequest request)
-  {
-    return new AbandonRequestImpl(request);
-  }
+    /**
+     * Creates a new modify request using the provided lines of LDIF decoded
+     * using the default schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing a single LDIF modify change record.
+     * @return The new modify request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public static ModifyRequest newModifyRequest(final String... ldifLines) {
+        // LDIF change record reader is tolerant to missing change types.
+        final ChangeRecord record = LDIFChangeRecordReader.valueOfLDIFChangeRecord(ldifLines);
 
+        if (record instanceof ModifyRequest) {
+            return (ModifyRequest) record;
+        } else {
+            // Wrong change type.
+            final LocalizableMessage message =
+                    WARN_READ_LDIF_RECORD_CHANGE_RECORD_WRONG_TYPE.get("modify");
+            throw new LocalizedIllegalArgumentException(message);
+        }
+    }
 
+    /**
+     * Creates a new password modify extended request, with no user identity,
+     * old password, or new password.
+     *
+     * @return The new password modify extended request.
+     */
+    public static PasswordModifyExtendedRequest newPasswordModifyExtendedRequest() {
+        return new PasswordModifyExtendedRequestImpl();
+    }
 
-  /**
-   * Creates a new add request that is an exact copy of the provided request.
-   *
-   * @param request
-   *          The add request to be copied.
-   * @return The new add request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static AddRequest copyOfAddRequest(final AddRequest request)
-  {
-    return new AddRequestImpl(request);
-  }
+    /**
+     * Creates a new Plain SASL bind request having the provided authentication
+     * ID and password, but no authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     * @return The new Plain SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static PlainSASLBindRequest newPlainSASLBindRequest(final String authenticationID,
+            final byte[] password) {
+        return new PlainSASLBindRequestImpl(authenticationID, password);
+    }
 
+    /**
+     * Creates a new Plain SASL bind request having the provided authentication
+     * ID and password, but no authorization ID.
+     *
+     * @param authenticationID
+     *            The authentication ID of the user. The authentication ID
+     *            usually has the form "dn:" immediately followed by the
+     *            distinguished name of the user, or "u:" followed by a user ID
+     *            string, but other forms are permitted.
+     * @param password
+     *            The password of the user that the client wishes to bind as.
+     *            The password will be converted to a UTF-8 octet string.
+     * @return The new Plain SASL bind request.
+     * @throws NullPointerException
+     *             If {@code authenticationID} or {@code password} was
+     *             {@code null}.
+     */
+    public static PlainSASLBindRequest newPlainSASLBindRequest(final String authenticationID,
+            final char[] password) {
+        return new PlainSASLBindRequestImpl(authenticationID, getBytes(password));
+    }
 
+    /**
+     * Creates a new search request using the provided distinguished name,
+     * scope, and filter, decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @param scope
+     *            The scope of the search.
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with each entry.
+     * @return The new search request.
+     * @throws NullPointerException
+     *             If the {@code name}, {@code scope}, or {@code filter} were
+     *             {@code null}.
+     */
+    public static SearchRequest newSearchRequest(final DN name, final SearchScope scope,
+            final Filter filter, final String... attributeDescriptions) {
+        Validator.ensureNotNull(name, scope, filter);
+        final SearchRequest request = new SearchRequestImpl(name, scope, filter);
+        for (final String attributeDescription : attributeDescriptions) {
+            request.addAttribute(attributeDescription);
+        }
+        return request;
+    }
 
-  /**
-   * Creates a new anonymous SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The anonymous SASL bind request to be copied.
-   * @return The new anonymous SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static AnonymousSASLBindRequest copyOfAnonymousSASLBindRequest(
-      final AnonymousSASLBindRequest request)
-  {
-    return new AnonymousSASLBindRequestImpl(request);
-  }
+    /**
+     * Creates a new search request using the provided distinguished name,
+     * scope, and filter, decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @param scope
+     *            The scope of the search.
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @param attributeDescriptions
+     *            The names of the attributes to be included with each entry.
+     * @return The new search request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema, or if {@code filter} is not a valid LDAP string
+     *             representation of a filter.
+     * @throws NullPointerException
+     *             If the {@code name}, {@code scope}, or {@code filter} were
+     *             {@code null}.
+     */
+    public static SearchRequest newSearchRequest(final String name, final SearchScope scope,
+            final String filter, final String... attributeDescriptions) {
+        Validator.ensureNotNull(name, scope, filter);
+        final SearchRequest request =
+                new SearchRequestImpl(DN.valueOf(name), scope, Filter.valueOf(filter));
+        for (final String attributeDescription : attributeDescriptions) {
+            request.addAttribute(attributeDescription);
+        }
+        return request;
+    }
 
+    /**
+     * Creates a new simple bind request having an empty name and password
+     * suitable for anonymous authentication.
+     *
+     * @return The new simple bind request.
+     */
+    public static SimpleBindRequest newSimpleBindRequest() {
+        return new SimpleBindRequestImpl("", EMPTY_BYTES);
+    }
 
+    /**
+     * Creates a new simple bind request having the provided name and password
+     * suitable for name/password authentication. The name will be decoded using
+     * the default schema.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty indicating that an unauthenticated
+     *            bind is to be performed.
+     * @return The new simple bind request.
+     * @throws NullPointerException
+     *             If {@code name} or {@code password} was {@code null}.
+     */
+    public static SimpleBindRequest newSimpleBindRequest(final String name, final byte[] password) {
+        Validator.ensureNotNull(name, password);
+        return new SimpleBindRequestImpl(name, password);
+    }
 
-  /**
-   * Creates a new cancel extended request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The cancel extended request to be copied.
-   * @return The new cancel extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static CancelExtendedRequest copyOfCancelExtendedRequest(
-      final CancelExtendedRequest request)
-  {
-    return new CancelExtendedRequestImpl(request);
-  }
+    /**
+     * Creates a new simple bind request having the provided name and password
+     * suitable for name/password authentication. The name will be decoded using
+     * the default schema.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty indicating that an unauthenticated
+     *            bind is to be performed. The password will be converted to a
+     *            UTF-8 octet string.
+     * @return The new simple bind request.
+     * @throws NullPointerException
+     *             If {@code name} or {@code password} was {@code null}.
+     */
+    public static SimpleBindRequest newSimpleBindRequest(final String name, final char[] password) {
+        Validator.ensureNotNull(name, password);
+        return new SimpleBindRequestImpl(name, getBytes(password));
+    }
 
+    /**
+     * Creates a new start TLS extended request which will use the provided SSL
+     * context.
+     *
+     * @param sslContext
+     *            The SSLContext that should be used when installing the TLS
+     *            layer.
+     * @return The new start TLS extended request.
+     * @throws NullPointerException
+     *             If {@code sslContext} was {@code null}.
+     */
+    public static StartTLSExtendedRequest newStartTLSExtendedRequest(final SSLContext sslContext) {
+        return new StartTLSExtendedRequestImpl(sslContext);
+    }
 
+    /**
+     * Creates a new unbind request.
+     *
+     * @return The new unbind request.
+     */
+    public static UnbindRequest newUnbindRequest() {
+        return new UnbindRequestImpl();
+    }
 
-  /**
-   * Creates a new compare request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The compare request to be copied.
-   * @return The new compare request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static CompareRequest copyOfCompareRequest(final CompareRequest request)
-  {
-    return new CompareRequestImpl(request);
-  }
+    /**
+     * Creates a new Who Am I extended request.
+     *
+     * @return The new Who Am I extended request.
+     */
+    public static WhoAmIExtendedRequest newWhoAmIExtendedRequest() {
+        return new WhoAmIExtendedRequestImpl();
+    }
 
+    /**
+     * Creates an unmodifiable abandon request of the provided request.
+     *
+     * @param request
+     *            The abandon request to be copied.
+     * @return The new abandon request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}
+     */
+    public static AbandonRequest unmodifiableAbandonRequest(final AbandonRequest request) {
+        if (request instanceof UnmodifiableAbandonRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableAbandonRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable add request of the provided request.
+     *
+     * @param request
+     *            The add request to be copied.
+     * @return The new add request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static AddRequest unmodifiableAddRequest(final AddRequest request) {
+        if (request instanceof UnmodifiableAddRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableAddRequestImpl(request);
+    }
 
-  /**
-   * Creates a new CRAM MD5 SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The CRAM MD5 SASL bind request to be copied.
-   * @return The new CRAM-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static CRAMMD5SASLBindRequest copyOfCRAMMD5SASLBindRequest(
-      final CRAMMD5SASLBindRequest request)
-  {
-    return new CRAMMD5SASLBindRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable anonymous SASL bind request of the provided
+     * request.
+     *
+     * @param request
+     *            The anonymous SASL bind request to be copied.
+     * @return The new anonymous SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static AnonymousSASLBindRequest unmodifiableAnonymousSASLBindRequest(
+            final AnonymousSASLBindRequest request) {
+        if (request instanceof UnmodifiableAnonymousSASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableAnonymousSASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable cancel extended request of the provided request.
+     *
+     * @param request
+     *            The cancel extended request to be copied.
+     * @return The new cancel extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static CancelExtendedRequest unmodifiableCancelExtendedRequest(
+            final CancelExtendedRequest request) {
+        if (request instanceof UnmodifiableCancelExtendedRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableCancelExtendedRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable compare request of the provided request.
+     *
+     * @param request
+     *            The compare request to be copied.
+     * @return The new compare request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static CompareRequest unmodifiableCompareRequest(final CompareRequest request) {
+        if (request instanceof UnmodifiableCompareRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableCompareRequestImpl(request);
+    }
 
-  /**
-   * Creates a new delete request that is an exact copy of the provided request.
-   *
-   * @param request
-   *          The add request to be copied.
-   * @return The new delete request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static DeleteRequest copyOfDeleteRequest(final DeleteRequest request)
-  {
-    return new DeleteRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable CRAM MD5 SASL bind request of the provided
+     * request.
+     * <p>
+     * The returned bind request creates defensive copies of the password in
+     * order to maintain immutability.
+     *
+     * @param request
+     *            The CRAM MD5 SASL bind request to be copied.
+     * @return The new CRAM-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static CRAMMD5SASLBindRequest unmodifiableCRAMMD5SASLBindRequest(
+            final CRAMMD5SASLBindRequest request) {
+        if (request instanceof UnmodifiableCRAMMD5SASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableCRAMMD5SASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable delete request of the provided request.
+     *
+     * @param request
+     *            The add request to be copied.
+     * @return The new delete request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static DeleteRequest unmodifiableDeleteRequest(final DeleteRequest request) {
+        if (request instanceof UnmodifiableDeleteRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableDeleteRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable digest MD5 SASL bind request of the provided
+     * request.
+     * <p>
+     * The returned bind request creates defensive copies of the password in
+     * order to maintain immutability.
+     *
+     * @param request
+     *            The digest MD5 SASL bind request to be copied.
+     * @return The new DIGEST-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static DigestMD5SASLBindRequest unmodifiableDigestMD5SASLBindRequest(
+            final DigestMD5SASLBindRequest request) {
+        if (request instanceof UnmodifiableDigestMD5SASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableDigestMD5SASLBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new digest MD5 SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The digest MD5 SASL bind request to be copied.
-   * @return The new DIGEST-MD5 SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static DigestMD5SASLBindRequest copyOfDigestMD5SASLBindRequest(
-      final DigestMD5SASLBindRequest request)
-  {
-    return new DigestMD5SASLBindRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable external SASL bind request of the provided
+     * request.
+     *
+     * @param request
+     *            The external SASL bind request to be copied.
+     * @return The new External SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ExternalSASLBindRequest unmodifiableExternalSASLBindRequest(
+            final ExternalSASLBindRequest request) {
+        if (request instanceof UnmodifiableExternalSASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableExternalSASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable generic bind request of the provided request.
+     * <p>
+     * The returned bind request creates defensive copies of the authentication
+     * value in order to maintain immutability.
+     *
+     * @param request
+     *            The generic bind request to be copied.
+     * @return The new generic bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static GenericBindRequest unmodifiableGenericBindRequest(final GenericBindRequest request) {
+        if (request instanceof UnmodifiableGenericBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableGenericBindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable generic extended request of the provided request.
+     *
+     * @param request
+     *            The generic extended request to be copied.
+     * @return The new generic extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static GenericExtendedRequest unmodifiableGenericExtendedRequest(
+            GenericExtendedRequest request) {
+        if (request instanceof UnmodifiableGenericExtendedRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableGenericExtendedRequestImpl(request);
+    }
 
-  /**
-   * Creates a new external SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The external SASL bind request to be copied.
-   * @return The new External SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ExternalSASLBindRequest copyOfExternalSASLBindRequest(
-      final ExternalSASLBindRequest request)
-  {
-    return new ExternalSASLBindRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable GSSAPI SASL bind request of the provided request.
+     * <p>
+     * The returned bind request creates defensive copies of the password in
+     * order to maintain immutability.
+     *
+     * @param request
+     *            The GSSAPI SASL bind request to be copied.
+     * @return The new GSSAPI SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static GSSAPISASLBindRequest unmodifiableGSSAPISASLBindRequest(
+            final GSSAPISASLBindRequest request) {
+        if (request instanceof UnmodifiableGSSAPISASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableGSSAPISASLBindRequestImpl(request);
+    }
 
-
-
-  /**
-   * Creates a new generic bind request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The generic bind request to be copied.
-   * @return The new generic bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static GenericBindRequest copyOfGenericBindRequest(
-      final GenericBindRequest request)
-  {
-    return new GenericBindRequestImpl(request);
-  }
-
-
-
-  /**
-   * Creates a new generic extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The generic extended request to be copied.
-   * @return The new generic extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static GenericExtendedRequest copyOfGenericExtendedRequest(
-      GenericExtendedRequest request)
-  {
-    return new GenericExtendedRequestImpl(request);
-  }
-
-
-
-  /**
-   * Creates a new GSSAPI SASL bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The GSSAPI SASL bind request to be copied.
-   * @return The new GSSAPI SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null}.
-   */
-  public static GSSAPISASLBindRequest copyOfGSSAPISASLBindRequest(
-      final GSSAPISASLBindRequest request)
-  {
-    return new GSSAPISASLBindRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable modify DN request of the provided request.
+     *
+     * @param request
+     *            The modify DN request to be copied.
+     * @return The new modify DN request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ModifyDNRequest unmodifiableModifyDNRequest(final ModifyDNRequest request) {
+        if (request instanceof UnmodifiableModifyDNRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableModifyDNRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable modify request of the provided request.
+     *
+     * @param request
+     *            The modify request to be copied.
+     * @return The new modify request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ModifyRequest unmodifiableModifyRequest(final ModifyRequest request) {
+        if (request instanceof UnmodifiableModifyRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableModifyRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable password modify extended request of the provided
+     * request.
+     *
+     * @param request
+     *            The password modify extended request to be copied.
+     * @return The new password modify extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static PasswordModifyExtendedRequest unmodifiablePasswordModifyExtendedRequest(
+            final PasswordModifyExtendedRequest request) {
+        if (request instanceof UnmodifiablePasswordModifyExtendedRequestImpl) {
+            return request;
+        }
+        return new UnmodifiablePasswordModifyExtendedRequestImpl(request);
+    }
 
-  /**
-   * Creates a new modify DN request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The modify DN request to be copied.
-   * @return The new modify DN request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ModifyDNRequest copyOfModifyDNRequest(
-      final ModifyDNRequest request)
-  {
-    return new ModifyDNRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable plain SASL bind request of the provided request.
+     * <p>
+     * The returned bind request creates defensive copies of the password in
+     * order to maintain immutability.
+     *
+     * @param request
+     *            The plain SASL bind request to be copied.
+     * @return The new Plain SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static PlainSASLBindRequest unmodifiablePlainSASLBindRequest(
+            final PlainSASLBindRequest request) {
+        if (request instanceof UnmodifiablePlainSASLBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiablePlainSASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable search request of the provided request.
+     *
+     * @param request
+     *            The search request to be copied.
+     * @return The new search request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static SearchRequest unmodifiableSearchRequest(final SearchRequest request) {
+        if (request instanceof UnmodifiableSearchRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableSearchRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable simple bind request of the provided request.
+     * <p>
+     * The returned bind request creates defensive copies of the password in
+     * order to maintain immutability.
+     *
+     * @param request
+     *            The simple bind request to be copied.
+     * @return The new simple bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static SimpleBindRequest unmodifiableSimpleBindRequest(final SimpleBindRequest request) {
+        if (request instanceof UnmodifiableSimpleBindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableSimpleBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new modify request that is an exact copy of the provided request.
-   *
-   * @param request
-   *          The modify request to be copied.
-   * @return The new modify request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static ModifyRequest copyOfModifyRequest(final ModifyRequest request)
-  {
-    return new ModifyRequestImpl(request);
-  }
+    /**
+     * Creates an unmodifiable startTLS extended request of the provided
+     * request.
+     *
+     * @param request
+     *            The startTLS extended request to be copied.
+     * @return The new start TLS extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static StartTLSExtendedRequest unmodifiableStartTLSExtendedRequest(
+            final StartTLSExtendedRequest request) {
+        if (request instanceof UnmodifiableStartTLSExtendedRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableStartTLSExtendedRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable unbind request of the provided request.
+     *
+     * @param request
+     *            The unbind request to be copied.
+     * @return The new unbind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static UnbindRequest unmodifiableUnbindRequest(final UnbindRequest request) {
+        if (request instanceof UnmodifiableUnbindRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableUnbindRequestImpl(request);
+    }
 
+    /**
+     * Creates an unmodifiable new Who Am I extended request of the provided
+     * request.
+     *
+     * @param request
+     *            The who Am I extended request to be copied.
+     * @return The new Who Am I extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static WhoAmIExtendedRequest unmodifiableWhoAmIExtendedRequest(
+            final WhoAmIExtendedRequest request) {
+        if (request instanceof UnmodifiableWhoAmIExtendedRequestImpl) {
+            return request;
+        }
+        return new UnmodifiableWhoAmIExtendedRequestImpl(request);
+    }
 
-  /**
-   * Creates a new password modify extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The password modify extended request to be copied.
-   * @return The new password modify extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static PasswordModifyExtendedRequest copyOfPasswordModifyExtendedRequest(
-      final PasswordModifyExtendedRequest request)
-  {
-    return new PasswordModifyExtendedRequestImpl(request);
-  }
+    /**
+     * Creates a new abandon request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The abandon request to be copied.
+     * @return The new abandon request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}
+     */
+    public static AbandonRequest copyOfAbandonRequest(final AbandonRequest request) {
+        return new AbandonRequestImpl(request);
+    }
 
+    /**
+     * Creates a new add request that is an exact copy of the provided request.
+     *
+     * @param request
+     *            The add request to be copied.
+     * @return The new add request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static AddRequest copyOfAddRequest(final AddRequest request) {
+        return new AddRequestImpl(request);
+    }
 
+    /**
+     * Creates a new anonymous SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The anonymous SASL bind request to be copied.
+     * @return The new anonymous SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static AnonymousSASLBindRequest copyOfAnonymousSASLBindRequest(
+            final AnonymousSASLBindRequest request) {
+        return new AnonymousSASLBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new plain SASL bind request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The plain SASL bind request to be copied.
-   * @return The new Plain SASL bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static PlainSASLBindRequest copyOfPlainSASLBindRequest(
-      final PlainSASLBindRequest request)
-  {
-    return new PlainSASLBindRequestImpl(request);
-  }
+    /**
+     * Creates a new cancel extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The cancel extended request to be copied.
+     * @return The new cancel extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static CancelExtendedRequest copyOfCancelExtendedRequest(
+            final CancelExtendedRequest request) {
+        return new CancelExtendedRequestImpl(request);
+    }
 
+    /**
+     * Creates a new compare request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The compare request to be copied.
+     * @return The new compare request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static CompareRequest copyOfCompareRequest(final CompareRequest request) {
+        return new CompareRequestImpl(request);
+    }
 
+    /**
+     * Creates a new CRAM MD5 SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The CRAM MD5 SASL bind request to be copied.
+     * @return The new CRAM-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static CRAMMD5SASLBindRequest copyOfCRAMMD5SASLBindRequest(
+            final CRAMMD5SASLBindRequest request) {
+        return new CRAMMD5SASLBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new search request that is an exact copy of the provided request.
-   *
-   * @param request
-   *          The search request to be copied.
-   * @return The new search request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static SearchRequest copyOfSearchRequest(final SearchRequest request)
-  {
-    return new SearchRequestImpl(request);
-  }
+    /**
+     * Creates a new delete request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The add request to be copied.
+     * @return The new delete request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static DeleteRequest copyOfDeleteRequest(final DeleteRequest request) {
+        return new DeleteRequestImpl(request);
+    }
 
+    /**
+     * Creates a new digest MD5 SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The digest MD5 SASL bind request to be copied.
+     * @return The new DIGEST-MD5 SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static DigestMD5SASLBindRequest copyOfDigestMD5SASLBindRequest(
+            final DigestMD5SASLBindRequest request) {
+        return new DigestMD5SASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates a new external SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The external SASL bind request to be copied.
+     * @return The new External SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ExternalSASLBindRequest copyOfExternalSASLBindRequest(
+            final ExternalSASLBindRequest request) {
+        return new ExternalSASLBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new simple bind request that is an exact copy of the provided
-   * request.
-   *
-   * @param request
-   *          The simple bind request to be copied.
-   * @return The new simple bind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static SimpleBindRequest copyOfSimpleBindRequest(
-      final SimpleBindRequest request)
-  {
-    return new SimpleBindRequestImpl(request);
-  }
+    /**
+     * Creates a new generic bind request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The generic bind request to be copied.
+     * @return The new generic bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static GenericBindRequest copyOfGenericBindRequest(final GenericBindRequest request) {
+        return new GenericBindRequestImpl(request);
+    }
 
+    /**
+     * Creates a new generic extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The generic extended request to be copied.
+     * @return The new generic extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static GenericExtendedRequest copyOfGenericExtendedRequest(GenericExtendedRequest request) {
+        return new GenericExtendedRequestImpl(request);
+    }
 
+    /**
+     * Creates a new GSSAPI SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The GSSAPI SASL bind request to be copied.
+     * @return The new GSSAPI SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null}.
+     */
+    public static GSSAPISASLBindRequest copyOfGSSAPISASLBindRequest(
+            final GSSAPISASLBindRequest request) {
+        return new GSSAPISASLBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new startTLS extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The startTLS extended request to be copied.
-   * @return The new start TLS extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static StartTLSExtendedRequest copyOfStartTLSExtendedRequest(
-      final StartTLSExtendedRequest request)
-  {
-    return new StartTLSExtendedRequestImpl(request);
-  }
+    /**
+     * Creates a new modify DN request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The modify DN request to be copied.
+     * @return The new modify DN request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ModifyDNRequest copyOfModifyDNRequest(final ModifyDNRequest request) {
+        return new ModifyDNRequestImpl(request);
+    }
 
+    /**
+     * Creates a new modify request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The modify request to be copied.
+     * @return The new modify request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static ModifyRequest copyOfModifyRequest(final ModifyRequest request) {
+        return new ModifyRequestImpl(request);
+    }
 
+    /**
+     * Creates a new password modify extended request that is an exact copy of
+     * the provided request.
+     *
+     * @param request
+     *            The password modify extended request to be copied.
+     * @return The new password modify extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static PasswordModifyExtendedRequest copyOfPasswordModifyExtendedRequest(
+            final PasswordModifyExtendedRequest request) {
+        return new PasswordModifyExtendedRequestImpl(request);
+    }
 
-  /**
-   * Creates a new unbind request that is an exact copy of the provided request.
-   *
-   * @param request
-   *          The unbind request to be copied.
-   * @return The new unbind request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static UnbindRequest copyOfUnbindRequest(final UnbindRequest request)
-  {
-    return new UnbindRequestImpl(request);
-  }
+    /**
+     * Creates a new plain SASL bind request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The plain SASL bind request to be copied.
+     * @return The new Plain SASL bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static PlainSASLBindRequest copyOfPlainSASLBindRequest(final PlainSASLBindRequest request) {
+        return new PlainSASLBindRequestImpl(request);
+    }
 
+    /**
+     * Creates a new search request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The search request to be copied.
+     * @return The new search request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static SearchRequest copyOfSearchRequest(final SearchRequest request) {
+        return new SearchRequestImpl(request);
+    }
 
+    /**
+     * Creates a new simple bind request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The simple bind request to be copied.
+     * @return The new simple bind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static SimpleBindRequest copyOfSimpleBindRequest(final SimpleBindRequest request) {
+        return new SimpleBindRequestImpl(request);
+    }
 
-  /**
-   * Creates a new Who Am I extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param request
-   *          The who Am I extended request to be copied.
-   * @return The new Who Am I extended request.
-   * @throws NullPointerException
-   *           If {@code request} was {@code null} .
-   */
-  public static WhoAmIExtendedRequest copyOfWhoAmIExtendedRequest(
-      final WhoAmIExtendedRequest request)
-  {
-    return new WhoAmIExtendedRequestImpl(request);
-  }
+    /**
+     * Creates a new startTLS extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The startTLS extended request to be copied.
+     * @return The new start TLS extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static StartTLSExtendedRequest copyOfStartTLSExtendedRequest(
+            final StartTLSExtendedRequest request) {
+        return new StartTLSExtendedRequestImpl(request);
+    }
 
+    /**
+     * Creates a new unbind request that is an exact copy of the provided
+     * request.
+     *
+     * @param request
+     *            The unbind request to be copied.
+     * @return The new unbind request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static UnbindRequest copyOfUnbindRequest(final UnbindRequest request) {
+        return new UnbindRequestImpl(request);
+    }
 
+    /**
+     * Creates a new Who Am I extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param request
+     *            The who Am I extended request to be copied.
+     * @return The new Who Am I extended request.
+     * @throws NullPointerException
+     *             If {@code request} was {@code null} .
+     */
+    public static WhoAmIExtendedRequest copyOfWhoAmIExtendedRequest(
+            final WhoAmIExtendedRequest request) {
+        return new WhoAmIExtendedRequestImpl(request);
+    }
 
-  private Requests()
-  {
-    // Prevent instantiation.
-  }
+    private Requests() {
+        // Prevent instantiation.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java
index 551edc6..35e60e3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,20 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.INFO_SASL_UNSUPPORTED_CALLBACK;
 
 import java.io.IOException;
 
-import javax.security.auth.callback.*;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.ChoiceCallback;
+import javax.security.auth.callback.ConfirmationCallback;
+import javax.security.auth.callback.LanguageCallback;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.TextInputCallback;
+import javax.security.auth.callback.TextOutputCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.security.sasl.AuthorizeCallback;
 import javax.security.sasl.RealmCallback;
 import javax.security.sasl.RealmChoiceCallback;
@@ -44,233 +50,154 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 
-
-
 /**
  * SASL bind client implementation.
  */
-class SASLBindClientImpl extends BindClientImpl implements CallbackHandler
-{
-  /**
-   * The name of the default protocol used.
-   */
-  static final String SASL_DEFAULT_PROTOCOL = "ldap";
+class SASLBindClientImpl extends BindClientImpl implements CallbackHandler {
+    /**
+     * The name of the default protocol used.
+     */
+    static final String SASL_DEFAULT_PROTOCOL = "ldap";
 
-  private final String saslMechanism;
+    private final String saslMechanism;
 
+    /**
+     * Creates a new abstract SASL bind client. The next bind request will be a
+     * copy of the provided initial bind request which should be updated in
+     * subsequent bind requests forming part of this authentication.
+     *
+     * @param initialBindRequest
+     *            The initial bind request.
+     */
+    SASLBindClientImpl(final SASLBindRequest initialBindRequest) {
+        super(initialBindRequest);
+        this.saslMechanism = initialBindRequest.getSASLMechanism();
+    }
 
+    public final void handle(final Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+        for (final Callback callback : callbacks) {
+            if (callback instanceof NameCallback) {
+                handle((NameCallback) callback);
+            } else if (callback instanceof PasswordCallback) {
+                handle((PasswordCallback) callback);
+            } else if (callback instanceof AuthorizeCallback) {
+                handle((AuthorizeCallback) callback);
+            } else if (callback instanceof RealmCallback) {
+                handle((RealmCallback) callback);
+            } else if (callback instanceof RealmChoiceCallback) {
+                handle((RealmChoiceCallback) callback);
+            } else if (callback instanceof ChoiceCallback) {
+                handle((ChoiceCallback) callback);
+            } else if (callback instanceof ConfirmationCallback) {
+                handle((ConfirmationCallback) callback);
+            } else if (callback instanceof LanguageCallback) {
+                handle((LanguageCallback) callback);
+            } else if (callback instanceof TextInputCallback) {
+                handle((TextInputCallback) callback);
+            } else if (callback instanceof TextOutputCallback) {
+                handle((TextOutputCallback) callback);
+            } else {
+                final org.forgerock.i18n.LocalizableMessage message =
+                        INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+                throw new UnsupportedCallbackException(callback, message.toString());
+            }
+        }
+    }
 
-  /**
-   * Creates a new abstract SASL bind client. The next bind request will be a
-   * copy of the provided initial bind request which should be updated in
-   * subsequent bind requests forming part of this authentication.
-   *
-   * @param initialBindRequest
-   *          The initial bind request.
-   */
-  SASLBindClientImpl(final SASLBindRequest initialBindRequest)
-  {
-    super(initialBindRequest);
-    this.saslMechanism = initialBindRequest.getSASLMechanism();
-  }
-
-
-
-  public final void handle(final Callback[] callbacks) throws IOException,
-      UnsupportedCallbackException
-  {
-    for (final Callback callback : callbacks)
-    {
-      if (callback instanceof NameCallback)
-      {
-        handle((NameCallback) callback);
-      }
-      else if (callback instanceof PasswordCallback)
-      {
-        handle((PasswordCallback) callback);
-      }
-      else if (callback instanceof AuthorizeCallback)
-      {
-        handle((AuthorizeCallback) callback);
-      }
-      else if (callback instanceof RealmCallback)
-      {
-        handle((RealmCallback) callback);
-      }
-      else if (callback instanceof RealmChoiceCallback)
-      {
-        handle((RealmChoiceCallback) callback);
-      }
-      else if (callback instanceof ChoiceCallback)
-      {
-        handle((ChoiceCallback) callback);
-      }
-      else if (callback instanceof ConfirmationCallback)
-      {
-        handle((ConfirmationCallback) callback);
-      }
-      else if (callback instanceof LanguageCallback)
-      {
-        handle((LanguageCallback) callback);
-      }
-      else if (callback instanceof TextInputCallback)
-      {
-        handle((TextInputCallback) callback);
-      }
-      else if (callback instanceof TextOutputCallback)
-      {
-        handle((TextOutputCallback) callback);
-      }
-      else
-      {
-        final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-            .get(saslMechanism, String.valueOf(callback));
+    void handle(final AuthorizeCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
         throw new UnsupportedCallbackException(callback, message.toString());
-      }
-    }
-  }
-
-
-
-  void handle(final AuthorizeCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final ChoiceCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final ConfirmationCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final LanguageCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final NameCallback callback) throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final PasswordCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final RealmCallback callback) throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final RealmChoiceCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final TextInputCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  void handle(final TextOutputCallback callback)
-      throws UnsupportedCallbackException
-  {
-    final org.forgerock.i18n.LocalizableMessage message = INFO_SASL_UNSUPPORTED_CALLBACK
-        .get(saslMechanism, String.valueOf(callback));
-    throw new UnsupportedCallbackException(callback, message.toString());
-  }
-
-
-
-  /**
-   * Sets the SASL credentials to be used in the next bind request.
-   *
-   * @param saslCredentials
-   *          The SASL credentials to be used in the next bind request.
-   * @return A reference to this SASL bind client.
-   */
-  final BindClient setNextSASLCredentials(final byte[] saslCredentials)
-  {
-    final ByteString value = (saslCredentials != null) ? ByteString
-        .wrap(saslCredentials) : null;
-    return setNextSASLCredentials(value);
-  }
-
-
-
-  /**
-   * Sets the SASL credentials to be used in the next bind request.
-   *
-   * @param saslCredentials
-   *          The SASL credentials to be used in the next bind request.
-   * @return A reference to this SASL bind client.
-   */
-  final BindClient setNextSASLCredentials(final ByteString saslCredentials)
-  {
-    final ByteStringBuilder builder = new ByteStringBuilder();
-    final ASN1Writer writer = ASN1.getWriter(builder);
-
-    try
-    {
-      writer.writeOctetString(saslMechanism);
-      if (saslCredentials != null)
-      {
-        writer.writeOctetString(saslCredentials);
-      }
-    }
-    catch (final IOException ioe)
-    {
-      throw new RuntimeException("Error encoding SaslCredentials");
     }
 
-    return setNextAuthenticationValue(builder.toByteString().toByteArray());
-  }
+    void handle(final ChoiceCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final ConfirmationCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final LanguageCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final NameCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final PasswordCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final RealmCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final RealmChoiceCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final TextInputCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    void handle(final TextOutputCallback callback) throws UnsupportedCallbackException {
+        final org.forgerock.i18n.LocalizableMessage message =
+                INFO_SASL_UNSUPPORTED_CALLBACK.get(saslMechanism, String.valueOf(callback));
+        throw new UnsupportedCallbackException(callback, message.toString());
+    }
+
+    /**
+     * Sets the SASL credentials to be used in the next bind request.
+     *
+     * @param saslCredentials
+     *            The SASL credentials to be used in the next bind request.
+     * @return A reference to this SASL bind client.
+     */
+    final BindClient setNextSASLCredentials(final byte[] saslCredentials) {
+        final ByteString value =
+                (saslCredentials != null) ? ByteString.wrap(saslCredentials) : null;
+        return setNextSASLCredentials(value);
+    }
+
+    /**
+     * Sets the SASL credentials to be used in the next bind request.
+     *
+     * @param saslCredentials
+     *            The SASL credentials to be used in the next bind request.
+     * @return A reference to this SASL bind client.
+     */
+    final BindClient setNextSASLCredentials(final ByteString saslCredentials) {
+        final ByteStringBuilder builder = new ByteStringBuilder();
+        final ASN1Writer writer = ASN1.getWriter(builder);
+
+        try {
+            writer.writeOctetString(saslMechanism);
+            if (saslCredentials != null) {
+                writer.writeOctetString(saslCredentials);
+            }
+        } catch (final IOException ioe) {
+            throw new RuntimeException("Error encoding SaslCredentials");
+        }
+
+        return setNextAuthenticationValue(builder.toByteString().toByteArray());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java
index 4787a45..0bf01fb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,8 +34,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The SASL authentication method of the Bind operation allows clients to
  * authenticate using one of the SASL authentication methods defined in RFC
@@ -46,62 +41,50 @@
  * <p>
  * <TODO>finish doc.
  */
-public interface SASLBindRequest extends BindRequest
-{
-  /**
-   * {@inheritDoc}
-   */
-  SASLBindRequest addControl(Control control);
+public interface SASLBindRequest extends BindRequest {
+    /**
+     * {@inheritDoc}
+     */
+    SASLBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
+    /**
+     * Returns the authentication mechanism identifier for this SASL bind
+     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the name of the Directory object that the client wishes to bind
+     * as, which is always the empty string for SASL authentication.
+     *
+     * @return The name of the Directory object that the client wishes to bind
+     *         as.
+     */
+    String getName();
 
-  /**
-   * Returns the authentication mechanism identifier for this SASL bind request
-   * as defined by the LDAP protocol, which is always {@code 0xA3}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the name of the Directory object that the client wishes to bind as,
-   * which is always the empty string for SASL authentication.
-   *
-   * @return The name of the Directory object that the client wishes to bind as.
-   */
-  String getName();
-
-
-
-  /**
-   * Returns the SASL mechanism for this SASL bind request.
-   *
-   * @return The SASL mechanism for this bind request.
-   */
-  String getSASLMechanism();
+    /**
+     * Returns the SASL mechanism for this SASL bind request.
+     *
+     * @return The SASL mechanism for this bind request.
+     */
+    String getSASLMechanism();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java
index 0e85f09..bf6e98b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,18 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Search operation is used to request a server to return, subject to access
  * controls and other restrictions, a set of entries matching a complex search
@@ -46,302 +46,263 @@
  * entries immediately subordinate to a particular entry, or from a whole
  * subtree of entries.
  */
-public interface SearchRequest extends Request
-{
-  /**
-   * Adds the provided attribute name(s) to the list of attributes to be
-   * included with each entry that matches the search criteria. Attributes that
-   * are sub-types of listed attributes are implicitly included.
-   *
-   * @param attributeDescriptions
-   *          The name(s) of the attribute to be included with each entry.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit attribute names to be
-   *           added.
-   * @throws NullPointerException
-   *           If {@code attributeDescriptions} was {@code null}.
-   */
-  SearchRequest addAttribute(String... attributeDescriptions);
+public interface SearchRequest extends Request {
+    /**
+     * Adds the provided attribute name(s) to the list of attributes to be
+     * included with each entry that matches the search criteria. Attributes
+     * that are sub-types of listed attributes are implicitly included.
+     *
+     * @param attributeDescriptions
+     *            The name(s) of the attribute to be included with each entry.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit attribute names to be
+     *             added.
+     * @throws NullPointerException
+     *             If {@code attributeDescriptions} was {@code null}.
+     */
+    SearchRequest addAttribute(String... attributeDescriptions);
 
+    /**
+     * {@inheritDoc}
+     */
+    SearchRequest addControl(Control control);
 
+    /**
+     * Returns a {@code List} containing the list of attributes to be included
+     * with each entry that matches the search criteria. Attributes that are
+     * sub-types of listed attributes are implicitly included. The returned
+     * {@code List} may be modified if permitted by this search request.
+     *
+     * @return A {@code List} containing the list of attributes.
+     */
+    List<String> getAttributes();
 
-  /**
-   * {@inheritDoc}
-   */
-  SearchRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns an indication as to whether or not alias entries are to be
+     * dereferenced during the search.
+     *
+     * @return The alias dereferencing policy.
+     */
+    DereferenceAliasesPolicy getDereferenceAliasesPolicy();
 
-  /**
-   * Returns a {@code List} containing the list of attributes to be included
-   * with each entry that matches the search criteria. Attributes that are
-   * sub-types of listed attributes are implicitly included. The returned
-   * {@code List} may be modified if permitted by this search request.
-   *
-   * @return A {@code List} containing the list of attributes.
-   */
-  List<String> getAttributes();
+    /**
+     * Returns the filter that defines the conditions that must be fulfilled in
+     * order for an entry to be returned.
+     *
+     * @return The search filter.
+     */
+    Filter getFilter();
 
+    /**
+     * Returns the distinguished name of the base entry relative to which the
+     * search is to be performed.
+     *
+     * @return The distinguished name of the base entry.
+     */
+    DN getName();
 
+    /**
+     * Returns the scope of the search.
+     *
+     * @return The search scope.
+     */
+    SearchScope getScope();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the size limit that should be used in order to restrict the
+     * maximum number of entries returned by the search.
+     * <p>
+     * A value of zero (the default) in this field indicates that no
+     * client-requested size limit restrictions are in effect. Servers may also
+     * enforce a maximum number of entries to return.
+     *
+     * @return The size limit that should be used in order to restrict the
+     *         maximum number of entries returned by the search.
+     */
+    int getSizeLimit();
 
+    /**
+     * Returns the time limit that should be used in order to restrict the
+     * maximum time (in seconds) allowed for the search.
+     * <p>
+     * A value of zero (the default) in this field indicates that no
+     * client-requested time limit restrictions are in effect for the search.
+     * Servers may also enforce a maximum time limit for the search.
+     *
+     * @return The time limit that should be used in order to restrict the
+     *         maximum time (in seconds) allowed for the search.
+     */
+    int getTimeLimit();
 
+    /**
+     * Indicates whether search results are to contain both attribute
+     * descriptions and values, or just attribute descriptions.
+     *
+     * @return {@code true} if only attribute descriptions (and not values) are
+     *         to be returned, or {@code false} (the default) if both attribute
+     *         descriptions and values are to be returned.
+     */
+    boolean isTypesOnly();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Sets the alias dereferencing policy to be used during the search.
+     *
+     * @param policy
+     *            The alias dereferencing policy to be used during the search.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the alias
+     *             dereferencing policy to be set.
+     * @throws NullPointerException
+     *             If {@code policy} was {@code null}.
+     */
+    SearchRequest setDereferenceAliasesPolicy(DereferenceAliasesPolicy policy);
 
+    /**
+     * Sets the filter that defines the conditions that must be fulfilled in
+     * order for an entry to be returned.
+     *
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the filter to be set.
+     * @throws NullPointerException
+     *             If {@code filter} was {@code null}.
+     */
+    SearchRequest setFilter(Filter filter);
 
+    /**
+     * Sets the filter that defines the conditions that must be fulfilled in
+     * order for an entry to be returned.
+     *
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the filter to be set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code filter} is not a valid LDAP string representation
+     *             of a filter.
+     * @throws NullPointerException
+     *             If {@code filter} was {@code null}.
+     */
+    SearchRequest setFilter(String filter);
 
-  /**
-   * Returns an indication as to whether or not alias entries are to be
-   * dereferenced during the search.
-   *
-   * @return The alias dereferencing policy.
-   */
-  DereferenceAliasesPolicy getDereferenceAliasesPolicy();
+    /**
+     * Sets the distinguished name of the base entry relative to which the
+     * search is to be performed.
+     *
+     * @param dn
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    SearchRequest setName(DN dn);
 
+    /**
+     * Sets the distinguished name of the base entry relative to which the
+     * search is to be performed.
+     *
+     * @param dn
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @return This search request.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code dn} could not be decoded using the default schema.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code dn} was {@code null}.
+     */
+    SearchRequest setName(String dn);
 
+    /**
+     * Sets the scope of the search.
+     *
+     * @param scope
+     *            The scope of the search.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the scope to be set.
+     * @throws NullPointerException
+     *             If {@code scope} was {@code null}.
+     */
+    SearchRequest setScope(SearchScope scope);
 
-  /**
-   * Returns the filter that defines the conditions that must be fulfilled in
-   * order for an entry to be returned.
-   *
-   * @return The search filter.
-   */
-  Filter getFilter();
+    /**
+     * Sets the size limit that should be used in order to restrict the maximum
+     * number of entries returned by the search.
+     * <p>
+     * A value of zero (the default) in this field indicates that no
+     * client-requested size limit restrictions are in effect. Servers may also
+     * enforce a maximum number of entries to return.
+     *
+     * @param limit
+     *            The size limit that should be used in order to restrict the
+     *            maximum number of entries returned by the search.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the size limit to be
+     *             set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code limit} was negative.
+     */
+    SearchRequest setSizeLimit(int limit);
 
+    /**
+     * Sets the time limit that should be used in order to restrict the maximum
+     * time (in seconds) allowed for the search.
+     * <p>
+     * A value of zero (the default) in this field indicates that no
+     * client-requested time limit restrictions are in effect for the search.
+     * Servers may also enforce a maximum time limit for the search.
+     *
+     * @param limit
+     *            The time limit that should be used in order to restrict the
+     *            maximum time (in seconds) allowed for the search.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the time limit to be
+     *             set.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code limit} was negative.
+     */
+    SearchRequest setTimeLimit(int limit);
 
-
-  /**
-   * Returns the distinguished name of the base entry relative to which the
-   * search is to be performed.
-   *
-   * @return The distinguished name of the base entry.
-   */
-  DN getName();
-
-
-
-  /**
-   * Returns the scope of the search.
-   *
-   * @return The search scope.
-   */
-  SearchScope getScope();
-
-
-
-  /**
-   * Returns the size limit that should be used in order to restrict the maximum
-   * number of entries returned by the search.
-   * <p>
-   * A value of zero (the default) in this field indicates that no
-   * client-requested size limit restrictions are in effect. Servers may also
-   * enforce a maximum number of entries to return.
-   *
-   * @return The size limit that should be used in order to restrict the maximum
-   *         number of entries returned by the search.
-   */
-  int getSizeLimit();
-
-
-
-  /**
-   * Returns the time limit that should be used in order to restrict the maximum
-   * time (in seconds) allowed for the search.
-   * <p>
-   * A value of zero (the default) in this field indicates that no
-   * client-requested time limit restrictions are in effect for the search.
-   * Servers may also enforce a maximum time limit for the search.
-   *
-   * @return The time limit that should be used in order to restrict the maximum
-   *         time (in seconds) allowed for the search.
-   */
-  int getTimeLimit();
-
-
-
-  /**
-   * Indicates whether search results are to contain both attribute descriptions
-   * and values, or just attribute descriptions.
-   *
-   * @return {@code true} if only attribute descriptions (and not values) are to
-   *         be returned, or {@code false} (the default) if both attribute
-   *         descriptions and values are to be returned.
-   */
-  boolean isTypesOnly();
-
-
-
-  /**
-   * Sets the alias dereferencing policy to be used during the search.
-   *
-   * @param policy
-   *          The alias dereferencing policy to be used during the search.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the alias dereferencing
-   *           policy to be set.
-   * @throws NullPointerException
-   *           If {@code policy} was {@code null}.
-   */
-  SearchRequest setDereferenceAliasesPolicy(DereferenceAliasesPolicy policy);
-
-
-
-  /**
-   * Sets the filter that defines the conditions that must be fulfilled in order
-   * for an entry to be returned.
-   *
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the filter to be set.
-   * @throws NullPointerException
-   *           If {@code filter} was {@code null}.
-   */
-  SearchRequest setFilter(Filter filter);
-
-
-
-  /**
-   * Sets the filter that defines the conditions that must be fulfilled in order
-   * for an entry to be returned.
-   *
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the filter to be set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code filter} is not a valid LDAP string representation of a
-   *           filter.
-   * @throws NullPointerException
-   *           If {@code filter} was {@code null}.
-   */
-  SearchRequest setFilter(String filter);
-
-
-
-  /**
-   * Sets the distinguished name of the base entry relative to which the search
-   * is to be performed.
-   *
-   * @param dn
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  SearchRequest setName(DN dn);
-
-
-
-  /**
-   * Sets the distinguished name of the base entry relative to which the search
-   * is to be performed.
-   *
-   * @param dn
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @return This search request.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code dn} could not be decoded using the default schema.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the distinguished name to
-   *           be set.
-   * @throws NullPointerException
-   *           If {@code dn} was {@code null}.
-   */
-  SearchRequest setName(String dn);
-
-
-
-  /**
-   * Sets the scope of the search.
-   *
-   * @param scope
-   *          The scope of the search.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the scope to be set.
-   * @throws NullPointerException
-   *           If {@code scope} was {@code null}.
-   */
-  SearchRequest setScope(SearchScope scope);
-
-
-
-  /**
-   * Sets the size limit that should be used in order to restrict the maximum
-   * number of entries returned by the search.
-   * <p>
-   * A value of zero (the default) in this field indicates that no
-   * client-requested size limit restrictions are in effect. Servers may also
-   * enforce a maximum number of entries to return.
-   *
-   * @param limit
-   *          The size limit that should be used in order to restrict the
-   *          maximum number of entries returned by the search.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the size limit to be set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code limit} was negative.
-   */
-  SearchRequest setSizeLimit(int limit);
-
-
-
-  /**
-   * Sets the time limit that should be used in order to restrict the maximum
-   * time (in seconds) allowed for the search.
-   * <p>
-   * A value of zero (the default) in this field indicates that no
-   * client-requested time limit restrictions are in effect for the search.
-   * Servers may also enforce a maximum time limit for the search.
-   *
-   * @param limit
-   *          The time limit that should be used in order to restrict the
-   *          maximum time (in seconds) allowed for the search.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the time limit to be set.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code limit} was negative.
-   */
-  SearchRequest setTimeLimit(int limit);
-
-
-
-  /**
-   * Specifies whether search results are to contain both attribute descriptions
-   * and values, or just attribute descriptions.
-   *
-   * @param typesOnly
-   *          {@code true} if only attribute descriptions (and not values) are
-   *          to be returned, or {@code false} (the default) if both attribute
-   *          descriptions and values are to be returned.
-   * @return This search request.
-   * @throws UnsupportedOperationException
-   *           If this search request does not permit the types-only parameter
-   *           to be set.
-   */
-  SearchRequest setTypesOnly(boolean typesOnly);
+    /**
+     * Specifies whether search results are to contain both attribute
+     * descriptions and values, or just attribute descriptions.
+     *
+     * @param typesOnly
+     *            {@code true} if only attribute descriptions (and not values)
+     *            are to be returned, or {@code false} (the default) if both
+     *            attribute descriptions and values are to be returned.
+     * @return This search request.
+     * @throws UnsupportedOperationException
+     *             If this search request does not permit the types-only
+     *             parameter to be set.
+     */
+    SearchRequest setTypesOnly(boolean typesOnly);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java
index a3f4eac..1deef92 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
@@ -40,325 +37,252 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Search request implementation.
  */
-final class SearchRequestImpl extends AbstractRequestImpl<SearchRequest>
-    implements SearchRequest
-{
+final class SearchRequestImpl extends AbstractRequestImpl<SearchRequest> implements SearchRequest {
 
-  private final List<String> attributes = new LinkedList<String>();
+    private final List<String> attributes = new LinkedList<String>();
 
-  private DN name;
+    private DN name;
 
-  private DereferenceAliasesPolicy dereferenceAliasesPolicy =
-      DereferenceAliasesPolicy.NEVER;
+    private DereferenceAliasesPolicy dereferenceAliasesPolicy = DereferenceAliasesPolicy.NEVER;
 
-  private Filter filter;
+    private Filter filter;
 
-  private SearchScope scope;
+    private SearchScope scope;
 
-  private int sizeLimit = 0;
+    private int sizeLimit = 0;
 
-  private int timeLimit = 0;
+    private int timeLimit = 0;
 
-  private boolean typesOnly = false;
+    private boolean typesOnly = false;
 
-
-
-  /**
-   * Creates a new search request using the provided distinguished name, scope,
-   * and filter, decoded using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the base entry relative to which the
-   *          search is to be performed.
-   * @param scope
-   *          The scope of the search.
-   * @param filter
-   *          The filter that defines the conditions that must be fulfilled in
-   *          order for an entry to be returned.
-   * @throws NullPointerException
-   *           If the {@code name}, {@code scope}, or {@code filter} were
-   *           {@code null}.
-   */
-  SearchRequestImpl(final DN name, final SearchScope scope, final Filter filter)
-  {
-    this.name = name;
-    this.scope = scope;
-    this.filter = filter;
-  }
-
-
-
-  /**
-   * Creates a new search request that is an exact copy of the provided
-   * request.
-   *
-   * @param searchRequest
-   *          The search request to be copied.
-   * @throws NullPointerException
-   *           If {@code searchRequest} was {@code null} .
-   */
-  SearchRequestImpl(final SearchRequest searchRequest)
-  {
-    super(searchRequest);
-    this.attributes.addAll(searchRequest.getAttributes());
-    this.name = searchRequest.getName();
-    this.dereferenceAliasesPolicy = searchRequest.getDereferenceAliasesPolicy();
-    this.filter = searchRequest.getFilter();
-    this.scope = searchRequest.getScope();
-    this.sizeLimit = searchRequest.getSizeLimit();
-    this.timeLimit = searchRequest.getTimeLimit();
-    this.typesOnly = searchRequest.isTypesOnly();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest addAttribute(final String... attributeDescriptions)
-  {
-    for (String attributeDescription : attributeDescriptions)
-    {
-      attributes.add(Validator.ensureNotNull(attributeDescription));
+    /**
+     * Creates a new search request using the provided distinguished name,
+     * scope, and filter, decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the base entry relative to which the
+     *            search is to be performed.
+     * @param scope
+     *            The scope of the search.
+     * @param filter
+     *            The filter that defines the conditions that must be fulfilled
+     *            in order for an entry to be returned.
+     * @throws NullPointerException
+     *             If the {@code name}, {@code scope}, or {@code filter} were
+     *             {@code null}.
+     */
+    SearchRequestImpl(final DN name, final SearchScope scope, final Filter filter) {
+        this.name = name;
+        this.scope = scope;
+        this.filter = filter;
     }
-    return this;
-  }
 
+    /**
+     * Creates a new search request that is an exact copy of the provided
+     * request.
+     *
+     * @param searchRequest
+     *            The search request to be copied.
+     * @throws NullPointerException
+     *             If {@code searchRequest} was {@code null} .
+     */
+    SearchRequestImpl(final SearchRequest searchRequest) {
+        super(searchRequest);
+        this.attributes.addAll(searchRequest.getAttributes());
+        this.name = searchRequest.getName();
+        this.dereferenceAliasesPolicy = searchRequest.getDereferenceAliasesPolicy();
+        this.filter = searchRequest.getFilter();
+        this.scope = searchRequest.getScope();
+        this.sizeLimit = searchRequest.getSizeLimit();
+        this.timeLimit = searchRequest.getTimeLimit();
+        this.typesOnly = searchRequest.isTypesOnly();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest addAttribute(final String... attributeDescriptions) {
+        for (String attributeDescription : attributeDescriptions) {
+            attributes.add(Validator.ensureNotNull(attributeDescription));
+        }
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public List<String> getAttributes()
-  {
-    return attributes;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getAttributes() {
+        return attributes;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public DereferenceAliasesPolicy getDereferenceAliasesPolicy() {
+        return dereferenceAliasesPolicy;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Filter getFilter() {
+        return filter;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public DereferenceAliasesPolicy getDereferenceAliasesPolicy()
-  {
-    return dereferenceAliasesPolicy;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return name;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchScope getScope() {
+        return scope;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getSizeLimit() {
+        return sizeLimit;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public Filter getFilter()
-  {
-    return filter;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public int getTimeLimit() {
+        return timeLimit;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isTypesOnly() {
+        return typesOnly;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setDereferenceAliasesPolicy(final DereferenceAliasesPolicy policy) {
+        Validator.ensureNotNull(policy);
 
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return name;
-  }
+        this.dereferenceAliasesPolicy = policy;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setFilter(final Filter filter) {
+        Validator.ensureNotNull(filter);
 
+        this.filter = filter;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public SearchScope getScope()
-  {
-    return scope;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setFilter(final String filter) {
+        this.filter = Filter.valueOf(filter);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setName(final DN dn) {
+        Validator.ensureNotNull(dn);
 
+        this.name = dn;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public int getSizeLimit()
-  {
-    return sizeLimit;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setName(final String dn) {
+        Validator.ensureNotNull(dn);
 
+        this.name = DN.valueOf(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setScope(final SearchScope scope) {
+        Validator.ensureNotNull(scope);
 
-  /**
-   * {@inheritDoc}
-   */
-  public int getTimeLimit()
-  {
-    return timeLimit;
-  }
+        this.scope = scope;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setSizeLimit(final int limit) {
+        Validator.ensureTrue(limit >= 0, "negative size limit");
 
+        this.sizeLimit = limit;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isTypesOnly()
-  {
-    return typesOnly;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setTimeLimit(final int limit) {
+        Validator.ensureTrue(limit >= 0, "negative time limit");
 
+        this.timeLimit = limit;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchRequest setTypesOnly(final boolean typesOnly) {
+        this.typesOnly = typesOnly;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setDereferenceAliasesPolicy(
-      final DereferenceAliasesPolicy policy)
-  {
-    Validator.ensureNotNull(policy);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SearchRequest(name=");
+        builder.append(getName());
+        builder.append(", scope=");
+        builder.append(getScope());
+        builder.append(", dereferenceAliasesPolicy=");
+        builder.append(getDereferenceAliasesPolicy());
+        builder.append(", sizeLimit=");
+        builder.append(getSizeLimit());
+        builder.append(", timeLimit=");
+        builder.append(getTimeLimit());
+        builder.append(", typesOnly=");
+        builder.append(isTypesOnly());
+        builder.append(", filter=");
+        builder.append(getFilter());
+        builder.append(", attributes=");
+        builder.append(getAttributes());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-    this.dereferenceAliasesPolicy = policy;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setFilter(final Filter filter)
-  {
-    Validator.ensureNotNull(filter);
-
-    this.filter = filter;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setFilter(final String filter)
-  {
-    this.filter = Filter.valueOf(filter);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setName(final DN dn)
-  {
-    Validator.ensureNotNull(dn);
-
-    this.name = dn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setName(final String dn)
-  {
-    Validator.ensureNotNull(dn);
-
-    this.name = DN.valueOf(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setScope(final SearchScope scope)
-  {
-    Validator.ensureNotNull(scope);
-
-    this.scope = scope;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setSizeLimit(final int limit)
-  {
-    Validator.ensureTrue(limit >= 0, "negative size limit");
-
-    this.sizeLimit = limit;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setTimeLimit(final int limit)
-  {
-    Validator.ensureTrue(limit >= 0, "negative time limit");
-
-    this.timeLimit = limit;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchRequest setTypesOnly(final boolean typesOnly)
-  {
-    this.typesOnly = typesOnly;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SearchRequest(name=");
-    builder.append(getName());
-    builder.append(", scope=");
-    builder.append(getScope());
-    builder.append(", dereferenceAliasesPolicy=");
-    builder.append(getDereferenceAliasesPolicy());
-    builder.append(", sizeLimit=");
-    builder.append(getSizeLimit());
-    builder.append(", timeLimit=");
-    builder.append(getTimeLimit());
-    builder.append(", typesOnly=");
-    builder.append(isTypesOnly());
-    builder.append(", filter=");
-    builder.append(getFilter());
-    builder.append(", attributes=");
-    builder.append(getAttributes());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  SearchRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    SearchRequest getThis() {
+        return this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java
index 2b72f3f..e86f9dc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,8 +35,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The simple authentication method of the Bind Operation provides three
  * authentication mechanisms:
@@ -52,134 +47,115 @@
  * a name and a password.
  * </ul>
  */
-public interface SimpleBindRequest extends BindRequest
-{
-  /**
-   * {@inheritDoc}
-   */
-  SimpleBindRequest addControl(Control control);
+public interface SimpleBindRequest extends BindRequest {
+    /**
+     * {@inheritDoc}
+     */
+    SimpleBindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindClient createBindClient(String serverName) throws ErrorResultException;
 
+    /**
+     * Returns the authentication mechanism identifier for this simple bind
+     * request as defined by the LDAP protocol, which is always {@code 0x80}.
+     *
+     * @return The authentication mechanism identifier.
+     */
+    byte getAuthenticationType();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindClient createBindClient(String serverName) throws ErrorResultException;
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getName();
 
-  /**
-   * Returns the authentication mechanism identifier for this simple bind
-   * request as defined by the LDAP protocol, which is always {@code 0x80}.
-   *
-   * @return The authentication mechanism identifier.
-   */
-  byte getAuthenticationType();
+    /**
+     * Returns the password of the Directory object that the client wishes to
+     * bind as. The password may be empty (but never {@code null}) when used for
+     * of anonymous or unauthenticated binds.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * returned password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @return The password of the Directory object that the client wishes to
+     *         bind as.
+     */
+    byte[] getPassword();
 
+    /**
+     * Sets the name of the Directory object that the client wishes to bind as.
+     * The name may be empty (but never {@code null} when used for of anonymous
+     * binds, or when using SASL authentication. The server shall not
+     * dereference any aliases in locating the named object.
+     * <p>
+     * The LDAP protocol defines the Bind name to be a distinguished name,
+     * however some LDAP implementations have relaxed this constraint and allow
+     * other identities to be used, such as the user's email address.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as.
+     * @return This bind request.
+     * @throws UnsupportedOperationException
+     *             If this bind request does not permit the distinguished name
+     *             to be set.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    SimpleBindRequest setName(String name);
 
+    /**
+     * Sets the password of the Directory object that the client wishes to bind
+     * as. The password may be empty (but never {@code null}) when used for of
+     * anonymous or unauthenticated binds.
+     * <p>
+     * Unless otherwise indicated, implementations will store a reference to the
+     * provided password byte array, allowing applications to overwrite the
+     * password after it has been used.
+     *
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @return This simple bind request.
+     * @throws UnsupportedOperationException
+     *             If this simple bind request does not permit the password to
+     *             be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    SimpleBindRequest setPassword(byte[] password);
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getName();
-
-
-
-  /**
-   * Returns the password of the Directory object that the client wishes to bind
-   * as. The password may be empty (but never {@code null}) when used for of
-   * anonymous or unauthenticated binds.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * returned password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @return The password of the Directory object that the client wishes to bind
-   *         as.
-   */
-  byte[] getPassword();
-
-
-
-  /**
-   * Sets the name of the Directory object that the client wishes to bind as.
-   * The name may be empty (but never {@code null} when used for of anonymous
-   * binds, or when using SASL authentication. The server shall not dereference
-   * any aliases in locating the named object.
-   * <p>
-   * The LDAP protocol defines the Bind name to be a distinguished name, however
-   * some LDAP implementations have relaxed this constraint and allow other
-   * identities to be used, such as the user's email address.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind
-   *          as.
-   * @return This bind request.
-   * @throws UnsupportedOperationException
-   *           If this bind request does not permit the distinguished name to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  SimpleBindRequest setName(String name);
-
-
-
-  /**
-   * Sets the password of the Directory object that the client wishes to bind
-   * as. The password may be empty (but never {@code null}) when used for of
-   * anonymous or unauthenticated binds.
-   * <p>
-   * Unless otherwise indicated, implementations will store a reference to the
-   * provided password byte array, allowing applications to overwrite the
-   * password after it has been used.
-   *
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty.
-   * @return This simple bind request.
-   * @throws UnsupportedOperationException
-   *           If this simple bind request does not permit the password to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  SimpleBindRequest setPassword(byte[] password);
-
-
-
-  /**
-   * Sets the password of the Directory object that the client wishes to bind
-   * as. The password will be converted to a UTF-8 octet string. The password
-   * may be empty (but never {@code null}) when used for of anonymous or
-   * unauthenticated binds. Subsequent modifications to the {@code password}
-   * array will not alter this bind request.
-   *
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty.
-   * @return This simple bind request.
-   * @throws UnsupportedOperationException
-   *           If this simple bind request does not permit the password to be
-   *           set.
-   * @throws NullPointerException
-   *           If {@code password} was {@code null}.
-   */
-  SimpleBindRequest setPassword(char[] password);
+    /**
+     * Sets the password of the Directory object that the client wishes to bind
+     * as. The password will be converted to a UTF-8 octet string. The password
+     * may be empty (but never {@code null}) when used for of anonymous or
+     * unauthenticated binds. Subsequent modifications to the {@code password}
+     * array will not alter this bind request.
+     *
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @return This simple bind request.
+     * @throws UnsupportedOperationException
+     *             If this simple bind request does not permit the password to
+     *             be set.
+     * @throws NullPointerException
+     *             If {@code password} was {@code null}.
+     */
+    SimpleBindRequest setPassword(char[] password);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java
index e56cc05..d0497e4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,9 +27,7 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import static com.forgerock.opendj.ldap.LDAPConstants.*;
+import static com.forgerock.opendj.ldap.LDAPConstants.TYPE_AUTHENTICATION_SIMPLE;
 
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ErrorResultException;
@@ -38,147 +35,113 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Simple bind request implementation.
  */
-final class SimpleBindRequestImpl extends
-    AbstractBindRequest<SimpleBindRequest> implements SimpleBindRequest
-{
-  private byte[] password = new byte[0];
+final class SimpleBindRequestImpl extends AbstractBindRequest<SimpleBindRequest> implements
+        SimpleBindRequest {
+    private byte[] password = new byte[0];
 
-  private String name = "".intern();
+    private String name = "".intern();
 
+    /**
+     * Creates a new simple bind request having the provided name and password
+     * suitable for name/password authentication.
+     *
+     * @param name
+     *            The name of the Directory object that the client wishes to
+     *            bind as, which may be empty.
+     * @param password
+     *            The password of the Directory object that the client wishes to
+     *            bind as, which may be empty indicating that an unauthenticated
+     *            bind is to be performed.
+     * @throws NullPointerException
+     *             If {@code name} or {@code password} was {@code null}.
+     */
+    SimpleBindRequestImpl(final String name, final byte[] password) {
+        this.name = name;
+        this.password = password;
+    }
 
+    /**
+     * Creates a new simple bind request that is an exact copy of the provided
+     * request.
+     *
+     * @param simpleBindRequest
+     *            The simple bind request to be copied.
+     * @throws NullPointerException
+     *             If {@code simpleBindRequest} was {@code null} .
+     */
+    SimpleBindRequestImpl(final SimpleBindRequest simpleBindRequest) {
+        super(simpleBindRequest);
+        this.name = simpleBindRequest.getName();
+        this.password = StaticUtils.copyOfBytes(simpleBindRequest.getPassword());
+    }
 
-  /**
-   * Creates a new simple bind request having the provided name and password
-   * suitable for name/password authentication.
-   *
-   * @param name
-   *          The name of the Directory object that the client wishes to bind
-   *          as, which may be empty.
-   * @param password
-   *          The password of the Directory object that the client wishes to
-   *          bind as, which may be empty indicating that an unauthenticated
-   *          bind is to be performed.
-   * @throws NullPointerException
-   *           If {@code name} or {@code password} was {@code null}.
-   */
-  SimpleBindRequestImpl(final String name, final byte[] password)
-  {
-    this.name = name;
-    this.password = password;
-  }
+    public BindClient createBindClient(final String serverName) throws ErrorResultException {
+        return new BindClientImpl(this).setNextAuthenticationValue(password);
+    }
 
+    public byte getAuthenticationType() {
+        return TYPE_AUTHENTICATION_SIMPLE;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
 
-  /**
-   * Creates a new simple bind request that is an exact copy of the
-   * provided request.
-   *
-   * @param simpleBindRequest
-   *          The simple bind request to be copied.
-   * @throws NullPointerException
-   *           If {@code simpleBindRequest} was {@code null} .
-   */
-  SimpleBindRequestImpl(final SimpleBindRequest simpleBindRequest)
-  {
-    super(simpleBindRequest);
-    this.name = simpleBindRequest.getName();
-    this.password = StaticUtils.copyOfBytes(simpleBindRequest.getPassword());
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getPassword() {
+        return password;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SimpleBindRequest setName(final String name) {
+        Validator.ensureNotNull(name);
+        this.name = name;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SimpleBindRequest setPassword(final byte[] password) {
+        Validator.ensureNotNull(password);
+        this.password = password;
+        return this;
+    }
 
-  public BindClient createBindClient(final String serverName)
-      throws ErrorResultException
-  {
-    return new BindClientImpl(this).setNextAuthenticationValue(password);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SimpleBindRequest setPassword(final char[] password) {
+        Validator.ensureNotNull(password);
+        this.password = StaticUtils.getBytes(password);
+        return this;
+    }
 
-
-
-  public byte getAuthenticationType()
-  {
-    return TYPE_AUTHENTICATION_SIMPLE;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public byte[] getPassword()
-  {
-    return password;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SimpleBindRequest setName(final String name)
-  {
-    Validator.ensureNotNull(name);
-    this.name = name;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SimpleBindRequest setPassword(final byte[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SimpleBindRequest setPassword(final char[] password)
-  {
-    Validator.ensureNotNull(password);
-    this.password = StaticUtils.getBytes(password);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SimpleBindRequest(name=");
-    builder.append(getName());
-    builder.append(", authentication=simple");
-    builder.append(", password=");
-    builder.append(ByteString.wrap(getPassword()));
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SimpleBindRequest(name=");
+        builder.append(getName());
+        builder.append(", authentication=simple");
+        builder.append(", password=");
+        builder.append(ByteString.wrap(getPassword()));
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java
index cf18773..3a8b218 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import javax.net.ssl.SSLContext;
@@ -42,8 +39,6 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 
-
-
 /**
  * The start TLS extended request as defined in RFC 4511. The Start Transport
  * Layer Security (StartTLS) operation's purpose is to initiate installation of
@@ -52,149 +47,124 @@
  * @see <a href="http://tools.ietf.org/html/rfc4511">RFC 4511 - Lightweight
  *      Directory Access Protocol (LDAP): The Protocol </a>
  */
-public interface StartTLSExtendedRequest extends
-    ExtendedRequest<ExtendedResult>
-{
+public interface StartTLSExtendedRequest extends ExtendedRequest<ExtendedResult> {
 
-  /**
-   * The OID for the start TLS extended operation request.
-   */
-  public static final String OID = "1.3.6.1.4.1.1466.20037";
+    /**
+     * The OID for the start TLS extended operation request.
+     */
+    public static final String OID = "1.3.6.1.4.1.1466.20037";
 
-  /**
-   * A decoder which can be used to decode start TLS extended operation
-   * requests.
-   */
-  public static final ExtendedRequestDecoder<StartTLSExtendedRequest,
-                                             ExtendedResult> DECODER =
-    new StartTLSExtendedRequestImpl.RequestDecoder();
+    /**
+     * A decoder which can be used to decode start TLS extended operation
+     * requests.
+     */
+    public static final ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult> DECODER =
+            new StartTLSExtendedRequestImpl.RequestDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    StartTLSExtendedRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  StartTLSExtendedRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResultDecoder<ExtendedResult> getResultDecoder();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the SSLContext that should be used when installing the TLS layer.
+     *
+     * @return The SSLContext that should be used when installing the TLS layer.
+     */
+    SSLContext getSSLContext();
 
+    /**
+     * Adds the protocol versions enabled for secure connections with the
+     * Directory Server.
+     *
+     * The protocols must be supported by the SSLContext specified in
+     * {@link #setSSLContext(SSLContext)}. Following a successful call to this
+     * method, only the protocols listed in the protocols parameter are enabled
+     * for use.
+     *
+     * @param protocols
+     *            Names of all the protocols to enable.
+     * @return A reference to this LDAP connection options.
+     * @throws UnsupportedOperationException
+     *             If this start TLS extended request does not permit the
+     *             enabled protocols to be set.
+     */
+    StartTLSExtendedRequest addEnabledProtocol(String... protocols);
 
+    /**
+     * Adds the cipher suites enabled for secure connections with the Directory
+     * Server.
+     *
+     * The suites must be supported by the SSLContext specified in
+     * {@link #setSSLContext(SSLContext)}. Following a successful call to this
+     * method, only the suites listed in the protocols parameter are enabled for
+     * use.
+     *
+     * @param suites
+     *            Names of all the suites to enable.
+     * @return A reference to this LDAP connection options.
+     * @throws UnsupportedOperationException
+     *             If this start TLS extended request does not permit the
+     *             enabled cipher suites to be set.
+     */
+    StartTLSExtendedRequest addEnabledCipherSuite(String... suites);
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Returns the names of the protocol versions which are currently enabled
+     * for secure connections with the Directory Server.
+     *
+     * @return an array of protocols or empty set if the default protocols are
+     *         to be used.
+     */
+    List<String> getEnabledProtocols();
 
+    /**
+     * Returns the names of the protocol versions which are currently enabled
+     * for secure connections with the Directory Server.
+     *
+     * @return an array of protocols or empty set if the default protocols are
+     *         to be used.
+     */
+    List<String> getEnabledCipherSuites();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResultDecoder<ExtendedResult> getResultDecoder();
-
-
-
-  /**
-   * Returns the SSLContext that should be used when installing the TLS layer.
-   *
-   * @return The SSLContext that should be used when installing the TLS layer.
-   */
-  SSLContext getSSLContext();
-
-
-
-  /**
-   * Adds the protocol versions enabled for secure connections with the
-   * Directory Server.
-   *
-   * The protocols must be supported by the SSLContext specified in
-   * {@link #setSSLContext(SSLContext)}. Following a successful call to
-   * this method, only the protocols listed in the protocols parameter are
-   * enabled for use.
-   *
-   * @param protocols Names of all the protocols to enable.
-   * @return A reference to this LDAP connection options.
-   * @throws UnsupportedOperationException
-   *           If this start TLS extended request does not permit the enabled
-   *           protocols to be set.
-   */
-  StartTLSExtendedRequest addEnabledProtocol(String... protocols);
-
-
-  /**
-   * Adds the cipher suites enabled for secure connections with the
-   * Directory Server.
-   *
-   * The suites must be supported by the SSLContext specified in
-   * {@link #setSSLContext(SSLContext)}. Following a successful call to
-   * this method, only the suites listed in the protocols parameter are
-   * enabled for use.
-   *
-   * @param suites Names of all the suites to enable.
-   * @return A reference to this LDAP connection options.
-   * @throws UnsupportedOperationException
-   *           If this start TLS extended request does not permit the enabled
-   *           cipher suites to be set.
-   */
-  StartTLSExtendedRequest addEnabledCipherSuite(String... suites);
-
-
-
-  /**
-   * Returns the names of the protocol versions which are currently enabled
-   * for secure connections with the Directory Server.
-   *
-   * @return an array of protocols or empty set if the default protocols
-   * are to be used.
-   */
-  List<String> getEnabledProtocols();
-
-
-
-  /**
-   * Returns the names of the protocol versions which are currently enabled
-   * for secure connections with the Directory Server.
-   *
-   * @return an array of protocols or empty set if the default protocols
-   * are to be used.
-   */
-  List<String> getEnabledCipherSuites();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Sets the SSLContext that should be used when installing the TLS layer.
-   *
-   * @param sslContext
-   *          The SSLContext that should be used when installing the TLS layer.
-   * @return This startTLS request.
-   */
-  StartTLSExtendedRequest setSSLContext(SSLContext sslContext);
+    /**
+     * Sets the SSLContext that should be used when installing the TLS layer.
+     *
+     * @param sslContext
+     *            The SSLContext that should be used when installing the TLS
+     *            layer.
+     * @return This startTLS request.
+     */
+    StartTLSExtendedRequest setSSLContext(SSLContext sslContext);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java
index edb0339..00a6df9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
@@ -40,245 +37,184 @@
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.responses.AbstractExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
 
 import com.forgerock.opendj.util.Validator;
 
-
 /**
  * Start TLS extended request implementation.
  */
 final class StartTLSExtendedRequestImpl extends
-    AbstractExtendedRequest<StartTLSExtendedRequest, ExtendedResult> implements
-    StartTLSExtendedRequest
-{
-  static final class RequestDecoder implements
-      ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult>
-  {
+        AbstractExtendedRequest<StartTLSExtendedRequest, ExtendedResult> implements
+        StartTLSExtendedRequest {
+    static final class RequestDecoder implements
+            ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult> {
 
-    public StartTLSExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      // TODO: Check the OID and that the value is not present.
-      final StartTLSExtendedRequest newRequest =
-          new StartTLSExtendedRequestImpl();
-      for (final Control control : request.getControls())
-      {
-        newRequest.addControl(control);
-      }
-      return newRequest;
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<ExtendedResult>
-  {
-    public GenericExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      return Responses.newGenericExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
+        public StartTLSExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request,
+                final DecodeOptions options) throws DecodeException {
+            // TODO: Check the OID and that the value is not present.
+            final StartTLSExtendedRequest newRequest = new StartTLSExtendedRequestImpl();
+            for (final Control control : request.getControls()) {
+                newRequest.addControl(control);
+            }
+            return newRequest;
+        }
     }
 
+    private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> {
+        public GenericExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
+        }
 
-
-    public ExtendedResult decodeExtendedResult(final ExtendedResult result,
-        final DecodeOptions options) throws DecodeException
-    {
-      // TODO: Should we check oid is NOT null and matches but
-      // value is null?
-      return result;
+        public ExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            // TODO: Should we check oid is NOT null and matches but
+            // value is null?
+            return result;
+        }
     }
-  }
 
+    private SSLContext sslContext;
 
+    /**
+     * The list of cipher suite.
+     */
+    private List<String> enabledCipherSuites = new LinkedList<String>();
 
-  private SSLContext sslContext;
+    /**
+     * the list of protocols.
+     */
+    private List<String> enabledProtocols = new LinkedList<String>();
 
-  /**
-   * The list of cipher suite
-   */
-  private List<String> enabledCipherSuites = new LinkedList<String>();
+    // No need to expose this.
+    private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER = new ResultDecoder();
 
-  /**
-   * the list of protocols
-   */
-  private List<String> enabledProtocols = new LinkedList<String>();
-
-  // No need to expose this.
-  private static final ExtendedResultDecoder<ExtendedResult> RESULT_DECODER =
-      new ResultDecoder();
-
-
-
-  StartTLSExtendedRequestImpl(final SSLContext sslContext)
-  {
-    Validator.ensureNotNull(sslContext);
-    this.sslContext = sslContext;
-  }
-
-
-
-  /**
-   * Creates a new startTLS extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param startTLSExtendedRequest
-   *          The startTLS extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code startTLSExtendedRequest} was {@code null} .
-   */
-  StartTLSExtendedRequestImpl(
-      final StartTLSExtendedRequest startTLSExtendedRequest)
-  {
-    super(startTLSExtendedRequest);
-    this.sslContext = startTLSExtendedRequest.getSSLContext();
-    this.enabledCipherSuites.addAll(
-        startTLSExtendedRequest.getEnabledCipherSuites());
-    this.enabledProtocols.addAll(startTLSExtendedRequest.getEnabledProtocols());
-  }
-
-
-
-  // Prevent instantiation.
-  private StartTLSExtendedRequestImpl()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<ExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SSLContext getSSLContext()
-  {
-    return sslContext;
-  }
-
-
-
-  /**
-   * {@inheritDoc}}
-   */
-  public StartTLSExtendedRequest addEnabledProtocol(String... protocols)
-  {
-    for (final String protocol : protocols)
-    {
-      this.enabledProtocols.add(Validator.ensureNotNull(protocol));
+    StartTLSExtendedRequestImpl(final SSLContext sslContext) {
+        Validator.ensureNotNull(sslContext);
+        this.sslContext = sslContext;
     }
-    return this;
-  }
 
-
-
-  /**
-   * {@inheritDoc}}
-   */
-  public StartTLSExtendedRequest addEnabledCipherSuite(String... suites)
-  {
-    for (final String suite : suites)
-    {
-      this.enabledCipherSuites.add(Validator.ensureNotNull(suite));
+    /**
+     * Creates a new startTLS extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param startTLSExtendedRequest
+     *            The startTLS extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code startTLSExtendedRequest} was {@code null} .
+     */
+    StartTLSExtendedRequestImpl(final StartTLSExtendedRequest startTLSExtendedRequest) {
+        super(startTLSExtendedRequest);
+        this.sslContext = startTLSExtendedRequest.getSSLContext();
+        this.enabledCipherSuites.addAll(startTLSExtendedRequest.getEnabledCipherSuites());
+        this.enabledProtocols.addAll(startTLSExtendedRequest.getEnabledProtocols());
     }
-    return this;
-  }
 
+    // Prevent instantiation.
+    private StartTLSExtendedRequestImpl() {
+        // Nothing to do.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return OID;
+    }
 
-  /**
-   * {@inheritDoc}}
-   */
-  public List<String> getEnabledProtocols()
-  {
-    return this.enabledProtocols;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<ExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SSLContext getSSLContext() {
+        return sslContext;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public StartTLSExtendedRequest addEnabledProtocol(String... protocols) {
+        for (final String protocol : protocols) {
+            this.enabledProtocols.add(Validator.ensureNotNull(protocol));
+        }
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}}
-   */
-  public List<String> getEnabledCipherSuites()
-  {
-    return this.enabledCipherSuites;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public StartTLSExtendedRequest addEnabledCipherSuite(String... suites) {
+        for (final String suite : suites) {
+            this.enabledCipherSuites.add(Validator.ensureNotNull(suite));
+        }
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getEnabledProtocols() {
+        return this.enabledProtocols;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getEnabledCipherSuites() {
+        return this.enabledCipherSuites;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return false;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public StartTLSExtendedRequest setSSLContext(final SSLContext sslContext) {
+        Validator.ensureNotNull(sslContext);
+        this.sslContext = sslContext;
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public StartTLSExtendedRequest setSSLContext(final SSLContext sslContext)
-  {
-    Validator.ensureNotNull(sslContext);
-    this.sslContext = sslContext;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("StartTLSExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("StartTLSExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java
index 6038e10..eead8ce 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,30 +34,23 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The Unbind operation allows a client to terminate an LDAP session.
  */
-public interface UnbindRequest extends Request
-{
-  /**
-   * {@inheritDoc}
-   */
-  UnbindRequest addControl(Control control);
+public interface UnbindRequest extends Request {
+    /**
+     * {@inheritDoc}
+     */
+    UnbindRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java
index aba13d3..10dbde7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,60 +27,46 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Unbind request implementation.
  */
-final class UnbindRequestImpl extends AbstractRequestImpl<UnbindRequest>
-    implements UnbindRequest
-{
+final class UnbindRequestImpl extends AbstractRequestImpl<UnbindRequest> implements UnbindRequest {
 
-  /**
-   * Creates a new unbind request.
-   */
-  UnbindRequestImpl()
-  {
-    // Do nothing.
-  }
+    /**
+     * Creates a new unbind request.
+     */
+    UnbindRequestImpl() {
+        // Do nothing.
+    }
 
+    /**
+     * Creates a new unbind request that is an exact copy of the provided
+     * request.
+     *
+     * @param unbindRequest
+     *            The unbind request to be copied.
+     * @throws NullPointerException
+     *             If {@code unbindRequest} was {@code null} .
+     */
+    UnbindRequestImpl(final UnbindRequest unbindRequest) {
+        super(unbindRequest);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("UnbindRequest(controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * Creates a new unbind request that is an exact copy of the provided
-   * request.
-   *
-   * @param unbindRequest
-   *          The unbind request to be copied.
-   * @throws NullPointerException
-   *           If {@code unbindRequest} was {@code null} .
-   */
-  UnbindRequestImpl(final UnbindRequest unbindRequest)
-  {
-    super(unbindRequest);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("UnbindRequest(controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  UnbindRequest getThis()
-  {
-    return this;
-  }
+    @Override
+    UnbindRequest getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java
index a3db476..9f26d3d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,36 +26,26 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Unmodifiable abandon request implementation.
  */
-final class UnmodifiableAbandonRequestImpl extends
-    AbstractUnmodifiableRequest<AbandonRequest> implements AbandonRequest
-{
-  UnmodifiableAbandonRequestImpl(AbandonRequest request)
-  {
-    super(request);
-  }
+final class UnmodifiableAbandonRequestImpl extends AbstractUnmodifiableRequest<AbandonRequest>
+        implements AbandonRequest {
+    UnmodifiableAbandonRequestImpl(AbandonRequest request) {
+        super(request);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getRequestID() {
+        return impl.getRequestID();
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public int getRequestID()
-  {
-    return impl.getRequestID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public AbandonRequest setRequestID(int id)
-  {
-    throw new UnsupportedOperationException();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public AbandonRequest setRequestID(int id) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
index c90e7fa..8a85be2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,214 +26,130 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.Attributes;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
 import com.forgerock.opendj.util.Function;
 import com.forgerock.opendj.util.Iterables;
 
-
-
 /**
  * Unmodifiable add request implementation.
  */
-final class UnmodifiableAddRequestImpl extends
-    AbstractUnmodifiableRequest<AddRequest> implements AddRequest
-{
-  private static final Function<Attribute, Attribute, Void>
-    UNMODIFIABLE_ATTRIBUTE_FUNCTION = new Function<Attribute, Attribute, Void>()
-  {
+final class UnmodifiableAddRequestImpl extends AbstractUnmodifiableRequest<AddRequest> implements
+        AddRequest {
+    private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION =
+            new Function<Attribute, Attribute, Void>() {
 
-    public Attribute apply(final Attribute value, final Void p)
-    {
-      return Attributes.unmodifiableAttribute(value);
+                public Attribute apply(final Attribute value, final Void p) {
+                    return Attributes.unmodifiableAttribute(value);
+                }
+
+            };
+
+    UnmodifiableAddRequestImpl(AddRequest impl) {
+        super(impl);
     }
 
-  };
-
-
-
-  UnmodifiableAddRequestImpl(AddRequest impl)
-  {
-    super(impl);
-  }
-
-
-
-  public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
-
-
-
-  public boolean addAttribute(Attribute attribute)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public boolean addAttribute(Attribute attribute,
-      Collection<ByteString> duplicateValues)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public AddRequest addAttribute(String attributeDescription, Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public AddRequest clearAttributes()
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public boolean containsAttribute(Attribute attribute,
-      Collection<ByteString> missingValues)
-  {
-    return impl.containsAttribute(attribute, missingValues);
-  }
-
-
-
-  public boolean containsAttribute(String attributeDescription,
-      Object... values)
-  {
-    return impl.containsAttribute(attributeDescription, values);
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes()
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes(
-      AttributeDescription attributeDescription)
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(attributeDescription),
-        UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes(String attributeDescription)
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(attributeDescription),
-        UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Attribute getAttribute(AttributeDescription attributeDescription)
-  {
-    final Attribute attribute = impl.getAttribute(attributeDescription);
-    if (attribute != null)
-    {
-      return Attributes.unmodifiableAttribute(attribute);
+    public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) {
+        return v.visitChangeRecord(p, this);
     }
-    else
-    {
-      return null;
+
+    public boolean addAttribute(Attribute attribute) {
+        throw new UnsupportedOperationException();
     }
-  }
 
-
-
-  public Attribute getAttribute(String attributeDescription)
-  {
-    final Attribute attribute = impl.getAttribute(attributeDescription);
-    if (attribute != null)
-    {
-      return Attributes.unmodifiableAttribute(attribute);
+    public boolean addAttribute(Attribute attribute, Collection<ByteString> duplicateValues) {
+        throw new UnsupportedOperationException();
     }
-    else
-    {
-      return null;
+
+    public AddRequest addAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
     }
-  }
 
+    public AddRequest clearAttributes() {
+        throw new UnsupportedOperationException();
+    }
 
+    public boolean containsAttribute(Attribute attribute, Collection<ByteString> missingValues) {
+        return impl.containsAttribute(attribute, missingValues);
+    }
 
-  public int getAttributeCount()
-  {
-    return impl.getAttributeCount();
-  }
+    public boolean containsAttribute(String attributeDescription, Object... values) {
+        return impl.containsAttribute(attributeDescription, values);
+    }
 
+    public Iterable<Attribute> getAllAttributes() {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(
+                impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
+    public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription) {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl
+                .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
-  public DN getName()
-  {
-    return impl.getName();
-  }
+    public Iterable<Attribute> getAllAttributes(String attributeDescription) {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl
+                .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
+    public Attribute getAttribute(AttributeDescription attributeDescription) {
+        final Attribute attribute = impl.getAttribute(attributeDescription);
+        if (attribute != null) {
+            return Attributes.unmodifiableAttribute(attribute);
+        } else {
+            return null;
+        }
+    }
 
+    public Attribute getAttribute(String attributeDescription) {
+        final Attribute attribute = impl.getAttribute(attributeDescription);
+        if (attribute != null) {
+            return Attributes.unmodifiableAttribute(attribute);
+        } else {
+            return null;
+        }
+    }
 
-  public boolean removeAttribute(Attribute attribute,
-      Collection<ByteString> missingValues)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public int getAttributeCount() {
+        return impl.getAttributeCount();
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
+    public boolean removeAttribute(Attribute attribute, Collection<ByteString> missingValues) {
+        throw new UnsupportedOperationException();
+    }
 
-  public boolean removeAttribute(AttributeDescription attributeDescription)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public boolean removeAttribute(AttributeDescription attributeDescription) {
+        throw new UnsupportedOperationException();
+    }
 
+    public AddRequest removeAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
+    }
 
+    public boolean replaceAttribute(Attribute attribute) {
+        throw new UnsupportedOperationException();
+    }
 
-  public AddRequest removeAttribute(String attributeDescription,
-      Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public AddRequest replaceAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
+    }
 
+    public AddRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  public boolean replaceAttribute(Attribute attribute)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public AddRequest replaceAttribute(String attributeDescription,
-      Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public AddRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public AddRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public AddRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java
index 370f1e5..4192afe 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,33 +27,23 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Unmodifiable anonymous SASL bind request implementation.
  */
 final class UnmodifiableAnonymousSASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<AnonymousSASLBindRequest> implements
-    AnonymousSASLBindRequest
-{
-  UnmodifiableAnonymousSASLBindRequestImpl(AnonymousSASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<AnonymousSASLBindRequest> implements
+        AnonymousSASLBindRequest {
+    UnmodifiableAnonymousSASLBindRequestImpl(AnonymousSASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public String getTraceString() {
+        return impl.getTraceString();
+    }
 
-
-  @Override
-  public String getTraceString()
-  {
-    return impl.getTraceString();
-  }
-
-
-
-  @Override
-  public AnonymousSASLBindRequest setTraceString(String traceString)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public AnonymousSASLBindRequest setTraceString(String traceString) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
index d0560f8..55565de 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,62 +27,41 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable CRAM-MD5 SASL bind request implementation.
  */
 final class UnmodifiableCRAMMD5SASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<CRAMMD5SASLBindRequest> implements
-    CRAMMD5SASLBindRequest
-{
-  UnmodifiableCRAMMD5SASLBindRequestImpl(CRAMMD5SASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<CRAMMD5SASLBindRequest> implements
+        CRAMMD5SASLBindRequest {
+    UnmodifiableCRAMMD5SASLBindRequestImpl(CRAMMD5SASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public String getAuthenticationID() {
+        return impl.getAuthenticationID();
+    }
 
+    @Override
+    public byte[] getPassword() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getPassword());
+    }
 
-  @Override
-  public String getAuthenticationID()
-  {
-    return impl.getAuthenticationID();
-  }
+    @Override
+    public CRAMMD5SASLBindRequest setAuthenticationID(String authenticationID) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public CRAMMD5SASLBindRequest setPassword(byte[] password) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  @Override
-  public byte[] getPassword()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getPassword());
-  }
-
-
-
-  @Override
-  public CRAMMD5SASLBindRequest setAuthenticationID(String authenticationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public CRAMMD5SASLBindRequest setPassword(byte[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public CRAMMD5SASLBindRequest setPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public CRAMMD5SASLBindRequest setPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java
index d56fbd1..6a3ab75 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,35 +27,23 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * Unmodifiable cancel extended request implementation.
  */
 final class UnmodifiableCancelExtendedRequestImpl extends
-    AbstractUnmodifiableExtendedRequest<CancelExtendedRequest, ExtendedResult>
-    implements CancelExtendedRequest
-{
-  UnmodifiableCancelExtendedRequestImpl(CancelExtendedRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableExtendedRequest<CancelExtendedRequest, ExtendedResult> implements
+        CancelExtendedRequest {
+    UnmodifiableCancelExtendedRequestImpl(CancelExtendedRequest impl) {
+        super(impl);
+    }
 
+    public int getRequestID() {
+        return impl.getRequestID();
+    }
 
-
-  public int getRequestID()
-  {
-    return impl.getRequestID();
-  }
-
-
-
-  public CancelExtendedRequest setRequestID(int id)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public CancelExtendedRequest setRequestID(int id) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java
index 60a3799..a995166 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,93 +27,56 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 
-
-
 /**
  * Unmodifiable compare request implementation.
  */
-final class UnmodifiableCompareRequestImpl extends
-    AbstractUnmodifiableRequest<CompareRequest> implements CompareRequest
-{
-  UnmodifiableCompareRequestImpl(CompareRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableCompareRequestImpl extends AbstractUnmodifiableRequest<CompareRequest>
+        implements CompareRequest {
+    UnmodifiableCompareRequestImpl(CompareRequest impl) {
+        super(impl);
+    }
 
+    public ByteString getAssertionValue() {
+        return impl.getAssertionValue();
+    }
 
+    public String getAssertionValueAsString() {
+        return impl.getAssertionValueAsString();
+    }
 
-  public ByteString getAssertionValue()
-  {
-    return impl.getAssertionValue();
-  }
+    public AttributeDescription getAttributeDescription() {
+        return impl.getAttributeDescription();
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
+    public CompareRequest setAssertionValue(ByteString value) {
+        throw new UnsupportedOperationException();
+    }
 
-  public String getAssertionValueAsString()
-  {
-    return impl.getAssertionValueAsString();
-  }
+    public CompareRequest setAssertionValue(Object value) {
+        throw new UnsupportedOperationException();
+    }
 
+    public CompareRequest setAttributeDescription(AttributeDescription attributeDescription) {
+        throw new UnsupportedOperationException();
+    }
 
+    public CompareRequest setAttributeDescription(String attributeDescription) {
+        throw new UnsupportedOperationException();
+    }
 
-  public AttributeDescription getAttributeDescription()
-  {
-    return impl.getAttributeDescription();
-  }
+    public CompareRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public DN getName()
-  {
-    return impl.getName();
-  }
-
-
-
-  public CompareRequest setAssertionValue(ByteString value)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public CompareRequest setAssertionValue(Object value)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public CompareRequest setAttributeDescription(
-      AttributeDescription attributeDescription)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public CompareRequest setAttributeDescription(String attributeDescription)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public CompareRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public CompareRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public CompareRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java
index f15708b..c80906e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,49 +27,31 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * Unmodifiable delete request implementation.
  */
-final class UnmodifiableDeleteRequestImpl extends
-    AbstractUnmodifiableRequest<DeleteRequest> implements DeleteRequest
-{
-  UnmodifiableDeleteRequestImpl(DeleteRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableDeleteRequestImpl extends AbstractUnmodifiableRequest<DeleteRequest>
+        implements DeleteRequest {
+    UnmodifiableDeleteRequestImpl(DeleteRequest impl) {
+        super(impl);
+    }
 
+    public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
-  public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    public DeleteRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public DN getName()
-  {
-    return impl.getName();
-  }
-
-
-
-  public DeleteRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public DeleteRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public DeleteRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
index 583f27d..0ae639e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,195 +27,125 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable digest-MD5 SASL bind request implementation.
  */
 final class UnmodifiableDigestMD5SASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<DigestMD5SASLBindRequest> implements
-    DigestMD5SASLBindRequest
-{
-  UnmodifiableDigestMD5SASLBindRequestImpl(DigestMD5SASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<DigestMD5SASLBindRequest> implements
+        DigestMD5SASLBindRequest {
+    UnmodifiableDigestMD5SASLBindRequestImpl(DigestMD5SASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest addAdditionalAuthParam(String name, String value) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest addQOP(String... qopValues) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public DigestMD5SASLBindRequest addAdditionalAuthParam(String name,
-      String value)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public Map<String, String> getAdditionalAuthParams() {
+        return Collections.unmodifiableMap(impl.getAdditionalAuthParams());
+    }
 
+    @Override
+    public String getAuthenticationID() {
+        return impl.getAuthenticationID();
+    }
 
+    @Override
+    public String getAuthorizationID() {
+        return impl.getAuthorizationID();
+    }
 
-  @Override
-  public DigestMD5SASLBindRequest addQOP(String... qopValues)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public String getCipher() {
+        return impl.getCipher();
+    }
 
+    @Override
+    public int getMaxReceiveBufferSize() {
+        return impl.getMaxReceiveBufferSize();
+    }
 
+    @Override
+    public int getMaxSendBufferSize() {
+        return impl.getMaxSendBufferSize();
+    }
 
-  @Override
-  public Map<String, String> getAdditionalAuthParams()
-  {
-    return Collections.unmodifiableMap(impl.getAdditionalAuthParams());
-  }
+    @Override
+    public byte[] getPassword() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getPassword());
+    }
 
+    @Override
+    public List<String> getQOPs() {
+        return Collections.unmodifiableList(impl.getQOPs());
+    }
 
+    @Override
+    public String getRealm() {
+        return impl.getRealm();
+    }
 
-  @Override
-  public String getAuthenticationID()
-  {
-    return impl.getAuthenticationID();
-  }
+    @Override
+    public boolean isServerAuth() {
+        return impl.isServerAuth();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setAuthenticationID(String authenticationID) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setAuthorizationID(String authorizationID) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public String getAuthorizationID()
-  {
-    return impl.getAuthorizationID();
-  }
+    @Override
+    public DigestMD5SASLBindRequest setCipher(String cipher) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setMaxReceiveBufferSize(int size) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setMaxSendBufferSize(int size) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public String getCipher()
-  {
-    return impl.getCipher();
-  }
+    @Override
+    public DigestMD5SASLBindRequest setPassword(byte[] password) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public DigestMD5SASLBindRequest setRealm(String realm) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public int getMaxReceiveBufferSize()
-  {
-    return impl.getMaxReceiveBufferSize();
-  }
-
-
-
-  @Override
-  public int getMaxSendBufferSize()
-  {
-    return impl.getMaxSendBufferSize();
-  }
-
-
-
-  @Override
-  public byte[] getPassword()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getPassword());
-  }
-
-
-
-  @Override
-  public List<String> getQOPs()
-  {
-    return Collections.unmodifiableList(impl.getQOPs());
-  }
-
-
-
-  @Override
-  public String getRealm()
-  {
-    return impl.getRealm();
-  }
-
-
-
-  @Override
-  public boolean isServerAuth()
-  {
-    return impl.isServerAuth();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setAuthenticationID(String authenticationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setAuthorizationID(String authorizationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setCipher(String cipher)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setMaxReceiveBufferSize(int size)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setMaxSendBufferSize(int size)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setPassword(byte[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setRealm(String realm)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public DigestMD5SASLBindRequest setServerAuth(boolean serverAuth)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public DigestMD5SASLBindRequest setServerAuth(boolean serverAuth) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java
index 94ffe20..3f475a6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,33 +27,23 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Unmodifiable external SASL bind request implementation.
  */
 final class UnmodifiableExternalSASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<ExternalSASLBindRequest> implements
-    ExternalSASLBindRequest
-{
-  UnmodifiableExternalSASLBindRequestImpl(ExternalSASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<ExternalSASLBindRequest> implements
+        ExternalSASLBindRequest {
+    UnmodifiableExternalSASLBindRequestImpl(ExternalSASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public String getAuthorizationID() {
+        return impl.getAuthorizationID();
+    }
 
-
-  @Override
-  public String getAuthorizationID()
-  {
-    return impl.getAuthorizationID();
-  }
-
-
-
-  @Override
-  public ExternalSASLBindRequest setAuthorizationID(String authorizationID)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public ExternalSASLBindRequest setAuthorizationID(String authorizationID) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
index acf2a0b..e553efb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -38,202 +35,128 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable GSSAPI SASL bind request implementation.
  */
 final class UnmodifiableGSSAPISASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<GSSAPISASLBindRequest> implements
-    GSSAPISASLBindRequest
-{
-  UnmodifiableGSSAPISASLBindRequestImpl(GSSAPISASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<GSSAPISASLBindRequest> implements GSSAPISASLBindRequest {
+    UnmodifiableGSSAPISASLBindRequestImpl(GSSAPISASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public Map<String, String> getAdditionalAuthParams() {
+        return Collections.unmodifiableMap(impl.getAdditionalAuthParams());
+    }
 
-  @Override
-  public GSSAPISASLBindRequest addAdditionalAuthParam(String name, String value)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public GSSAPISASLBindRequest addQOP(String... qopValues) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public String getAuthenticationID() {
+        return impl.getAuthenticationID();
+    }
 
+    @Override
+    public String getAuthorizationID() {
+        return impl.getAuthorizationID();
+    }
 
-  @Override
-  public Map<String, String> getAdditionalAuthParams()
-  {
-    return Collections.unmodifiableMap(impl.getAdditionalAuthParams());
-  }
+    @Override
+    public String getKDCAddress() {
+        return impl.getKDCAddress();
+    }
 
+    @Override
+    public int getMaxReceiveBufferSize() {
+        return impl.getMaxReceiveBufferSize();
+    }
 
+    @Override
+    public int getMaxSendBufferSize() {
+        return impl.getMaxSendBufferSize();
+    }
 
-  @Override
-  public GSSAPISASLBindRequest addQOP(String... qopValues)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public byte[] getPassword() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getPassword());
+    }
 
+    @Override
+    public List<String> getQOPs() {
+        return Collections.unmodifiableList(impl.getQOPs());
+    }
 
+    @Override
+    public String getRealm() {
+        return impl.getRealm();
+    }
 
-  @Override
-  public String getAuthenticationID()
-  {
-    return impl.getAuthenticationID();
-  }
+    @Override
+    public Subject getSubject() {
+        return impl.getSubject();
+    }
 
+    @Override
+    public boolean isServerAuth() {
+        return impl.isServerAuth();
+    }
 
+    @Override
+    public GSSAPISASLBindRequest setAuthenticationID(String authenticationID) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public String getAuthorizationID()
-  {
-    return impl.getAuthorizationID();
-  }
+    @Override
+    public GSSAPISASLBindRequest setAuthorizationID(String authorizationID) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public GSSAPISASLBindRequest setKDCAddress(String address) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public GSSAPISASLBindRequest setMaxReceiveBufferSize(int size) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public String getKDCAddress()
-  {
-    return impl.getKDCAddress();
-  }
+    @Override
+    public GSSAPISASLBindRequest setMaxSendBufferSize(int size) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public GSSAPISASLBindRequest setPassword(byte[] password) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public GSSAPISASLBindRequest setPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public int getMaxReceiveBufferSize()
-  {
-    return impl.getMaxReceiveBufferSize();
-  }
+    @Override
+    public GSSAPISASLBindRequest setRealm(String realm) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  @Override
-  public int getMaxSendBufferSize()
-  {
-    return impl.getMaxSendBufferSize();
-  }
-
-
-
-  @Override
-  public byte[] getPassword()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getPassword());
-  }
-
-
-
-  @Override
-  public List<String> getQOPs()
-  {
-    return Collections.unmodifiableList(impl.getQOPs());
-  }
-
-
-
-  @Override
-  public String getRealm()
-  {
-    return impl.getRealm();
-  }
-
-
-
-  @Override
-  public Subject getSubject()
-  {
-    return impl.getSubject();
-  }
-
-
-
-  @Override
-  public boolean isServerAuth()
-  {
-    return impl.isServerAuth();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setAuthenticationID(String authenticationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setAuthorizationID(String authorizationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setKDCAddress(String address)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setMaxReceiveBufferSize(int size)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setMaxSendBufferSize(int size)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setPassword(byte[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setRealm(String realm)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GSSAPISASLBindRequest setServerAuth(boolean serverAuth)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
+    @Override
+    public GSSAPISASLBindRequest setServerAuth(boolean serverAuth) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public GSSAPISASLBindRequest setSubject(Subject subject)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public GSSAPISASLBindRequest setSubject(Subject subject) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java
index df9729a..1b8e4d2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,50 +27,31 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable generic bind request implementation.
  */
 final class UnmodifiableGenericBindRequestImpl extends
-    AbstractUnmodifiableBindRequest<GenericBindRequest> implements
-    GenericBindRequest
-{
-  UnmodifiableGenericBindRequestImpl(GenericBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableBindRequest<GenericBindRequest> implements GenericBindRequest {
+    UnmodifiableGenericBindRequestImpl(GenericBindRequest impl) {
+        super(impl);
+    }
 
+    public byte[] getAuthenticationValue() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getAuthenticationValue());
+    }
 
+    public GenericBindRequest setAuthenticationType(byte type) {
+        throw new UnsupportedOperationException();
+    }
 
-  public byte[] getAuthenticationValue()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getAuthenticationValue());
-  }
+    public GenericBindRequest setAuthenticationValue(byte[] bytes) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public GenericBindRequest setAuthenticationType(byte type)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public GenericBindRequest setAuthenticationValue(byte[] bytes)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public GenericBindRequest setName(String name)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public GenericBindRequest setName(String name) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java
index 5dc98d1..c30065e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,37 +27,24 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
 
-
-
 /**
  * Unmodifiable generic extended request implementation.
  */
-final class UnmodifiableGenericExtendedRequestImpl
-    extends
-    AbstractUnmodifiableExtendedRequest<GenericExtendedRequest, GenericExtendedResult>
-    implements GenericExtendedRequest
-{
-  UnmodifiableGenericExtendedRequestImpl(GenericExtendedRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableGenericExtendedRequestImpl extends
+        AbstractUnmodifiableExtendedRequest<GenericExtendedRequest, GenericExtendedResult>
+        implements GenericExtendedRequest {
+    UnmodifiableGenericExtendedRequestImpl(GenericExtendedRequest impl) {
+        super(impl);
+    }
 
+    public GenericExtendedRequest setOID(String oid) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  public GenericExtendedRequest setOID(String oid)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public GenericExtendedRequest setValue(ByteString bytes)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public GenericExtendedRequest setValue(ByteString bytes) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java
index 8745ee2..7707ecd 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,106 +27,64 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.RDN;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
-
-
 /**
  * Unmodifiable modify DN request implementation.
  */
-final class UnmodifiableModifyDNRequestImpl extends
-    AbstractUnmodifiableRequest<ModifyDNRequest> implements ModifyDNRequest
-{
-  UnmodifiableModifyDNRequestImpl(ModifyDNRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableModifyDNRequestImpl extends AbstractUnmodifiableRequest<ModifyDNRequest>
+        implements ModifyDNRequest {
+    UnmodifiableModifyDNRequestImpl(ModifyDNRequest impl) {
+        super(impl);
+    }
 
+    public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
-  public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    public RDN getNewRDN() {
+        return impl.getNewRDN();
+    }
 
+    public DN getNewSuperior() {
+        return impl.getNewSuperior();
+    }
 
+    public boolean isDeleteOldRDN() {
+        return impl.isDeleteOldRDN();
+    }
 
-  public DN getName()
-  {
-    return impl.getName();
-  }
+    public ModifyDNRequest setDeleteOldRDN(boolean deleteOldRDN) {
+        throw new UnsupportedOperationException();
+    }
 
+    public ModifyDNRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
+    public ModifyDNRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 
-  public RDN getNewRDN()
-  {
-    return impl.getNewRDN();
-  }
+    public ModifyDNRequest setNewRDN(RDN rdn) {
+        throw new UnsupportedOperationException();
+    }
 
+    public ModifyDNRequest setNewRDN(String rdn) {
+        throw new UnsupportedOperationException();
+    }
 
+    public ModifyDNRequest setNewSuperior(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-  public DN getNewSuperior()
-  {
-    return impl.getNewSuperior();
-  }
-
-
-
-  public boolean isDeleteOldRDN()
-  {
-    return impl.isDeleteOldRDN();
-  }
-
-
-
-  public ModifyDNRequest setDeleteOldRDN(boolean deleteOldRDN)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setNewRDN(RDN rdn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setNewRDN(String rdn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setNewSuperior(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyDNRequest setNewSuperior(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public ModifyDNRequest setNewSuperior(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
index d913fcd..1f98801 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,96 +27,71 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.Attributes;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldif.ChangeRecordVisitor;
 
 import com.forgerock.opendj.util.Collections2;
 import com.forgerock.opendj.util.Function;
 import com.forgerock.opendj.util.Functions;
 
-
-
 /**
  * Unmodifiable modify request implementation.
  */
-final class UnmodifiableModifyRequestImpl extends
-    AbstractUnmodifiableRequest<ModifyRequest> implements ModifyRequest
-{
-  UnmodifiableModifyRequestImpl(ModifyRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableModifyRequestImpl extends AbstractUnmodifiableRequest<ModifyRequest>
+        implements ModifyRequest {
+    UnmodifiableModifyRequestImpl(ModifyRequest impl) {
+        super(impl);
+    }
 
+    public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p) {
+        return v.visitChangeRecord(p, this);
+    }
 
+    public ModifyRequest addModification(Modification modification) {
+        throw new UnsupportedOperationException();
+    }
 
-  public <R, P> R accept(ChangeRecordVisitor<R, P> v, P p)
-  {
-    return v.visitChangeRecord(p, this);
-  }
+    public ModifyRequest addModification(ModificationType type, String attributeDescription,
+            Object... values) {
+        throw new UnsupportedOperationException();
+    }
 
+    public List<Modification> getModifications() {
+        // We need to make all attributes unmodifiable as well.
+        Function<Modification, Modification, Void> function =
+                new Function<Modification, Modification, Void>() {
 
+                    public Modification apply(Modification value, Void p) {
+                        ModificationType type = value.getModificationType();
+                        Attribute attribute =
+                                Attributes.unmodifiableAttribute(value.getAttribute());
+                        return new Modification(type, attribute);
+                    }
 
-  public ModifyRequest addModification(Modification modification)
-  {
-    throw new UnsupportedOperationException();
-  }
+                };
 
+        List<Modification> unmodifiableModifications =
+                Collections2.transformedList(impl.getModifications(), function, Functions
+                        .<Modification> identityFunction());
+        return Collections.unmodifiableList(unmodifiableModifications);
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
-  public ModifyRequest addModification(ModificationType type,
-      String attributeDescription, Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public ModifyRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public List<Modification> getModifications()
-  {
-    // We need to make all attributes unmodifiable as well.
-    Function<Modification, Modification, Void> function =
-        new Function<Modification, Modification, Void>()
-    {
-
-      public Modification apply(Modification value, Void p)
-      {
-        ModificationType type = value.getModificationType();
-        Attribute attribute = Attributes.unmodifiableAttribute(value
-            .getAttribute());
-        return new Modification(type, attribute);
-      }
-
-    };
-
-    List<Modification> unmodifiableModifications = Collections2
-        .transformedList(impl.getModifications(), function,
-            Functions.<Modification> identityFunction());
-    return Collections.unmodifiableList(unmodifiableModifications);
-  }
-
-
-
-  public DN getName()
-  {
-    return impl.getName();
-  }
-
-
-
-  public ModifyRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public ModifyRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public ModifyRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
index bd2347e..4ddead4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,94 +26,57 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult;
 
-
-
 /**
  * Unmodifiable password modify extended request implementation.
  */
 final class UnmodifiablePasswordModifyExtendedRequestImpl
-    extends
-    AbstractUnmodifiableExtendedRequest<PasswordModifyExtendedRequest, PasswordModifyExtendedResult>
-    implements PasswordModifyExtendedRequest
-{
-  UnmodifiablePasswordModifyExtendedRequestImpl(
-      PasswordModifyExtendedRequest impl)
-  {
-    super(impl);
-  }
+        extends
+        AbstractUnmodifiableExtendedRequest<PasswordModifyExtendedRequest, PasswordModifyExtendedResult>
+        implements PasswordModifyExtendedRequest {
+    UnmodifiablePasswordModifyExtendedRequestImpl(PasswordModifyExtendedRequest impl) {
+        super(impl);
+    }
 
+    public ByteString getNewPassword() {
+        return impl.getNewPassword();
+    }
 
+    public ByteString getOldPassword() {
+        return impl.getOldPassword();
+    }
 
-  public ByteString getNewPassword()
-  {
-    return impl.getNewPassword();
-  }
+    public ByteString getUserIdentity() {
+        return impl.getUserIdentity();
+    }
 
+    public String getUserIdentityAsString() {
+        return impl.getUserIdentityAsString();
+    }
 
+    public PasswordModifyExtendedRequest setNewPassword(ByteString newPassword) {
+        throw new UnsupportedOperationException();
+    }
 
-  public ByteString getOldPassword()
-  {
-    return impl.getOldPassword();
-  }
+    public PasswordModifyExtendedRequest setNewPassword(char[] newPassword) {
+        throw new UnsupportedOperationException();
+    }
 
+    public PasswordModifyExtendedRequest setOldPassword(ByteString oldPassword) {
+        throw new UnsupportedOperationException();
+    }
 
+    public PasswordModifyExtendedRequest setOldPassword(char[] oldPassword) {
+        throw new UnsupportedOperationException();
+    }
 
-  public ByteString getUserIdentity()
-  {
-    return impl.getUserIdentity();
-  }
+    public PasswordModifyExtendedRequest setUserIdentity(ByteString userIdentity) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public String getUserIdentityAsString()
-  {
-    return impl.getUserIdentityAsString();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setNewPassword(ByteString newPassword)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setNewPassword(char[] newPassword)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setOldPassword(ByteString oldPassword)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setOldPassword(char[] oldPassword)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setUserIdentity(ByteString userIdentity)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public PasswordModifyExtendedRequest setUserIdentity(String userIdentity)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public PasswordModifyExtendedRequest setUserIdentity(String userIdentity) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java
index 86eb8be..28f12ce 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,78 +27,50 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable plain SASL bind request implementation.
  */
 final class UnmodifiablePlainSASLBindRequestImpl extends
-    AbstractUnmodifiableSASLBindRequest<PlainSASLBindRequest> implements
-    PlainSASLBindRequest
-{
-  UnmodifiablePlainSASLBindRequestImpl(PlainSASLBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableSASLBindRequest<PlainSASLBindRequest> implements PlainSASLBindRequest {
+    UnmodifiablePlainSASLBindRequestImpl(PlainSASLBindRequest impl) {
+        super(impl);
+    }
 
+    @Override
+    public String getAuthenticationID() {
+        return impl.getAuthenticationID();
+    }
 
+    @Override
+    public String getAuthorizationID() {
+        return impl.getAuthorizationID();
+    }
 
-  @Override
-  public String getAuthenticationID()
-  {
-    return impl.getAuthenticationID();
-  }
+    @Override
+    public byte[] getPassword() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getPassword());
+    }
 
+    @Override
+    public PlainSASLBindRequest setAuthenticationID(String authenticationID) {
+        throw new UnsupportedOperationException();
+    }
 
+    @Override
+    public PlainSASLBindRequest setAuthorizationID(String authorizationID) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public String getAuthorizationID()
-  {
-    return impl.getAuthorizationID();
-  }
+    @Override
+    public PlainSASLBindRequest setPassword(byte[] password) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  @Override
-  public byte[] getPassword()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getPassword());
-  }
-
-
-
-  @Override
-  public PlainSASLBindRequest setAuthenticationID(String authenticationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public PlainSASLBindRequest setAuthorizationID(String authorizationID)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public PlainSASLBindRequest setPassword(byte[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public PlainSASLBindRequest setPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public PlainSASLBindRequest setPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java
index 25e7aa3..03d8f31 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
@@ -38,143 +35,84 @@
 import org.forgerock.opendj.ldap.Filter;
 import org.forgerock.opendj.ldap.SearchScope;
 
-
-
 /**
  * Unmodifiable search request implementation.
  */
-final class UnmodifiableSearchRequestImpl extends
-    AbstractUnmodifiableRequest<SearchRequest> implements SearchRequest
-{
-  UnmodifiableSearchRequestImpl(SearchRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableSearchRequestImpl extends AbstractUnmodifiableRequest<SearchRequest>
+        implements SearchRequest {
+    UnmodifiableSearchRequestImpl(SearchRequest impl) {
+        super(impl);
+    }
 
+    public SearchRequest addAttribute(String... attributeDescriptions) {
+        throw new UnsupportedOperationException();
+    }
 
+    public List<String> getAttributes() {
+        return Collections.unmodifiableList(impl.getAttributes());
+    }
 
-  public SearchRequest addAttribute(String... attributeDescriptions)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public DereferenceAliasesPolicy getDereferenceAliasesPolicy() {
+        return impl.getDereferenceAliasesPolicy();
+    }
 
+    public Filter getFilter() {
+        return impl.getFilter();
+    }
 
+    public DN getName() {
+        return impl.getName();
+    }
 
-  public List<String> getAttributes()
-  {
-    return Collections.unmodifiableList(impl.getAttributes());
-  }
+    public SearchScope getScope() {
+        return impl.getScope();
+    }
 
+    public int getSizeLimit() {
+        return impl.getSizeLimit();
+    }
 
+    public int getTimeLimit() {
+        return impl.getTimeLimit();
+    }
 
-  public DereferenceAliasesPolicy getDereferenceAliasesPolicy()
-  {
-    return impl.getDereferenceAliasesPolicy();
-  }
+    public boolean isTypesOnly() {
+        return impl.isTypesOnly();
+    }
 
+    public SearchRequest setDereferenceAliasesPolicy(DereferenceAliasesPolicy policy) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchRequest setFilter(Filter filter) {
+        throw new UnsupportedOperationException();
+    }
 
-  public Filter getFilter()
-  {
-    return impl.getFilter();
-  }
+    public SearchRequest setFilter(String filter) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchRequest setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchRequest setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 
-  public DN getName()
-  {
-    return impl.getName();
-  }
+    public SearchRequest setScope(SearchScope scope) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchRequest setSizeLimit(int limit) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchRequest setTimeLimit(int limit) {
+        throw new UnsupportedOperationException();
+    }
 
-  public SearchScope getScope()
-  {
-    return impl.getScope();
-  }
-
-
-
-  public int getSizeLimit()
-  {
-    return impl.getSizeLimit();
-  }
-
-
-
-  public int getTimeLimit()
-  {
-    return impl.getTimeLimit();
-  }
-
-
-
-  public boolean isTypesOnly()
-  {
-    return impl.isTypesOnly();
-  }
-
-
-
-  public SearchRequest setDereferenceAliasesPolicy(
-      DereferenceAliasesPolicy policy)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setFilter(Filter filter)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setFilter(String filter)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setScope(SearchScope scope)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setSizeLimit(int limit)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setTimeLimit(int limit)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchRequest setTypesOnly(boolean typesOnly)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public SearchRequest setTypesOnly(boolean typesOnly) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java
index e802d42..19b6ac3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,50 +27,31 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Unmodifiable simple bind request implementation.
  */
 final class UnmodifiableSimpleBindRequestImpl extends
-    AbstractUnmodifiableBindRequest<SimpleBindRequest> implements
-    SimpleBindRequest
-{
-  UnmodifiableSimpleBindRequestImpl(SimpleBindRequest impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableBindRequest<SimpleBindRequest> implements SimpleBindRequest {
+    UnmodifiableSimpleBindRequestImpl(SimpleBindRequest impl) {
+        super(impl);
+    }
 
+    public byte[] getPassword() {
+        // Defensive copy.
+        return StaticUtils.copyOfBytes(impl.getPassword());
+    }
 
+    public SimpleBindRequest setName(String name) {
+        throw new UnsupportedOperationException();
+    }
 
-  public byte[] getPassword()
-  {
-    // Defensive copy.
-    return StaticUtils.copyOfBytes(impl.getPassword());
-  }
+    public SimpleBindRequest setPassword(byte[] password) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public SimpleBindRequest setName(String name)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SimpleBindRequest setPassword(byte[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SimpleBindRequest setPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public SimpleBindRequest setPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java
index 8b1241a..4c99b04 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
@@ -36,60 +33,37 @@
 
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 
-
-
 /**
  * Unmodifiable start TLS extended request implementation.
  */
-final class UnmodifiableStartTLSExtendedRequestImpl
-    extends
-    AbstractUnmodifiableExtendedRequest<StartTLSExtendedRequest, ExtendedResult>
-    implements StartTLSExtendedRequest
-{
-  UnmodifiableStartTLSExtendedRequestImpl(StartTLSExtendedRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableStartTLSExtendedRequestImpl extends
+        AbstractUnmodifiableExtendedRequest<StartTLSExtendedRequest, ExtendedResult> implements
+        StartTLSExtendedRequest {
+    UnmodifiableStartTLSExtendedRequestImpl(StartTLSExtendedRequest impl) {
+        super(impl);
+    }
 
+    public SSLContext getSSLContext() {
+        return impl.getSSLContext();
+    }
 
+    public StartTLSExtendedRequest addEnabledProtocol(String... protocols) {
+        throw new UnsupportedOperationException();
+    }
 
-  public SSLContext getSSLContext()
-  {
-    return impl.getSSLContext();
-  }
+    public StartTLSExtendedRequest addEnabledCipherSuite(String... suites) {
+        throw new UnsupportedOperationException();
+    }
 
+    public List<String> getEnabledProtocols() {
+        return Collections.unmodifiableList(impl.getEnabledProtocols());
+    }
 
+    public List<String> getEnabledCipherSuites() {
+        return Collections.unmodifiableList(impl.getEnabledCipherSuites());
+    }
 
-  public StartTLSExtendedRequest addEnabledProtocol(String... protocols)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public StartTLSExtendedRequest addEnabledCipherSuite(String... suites)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public List<String> getEnabledProtocols()
-  {
-    return Collections.unmodifiableList(impl.getEnabledProtocols());
-  }
-
-
-
-  public List<String> getEnabledCipherSuites()
-  {
-    return Collections.unmodifiableList(impl.getEnabledCipherSuites());
-  }
-
-
-
-  public StartTLSExtendedRequest setSSLContext(SSLContext sslContext)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public StartTLSExtendedRequest setSSLContext(SSLContext sslContext) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java
index 23fb678..3c1480a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,16 +26,12 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 /**
  * Unmodifiable unbind request implementation.
  */
-final class UnmodifiableUnbindRequestImpl extends
-    AbstractUnmodifiableRequest<UnbindRequest> implements UnbindRequest
-{
-  UnmodifiableUnbindRequestImpl(UnbindRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableUnbindRequestImpl extends AbstractUnmodifiableRequest<UnbindRequest>
+        implements UnbindRequest {
+    UnmodifiableUnbindRequestImpl(UnbindRequest impl) {
+        super(impl);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java
index 753006e..2fdd0d9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,22 +26,15 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult;
 
-
-
 /**
  * Unmodifiable Who Am I extended request implementation.
  */
-final class UnmodifiableWhoAmIExtendedRequestImpl
-    extends
-    AbstractUnmodifiableExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult>
-    implements WhoAmIExtendedRequest
-{
-  UnmodifiableWhoAmIExtendedRequestImpl(WhoAmIExtendedRequest impl)
-  {
-    super(impl);
-  }
+final class UnmodifiableWhoAmIExtendedRequestImpl extends
+        AbstractUnmodifiableExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult> implements
+        WhoAmIExtendedRequest {
+    UnmodifiableWhoAmIExtendedRequestImpl(WhoAmIExtendedRequest impl) {
+        super(impl);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java
index b8b6ac6..626c231 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,10 +36,8 @@
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult;
 
-
-
 /**
- *The who am I extended request as defined in RFC 4532. This operation allows
+ * The who am I extended request as defined in RFC 4532. This operation allows
  * clients to obtain the primary authorization identity, in its primary form,
  * that the server has associated with the user or application entity.
  * <p>
@@ -64,69 +59,53 @@
  *      Directory Access Protocol (LDAP) Authorization Identity Request and
  *      Response Controls </a>
  */
-public interface WhoAmIExtendedRequest extends
-    ExtendedRequest<WhoAmIExtendedResult>
-{
+public interface WhoAmIExtendedRequest extends ExtendedRequest<WhoAmIExtendedResult> {
 
-  /**
-   * The OID for the who am I extended operation request.
-   */
-  public static final String OID = "1.3.6.1.4.1.4203.1.11.3";
+    /**
+     * The OID for the who am I extended operation request.
+     */
+    public static final String OID = "1.3.6.1.4.1.4203.1.11.3";
 
-  /**
-   * A decoder which can be used to decode who am I extended operation requests.
-   */
-  public static final ExtendedRequestDecoder<WhoAmIExtendedRequest,
-                                             WhoAmIExtendedResult> DECODER =
-    new WhoAmIExtendedRequestImpl.RequestDecoder();
+    /**
+     * A decoder which can be used to decode who am I extended operation
+     * requests.
+     */
+    public static final ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult> DECODER =
+            new WhoAmIExtendedRequestImpl.RequestDecoder();
 
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedRequest addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedRequest addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java
index 1df093a..3b6c248 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,186 +27,140 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
-import org.forgerock.opendj.ldap.responses.*;
-
-
+import org.forgerock.opendj.ldap.responses.AbstractExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult;
 
 /**
  * Who Am I extended request implementation.
  */
 final class WhoAmIExtendedRequestImpl extends
-    AbstractExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult>
-    implements WhoAmIExtendedRequest
-{
+        AbstractExtendedRequest<WhoAmIExtendedRequest, WhoAmIExtendedResult> implements
+        WhoAmIExtendedRequest {
 
-  static final class RequestDecoder implements
-      ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult>
-  {
+    static final class RequestDecoder implements
+            ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult> {
 
-    public WhoAmIExtendedRequest decodeExtendedRequest(
-        final ExtendedRequest<?> request, final DecodeOptions options)
-        throws DecodeException
-    {
-      // TODO: Check the OID and that the value is not present.
-      final WhoAmIExtendedRequest newRequest = new WhoAmIExtendedRequestImpl();
-      for (final Control control : request.getControls())
-      {
-        newRequest.addControl(control);
-      }
-      return newRequest;
-    }
-  }
-
-
-
-  private static final class ResultDecoder extends
-      AbstractExtendedResultDecoder<WhoAmIExtendedResult>
-  {
-    public WhoAmIExtendedResult newExtendedErrorResult(
-        final ResultCode resultCode, final String matchedDN,
-        final String diagnosticMessage)
-    {
-      return Responses.newWhoAmIExtendedResult(resultCode).setMatchedDN(
-          matchedDN).setDiagnosticMessage(diagnosticMessage);
+        public WhoAmIExtendedRequest decodeExtendedRequest(final ExtendedRequest<?> request,
+                final DecodeOptions options) throws DecodeException {
+            // TODO: Check the OID and that the value is not present.
+            final WhoAmIExtendedRequest newRequest = new WhoAmIExtendedRequestImpl();
+            for (final Control control : request.getControls()) {
+                newRequest.addControl(control);
+            }
+            return newRequest;
+        }
     }
 
-
-
-    public WhoAmIExtendedResult decodeExtendedResult(
-        final ExtendedResult result, final DecodeOptions options)
-        throws DecodeException
-    {
-      if (result instanceof WhoAmIExtendedResult)
-      {
-        return (WhoAmIExtendedResult) result;
-      }
-      else
-      {
-        final WhoAmIExtendedResult newResult = Responses
-            .newWhoAmIExtendedResult(result.getResultCode()).setMatchedDN(
-                result.getMatchedDN()).setDiagnosticMessage(
-                result.getDiagnosticMessage());
-
-        final ByteString responseValue = result.getValue();
-        if (responseValue != null)
-        {
-          try
-          {
-            newResult.setAuthorizationID(responseValue.toString());
-          }
-          catch (final LocalizedIllegalArgumentException e)
-          {
-            throw DecodeException.error(e.getMessageObject());
-          }
+    private static final class ResultDecoder extends
+            AbstractExtendedResultDecoder<WhoAmIExtendedResult> {
+        public WhoAmIExtendedResult newExtendedErrorResult(final ResultCode resultCode,
+                final String matchedDN, final String diagnosticMessage) {
+            return Responses.newWhoAmIExtendedResult(resultCode).setMatchedDN(matchedDN)
+                    .setDiagnosticMessage(diagnosticMessage);
         }
 
-        for (final Control control : result.getControls())
-        {
-          newResult.addControl(control);
+        public WhoAmIExtendedResult decodeExtendedResult(final ExtendedResult result,
+                final DecodeOptions options) throws DecodeException {
+            if (result instanceof WhoAmIExtendedResult) {
+                return (WhoAmIExtendedResult) result;
+            } else {
+                final WhoAmIExtendedResult newResult =
+                        Responses.newWhoAmIExtendedResult(result.getResultCode()).setMatchedDN(
+                                result.getMatchedDN()).setDiagnosticMessage(
+                                result.getDiagnosticMessage());
+
+                final ByteString responseValue = result.getValue();
+                if (responseValue != null) {
+                    try {
+                        newResult.setAuthorizationID(responseValue.toString());
+                    } catch (final LocalizedIllegalArgumentException e) {
+                        throw DecodeException.error(e.getMessageObject());
+                    }
+                }
+
+                for (final Control control : result.getControls()) {
+                    newResult.addControl(control);
+                }
+
+                return newResult;
+            }
         }
-
-        return newResult;
-      }
     }
-  }
 
+    // No need to expose this.
+    private static final ExtendedResultDecoder<WhoAmIExtendedResult> RESULT_DECODER =
+            new ResultDecoder();
 
+    // Prevent instantiation.
+    WhoAmIExtendedRequestImpl() {
+        // Nothing to do.
+    }
 
-  // No need to expose this.
-  private static final ExtendedResultDecoder<WhoAmIExtendedResult>
-    RESULT_DECODER = new ResultDecoder();
+    /**
+     * Creates a new Who Am I extended request that is an exact copy of the
+     * provided request.
+     *
+     * @param whoAmIExtendedRequest
+     *            The who Am I extended request to be copied.
+     * @throws NullPointerException
+     *             If {@code whoAmIExtendedRequest} was {@code null} .
+     */
+    WhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest whoAmIExtendedRequest) {
+        super(whoAmIExtendedRequest);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return OID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder() {
+        return RESULT_DECODER;
+    }
 
-  // Prevent instantiation.
-  WhoAmIExtendedRequestImpl()
-  {
-    // Nothing to do.
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return false;
+    }
 
-
-  /**
-   * Creates a new Who Am I extended request that is an exact copy of the
-   * provided request.
-   *
-   * @param whoAmIExtendedRequest
-   *          The who Am I extended request to be copied.
-   * @throws NullPointerException
-   *           If {@code whoAmIExtendedRequest} was {@code null} .
-   */
-  WhoAmIExtendedRequestImpl(
-      final WhoAmIExtendedRequest whoAmIExtendedRequest)
-  {
-    super(whoAmIExtendedRequest);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return OID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ExtendedResultDecoder<WhoAmIExtendedResult> getResultDecoder()
-  {
-    return RESULT_DECODER;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("WhoAmIExtendedRequest(requestName=");
-    builder.append(getOID());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("WhoAmIExtendedRequest(requestName=");
+        builder.append(getOID());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java
index f3fe66f..8805522 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package org.forgerock.opendj.ldap.requests;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java
index 0a68fd3..831df1e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,115 +27,93 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ResultCode;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An abstract Extended result which can be used as the basis for implementing
  * new Extended operations.
  *
  * @param <S>
- *          The type of Extended result.
+ *            The type of Extended result.
  */
-public abstract class AbstractExtendedResult<S extends ExtendedResult>
-    extends AbstractResultImpl<S> implements ExtendedResult
-{
+public abstract class AbstractExtendedResult<S extends ExtendedResult> extends
+        AbstractResultImpl<S> implements ExtendedResult {
 
-  /**
-   * Creates a new extended result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  protected AbstractExtendedResult(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new extended result that is an exact copy of the provided
-   * result.
-   *
-   * @param extendedResult
-   *          The extended result to be copied.
-   * @throws NullPointerException
-   *           If {@code extendedResult} was {@code null} .
-   */
-  protected AbstractExtendedResult(ExtendedResult extendedResult)
-  {
-    super(extendedResult);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("ExtendedResult(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", responseName=");
-    builder.append(getOID() == null ? "" : getOID());
-    if (hasValue())
-    {
-      builder.append(", responseValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new extended result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    protected AbstractExtendedResult(final ResultCode resultCode) {
+        super(resultCode);
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 
+    /**
+     * Creates a new extended result that is an exact copy of the provided
+     * result.
+     *
+     * @param extendedResult
+     *            The extended result to be copied.
+     * @throws NullPointerException
+     *             If {@code extendedResult} was {@code null} .
+     */
+    protected AbstractExtendedResult(ExtendedResult extendedResult) {
+        super(extendedResult);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public abstract String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @SuppressWarnings("unchecked")
-  final S getThis()
-  {
-    return (S) this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public abstract ByteString getValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    public abstract boolean hasValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ExtendedResult(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", responseName=");
+        builder.append(getOID() == null ? "" : getOID());
+        if (hasValue()) {
+            builder.append(", responseValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    final S getThis() {
+        return (S) this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java
index 44fae48..dd187f4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,110 +27,89 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.ExtendedRequest;
 
-
-
 /**
  * This class provides a skeletal implementation of the
  * {@code ExtendedResultDecoder} interface, to minimize the effort required to
  * implement this interface.
  *
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-public abstract class AbstractExtendedResultDecoder<S extends ExtendedResult>
-    implements ExtendedResultDecoder<S>
-{
-  /**
-   * Creates a new abstract extended result decoder.
-   */
-  protected AbstractExtendedResultDecoder()
-  {
-    // Nothing to do.
-  }
+public abstract class AbstractExtendedResultDecoder<S extends ExtendedResult> implements
+        ExtendedResultDecoder<S> {
+    /**
+     * Creates a new abstract extended result decoder.
+     */
+    protected AbstractExtendedResultDecoder() {
+        // Nothing to do.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public S adaptDecodeException(final DecodeException exception) {
+        final S adaptedResult =
+                newExtendedErrorResult(ResultCode.PROTOCOL_ERROR, "", exception.getMessage());
+        adaptedResult.setCause(exception.getCause());
+        return adaptedResult;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler(
+            final ExtendedRequest<R> request, final ResultHandler<? super R> resultHandler,
+            final DecodeOptions options) {
+        return new ResultHandler<S>() {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public S adaptDecodeException(final DecodeException exception)
-  {
-    final S adaptedResult = newExtendedErrorResult(ResultCode.PROTOCOL_ERROR,
-        "", exception.getMessage());
-    adaptedResult.setCause(exception.getCause());
-    return adaptedResult;
-  }
+            @Override
+            public void handleErrorResult(final ErrorResultException error) {
+                final Result result = error.getResult();
+                final R adaptedResult =
+                        request.getResultDecoder().newExtendedErrorResult(result.getResultCode(),
+                                result.getMatchedDN(), result.getDiagnosticMessage());
+                adaptedResult.setCause(result.getCause());
+                resultHandler.handleErrorResult(newErrorResult(adaptedResult));
+            }
 
+            @Override
+            public void handleResult(final S result) {
+                try {
+                    final R adaptedResult =
+                            request.getResultDecoder().decodeExtendedResult(result, options);
+                    resultHandler.handleResult(adaptedResult);
+                } catch (final DecodeException e) {
+                    final R adaptedResult = request.getResultDecoder().adaptDecodeException(e);
+                    resultHandler.handleErrorResult(newErrorResult(adaptedResult));
+                }
+            }
 
+        };
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler(
-      final ExtendedRequest<R> request,
-      final ResultHandler<? super R> resultHandler, final DecodeOptions options)
-  {
-    return new ResultHandler<S>()
-    {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract S decodeExtendedResult(ExtendedResult result, DecodeOptions options)
+            throws DecodeException;
 
-      @Override
-      public void handleErrorResult(final ErrorResultException error)
-      {
-        final Result result = error.getResult();
-        final R adaptedResult = request.getResultDecoder()
-            .newExtendedErrorResult(result.getResultCode(),
-                result.getMatchedDN(), result.getDiagnosticMessage());
-        adaptedResult.setCause(result.getCause());
-        resultHandler.handleErrorResult(newErrorResult(adaptedResult));
-      }
-
-
-
-      @Override
-      public void handleResult(final S result)
-      {
-        try
-        {
-          final R adaptedResult = request.getResultDecoder()
-              .decodeExtendedResult(result, options);
-          resultHandler.handleResult(adaptedResult);
-        }
-        catch (final DecodeException e)
-        {
-          final R adaptedResult = request.getResultDecoder()
-              .adaptDecodeException(e);
-          resultHandler.handleErrorResult(newErrorResult(adaptedResult));
-        }
-      }
-
-    };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract S decodeExtendedResult(ExtendedResult result,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract S newExtendedErrorResult(ResultCode resultCode,
-      String matchedDN, String diagnosticMessage);
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract S newExtendedErrorResult(ResultCode resultCode, String matchedDN,
+            String diagnosticMessage);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java
index 206848e..406b29d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,102 +27,79 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An abstract Intermediate response which can be used as the basis for
  * implementing new Intermediate responses.
  *
  * @param <S>
- *          The type of Intermediate response.
+ *            The type of Intermediate response.
  */
-public abstract class AbstractIntermediateResponse<S extends IntermediateResponse>
-    extends AbstractResponseImpl<S> implements IntermediateResponse
-{
+public abstract class AbstractIntermediateResponse<S extends IntermediateResponse> extends
+        AbstractResponseImpl<S> implements IntermediateResponse {
 
-  /**
-   * Creates a new intermediate response.
-   */
-  protected AbstractIntermediateResponse()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * Creates a new intermediate response that is an exact copy of the provided
-   * response.
-   *
-   * @param intermediateResponse
-   *          The intermediate response to be copied.
-   * @throws NullPointerException
-   *           If {@code intermediateResponse} was {@code null} .
-   */
-  protected AbstractIntermediateResponse(
-      IntermediateResponse intermediateResponse)
-  {
-    super(intermediateResponse);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public abstract boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("IntermediateResponse(responseName=");
-    builder.append(getOID() == null ? "" : getOID());
-    if (hasValue())
-    {
-      builder.append(", responseValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new intermediate response.
+     */
+    protected AbstractIntermediateResponse() {
+        // Nothing to do.
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
 
+    /**
+     * Creates a new intermediate response that is an exact copy of the provided
+     * response.
+     *
+     * @param intermediateResponse
+     *            The intermediate response to be copied.
+     * @throws NullPointerException
+     *             If {@code intermediateResponse} was {@code null} .
+     */
+    protected AbstractIntermediateResponse(IntermediateResponse intermediateResponse) {
+        super(intermediateResponse);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public abstract String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @SuppressWarnings("unchecked")
-  final S getThis()
-  {
-    return (S) this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public abstract ByteString getValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    public abstract boolean hasValue();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("IntermediateResponse(responseName=");
+        builder.append(getOID() == null ? "" : getOID());
+        if (hasValue()) {
+            builder.append(", responseValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    final S getThis() {
+        return (S) this;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java
index a85dc17..96195d0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
@@ -41,105 +38,79 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
 /**
  * Modifiable response implementation.
  *
  * @param <S>
- *          The type of response.
+ *            The type of response.
  */
-abstract class AbstractResponseImpl<S extends Response> implements Response
-{
-  private final List<Control> controls = new LinkedList<Control>();
+abstract class AbstractResponseImpl<S extends Response> implements Response {
+    private final List<Control> controls = new LinkedList<Control>();
 
-
-
-  /**
-   * Creates a new modifiable response implementation.
-   */
-  AbstractResponseImpl()
-  {
-    // No implementation required.
-  }
-
-
-
-  /**
-   * Creates a new abstract response that is an exact copy of the provided
-   * response.
-   *
-   * @param response
-   *          The response to be copied.
-   * @throws NullPointerException
-   *           If {@code response} was {@code null} .
-   */
-  AbstractResponseImpl(Response response)
-  {
-    Validator.ensureNotNull(response);
-    for (Control control : response.getControls())
-    {
-      // Create defensive copy.
-      controls.add(GenericControl.newControl(control));
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final S addControl(final Control control)
-  {
-    Validator.ensureNotNull(control);
-    controls.add(control);
-    return getThis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final <C extends Control> C getControl(
-      final ControlDecoder<C> decoder, final DecodeOptions options)
-      throws DecodeException
-  {
-    Validator.ensureNotNull(decoder, options);
-
-    // Avoid creating an iterator if possible.
-    if (controls.isEmpty())
-    {
-      return null;
+    /**
+     * Creates a new modifiable response implementation.
+     */
+    AbstractResponseImpl() {
+        // No implementation required.
     }
 
-    for (final Control control : controls)
-    {
-      if (control.getOID().equals(decoder.getOID()))
-      {
-        return decoder.decodeControl(control, options);
-      }
+    /**
+     * Creates a new abstract response that is an exact copy of the provided
+     * response.
+     *
+     * @param response
+     *            The response to be copied.
+     * @throws NullPointerException
+     *             If {@code response} was {@code null} .
+     */
+    AbstractResponseImpl(Response response) {
+        Validator.ensureNotNull(response);
+        for (Control control : response.getControls()) {
+            // Create defensive copy.
+            controls.add(GenericControl.newControl(control));
+        }
     }
 
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final S addControl(final Control control) {
+        Validator.ensureNotNull(control);
+        controls.add(control);
+        return getThis();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final <C extends Control> C getControl(final ControlDecoder<C> decoder,
+            final DecodeOptions options) throws DecodeException {
+        Validator.ensureNotNull(decoder, options);
 
+        // Avoid creating an iterator if possible.
+        if (controls.isEmpty()) {
+            return null;
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final List<Control> getControls()
-  {
-    return controls;
-  }
+        for (final Control control : controls) {
+            if (control.getOID().equals(decoder.getOID())) {
+                return decoder.decodeControl(control, options);
+            }
+        }
 
+        return null;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final List<Control> getControls() {
+        return controls;
+    }
 
-  @Override
-  public abstract String toString();
+    @Override
+    public abstract String toString();
 
-
-
-  abstract S getThis();
+    abstract S getThis();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java
index 5958591..f17fcea 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
@@ -37,210 +34,159 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Modifiable result implementation.
  *
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-abstract class AbstractResultImpl<S extends Result> extends
-    AbstractResponseImpl<S> implements Result
-{
-  // For local errors caused by internal exceptions.
-  private Throwable cause = null;
+abstract class AbstractResultImpl<S extends Result> extends AbstractResponseImpl<S> implements
+        Result {
+    // For local errors caused by internal exceptions.
+    private Throwable cause = null;
 
-  private String diagnosticMessage = "";
+    private String diagnosticMessage = "";
 
-  private String matchedDN = "";
+    private String matchedDN = "";
 
-  private final List<String> referralURIs = new LinkedList<String>();
+    private final List<String> referralURIs = new LinkedList<String>();
 
-  private ResultCode resultCode;
+    private ResultCode resultCode;
 
-
-
-  /**
-   * Creates a new modifiable result implementation using the provided result
-   * code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  AbstractResultImpl(final ResultCode resultCode)
-  {
-    this.resultCode = resultCode;
-  }
-
-
-
-  /**
-   * Creates a new modifiable result that is an exact copy of the provided
-   * result.
-   *
-   * @param result
-   *          The result to be copied.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  AbstractResultImpl(Result result)
-  {
-    super(result);
-    this.cause = result.getCause();
-    this.diagnosticMessage = result.getDiagnosticMessage();
-    this.matchedDN = result.getMatchedDN();
-    this.referralURIs.addAll(result.getReferralURIs());
-    this.resultCode = result.getResultCode();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final S addReferralURI(final String uri)
-  {
-    Validator.ensureNotNull(uri);
-
-    referralURIs.add(uri);
-    return getThis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final Throwable getCause()
-  {
-    return cause;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final String getDiagnosticMessage()
-  {
-    return diagnosticMessage;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final String getMatchedDN()
-  {
-    return matchedDN;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final List<String> getReferralURIs()
-  {
-    return referralURIs;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final ResultCode getResultCode()
-  {
-    return resultCode;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isReferral()
-  {
-    final ResultCode code = getResultCode();
-    return code.equals(ResultCode.REFERRAL);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final boolean isSuccess()
-  {
-    final ResultCode code = getResultCode();
-    return !code.isExceptional();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final S setCause(final Throwable cause)
-  {
-    this.cause = cause;
-    return getThis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final S setDiagnosticMessage(final String message)
-  {
-    if (message == null)
-    {
-      this.diagnosticMessage = "";
-    }
-    else
-    {
-      this.diagnosticMessage = message;
+    /**
+     * Creates a new modifiable result implementation using the provided result
+     * code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    AbstractResultImpl(final ResultCode resultCode) {
+        this.resultCode = resultCode;
     }
 
-    return getThis();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public final S setMatchedDN(final String dn)
-  {
-    if (dn == null)
-    {
-      this.matchedDN = "";
-    }
-    else
-    {
-      this.matchedDN = dn;
+    /**
+     * Creates a new modifiable result that is an exact copy of the provided
+     * result.
+     *
+     * @param result
+     *            The result to be copied.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    AbstractResultImpl(Result result) {
+        super(result);
+        this.cause = result.getCause();
+        this.diagnosticMessage = result.getDiagnosticMessage();
+        this.matchedDN = result.getMatchedDN();
+        this.referralURIs.addAll(result.getReferralURIs());
+        this.resultCode = result.getResultCode();
     }
 
-    return getThis();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final S addReferralURI(final String uri) {
+        Validator.ensureNotNull(uri);
 
+        referralURIs.add(uri);
+        return getThis();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public final Throwable getCause() {
+        return cause;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public final S setResultCode(final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
+    /**
+     * {@inheritDoc}
+     */
+    public final String getDiagnosticMessage() {
+        return diagnosticMessage;
+    }
 
-    this.resultCode = resultCode;
-    return getThis();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public final String getMatchedDN() {
+        return matchedDN;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final List<String> getReferralURIs() {
+        return referralURIs;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final ResultCode getResultCode() {
+        return resultCode;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isReferral() {
+        final ResultCode code = getResultCode();
+        return code.equals(ResultCode.REFERRAL);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isSuccess() {
+        final ResultCode code = getResultCode();
+        return !code.isExceptional();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final S setCause(final Throwable cause) {
+        this.cause = cause;
+        return getThis();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final S setDiagnosticMessage(final String message) {
+        if (message == null) {
+            this.diagnosticMessage = "";
+        } else {
+            this.diagnosticMessage = message;
+        }
+
+        return getThis();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final S setMatchedDN(final String dn) {
+        if (dn == null) {
+            this.matchedDN = "";
+        } else {
+            this.matchedDN = dn;
+        }
+
+        return getThis();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final S setResultCode(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+
+        this.resultCode = resultCode;
+        return getThis();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java
index 9e04c40..a5e3ae6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -34,27 +33,26 @@
  * implementing new unmodifiable Extended operations.
  *
  * @param <S>
- *          The type of Extended result.
+ *            The type of Extended result.
  */
-abstract class AbstractUnmodifiableExtendedResultImpl<S extends ExtendedResult>
-    extends AbstractUnmodifiableResultImpl<S> implements ExtendedResult
-{
-  protected AbstractUnmodifiableExtendedResultImpl(S impl) {
-    super(impl);
-  }
+abstract class AbstractUnmodifiableExtendedResultImpl<S extends ExtendedResult> extends
+        AbstractUnmodifiableResultImpl<S> implements ExtendedResult {
+    protected AbstractUnmodifiableExtendedResultImpl(S impl) {
+        super(impl);
+    }
 
-  @Override
-  public String getOID() {
-    return impl.getOID();
-  }
+    @Override
+    public String getOID() {
+        return impl.getOID();
+    }
 
-  @Override
-  public ByteString getValue() {
-    return impl.getValue();
-  }
+    @Override
+    public ByteString getValue() {
+        return impl.getValue();
+    }
 
-  @Override
-  public boolean hasValue() {
-    return impl.hasValue();
-  }
+    @Override
+    public boolean hasValue() {
+        return impl.hasValue();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java
index 63c6b78..7c5a9cb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -34,28 +33,26 @@
  * for implementing new unmodifiable Intermediate responses.
  *
  * @param <S>
- *          The type of Intermediate response.
+ *            The type of Intermediate response.
  */
-abstract class AbstractUnmodifiableIntermediateResponseImpl
-    <S extends IntermediateResponse> extends AbstractUnmodifiableResponseImpl<S>
-    implements IntermediateResponse
-{
-  protected AbstractUnmodifiableIntermediateResponseImpl(S impl) {
-    super(impl);
-  }
+abstract class AbstractUnmodifiableIntermediateResponseImpl<S extends IntermediateResponse> extends
+        AbstractUnmodifiableResponseImpl<S> implements IntermediateResponse {
+    protected AbstractUnmodifiableIntermediateResponseImpl(S impl) {
+        super(impl);
+    }
 
-  @Override
-  public String getOID() {
-    return impl.getOID();
-  }
+    @Override
+    public String getOID() {
+        return impl.getOID();
+    }
 
-  @Override
-  public ByteString getValue() {
-    return impl.getValue();
-  }
+    @Override
+    public ByteString getValue() {
+        return impl.getValue();
+    }
 
-  @Override
-  public boolean hasValue() {
-    return impl.hasValue();
-  }
+    @Override
+    public boolean hasValue() {
+        return impl.hasValue();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
index 21eaf72..ceb28a9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
@@ -44,130 +41,103 @@
 import com.forgerock.opendj.util.Functions;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Unmodifiable response implementation.
  *
  * @param <S>
- *          The type of response.
+ *            The type of response.
  */
-abstract class AbstractUnmodifiableResponseImpl<S extends Response> implements
-    Response
-{
+abstract class AbstractUnmodifiableResponseImpl<S extends Response> implements Response {
 
-  protected final S impl;
+    protected final S impl;
 
-
-
-  /**
-   * Creates a new unmodifiable response implementation.
-   *
-   * @param impl
-   *          The underlying response implementation to be made unmodifiable.
-   */
-  AbstractUnmodifiableResponseImpl(final S impl)
-  {
-    Validator.ensureNotNull(impl);
-    this.impl = impl;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final S addControl(final Control control)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final <C extends Control> C getControl(
-      final ControlDecoder<C> decoder, final DecodeOptions options)
-      throws DecodeException
-  {
-    Validator.ensureNotNull(decoder, options);
-
-    final List<Control> controls = impl.getControls();
-
-    // Avoid creating an iterator if possible.
-    if (controls.isEmpty())
-    {
-      return null;
+    /**
+     * Creates a new unmodifiable response implementation.
+     *
+     * @param impl
+     *            The underlying response implementation to be made
+     *            unmodifiable.
+     */
+    AbstractUnmodifiableResponseImpl(final S impl) {
+        Validator.ensureNotNull(impl);
+        this.impl = impl;
     }
 
-    for (final Control control : controls)
-    {
-      if (control.getOID().equals(decoder.getOID()))
-      {
-        // Got a match. Return a defensive copy only if necessary.
-        final C decodedControl = decoder.decodeControl(control, options);
-
-        if (decodedControl != control)
-        {
-          // This was not the original control so return it immediately.
-          return decodedControl;
-        }
-        else if (decodedControl instanceof GenericControl)
-        {
-          // Generic controls are immutable, so return it immediately.
-          return decodedControl;
-        }
-        else
-        {
-          // Re-decode to get defensive copy.
-          final GenericControl genericControl = GenericControl
-              .newControl(control);
-          return decoder.decodeControl(genericControl, options);
-        }
-      }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final S addControl(final Control control) {
+        throw new UnsupportedOperationException();
     }
 
-    return null;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final <C extends Control> C getControl(final ControlDecoder<C> decoder,
+            final DecodeOptions options) throws DecodeException {
+        Validator.ensureNotNull(decoder, options);
 
+        final List<Control> controls = impl.getControls();
 
+        // Avoid creating an iterator if possible.
+        if (controls.isEmpty()) {
+            return null;
+        }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final List<Control> getControls()
-  {
-    // We need to make all controls unmodifiable as well, which implies making
-    // defensive copies where necessary.
-    final Function<Control, Control, Void> function = new Function<Control, Control, Void>()
-    {
+        for (final Control control : controls) {
+            if (control.getOID().equals(decoder.getOID())) {
+                // Got a match. Return a defensive copy only if necessary.
+                final C decodedControl = decoder.decodeControl(control, options);
 
-      @Override
-      public Control apply(final Control value, final Void p)
-      {
-        // Return defensive copy.
-        return GenericControl.newControl(value);
-      }
+                if (decodedControl != control) {
+                    // This was not the original control so return it
+                    // immediately.
+                    return decodedControl;
+                } else if (decodedControl instanceof GenericControl) {
+                    // Generic controls are immutable, so return it immediately.
+                    return decodedControl;
+                } else {
+                    // Re-decode to get defensive copy.
+                    final GenericControl genericControl = GenericControl.newControl(control);
+                    return decoder.decodeControl(genericControl, options);
+                }
+            }
+        }
 
-    };
+        return null;
+    }
 
-    final List<Control> unmodifiableControls = Collections2.transformedList(
-        impl.getControls(), function, Functions.<Control> identityFunction());
-    return Collections.unmodifiableList(unmodifiableControls);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final List<Control> getControls() {
+        // We need to make all controls unmodifiable as well, which implies
+        // making
+        // defensive copies where necessary.
+        final Function<Control, Control, Void> function = new Function<Control, Control, Void>() {
 
+            @Override
+            public Control apply(final Control value, final Void p) {
+                // Return defensive copy.
+                return GenericControl.newControl(value);
+            }
 
+        };
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final String toString()
-  {
-    return impl.toString();
-  }
+        final List<Control> unmodifiableControls =
+                Collections2.transformedList(impl.getControls(), function, Functions
+                        .<Control> identityFunction());
+        return Collections.unmodifiableList(unmodifiableControls);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final String toString() {
+        return impl.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java
index f382a6a..115d0d3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,118 +27,76 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.Collections;
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * Unmodifiable result implementation.
  *
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
 abstract class AbstractUnmodifiableResultImpl<S extends Result> extends
-    AbstractUnmodifiableResponseImpl<S> implements Result
-{
+        AbstractUnmodifiableResponseImpl<S> implements Result {
 
-  /**
-   * Creates a new unmodifiable result implementation.
-   *
-   * @param impl
-   *          The underlying result implementation to be made unmodifiable.
-   */
-  AbstractUnmodifiableResultImpl(final S impl)
-  {
-    super(impl);
-  }
+    /**
+     * Creates a new unmodifiable result implementation.
+     *
+     * @param impl
+     *            The underlying result implementation to be made unmodifiable.
+     */
+    AbstractUnmodifiableResultImpl(final S impl) {
+        super(impl);
+    }
 
+    public final S addReferralURI(final String uri) {
+        throw new UnsupportedOperationException();
+    }
 
+    public final Throwable getCause() {
+        return impl.getCause();
+    }
 
-  public final S addReferralURI(final String uri)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public final String getDiagnosticMessage() {
+        return impl.getDiagnosticMessage();
+    }
 
+    public final String getMatchedDN() {
+        return impl.getMatchedDN();
+    }
 
+    public final List<String> getReferralURIs() {
+        return Collections.unmodifiableList(impl.getReferralURIs());
+    }
 
-  public final Throwable getCause()
-  {
-    return impl.getCause();
-  }
+    public final ResultCode getResultCode() {
+        return impl.getResultCode();
+    }
 
+    public final boolean isReferral() {
+        return impl.isReferral();
+    }
 
+    public final boolean isSuccess() {
+        return impl.isSuccess();
+    }
 
-  public final String getDiagnosticMessage()
-  {
-    return impl.getDiagnosticMessage();
-  }
+    public final S setCause(final Throwable cause) {
+        throw new UnsupportedOperationException();
+    }
 
+    public final S setDiagnosticMessage(final String message) {
+        throw new UnsupportedOperationException();
+    }
 
+    public final S setMatchedDN(final String dn) {
+        throw new UnsupportedOperationException();
+    }
 
-  public final String getMatchedDN()
-  {
-    return impl.getMatchedDN();
-  }
-
-
-
-  public final List<String> getReferralURIs()
-  {
-    return Collections.unmodifiableList(impl.getReferralURIs());
-  }
-
-
-
-  public final ResultCode getResultCode()
-  {
-    return impl.getResultCode();
-  }
-
-
-
-  public final boolean isReferral()
-  {
-    return impl.isReferral();
-  }
-
-
-
-  public final boolean isSuccess()
-  {
-    return impl.isSuccess();
-  }
-
-
-
-  public final S setCause(final Throwable cause)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public final S setDiagnosticMessage(final String message)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public final S setMatchedDN(final String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public final S setResultCode(final ResultCode resultCode)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public final S setResultCode(final ResultCode resultCode) {
+        throw new UnsupportedOperationException();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java
index f6e5ed5..69d9735 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,8 +36,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Bind result indicates the status of the client's request for
  * authentication.
@@ -61,151 +56,116 @@
  * {@link ResultCode#SASL_BIND_IN_PROGRESS} and can be determined by invoking
  * the {@link #isSASLBindInProgress} method.
  */
-public interface BindResult extends Result
-{
-  /**
-   * {@inheritDoc}
-   */
-  BindResult addControl(Control control);
+public interface BindResult extends Result {
+    /**
+     * {@inheritDoc}
+     */
+    BindResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindResult addReferralURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
-  /**
-   * {@inheritDoc}
-   */
-  BindResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the server SASL credentials associated with this bind result.
+     *
+     * @return The server SASL credentials, or {@code null} indicating that none
+     *         was provided.
+     */
+    ByteString getServerSASLCredentials();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * Indicates whether or not the server requires the client to send a new
+     * SASL Bind request with the same SASL mechanism in order to continue the
+     * authentication process. This typically occurs during multi-stage
+     * (challenge response) authentication.
+     * <p>
+     * Specifically, this method returns {@code true} if the result code is
+     * equal to {@link ResultCode#SASL_BIND_IN_PROGRESS}.
+     *
+     * @return {@code true} if the server requires the client to send a new SASL
+     *         Bind request, otherwise {@code false}.
+     */
+    boolean isSASLBindInProgress();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
+    /**
+     * {@inheritDoc}
+     */
+    BindResult setCause(Throwable cause);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindResult setDiagnosticMessage(String message);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
+    /**
+     * {@inheritDoc}
+     */
+    BindResult setMatchedDN(String dn);
 
+    /**
+     * {@inheritDoc}
+     */
+    BindResult setResultCode(ResultCode resultCode);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * Returns the server SASL credentials associated with this bind result.
-   *
-   * @return The server SASL credentials, or {@code null} indicating that none
-   *         was provided.
-   */
-  ByteString getServerSASLCredentials();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * Indicates whether or not the server requires the client to send a new SASL
-   * Bind request with the same SASL mechanism in order to continue the
-   * authentication process. This typically occurs during multi-stage (challenge
-   * response) authentication.
-   * <p>
-   * Specifically, this method returns {@code true} if the result code is equal
-   * to {@link ResultCode#SASL_BIND_IN_PROGRESS}.
-   *
-   * @return {@code true} if the server requires the client to send a new SASL
-   *         Bind request, otherwise {@code false}.
-   */
-  boolean isSASLBindInProgress();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  BindResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  BindResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  BindResult setMatchedDN(String dn);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  BindResult setResultCode(ResultCode resultCode);
-
-
-
-  /**
-   * Sets the server SASL credentials associated with this bind result.
-   *
-   * @param credentials
-   *          The server SASL credentials associated with this bind result,
-   *          which may be {@code null} indicating that none was provided.
-   * @return This bind result.
-   * @throws UnsupportedOperationException
-   *           If this bind result does not permit the server SASL credentials
-   *           to be set.
-   */
-  BindResult setServerSASLCredentials(ByteString credentials);
+    /**
+     * Sets the server SASL credentials associated with this bind result.
+     *
+     * @param credentials
+     *            The server SASL credentials associated with this bind result,
+     *            which may be {@code null} indicating that none was provided.
+     * @return This bind result.
+     * @throws UnsupportedOperationException
+     *             If this bind result does not permit the server SASL
+     *             credentials to be set.
+     */
+    BindResult setServerSASLCredentials(ByteString credentials);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java
index 753cf7a..a73ae77 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,117 +27,89 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * Bind result implementation.
  */
-final class BindResultImpl extends AbstractResultImpl<BindResult> implements
-    BindResult
-{
-  private ByteString credentials = null;
+final class BindResultImpl extends AbstractResultImpl<BindResult> implements BindResult {
+    private ByteString credentials = null;
 
+    /**
+     * Creates a new bind result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    BindResultImpl(final ResultCode resultCode) {
+        super(resultCode);
+    }
 
+    /**
+     * Creates a new bind result that is an exact copy of the provided result.
+     *
+     * @param bindResult
+     *            The bind result to be copied.
+     * @throws NullPointerException
+     *             If {@code bindResult} was {@code null} .
+     */
+    BindResultImpl(final BindResult bindResult) {
+        super(bindResult);
+        this.credentials = bindResult.getServerSASLCredentials();
+    }
 
-  /**
-   * Creates a new bind result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  BindResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getServerSASLCredentials() {
+        return credentials;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSASLBindInProgress() {
+        final ResultCode code = getResultCode();
+        return code.equals(ResultCode.SASL_BIND_IN_PROGRESS);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public BindResult setServerSASLCredentials(final ByteString credentials) {
+        this.credentials = credentials;
+        return this;
+    }
 
-  /**
-   * Creates a new bind result that is an exact copy of the provided
-   * result.
-   *
-   * @param bindResult
-   *          The bind result to be copied.
-   * @throws NullPointerException
-   *           If {@code bindResult} was {@code null} .
-   */
-  BindResultImpl(final BindResult bindResult)
-  {
-    super(bindResult);
-    this.credentials = bindResult.getServerSASLCredentials();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("BindResult(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", serverSASLCreds=");
+        builder.append(getServerSASLCredentials() == null ? ByteString.empty()
+                : getServerSASLCredentials());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getServerSASLCredentials()
-  {
-    return credentials;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean isSASLBindInProgress()
-  {
-    final ResultCode code = getResultCode();
-    return code.equals(ResultCode.SASL_BIND_IN_PROGRESS);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public BindResult setServerSASLCredentials(final ByteString credentials)
-  {
-    this.credentials = credentials;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("BindResult(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", serverSASLCreds=");
-    builder.append(getServerSASLCredentials() == null ? ByteString.empty()
-        : getServerSASLCredentials());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  BindResult getThis()
-  {
-    return this;
-  }
+    @Override
+    BindResult getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java
index e1a2775..e29932a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,8 +34,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * An Compare result indicates the final status of an Compare operation.
  * <p>
@@ -47,125 +42,94 @@
  * then the result code is set to {@link ResultCode#COMPARE_TRUE} and can be
  * determined by invoking the {@link #matched} method.
  */
-public interface CompareResult extends Result
-{
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult addControl(Control control);
+public interface CompareResult extends Result {
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult addReferralURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
+    /**
+     * Indicates whether or not the attribute value assertion in the Compare
+     * request matched a value of the attribute or sub-type according to the
+     * attribute's equality matching rule.
+     * <p>
+     * Specifically, this method returns {@code true} if the result code is
+     * equal to {@link ResultCode#COMPARE_TRUE}.
+     *
+     * @return {@code true} if the attribute value assertion matched, otherwise
+     *         {@code false}.
+     */
+    boolean matched();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult setCause(Throwable cause);
 
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult setDiagnosticMessage(String message);
 
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult setMatchedDN(String dn);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * Indicates whether or not the attribute value assertion in the Compare
-   * request matched a value of the attribute or sub-type according to the
-   * attribute's equality matching rule.
-   * <p>
-   * Specifically, this method returns {@code true} if the result code is equal
-   * to {@link ResultCode#COMPARE_TRUE}.
-   *
-   * @return {@code true} if the attribute value assertion matched, otherwise
-   *         {@code false}.
-   */
-  boolean matched();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult setMatchedDN(String dn);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  CompareResult setResultCode(ResultCode resultCode);
+    /**
+     * {@inheritDoc}
+     */
+    CompareResult setResultCode(ResultCode resultCode);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java
index 0b72ad8..f60cca9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,88 +27,69 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * Compare result implementation.
  */
-final class CompareResultImpl extends AbstractResultImpl<CompareResult>
-    implements CompareResult
-{
+final class CompareResultImpl extends AbstractResultImpl<CompareResult> implements CompareResult {
 
-  /**
-   * Creates a new compare result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  CompareResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
+    /**
+     * Creates a new compare result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    CompareResultImpl(final ResultCode resultCode) {
+        super(resultCode);
+    }
 
+    /**
+     * Creates a new compare result that is an exact copy of the provided
+     * result.
+     *
+     * @param compareResult
+     *            The compare result to be copied.
+     * @throws NullPointerException
+     *             If {@code compareResult} was {@code null} .
+     */
+    CompareResultImpl(final CompareResult compareResult) {
+        super(compareResult);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean matched() {
+        final ResultCode code = getResultCode();
+        return code.equals(ResultCode.COMPARE_TRUE);
+    }
 
-  /**
-   * Creates a new compare result that is an exact copy of the provided
-   * result.
-   *
-   * @param compareResult
-   *          The compare result to be copied.
-   * @throws NullPointerException
-   *           If {@code compareResult} was {@code null} .
-   */
-  CompareResultImpl(final CompareResult compareResult)
-  {
-    super(compareResult);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("CompareResult(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean matched()
-  {
-    final ResultCode code = getResultCode();
-    return code.equals(ResultCode.COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("CompareResult(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  CompareResult getThis()
-  {
-    return this;
-  }
+    @Override
+    CompareResult getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java
index 74ce87a..2ab769d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,151 +36,114 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Extended result indicates the status of an Extended operation and any
  * additional information associated with the Extended operation, including the
  * optional response name and value. These can be retrieved using the
  * {@link #getOID} and {@link #getValue} methods respectively.
  */
-public interface ExtendedResult extends Result
-{
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult addControl(Control control);
+public interface ExtendedResult extends Result {
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult addReferralURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * Returns the numeric OID, if any, associated with this extended result.
+     *
+     * @return The numeric OID associated with this extended result, or
+     *         {@code null} if there is no OID.
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
+    /**
+     * Returns the value, if any, associated with this extended result. Its
+     * format is defined by the specification of this extended result.
+     *
+     * @return The value associated with this extended result, or {@code null}
+     *         if there is no value.
+     */
+    ByteString getValue();
 
+    /**
+     * Returns {@code true} if this extended result has a value. In some
+     * circumstances it may be useful to determine if a extended result has a
+     * value, without actually calculating the value and incurring any
+     * performance costs.
+     *
+     * @return {@code true} if this extended result has a value, or
+     *         {@code false} if there is no value.
+     */
+    boolean hasValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult setCause(Throwable cause);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult setDiagnosticMessage(String message);
 
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult setMatchedDN(String dn);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * Returns the numeric OID, if any, associated with this extended result.
-   *
-   * @return The numeric OID associated with this extended result, or {@code
-   *         null} if there is no OID.
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * Returns the value, if any, associated with this extended result. Its format
-   * is defined by the specification of this extended result.
-   *
-   * @return The value associated with this extended result, or {@code null} if
-   *         there is no value.
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * Returns {@code true} if this extended result has a value. In some
-   * circumstances it may be useful to determine if a extended result has a
-   * value, without actually calculating the value and incurring any performance
-   * costs.
-   *
-   * @return {@code true} if this extended result has a value, or {@code false}
-   *         if there is no value.
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult setMatchedDN(String dn);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ExtendedResult setResultCode(ResultCode resultCode);
+    /**
+     * {@inheritDoc}
+     */
+    ExtendedResult setResultCode(ResultCode resultCode);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java
index fc9e31b..5165fa1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,108 +27,96 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.ExtendedRequest;
 
-
-
 /**
  * A factory interface for decoding a generic extended result as an extended
  * result of specific type.
  *
  * @param <S>
- *          The type of result.
+ *            The type of result.
  */
-public interface ExtendedResultDecoder<S extends ExtendedResult>
-{
+public interface ExtendedResultDecoder<S extends ExtendedResult> {
 
-  /**
-   * Creates a new extended operation error result using the provided decoding
-   * exception. This method should be used to adapt {@code DecodeException}
-   * encountered while decoding an extended request or result. The returned
-   * error result will have the result code {@link ResultCode#PROTOCOL_ERROR}.
-   *
-   * @param exception
-   *          The decoding exception to be adapted.
-   * @return An extended operation error result representing the decoding
-   *         exception.
-   * @throws NullPointerException
-   *           If {@code exception} was {@code null}.
-   */
-  S adaptDecodeException(DecodeException exception);
+    /**
+     * Creates a new extended operation error result using the provided decoding
+     * exception. This method should be used to adapt {@code DecodeException}
+     * encountered while decoding an extended request or result. The returned
+     * error result will have the result code {@link ResultCode#PROTOCOL_ERROR}.
+     *
+     * @param exception
+     *            The decoding exception to be adapted.
+     * @return An extended operation error result representing the decoding
+     *         exception.
+     * @throws NullPointerException
+     *             If {@code exception} was {@code null}.
+     */
+    S adaptDecodeException(DecodeException exception);
 
+    /**
+     * Adapts the provided extended result handler into a result handler which
+     * is compatible with this extended result decoder. Extended results handled
+     * by the returned handler will be automatically converted and passed to the
+     * provided result handler. Decoding errors encountered while decoding the
+     * extended result will be converted into protocol errors.
+     *
+     * @param <R>
+     *            The type of result handler to be adapted.
+     * @param request
+     *            The extended request whose result handler is to be adapted.
+     * @param resultHandler
+     *            The extended result handler which is to be adapted.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the extended operation result.
+     * @return A result handler which is compatible with this extended result
+     *         decoder.
+     */
+    <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler(
+            final ExtendedRequest<R> request, final ResultHandler<? super R> resultHandler,
+            DecodeOptions options);
 
+    /**
+     * Decodes the provided extended operation result as a {@code Result} of
+     * type {@code S}. This method is called when an extended result is received
+     * from the server. The result may indicate success or failure of the
+     * extended request.
+     *
+     * @param result
+     *            The extended operation result to be decoded.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the extended operation result.
+     * @return The decoded extended operation result.
+     * @throws DecodeException
+     *             If the provided extended operation result could not be
+     *             decoded. For example, if the request name was wrong, or if
+     *             the request value was invalid.
+     */
+    S decodeExtendedResult(ExtendedResult result, DecodeOptions options) throws DecodeException;
 
-  /**
-   * Adapts the provided extended result handler into a result handler which is
-   * compatible with this extended result decoder. Extended results handled by
-   * the returned handler will be automatically converted and passed to the
-   * provided result handler. Decoding errors encountered while decoding the
-   * extended result will be converted into protocol errors.
-   *
-   * @param <R>
-   *          The type of result handler to be adapted.
-   * @param request
-   *          The extended request whose result handler is to be adapted.
-   * @param resultHandler
-   *          The extended result handler which is to be adapted.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          extended operation result.
-   * @return A result handler which is compatible with this extended result
-   *         decoder.
-   */
-  <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler(
-      final ExtendedRequest<R> request,
-      final ResultHandler<? super R> resultHandler, DecodeOptions options);
-
-
-
-  /**
-   * Decodes the provided extended operation result as a {@code Result} of type
-   * {@code S}. This method is called when an extended result is received from
-   * the server. The result may indicate success or failure of the extended
-   * request.
-   *
-   * @param result
-   *          The extended operation result to be decoded.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          extended operation result.
-   * @return The decoded extended operation result.
-   * @throws DecodeException
-   *           If the provided extended operation result could not be decoded.
-   *           For example, if the request name was wrong, or if the request
-   *           value was invalid.
-   */
-  S decodeExtendedResult(ExtendedResult result, DecodeOptions options)
-      throws DecodeException;
-
-
-
-  /**
-   * Creates a new extended error result using the provided result code, matched
-   * DN, and diagnostic message. This method is called when a generic failure
-   * occurs, such as a connection failure, and the error result needs to be
-   * converted to a {@code Result} of type {@code S}.
-   *
-   * @param resultCode
-   *          The result code.
-   * @param matchedDN
-   *          The matched DN, which may be empty if none was provided.
-   * @param diagnosticMessage
-   *          The diagnostic message, which may be empty if none was provided.
-   * @return The decoded extended operation error result.
-   * @throws NullPointerException
-   *           If {@code resultCode}, {@code matchedDN}, or
-   *           {@code diagnosticMessage} were {@code null}.
-   */
-  S newExtendedErrorResult(ResultCode resultCode, String matchedDN,
-      String diagnosticMessage);
+    /**
+     * Creates a new extended error result using the provided result code,
+     * matched DN, and diagnostic message. This method is called when a generic
+     * failure occurs, such as a connection failure, and the error result needs
+     * to be converted to a {@code Result} of type {@code S}.
+     *
+     * @param resultCode
+     *            The result code.
+     * @param matchedDN
+     *            The matched DN, which may be empty if none was provided.
+     * @param diagnosticMessage
+     *            The diagnostic message, which may be empty if none was
+     *            provided.
+     * @return The decoded extended operation error result.
+     * @throws NullPointerException
+     *             If {@code resultCode}, {@code matchedDN}, or
+     *             {@code diagnosticMessage} were {@code null}.
+     */
+    S newExtendedErrorResult(ResultCode resultCode, String matchedDN, String diagnosticMessage);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java
index 30b06ab..935dcb2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,168 +36,127 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Generic Extended result indicates the final status of an Generic Extended
  * operation.
  */
-public interface GenericExtendedResult extends ExtendedResult
-{
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult addControl(Control control);
+public interface GenericExtendedResult extends ExtendedResult {
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult addReferralURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult setCause(Throwable cause);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult setDiagnosticMessage(String message);
 
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult setMatchedDN(String dn);
 
+    /**
+     * Sets the numeric OID, if any, associated with this extended result.
+     *
+     * @param oid
+     *            The numeric OID associated with this extended result, or
+     *            {@code null} if there is no value.
+     * @return This generic extended result.
+     * @throws UnsupportedOperationException
+     *             If this generic extended result does not permit the result
+     *             name to be set.
+     */
+    GenericExtendedResult setOID(String oid);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
+    /**
+     * {@inheritDoc}
+     */
+    GenericExtendedResult setResultCode(ResultCode resultCode);
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult setMatchedDN(String dn);
-
-
-
-  /**
-   * Sets the numeric OID, if any, associated with this extended result.
-   *
-   * @param oid
-   *          The numeric OID associated with this extended result, or {@code
-   *          null} if there is no value.
-   * @return This generic extended result.
-   * @throws UnsupportedOperationException
-   *           If this generic extended result does not permit the result name
-   *           to be set.
-   */
-  GenericExtendedResult setOID(String oid);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  GenericExtendedResult setResultCode(ResultCode resultCode);
-
-
-
-  /**
-   * Sets the value, if any, associated with this extended result. Its format is
-   * defined by the specification of this extended result.
-   *
-   * @param bytes
-   *          The value associated with this extended result, or {@code null} if
-   *          there is no value.
-   * @return This generic extended result.
-   * @throws UnsupportedOperationException
-   *           If this generic extended result does not permit the result value
-   *           to be set.
-   */
-  GenericExtendedResult setValue(ByteString bytes);
+    /**
+     * Sets the value, if any, associated with this extended result. Its format
+     * is defined by the specification of this extended result.
+     *
+     * @param bytes
+     *            The value associated with this extended result, or
+     *            {@code null} if there is no value.
+     * @return This generic extended result.
+     * @throws UnsupportedOperationException
+     *             If this generic extended result does not permit the result
+     *             value to be set.
+     */
+    GenericExtendedResult setValue(ByteString bytes);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java
index 2d54eb2..27ed19d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,139 +27,108 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ResultCode;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Generic extended result implementation.
  */
-final class GenericExtendedResultImpl extends
-    AbstractExtendedResult<GenericExtendedResult> implements ExtendedResult,
-    GenericExtendedResult
-{
+final class GenericExtendedResultImpl extends AbstractExtendedResult<GenericExtendedResult>
+        implements ExtendedResult, GenericExtendedResult {
 
-  private String responseName = null;
+    private String responseName = null;
 
-  private ByteString responseValue = null;
+    private ByteString responseValue = null;
 
-
-
-  /**
-   * Creates a new generic extended result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  GenericExtendedResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new generic extended result that is an exact copy of the provided
-   * result.
-   *
-   * @param genericExtendedResult
-   *          The generic extended result to be copied.
-   * @throws NullPointerException
-   *           If {@code genericExtendedResult} was {@code null} .
-   */
-  GenericExtendedResultImpl(final GenericExtendedResult genericExtendedResult)
-  {
-    super(genericExtendedResult);
-    this.responseName = genericExtendedResult.getOID();
-    this.responseValue = genericExtendedResult.getValue();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getOID()
-  {
-    return responseName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getValue()
-  {
-    return responseValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean hasValue()
-  {
-    return responseValue != null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericExtendedResult setOID(final String oid)
-  {
-    this.responseName = oid;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericExtendedResult setValue(final ByteString bytes)
-  {
-    this.responseValue = bytes;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GenericExtendedResult(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", responseName=");
-    builder.append(getOID() == null ? "" : getOID());
-    if (hasValue())
-    {
-      builder.append(", responseValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new generic extended result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    GenericExtendedResultImpl(final ResultCode resultCode) {
+        super(resultCode);
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * Creates a new generic extended result that is an exact copy of the
+     * provided result.
+     *
+     * @param genericExtendedResult
+     *            The generic extended result to be copied.
+     * @throws NullPointerException
+     *             If {@code genericExtendedResult} was {@code null} .
+     */
+    GenericExtendedResultImpl(final GenericExtendedResult genericExtendedResult) {
+        super(genericExtendedResult);
+        this.responseName = genericExtendedResult.getOID();
+        this.responseValue = genericExtendedResult.getValue();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOID() {
+        return responseName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getValue() {
+        return responseValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue() {
+        return responseValue != null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericExtendedResult setOID(final String oid) {
+        this.responseName = oid;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericExtendedResult setValue(final ByteString bytes) {
+        this.responseValue = bytes;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GenericExtendedResult(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", responseName=");
+        builder.append(getOID() == null ? "" : getOID());
+        if (hasValue()) {
+            builder.append(", responseValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java
index 8891242..3162a04 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -38,84 +35,67 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Generic Intermediate response provides a mechanism for communicating
  * unrecognized or unsupported Intermediate responses to the client.
  */
-public interface GenericIntermediateResponse extends IntermediateResponse
-{
-  /**
-   * {@inheritDoc}
-   */
-  GenericIntermediateResponse addControl(Control control);
+public interface GenericIntermediateResponse extends IntermediateResponse {
+    /**
+     * {@inheritDoc}
+     */
+    GenericIntermediateResponse addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Sets the numeric OID, if any, associated with this intermediate response.
+     *
+     * @param oid
+     *            The numeric OID associated with this intermediate response, or
+     *            {@code null} if there is no value.
+     * @return This generic intermediate response.
+     * @throws UnsupportedOperationException
+     *             If this intermediate response does not permit the response
+     *             name to be set.
+     */
+    GenericIntermediateResponse setOID(String oid);
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * Sets the numeric OID, if any, associated with this intermediate response.
-   *
-   * @param oid
-   *          The numeric OID associated with this intermediate response, or
-   *          {@code null} if there is no value.
-   * @return This generic intermediate response.
-   * @throws UnsupportedOperationException
-   *           If this intermediate response does not permit the response name
-   *           to be set.
-   */
-  GenericIntermediateResponse setOID(String oid);
-
-
-
-  /**
-   * Sets the value, if any, associated with this intermediate response. Its
-   * format is defined by the specification of this intermediate response.
-   *
-   * @param bytes
-   *          The value associated with this intermediate response, or {@code
-   *          null} if there is no value.
-   * @return This generic intermediate response.
-   * @throws UnsupportedOperationException
-   *           If this intermediate response does not permit the response value
-   *           to be set.
-   */
-  GenericIntermediateResponse setValue(ByteString bytes);
+    /**
+     * Sets the value, if any, associated with this intermediate response. Its
+     * format is defined by the specification of this intermediate response.
+     *
+     * @param bytes
+     *            The value associated with this intermediate response, or
+     *            {@code null} if there is no value.
+     * @return This generic intermediate response.
+     * @throws UnsupportedOperationException
+     *             If this intermediate response does not permit the response
+     *             value to be set.
+     */
+    GenericIntermediateResponse setValue(ByteString bytes);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java
index 89a13c2..8c9a813 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,141 +27,109 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Generic intermediate response implementation.
  */
 final class GenericIntermediateResponseImpl extends
-    AbstractIntermediateResponse<GenericIntermediateResponse> implements
-    GenericIntermediateResponse
-{
+        AbstractIntermediateResponse<GenericIntermediateResponse> implements
+        GenericIntermediateResponse {
 
-  private String responseName = null;
+    private String responseName = null;
 
-  private ByteString responseValue = null;
+    private ByteString responseValue = null;
 
-
-
-  /**
-   * Creates a new generic intermediate response using the provided response
-   * name and value.
-   *
-   * @param responseName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to this intermediate response, which may be {@code null}
-   *          indicating that none was provided.
-   * @param responseValue
-   *          The response value associated with this generic intermediate
-   *          response, which may be {@code null} indicating that none was
-   *          provided.
-   */
-  GenericIntermediateResponseImpl(final String responseName,
-      final ByteString responseValue)
-  {
-    this.responseName = responseName;
-    this.responseValue = responseValue;
-  }
-
-
-
-  /**
-   * Creates a new generic intermediate response that is an exact copy of the
-   * provided result.
-   *
-   * @param genericIntermediateResponse
-   *          The generic intermediate response to be copied.
-   * @throws NullPointerException
-   *           If {@code genericExtendedResult} was {@code null} .
-   */
-  GenericIntermediateResponseImpl(
-      final GenericIntermediateResponse genericIntermediateResponse)
-  {
-    super(genericIntermediateResponse);
-    this.responseName = genericIntermediateResponse.getOID();
-    this.responseValue = genericIntermediateResponse.getValue();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    return responseName;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return responseValue;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return responseValue != null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericIntermediateResponse setOID(final String oid)
-  {
-    this.responseName = oid;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public GenericIntermediateResponse setValue(final ByteString bytes)
-  {
-    this.responseValue = bytes;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("GenericIntermediateResponse(responseName=");
-    builder.append(getOID() == null ? "" : getOID());
-    if (hasValue())
-    {
-      builder.append(", requestValue=");
-      StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+    /**
+     * Creates a new generic intermediate response using the provided response
+     * name and value.
+     *
+     * @param responseName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to this intermediate response, which may be
+     *            {@code null} indicating that none was provided.
+     * @param responseValue
+     *            The response value associated with this generic intermediate
+     *            response, which may be {@code null} indicating that none was
+     *            provided.
+     */
+    GenericIntermediateResponseImpl(final String responseName, final ByteString responseValue) {
+        this.responseName = responseName;
+        this.responseValue = responseValue;
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * Creates a new generic intermediate response that is an exact copy of the
+     * provided result.
+     *
+     * @param genericIntermediateResponse
+     *            The generic intermediate response to be copied.
+     * @throws NullPointerException
+     *             If {@code genericExtendedResult} was {@code null} .
+     */
+    GenericIntermediateResponseImpl(final GenericIntermediateResponse genericIntermediateResponse) {
+        super(genericIntermediateResponse);
+        this.responseName = genericIntermediateResponse.getOID();
+        this.responseValue = genericIntermediateResponse.getValue();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        return responseName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return responseValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return responseValue != null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericIntermediateResponse setOID(final String oid) {
+        this.responseName = oid;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GenericIntermediateResponse setValue(final ByteString bytes) {
+        this.responseValue = bytes;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("GenericIntermediateResponse(responseName=");
+        builder.append(getOID() == null ? "" : getOID());
+        if (hasValue()) {
+            builder.append(", requestValue=");
+            StaticUtils.toHexPlusAscii(getValue(), builder, 4);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java
index 3e9e448..fe7b4b7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -38,8 +35,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * An Intermediate response provides a general mechanism for defining
  * single-request/multiple-response operations. This response is intended to be
@@ -52,61 +47,50 @@
  * These can be retrieved using the {@link #getOID} and {@link #getValue}
  * methods respectively.
  */
-public interface IntermediateResponse extends Response
-{
-  /**
-   * {@inheritDoc}
-   */
-  IntermediateResponse addControl(Control control);
+public interface IntermediateResponse extends Response {
+    /**
+     * {@inheritDoc}
+     */
+    IntermediateResponse addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Returns the numeric OID, if any, associated with this intermediate
+     * response.
+     *
+     * @return The numeric OID associated with this intermediate response, or
+     *         {@code null} if there is no OID.
+     */
+    String getOID();
 
+    /**
+     * Returns the value, if any, associated with this intermediate response.
+     * Its format is defined by the specification of this intermediate response.
+     *
+     * @return The value associated with this intermediate response, or
+     *         {@code null} if there is no value.
+     */
+    ByteString getValue();
 
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns the numeric OID, if any, associated with this intermediate
-   * response.
-   *
-   * @return The numeric OID associated with this intermediate response, or
-   *         {@code null} if there is no OID.
-   */
-  String getOID();
-
-
-
-  /**
-   * Returns the value, if any, associated with this intermediate response. Its
-   * format is defined by the specification of this intermediate response.
-   *
-   * @return The value associated with this intermediate response, or {@code
-   *         null} if there is no value.
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * Returns {@code true} if this intermediate response has a value. In some
-   * circumstances it may be useful to determine if an intermediate response has
-   * a value, without actually calculating the value and incurring any
-   * performance costs.
-   *
-   * @return {@code true} if this intermediate response has a value, or {@code
-   *         false} if there is no value.
-   */
-  boolean hasValue();
+    /**
+     * Returns {@code true} if this intermediate response has a value. In some
+     * circumstances it may be useful to determine if an intermediate response
+     * has a value, without actually calculating the value and incurring any
+     * performance costs.
+     *
+     * @return {@code true} if this intermediate response has a value, or
+     *         {@code false} if there is no value.
+     */
+    boolean hasValue();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java
index 9aa74a3..2cc808f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -39,8 +36,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The password modify extended result as defined in RFC 3062. The result
  * includes the generated password, if requested, but only if the modify request
@@ -50,174 +45,133 @@
  * @see <a href="http://tools.ietf.org/html/rfc3909">RFC 3062 - LDAP Password
  *      Modify Extended Operation </a>
  */
-public interface PasswordModifyExtendedResult extends ExtendedResult
-{
+public interface PasswordModifyExtendedResult extends ExtendedResult {
 
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult addReferralURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * Returns the newly generated password, but only if the password modify
+     * request succeeded and a generated password was requested.
+     *
+     * @return The newly generated password, or {@code null} if the password
+     *         modify request failed or a generated password was not requested.
+     */
+    ByteString getGeneratedPassword();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult setCause(Throwable cause);
 
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult setDiagnosticMessage(String message);
 
+    /**
+     * Sets the generated password.
+     *
+     * @param password
+     *            The generated password, or {@code null} if there is no
+     *            generated password associated with this result.
+     * @return This password modify result.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended result does not permit the
+     *             generated password to be set.
+     */
+    PasswordModifyExtendedResult setGeneratedPassword(ByteString password);
 
-  /**
-   * Returns the newly generated password, but only if the password modify
-   * request succeeded and a generated password was requested.
-   *
-   * @return The newly generated password, or {@code null} if the password
-   *         modify request failed or a generated password was not requested.
-   */
-  ByteString getGeneratedPassword();
+    /**
+     * Sets the generated password. The password will be converted to a UTF-8
+     * octet string.
+     *
+     * @param password
+     *            The generated password, or {@code null} if there is no
+     *            generated password associated with this result.
+     * @return This password modify result.
+     * @throws UnsupportedOperationException
+     *             If this password modify extended result does not permit the
+     *             generated password to be set.
+     */
+    PasswordModifyExtendedResult setGeneratedPassword(char[] password);
 
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult setMatchedDN(String dn);
 
-
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * Sets the generated password.
-   *
-   * @param password
-   *          The generated password, or {@code null} if there is no generated
-   *          password associated with this result.
-   * @return This password modify result.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended result does not permit the
-   *           generated password to be set.
-   */
-  PasswordModifyExtendedResult setGeneratedPassword(ByteString password);
-
-
-
-  /**
-   * Sets the generated password. The password will be converted to a UTF-8
-   * octet string.
-   *
-   * @param password
-   *          The generated password, or {@code null} if there is no generated
-   *          password associated with this result.
-   * @return This password modify result.
-   * @throws UnsupportedOperationException
-   *           If this password modify extended result does not permit the
-   *           generated password to be set.
-   */
-  PasswordModifyExtendedResult setGeneratedPassword(char[] password);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult setMatchedDN(String dn);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  PasswordModifyExtendedResult setResultCode(ResultCode resultCode);
+    /**
+     * {@inheritDoc}
+     */
+    PasswordModifyExtendedResult setResultCode(ResultCode resultCode);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java
index 6c6dbd2..5f03a30 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.asn1.ASN1;
@@ -38,163 +35,123 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * Password modify extended result implementation.
  */
 final class PasswordModifyExtendedResultImpl extends
-    AbstractExtendedResult<PasswordModifyExtendedResult> implements
-    PasswordModifyExtendedResult
-{
-  private ByteString password;
+        AbstractExtendedResult<PasswordModifyExtendedResult> implements
+        PasswordModifyExtendedResult {
+    private ByteString password;
 
-  /**
-   * The ASN.1 element type that will be used to encode the genPasswd component
-   * in a password modify extended response.
-   */
-  private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD =
-      (byte) 0x80;
+    /**
+     * The ASN.1 element type that will be used to encode the genPasswd
+     * component in a password modify extended response.
+     */
+    private static final byte TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD = (byte) 0x80;
 
-
-
-  // Instantiation via factory.
-  PasswordModifyExtendedResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new password modify extended result that is an exact copy of the
-   * provided result.
-   *
-   * @param passwordModifyExtendedResult
-   *          The password modify extended result to be copied.
-   * @throws NullPointerException
-   *           If {@code passwordModifyExtendedResult} was {@code null} .
-   */
-  PasswordModifyExtendedResultImpl(
-      final PasswordModifyExtendedResult passwordModifyExtendedResult)
-  {
-    super(passwordModifyExtendedResult);
-    this.password = passwordModifyExtendedResult.getGeneratedPassword();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString getGeneratedPassword()
-  {
-    return password;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    // No response name defined.
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    if (password != null)
-    {
-      final ByteStringBuilder buffer = new ByteStringBuilder();
-      final ASN1Writer writer = ASN1.getWriter(buffer);
-
-      try
-      {
-        writer.writeStartSequence();
-        writer.writeOctetString(TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD,
-            password);
-        writer.writeEndSequence();
-      }
-      catch (final IOException ioe)
-      {
-        // This should never happen unless there is a bug somewhere.
-        throw new RuntimeException(ioe);
-      }
-
-      return buffer.toByteString();
+    // Instantiation via factory.
+    PasswordModifyExtendedResultImpl(final ResultCode resultCode) {
+        super(resultCode);
     }
-    return null;
-  }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return password != null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedResult setGeneratedPassword(
-      final ByteString password)
-  {
-    this.password = password;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public PasswordModifyExtendedResult setGeneratedPassword(
-      final char[] password)
-  {
-    this.password = (password != null) ? ByteString.valueOf(password) : null;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("PasswordModifyExtendedResponse(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    if (password != null)
-    {
-      builder.append(", genPassword=");
-      builder.append(password);
+    /**
+     * Creates a new password modify extended result that is an exact copy of
+     * the provided result.
+     *
+     * @param passwordModifyExtendedResult
+     *            The password modify extended result to be copied.
+     * @throws NullPointerException
+     *             If {@code passwordModifyExtendedResult} was {@code null} .
+     */
+    PasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult passwordModifyExtendedResult) {
+        super(passwordModifyExtendedResult);
+        this.password = passwordModifyExtendedResult.getGeneratedPassword();
     }
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString getGeneratedPassword() {
+        return password;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        // No response name defined.
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        if (password != null) {
+            final ByteStringBuilder buffer = new ByteStringBuilder();
+            final ASN1Writer writer = ASN1.getWriter(buffer);
+
+            try {
+                writer.writeStartSequence();
+                writer.writeOctetString(TYPE_PASSWORD_MODIFY_GENERATED_PASSWORD, password);
+                writer.writeEndSequence();
+            } catch (final IOException ioe) {
+                // This should never happen unless there is a bug somewhere.
+                throw new RuntimeException(ioe);
+            }
+
+            return buffer.toByteString();
+        }
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return password != null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedResult setGeneratedPassword(final ByteString password) {
+        this.password = password;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordModifyExtendedResult setGeneratedPassword(final char[] password) {
+        this.password = (password != null) ? ByteString.valueOf(password) : null;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("PasswordModifyExtendedResponse(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        if (password != null) {
+            builder.append(", genPassword=");
+            builder.append(password);
+        }
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Response.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Response.java
index f0f671c..829ceba 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Response.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Response.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,61 +34,55 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The base class of all Responses provides methods for querying and
  * manipulating the set of Controls included with a Response.
  */
-public interface Response
-{
+public interface Response {
 
-  /**
-   * Adds the provided control to this response.
-   *
-   * @param control
-   *          The control to be added.
-   * @return This response.
-   * @throws UnsupportedOperationException
-   *           If this response does not permit controls to be added.
-   * @throws NullPointerException
-   *           If {@code control} was {@code null}.
-   */
-  Response addControl(Control control);
+    /**
+     * Adds the provided control to this response.
+     *
+     * @param control
+     *            The control to be added.
+     * @return This response.
+     * @throws UnsupportedOperationException
+     *             If this response does not permit controls to be added.
+     * @throws NullPointerException
+     *             If {@code control} was {@code null}.
+     */
+    Response addControl(Control control);
 
+    /**
+     * Decodes and returns the first control in this response having an OID
+     * corresponding to the provided control decoder.
+     *
+     * @param <C>
+     *            The type of control to be decoded and returned.
+     * @param decoder
+     *            The control decoder.
+     * @param options
+     *            The set of decode options which should be used when decoding
+     *            the control.
+     * @return The decoded control, or {@code null} if the control is not
+     *         included with this response.
+     * @throws DecodeException
+     *             If the control could not be decoded because it was malformed
+     *             in some way (e.g. the control value was missing, or its
+     *             content could not be decoded).
+     * @throws NullPointerException
+     *             If {@code decoder} or {@code options} was {@code null}.
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-
-  /**
-   * Decodes and returns the first control in this response having an OID
-   * corresponding to the provided control decoder.
-   *
-   * @param <C>
-   *          The type of control to be decoded and returned.
-   * @param decoder
-   *          The control decoder.
-   * @param options
-   *          The set of decode options which should be used when decoding the
-   *          control.
-   * @return The decoded control, or {@code null} if the control is not included
-   *         with this response.
-   * @throws DecodeException
-   *           If the control could not be decoded because it was malformed in
-   *           some way (e.g. the control value was missing, or its content
-   *           could not be decoded).
-   * @throws NullPointerException
-   *           If {@code decoder} or {@code options} was {@code null}.
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * Returns a {@code List} containing the controls included with this response.
-   * The returned {@code List} may be modified if permitted by this response.
-   *
-   * @return A {@code List} containing the controls.
-   */
-  List<Control> getControls();
+    /**
+     * Returns a {@code List} containing the controls included with this
+     * response. The returned {@code List} may be modified if permitted by this
+     * response.
+     *
+     * @return A {@code List} containing the controls.
+     */
+    List<Control> getControls();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java
index 2d282c9..4c461af 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,15 +27,15 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
-import org.forgerock.i18n.*;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.ResultCode;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class contains various methods for creating and manipulating responses.
  * <p>
@@ -49,606 +48,497 @@
  * response parameter. More specifically, any controls, modifications, and
  * attributes contained within the returned response will be unmodifiable.
  */
-public final class Responses
-{
+public final class Responses {
 
-  // TODO: search reference from LDAP URL.
+    // TODO: search reference from LDAP URL.
 
-  // TODO: referral from LDAP URL.
+    // TODO: referral from LDAP URL.
 
-  // TODO: synchronized requests?
+    // TODO: synchronized requests?
 
-  /**
-   * Creates a new bind result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new bind result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static BindResult newBindResult(final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new BindResultImpl(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new compare result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new compare result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static CompareResult newCompareResult(final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new CompareResultImpl(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new generic extended result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new generic extended result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static GenericExtendedResult newGenericExtendedResult(
-      final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new GenericExtendedResultImpl(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new generic intermediate response with no name or value.
-   *
-   * @return The new generic intermediate response.
-   */
-  public static GenericIntermediateResponse newGenericIntermediateResponse()
-  {
-    return new GenericIntermediateResponseImpl(null, null);
-  }
-
-
-
-  /**
-   * Creates a new generic intermediate response using the provided response
-   * name and value.
-   *
-   * @param responseName
-   *          The dotted-decimal representation of the unique OID corresponding
-   *          to this intermediate response, which may be {@code null}
-   *          indicating that none was provided.
-   * @param responseValue
-   *          The response value associated with this generic intermediate
-   *          response, which may be {@code null} indicating that none was
-   *          provided.
-   * @return The new generic intermediate response.
-   */
-  public static GenericIntermediateResponse newGenericIntermediateResponse(
-      final String responseName, final ByteString responseValue)
-  {
-    return new GenericIntermediateResponseImpl(responseName, responseValue);
-  }
-
-
-
-  /**
-   * Creates a new password modify extended result using the provided result
-   * code, and no generated password.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new password modify extended result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static PasswordModifyExtendedResult newPasswordModifyExtendedResult(
-      final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new PasswordModifyExtendedResultImpl(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  public static Result newResult(final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new ResultImpl(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new search result entry using the provided distinguished name.
-   *
-   * @param name
-   *          The distinguished name of the entry.
-   * @return The new search result entry.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static SearchResultEntry newSearchResultEntry(final DN name)
-  {
-    final Entry entry = new LinkedHashMapEntry().setName(name);
-    return new SearchResultEntryImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new search result entry backed by the provided entry.
-   * Modifications made to {@code entry} will be reflected in the returned
-   * search result entry. The returned search result entry supports updates to
-   * its list of controls, as well as updates to the name and attributes if the
-   * underlying entry allows.
-   *
-   * @param entry
-   *          The entry.
-   * @return The new search result entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  public static SearchResultEntry newSearchResultEntry(final Entry entry)
-  {
-    Validator.ensureNotNull(entry);
-    return new SearchResultEntryImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new search result entry using the provided distinguished name
-   * decoded using the default schema.
-   *
-   * @param name
-   *          The distinguished name of the entry.
-   * @return The new search result entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code name} could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public static SearchResultEntry newSearchResultEntry(final String name)
-  {
-    final Entry entry = new LinkedHashMapEntry().setName(name);
-    return new SearchResultEntryImpl(entry);
-  }
-
-
-
-  /**
-   * Creates a new search result entry using the provided lines of LDIF decoded
-   * using the default schema.
-   *
-   * @param ldifLines
-   *          Lines of LDIF containing an LDIF add change record or an LDIF
-   *          entry record.
-   * @return The new search result entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} was empty, or contained invalid LDIF, or
-   *           could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null} .
-   */
-  public static SearchResultEntry newSearchResultEntry(
-      final String... ldifLines)
-  {
-    return newSearchResultEntry(new LinkedHashMapEntry(ldifLines));
-  }
-
-
-
-  /**
-   * Creates a new search result reference using the provided continuation
-   * reference URI.
-   *
-   * @param uri
-   *          The first continuation reference URI to be added to this search
-   *          result reference.
-   * @return The new search result reference.
-   * @throws NullPointerException
-   *           If {@code uri} was {@code null}.
-   */
-  public static SearchResultReference newSearchResultReference(final String uri)
-  {
-    Validator.ensureNotNull(uri);
-    return new SearchResultReferenceImpl(uri);
-  }
-
-
-
-  /**
-   * Creates a new who am I extended result with the provided result code and no
-   * authorization ID.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return The new who am I extended result.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null} .
-   */
-  public static WhoAmIExtendedResult newWhoAmIExtendedResult(
-      final ResultCode resultCode)
-  {
-    Validator.ensureNotNull(resultCode);
-    return new WhoAmIExtendedResultImpl(ResultCode.SUCCESS);
-  }
-
-
-
-  /**
-   * Creates an unmodifiable bind result using the provided response.
-   *
-   * @param result
-   *          The bind result to be copied.
-   * @return The unmodifiable bind result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static BindResult unmodifiableBindResult(final BindResult result)
-  {
-    if (result instanceof UnmodifiableBindResultImpl)
-    {
-      return result;
+    /**
+     * Creates a new bind result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new bind result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static BindResult newBindResult(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new BindResultImpl(resultCode);
     }
-    return new UnmodifiableBindResultImpl(result);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable compare result using the provided response.
-   *
-   * @param result
-   *          The compare result to be copied.
-   * @return The unmodifiable compare result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static CompareResult unmodifiableCompareResult(
-      final CompareResult result)
-  {
-    if (result instanceof UnmodifiableCompareResultImpl)
-    {
-      return result;
+    /**
+     * Creates a new compare result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new compare result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static CompareResult newCompareResult(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new CompareResultImpl(resultCode);
     }
-    return new UnmodifiableCompareResultImpl(result);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable generic extended result using the provided
-   * response.
-   *
-   * @param result
-   *          The generic extended result to be copied.
-   * @return The unmodifiable generic extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static GenericExtendedResult unmodifiableGenericExtendedResult(
-      final GenericExtendedResult result)
-  {
-    if (result instanceof UnmodifiableGenericExtendedResultImpl)
-    {
-      return result;
+    /**
+     * Creates a new generic extended result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new generic extended result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static GenericExtendedResult newGenericExtendedResult(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new GenericExtendedResultImpl(resultCode);
     }
-    return new UnmodifiableGenericExtendedResultImpl(result);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable generic intermediate response using the provided
-   * response.
-   *
-   * @param response
-   *          The generic intermediate response to be copied.
-   * @return The unmodifiable generic intermediate response.
-   * @throws NullPointerException
-   *           If {@code response} was {@code null}.
-   */
-  public static GenericIntermediateResponse unmodifiableGenericIntermediateResponse(
-      final GenericIntermediateResponse response)
-  {
-    if (response instanceof UnmodifiableGenericIntermediateResponseImpl)
-    {
-      return response;
+    /**
+     * Creates a new generic intermediate response with no name or value.
+     *
+     * @return The new generic intermediate response.
+     */
+    public static GenericIntermediateResponse newGenericIntermediateResponse() {
+        return new GenericIntermediateResponseImpl(null, null);
     }
-    return new UnmodifiableGenericIntermediateResponseImpl(response);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable password modify extended result using the provided
-   * response.
-   *
-   * @param result
-   *          The password modify extended result to be copied.
-   * @return The unmodifiable password modify extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static PasswordModifyExtendedResult unmodifiablePasswordModifyExtendedResult(
-      final PasswordModifyExtendedResult result)
-  {
-    if (result instanceof UnmodifiablePasswordModifyExtendedResultImpl)
-    {
-      return result;
+    /**
+     * Creates a new generic intermediate response using the provided response
+     * name and value.
+     *
+     * @param responseName
+     *            The dotted-decimal representation of the unique OID
+     *            corresponding to this intermediate response, which may be
+     *            {@code null} indicating that none was provided.
+     * @param responseValue
+     *            The response value associated with this generic intermediate
+     *            response, which may be {@code null} indicating that none was
+     *            provided.
+     * @return The new generic intermediate response.
+     */
+    public static GenericIntermediateResponse newGenericIntermediateResponse(
+            final String responseName, final ByteString responseValue) {
+        return new GenericIntermediateResponseImpl(responseName, responseValue);
     }
-    return new UnmodifiablePasswordModifyExtendedResultImpl(result);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable result using the provided response.
-   *
-   * @param result
-   *          The result to be copied.
-   * @return The unmodifiable result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static Result unmodifiableResult(final Result result)
-  {
-    if (result instanceof UnmodifiableResultImpl)
-    {
-      return result;
+    /**
+     * Creates a new password modify extended result using the provided result
+     * code, and no generated password.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new password modify extended result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static PasswordModifyExtendedResult newPasswordModifyExtendedResult(
+            final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new PasswordModifyExtendedResultImpl(resultCode);
     }
-    return new UnmodifiableResultImpl(result);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable search result entry using the provided response.
-   *
-   * @param entry
-   *          The search result entry to be copied.
-   * @return The unmodifiable search result entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public static SearchResultEntry unmodifiableSearchResultEntry(
-      final SearchResultEntry entry)
-  {
-    if (entry instanceof UnmodifiableSearchResultEntryImpl)
-    {
-      return entry;
+    /**
+     * Creates a new result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    public static Result newResult(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new ResultImpl(resultCode);
     }
-    return new UnmodifiableSearchResultEntryImpl(entry);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable search result reference using the provided
-   * response.
-   *
-   * @param reference
-   *          The search result reference to be copied.
-   * @return The unmodifiable search result reference.
-   * @throws NullPointerException
-   *           If {@code searchResultReference} was {@code null}.
-   */
-  public static SearchResultReference unmodifiableSearchResultReference(
-      final SearchResultReference reference)
-  {
-    if (reference instanceof UnmodifiableSearchResultReferenceImpl)
-    {
-      return reference;
+    /**
+     * Creates a new search result entry using the provided distinguished name.
+     *
+     * @param name
+     *            The distinguished name of the entry.
+     * @return The new search result entry.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static SearchResultEntry newSearchResultEntry(final DN name) {
+        final Entry entry = new LinkedHashMapEntry().setName(name);
+        return new SearchResultEntryImpl(entry);
     }
-    return new UnmodifiableSearchResultReferenceImpl(reference);
-  }
 
-
-
-  /**
-   * Creates an unmodifiable who am I extended result using the provided
-   * response.
-   *
-   * @param result
-   *          The who am I result to be copied.
-   * @return The unmodifiable who am I extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null} .
-   */
-  public static WhoAmIExtendedResult unmodifiableWhoAmIExtendedResult(
-      final WhoAmIExtendedResult result)
-  {
-    if (result instanceof UnmodifiableSearchResultReferenceImpl)
-    {
-      return result;
+    /**
+     * Creates a new search result entry backed by the provided entry.
+     * Modifications made to {@code entry} will be reflected in the returned
+     * search result entry. The returned search result entry supports updates to
+     * its list of controls, as well as updates to the name and attributes if
+     * the underlying entry allows.
+     *
+     * @param entry
+     *            The entry.
+     * @return The new search result entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    public static SearchResultEntry newSearchResultEntry(final Entry entry) {
+        Validator.ensureNotNull(entry);
+        return new SearchResultEntryImpl(entry);
     }
-    return new UnmodifiableWhoAmIExtendedResultImpl(result);
-  }
 
+    /**
+     * Creates a new search result entry using the provided distinguished name
+     * decoded using the default schema.
+     *
+     * @param name
+     *            The distinguished name of the entry.
+     * @return The new search result entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code name} could not be decoded using the default
+     *             schema.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public static SearchResultEntry newSearchResultEntry(final String name) {
+        final Entry entry = new LinkedHashMapEntry().setName(name);
+        return new SearchResultEntryImpl(entry);
+    }
 
+    /**
+     * Creates a new search result entry using the provided lines of LDIF
+     * decoded using the default schema.
+     *
+     * @param ldifLines
+     *            Lines of LDIF containing an LDIF add change record or an LDIF
+     *            entry record.
+     * @return The new search result entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} was empty, or contained invalid LDIF, or
+     *             could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null} .
+     */
+    public static SearchResultEntry newSearchResultEntry(final String... ldifLines) {
+        return newSearchResultEntry(new LinkedHashMapEntry(ldifLines));
+    }
 
-  /**
-   * Creates a new bind result that is an exact copy of the provided result.
-   *
-   * @param result
-   *          The bind result to be copied.
-   * @return The new bind result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static BindResult copyOfBindResult(final BindResult result)
-  {
-    return new BindResultImpl(result);
-  }
+    /**
+     * Creates a new search result reference using the provided continuation
+     * reference URI.
+     *
+     * @param uri
+     *            The first continuation reference URI to be added to this
+     *            search result reference.
+     * @return The new search result reference.
+     * @throws NullPointerException
+     *             If {@code uri} was {@code null}.
+     */
+    public static SearchResultReference newSearchResultReference(final String uri) {
+        Validator.ensureNotNull(uri);
+        return new SearchResultReferenceImpl(uri);
+    }
 
+    /**
+     * Creates a new who am I extended result with the provided result code and
+     * no authorization ID.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return The new who am I extended result.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null} .
+     */
+    public static WhoAmIExtendedResult newWhoAmIExtendedResult(final ResultCode resultCode) {
+        Validator.ensureNotNull(resultCode);
+        return new WhoAmIExtendedResultImpl(ResultCode.SUCCESS);
+    }
 
+    /**
+     * Creates an unmodifiable bind result using the provided response.
+     *
+     * @param result
+     *            The bind result to be copied.
+     * @return The unmodifiable bind result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static BindResult unmodifiableBindResult(final BindResult result) {
+        if (result instanceof UnmodifiableBindResultImpl) {
+            return result;
+        }
+        return new UnmodifiableBindResultImpl(result);
+    }
 
-  /**
-   * Creates a new compare result that is an exact copy of the provided result.
-   *
-   * @param result
-   *          The compare result to be copied.
-   * @return The new compare result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static CompareResult copyOfCompareResult(final CompareResult result)
-  {
-    return new CompareResultImpl(result);
-  }
+    /**
+     * Creates an unmodifiable compare result using the provided response.
+     *
+     * @param result
+     *            The compare result to be copied.
+     * @return The unmodifiable compare result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static CompareResult unmodifiableCompareResult(final CompareResult result) {
+        if (result instanceof UnmodifiableCompareResultImpl) {
+            return result;
+        }
+        return new UnmodifiableCompareResultImpl(result);
+    }
 
+    /**
+     * Creates an unmodifiable generic extended result using the provided
+     * response.
+     *
+     * @param result
+     *            The generic extended result to be copied.
+     * @return The unmodifiable generic extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static GenericExtendedResult unmodifiableGenericExtendedResult(
+            final GenericExtendedResult result) {
+        if (result instanceof UnmodifiableGenericExtendedResultImpl) {
+            return result;
+        }
+        return new UnmodifiableGenericExtendedResultImpl(result);
+    }
 
+    /**
+     * Creates an unmodifiable generic intermediate response using the provided
+     * response.
+     *
+     * @param response
+     *            The generic intermediate response to be copied.
+     * @return The unmodifiable generic intermediate response.
+     * @throws NullPointerException
+     *             If {@code response} was {@code null}.
+     */
+    public static GenericIntermediateResponse unmodifiableGenericIntermediateResponse(
+            final GenericIntermediateResponse response) {
+        if (response instanceof UnmodifiableGenericIntermediateResponseImpl) {
+            return response;
+        }
+        return new UnmodifiableGenericIntermediateResponseImpl(response);
+    }
 
-  /**
-   * Creates a new generic extended result that is an exact copy of the provided
-   * result.
-   *
-   * @param result
-   *          The generic extended result to be copied.
-   * @return The new generic extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static GenericExtendedResult copyOfGenericExtendedResult(
-      final GenericExtendedResult result)
-  {
-    return new GenericExtendedResultImpl(result);
-  }
+    /**
+     * Creates an unmodifiable password modify extended result using the
+     * provided response.
+     *
+     * @param result
+     *            The password modify extended result to be copied.
+     * @return The unmodifiable password modify extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static PasswordModifyExtendedResult unmodifiablePasswordModifyExtendedResult(
+            final PasswordModifyExtendedResult result) {
+        if (result instanceof UnmodifiablePasswordModifyExtendedResultImpl) {
+            return result;
+        }
+        return new UnmodifiablePasswordModifyExtendedResultImpl(result);
+    }
 
+    /**
+     * Creates an unmodifiable result using the provided response.
+     *
+     * @param result
+     *            The result to be copied.
+     * @return The unmodifiable result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static Result unmodifiableResult(final Result result) {
+        if (result instanceof UnmodifiableResultImpl) {
+            return result;
+        }
+        return new UnmodifiableResultImpl(result);
+    }
 
+    /**
+     * Creates an unmodifiable search result entry using the provided response.
+     *
+     * @param entry
+     *            The search result entry to be copied.
+     * @return The unmodifiable search result entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public static SearchResultEntry unmodifiableSearchResultEntry(final SearchResultEntry entry) {
+        if (entry instanceof UnmodifiableSearchResultEntryImpl) {
+            return entry;
+        }
+        return new UnmodifiableSearchResultEntryImpl(entry);
+    }
 
-  /**
-   * Creates a new generic intermediate response that is an exact copy of the
-   * provided response.
-   *
-   * @param result
-   *          The generic intermediate response to be copied.
-   * @return The new generic intermediate response.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static GenericIntermediateResponse copyOfGenericIntermediateResponse(
-      final GenericIntermediateResponse result)
-  {
-    return new GenericIntermediateResponseImpl(result);
-  }
+    /**
+     * Creates an unmodifiable search result reference using the provided
+     * response.
+     *
+     * @param reference
+     *            The search result reference to be copied.
+     * @return The unmodifiable search result reference.
+     * @throws NullPointerException
+     *             If {@code searchResultReference} was {@code null}.
+     */
+    public static SearchResultReference unmodifiableSearchResultReference(
+            final SearchResultReference reference) {
+        if (reference instanceof UnmodifiableSearchResultReferenceImpl) {
+            return reference;
+        }
+        return new UnmodifiableSearchResultReferenceImpl(reference);
+    }
 
+    /**
+     * Creates an unmodifiable who am I extended result using the provided
+     * response.
+     *
+     * @param result
+     *            The who am I result to be copied.
+     * @return The unmodifiable who am I extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null} .
+     */
+    public static WhoAmIExtendedResult unmodifiableWhoAmIExtendedResult(
+            final WhoAmIExtendedResult result) {
+        if (result instanceof UnmodifiableSearchResultReferenceImpl) {
+            return result;
+        }
+        return new UnmodifiableWhoAmIExtendedResultImpl(result);
+    }
 
+    /**
+     * Creates a new bind result that is an exact copy of the provided result.
+     *
+     * @param result
+     *            The bind result to be copied.
+     * @return The new bind result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static BindResult copyOfBindResult(final BindResult result) {
+        return new BindResultImpl(result);
+    }
 
-  /**
-   * Creates a new password modify extended result that is an exact copy of the
-   * provided result.
-   *
-   * @param result
-   *          The password modify extended result to be copied.
-   * @return The new password modify extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static PasswordModifyExtendedResult copyOfPasswordModifyExtendedResult(
-      final PasswordModifyExtendedResult result)
-  {
-    return new PasswordModifyExtendedResultImpl(result);
-  }
+    /**
+     * Creates a new compare result that is an exact copy of the provided
+     * result.
+     *
+     * @param result
+     *            The compare result to be copied.
+     * @return The new compare result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static CompareResult copyOfCompareResult(final CompareResult result) {
+        return new CompareResultImpl(result);
+    }
 
+    /**
+     * Creates a new generic extended result that is an exact copy of the
+     * provided result.
+     *
+     * @param result
+     *            The generic extended result to be copied.
+     * @return The new generic extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static GenericExtendedResult copyOfGenericExtendedResult(
+            final GenericExtendedResult result) {
+        return new GenericExtendedResultImpl(result);
+    }
 
+    /**
+     * Creates a new generic intermediate response that is an exact copy of the
+     * provided response.
+     *
+     * @param result
+     *            The generic intermediate response to be copied.
+     * @return The new generic intermediate response.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static GenericIntermediateResponse copyOfGenericIntermediateResponse(
+            final GenericIntermediateResponse result) {
+        return new GenericIntermediateResponseImpl(result);
+    }
 
-  /**
-   * Creates a new result that is an exact copy of the provided result.
-   *
-   * @param result
-   *          The result to be copied.
-   * @return The new result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null}.
-   */
-  public static Result copyOfResult(final Result result)
-  {
-    return new ResultImpl(result);
-  }
+    /**
+     * Creates a new password modify extended result that is an exact copy of
+     * the provided result.
+     *
+     * @param result
+     *            The password modify extended result to be copied.
+     * @return The new password modify extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static PasswordModifyExtendedResult copyOfPasswordModifyExtendedResult(
+            final PasswordModifyExtendedResult result) {
+        return new PasswordModifyExtendedResultImpl(result);
+    }
 
+    /**
+     * Creates a new result that is an exact copy of the provided result.
+     *
+     * @param result
+     *            The result to be copied.
+     * @return The new result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null}.
+     */
+    public static Result copyOfResult(final Result result) {
+        return new ResultImpl(result);
+    }
 
+    /**
+     * Creates a new search result entry that is an exact copy of the provided
+     * result.
+     *
+     * @param entry
+     *            The search result entry to be copied.
+     * @return The new search result entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public static SearchResultEntry copyOfSearchResultEntry(final SearchResultEntry entry) {
+        return new SearchResultEntryImpl(entry);
+    }
 
-  /**
-   * Creates a new search result entry that is an exact copy of the provided
-   * result.
-   *
-   * @param entry
-   *          The search result entry to be copied.
-   * @return The new search result entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public static SearchResultEntry copyOfSearchResultEntry(
-      final SearchResultEntry entry)
-  {
-    return new SearchResultEntryImpl(entry);
-  }
+    /**
+     * Creates a new search result reference that is an exact copy of the
+     * provided result.
+     *
+     * @param reference
+     *            The search result reference to be copied.
+     * @return The new search result reference.
+     * @throws NullPointerException
+     *             If {@code reference} was {@code null}.
+     */
+    public static SearchResultReference copyOfSearchResultReference(
+            final SearchResultReference reference) {
+        return new SearchResultReferenceImpl(reference);
+    }
 
+    /**
+     * Creates a new who am I extended result that is an exact copy of the
+     * provided result.
+     *
+     * @param result
+     *            The who am I result to be copied.
+     * @return The new who am I extended result.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null} .
+     */
+    public static WhoAmIExtendedResult copyOfWhoAmIExtendedResult(final WhoAmIExtendedResult result) {
+        return new WhoAmIExtendedResultImpl(result);
+    }
 
-
-  /**
-   * Creates a new search result reference that is an exact copy of the provided
-   * result.
-   *
-   * @param reference
-   *          The search result reference to be copied.
-   * @return The new search result reference.
-   * @throws NullPointerException
-   *           If {@code reference} was {@code null}.
-   */
-  public static SearchResultReference copyOfSearchResultReference(
-      final SearchResultReference reference)
-  {
-    return new SearchResultReferenceImpl(reference);
-  }
-
-
-
-  /**
-   * Creates a new who am I extended result that is an exact copy of the
-   * provided result.
-   *
-   * @param result
-   *          The who am I result to be copied.
-   * @return The new who am I extended result.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null} .
-   */
-  public static WhoAmIExtendedResult copyOfWhoAmIExtendedResult(
-      final WhoAmIExtendedResult result)
-  {
-    return new WhoAmIExtendedResultImpl(result);
-  }
-
-
-
-  // Private constructor.
-  private Responses()
-  {
-    // Prevent instantiation.
-  }
+    // Private constructor.
+    private Responses() {
+        // Prevent instantiation.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java
index 31ea921..dc941a9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/Result.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,8 +35,6 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Result is used to indicate the status of an operation performed by the
  * server. A Result is comprised of several fields:
@@ -62,175 +57,147 @@
  * result codes.
  * </ul>
  */
-public interface Result extends Response
-{
-  /**
-   * {@inheritDoc}
-   */
-  Result addControl(Control control);
+public interface Result extends Response {
+    /**
+     * {@inheritDoc}
+     */
+    Result addControl(Control control);
 
+    /**
+     * Adds the provided referral URI to this result.
+     *
+     * @param uri
+     *            The referral URI to be added.
+     * @return This result.
+     * @throws UnsupportedOperationException
+     *             If this result does not permit referrals to be added.
+     * @throws NullPointerException
+     *             If {@code uri} was {@code null}.
+     */
+    Result addReferralURI(String uri);
 
+    /**
+     * Returns the throwable cause associated with this result if available. A
+     * cause may be provided in cases where a result indicates a failure due to
+     * a client-side error.
+     *
+     * @return The throwable cause, or {@code null} if none was provided.
+     */
+    Throwable getCause();
 
-  /**
-   * Adds the provided referral URI to this result.
-   *
-   * @param uri
-   *          The referral URI to be added.
-   * @return This result.
-   * @throws UnsupportedOperationException
-   *           If this result does not permit referrals to be added.
-   * @throws NullPointerException
-   *           If {@code uri} was {@code null}.
-   */
-  Result addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
+    /**
+     * Returns the diagnostic message associated with this result.
+     *
+     * @return The diagnostic message, which may be empty if none was provided
+     *         (never {@code null}).
+     */
+    String getDiagnosticMessage();
 
-  /**
-   * Returns the throwable cause associated with this result if available. A
-   * cause may be provided in cases where a result indicates a failure due to a
-   * client-side error.
-   *
-   * @return The throwable cause, or {@code null} if none was provided.
-   */
-  Throwable getCause();
+    /**
+     * Returns the matched DN associated with this result.
+     *
+     * @return The matched DN, which may be empty if none was provided (never
+     *         {@code null}).
+     */
+    String getMatchedDN();
 
+    /**
+     * Returns a {@code List} containing the referral URIs included with this
+     * result. The returned {@code List} may be modified if permitted by this
+     * result.
+     *
+     * @return A {@code List} containing the referral URIs.
+     */
+    List<String> getReferralURIs();
 
+    /**
+     * Returns the result code associated with this result.
+     *
+     * @return The result code.
+     */
+    ResultCode getResultCode();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * Indicates whether or not a referral needs to be chased in order to
+     * complete the operation.
+     * <p>
+     * Specifically, this method returns {@code true} if the result code is
+     * equal to {@link ResultCode#REFERRAL}.
+     *
+     * @return {@code true} if a referral needs to be chased, otherwise
+     *         {@code false}.
+     */
+    boolean isReferral();
 
+    /**
+     * Indicates whether or not the request succeeded or not. This method will
+     * return {code true} for all non-error responses.
+     *
+     * @return {@code true} if the request succeeded, otherwise {@code false}.
+     */
+    boolean isSuccess();
 
+    /**
+     * Sets the throwable cause associated with this result if available. A
+     * cause may be provided in cases where a result indicates a failure due to
+     * a client-side error.
+     *
+     * @param cause
+     *            The throwable cause, which may be {@code null} indicating that
+     *            none was provided.
+     * @return This result.
+     * @throws UnsupportedOperationException
+     *             If this result does not permit the cause to be set.
+     */
+    Result setCause(Throwable cause);
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Sets the diagnostic message associated with this result.
+     *
+     * @param message
+     *            The diagnostic message, which may be empty or {@code null}
+     *            indicating that none was provided.
+     * @return This result.
+     * @throws UnsupportedOperationException
+     *             If this result does not permit the diagnostic message to be
+     *             set.
+     */
+    Result setDiagnosticMessage(String message);
 
+    /**
+     * Sets the matched DN associated with this result.
+     *
+     * @param dn
+     *            The matched DN associated, which may be empty or {@code null}
+     *            indicating that none was provided.
+     * @return This result.
+     * @throws UnsupportedOperationException
+     *             If this result does not permit the matched DN to be set.
+     */
+    Result setMatchedDN(String dn);
 
-
-  /**
-   * Returns the diagnostic message associated with this result.
-   *
-   * @return The diagnostic message, which may be empty if none was provided
-   *         (never {@code null}).
-   */
-  String getDiagnosticMessage();
-
-
-
-  /**
-   * Returns the matched DN associated with this result.
-   *
-   * @return The matched DN, which may be empty if none was provided (never
-   *         {@code null}).
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * Returns a {@code List} containing the referral URIs included with this
-   * result. The returned {@code List} may be modified if permitted by this
-   * result.
-   *
-   * @return A {@code List} containing the referral URIs.
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * Returns the result code associated with this result.
-   *
-   * @return The result code.
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * Indicates whether or not a referral needs to be chased in order to complete
-   * the operation.
-   * <p>
-   * Specifically, this method returns {@code true} if the result code is equal
-   * to {@link ResultCode#REFERRAL}.
-   *
-   * @return {@code true} if a referral needs to be chased, otherwise {@code
-   *         false}.
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * Indicates whether or not the request succeeded or not. This method will
-   * return {code true} for all non-error responses.
-   *
-   * @return {@code true} if the request succeeded, otherwise {@code false}.
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * Sets the throwable cause associated with this result if available. A cause
-   * may be provided in cases where a result indicates a failure due to a
-   * client-side error.
-   *
-   * @param cause
-   *          The throwable cause, which may be {@code null} indicating that
-   *          none was provided.
-   * @return This result.
-   * @throws UnsupportedOperationException
-   *           If this result does not permit the cause to be set.
-   */
-  Result setCause(Throwable cause);
-
-
-
-  /**
-   * Sets the diagnostic message associated with this result.
-   *
-   * @param message
-   *          The diagnostic message, which may be empty or {@code null}
-   *          indicating that none was provided.
-   * @return This result.
-   * @throws UnsupportedOperationException
-   *           If this result does not permit the diagnostic message to be set.
-   */
-  Result setDiagnosticMessage(String message);
-
-
-
-  /**
-   * Sets the matched DN associated with this result.
-   *
-   * @param dn
-   *          The matched DN associated, which may be empty or {@code null}
-   *          indicating that none was provided.
-   * @return This result.
-   * @throws UnsupportedOperationException
-   *           If this result does not permit the matched DN to be set.
-   */
-  Result setMatchedDN(String dn);
-
-
-
-  /**
-   * Sets the result code associated with this result.
-   *
-   * @param resultCode
-   *          The result code.
-   * @return This result.
-   * @throws UnsupportedOperationException
-   *           If this result does not permit the result code to be set.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  Result setResultCode(ResultCode resultCode);
+    /**
+     * Sets the result code associated with this result.
+     *
+     * @param resultCode
+     *            The result code.
+     * @return This result.
+     * @throws UnsupportedOperationException
+     *             If this result does not permit the result code to be set.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    Result setResultCode(ResultCode resultCode);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java
index 67bac11..93f3a5e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,75 +27,60 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * A generic result indicates the final status of an operation.
  */
-final class ResultImpl extends AbstractResultImpl<Result> implements Result
-{
+final class ResultImpl extends AbstractResultImpl<Result> implements Result {
 
-  /**
-   * Creates a new generic result using the provided result code.
-   *
-   * @param resultCode
-   *          The result code.
-   * @throws NullPointerException
-   *           If {@code resultCode} was {@code null}.
-   */
-  ResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
+    /**
+     * Creates a new generic result using the provided result code.
+     *
+     * @param resultCode
+     *            The result code.
+     * @throws NullPointerException
+     *             If {@code resultCode} was {@code null}.
+     */
+    ResultImpl(final ResultCode resultCode) {
+        super(resultCode);
+    }
 
+    /**
+     * Creates a new result that is an exact copy of the provided result.
+     *
+     * @param result
+     *            The result to be copied.
+     * @throws NullPointerException
+     *             If {@code result} was {@code null} .
+     */
+    ResultImpl(final Result result) {
+        super(result);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("Result(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * Creates a new result that is an exact copy of the provided result.
-   *
-   * @param result
-   *          The result to be copied.
-   * @throws NullPointerException
-   *           If {@code result} was {@code null} .
-   */
-  ResultImpl(final Result result)
-  {
-    super(result);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("Result(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  Result getThis()
-  {
-    return this;
-  }
+    @Override
+    Result getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java
index cc2159d..0d0db5b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,19 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.Collection;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Search Result Entry represents an entry found during a Search operation.
  * <p>
@@ -53,171 +54,121 @@
  * may happen when only attribute types are requested, access controls prevent
  * the return of values, or other reasons.
  */
-public interface SearchResultEntry extends Response, Entry
-{
-  /**
-   * {@inheritDoc}
-   */
-  boolean addAttribute(Attribute attribute);
+public interface SearchResultEntry extends Response, Entry {
+    /**
+     * {@inheritDoc}
+     */
+    boolean addAttribute(Attribute attribute);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean addAttribute(Attribute attribute, Collection<ByteString> duplicateValues);
 
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry addAttribute(String attributeDescription, Object... values);
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean addAttribute(Attribute attribute,
-      Collection<ByteString> duplicateValues);
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry clearAttributes();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean containsAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry addAttribute(String attributeDescription, Object... values);
+    /**
+     * {@inheritDoc}
+     */
+    boolean containsAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes();
 
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
 
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    Iterable<Attribute> getAllAttributes(String attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    Attribute getAttribute(AttributeDescription attributeDescription);
 
+    /**
+     * {@inheritDoc}
+     */
+    Attribute getAttribute(String attributeDescription);
 
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry clearAttributes();
+    /**
+     * {@inheritDoc}
+     */
+    int getAttributeCount();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean containsAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
+    /**
+     * {@inheritDoc}
+     */
+    DN getName();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean removeAttribute(Attribute attribute, Collection<ByteString> missingValues);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean removeAttribute(AttributeDescription attributeDescription);
 
-  /**
-   * {@inheritDoc}
-   */
-  boolean containsAttribute(String attributeDescription, Object... values);
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry removeAttribute(String attributeDescription, Object... values);
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean replaceAttribute(Attribute attribute);
 
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry replaceAttribute(String attributeDescription, Object... values);
 
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Iterable<Attribute> getAllAttributes(String attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Attribute getAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  Attribute getAttribute(String attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  int getAttributeCount();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  DN getName();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean removeAttribute(Attribute attribute,
-      Collection<ByteString> missingValues);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean removeAttribute(AttributeDescription attributeDescription);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry removeAttribute(String attributeDescription,
-      Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean replaceAttribute(Attribute attribute);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry replaceAttribute(String attributeDescription,
-      Object... values);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry setName(DN dn);
-
-
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry setName(DN dn);
 
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultEntry setName(String dn);
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultEntry setName(String dn);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java
index 4bbbc33..f528a7f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,316 +27,239 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
 
 /**
  * Search result entry implementation.
  */
-final class SearchResultEntryImpl extends
-    AbstractResponseImpl<SearchResultEntry> implements SearchResultEntry
-{
+final class SearchResultEntryImpl extends AbstractResponseImpl<SearchResultEntry> implements
+        SearchResultEntry {
 
-  private final Entry entry;
+    private final Entry entry;
 
+    /**
+     * Creates a new search result entry backed by the provided entry.
+     * Modifications made to {@code entry} will be reflected in the returned
+     * search result entry. The returned search result entry supports updates to
+     * its list of controls, as well as updates to the name and attributes if
+     * the underlying entry allows.
+     *
+     * @param entry
+     *            The entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null} .
+     */
+    SearchResultEntryImpl(final Entry entry) {
+        this.entry = entry;
+    }
 
+    /**
+     * Creates a new search result entry that is an exact copy of the provided
+     * result.
+     *
+     * @param searchResultEntry
+     *            The search result entry to be copied.
+     * @throws NullPointerException
+     *             If {@code searchResultEntry} was {@code null} .
+     */
+    SearchResultEntryImpl(final SearchResultEntry searchResultEntry) {
+        super(searchResultEntry);
+        this.entry = LinkedHashMapEntry.deepCopyOfEntry(searchResultEntry);
+    }
 
-  /**
-   * Creates a new search result entry backed by the provided entry.
-   * Modifications made to {@code entry} will be reflected in the returned
-   * search result entry. The returned search result entry supports updates to
-   * its list of controls, as well as updates to the name and attributes if the
-   * underlying entry allows.
-   *
-   * @param entry
-   *          The entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null} .
-   */
-  SearchResultEntryImpl(final Entry entry)
-  {
-    this.entry = entry;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAttribute(final Attribute attribute) {
+        return entry.addAttribute(attribute);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean addAttribute(final Attribute attribute,
+            final Collection<ByteString> duplicateValues) {
+        return entry.addAttribute(attribute, duplicateValues);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry addAttribute(final String attributeDescription, final Object... values) {
+        entry.addAttribute(attributeDescription, values);
+        return this;
+    }
 
-  /**
-   * Creates a new search result entry that is an exact copy of the provided
-   * result.
-   *
-   * @param searchResultEntry
-   *          The search result entry to be copied.
-   * @throws NullPointerException
-   *           If {@code searchResultEntry} was {@code null} .
-   */
-  SearchResultEntryImpl(final SearchResultEntry searchResultEntry)
-  {
-    super(searchResultEntry);
-    this.entry = LinkedHashMapEntry.deepCopyOfEntry(searchResultEntry);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry clearAttributes() {
+        entry.clearAttributes();
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        return entry.containsAttribute(attribute, missingValues);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsAttribute(final String attributeDescription, final Object... values) {
+        return entry.containsAttribute(attributeDescription, values);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAttribute(final Attribute attribute)
-  {
-    return entry.addAttribute(attribute);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes() {
+        return entry.getAllAttributes();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final AttributeDescription attributeDescription) {
+        return entry.getAllAttributes(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Attribute> getAllAttributes(final String attributeDescription) {
+        return entry.getAllAttributes(attributeDescription);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean addAttribute(final Attribute attribute,
-      final Collection<ByteString> duplicateValues)
-  {
-    return entry.addAttribute(attribute, duplicateValues);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public Attribute getAttribute(final AttributeDescription attributeDescription) {
+        return entry.getAttribute(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Attribute getAttribute(final String attributeDescription) {
+        return entry.getAttribute(attributeDescription);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getAttributeCount() {
+        return entry.getAttributeCount();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry addAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.addAttribute(attributeDescription, values);
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public DN getName() {
+        return entry.getName();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean removeAttribute(final Attribute attribute,
+            final Collection<ByteString> missingValues) {
+        return entry.removeAttribute(attribute, missingValues);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean removeAttribute(final AttributeDescription attributeDescription) {
+        return entry.removeAttribute(attributeDescription);
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry clearAttributes()
-  {
-    entry.clearAttributes();
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry removeAttribute(final String attributeDescription,
+            final Object... values) {
+        entry.removeAttribute(attributeDescription, values);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean replaceAttribute(final Attribute attribute) {
+        return entry.replaceAttribute(attribute);
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry replaceAttribute(final String attributeDescription,
+            final Object... values) {
+        entry.replaceAttribute(attributeDescription, values);
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    return entry.containsAttribute(attribute, missingValues);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry setName(final DN dn) {
+        entry.setName(dn);
+        return this;
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean containsAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    return entry.containsAttribute(attributeDescription, values);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes()
-  {
-    return entry.getAllAttributes();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(
-      final AttributeDescription attributeDescription)
-  {
-    return entry.getAllAttributes(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Iterable<Attribute> getAllAttributes(final String attributeDescription)
-  {
-    return entry.getAllAttributes(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Attribute getAttribute(final AttributeDescription attributeDescription)
-  {
-    return entry.getAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Attribute getAttribute(final String attributeDescription)
-  {
-    return entry.getAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public int getAttributeCount()
-  {
-    return entry.getAttributeCount();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public DN getName()
-  {
-    return entry.getName();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean removeAttribute(final Attribute attribute,
-      final Collection<ByteString> missingValues)
-  {
-    return entry.removeAttribute(attribute, missingValues);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean removeAttribute(final AttributeDescription attributeDescription)
-  {
-    return entry.removeAttribute(attributeDescription);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry removeAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.removeAttribute(attributeDescription, values);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean replaceAttribute(final Attribute attribute)
-  {
-    return entry.replaceAttribute(attribute);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry replaceAttribute(final String attributeDescription,
-      final Object... values)
-  {
-    entry.replaceAttribute(attributeDescription, values);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry setName(final DN dn)
-  {
-    entry.setName(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultEntry setName(final String dn)
-  {
-    entry.setName(dn);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SearchResultEntry(name=");
-    builder.append(getName());
-    builder.append(", attributes=");
-    builder.append(getAllAttributes());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultEntry setName(final String dn) {
+        entry.setName(dn);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SearchResultEntry(name=");
+        builder.append(getName());
+        builder.append(", attributes=");
+        builder.append(getAllAttributes());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  @Override
-  SearchResultEntry getThis()
-  {
-    return this;
-  }
+    @Override
+    SearchResultEntry getThis() {
+        return this;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return entry.hashCode();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return entry.hashCode();
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object object)
-  {
-    return entry.equals(object);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object object) {
+        return entry.equals(object);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java
index e50f733..6ead693 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
 import org.forgerock.opendj.ldap.DecodeException;
@@ -37,60 +34,49 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * A Search Result Reference represents an area not yet explored during a Search
  * operation.
  */
-public interface SearchResultReference extends Response
-{
-  /**
-   * {@inheritDoc}
-   */
-  SearchResultReference addControl(Control control);
+public interface SearchResultReference extends Response {
+    /**
+     * {@inheritDoc}
+     */
+    SearchResultReference addControl(Control control);
 
+    /**
+     * Adds the provided continuation reference URI to this search result
+     * reference.
+     *
+     * @param uri
+     *            The continuation reference URI to be added.
+     * @return This search result reference.
+     * @throws UnsupportedOperationException
+     *             If this search result reference does not permit continuation
+     *             reference URI to be added.
+     * @throws NullPointerException
+     *             If {@code uri} was {@code null}.
+     */
+    SearchResultReference addURI(String uri);
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
-  /**
-   * Adds the provided continuation reference URI to this search result
-   * reference.
-   *
-   * @param uri
-   *          The continuation reference URI to be added.
-   * @return This search result reference.
-   * @throws UnsupportedOperationException
-   *           If this search result reference does not permit continuation
-   *           reference URI to be added.
-   * @throws NullPointerException
-   *           If {@code uri} was {@code null}.
-   */
-  SearchResultReference addURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
-
-
-
-  /**
-   * Returns a {@code List} containing the continuation reference URIs included
-   * with this search result reference. The returned {@code List} may be
-   * modified if permitted by this search result reference.
-   *
-   * @return A {@code List} containing the continuation reference URIs.
-   */
-  List<String> getURIs();
+    /**
+     * Returns a {@code List} containing the continuation reference URIs
+     * included with this search result reference. The returned {@code List} may
+     * be modified if permitted by this search result reference.
+     *
+     * @return A {@code List} containing the continuation reference URIs.
+     */
+    List<String> getURIs();
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java
index ce1f071..4be0f0e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,104 +27,80 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.LinkedList;
 import java.util.List;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Search result reference implementation.
  */
-final class SearchResultReferenceImpl extends
-    AbstractResponseImpl<SearchResultReference> implements
-    SearchResultReference
-{
+final class SearchResultReferenceImpl extends AbstractResponseImpl<SearchResultReference> implements
+        SearchResultReference {
 
-  private final List<String> uris = new LinkedList<String>();
+    private final List<String> uris = new LinkedList<String>();
 
+    /**
+     * Creates a new search result reference using the provided continuation
+     * reference URI.
+     *
+     * @param uri
+     *            The first continuation reference URI to be added to this
+     *            search result reference.
+     * @throws NullPointerException
+     *             If {@code uri} was {@code null}.
+     */
+    SearchResultReferenceImpl(final String uri) {
+        addURI(uri);
+    }
 
+    /**
+     * Creates a new search result reference that is an exact copy of the
+     * provided result.
+     *
+     * @param searchResultReference
+     *            The search result reference to be copied.
+     * @throws NullPointerException
+     *             If {@code searchResultReference} was {@code null} .
+     */
+    SearchResultReferenceImpl(final SearchResultReference searchResultReference) {
+        super(searchResultReference);
+        this.uris.addAll(searchResultReference.getURIs());
+    }
 
-  /**
-   * Creates a new search result reference using the provided continuation
-   * reference URI.
-   *
-   * @param uri
-   *          The first continuation reference URI to be added to this search
-   *          result reference.
-   * @throws NullPointerException
-   *           If {@code uri} was {@code null}.
-   */
-  SearchResultReferenceImpl(final String uri)
-  {
-    addURI(uri);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public SearchResultReference addURI(final String uri) {
+        Validator.ensureNotNull(uri);
+        uris.add(uri);
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getURIs() {
+        return uris;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("SearchResultReference(uris=");
+        builder.append(getURIs());
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 
-  /**
-   * Creates a new search result reference that is an exact copy of the provided
-   * result.
-   *
-   * @param searchResultReference
-   *          The search result reference to be copied.
-   * @throws NullPointerException
-   *           If {@code searchResultReference} was {@code null} .
-   */
-  SearchResultReferenceImpl(final SearchResultReference searchResultReference)
-  {
-    super(searchResultReference);
-    this.uris.addAll(searchResultReference.getURIs());
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public SearchResultReference addURI(final String uri)
-  {
-    Validator.ensureNotNull(uri);
-    uris.add(uri);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public List<String> getURIs()
-  {
-    return uris;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("SearchResultReference(uris=");
-    builder.append(getURIs());
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
-
-
-
-  @Override
-  SearchResultReference getThis()
-  {
-    return this;
-  }
+    @Override
+    SearchResultReference getThis() {
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java
index d429707..c9381b9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,44 +27,29 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Unmodifiable Bind result implementation.
  */
-class UnmodifiableBindResultImpl extends
-    AbstractUnmodifiableResultImpl<BindResult> implements BindResult
-{
-  public UnmodifiableBindResultImpl(BindResult impl)
-  {
-    super(impl);
-  }
+class UnmodifiableBindResultImpl extends AbstractUnmodifiableResultImpl<BindResult> implements
+        BindResult {
+    public UnmodifiableBindResultImpl(BindResult impl) {
+        super(impl);
+    }
 
+    @Override
+    public ByteString getServerSASLCredentials() {
+        return impl.getServerSASLCredentials();
+    }
 
+    @Override
+    public boolean isSASLBindInProgress() {
+        return impl.isSASLBindInProgress();
+    }
 
-  @Override
-  public ByteString getServerSASLCredentials()
-  {
-    return impl.getServerSASLCredentials();
-  }
-
-
-
-  @Override
-  public boolean isSASLBindInProgress()
-  {
-    return impl.isSASLBindInProgress();
-  }
-
-
-
-  @Override
-  public BindResult setServerSASLCredentials(ByteString credentials)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public BindResult setServerSASLCredentials(ByteString credentials) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java
index 50a7a65..5096987 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,24 +26,17 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 /**
  * Unmodifiable Compare result implementation.
  */
-class UnmodifiableCompareResultImpl extends
-    AbstractUnmodifiableResultImpl<CompareResult> implements CompareResult
-{
-  UnmodifiableCompareResultImpl(CompareResult impl)
-  {
-    super(impl);
-  }
+class UnmodifiableCompareResultImpl extends AbstractUnmodifiableResultImpl<CompareResult> implements
+        CompareResult {
+    UnmodifiableCompareResultImpl(CompareResult impl) {
+        super(impl);
+    }
 
-
-
-  @Override
-  public boolean matched()
-  {
-    return impl.matched();
-  }
+    @Override
+    public boolean matched() {
+        return impl.matched();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java
index 3bacb4c..73c0c47 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,37 +27,25 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Unmodifiable Generic extended result implementation.
  */
 class UnmodifiableGenericExtendedResultImpl extends
-    AbstractUnmodifiableExtendedResultImpl<GenericExtendedResult> implements
-    ExtendedResult, GenericExtendedResult
-{
-  UnmodifiableGenericExtendedResultImpl(GenericExtendedResult impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableExtendedResultImpl<GenericExtendedResult> implements ExtendedResult,
+        GenericExtendedResult {
+    UnmodifiableGenericExtendedResultImpl(GenericExtendedResult impl) {
+        super(impl);
+    }
 
+    @Override
+    public GenericExtendedResult setOID(String oid) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  @Override
-  public GenericExtendedResult setOID(String oid)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GenericExtendedResult setValue(ByteString bytes)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public GenericExtendedResult setValue(ByteString bytes) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java
index b5450f0..0201aab 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,37 +27,25 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Unmodifiable Generic extended result implementation.
  */
 class UnmodifiableGenericIntermediateResponseImpl extends
-    AbstractUnmodifiableIntermediateResponseImpl<GenericIntermediateResponse>
-    implements GenericIntermediateResponse
-{
-  UnmodifiableGenericIntermediateResponseImpl(GenericIntermediateResponse impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableIntermediateResponseImpl<GenericIntermediateResponse> implements
+        GenericIntermediateResponse {
+    UnmodifiableGenericIntermediateResponseImpl(GenericIntermediateResponse impl) {
+        super(impl);
+    }
 
+    @Override
+    public GenericIntermediateResponse setOID(String oid) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  @Override
-  public GenericIntermediateResponse setOID(String oid)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public GenericIntermediateResponse setValue(ByteString bytes)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public GenericIntermediateResponse setValue(ByteString bytes) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
index 7217192..12d20cc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,45 +27,30 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Unmodifiable Password modify extended result implementation.
  */
 class UnmodifiablePasswordModifyExtendedResultImpl extends
-    AbstractUnmodifiableExtendedResultImpl<PasswordModifyExtendedResult>
-    implements PasswordModifyExtendedResult
-{
-  UnmodifiablePasswordModifyExtendedResultImpl(PasswordModifyExtendedResult impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableExtendedResultImpl<PasswordModifyExtendedResult> implements
+        PasswordModifyExtendedResult {
+    UnmodifiablePasswordModifyExtendedResultImpl(PasswordModifyExtendedResult impl) {
+        super(impl);
+    }
 
+    @Override
+    public ByteString getGeneratedPassword() {
+        return impl.getGeneratedPassword();
+    }
 
+    @Override
+    public PasswordModifyExtendedResult setGeneratedPassword(ByteString password) {
+        throw new UnsupportedOperationException();
+    }
 
-  @Override
-  public ByteString getGeneratedPassword()
-  {
-    return impl.getGeneratedPassword();
-  }
-
-
-
-  @Override
-  public PasswordModifyExtendedResult setGeneratedPassword(ByteString password)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public PasswordModifyExtendedResult setGeneratedPassword(char[] password)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public PasswordModifyExtendedResult setGeneratedPassword(char[] password) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java
index 95cf74a..2089df6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,16 +26,11 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 /**
  * A unmodifiable generic result indicates the final status of an operation.
  */
-class UnmodifiableResultImpl extends AbstractUnmodifiableResultImpl<Result>
-    implements Result
-{
-  UnmodifiableResultImpl(Result impl)
-  {
-    super(impl);
-  }
+class UnmodifiableResultImpl extends AbstractUnmodifiableResultImpl<Result> implements Result {
+    UnmodifiableResultImpl(Result impl) {
+        super(impl);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
index 0521714..d74f02f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,208 +27,125 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.Collection;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.Attributes;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
 
 import com.forgerock.opendj.util.Function;
 import com.forgerock.opendj.util.Iterables;
 
-
-
 /**
  * Unmodifiable Search result entry implementation.
  */
-class UnmodifiableSearchResultEntryImpl extends
-    AbstractUnmodifiableResponseImpl<SearchResultEntry> implements
-    SearchResultEntry
-{
-  private static final Function<Attribute, Attribute, Void>
-    UNMODIFIABLE_ATTRIBUTE_FUNCTION = new Function<Attribute, Attribute, Void>()
-  {
+class UnmodifiableSearchResultEntryImpl extends AbstractUnmodifiableResponseImpl<SearchResultEntry>
+        implements SearchResultEntry {
+    private static final Function<Attribute, Attribute, Void> UNMODIFIABLE_ATTRIBUTE_FUNCTION =
+            new Function<Attribute, Attribute, Void>() {
 
-    public Attribute apply(final Attribute value, final Void p)
-    {
-      return Attributes.unmodifiableAttribute(value);
+                public Attribute apply(final Attribute value, final Void p) {
+                    return Attributes.unmodifiableAttribute(value);
+                }
+
+            };
+
+    UnmodifiableSearchResultEntryImpl(SearchResultEntry impl) {
+        super(impl);
     }
 
-  };
-
-
-
-  UnmodifiableSearchResultEntryImpl(SearchResultEntry impl)
-  {
-    super(impl);
-  }
-
-
-
-  public boolean addAttribute(Attribute attribute)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public boolean addAttribute(Attribute attribute,
-      Collection<ByteString> duplicateValues)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchResultEntry addAttribute(String attributeDescription,
-      Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchResultEntry clearAttributes()
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public boolean containsAttribute(Attribute attribute,
-      Collection<ByteString> missingValues)
-  {
-    return impl.containsAttribute(attribute, missingValues);
-  }
-
-
-
-  public boolean containsAttribute(String attributeDescription,
-      Object... values)
-  {
-    return impl.containsAttribute(attributeDescription, values);
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes()
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes(
-      AttributeDescription attributeDescription)
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(attributeDescription),
-        UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Iterable<Attribute> getAllAttributes(String attributeDescription)
-  {
-    return Iterables.unmodifiableIterable(Iterables.transformedIterable(
-        impl.getAllAttributes(attributeDescription),
-        UNMODIFIABLE_ATTRIBUTE_FUNCTION));
-  }
-
-
-
-  public Attribute getAttribute(AttributeDescription attributeDescription)
-  {
-    final Attribute attribute = impl.getAttribute(attributeDescription);
-    if (attribute != null)
-    {
-      return Attributes.unmodifiableAttribute(attribute);
+    public boolean addAttribute(Attribute attribute) {
+        throw new UnsupportedOperationException();
     }
-    else
-    {
-      return null;
+
+    public boolean addAttribute(Attribute attribute, Collection<ByteString> duplicateValues) {
+        throw new UnsupportedOperationException();
     }
-  }
 
-
-
-  public Attribute getAttribute(String attributeDescription)
-  {
-    final Attribute attribute = impl.getAttribute(attributeDescription);
-    if (attribute != null)
-    {
-      return Attributes.unmodifiableAttribute(attribute);
+    public SearchResultEntry addAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
     }
-    else
-    {
-      return null;
+
+    public SearchResultEntry clearAttributes() {
+        throw new UnsupportedOperationException();
     }
-  }
 
+    public boolean containsAttribute(Attribute attribute, Collection<ByteString> missingValues) {
+        return impl.containsAttribute(attribute, missingValues);
+    }
 
+    public boolean containsAttribute(String attributeDescription, Object... values) {
+        return impl.containsAttribute(attributeDescription, values);
+    }
 
-  public int getAttributeCount()
-  {
-    return impl.getAttributeCount();
-  }
+    public Iterable<Attribute> getAllAttributes() {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(
+                impl.getAllAttributes(), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
+    public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription) {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl
+                .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
+    public Iterable<Attribute> getAllAttributes(String attributeDescription) {
+        return Iterables.unmodifiableIterable(Iterables.transformedIterable(impl
+                .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION));
+    }
 
-  public DN getName()
-  {
-    return impl.getName();
-  }
+    public Attribute getAttribute(AttributeDescription attributeDescription) {
+        final Attribute attribute = impl.getAttribute(attributeDescription);
+        if (attribute != null) {
+            return Attributes.unmodifiableAttribute(attribute);
+        } else {
+            return null;
+        }
+    }
 
+    public Attribute getAttribute(String attributeDescription) {
+        final Attribute attribute = impl.getAttribute(attributeDescription);
+        if (attribute != null) {
+            return Attributes.unmodifiableAttribute(attribute);
+        } else {
+            return null;
+        }
+    }
 
+    public int getAttributeCount() {
+        return impl.getAttributeCount();
+    }
 
-  public boolean removeAttribute(Attribute attribute,
-      Collection<ByteString> missingValues)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public DN getName() {
+        return impl.getName();
+    }
 
+    public boolean removeAttribute(Attribute attribute, Collection<ByteString> missingValues) {
+        throw new UnsupportedOperationException();
+    }
 
+    public boolean removeAttribute(AttributeDescription attributeDescription) {
+        throw new UnsupportedOperationException();
+    }
 
-  public boolean removeAttribute(AttributeDescription attributeDescription)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public SearchResultEntry removeAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
+    }
 
+    public boolean replaceAttribute(Attribute attribute) {
+        throw new UnsupportedOperationException();
+    }
 
+    public SearchResultEntry replaceAttribute(String attributeDescription, Object... values) {
+        throw new UnsupportedOperationException();
+    }
 
-  public SearchResultEntry removeAttribute(String attributeDescription,
-      Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public SearchResultEntry setName(DN dn) {
+        throw new UnsupportedOperationException();
+    }
 
-
-
-  public boolean replaceAttribute(Attribute attribute)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchResultEntry replaceAttribute(String attributeDescription,
-      Object... values)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchResultEntry setName(DN dn)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  public SearchResultEntry setName(String dn)
-  {
-    throw new UnsupportedOperationException();
-  }
+    public SearchResultEntry setName(String dn) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java
index bea75cd..c2d4a62 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,37 +27,24 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
-
-
 /**
  * Unmodifiable Search result reference implementation.
  */
 class UnmodifiableSearchResultReferenceImpl extends
-    AbstractUnmodifiableResponseImpl<SearchResultReference> implements
-    SearchResultReference
-{
-  UnmodifiableSearchResultReferenceImpl(SearchResultReference impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableResponseImpl<SearchResultReference> implements SearchResultReference {
+    UnmodifiableSearchResultReferenceImpl(SearchResultReference impl) {
+        super(impl);
+    }
 
+    @Override
+    public SearchResultReference addURI(String uri) {
+        throw new UnsupportedOperationException();
+    }
 
-
-  @Override
-  public SearchResultReference addURI(String uri)
-  {
-    throw new UnsupportedOperationException();
-  }
-
-
-
-  @Override
-  public List<String> getURIs()
-  {
-    return impl.getURIs();
-  }
+    @Override
+    public List<String> getURIs() {
+        return impl.getURIs();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java
index 711eef7..9fdd2e1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,33 +27,23 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 /**
  * Unmodifiable Who Am I extended result implementation.
  */
 class UnmodifiableWhoAmIExtendedResultImpl extends
-    AbstractUnmodifiableExtendedResultImpl<WhoAmIExtendedResult> implements
-    WhoAmIExtendedResult
-{
-  UnmodifiableWhoAmIExtendedResultImpl(WhoAmIExtendedResult impl)
-  {
-    super(impl);
-  }
+        AbstractUnmodifiableExtendedResultImpl<WhoAmIExtendedResult> implements
+        WhoAmIExtendedResult {
+    UnmodifiableWhoAmIExtendedResultImpl(WhoAmIExtendedResult impl) {
+        super(impl);
+    }
 
+    @Override
+    public String getAuthorizationID() {
+        return impl.getAuthorizationID();
+    }
 
-
-  @Override
-  public String getAuthorizationID()
-  {
-    return impl.getAuthorizationID();
-  }
-
-
-
-  @Override
-  public WhoAmIExtendedResult setAuthorizationID(String authorizationID)
-  {
-    throw new UnsupportedOperationException();
-  }
+    @Override
+    public WhoAmIExtendedResult setAuthorizationID(String authorizationID) {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java
index 8fe2901..e3cb1cb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,11 +27,9 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import java.util.List;
 
-import org.forgerock.i18n.*;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.DecodeOptions;
@@ -40,16 +37,14 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 
-
-
 /**
  * The who am I extended result as defined in RFC 4532. The result includes the
  * primary authorization identity, in its primary form, that the server has
  * associated with the user or application entity, but only if the who am I
  * request succeeded.
  * <p>
- * The authorization identity is specified using an authorization ID, or {@code
- * authzId}, as defined in RFC 4513 section 5.2.1.8.
+ * The authorization identity is specified using an authorization ID, or
+ * {@code authzId}, as defined in RFC 4513 section 5.2.1.8.
  *
  * @see org.forgerock.opendj.ldap.requests.WhoAmIExtendedRequest
  * @see org.forgerock.opendj.ldap.controls.AuthorizationIdentityRequestControl
@@ -58,164 +53,127 @@
  * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
  *      SASL Authorization Identities (authzId) </a>
  */
-public interface WhoAmIExtendedResult extends ExtendedResult
-{
+public interface WhoAmIExtendedResult extends ExtendedResult {
 
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult addControl(Control control);
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult addControl(Control control);
 
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult addReferralURI(String uri);
 
+    /**
+     * Returns the authorization ID of the user. The authorization ID usually
+     * has the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @return The authorization ID of the user, or {@code null} if this result
+     *         does not contain an authorization ID.
+     */
+    String getAuthorizationID();
 
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult addReferralURI(String uri);
+    /**
+     * {@inheritDoc}
+     */
+    Throwable getCause();
 
+    /**
+     * {@inheritDoc}
+     */
+    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
+            throws DecodeException;
 
+    /**
+     * {@inheritDoc}
+     */
+    List<Control> getControls();
 
-  /**
-   * Returns the authorization ID of the user. The authorization ID usually has
-   * the form "dn:" immediately followed by the distinguished name of the user,
-   * or "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @return The authorization ID of the user, or {@code null} if this result
-   *         does not contain an authorization ID.
-   */
-  String getAuthorizationID();
+    /**
+     * {@inheritDoc}
+     */
+    String getDiagnosticMessage();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getMatchedDN();
 
+    /**
+     * {@inheritDoc}
+     */
+    String getOID();
 
-  /**
-   * {@inheritDoc}
-   */
-  Throwable getCause();
+    /**
+     * {@inheritDoc}
+     */
+    List<String> getReferralURIs();
 
+    /**
+     * {@inheritDoc}
+     */
+    ResultCode getResultCode();
 
+    /**
+     * {@inheritDoc}
+     */
+    ByteString getValue();
 
-  /**
-   * {@inheritDoc}
-   */
-  <C extends Control> C getControl(ControlDecoder<C> decoder,
-      DecodeOptions options) throws DecodeException;
+    /**
+     * {@inheritDoc}
+     */
+    boolean hasValue();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isReferral();
 
+    /**
+     * {@inheritDoc}
+     */
+    boolean isSuccess();
 
-  /**
-   * {@inheritDoc}
-   */
-  List<Control> getControls();
+    /**
+     * Sets the authorization ID of the user. The authorization ID usually has
+     * the form "dn:" immediately followed by the distinguished name of the
+     * user, or "u:" followed by a user ID string, but other forms are
+     * permitted.
+     *
+     * @param authorizationID
+     *            The authorization ID of the user, which may be {@code null} if
+     *            this result does not contain an authorization ID.
+     * @return This who am I result.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code authorizationID} was non-empty and did not contain
+     *             a valid authorization ID type.
+     * @throws UnsupportedOperationException
+     *             If this who am I extended result does not permit the
+     *             authorization ID to be set.
+     */
+    WhoAmIExtendedResult setAuthorizationID(String authorizationID);
 
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult setCause(Throwable cause);
 
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult setDiagnosticMessage(String message);
 
-  /**
-   * {@inheritDoc}
-   */
-  String getDiagnosticMessage();
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult setMatchedDN(String dn);
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getMatchedDN();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  List<String> getReferralURIs();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ResultCode getResultCode();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  ByteString getValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean hasValue();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isReferral();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  boolean isSuccess();
-
-
-
-  /**
-   * Sets the authorization ID of the user. The authorization ID usually has the
-   * form "dn:" immediately followed by the distinguished name of the user, or
-   * "u:" followed by a user ID string, but other forms are permitted.
-   *
-   * @param authorizationID
-   *          The authorization ID of the user, which may be {@code null} if
-   *          this result does not contain an authorization ID.
-   * @return This who am I result.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code authorizationID} was non-empty and did not contain a
-   *           valid authorization ID type.
-   * @throws UnsupportedOperationException
-   *           If this who am I extended result does not permit the
-   *           authorization ID to be set.
-   */
-  WhoAmIExtendedResult setAuthorizationID(String authorizationID);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult setCause(Throwable cause);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult setDiagnosticMessage(String message);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult setMatchedDN(String dn);
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  WhoAmIExtendedResult setResultCode(ResultCode resultCode);
+    /**
+     * {@inheritDoc}
+     */
+    WhoAmIExtendedResult setResultCode(ResultCode resultCode);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java
index 67091ee..d9ab827 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_WHOAMI_INVALID_AUTHZID_TYPE;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -37,133 +34,102 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ResultCode;
 
-
-
 /**
  * Who Am I extended result implementation.
  */
-final class WhoAmIExtendedResultImpl extends
-    AbstractExtendedResult<WhoAmIExtendedResult> implements
-    WhoAmIExtendedResult
-{
+final class WhoAmIExtendedResultImpl extends AbstractExtendedResult<WhoAmIExtendedResult> implements
+        WhoAmIExtendedResult {
 
-  // The authorization ID.
-  private String authorizationID = null;
+    // The authorization ID.
+    private String authorizationID = null;
 
-
-
-  // Instantiation via factory.
-  WhoAmIExtendedResultImpl(final ResultCode resultCode)
-  {
-    super(resultCode);
-  }
-
-
-
-  /**
-   * Creates a new who am I extended result that is an exact copy of the
-   * provided result.
-   *
-   * @param whoAmIExtendedResult
-   *          The who am I extended result to be copied.
-   * @throws NullPointerException
-   *           If {@code whoAmIExtendedResult} was {@code null} .
-   */
-  WhoAmIExtendedResultImpl(final WhoAmIExtendedResult whoAmIExtendedResult)
-  {
-    super(whoAmIExtendedResult);
-    this.authorizationID = whoAmIExtendedResult.getAuthorizationID();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getAuthorizationID()
-  {
-    return authorizationID;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getOID()
-  {
-    // No response name defined.
-    return null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ByteString getValue()
-  {
-    return (authorizationID != null) ? ByteString.valueOf(authorizationID)
-        : null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasValue()
-  {
-    return (authorizationID != null);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public WhoAmIExtendedResult setAuthorizationID(final String authorizationID)
-  {
-    if (authorizationID != null && authorizationID.length() != 0)
-    {
-      final int colonIndex = authorizationID.indexOf(':');
-      if (colonIndex < 0)
-      {
-        final LocalizableMessage message = ERR_WHOAMI_INVALID_AUTHZID_TYPE
-            .get(authorizationID);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+    // Instantiation via factory.
+    WhoAmIExtendedResultImpl(final ResultCode resultCode) {
+        super(resultCode);
     }
 
-    this.authorizationID = authorizationID;
-    return this;
-  }
+    /**
+     * Creates a new who am I extended result that is an exact copy of the
+     * provided result.
+     *
+     * @param whoAmIExtendedResult
+     *            The who am I extended result to be copied.
+     * @throws NullPointerException
+     *             If {@code whoAmIExtendedResult} was {@code null} .
+     */
+    WhoAmIExtendedResultImpl(final WhoAmIExtendedResult whoAmIExtendedResult) {
+        super(whoAmIExtendedResult);
+        this.authorizationID = whoAmIExtendedResult.getAuthorizationID();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public String getAuthorizationID() {
+        return authorizationID;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID() {
+        // No response name defined.
+        return null;
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("WhoAmIExtendedResponse(resultCode=");
-    builder.append(getResultCode());
-    builder.append(", matchedDN=");
-    builder.append(getMatchedDN());
-    builder.append(", diagnosticMessage=");
-    builder.append(getDiagnosticMessage());
-    builder.append(", referrals=");
-    builder.append(getReferralURIs());
-    builder.append(", authzId=");
-    builder.append(authorizationID);
-    builder.append(", controls=");
-    builder.append(getControls());
-    builder.append(")");
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString getValue() {
+        return (authorizationID != null) ? ByteString.valueOf(authorizationID) : null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean hasValue() {
+        return (authorizationID != null);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) {
+        if (authorizationID != null && authorizationID.length() != 0) {
+            final int colonIndex = authorizationID.indexOf(':');
+            if (colonIndex < 0) {
+                final LocalizableMessage message =
+                        ERR_WHOAMI_INVALID_AUTHZID_TYPE.get(authorizationID);
+                throw new LocalizedIllegalArgumentException(message);
+            }
+        }
+
+        this.authorizationID = authorizationID;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("WhoAmIExtendedResponse(resultCode=");
+        builder.append(getResultCode());
+        builder.append(", matchedDN=");
+        builder.append(getMatchedDN());
+        builder.append(", diagnosticMessage=");
+        builder.append(getDiagnosticMessage());
+        builder.append(", referrals=");
+        builder.append(getReferralURIs());
+        builder.append(", authzId=");
+        builder.append(authorizationID);
+        builder.append(", controls=");
+        builder.append(getControls());
+        builder.append(")");
+        return builder.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java
index c394612..721ed0d 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package org.forgerock.opendj.ldap.responses;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java
index 8f2cc15..f253b27 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import java.util.Comparator;
 import java.util.List;
 
@@ -36,98 +33,63 @@
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements a default equality or approximate matching rule that
  * matches normalized values in byte order.
  */
-abstract class AbstractMatchingRuleImpl implements MatchingRuleImpl
-{
-  static class DefaultEqualityAssertion implements Assertion
-  {
-    ByteSequence normalizedAssertionValue;
+abstract class AbstractMatchingRuleImpl implements MatchingRuleImpl {
+    static class DefaultEqualityAssertion implements Assertion {
+        ByteSequence normalizedAssertionValue;
 
+        protected DefaultEqualityAssertion(final ByteSequence normalizedAssertionValue) {
+            this.normalizedAssertionValue = normalizedAssertionValue;
+        }
 
-
-    protected DefaultEqualityAssertion(
-        final ByteSequence normalizedAssertionValue)
-    {
-      this.normalizedAssertionValue = normalizedAssertionValue;
+        public ConditionResult matches(final ByteSequence attributeValue) {
+            return normalizedAssertionValue.equals(attributeValue) ? ConditionResult.TRUE
+                    : ConditionResult.FALSE;
+        }
     }
 
+    private static final Assertion UNDEFINED_ASSERTION = new Assertion() {
+        public ConditionResult matches(final ByteSequence attributeValue) {
+            return ConditionResult.UNDEFINED;
+        }
+    };
 
+    private static final Comparator<ByteSequence> DEFAULT_COMPARATOR =
+            new Comparator<ByteSequence>() {
+                public int compare(final ByteSequence o1, final ByteSequence o2) {
+                    return o1.compareTo(o2);
+                }
+            };
 
-    public ConditionResult matches(final ByteSequence attributeValue)
-    {
-      return normalizedAssertionValue.equals(attributeValue) ? ConditionResult.TRUE
-          : ConditionResult.FALSE;
+    AbstractMatchingRuleImpl() {
+        // Nothing to do.
     }
-  }
 
-
-
-  private static final Assertion UNDEFINED_ASSERTION = new Assertion()
-  {
-    public ConditionResult matches(final ByteSequence attributeValue)
-    {
-      return ConditionResult.UNDEFINED;
+    public Comparator<ByteSequence> comparator(final Schema schema) {
+        return DEFAULT_COMPARATOR;
     }
-  };
 
-  private static final Comparator<ByteSequence> DEFAULT_COMPARATOR = new Comparator<ByteSequence>()
-  {
-    public int compare(final ByteSequence o1, final ByteSequence o2)
-    {
-      return o1.compareTo(o2);
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return new DefaultEqualityAssertion(normalizeAttributeValue(schema, value));
     }
-  };
 
+    public Assertion getAssertion(final Schema schema, final ByteSequence subInitial,
+            final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal)
+            throws DecodeException {
+        return UNDEFINED_ASSERTION;
+    }
 
+    public Assertion getGreaterOrEqualAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return UNDEFINED_ASSERTION;
+    }
 
-  AbstractMatchingRuleImpl()
-  {
-    // Nothing to do.
-  }
-
-
-
-  public Comparator<ByteSequence> comparator(final Schema schema)
-  {
-    return DEFAULT_COMPARATOR;
-  }
-
-
-
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return new DefaultEqualityAssertion(normalizeAttributeValue(schema, value));
-  }
-
-
-
-  public Assertion getAssertion(final Schema schema,
-      final ByteSequence subInitial,
-      final List<? extends ByteSequence> subAnyElements,
-      final ByteSequence subFinal) throws DecodeException
-  {
-    return UNDEFINED_ASSERTION;
-  }
-
-
-
-  public Assertion getGreaterOrEqualAssertion(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return UNDEFINED_ASSERTION;
-  }
-
-
-
-  public Assertion getLessOrEqualAssertion(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return UNDEFINED_ASSERTION;
-  }
+    public Assertion getLessOrEqualAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return UNDEFINED_ASSERTION;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java
index 41c075c..f416ac7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,72 +25,54 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 /**
  * This class implements a default ordering matching rule that matches
  * normalized values in byte order.
  */
-abstract class AbstractOrderingMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  AbstractOrderingMatchingRuleImpl()
-  {
-    // Nothing to do.
-  }
+abstract class AbstractOrderingMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    AbstractOrderingMatchingRuleImpl() {
+        // Nothing to do.
+    }
 
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final ByteString normAssertion = normalizeAttributeValue(schema, value);
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                return attributeValue.compareTo(normAssertion) < 0 ? ConditionResult.TRUE
+                        : ConditionResult.FALSE;
+            }
+        };
+    }
 
+    @Override
+    public Assertion getGreaterOrEqualAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final ByteString normAssertion = normalizeAttributeValue(schema, value);
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                return attributeValue.compareTo(normAssertion) >= 0 ? ConditionResult.TRUE
+                        : ConditionResult.FALSE;
+            }
+        };
+    }
 
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    final ByteString normAssertion = normalizeAttributeValue(schema, value);
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        return attributeValue.compareTo(normAssertion) < 0 ? ConditionResult.TRUE
-            : ConditionResult.FALSE;
-      }
-    };
-  }
-
-
-
-  @Override
-  public Assertion getGreaterOrEqualAssertion(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final ByteString normAssertion = normalizeAttributeValue(schema, value);
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        return attributeValue.compareTo(normAssertion) >= 0 ? ConditionResult.TRUE
-            : ConditionResult.FALSE;
-      }
-    };
-  }
-
-
-
-  @Override
-  public Assertion getLessOrEqualAssertion(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final ByteString normAssertion = normalizeAttributeValue(schema, value);
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        return attributeValue.compareTo(normAssertion) <= 0 ? ConditionResult.TRUE
-            : ConditionResult.FALSE;
-      }
-    };
-  }
+    @Override
+    public Assertion getLessOrEqualAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final ByteString normAssertion = normalizeAttributeValue(schema, value);
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                return attributeValue.compareTo(normAssertion) <= 0 ? ConditionResult.TRUE
+                        : ConditionResult.FALSE;
+            }
+        };
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java
index b987732..7c1790d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,515 +25,414 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.util.LinkedList;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements a default substring matching rule that matches
  * normalized substring assertion values in byte order.
  */
-abstract class AbstractSubstringMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  static class DefaultSubstringAssertion implements Assertion
-  {
-    private final ByteString normInitial;
-    private final ByteString[] normAnys;
-    private final ByteString normFinal;
+abstract class AbstractSubstringMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    static class DefaultSubstringAssertion implements Assertion {
+        private final ByteString normInitial;
+        private final ByteString[] normAnys;
+        private final ByteString normFinal;
 
-
-
-    protected DefaultSubstringAssertion(final ByteString normInitial,
-        final ByteString[] normAnys, final ByteString normFinal)
-    {
-      this.normInitial = normInitial;
-      this.normAnys = normAnys;
-      this.normFinal = normFinal;
-    }
-
-
-
-    public ConditionResult matches(final ByteSequence attributeValue)
-    {
-      final int valueLength = attributeValue.length();
-
-      int pos = 0;
-      if (normInitial != null)
-      {
-        final int initialLength = normInitial.length();
-        if (initialLength > valueLength)
-        {
-          return ConditionResult.FALSE;
+        protected DefaultSubstringAssertion(final ByteString normInitial,
+                final ByteString[] normAnys, final ByteString normFinal) {
+            this.normInitial = normInitial;
+            this.normAnys = normAnys;
+            this.normFinal = normFinal;
         }
 
-        for (; pos < initialLength; pos++)
-        {
-          if (normInitial.byteAt(pos) != attributeValue.byteAt(pos))
-          {
-            return ConditionResult.FALSE;
-          }
-        }
-      }
+        public ConditionResult matches(final ByteSequence attributeValue) {
+            final int valueLength = attributeValue.length();
 
-      if (normAnys != null && normAnys.length != 0)
-      {
-        for (final ByteSequence element : normAnys)
-        {
-          final int anyLength = element.length();
-          if (anyLength == 0)
-          {
-            continue;
-          }
-          final int end = valueLength - anyLength;
-          boolean match = false;
-          for (; pos <= end; pos++)
-          {
-            if (element.byteAt(0) == attributeValue.byteAt(pos))
-            {
-              boolean subMatch = true;
-              for (int i = 1; i < anyLength; i++)
-              {
-                if (element.byteAt(i) != attributeValue.byteAt(pos + i))
-                {
-                  subMatch = false;
-                  break;
+            int pos = 0;
+            if (normInitial != null) {
+                final int initialLength = normInitial.length();
+                if (initialLength > valueLength) {
+                    return ConditionResult.FALSE;
                 }
-              }
 
-              if (subMatch)
-              {
-                match = subMatch;
+                for (; pos < initialLength; pos++) {
+                    if (normInitial.byteAt(pos) != attributeValue.byteAt(pos)) {
+                        return ConditionResult.FALSE;
+                    }
+                }
+            }
+
+            if (normAnys != null && normAnys.length != 0) {
+                for (final ByteSequence element : normAnys) {
+                    final int anyLength = element.length();
+                    if (anyLength == 0) {
+                        continue;
+                    }
+                    final int end = valueLength - anyLength;
+                    boolean match = false;
+                    for (; pos <= end; pos++) {
+                        if (element.byteAt(0) == attributeValue.byteAt(pos)) {
+                            boolean subMatch = true;
+                            for (int i = 1; i < anyLength; i++) {
+                                if (element.byteAt(i) != attributeValue.byteAt(pos + i)) {
+                                    subMatch = false;
+                                    break;
+                                }
+                            }
+
+                            if (subMatch) {
+                                match = subMatch;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (match) {
+                        pos += anyLength;
+                    } else {
+                        return ConditionResult.FALSE;
+                    }
+                }
+            }
+
+            if (normFinal != null) {
+                final int finalLength = normFinal.length();
+
+                if (valueLength - finalLength < pos) {
+                    return ConditionResult.FALSE;
+                }
+
+                pos = valueLength - finalLength;
+                for (int i = 0; i < finalLength; i++, pos++) {
+                    if (normFinal.byteAt(i) != attributeValue.byteAt(pos)) {
+                        return ConditionResult.FALSE;
+                    }
+                }
+            }
+
+            return ConditionResult.TRUE;
+        }
+    }
+
+    AbstractSubstringMatchingRuleImpl() {
+        // Nothing to do.
+    }
+
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        if (value.length() == 0) {
+            throw DecodeException.error(WARN_ATTR_SYNTAX_SUBSTRING_EMPTY.get());
+        }
+
+        ByteSequence initialString = null;
+        ByteSequence finalString = null;
+        List<ByteSequence> anyStrings = null;
+
+        final String valueString = value.toString();
+
+        if (valueString.length() == 1 && valueString.charAt(0) == '*') {
+            return getAssertion(schema, initialString, anyStrings, finalString);
+        }
+
+        final char[] escapeChars = new char[] { '*' };
+        final SubstringReader reader = new SubstringReader(valueString);
+
+        ByteString bytes = evaluateEscapes(reader, escapeChars, false);
+        if (bytes.length() > 0) {
+            initialString = normalizeSubString(schema, bytes);
+        }
+        if (reader.remaining() == 0) {
+            throw DecodeException.error(WARN_ATTR_SYNTAX_SUBSTRING_NO_WILDCARDS.get(value
+                    .toString()));
+        }
+        while (true) {
+            reader.read();
+            bytes = evaluateEscapes(reader, escapeChars, false);
+            if (reader.remaining() > 0) {
+                if (bytes.length() == 0) {
+                    throw DecodeException.error(WARN_ATTR_SYNTAX_SUBSTRING_CONSECUTIVE_WILDCARDS
+                            .get(value.toString(), reader.pos()));
+                }
+                if (anyStrings == null) {
+                    anyStrings = new LinkedList<ByteSequence>();
+                }
+                anyStrings.add(normalizeSubString(schema, bytes));
+            } else {
+                if (bytes.length() > 0) {
+                    finalString = normalizeSubString(schema, bytes);
+                }
                 break;
-              }
             }
-          }
-
-          if (match)
-          {
-            pos += anyLength;
-          }
-          else
-          {
-            return ConditionResult.FALSE;
-          }
-        }
-      }
-
-      if (normFinal != null)
-      {
-        final int finalLength = normFinal.length();
-
-        if (valueLength - finalLength < pos)
-        {
-          return ConditionResult.FALSE;
         }
 
-        pos = valueLength - finalLength;
-        for (int i = 0; i < finalLength; i++, pos++)
-        {
-          if (normFinal.byteAt(i) != attributeValue.byteAt(pos))
-          {
-            return ConditionResult.FALSE;
-          }
+        return getAssertion(schema, initialString, anyStrings, finalString);
+    }
+
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence subInitial,
+            final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal)
+            throws DecodeException {
+        final ByteString normInitial =
+                subInitial == null ? null : normalizeSubString(schema, subInitial);
+
+        ByteString[] normAnys = null;
+        if (subAnyElements != null && !subAnyElements.isEmpty()) {
+            normAnys = new ByteString[subAnyElements.size()];
+            for (int i = 0; i < subAnyElements.size(); i++) {
+                normAnys[i] = normalizeSubString(schema, subAnyElements.get(i));
+            }
         }
-      }
+        final ByteString normFinal = subFinal == null ? null : normalizeSubString(schema, subFinal);
 
-      return ConditionResult.TRUE;
-    }
-  }
-
-
-
-  AbstractSubstringMatchingRuleImpl()
-  {
-    // Nothing to do.
-  }
-
-
-
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    if (value.length() == 0)
-    {
-      throw DecodeException.error(WARN_ATTR_SYNTAX_SUBSTRING_EMPTY.get());
+        return new DefaultSubstringAssertion(normInitial, normAnys, normFinal);
     }
 
-    ByteSequence initialString = null;
-    ByteSequence finalString = null;
-    List<ByteSequence> anyStrings = null;
-
-    final String valueString = value.toString();
-
-    if (valueString.length() == 1 && valueString.charAt(0) == '*')
-    {
-      return getAssertion(schema, initialString, anyStrings, finalString);
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalizeAttributeValue(schema, value);
     }
 
-    final char[] escapeChars = new char[] { '*' };
-    final SubstringReader reader = new SubstringReader(valueString);
-
-    ByteString bytes = evaluateEscapes(reader, escapeChars, false);
-    if (bytes.length() > 0)
-    {
-      initialString = normalizeSubString(schema, bytes);
-    }
-    if (reader.remaining() == 0)
-    {
-      throw DecodeException.error(WARN_ATTR_SYNTAX_SUBSTRING_NO_WILDCARDS
-          .get(value.toString()));
-    }
-    while (true)
-    {
-      reader.read();
-      bytes = evaluateEscapes(reader, escapeChars, false);
-      if (reader.remaining() > 0)
-      {
-        if (bytes.length() == 0)
-        {
-          throw DecodeException
-              .error(WARN_ATTR_SYNTAX_SUBSTRING_CONSECUTIVE_WILDCARDS.get(value
-                  .toString(), reader.pos()));
+    private char evaluateEscapedChar(final SubstringReader reader, final char[] escapeChars)
+            throws DecodeException {
+        final char c1 = reader.read();
+        byte b;
+        switch (c1) {
+        case '0':
+            b = 0x00;
+            break;
+        case '1':
+            b = 0x10;
+            break;
+        case '2':
+            b = 0x20;
+            break;
+        case '3':
+            b = 0x30;
+            break;
+        case '4':
+            b = 0x40;
+            break;
+        case '5':
+            b = 0x50;
+            break;
+        case '6':
+            b = 0x60;
+            break;
+        case '7':
+            b = 0x70;
+            break;
+        case '8':
+            b = (byte) 0x80;
+            break;
+        case '9':
+            b = (byte) 0x90;
+            break;
+        case 'A':
+        case 'a':
+            b = (byte) 0xA0;
+            break;
+        case 'B':
+        case 'b':
+            b = (byte) 0xB0;
+            break;
+        case 'C':
+        case 'c':
+            b = (byte) 0xC0;
+            break;
+        case 'D':
+        case 'd':
+            b = (byte) 0xD0;
+            break;
+        case 'E':
+        case 'e':
+            b = (byte) 0xE0;
+            break;
+        case 'F':
+        case 'f':
+            b = (byte) 0xF0;
+            break;
+        default:
+            if (c1 == 0x5C) {
+                return c1;
+            }
+            if (escapeChars != null) {
+                for (final char escapeChar : escapeChars) {
+                    if (c1 == escapeChar) {
+                        return c1;
+                    }
+                }
+            }
+            final LocalizableMessage message = ERR_INVALID_ESCAPE_CHAR.get(reader.getString(), c1);
+            throw DecodeException.error(message);
         }
-        if (anyStrings == null)
-        {
-          anyStrings = new LinkedList<ByteSequence>();
+
+        // The two positions must be the hex characters that
+        // comprise the escaped value.
+        if (reader.remaining() == 0) {
+            final LocalizableMessage message =
+                    ERR_HEX_DECODE_INVALID_LENGTH.get(reader.getString());
+
+            throw DecodeException.error(message);
         }
-        anyStrings.add(normalizeSubString(schema, bytes));
-      }
-      else
-      {
-        if (bytes.length() > 0)
-        {
-          finalString = normalizeSubString(schema, bytes);
+
+        final char c2 = reader.read();
+        switch (c2) {
+        case '0':
+            // No action required.
+            break;
+        case '1':
+            b |= 0x01;
+            break;
+        case '2':
+            b |= 0x02;
+            break;
+        case '3':
+            b |= 0x03;
+            break;
+        case '4':
+            b |= 0x04;
+            break;
+        case '5':
+            b |= 0x05;
+            break;
+        case '6':
+            b |= 0x06;
+            break;
+        case '7':
+            b |= 0x07;
+            break;
+        case '8':
+            b |= 0x08;
+            break;
+        case '9':
+            b |= 0x09;
+            break;
+        case 'A':
+        case 'a':
+            b |= 0x0A;
+            break;
+        case 'B':
+        case 'b':
+            b |= 0x0B;
+            break;
+        case 'C':
+        case 'c':
+            b |= 0x0C;
+            break;
+        case 'D':
+        case 'd':
+            b |= 0x0D;
+            break;
+        case 'E':
+        case 'e':
+            b |= 0x0E;
+            break;
+        case 'F':
+        case 'f':
+            b |= 0x0F;
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_HEX_DECODE_INVALID_CHARACTER.get(new String(new char[] { c1, c2 }), c1);
+            throw DecodeException.error(message);
         }
-        break;
-      }
+        return (char) b;
     }
 
-    return getAssertion(schema, initialString, anyStrings, finalString);
-  }
-
-
-
-  @Override
-  public Assertion getAssertion(final Schema schema,
-      final ByteSequence subInitial,
-      final List<? extends ByteSequence> subAnyElements,
-      final ByteSequence subFinal) throws DecodeException
-  {
-    final ByteString normInitial = subInitial == null ? null
-        : normalizeSubString(schema, subInitial);
-
-    ByteString[] normAnys = null;
-    if (subAnyElements != null && !subAnyElements.isEmpty())
-    {
-      normAnys = new ByteString[subAnyElements.size()];
-      for (int i = 0; i < subAnyElements.size(); i++)
-      {
-        normAnys[i] = normalizeSubString(schema, subAnyElements.get(i));
-      }
+    private ByteString evaluateEscapes(final SubstringReader reader, final char[] escapeChars,
+            final boolean trim) throws DecodeException {
+        return evaluateEscapes(reader, escapeChars, escapeChars, trim);
     }
-    final ByteString normFinal = subFinal == null ? null : normalizeSubString(
-        schema, subFinal);
 
-    return new DefaultSubstringAssertion(normInitial, normAnys, normFinal);
-  }
+    private ByteString evaluateEscapes(final SubstringReader reader, final char[] escapeChars,
+            final char[] delimiterChars, final boolean trim) throws DecodeException {
+        int length = 0;
+        int lengthWithoutSpace = 0;
+        char c;
+        ByteStringBuilder valueBuffer = null;
 
-
-
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return normalizeAttributeValue(schema, value);
-  }
-
-
-
-  private char evaluateEscapedChar(final SubstringReader reader,
-      final char[] escapeChars) throws DecodeException
-  {
-    final char c1 = reader.read();
-    byte b;
-    switch (c1)
-    {
-    case '0':
-      b = 0x00;
-      break;
-    case '1':
-      b = 0x10;
-      break;
-    case '2':
-      b = 0x20;
-      break;
-    case '3':
-      b = 0x30;
-      break;
-    case '4':
-      b = 0x40;
-      break;
-    case '5':
-      b = 0x50;
-      break;
-    case '6':
-      b = 0x60;
-      break;
-    case '7':
-      b = 0x70;
-      break;
-    case '8':
-      b = (byte) 0x80;
-      break;
-    case '9':
-      b = (byte) 0x90;
-      break;
-    case 'A':
-    case 'a':
-      b = (byte) 0xA0;
-      break;
-    case 'B':
-    case 'b':
-      b = (byte) 0xB0;
-      break;
-    case 'C':
-    case 'c':
-      b = (byte) 0xC0;
-      break;
-    case 'D':
-    case 'd':
-      b = (byte) 0xD0;
-      break;
-    case 'E':
-    case 'e':
-      b = (byte) 0xE0;
-      break;
-    case 'F':
-    case 'f':
-      b = (byte) 0xF0;
-      break;
-    default:
-      if (c1 == 0x5C)
-      {
-        return c1;
-      }
-      if (escapeChars != null)
-      {
-        for (final char escapeChar : escapeChars)
-        {
-          if (c1 == escapeChar)
-          {
-            return c1;
-          }
+        if (trim) {
+            reader.skipWhitespaces();
         }
-      }
-      final LocalizableMessage message = ERR_INVALID_ESCAPE_CHAR.get(reader
-          .getString(), c1);
-      throw DecodeException.error(message);
-    }
 
-    // The two positions must be the hex characters that
-    // comprise the escaped value.
-    if (reader.remaining() == 0)
-    {
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH
-          .get(reader.getString());
-
-      throw DecodeException.error(message);
-    }
-
-    final char c2 = reader.read();
-    switch (c2)
-    {
-    case '0':
-      // No action required.
-      break;
-    case '1':
-      b |= 0x01;
-      break;
-    case '2':
-      b |= 0x02;
-      break;
-    case '3':
-      b |= 0x03;
-      break;
-    case '4':
-      b |= 0x04;
-      break;
-    case '5':
-      b |= 0x05;
-      break;
-    case '6':
-      b |= 0x06;
-      break;
-    case '7':
-      b |= 0x07;
-      break;
-    case '8':
-      b |= 0x08;
-      break;
-    case '9':
-      b |= 0x09;
-      break;
-    case 'A':
-    case 'a':
-      b |= 0x0A;
-      break;
-    case 'B':
-    case 'b':
-      b |= 0x0B;
-      break;
-    case 'C':
-    case 'c':
-      b |= 0x0C;
-      break;
-    case 'D':
-    case 'd':
-      b |= 0x0D;
-      break;
-    case 'E':
-    case 'e':
-      b |= 0x0E;
-      break;
-    case 'F':
-    case 'f':
-      b |= 0x0F;
-      break;
-    default:
-      final LocalizableMessage message = ERR_HEX_DECODE_INVALID_CHARACTER.get(
-          new String(new char[] { c1, c2 }), c1);
-      throw DecodeException.error(message);
-    }
-    return (char) b;
-  }
-
-
-
-  private ByteString evaluateEscapes(final SubstringReader reader,
-      final char[] escapeChars, final boolean trim) throws DecodeException
-  {
-    return evaluateEscapes(reader, escapeChars, escapeChars, trim);
-  }
-
-
-
-  private ByteString evaluateEscapes(final SubstringReader reader,
-      final char[] escapeChars, final char[] delimiterChars, final boolean trim)
-      throws DecodeException
-  {
-    int length = 0;
-    int lengthWithoutSpace = 0;
-    char c;
-    ByteStringBuilder valueBuffer = null;
-
-    if (trim)
-    {
-      reader.skipWhitespaces();
-    }
-
-    reader.mark();
-    while (reader.remaining() > 0)
-    {
-      c = reader.read();
-      if (c == 0x5C) // The backslash character
-      {
-        if (valueBuffer == null)
-        {
-          valueBuffer = new ByteStringBuilder();
-        }
-        valueBuffer.append(reader.read(length));
-        valueBuffer.append(evaluateEscapedChar(reader, escapeChars));
         reader.mark();
-        length = lengthWithoutSpace = 0;
-      }
-      if (delimiterChars != null)
-      {
-        for (final char delimiterChar : delimiterChars)
-        {
-          if (c == delimiterChar)
-          {
-            reader.reset();
-            if (valueBuffer != null)
-            {
-              if (trim)
-              {
-                valueBuffer.append(reader.read(lengthWithoutSpace));
-              }
-              else
-              {
+        while (reader.remaining() > 0) {
+            c = reader.read();
+            if (c == 0x5C /* The backslash character */) {
+                if (valueBuffer == null) {
+                    valueBuffer = new ByteStringBuilder();
+                }
                 valueBuffer.append(reader.read(length));
-              }
-              return valueBuffer.toByteString();
+                valueBuffer.append(evaluateEscapedChar(reader, escapeChars));
+                reader.mark();
+                length = lengthWithoutSpace = 0;
             }
-            else
-            {
-              if (trim)
-              {
-                if (lengthWithoutSpace > 0)
-                {
-                  return ByteString.valueOf(reader.read(lengthWithoutSpace));
+            if (delimiterChars != null) {
+                for (final char delimiterChar : delimiterChars) {
+                    if (c == delimiterChar) {
+                        reader.reset();
+                        if (valueBuffer != null) {
+                            if (trim) {
+                                valueBuffer.append(reader.read(lengthWithoutSpace));
+                            } else {
+                                valueBuffer.append(reader.read(length));
+                            }
+                            return valueBuffer.toByteString();
+                        } else {
+                            if (trim) {
+                                if (lengthWithoutSpace > 0) {
+                                    return ByteString.valueOf(reader.read(lengthWithoutSpace));
+                                }
+                                return ByteString.empty();
+                            }
+                            if (length > 0) {
+                                return ByteString.valueOf(reader.read(length));
+                            }
+                            return ByteString.empty();
+                        }
+                    }
+                }
+            }
+            length++;
+            if (c != ' ') {
+                lengthWithoutSpace = length;
+            } else {
+                lengthWithoutSpace++;
+            }
+        }
+
+        reader.reset();
+        if (valueBuffer != null) {
+            if (trim) {
+                valueBuffer.append(reader.read(lengthWithoutSpace));
+            } else {
+                valueBuffer.append(reader.read(length));
+            }
+            return valueBuffer.toByteString();
+        } else {
+            if (trim) {
+                if (lengthWithoutSpace > 0) {
+                    return ByteString.valueOf(reader.read(lengthWithoutSpace));
                 }
                 return ByteString.empty();
-              }
-              if (length > 0)
-              {
-                return ByteString.valueOf(reader.read(length));
-              }
-              return ByteString.empty();
             }
-          }
+            if (length > 0) {
+                return ByteString.valueOf(reader.read(length));
+            }
+            return ByteString.empty();
         }
-      }
-      length++;
-      if (c != ' ')
-      {
-        lengthWithoutSpace = length;
-      }
-      else
-      {
-        lengthWithoutSpace++;
-      }
     }
-
-    reader.reset();
-    if (valueBuffer != null)
-    {
-      if (trim)
-      {
-        valueBuffer.append(reader.read(lengthWithoutSpace));
-      }
-      else
-      {
-        valueBuffer.append(reader.read(length));
-      }
-      return valueBuffer.toByteString();
-    }
-    else
-    {
-      if (trim)
-      {
-        if (lengthWithoutSpace > 0)
-        {
-          return ByteString.valueOf(reader.read(lengthWithoutSpace));
-        }
-        return ByteString.empty();
-      }
-      if (length > 0)
-      {
-        return ByteString.valueOf(reader.read(length));
-      }
-      return ByteString.empty();
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java
index 7459110..7fefd86 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,51 +26,32 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 /**
  * This class defines the set of methods and structures that must be implemented
  * to define a new attribute syntax.
  */
-abstract class AbstractSyntaxImpl implements SyntaxImpl
-{
-  AbstractSyntaxImpl()
-  {
-    // Nothing to do.
-  }
+abstract class AbstractSyntaxImpl implements SyntaxImpl {
+    AbstractSyntaxImpl() {
+        // Nothing to do.
+    }
 
+    public String getApproximateMatchingRule() {
+        return null;
+    }
 
+    public String getEqualityMatchingRule() {
+        return null;
+    }
 
-  public String getApproximateMatchingRule()
-  {
-    return null;
-  }
+    public String getOrderingMatchingRule() {
+        return null;
+    }
 
+    public String getSubstringMatchingRule() {
+        return null;
+    }
 
-
-  public String getEqualityMatchingRule()
-  {
-    return null;
-  }
-
-
-
-  public String getOrderingMatchingRule()
-  {
-    return null;
-  }
-
-
-
-  public String getSubstringMatchingRule()
-  {
-    return null;
-  }
-
-
-
-  public boolean isBEREncodingRequired()
-  {
-    return false;
-  }
+    public boolean isBEREncodingRequired() {
+        return false;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java
index 002c257..39a9aea 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,8 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SCHEMA_PROPERTY_APPROX_RULE;
 
 import java.util.Collections;
 import java.util.Iterator;
@@ -43,8 +40,6 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with an
  * attribute type, which contains information about the format of an attribute
@@ -55,882 +50,704 @@
  * will be preserved when the associated fields are accessed via their getters
  * or via the {@link #toString()} methods.
  */
-public final class AttributeType extends SchemaElement implements
-    Comparable<AttributeType>
-{
+public final class AttributeType extends SchemaElement implements Comparable<AttributeType> {
 
-  // The approximate matching rule for this attribute type.
-  private final String approximateMatchingRuleOID;
+    // The approximate matching rule for this attribute type.
+    private final String approximateMatchingRuleOID;
 
-  // The attribute usage for this attribute type.
-  private final AttributeUsage attributeUsage;
+    // The attribute usage for this attribute type.
+    private final AttributeUsage attributeUsage;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  // The equality matching rule for this attribute type.
-  private final String equalityMatchingRuleOID;
+    // The equality matching rule for this attribute type.
+    private final String equalityMatchingRuleOID;
 
-  // Indicates whether this attribute type is declared "collective".
-  private final boolean isCollective;
+    // Indicates whether this attribute type is declared "collective".
+    private final boolean isCollective;
 
-  // Indicates whether this attribute type is declared
-  // "no-user-modification".
-  private final boolean isNoUserModification;
+    // Indicates whether this attribute type is declared
+    // "no-user-modification".
+    private final boolean isNoUserModification;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // Indicates whether this attribute type is declared "single-value".
-  private final boolean isSingleValue;
+    // Indicates whether this attribute type is declared "single-value".
+    private final boolean isSingleValue;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // The OID that may be used to reference this definition.
-  private final String oid;
+    // The OID that may be used to reference this definition.
+    private final String oid;
 
-  // The ordering matching rule for this attribute type.
-  private final String orderingMatchingRuleOID;
+    // The ordering matching rule for this attribute type.
+    private final String orderingMatchingRuleOID;
 
-  // The substring matching rule for this attribute type.
-  private final String substringMatchingRuleOID;
+    // The substring matching rule for this attribute type.
+    private final String substringMatchingRuleOID;
 
-  // The superior attribute type from which this attribute type
-  // inherits.
-  private final String superiorTypeOID;
+    // The superior attribute type from which this attribute type
+    // inherits.
+    private final String superiorTypeOID;
 
-  // The syntax for this attribute type.
-  private final String syntaxOID;
+    // The syntax for this attribute type.
+    private final String syntaxOID;
 
-  // True if this type has OID 2.5.4.0.
-  private final boolean isObjectClassType;
+    // True if this type has OID 2.5.4.0.
+    private final boolean isObjectClassType;
 
-  // The normalized name of this attribute type.
-  private final String normalizedName;
+    // The normalized name of this attribute type.
+    private final String normalizedName;
 
-  // The superior attribute type from which this attribute type
-  // inherits.
-  private AttributeType superiorType;
+    // The superior attribute type from which this attribute type
+    // inherits.
+    private AttributeType superiorType;
 
-  // The equality matching rule for this attribute type.
-  private MatchingRule equalityMatchingRule;
+    // The equality matching rule for this attribute type.
+    private MatchingRule equalityMatchingRule;
 
-  // The ordering matching rule for this attribute type.
-  private MatchingRule orderingMatchingRule;
+    // The ordering matching rule for this attribute type.
+    private MatchingRule orderingMatchingRule;
 
-  // The substring matching rule for this attribute type.
-  private MatchingRule substringMatchingRule;
+    // The substring matching rule for this attribute type.
+    private MatchingRule substringMatchingRule;
 
-  // The approximate matching rule for this attribute type.
-  private MatchingRule approximateMatchingRule;
+    // The approximate matching rule for this attribute type.
+    private MatchingRule approximateMatchingRule;
 
-  // The syntax for this attribute type.
-  private Syntax syntax;
+    // The syntax for this attribute type.
+    private Syntax syntax;
 
-  // Indicates whether or not validation has been performed.
-  private boolean needsValidating = true;
+    // Indicates whether or not validation has been performed.
+    private boolean needsValidating = true;
 
-  // The indicates whether or not validation failed.
-  private boolean isValid = false;
+    // The indicates whether or not validation failed.
+    private boolean isValid = false;
 
+    AttributeType(final String oid, final List<String> names, final String description,
+            final boolean obsolete, final String superiorType, final String equalityMatchingRule,
+            final String orderingMatchingRule, final String substringMatchingRule,
+            final String approximateMatchingRule, final String syntax, final boolean singleValue,
+            final boolean collective, final boolean noUserModification,
+            final AttributeUsage attributeUsage, final Map<String, List<String>> extraProperties,
+            final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid, names, description, attributeUsage);
+        Validator.ensureTrue(superiorType != null || syntax != null,
+                "superiorType and/or syntax must not be null");
+        Validator.ensureNotNull(extraProperties);
 
-  AttributeType(final String oid, final List<String> names,
-      final String description, final boolean obsolete,
-      final String superiorType, final String equalityMatchingRule,
-      final String orderingMatchingRule, final String substringMatchingRule,
-      final String approximateMatchingRule, final String syntax,
-      final boolean singleValue, final boolean collective,
-      final boolean noUserModification, final AttributeUsage attributeUsage,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.superiorTypeOID = superiorType;
+        this.equalityMatchingRuleOID = equalityMatchingRule;
+        this.orderingMatchingRuleOID = orderingMatchingRule;
+        this.substringMatchingRuleOID = substringMatchingRule;
+        this.approximateMatchingRuleOID = approximateMatchingRule;
+        this.syntaxOID = syntax;
+        this.isSingleValue = singleValue;
+        this.isCollective = collective;
+        this.isNoUserModification = noUserModification;
+        this.attributeUsage = attributeUsage;
 
-    Validator.ensureNotNull(oid, names, description, attributeUsage);
-    Validator.ensureTrue(superiorType != null || syntax != null,
-        "superiorType and/or syntax must not be null");
-    Validator.ensureNotNull(extraProperties);
-
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.superiorTypeOID = superiorType;
-    this.equalityMatchingRuleOID = equalityMatchingRule;
-    this.orderingMatchingRuleOID = orderingMatchingRule;
-    this.substringMatchingRuleOID = substringMatchingRule;
-    this.approximateMatchingRuleOID = approximateMatchingRule;
-    this.syntaxOID = syntax;
-    this.isSingleValue = singleValue;
-    this.isCollective = collective;
-    this.isNoUserModification = noUserModification;
-    this.attributeUsage = attributeUsage;
-
-    if (definition != null)
-    {
-      this.definition = definition;
-    }
-    else
-    {
-      this.definition = buildDefinition();
-    }
-
-    this.isObjectClassType = oid.equals("2.5.4.0");
-    this.normalizedName = StaticUtils.toLowerCase(getNameOrOID());
-  }
-
-
-
-  AttributeType(final String oid, final List<String> names,
-      final String description, final MatchingRule equalityMatchingRule,
-      final Syntax syntax)
-  {
-    super(description, Collections.<String, List<String>> emptyMap());
-
-    Validator.ensureNotNull(oid, names, description);
-
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = false;
-    this.superiorTypeOID = null;
-    this.superiorType = null;
-    this.equalityMatchingRuleOID = equalityMatchingRule.getOID();
-    this.equalityMatchingRule = equalityMatchingRule;
-    this.orderingMatchingRuleOID = null;
-    this.substringMatchingRuleOID = null;
-    this.approximateMatchingRuleOID = null;
-    this.syntaxOID = syntax.getOID();
-    this.syntax = syntax;
-    this.isSingleValue = false;
-    this.isCollective = false;
-    this.isNoUserModification = false;
-    this.attributeUsage = AttributeUsage.USER_APPLICATIONS;
-    this.definition = buildDefinition();
-
-    this.isObjectClassType = oid.equals("2.5.4.0");
-    this.normalizedName = StaticUtils.toLowerCase(getNameOrOID());
-  }
-
-
-
-  /**
-   * Compares this attribute type to the provided attribute type. The sort-order
-   * is defined as follows:
-   * <ul>
-   * <li>The {@code objectClass} attribute is less than all other attribute
-   * types.
-   * <li>User attributes are less than operational attributes.
-   * <li>Lexicographic comparison of the primary name or OID.
-   * </ul>
-   *
-   * @param type
-   *          The attribute type to be compared.
-   * @return A negative integer, zero, or a positive integer as this attribute
-   *         type is less than, equal to, or greater than the specified
-   *         attribute type.
-   * @throws NullPointerException
-   *           If {@code name} was {@code null}.
-   */
-  public int compareTo(final AttributeType type)
-  {
-    if (isObjectClassType)
-    {
-      return type.isObjectClassType ? 0 : -1;
-    }
-    else if (type.isObjectClassType)
-    {
-      return 1;
-    }
-    else
-    {
-      final boolean isOperational = getUsage().isOperational();
-      final boolean typeIsOperational = type.getUsage().isOperational();
-
-      if (isOperational == typeIsOperational)
-      {
-        return normalizedName.compareTo(type.normalizedName);
-      }
-      else
-      {
-        return isOperational ? 1 : -1;
-      }
-    }
-  }
-
-
-
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (this == o)
-    {
-      return true;
-    }
-
-    if (o instanceof AttributeType)
-    {
-      final AttributeType other = (AttributeType) o;
-      return oid.equals(other.oid);
-    }
-
-    return false;
-  }
-
-
-
-  /**
-   * Returns the matching rule that should be used for approximate matching with
-   * this attribute type.
-   *
-   * @return The matching rule that should be used for approximate matching with
-   *         this attribute type.
-   */
-  public MatchingRule getApproximateMatchingRule()
-  {
-    return approximateMatchingRule;
-  }
-
-
-
-  /**
-   * Returns the matching rule that should be used for equality matching with
-   * this attribute type.
-   *
-   * @return The matching rule that should be used for equality matching with
-   *         this attribute type.
-   */
-  public MatchingRule getEqualityMatchingRule()
-  {
-    return equalityMatchingRule;
-  }
-
-
-
-  /**
-   * Returns the name or OID for this schema definition. If it has one or more
-   * names, then the primary name will be returned. If it does not have any
-   * names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return oid;
-    }
-    return names.get(0);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Returns the OID for this schema definition.
-   *
-   * @return The OID for this schema definition.
-   */
-  public String getOID()
-  {
-
-    return oid;
-  }
-
-
-
-  /**
-   * Returns the matching rule that should be used for ordering with this
-   * attribute type.
-   *
-   * @return The matching rule that should be used for ordering with this
-   *         attribute type.
-   */
-  public MatchingRule getOrderingMatchingRule()
-  {
-    return orderingMatchingRule;
-  }
-
-
-
-  /**
-   * Returns the matching rule that should be used for substring matching with
-   * this attribute type.
-   *
-   * @return The matching rule that should be used for substring matching with
-   *         this attribute type.
-   */
-  public MatchingRule getSubstringMatchingRule()
-  {
-    return substringMatchingRule;
-  }
-
-
-
-  /**
-   * Returns the superior type for this attribute type.
-   *
-   * @return The superior type for this attribute type, or <CODE>null</CODE> if
-   *         it does not have one.
-   */
-  public AttributeType getSuperiorType()
-  {
-    return superiorType;
-  }
-
-
-
-  /**
-   * Returns the syntax for this attribute type.
-   *
-   * @return The syntax for this attribute type.
-   */
-  public Syntax getSyntax()
-  {
-    return syntax;
-  }
-
-
-
-  /**
-   * Returns the usage indicator for this attribute type.
-   *
-   * @return The usage indicator for this attribute type.
-   */
-  public AttributeUsage getUsage()
-  {
-    return attributeUsage;
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return oid.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return {@code true} if the specified name is assigned to this schema
-   *         definition, or {@code false} if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name or OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return {@code true} if the provided value matches the OID or one of the
-   *         names assigned to this schema definition, or {@code false} if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || getOID().equals(value);
-  }
-
-
-
-  /**
-   * Indicates whether this attribute type is declared "collective".
-   *
-   * @return {@code true} if this attribute type is declared "collective", or
-   *         {@code false} if not.
-   */
-  public boolean isCollective()
-  {
-    return isCollective;
-  }
-
-
-
-  /**
-   * Indicates whether this attribute type is declared "no-user-modification".
-   *
-   * @return {@code true} if this attribute type is declared
-   *         "no-user-modification", or {@code false} if not.
-   */
-  public boolean isNoUserModification()
-  {
-    return isNoUserModification;
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute type is the {@code objectClass}
-   * attribute type having the OID 2.5.4.0.
-   *
-   * @return {@code true} if this attribute type is the {@code objectClass}
-   *         attribute type, or {@code false} if not.
-   */
-  public boolean isObjectClass()
-  {
-    return isObjectClassType;
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return {@code true} if this schema definition is declared "obsolete", or
-   *         {@code false} if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
-
-
-
-  /**
-   * Indicates whether this is an operational attribute. An operational
-   * attribute is one with a usage of "directoryOperation",
-   * "distributedOperation", or "dSAOperation" (i.e., only userApplications is
-   * not operational).
-   *
-   * @return {@code true} if this is an operational attribute, or {@code false}
-   *         if not.
-   */
-  public boolean isOperational()
-  {
-    return attributeUsage.isOperational();
-  }
-
-
-
-  /**
-   * Indicates whether this attribute type is declared "single-value".
-   *
-   * @return {@code true} if this attribute type is declared "single-value", or
-   *         {@code false} if not.
-   */
-  public boolean isSingleValue()
-  {
-    return isSingleValue;
-  }
-
-
-
-  /**
-   * Indicates whether or not this attribute type is a sub-type of the provided
-   * attribute type.
-   *
-   * @param type
-   *          The attribute type for which to make the determination.
-   * @return {@code true} if this attribute type is a sub-type of the provided
-   *         attribute type, or {@code false} if not.
-   * @throws NullPointerException
-   *           If {@code type} was {@code null}.
-   */
-  public boolean isSubTypeOf(final AttributeType type)
-  {
-    AttributeType tmp = this;
-    do
-    {
-      if (tmp.equals(type))
-      {
-        return true;
-      }
-      tmp = tmp.getSuperiorType();
-    }
-    while (tmp != null);
-    return false;
-  }
-
-
-
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
-
-
-
-  AttributeType duplicate()
-  {
-    return new AttributeType(oid, names, description, isObsolete,
-        superiorTypeOID, equalityMatchingRuleOID, orderingMatchingRuleOID,
-        substringMatchingRuleOID, approximateMatchingRuleOID, syntaxOID,
-        isSingleValue, isCollective, isNoUserModification, attributeUsage,
-        extraProperties, definition);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
+        this.isObjectClassType = oid.equals("2.5.4.0");
+        this.normalizedName = StaticUtils.toLowerCase(getNameOrOID());
     }
 
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
+    AttributeType(final String oid, final List<String> names, final String description,
+            final MatchingRule equalityMatchingRule, final Syntax syntax) {
+        super(description, Collections.<String, List<String>> emptyMap());
+
+        Validator.ensureNotNull(oid, names, description);
+
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = false;
+        this.superiorTypeOID = null;
+        this.superiorType = null;
+        this.equalityMatchingRuleOID = equalityMatchingRule.getOID();
+        this.equalityMatchingRule = equalityMatchingRule;
+        this.orderingMatchingRuleOID = null;
+        this.substringMatchingRuleOID = null;
+        this.approximateMatchingRuleOID = null;
+        this.syntaxOID = syntax.getOID();
+        this.syntax = syntax;
+        this.isSingleValue = false;
+        this.isCollective = false;
+        this.isNoUserModification = false;
+        this.attributeUsage = AttributeUsage.USER_APPLICATIONS;
+        this.definition = buildDefinition();
+
+        this.isObjectClassType = oid.equals("2.5.4.0");
+        this.normalizedName = StaticUtils.toLowerCase(getNameOrOID());
     }
 
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
+    /**
+     * Compares this attribute type to the provided attribute type. The
+     * sort-order is defined as follows:
+     * <ul>
+     * <li>The {@code objectClass} attribute is less than all other attribute
+     * types.
+     * <li>User attributes are less than operational attributes.
+     * <li>Lexicographic comparison of the primary name or OID.
+     * </ul>
+     *
+     * @param type
+     *            The attribute type to be compared.
+     * @return A negative integer, zero, or a positive integer as this attribute
+     *         type is less than, equal to, or greater than the specified
+     *         attribute type.
+     * @throws NullPointerException
+     *             If {@code name} was {@code null}.
+     */
+    public int compareTo(final AttributeType type) {
+        if (isObjectClassType) {
+            return type.isObjectClassType ? 0 : -1;
+        } else if (type.isObjectClassType) {
+            return 1;
+        } else {
+            final boolean isOperational = getUsage().isOperational();
+            final boolean typeIsOperational = type.getUsage().isOperational();
 
-    if (superiorTypeOID != null)
-    {
-      buffer.append(" SUP ");
-      buffer.append(superiorTypeOID);
-    }
-
-    if (equalityMatchingRuleOID != null)
-    {
-      buffer.append(" EQUALITY ");
-      buffer.append(equalityMatchingRuleOID);
-    }
-
-    if (orderingMatchingRuleOID != null)
-    {
-      buffer.append(" ORDERING ");
-      buffer.append(orderingMatchingRuleOID);
-    }
-
-    if (substringMatchingRuleOID != null)
-    {
-      buffer.append(" SUBSTR ");
-      buffer.append(substringMatchingRuleOID);
-    }
-
-    if (syntaxOID != null)
-    {
-      buffer.append(" SYNTAX ");
-      buffer.append(syntaxOID);
-    }
-
-    if (isSingleValue())
-    {
-      buffer.append(" SINGLE-VALUE");
-    }
-
-    if (isCollective())
-    {
-      buffer.append(" COLLECTIVE");
-    }
-
-    if (isNoUserModification())
-    {
-      buffer.append(" NO-USER-MODIFICATION");
-    }
-
-    if (attributeUsage != null)
-    {
-      buffer.append(" USAGE ");
-      buffer.append(attributeUsage.toString());
-    }
-
-    if (approximateMatchingRuleOID != null)
-    {
-      buffer.append(" ");
-      buffer.append(SCHEMA_PROPERTY_APPROX_RULE);
-      buffer.append(" '");
-      buffer.append(approximateMatchingRuleOID);
-      buffer.append("'");
-    }
-  }
-
-
-
-  boolean validate(final Schema schema,
-      final List<AttributeType> invalidSchemaElements,
-      final List<LocalizableMessage> warnings)
-  {
-    // Avoid validating this schema element more than once. This may occur if
-    // multiple attributes specify the same superior.
-    if (!needsValidating)
-    {
-      return isValid;
-    }
-
-    // Prevent re-validation.
-    needsValidating = false;
-
-    if (superiorTypeOID != null)
-    {
-      try
-      {
-        superiorType = schema.getAttributeType(superiorTypeOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUPERIOR_TYPE1
-            .get(getNameOrOID(), superiorTypeOID);
-        failValidation(invalidSchemaElements, warnings, message);
-        return false;
-      }
-
-      // First ensure that the superior has been validated and fail if it is
-      // invalid.
-      if (!superiorType.validate(schema, invalidSchemaElements, warnings))
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_SUPERIOR_TYPE
-            .get(getNameOrOID(), superiorTypeOID);
-        failValidation(invalidSchemaElements, warnings, message);
-        return false;
-      }
-
-      // If there is a superior type, then it must have the same usage
-      // as the subordinate type. Also, if the superior type is
-      // collective, then so must the subordinate type be collective.
-      if (superiorType.getUsage() != getUsage())
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_SUPERIOR_USAGE
-            .get(getNameOrOID(), getUsage().toString(), superiorType
-                .getNameOrOID());
-        failValidation(invalidSchemaElements, warnings, message);
-        return false;
-      }
-
-      if (superiorType.isCollective() != isCollective())
-      {
-        if (!isCollective())
-        {
-          LocalizableMessage message =
-            WARN_ATTR_SYNTAX_ATTRTYPE_NONCOLLECTIVE_FROM_COLLECTIVE
-              .get(getNameOrOID(), superiorType.getNameOrOID());
-          failValidation(invalidSchemaElements, warnings, message);
-          return false;
+            if (isOperational == typeIsOperational) {
+                return normalizedName.compareTo(type.normalizedName);
+            } else {
+                return isOperational ? 1 : -1;
+            }
         }
-      }
     }
 
-    if (syntaxOID != null)
-    {
-      if (!schema.hasSyntax(syntaxOID))
-      {
-        // Try substituting a syntax from the core schema. This will
-        // never fail since the core schema is non-strict and will
-        // substitute the syntax if required.
-        syntax = Schema.getCoreSchema().getSyntax(syntaxOID);
-        final LocalizableMessage message = WARN_ATTR_TYPE_NOT_DEFINED1.get(
-            getNameOrOID(), syntaxOID, syntax.getOID());
-        warnings.add(message);
-      }
-      else
-      {
-        syntax = schema.getSyntax(syntaxOID);
-      }
-    }
-    else if (getSuperiorType() != null && getSuperiorType().getSyntax() != null)
-    {
-      // Try to inherit the syntax from the superior type if possible
-      syntax = getSuperiorType().getSyntax();
-    }
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
+        }
 
-    if (equalityMatchingRuleOID != null)
-    {
-      // Use explicitly defined matching rule first.
-      try
-      {
-        equalityMatchingRule = schema.getMatchingRule(equalityMatchingRuleOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_EQUALITY_MR1
-            .get(getNameOrOID(), equalityMatchingRuleOID);
-        failValidation(invalidSchemaElements, warnings, message);
+        if (o instanceof AttributeType) {
+            final AttributeType other = (AttributeType) o;
+            return oid.equals(other.oid);
+        }
+
         return false;
-      }
-    }
-    else if (getSuperiorType() != null
-        && getSuperiorType().getEqualityMatchingRule() != null)
-    {
-      // Inherit matching rule from superior type if possible
-      equalityMatchingRule = getSuperiorType().getEqualityMatchingRule();
-    }
-    else if (getSyntax() != null
-        && getSyntax().getEqualityMatchingRule() != null)
-    {
-      // Use default for syntax
-      equalityMatchingRule = getSyntax().getEqualityMatchingRule();
     }
 
-    if (orderingMatchingRuleOID != null)
-    {
-      // Use explicitly defined matching rule first.
-      try
-      {
-        orderingMatchingRule = schema.getMatchingRule(orderingMatchingRuleOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_ORDERING_MR1
-            .get(getNameOrOID(), orderingMatchingRuleOID);
-        failValidation(invalidSchemaElements, warnings, message);
+    /**
+     * Returns the matching rule that should be used for approximate matching
+     * with this attribute type.
+     *
+     * @return The matching rule that should be used for approximate matching
+     *         with this attribute type.
+     */
+    public MatchingRule getApproximateMatchingRule() {
+        return approximateMatchingRule;
+    }
+
+    /**
+     * Returns the matching rule that should be used for equality matching with
+     * this attribute type.
+     *
+     * @return The matching rule that should be used for equality matching with
+     *         this attribute type.
+     */
+    public MatchingRule getEqualityMatchingRule() {
+        return equalityMatchingRule;
+    }
+
+    /**
+     * Returns the name or OID for this schema definition. If it has one or more
+     * names, then the primary name will be returned. If it does not have any
+     * names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return oid;
+        }
+        return names.get(0);
+    }
+
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
+    }
+
+    /**
+     * Returns the OID for this schema definition.
+     *
+     * @return The OID for this schema definition.
+     */
+    public String getOID() {
+
+        return oid;
+    }
+
+    /**
+     * Returns the matching rule that should be used for ordering with this
+     * attribute type.
+     *
+     * @return The matching rule that should be used for ordering with this
+     *         attribute type.
+     */
+    public MatchingRule getOrderingMatchingRule() {
+        return orderingMatchingRule;
+    }
+
+    /**
+     * Returns the matching rule that should be used for substring matching with
+     * this attribute type.
+     *
+     * @return The matching rule that should be used for substring matching with
+     *         this attribute type.
+     */
+    public MatchingRule getSubstringMatchingRule() {
+        return substringMatchingRule;
+    }
+
+    /**
+     * Returns the superior type for this attribute type.
+     *
+     * @return The superior type for this attribute type, or <CODE>null</CODE>
+     *         if it does not have one.
+     */
+    public AttributeType getSuperiorType() {
+        return superiorType;
+    }
+
+    /**
+     * Returns the syntax for this attribute type.
+     *
+     * @return The syntax for this attribute type.
+     */
+    public Syntax getSyntax() {
+        return syntax;
+    }
+
+    /**
+     * Returns the usage indicator for this attribute type.
+     *
+     * @return The usage indicator for this attribute type.
+     */
+    public AttributeUsage getUsage() {
+        return attributeUsage;
+    }
+
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
+
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return {@code true} if the specified name is assigned to this schema
+     *         definition, or {@code false} if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
         return false;
-      }
-    }
-    else if (getSuperiorType() != null
-        && getSuperiorType().getOrderingMatchingRule() != null)
-    {
-      // Inherit matching rule from superior type if possible
-      orderingMatchingRule = getSuperiorType().getOrderingMatchingRule();
-    }
-    else if (getSyntax() != null
-        && getSyntax().getOrderingMatchingRule() != null)
-    {
-      // Use default for syntax
-      orderingMatchingRule = getSyntax().getOrderingMatchingRule();
     }
 
-    if (substringMatchingRuleOID != null)
-    {
-      // Use explicitly defined matching rule first.
-      try
-      {
-        substringMatchingRule = schema
-            .getMatchingRule(substringMatchingRuleOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUBSTRING_MR1
-            .get(getNameOrOID(), substringMatchingRuleOID);
-        failValidation(invalidSchemaElements, warnings, message);
+    /**
+     * Indicates whether this schema definition has the specified name or OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return {@code true} if the provided value matches the OID or one of the
+     *         names assigned to this schema definition, or {@code false} if
+     *         not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || getOID().equals(value);
+    }
+
+    /**
+     * Indicates whether this attribute type is declared "collective".
+     *
+     * @return {@code true} if this attribute type is declared "collective", or
+     *         {@code false} if not.
+     */
+    public boolean isCollective() {
+        return isCollective;
+    }
+
+    /**
+     * Indicates whether this attribute type is declared "no-user-modification".
+     *
+     * @return {@code true} if this attribute type is declared
+     *         "no-user-modification", or {@code false} if not.
+     */
+    public boolean isNoUserModification() {
+        return isNoUserModification;
+    }
+
+    /**
+     * Indicates whether or not this attribute type is the {@code objectClass}
+     * attribute type having the OID 2.5.4.0.
+     *
+     * @return {@code true} if this attribute type is the {@code objectClass}
+     *         attribute type, or {@code false} if not.
+     */
+    public boolean isObjectClass() {
+        return isObjectClassType;
+    }
+
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return {@code true} if this schema definition is declared "obsolete", or
+     *         {@code false} if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
+
+    /**
+     * Indicates whether this is an operational attribute. An operational
+     * attribute is one with a usage of "directoryOperation",
+     * "distributedOperation", or "dSAOperation" (i.e., only userApplications is
+     * not operational).
+     *
+     * @return {@code true} if this is an operational attribute, or
+     *         {@code false} if not.
+     */
+    public boolean isOperational() {
+        return attributeUsage.isOperational();
+    }
+
+    /**
+     * Indicates whether this attribute type is declared "single-value".
+     *
+     * @return {@code true} if this attribute type is declared "single-value",
+     *         or {@code false} if not.
+     */
+    public boolean isSingleValue() {
+        return isSingleValue;
+    }
+
+    /**
+     * Indicates whether or not this attribute type is a sub-type of the
+     * provided attribute type.
+     *
+     * @param type
+     *            The attribute type for which to make the determination.
+     * @return {@code true} if this attribute type is a sub-type of the provided
+     *         attribute type, or {@code false} if not.
+     * @throws NullPointerException
+     *             If {@code type} was {@code null}.
+     */
+    public boolean isSubTypeOf(final AttributeType type) {
+        AttributeType tmp = this;
+        do {
+            if (tmp.equals(type)) {
+                return true;
+            }
+            tmp = tmp.getSuperiorType();
+        } while (tmp != null);
         return false;
-      }
-    }
-    else if (getSuperiorType() != null
-        && getSuperiorType().getSubstringMatchingRule() != null)
-    {
-      // Inherit matching rule from superior type if possible
-      substringMatchingRule = getSuperiorType().getSubstringMatchingRule();
-    }
-    else if (getSyntax() != null
-        && getSyntax().getSubstringMatchingRule() != null)
-    {
-      // Use default for syntax
-      substringMatchingRule = getSyntax().getSubstringMatchingRule();
     }
 
-    if (approximateMatchingRuleOID != null)
-    {
-      // Use explicitly defined matching rule first.
-      try
-      {
-        approximateMatchingRule = schema
-            .getMatchingRule(approximateMatchingRuleOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_APPROXIMATE_MR1
-            .get(getNameOrOID(), approximateMatchingRuleOID);
-        failValidation(invalidSchemaElements, warnings, message);
-        return false;
-      }
-    }
-    else if (getSuperiorType() != null
-        && getSuperiorType().getApproximateMatchingRule() != null)
-    {
-      // Inherit matching rule from superior type if possible
-      approximateMatchingRule = getSuperiorType().getApproximateMatchingRule();
-    }
-    else if (getSyntax() != null
-        && getSyntax().getApproximateMatchingRule() != null)
-    {
-      // Use default for syntax
-      approximateMatchingRule = getSyntax().getApproximateMatchingRule();
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
     }
 
-    // If the attribute type is COLLECTIVE, then it must have a usage of
-    // userApplications.
-    if (isCollective() && getUsage() != AttributeUsage.USER_APPLICATIONS)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_COLLECTIVE_IS_OPERATIONAL
-          .get(getNameOrOID());
-      warnings.add(message);
+    AttributeType duplicate() {
+        return new AttributeType(oid, names, description, isObsolete, superiorTypeOID,
+                equalityMatchingRuleOID, orderingMatchingRuleOID, substringMatchingRuleOID,
+                approximateMatchingRuleOID, syntaxOID, isSingleValue, isCollective,
+                isNoUserModification, attributeUsage, extraProperties, definition);
     }
 
-    // If the attribute type is NO-USER-MODIFICATION, then it must not
-    // have a usage of userApplications.
-    if (isNoUserModification()
-        && getUsage() == AttributeUsage.USER_APPLICATIONS)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_NO_USER_MOD_NOT_OPERATIONAL
-          .get(getNameOrOID());
-      warnings.add(message);
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
+
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
+        }
+
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
+        }
+
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
+        }
+
+        if (superiorTypeOID != null) {
+            buffer.append(" SUP ");
+            buffer.append(superiorTypeOID);
+        }
+
+        if (equalityMatchingRuleOID != null) {
+            buffer.append(" EQUALITY ");
+            buffer.append(equalityMatchingRuleOID);
+        }
+
+        if (orderingMatchingRuleOID != null) {
+            buffer.append(" ORDERING ");
+            buffer.append(orderingMatchingRuleOID);
+        }
+
+        if (substringMatchingRuleOID != null) {
+            buffer.append(" SUBSTR ");
+            buffer.append(substringMatchingRuleOID);
+        }
+
+        if (syntaxOID != null) {
+            buffer.append(" SYNTAX ");
+            buffer.append(syntaxOID);
+        }
+
+        if (isSingleValue()) {
+            buffer.append(" SINGLE-VALUE");
+        }
+
+        if (isCollective()) {
+            buffer.append(" COLLECTIVE");
+        }
+
+        if (isNoUserModification()) {
+            buffer.append(" NO-USER-MODIFICATION");
+        }
+
+        if (attributeUsage != null) {
+            buffer.append(" USAGE ");
+            buffer.append(attributeUsage.toString());
+        }
+
+        if (approximateMatchingRuleOID != null) {
+            buffer.append(" ");
+            buffer.append(SCHEMA_PROPERTY_APPROX_RULE);
+            buffer.append(" '");
+            buffer.append(approximateMatchingRuleOID);
+            buffer.append("'");
+        }
     }
 
-    return (isValid = true);
-  }
+    boolean validate(final Schema schema, final List<AttributeType> invalidSchemaElements,
+            final List<LocalizableMessage> warnings) {
+        // Avoid validating this schema element more than once. This may occur
+        // if
+        // multiple attributes specify the same superior.
+        if (!needsValidating) {
+            return isValid;
+        }
 
+        // Prevent re-validation.
+        needsValidating = false;
 
+        if (superiorTypeOID != null) {
+            try {
+                superiorType = schema.getAttributeType(superiorTypeOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUPERIOR_TYPE1.get(getNameOrOID(),
+                                superiorTypeOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
 
-  private void failValidation(final List<AttributeType> invalidSchemaElements,
-      final List<LocalizableMessage> warnings, final LocalizableMessage message)
-  {
-    invalidSchemaElements.add(this);
-    warnings.add(ERR_ATTR_TYPE_VALIDATION_FAIL.get(toString(), message));
-  }
+            // First ensure that the superior has been validated and fail if it
+            // is
+            // invalid.
+            if (!superiorType.validate(schema, invalidSchemaElements, warnings)) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_SUPERIOR_TYPE.get(getNameOrOID(),
+                                superiorTypeOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+
+            // If there is a superior type, then it must have the same usage
+            // as the subordinate type. Also, if the superior type is
+            // collective, then so must the subordinate type be collective.
+            if (superiorType.getUsage() != getUsage()) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_SUPERIOR_USAGE.get(getNameOrOID(),
+                                getUsage().toString(), superiorType.getNameOrOID());
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+
+            if (superiorType.isCollective() != isCollective()) {
+                if (!isCollective()) {
+                    LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_ATTRTYPE_NONCOLLECTIVE_FROM_COLLECTIVE.get(
+                                    getNameOrOID(), superiorType.getNameOrOID());
+                    failValidation(invalidSchemaElements, warnings, message);
+                    return false;
+                }
+            }
+        }
+
+        if (syntaxOID != null) {
+            if (!schema.hasSyntax(syntaxOID)) {
+                // Try substituting a syntax from the core schema. This will
+                // never fail since the core schema is non-strict and will
+                // substitute the syntax if required.
+                syntax = Schema.getCoreSchema().getSyntax(syntaxOID);
+                final LocalizableMessage message =
+                        WARN_ATTR_TYPE_NOT_DEFINED1.get(getNameOrOID(), syntaxOID, syntax.getOID());
+                warnings.add(message);
+            } else {
+                syntax = schema.getSyntax(syntaxOID);
+            }
+        } else if (getSuperiorType() != null && getSuperiorType().getSyntax() != null) {
+            // Try to inherit the syntax from the superior type if possible
+            syntax = getSuperiorType().getSyntax();
+        }
+
+        if (equalityMatchingRuleOID != null) {
+            // Use explicitly defined matching rule first.
+            try {
+                equalityMatchingRule = schema.getMatchingRule(equalityMatchingRuleOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_EQUALITY_MR1.get(getNameOrOID(),
+                                equalityMatchingRuleOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+        } else if (getSuperiorType() != null && getSuperiorType().getEqualityMatchingRule() != null) {
+            // Inherit matching rule from superior type if possible
+            equalityMatchingRule = getSuperiorType().getEqualityMatchingRule();
+        } else if (getSyntax() != null && getSyntax().getEqualityMatchingRule() != null) {
+            // Use default for syntax
+            equalityMatchingRule = getSyntax().getEqualityMatchingRule();
+        }
+
+        if (orderingMatchingRuleOID != null) {
+            // Use explicitly defined matching rule first.
+            try {
+                orderingMatchingRule = schema.getMatchingRule(orderingMatchingRuleOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_ORDERING_MR1.get(getNameOrOID(),
+                                orderingMatchingRuleOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+        } else if (getSuperiorType() != null && getSuperiorType().getOrderingMatchingRule() != null) {
+            // Inherit matching rule from superior type if possible
+            orderingMatchingRule = getSuperiorType().getOrderingMatchingRule();
+        } else if (getSyntax() != null && getSyntax().getOrderingMatchingRule() != null) {
+            // Use default for syntax
+            orderingMatchingRule = getSyntax().getOrderingMatchingRule();
+        }
+
+        if (substringMatchingRuleOID != null) {
+            // Use explicitly defined matching rule first.
+            try {
+                substringMatchingRule = schema.getMatchingRule(substringMatchingRuleOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUBSTRING_MR1.get(getNameOrOID(),
+                                substringMatchingRuleOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+        } else if (getSuperiorType() != null
+                && getSuperiorType().getSubstringMatchingRule() != null) {
+            // Inherit matching rule from superior type if possible
+            substringMatchingRule = getSuperiorType().getSubstringMatchingRule();
+        } else if (getSyntax() != null && getSyntax().getSubstringMatchingRule() != null) {
+            // Use default for syntax
+            substringMatchingRule = getSyntax().getSubstringMatchingRule();
+        }
+
+        if (approximateMatchingRuleOID != null) {
+            // Use explicitly defined matching rule first.
+            try {
+                approximateMatchingRule = schema.getMatchingRule(approximateMatchingRuleOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_APPROXIMATE_MR1.get(getNameOrOID(),
+                                approximateMatchingRuleOID);
+                failValidation(invalidSchemaElements, warnings, message);
+                return false;
+            }
+        } else if (getSuperiorType() != null
+                && getSuperiorType().getApproximateMatchingRule() != null) {
+            // Inherit matching rule from superior type if possible
+            approximateMatchingRule = getSuperiorType().getApproximateMatchingRule();
+        } else if (getSyntax() != null && getSyntax().getApproximateMatchingRule() != null) {
+            // Use default for syntax
+            approximateMatchingRule = getSyntax().getApproximateMatchingRule();
+        }
+
+        // If the attribute type is COLLECTIVE, then it must have a usage of
+        // userApplications.
+        if (isCollective() && getUsage() != AttributeUsage.USER_APPLICATIONS) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_ATTRTYPE_COLLECTIVE_IS_OPERATIONAL.get(getNameOrOID());
+            warnings.add(message);
+        }
+
+        // If the attribute type is NO-USER-MODIFICATION, then it must not
+        // have a usage of userApplications.
+        if (isNoUserModification() && getUsage() == AttributeUsage.USER_APPLICATIONS) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_ATTRTYPE_NO_USER_MOD_NOT_OPERATIONAL.get(getNameOrOID());
+            warnings.add(message);
+        }
+
+        return (isValid = true);
+    }
+
+    private void failValidation(final List<AttributeType> invalidSchemaElements,
+            final List<LocalizableMessage> warnings, final LocalizableMessage message) {
+        invalidSchemaElements.add(this);
+        warnings.add(ERR_ATTR_TYPE_VALIDATION_FAIL.get(toString(), message));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java
index 222f13f..fd11730 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,9 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_ATTRIBUTE_TYPE_NAME;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -41,241 +39,190 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class defines the attribute type description syntax, which is used to
  * hold attribute type definitions in the server schema. The format of this
  * syntax is defined in RFC 2252.
  */
-final class AttributeTypeSyntaxImpl extends AbstractSyntaxImpl
-{
+final class AttributeTypeSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_ATTRIBUTE_TYPE_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the definition was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the definition. But before we start, set default
-      // values for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          // This specifies the name or OID of the superior attribute
-          // type from which this attribute type should inherit its
-          // properties.
-          SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("equality"))
-        {
-          // This specifies the name or OID of the equality matching
-          // rule to use for this attribute type.
-          SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("ordering"))
-        {
-          // This specifies the name or OID of the ordering matching
-          // rule to use for this attribute type.
-          SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("substr"))
-        {
-          // This specifies the name or OID of the substring matching
-          // rule to use for this attribute type.
-          SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("syntax"))
-        {
-          // This specifies the numeric OID of the syntax for this
-          // matching rule. It may optionally be immediately followed by
-          // an open curly brace, an integer definition, and a close
-          // curly brace to suggest the minimum number of characters
-          // that should be allowed in values of that type. This
-          // implementation will ignore any such length because it does
-          // not impose any practical limit on the length of attribute
-          // values.
-          SchemaUtils.readOIDLen(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("single-definition"))
-        {
-          // This indicates that attributes of this type are allowed to
-          // have at most one definition. We do not need any more
-          // parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("single-value"))
-        {
-          // This indicates that attributes of this type are allowed to
-          // have at most one value. We do not need any more parsing for
-          // this token.
-        }
-        else if (tokenName.equalsIgnoreCase("collective"))
-        {
-          // This indicates that attributes of this type are collective
-          // (i.e., have their values generated dynamically in some
-          // way). We do not need any more parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("no-user-modification"))
-        {
-          // This indicates that the values of attributes of this type
-          // are not to be modified by end users. We do not need any
-          // more parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("usage"))
-        {
-          // This specifies the usage string for this attribute type. It
-          // should be followed by one of the strings
-          // "userApplications", "directoryOperation",
-          // "distributedOperation", or "dSAOperation".
-          int length = 0;
-
-          reader.skipWhitespaces();
-          reader.mark();
-
-          while (reader.read() != ' ')
-          {
-            length++;
-          }
-
-          reader.reset();
-          final String usageStr = reader.read(length);
-          if (!usageStr.equalsIgnoreCase("userapplications")
-              && !usageStr.equalsIgnoreCase("directoryoperation")
-              && !usageStr.equalsIgnoreCase("distributedoperation")
-              && !usageStr.equalsIgnoreCase("dsaoperation"))
-          {
-            final LocalizableMessage message =
-              WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1
-                .get(definition, usageStr);
-            final DecodeException e = DecodeException.error(message);
-            StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax",
-                "valueIsAcceptable", e);
-            throw e;
-          }
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_ATTRTYPE_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_ATTRIBUTE_TYPE_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the definition was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the definition. But before we start, set default
+            // values for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    // This specifies the name or OID of the superior attribute
+                    // type from which this attribute type should inherit its
+                    // properties.
+                    SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("equality")) {
+                    // This specifies the name or OID of the equality matching
+                    // rule to use for this attribute type.
+                    SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("ordering")) {
+                    // This specifies the name or OID of the ordering matching
+                    // rule to use for this attribute type.
+                    SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("substr")) {
+                    // This specifies the name or OID of the substring matching
+                    // rule to use for this attribute type.
+                    SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("syntax")) {
+                    // This specifies the numeric OID of the syntax for this
+                    // matching rule. It may optionally be immediately followed
+                    // by
+                    // an open curly brace, an integer definition, and a close
+                    // curly brace to suggest the minimum number of characters
+                    // that should be allowed in values of that type. This
+                    // implementation will ignore any such length because it
+                    // does
+                    // not impose any practical limit on the length of attribute
+                    // values.
+                    SchemaUtils.readOIDLen(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("single-definition")) {
+                    // This indicates that attributes of this type are allowed
+                    // to
+                    // have at most one definition. We do not need any more
+                    // parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("single-value")) {
+                    // This indicates that attributes of this type are allowed
+                    // to
+                    // have at most one value. We do not need any more parsing
+                    // for
+                    // this token.
+                } else if (tokenName.equalsIgnoreCase("collective")) {
+                    // This indicates that attributes of this type are
+                    // collective
+                    // (i.e., have their values generated dynamically in some
+                    // way). We do not need any more parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("no-user-modification")) {
+                    // This indicates that the values of attributes of this type
+                    // are not to be modified by end users. We do not need any
+                    // more parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("usage")) {
+                    // This specifies the usage string for this attribute type.
+                    // It
+                    // should be followed by one of the strings
+                    // "userApplications", "directoryOperation",
+                    // "distributedOperation", or "dSAOperation".
+                    int length = 0;
+
+                    reader.skipWhitespaces();
+                    reader.mark();
+
+                    while (reader.read() != ' ') {
+                        length++;
+                    }
+
+                    reader.reset();
+                    final String usageStr = reader.read(length);
+                    if (!usageStr.equalsIgnoreCase("userapplications")
+                            && !usageStr.equalsIgnoreCase("directoryoperation")
+                            && !usageStr.equalsIgnoreCase("distributedoperation")
+                            && !usageStr.equalsIgnoreCase("dsaoperation")) {
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1.get(definition,
+                                        usageStr);
+                        final DecodeException e = DecodeException.error(message);
+                        StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable",
+                                e);
+                        throw e;
+                    }
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("AttributeTypeSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_ATTRTYPE_INVALID1.get(definition, de
+                    .getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java
index 61b0f94..d5a1a6d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,84 +26,72 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 /**
  * This enumeration defines the set of possible attribute usage values that may
  * apply to an attribute type, as defined in RFC 2252.
  */
-public enum AttributeUsage
-{
-  /**
-   * The attribute usage intended for user-defined attribute types.
-   */
-  USER_APPLICATIONS("userApplications", false),
+public enum AttributeUsage {
+    /**
+     * The attribute usage intended for user-defined attribute types.
+     */
+    USER_APPLICATIONS("userApplications", false),
 
-  /**
-   * The attribute usage intended for standard operational attributes.
-   */
-  DIRECTORY_OPERATION("directoryOperation", true),
+    /**
+     * The attribute usage intended for standard operational attributes.
+     */
+    DIRECTORY_OPERATION("directoryOperation", true),
 
-  /**
-   * The attribute usage intended for non-standard operational attributes shared
-   * among multiple DSAs.
-   */
-  DISTRIBUTED_OPERATION("distributedOperation", true),
+    /**
+     * The attribute usage intended for non-standard operational attributes
+     * shared among multiple DSAs.
+     */
+    DISTRIBUTED_OPERATION("distributedOperation", true),
 
-  /**
-   * The attribute usage intended for non-standard operational attributes used
-   * by a single DSA.
-   */
-  DSA_OPERATION("dSAOperation", true);
+    /**
+     * The attribute usage intended for non-standard operational attributes used
+     * by a single DSA.
+     */
+    DSA_OPERATION("dSAOperation", true);
 
-  // The string representation of this attribute usage.
-  private final String usageString;
+    // The string representation of this attribute usage.
+    private final String usageString;
 
-  // Flag indicating whether or not the usage should be categorized as
-  // operational.
-  private final boolean isOperational;
+    // Flag indicating whether or not the usage should be categorized as
+    // operational.
+    private final boolean isOperational;
 
+    /**
+     * Creates a new attribute usage with the provided string representation.
+     *
+     * @param usageString
+     *            The string representation of this attribute usage.
+     * @param isOperational
+     *            <code>true</code> if attributes having this attribute usage
+     *            are operational, or <code>false</code> otherwise.
+     */
+    private AttributeUsage(final String usageString, final boolean isOperational) {
+        this.usageString = usageString;
+        this.isOperational = isOperational;
+    }
 
+    /**
+     * Determine whether or not attributes having this attribute usage are
+     * operational.
+     *
+     * @return Returns <code>true</code> if attributes having this attribute
+     *         usage are operational, or <code>false</code> otherwise.
+     */
+    public boolean isOperational() {
+        return isOperational;
+    }
 
-  /**
-   * Creates a new attribute usage with the provided string representation.
-   *
-   * @param usageString
-   *          The string representation of this attribute usage.
-   * @param isOperational
-   *          <code>true</code> if attributes having this attribute usage are
-   *          operational, or <code>false</code> otherwise.
-   */
-  private AttributeUsage(final String usageString, final boolean isOperational)
-  {
-    this.usageString = usageString;
-    this.isOperational = isOperational;
-  }
-
-
-
-  /**
-   * Determine whether or not attributes having this attribute usage are
-   * operational.
-   *
-   * @return Returns <code>true</code> if attributes having this attribute usage
-   *         are operational, or <code>false</code> otherwise.
-   */
-  public boolean isOperational()
-  {
-    return isOperational;
-  }
-
-
-
-  /**
-   * Retrieves a string representation of this attribute usage.
-   *
-   * @return A string representation of this attribute usage.
-   */
-  @Override
-  public String toString()
-  {
-    return usageString;
-  }
+    /**
+     * Retrieves a string representation of this attribute usage.
+     *
+     * @return A string representation of this attribute usage.
+     */
+    @Override
+    public String toString() {
+        return usageString;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java
index 9aab32f..9fb591a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,36 +25,29 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements the authPasswordMatch matching rule defined in RFC
  * 3112.
  */
-final class AuthPasswordExactEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final StringBuilder[] authPWComponents = AuthPasswordSyntaxImpl
-        .decodeAuthPassword(value.toString());
+final class AuthPasswordExactEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final StringBuilder[] authPWComponents =
+                AuthPasswordSyntaxImpl.decodeAuthPassword(value.toString());
 
-    final StringBuilder normalizedValue = new StringBuilder(2
-        + authPWComponents[0].length() + authPWComponents[1].length()
-        + authPWComponents[2].length());
-    normalizedValue.append(authPWComponents[0]);
-    normalizedValue.append('$');
-    normalizedValue.append(authPWComponents[1]);
-    normalizedValue.append('$');
-    normalizedValue.append(authPWComponents[2]);
+        final StringBuilder normalizedValue =
+                new StringBuilder(2 + authPWComponents[0].length() + authPWComponents[1].length()
+                        + authPWComponents[2].length());
+        normalizedValue.append(authPWComponents[0]);
+        normalizedValue.append('$');
+        normalizedValue.append(authPWComponents[1]);
+        normalizedValue.append('$');
+        normalizedValue.append(authPWComponents[2]);
 
-    return ByteString.valueOf(normalizedValue.toString());
-  }
+        return ByteString.valueOf(normalizedValue.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java
index 8486ad2..6ff213d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_AUTH_PASSWORD_EXACT_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_AUTH_PASSWORD_NAME;
@@ -38,303 +35,245 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the auth password attribute syntax, which is defined in
  * RFC 3112 and is used to hold authentication information. Only equality
  * matching will be allowed by default.
  */
-final class AuthPasswordSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * Decodes the provided authentication password value into its component
-   * parts.
-   *
-   * @param authPasswordValue
-   *          The authentication password value to be decoded.
-   * @return A three-element array, containing the scheme, authInfo, and
-   *         authValue components of the given string, in that order.
-   * @throws DecodeException
-   *           If a problem is encountered while attempting to decode the value.
-   */
-  static StringBuilder[] decodeAuthPassword(final String authPasswordValue)
-      throws DecodeException
-  {
-    // Create placeholders for the values to return.
-    final StringBuilder scheme = new StringBuilder();
-    final StringBuilder authInfo = new StringBuilder();
-    final StringBuilder authValue = new StringBuilder();
+final class AuthPasswordSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * Decodes the provided authentication password value into its component
+     * parts.
+     *
+     * @param authPasswordValue
+     *            The authentication password value to be decoded.
+     * @return A three-element array, containing the scheme, authInfo, and
+     *         authValue components of the given string, in that order.
+     * @throws DecodeException
+     *             If a problem is encountered while attempting to decode the
+     *             value.
+     */
+    static StringBuilder[] decodeAuthPassword(final String authPasswordValue)
+            throws DecodeException {
+        // Create placeholders for the values to return.
+        final StringBuilder scheme = new StringBuilder();
+        final StringBuilder authInfo = new StringBuilder();
+        final StringBuilder authValue = new StringBuilder();
 
-    // First, ignore any leading whitespace.
-    final int length = authPasswordValue.length();
-    int pos = 0;
-    while (pos < length && authPasswordValue.charAt(pos) == ' ')
-    {
-      pos++;
+        // First, ignore any leading whitespace.
+        final int length = authPasswordValue.length();
+        int pos = 0;
+        while (pos < length && authPasswordValue.charAt(pos) == ' ') {
+            pos++;
+        }
+
+        // The next set of characters will be the scheme, which must consist
+        // only of digits, uppercase alphabetic characters, dash, period,
+        // slash, and underscore characters. It must be immediately followed
+        // by one or more spaces or a dollar sign.
+    readScheme:
+        while (pos < length) {
+            final char c = authPasswordValue.charAt(pos);
+
+            switch (c) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+            case 'A':
+            case 'B':
+            case 'C':
+            case 'D':
+            case 'E':
+            case 'F':
+            case 'G':
+            case 'H':
+            case 'I':
+            case 'J':
+            case 'K':
+            case 'L':
+            case 'M':
+            case 'N':
+            case 'O':
+            case 'P':
+            case 'Q':
+            case 'R':
+            case 'S':
+            case 'T':
+            case 'U':
+            case 'V':
+            case 'W':
+            case 'X':
+            case 'Y':
+            case 'Z':
+            case '-':
+            case '.':
+            case '/':
+            case '_':
+                scheme.append(c);
+                pos++;
+                break;
+            case ' ':
+            case '$':
+                break readScheme;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_AUTHPW_INVALID_SCHEME_CHAR.get(pos);
+                throw DecodeException.error(message);
+            }
+        }
+
+        // The scheme must consist of at least one character.
+        if (scheme.length() == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_SCHEME.get();
+            throw DecodeException.error(message);
+        }
+
+        // Ignore any spaces before the dollar sign separator. Then read the
+        // dollar sign and ignore any trailing spaces.
+        while (pos < length && authPasswordValue.charAt(pos) == ' ') {
+            pos++;
+        }
+
+        if (pos < length && authPasswordValue.charAt(pos) == '$') {
+            pos++;
+        } else {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_SCHEME_SEPARATOR.get();
+            throw DecodeException.error(message);
+        }
+
+        while (pos < length && authPasswordValue.charAt(pos) == ' ') {
+            pos++;
+        }
+
+        // The next component must be the authInfo element, containing only
+        // printable characters other than the dollar sign and space
+        // character.
+    readAuthInfo:
+        while (pos < length) {
+            final char c = authPasswordValue.charAt(pos);
+            if (c == ' ' || c == '$') {
+                break readAuthInfo;
+            } else if (PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+                authInfo.append(c);
+                pos++;
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_AUTHPW_INVALID_AUTH_INFO_CHAR.get(pos);
+                throw DecodeException.error(message);
+            }
+        }
+
+        // The authInfo element must consist of at least one character.
+        if (scheme.length() == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_INFO.get();
+            throw DecodeException.error(message);
+        }
+
+        // Ignore any spaces before the dollar sign separator. Then read the
+        // dollar sign and ignore any trailing spaces.
+        while (pos < length && authPasswordValue.charAt(pos) == ' ') {
+            pos++;
+        }
+
+        if (pos < length && authPasswordValue.charAt(pos) == '$') {
+            pos++;
+        } else {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_INFO_SEPARATOR.get();
+            throw DecodeException.error(message);
+        }
+
+        while (pos < length && authPasswordValue.charAt(pos) == ' ') {
+            pos++;
+        }
+
+        // The final component must be the authValue element, containing
+        // only printable characters other than the dollar sign and space
+        // character.
+        while (pos < length) {
+            final char c = authPasswordValue.charAt(pos);
+            if (c == ' ' || c == '$') {
+                break;
+            } else if (PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+                authValue.append(c);
+                pos++;
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_AUTHPW_INVALID_AUTH_VALUE_CHAR.get(pos);
+                throw DecodeException.error(message);
+            }
+        }
+
+        // The authValue element must consist of at least one character.
+        if (scheme.length() == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_VALUE.get();
+            throw DecodeException.error(message);
+        }
+
+        // The only characters remaining must be whitespace.
+        while (pos < length) {
+            final char c = authPasswordValue.charAt(pos);
+            if (c == ' ') {
+                pos++;
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_AUTHPW_INVALID_TRAILING_CHAR.get(pos);
+                throw DecodeException.error(message);
+            }
+        }
+
+        // If we've gotten here, then everything must be OK.
+        return new StringBuilder[] { scheme, authInfo, authValue };
     }
 
-    // The next set of characters will be the scheme, which must consist
-    // only of digits, uppercase alphabetic characters, dash, period,
-    // slash, and underscore characters. It must be immediately followed
-    // by one or more spaces or a dollar sign.
-    readScheme: while (pos < length)
-    {
-      final char c = authPasswordValue.charAt(pos);
+    /**
+     * Indicates whether the provided value is encoded using the auth password
+     * syntax.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <CODE>true</CODE> if the value appears to be encoded using the
+     *         auth password syntax, or <CODE>false</CODE> if not.
+     */
+    static boolean isEncoded(final ByteSequence value) {
+        // FIXME -- Make this more efficient, and don't use exceptions for
+        // flow control.
 
-      switch (c)
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-      case 'A':
-      case 'B':
-      case 'C':
-      case 'D':
-      case 'E':
-      case 'F':
-      case 'G':
-      case 'H':
-      case 'I':
-      case 'J':
-      case 'K':
-      case 'L':
-      case 'M':
-      case 'N':
-      case 'O':
-      case 'P':
-      case 'Q':
-      case 'R':
-      case 'S':
-      case 'T':
-      case 'U':
-      case 'V':
-      case 'W':
-      case 'X':
-      case 'Y':
-      case 'Z':
-      case '-':
-      case '.':
-      case '/':
-      case '_':
-        scheme.append(c);
-        pos++;
-        break;
-      case ' ':
-      case '$':
-        break readScheme;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_INVALID_SCHEME_CHAR
-            .get(pos);
-        throw DecodeException.error(message);
-      }
+        try {
+            decodeAuthPassword(value.toString());
+            return true;
+        } catch (final Exception e) {
+            return false;
+        }
     }
 
-    // The scheme must consist of at least one character.
-    if (scheme.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_SCHEME.get();
-      throw DecodeException.error(message);
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_AUTH_PASSWORD_EXACT_OID;
     }
 
-    // Ignore any spaces before the dollar sign separator. Then read the
-    // dollar sign and ignore any trailing spaces.
-    while (pos < length && authPasswordValue.charAt(pos) == ' ')
-    {
-      pos++;
+    public String getName() {
+        return SYNTAX_AUTH_PASSWORD_NAME;
     }
 
-    if (pos < length && authPasswordValue.charAt(pos) == '$')
-    {
-      pos++;
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_SCHEME_SEPARATOR
-          .get();
-      throw DecodeException.error(message);
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    while (pos < length && authPasswordValue.charAt(pos) == ' ')
-    {
-      pos++;
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        try {
+            decodeAuthPassword(value.toString());
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
     }
-
-    // The next component must be the authInfo element, containing only
-    // printable characters other than the dollar sign and space
-    // character.
-    readAuthInfo: while (pos < length)
-    {
-      final char c = authPasswordValue.charAt(pos);
-      if (c == ' ' || c == '$')
-      {
-        break readAuthInfo;
-      }
-      else if (PrintableStringSyntaxImpl.isPrintableCharacter(c))
-      {
-        authInfo.append(c);
-        pos++;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_INVALID_AUTH_INFO_CHAR
-            .get(pos);
-        throw DecodeException.error(message);
-      }
-    }
-
-    // The authInfo element must consist of at least one character.
-    if (scheme.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_INFO
-          .get();
-      throw DecodeException.error(message);
-    }
-
-    // Ignore any spaces before the dollar sign separator. Then read the
-    // dollar sign and ignore any trailing spaces.
-    while (pos < length && authPasswordValue.charAt(pos) == ' ')
-    {
-      pos++;
-    }
-
-    if (pos < length && authPasswordValue.charAt(pos) == '$')
-    {
-      pos++;
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_INFO_SEPARATOR
-          .get();
-      throw DecodeException.error(message);
-    }
-
-    while (pos < length && authPasswordValue.charAt(pos) == ' ')
-    {
-      pos++;
-    }
-
-    // The final component must be the authValue element, containing
-    // only printable characters other than the dollar sign and space
-    // character.
-    while (pos < length)
-    {
-      final char c = authPasswordValue.charAt(pos);
-      if (c == ' ' || c == '$')
-      {
-        break;
-      }
-      else if (PrintableStringSyntaxImpl.isPrintableCharacter(c))
-      {
-        authValue.append(c);
-        pos++;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_INVALID_AUTH_VALUE_CHAR
-            .get(pos);
-        throw DecodeException.error(message);
-      }
-    }
-
-    // The authValue element must consist of at least one character.
-    if (scheme.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_NO_AUTH_VALUE
-          .get();
-      throw DecodeException.error(message);
-    }
-
-    // The only characters remaining must be whitespace.
-    while (pos < length)
-    {
-      final char c = authPasswordValue.charAt(pos);
-      if (c == ' ')
-      {
-        pos++;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_AUTHPW_INVALID_TRAILING_CHAR
-            .get(pos);
-        throw DecodeException.error(message);
-      }
-    }
-
-    // If we've gotten here, then everything must be OK.
-    return new StringBuilder[] { scheme, authInfo, authValue };
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is encoded using the auth password
-   * syntax.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <CODE>true</CODE> if the value appears to be encoded using the auth
-   *         password syntax, or <CODE>false</CODE> if not.
-   */
-  static boolean isEncoded(final ByteSequence value)
-  {
-    // FIXME -- Make this more efficient, and don't use exceptions for
-    // flow control.
-
-    try
-    {
-      decodeAuthPassword(value.toString());
-      return true;
-    }
-    catch (final Exception e)
-    {
-      return false;
-    }
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_AUTH_PASSWORD_EXACT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_AUTH_PASSWORD_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    try
-    {
-      decodeAuthPassword(value.toString());
-      return true;
-    }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java
index e522736..0394128 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BINARY_NAME;
@@ -36,63 +33,47 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the binary attribute syntax, which is essentially a byte
  * array using very strict matching. Equality, ordering, and substring matching
  * will be allowed by default.
  */
-final class BinarySyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+final class BinarySyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_BINARY_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_BINARY_NAME;
-  }
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the binary syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the binary syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java
index 3726204..8e55057 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT;
@@ -37,50 +34,43 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the bitStringMatch matching rule defined in X.520 and
  * referenced in RFC 2252.
  */
-final class BitStringEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String valueString = value.toString().toUpperCase();
+final class BitStringEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String valueString = value.toString().toUpperCase();
 
-    final int length = valueString.length();
-    if (length < 3)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT
-          .get(value.toString());
-      throw DecodeException.error(message);
+        final int length = valueString.length();
+        if (length < 3) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT.get(value.toString());
+            throw DecodeException.error(message);
+        }
+
+        if (valueString.charAt(0) != '\'' || valueString.charAt(length - 2) != '\''
+                || valueString.charAt(length - 1) != 'B') {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED.get(value.toString());
+            throw DecodeException.error(message);
+        }
+
+        for (int i = 1; i < length - 2; i++) {
+            switch (valueString.charAt(i)) {
+            case '0':
+            case '1':
+                // These characters are fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT.get(value.toString(), String
+                                .valueOf(valueString.charAt(i)));
+                throw DecodeException.error(message);
+            }
+        }
+
+        return ByteString.valueOf(valueString);
     }
-
-    if (valueString.charAt(0) != '\'' || valueString.charAt(length - 2) != '\''
-        || valueString.charAt(length - 1) != 'B')
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED
-          .get(value.toString());
-      throw DecodeException.error(message);
-    }
-
-    for (int i = 1; i < length - 2; i++)
-    {
-      switch (valueString.charAt(i))
-      {
-      case '0':
-      case '1':
-        // These characters are fine.
-        break;
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT
-            .get(value.toString(), String.valueOf(valueString.charAt(i)));
-        throw DecodeException.error(message);
-      }
-    }
-
-    return ByteString.valueOf(valueString);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java
index 3845485..4560662 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT;
@@ -38,88 +35,69 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the bit string attribute syntax, which is comprised of a
  * string of binary digits surrounded by single quotes and followed by a capital
  * letter "B" (e.g., '101001'B).
  */
-final class BitStringSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_BIT_STRING_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_BIT_STRING_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String valueString = value.toString().toUpperCase();
-
-    final int length = valueString.length();
-    if (length < 3)
-    {
-      invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT.get(value
-          .toString()));
-      return false;
+final class BitStringSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_BIT_STRING_OID;
     }
 
-    if (valueString.charAt(0) != '\'' || valueString.charAt(length - 2) != '\''
-        || valueString.charAt(length - 1) != 'B')
-    {
-      invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED.get(value
-          .toString()));
-      return false;
+    public String getName() {
+        return SYNTAX_BIT_STRING_NAME;
     }
 
-    for (int i = 1; i < length - 2; i++)
-    {
-      switch (valueString.charAt(i))
-      {
-      case '0':
-      case '1':
-        // These characters are fine.
-        break;
-      default:
-        invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT.get(value
-            .toString(), String.valueOf(valueString.charAt(i))));
-        return false;
-      }
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    // If we've gotten here, then everything is fine.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String valueString = value.toString().toUpperCase();
+
+        final int length = valueString.length();
+        if (length < 3) {
+            invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_TOO_SHORT.get(value.toString()));
+            return false;
+        }
+
+        if (valueString.charAt(0) != '\'' || valueString.charAt(length - 2) != '\''
+                || valueString.charAt(length - 1) != 'B') {
+            invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_NOT_QUOTED.get(value.toString()));
+            return false;
+        }
+
+        for (int i = 1; i < length - 2; i++) {
+            switch (valueString.charAt(i)) {
+            case '0':
+            case '1':
+                // These characters are fine.
+                break;
+            default:
+                invalidReason.append(WARN_ATTR_SYNTAX_BIT_STRING_INVALID_BIT.get(value.toString(),
+                        String.valueOf(valueString.charAt(i))));
+                return false;
+            }
+        }
+
+        // If we've gotten here, then everything is fine.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java
index 7cda6fe..aa3c66f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,38 +25,28 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN;
 
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the booleanMatch matching rule defined in X.520 and
  * referenced in RFC 4519.
  */
-final class BooleanEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String valueString = value.toString().toUpperCase();
-    if (valueString.equals("TRUE") || valueString.equals("YES")
-        || valueString.equals("ON") || valueString.equals("1"))
-    {
-      return SchemaConstants.TRUE_VALUE;
-    }
-    else if (valueString.equals("FALSE") || valueString.equals("NO")
-        || valueString.equals("OFF") || valueString.equals("0"))
-    {
-      return SchemaConstants.FALSE_VALUE;
-    }
+final class BooleanEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String valueString = value.toString().toUpperCase();
+        if (valueString.equals("TRUE") || valueString.equals("YES") || valueString.equals("ON")
+                || valueString.equals("1")) {
+            return SchemaConstants.TRUE_VALUE;
+        } else if (valueString.equals("FALSE") || valueString.equals("NO")
+                || valueString.equals("OFF") || valueString.equals("0")) {
+            return SchemaConstants.FALSE_VALUE;
+        }
 
-    throw DecodeException.error(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(value
-        .toString()));
-  }
+        throw DecodeException.error(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(value.toString()));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java
index 05883bf..d0e15f4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_BOOLEAN_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BOOLEAN_NAME;
@@ -36,8 +33,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the Boolean attribute syntax, which only allows values of
  * "TRUE" or "FALSE" (although this implementation is more flexible and will
@@ -45,61 +40,48 @@
  * instead of "FALSE"). Only equality matching is allowed by default for this
  * syntax.
  */
-final class BooleanSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_BOOLEAN_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_BOOLEAN_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String valueString = value.toString().toUpperCase();
-
-    final boolean returnValue = valueString.equals("TRUE")
-        || valueString.equals("YES") || valueString.equals("ON")
-        || valueString.equals("1") || valueString.equals("FALSE")
-        || valueString.equals("NO") || valueString.equals("OFF")
-        || valueString.equals("0");
-
-    if (!returnValue)
-    {
-      invalidReason.append(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(value
-          .toString()));
+final class BooleanSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_BOOLEAN_OID;
     }
 
-    return returnValue;
-  }
+    public String getName() {
+        return SYNTAX_BOOLEAN_NAME;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String valueString = value.toString().toUpperCase();
+
+        final boolean returnValue =
+                valueString.equals("TRUE") || valueString.equals("YES") || valueString.equals("ON")
+                        || valueString.equals("1") || valueString.equals("FALSE")
+                        || valueString.equals("NO") || valueString.equals("OFF")
+                        || valueString.equals("0");
+
+        if (!returnValue) {
+            invalidReason.append(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(value.toString()));
+        }
+
+        return returnValue;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java
index d753147..e84c2cd 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,48 +32,36 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the caseExactMatch matching rule defined in X.520 and
  * referenced in RFC 4519.
  */
-final class CaseExactEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class CaseExactEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java
index 07e009f..020e651 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -38,60 +35,47 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements the caseExactIA5Match matching rule defined in RFC
  * 2252.
  */
-final class CaseExactIA5EqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class CaseExactIA5EqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space and watch out
-    // for non-ASCII characters.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      final char c = buffer.charAt(pos);
-      if (c == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-      else if ((c & 0x7F) != c)
-      {
-        // This is not a valid character for an IA5 string. If strict
-        // syntax enforcement is enabled, then we'll throw an exception.
-        // Otherwise, we'll get rid of the character.
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER
-            .get(value.toString(), String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space and watch out
+        // for non-ASCII characters.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            final char c = buffer.charAt(pos);
+            if (c == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            } else if ((c & 0x7F) != c) {
+                // This is not a valid character for an IA5 string. If strict
+                // syntax enforcement is enabled, then we'll throw an exception.
+                // Otherwise, we'll get rid of the character.
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER.get(value.toString(), String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java
index 254bf2e..0e871d7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -38,79 +35,60 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements the caseExactIA5SubstringsMatch matching rule. This
  * matching rule actually isn't defined in any official specification, but some
  * directory vendors do provide an implementation using an OID from their own
  * private namespace.
  */
-final class CaseExactIA5SubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return normalize(TRIM, value);
-  }
-
-
-
-  @Override
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return normalize(false, value);
-  }
-
-
-
-  private ByteString normalize(final boolean trim, final ByteSequence value)
-      throws DecodeException
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, trim, NO_CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
+final class CaseExactIA5SubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(TRIM, value);
     }
 
-    // Replace any consecutive spaces with a single space and watch out
-    // for non-ASCII characters.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      final char c = buffer.charAt(pos);
-      if (c == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+    @Override
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(false, value);
+    }
+
+    private ByteString normalize(final boolean trim, final ByteSequence value)
+            throws DecodeException {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, trim, NO_CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-      else if ((c & 0x7F) != c)
-      {
-        // This is not a valid character for an IA5 string. If strict
-        // syntax enforcement is enabled, then we'll throw an exception.
-        // Otherwise, we'll get rid of the character.
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER
-            .get(value.toString(), String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space and watch out
+        // for non-ASCII characters.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            final char c = buffer.charAt(pos);
+            if (c == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            } else if ((c & 0x7F) != c) {
+                // This is not a valid character for an IA5 string. If strict
+                // syntax enforcement is enabled, then we'll throw an exception.
+                // Otherwise, we'll get rid of the character.
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER.get(value.toString(), String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java
index f23b734..6576607 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,49 +32,36 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the caseExactOrderingMatch matching rule defined in X.520
  * and referenced in RFC 4519.
  */
-final class CaseExactOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class CaseExactOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java
index 77faf05..fe13a21 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -36,65 +33,46 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the caseExactSubstringsMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-final class CaseExactSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return normalize(TRIM, value);
-  }
-
-
-
-  @Override
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return normalize(false, value);
-  }
-
-
-
-  private ByteString normalize(final boolean trim, final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, trim, NO_CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
+final class CaseExactSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return normalize(TRIM, value);
     }
 
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+    @Override
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(false, value);
+    }
+
+    private ByteString normalize(final boolean trim, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, trim, NO_CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java
index 8b0e783..58fbf25 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,48 +32,36 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the caseIgnoreMatch matching rule defined in X.520 and
  * referenced in RFC 2252.
  */
-final class CaseIgnoreEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class CaseIgnoreEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java
index bfbcd20..af31e3a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -38,60 +35,47 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements the caseIgnoreIA5Match matching rule defined in RFC
  * 2252.
  */
-final class CaseIgnoreIA5EqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class CaseIgnoreIA5EqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space and watch out
-    // for non-ASCII characters.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      final char c = buffer.charAt(pos);
-      if (c == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-      else if ((c & 0x7F) != c)
-      {
-        // This is not a valid character for an IA5 string. If strict
-        // syntax enforcement is enabled, then we'll throw an exception.
-        // Otherwise, we'll get rid of the character.
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER
-            .get(value.toString(), String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space and watch out
+        // for non-ASCII characters.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            final char c = buffer.charAt(pos);
+            if (c == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            } else if ((c & 0x7F) != c) {
+                // This is not a valid character for an IA5 string. If strict
+                // syntax enforcement is enabled, then we'll throw an exception.
+                // Otherwise, we'll get rid of the character.
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER.get(value.toString(), String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java
index bd15009..8eb8c03 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -38,77 +35,58 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class implements the caseIgnoreIA5SubstringsMatch matching rule defined
  * in RFC 2252.
  */
-final class CaseIgnoreIA5SubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return normalize(TRIM, value);
-  }
-
-
-
-  @Override
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return normalize(false, value);
-  }
-
-
-
-  private ByteString normalize(final boolean trim, final ByteSequence value)
-      throws DecodeException
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, trim, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
+final class CaseIgnoreIA5SubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(TRIM, value);
     }
 
-    // Replace any consecutive spaces with a single space and watch out
-    // for non-ASCII characters.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      final char c = buffer.charAt(pos);
-      if (c == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+    @Override
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(false, value);
+    }
+
+    private ByteString normalize(final boolean trim, final ByteSequence value)
+            throws DecodeException {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, trim, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-      else if ((c & 0x7F) != c)
-      {
-        // This is not a valid character for an IA5 string. If strict
-        // syntax enforcement is enabled, then we'll throw an exception.
-        // Otherwise, we'll get rid of the character.
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER
-            .get(value.toString(), String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space and watch out
+        // for non-ASCII characters.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            final char c = buffer.charAt(pos);
+            if (c == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            } else if ((c & 0x7F) != c) {
+                // This is not a valid character for an IA5 string. If strict
+                // syntax enforcement is enabled, then we'll throw an exception.
+                // Otherwise, we'll get rid of the character.
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER.get(value.toString(), String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java
index 0e26f01..a36eef4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,62 +32,44 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the caseIgnoreListMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-final class CaseIgnoreListEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class CaseIgnoreListEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
+        }
+
+        // Replace any consecutive spaces with a single space. Any spaces
+        // around a dollar sign will also be removed.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                final char c = buffer.charAt(pos - 1);
+                if (c == ' ') {
+                    buffer.delete(pos, pos + 1);
+                } else if (c == '$') {
+                    if (pos <= 1 || buffer.charAt(pos - 2) != '\\') {
+                        buffer.delete(pos, pos + 1);
+                    }
+                } else if (buffer.charAt(pos + 1) == '$') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
     }
-
-    // Replace any consecutive spaces with a single space. Any spaces
-    // around a dollar sign will also be removed.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        final char c = buffer.charAt(pos - 1);
-        if (c == ' ')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-        else if (c == '$')
-        {
-          if (pos <= 1 || buffer.charAt(pos - 2) != '\\')
-          {
-            buffer.delete(pos, pos + 1);
-          }
-        }
-        else if (buffer.charAt(pos + 1) == '$')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-      }
-    }
-
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java
index c36fac6..3b6d605 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
 
@@ -37,105 +34,77 @@
 
 import com.forgerock.opendj.util.StringPrepProfile;
 
-
-
 /**
  * This class implements the caseIgnoreListSubstringsMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-final class CaseIgnoreListSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, StringPrepProfile.TRIM, CASE_FOLD);
+final class CaseIgnoreListSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, StringPrepProfile.TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
+        }
+
+        // Replace any consecutive spaces with a single space. Any spaces
+        // around a dollar sign will also be removed.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                final char c = buffer.charAt(pos - 1);
+                if (c == ' ') {
+                    buffer.delete(pos, pos + 1);
+                } else if (c == '$') {
+                    if (pos <= 1 || buffer.charAt(pos - 2) != '\\') {
+                        buffer.delete(pos, pos + 1);
+                    }
+                } else if (buffer.charAt(pos + 1) == '$') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
     }
 
-    // Replace any consecutive spaces with a single space. Any spaces
-    // around a dollar sign will also be removed.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        final char c = buffer.charAt(pos - 1);
-        if (c == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+    @Override
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        // In this case, the process for normalizing a substring is the same
+        // as normalizing a full value with the exception that it may
+        // include an opening or trailing space.
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, false, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return value.toByteString();
+            }
         }
-        else if (c == '$')
-        {
-          if (pos <= 1 || buffer.charAt(pos - 2) != '\\')
-          {
-            buffer.delete(pos, pos + 1);
-          }
+
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
         }
-        else if (buffer.charAt(pos + 1) == '$')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-      }
+
+        return ByteString.valueOf(buffer.toString());
     }
-
-    return ByteString.valueOf(buffer.toString());
-  }
-
-
-
-  @Override
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    // In this case, the process for normalizing a substring is the same
-    // as normalizing a full value with the exception that it may
-    // include an opening or trailing space.
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, false, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return value.toByteString();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-      }
-    }
-
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java
index 7994aa8..f679124 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,49 +32,36 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the caseIgnoreOrderingMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-final class CaseIgnoreOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class CaseIgnoreOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java
index 6e3e8dd..3dd1ad7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 
@@ -37,66 +34,47 @@
 
 import com.forgerock.opendj.util.StringPrepProfile;
 
-
-
 /**
  * This class defines the caseIgnoreSubstringsMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-final class CaseIgnoreSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return normalize(TRIM, value);
-  }
-
-
-
-  @Override
-  ByteString normalizeSubString(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return normalize(false, value);
-  }
-
-
-
-  private ByteString normalize(final boolean trim, final ByteSequence value)
-  {
-
-    final StringBuilder buffer = new StringBuilder();
-    StringPrepProfile.prepareUnicode(buffer, value, trim, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return value.toByteString();
-      }
+final class CaseIgnoreSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return normalize(TRIM, value);
     }
 
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+    @Override
+    ByteString normalizeSubString(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return normalize(false, value);
+    }
+
+    private ByteString normalize(final boolean trim, final ByteSequence value) {
+
+        final StringBuilder buffer = new StringBuilder();
+        StringPrepProfile.prepareUnicode(buffer, value, trim, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return value.toByteString();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java
index 2b617ad..a5af1f8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTLIST_NAME;
@@ -36,72 +33,53 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the certificate list attribute syntax. This should be
  * restricted to holding only X.509 certificate lists, but we will accept any
  * set of bytes. It will be treated much like the octet string attribute syntax.
  */
-final class CertificateListSyntaxImpl extends AbstractSyntaxImpl
-{
+final class CertificateListSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_CERTLIST_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_CERTLIST_NAME;
-  }
+    @Override
+    public boolean isBEREncodingRequired() {
+        return true;
+    }
 
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  @Override
-  public boolean isBEREncodingRequired()
-  {
-    return true;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the certificate list syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the certificate list syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java
index 306a74c..91f91e8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTPAIR_NAME;
@@ -36,71 +33,52 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the certificate pair attribute syntax. This should be
  * restricted to holding only X.509 certificate pairs, but we will accept any
  * set of bytes. It will be treated much like the octet string attribute syntax.
  */
-final class CertificatePairSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+final class CertificatePairSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_CERTPAIR_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_CERTPAIR_NAME;
-  }
+    @Override
+    public boolean isBEREncodingRequired() {
+        return true;
+    }
 
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  @Override
-  public boolean isBEREncodingRequired()
-  {
-    return true;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the certificate pair syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the certificate pair syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java
index 99e3aa7..3352cbe 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTIFICATE_NAME;
@@ -36,71 +33,52 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the certificate attribute syntax. This should be
  * restricted to holding only X.509 certificates, but we will accept any set of
  * bytes. It will be treated much like the octet string attribute syntax.
  */
-final class CertificateSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+final class CertificateSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_CERTIFICATE_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_CERTIFICATE_NAME;
-  }
+    @Override
+    public boolean isBEREncodingRequired() {
+        return true;
+    }
 
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  @Override
-  public boolean isBEREncodingRequired()
-  {
-    return true;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the certificate syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the certificate syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java
index 0274bd9..deb526a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,31 +26,24 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 
-
-
 /**
  * Thrown when addition of a schema element to a schema builder fails because
  * the OID of the schema element conflicts with an existing schema element and
  * the caller explicitly requested not to override existing schema elements.
  */
 @SuppressWarnings("serial")
-public class ConflictingSchemaElementException extends
-    LocalizedIllegalArgumentException
-{
-  /**
-   * Creates a new conflicting schema element exception with the provided
-   * message.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   */
-  public ConflictingSchemaElementException(final LocalizableMessage message)
-  {
-    super(message);
-  }
+public class ConflictingSchemaElementException extends LocalizedIllegalArgumentException {
+    /**
+     * Creates a new conflicting schema element exception with the provided
+     * message.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     */
+    public ConflictingSchemaElementException(final LocalizableMessage message) {
+        super(message);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
index ed540cd..9753441 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 /**
  * The OpenDJ SDK core schema contains standard LDAP RFC schema elements. These
  * include:
@@ -50,2626 +47,2112 @@
  * The core schema is non-strict: attempts to retrieve non-existent Attribute
  * Types will return a temporary Attribute Type having the Octet String syntax.
  */
-public final class CoreSchema
-{
-  // Core Syntaxes
-  private static final Syntax ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.3");
-  private static final Syntax AUTHENTICATION_PASSWORD_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.4203.1.1.2");
-  private static final Syntax BINARY_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.5");
-  private static final Syntax BIT_STRING_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.6");
-  private static final Syntax BOOLEAN_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.7");
-  private static final Syntax CERTIFICATE_LIST_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.9");
-  private static final Syntax CERTIFICATE_PAIR_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.10");
-  private static final Syntax CERTIFICATE_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.8");
-  private static final Syntax COUNTRY_STRING_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.11");
-  private static final Syntax DELIVERY_METHOD_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.14");
-  private static final Syntax DIRECTORY_STRING_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.15");
-  private static final Syntax DIT_CONTENT_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.16");
-  private static final Syntax DIT_STRUCTURE_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.17");
-  private static final Syntax DN_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.12");
-  private static final Syntax ENHANCED_GUIDE_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.21");
-  private static final Syntax FACSIMILE_TELEPHONE_NUMBER_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.22");
-  private static final Syntax FAX_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.23");
-  private static final Syntax GENERALIZED_TIME_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.24");
-  private static final Syntax GUIDE_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.25");
-  private static final Syntax IA5_STRING_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.26");
-  private static final Syntax INTEGER_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.27");
-  private static final Syntax JPEG_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.28");
-  private static final Syntax LDAP_SYNTAX_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.54");
-  private static final Syntax MATCHING_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.30");
-  private static final Syntax MATCHING_RULE_USE_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.31");
-  private static final Syntax NAME_AND_OPTIONAL_UID_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.34");
-  private static final Syntax NAME_FORM_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.35");
-  private static final Syntax NUMERIC_STRING_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.36");
-  private static final Syntax OBJECT_CLASS_DESCRIPTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.37");
-  private static final Syntax OCTET_STRING_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.40");
-  private static final Syntax OID_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.38");
-  private static final Syntax OTHER_MAILBOX_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.39");
-  private static final Syntax POSTAL_ADDRESS_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.41");
-  private static final Syntax PRESENTATION_ADDRESS_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.43");
-  private static final Syntax PRINTABLE_STRING_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.44");
-  private static final Syntax PROTOCOL_INFORMATION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.42");
-  private static final Syntax SUBSTRING_ASSERTION_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.58");
-  private static final Syntax SUPPORTED_ALGORITHM_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.49");
-  private static final Syntax TELEPHONE_NUMBER_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.50");
-  private static final Syntax TELETEX_TERMINAL_IDENTIFIER_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.51");
-  private static final Syntax TELEX_NUMBER_SYNTAX = CoreSchemaImpl
-      .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.52");
-  private static final Syntax UTC_TIME_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.4.1.1466.115.121.1.53");
-  private static final Syntax UUID_SYNTAX = CoreSchemaImpl.getInstance()
-      .getSyntax("1.3.6.1.1.16.1");
+public final class CoreSchema {
+    // Core Syntaxes
+    private static final Syntax ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.3");
+    private static final Syntax AUTHENTICATION_PASSWORD_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.4203.1.1.2");
+    private static final Syntax BINARY_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.5");
+    private static final Syntax BIT_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.6");
+    private static final Syntax BOOLEAN_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.7");
+    private static final Syntax CERTIFICATE_LIST_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.9");
+    private static final Syntax CERTIFICATE_PAIR_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.10");
+    private static final Syntax CERTIFICATE_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.8");
+    private static final Syntax COUNTRY_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.11");
+    private static final Syntax DELIVERY_METHOD_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.14");
+    private static final Syntax DIRECTORY_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.15");
+    private static final Syntax DIT_CONTENT_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.16");
+    private static final Syntax DIT_STRUCTURE_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl
+            .getInstance().getSyntax("1.3.6.1.4.1.1466.115.121.1.17");
+    private static final Syntax DN_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.12");
+    private static final Syntax ENHANCED_GUIDE_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.21");
+    private static final Syntax FACSIMILE_TELEPHONE_NUMBER_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.22");
+    private static final Syntax FAX_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.23");
+    private static final Syntax GENERALIZED_TIME_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.24");
+    private static final Syntax GUIDE_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.25");
+    private static final Syntax IA5_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.26");
+    private static final Syntax INTEGER_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.27");
+    private static final Syntax JPEG_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.28");
+    private static final Syntax LDAP_SYNTAX_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.54");
+    private static final Syntax MATCHING_RULE_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.30");
+    private static final Syntax MATCHING_RULE_USE_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.31");
+    private static final Syntax NAME_AND_OPTIONAL_UID_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.34");
+    private static final Syntax NAME_FORM_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.35");
+    private static final Syntax NUMERIC_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.36");
+    private static final Syntax OBJECT_CLASS_DESCRIPTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.37");
+    private static final Syntax OCTET_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.40");
+    private static final Syntax OID_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.38");
+    private static final Syntax OTHER_MAILBOX_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.39");
+    private static final Syntax POSTAL_ADDRESS_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.41");
+    private static final Syntax PRESENTATION_ADDRESS_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.43");
+    private static final Syntax PRINTABLE_STRING_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.44");
+    private static final Syntax PROTOCOL_INFORMATION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.42");
+    private static final Syntax SUBSTRING_ASSERTION_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.58");
+    private static final Syntax SUPPORTED_ALGORITHM_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.49");
+    private static final Syntax TELEPHONE_NUMBER_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.50");
+    private static final Syntax TELETEX_TERMINAL_IDENTIFIER_SYNTAX = CoreSchemaImpl.getInstance()
+            .getSyntax("1.3.6.1.4.1.1466.115.121.1.51");
+    private static final Syntax TELEX_NUMBER_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.52");
+    private static final Syntax UTC_TIME_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.4.1.1466.115.121.1.53");
+    private static final Syntax UUID_SYNTAX = CoreSchemaImpl.getInstance().getSyntax(
+            "1.3.6.1.1.16.1");
 
-  // Core Matching Rules
-  private static final MatchingRule AUTH_PASSWORD_EXACT_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.4.1.4203.1.2.2");
-  private static final MatchingRule BIT_STRING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.16");
-  private static final MatchingRule BOOLEAN_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.13");
-  private static final MatchingRule CASE_EXACT_IA5_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.4.1.1466.109.114.1");
-  private static final MatchingRule CASE_EXACT_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.5");
-  private static final MatchingRule CASE_EXACT_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.6");
-  private static final MatchingRule CASE_EXACT_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.7");
-  private static final MatchingRule CASE_IGNORE_IA5_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.4.1.1466.109.114.2");
-  private static final MatchingRule CASE_IGNORE_IA5_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.4.1.1466.109.114.3");
-  private static final MatchingRule CASE_IGNORE_LIST_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.11");
-  private static final MatchingRule CASE_IGNORE_LIST_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.12");
-  private static final MatchingRule CASE_IGNORE_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.2");
-  private static final MatchingRule CASE_IGNORE_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.3");
-  private static final MatchingRule CASE_IGNORE_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.4");
-  private static final MatchingRule DIRECTORY_STRING_FIRST_COMPONENT_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.31");
-  private static final MatchingRule DISTINGUISHED_NAME_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.1");
-  private static final MatchingRule GENERALIZED_TIME_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.27");
-  private static final MatchingRule GENERALIZED_TIME_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.28");
-  private static final MatchingRule INTEGER_FIRST_COMPONENT_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.29");
-  private static final MatchingRule INTEGER_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.14");
-  private static final MatchingRule INTEGER_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.15");
-  private static final MatchingRule KEYWORD_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.33");
-  private static final MatchingRule NUMERIC_STRING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.8");
-  private static final MatchingRule NUMERIC_STRING_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.9");
-  private static final MatchingRule NUMERIC_STRING_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.10");
-  private static final MatchingRule OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.30");
-  private static final MatchingRule OBJECT_IDENTIFIER_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.0");
-  private static final MatchingRule OCTET_STRING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.17");
-  private static final MatchingRule OCTET_STRING_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.18");
-  private static final MatchingRule OCTET_STRING_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.19");
-  private static final MatchingRule PRESENTATION_ADDRESS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.22");
-  private static final MatchingRule PROTOCOL_INFORMATION_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.24");
-  private static final MatchingRule TELEPHONE_NUMBER_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.20");
-  private static final MatchingRule TELEPHONE_NUMBER_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.21");
-  private static final MatchingRule UNIQUE_MEMBER_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.23");
-  private static final MatchingRule UUID_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.1.16.2");
-  private static final MatchingRule UUID_ORDERING_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("1.3.6.1.1.16.3");
-  private static final MatchingRule WORD_MATCHING_RULE = CoreSchemaImpl
-      .getInstance().getMatchingRule("2.5.13.32");
+    // Core Matching Rules
+    private static final MatchingRule AUTH_PASSWORD_EXACT_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("1.3.6.1.4.1.4203.1.2.2");
+    private static final MatchingRule BIT_STRING_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.16");
+    private static final MatchingRule BOOLEAN_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.13");
+    private static final MatchingRule CASE_EXACT_IA5_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("1.3.6.1.4.1.1466.109.114.1");
+    private static final MatchingRule CASE_EXACT_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.5");
+    private static final MatchingRule CASE_EXACT_ORDERING_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.6");
+    private static final MatchingRule CASE_EXACT_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.7");
+    private static final MatchingRule CASE_IGNORE_IA5_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("1.3.6.1.4.1.1466.109.114.2");
+    private static final MatchingRule CASE_IGNORE_IA5_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("1.3.6.1.4.1.1466.109.114.3");
+    private static final MatchingRule CASE_IGNORE_LIST_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.11");
+    private static final MatchingRule CASE_IGNORE_LIST_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.12");
+    private static final MatchingRule CASE_IGNORE_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.2");
+    private static final MatchingRule CASE_IGNORE_ORDERING_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.3");
+    private static final MatchingRule CASE_IGNORE_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.4");
+    private static final MatchingRule DIRECTORY_STRING_FIRST_COMPONENT_MATCHING_RULE =
+            CoreSchemaImpl.getInstance().getMatchingRule("2.5.13.31");
+    private static final MatchingRule DISTINGUISHED_NAME_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.1");
+    private static final MatchingRule GENERALIZED_TIME_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.27");
+    private static final MatchingRule GENERALIZED_TIME_ORDERING_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.28");
+    private static final MatchingRule INTEGER_FIRST_COMPONENT_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.29");
+    private static final MatchingRule INTEGER_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.14");
+    private static final MatchingRule INTEGER_ORDERING_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.15");
+    private static final MatchingRule KEYWORD_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.33");
+    private static final MatchingRule NUMERIC_STRING_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.8");
+    private static final MatchingRule NUMERIC_STRING_ORDERING_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.9");
+    private static final MatchingRule NUMERIC_STRING_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.10");
+    private static final MatchingRule OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCHING_RULE =
+            CoreSchemaImpl.getInstance().getMatchingRule("2.5.13.30");
+    private static final MatchingRule OBJECT_IDENTIFIER_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.0");
+    private static final MatchingRule OCTET_STRING_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.17");
+    private static final MatchingRule OCTET_STRING_ORDERING_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.18");
+    private static final MatchingRule OCTET_STRING_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.19");
+    private static final MatchingRule PRESENTATION_ADDRESS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.22");
+    private static final MatchingRule PROTOCOL_INFORMATION_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.24");
+    private static final MatchingRule TELEPHONE_NUMBER_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.20");
+    private static final MatchingRule TELEPHONE_NUMBER_SUBSTRINGS_MATCHING_RULE = CoreSchemaImpl
+            .getInstance().getMatchingRule("2.5.13.21");
+    private static final MatchingRule UNIQUE_MEMBER_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.23");
+    private static final MatchingRule UUID_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("1.3.6.1.1.16.2");
+    private static final MatchingRule UUID_ORDERING_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("1.3.6.1.1.16.3");
+    private static final MatchingRule WORD_MATCHING_RULE = CoreSchemaImpl.getInstance()
+            .getMatchingRule("2.5.13.32");
 
-  // Core Attribute Types
-  private static final AttributeType ALIASED_OBJECT_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.1");
-  private static final AttributeType ALT_SERVER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.6");
-  private static final AttributeType ATTRIBUTE_TYPES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.5");
-  private static final AttributeType AUTH_PASSWORD_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.4203.1.3.4");
-  private static final AttributeType BUSINESS_CATEGORY_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.15");
-  private static final AttributeType CN_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.3");
-  private static final AttributeType CREATE_TIMESTAMP_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.18.1");
-  private static final AttributeType CREATORS_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.18.3");
-  private static final AttributeType C_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.6");
-  private static final AttributeType DC_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("0.9.2342.19200300.100.1.25");
-  private static final AttributeType DESCRIPTION_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.13");
-  private static final AttributeType DESTINATION_INDICATOR_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.27");
-  private static final AttributeType DISTINGUISHED_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.49");
-  private static final AttributeType DIT_CONTENT_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.2");
-  private static final AttributeType DIT_STRUCTURE_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.1");
-  private static final AttributeType DN_QUALIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.46");
-  private static final AttributeType ENHANCED_SEARCH_GUIDE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.47");
-  private static final AttributeType ENTRY_UUID_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.1.16.4");
-  private static final AttributeType FACSIMILE_TELEPHONE_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.23");
-  private static final AttributeType GENERATION_QUALIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.44");
-  private static final AttributeType GIVEN_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.42");
-  private static final AttributeType GOVERNING_STRUCTURE_RULE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.10");
-  private static final AttributeType HOUSE_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.51");
-  private static final AttributeType INITIALS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.43");
-  private static final AttributeType INTERNATIONAL_ISDN_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.25");
-  private static final AttributeType LDAP_SYNTAXES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.16");
-  private static final AttributeType L_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.7");
-  private static final AttributeType MATCHING_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.4");
-  private static final AttributeType MATCHING_RULE_USE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.8");
-  private static final AttributeType MEMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.31");
-  private static final AttributeType MODIFIERS_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.18.4");
-  private static final AttributeType MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.18.2");
-  private static final AttributeType NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.41");
-  private static final AttributeType NAME_FORMS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.7");
-  private static final AttributeType NAMING_CONTEXTS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.5");
-  private static final AttributeType OBJECT_CLASSES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.6");
-  private static final AttributeType OBJECT_CLASS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.0");
-  private static final AttributeType OU_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.11");
-  private static final AttributeType OWNER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.32");
-  private static final AttributeType O_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.10");
-  private static final AttributeType PHYSICAL_DELIVERY_OFFICE_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.19");
-  private static final AttributeType POSTAL_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.16");
-  private static final AttributeType POSTAL_CODE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.17");
-  private static final AttributeType POST_OFFICE_BOX_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.18");
-  private static final AttributeType PREFERRED_DELIVERY_METHOD_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.28");
-  private static final AttributeType REGISTERED_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.26");
-  private static final AttributeType ROLE_OCCUPANT_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.33");
-  private static final AttributeType SEARCH_GUIDE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.14");
-  private static final AttributeType SEE_ALSO_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.34");
-  private static final AttributeType SERIAL_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.5");
-  private static final AttributeType SN_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.4");
-  private static final AttributeType STREET_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.9");
-  private static final AttributeType STRUCTURAL_OBJECT_CLASS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.21.9");
-  private static final AttributeType ST_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.8");
-  private static final AttributeType SUBSCHEMA_SUBENTRY_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.18.10");
-  private static final AttributeType SUPPORTED_AUTH_PASSWORD_SCHEMES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.4203.1.3.3");
-  private static final AttributeType SUPPORTED_CONTROL_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.13");
-  private static final AttributeType SUPPORTED_EXTENSION_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.7");
-  private static final AttributeType SUPPORTED_FEATURES_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.4203.1.3.5");
-  private static final AttributeType SUPPORTED_LDAP_VERSION_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.15");
-  private static final AttributeType SUPPORTED_SASL_MECHANISMS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.14");
-  private static final AttributeType TELEPHONE_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.20");
-  private static final AttributeType TELETEX_TERMINAL_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.22");
-  private static final AttributeType TELEX_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.21");
-  private static final AttributeType TITLE_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.12");
-  private static final AttributeType UID_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("0.9.2342.19200300.100.1.1");
-  private static final AttributeType UNIQUE_MEMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.50");
-  private static final AttributeType USER_PASSWORD_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.35");
-  private static final AttributeType VENDOR_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.1.4");
-  private static final AttributeType VENDOR_VERSION_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("1.3.6.1.1.5");
-  private static final AttributeType X121_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.24");
-  private static final AttributeType X500_UNIQUE_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
-      .getInstance().getAttributeType("2.5.4.45");
+    // Core Attribute Types
+    private static final AttributeType ALIASED_OBJECT_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.1");
+    private static final AttributeType ALT_SERVER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.4.1.1466.101.120.6");
+    private static final AttributeType ATTRIBUTE_TYPES_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.5");
+    private static final AttributeType AUTH_PASSWORD_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.4.1.4203.1.3.4");
+    private static final AttributeType BUSINESS_CATEGORY_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.15");
+    private static final AttributeType CN_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.3");
+    private static final AttributeType CREATE_TIMESTAMP_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.18.1");
+    private static final AttributeType CREATORS_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.18.3");
+    private static final AttributeType C_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.6");
+    private static final AttributeType DC_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("0.9.2342.19200300.100.1.25");
+    private static final AttributeType DESCRIPTION_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.13");
+    private static final AttributeType DESTINATION_INDICATOR_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.27");
+    private static final AttributeType DISTINGUISHED_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.49");
+    private static final AttributeType DIT_CONTENT_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.2");
+    private static final AttributeType DIT_STRUCTURE_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.1");
+    private static final AttributeType DN_QUALIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.46");
+    private static final AttributeType ENHANCED_SEARCH_GUIDE_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.47");
+    private static final AttributeType ENTRY_UUID_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.1.16.4");
+    private static final AttributeType FACSIMILE_TELEPHONE_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.23");
+    private static final AttributeType GENERATION_QUALIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.44");
+    private static final AttributeType GIVEN_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.42");
+    private static final AttributeType GOVERNING_STRUCTURE_RULE_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.10");
+    private static final AttributeType HOUSE_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.51");
+    private static final AttributeType INITIALS_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.43");
+    private static final AttributeType INTERNATIONAL_ISDN_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.25");
+    private static final AttributeType LDAP_SYNTAXES_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.4.1.1466.101.120.16");
+    private static final AttributeType L_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.7");
+    private static final AttributeType MATCHING_RULES_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.21.4");
+    private static final AttributeType MATCHING_RULE_USE_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.8");
+    private static final AttributeType MEMBER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.31");
+    private static final AttributeType MODIFIERS_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.18.4");
+    private static final AttributeType MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.18.2");
+    private static final AttributeType NAME_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.41");
+    private static final AttributeType NAME_FORMS_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.21.7");
+    private static final AttributeType NAMING_CONTEXTS_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.5");
+    private static final AttributeType OBJECT_CLASSES_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.21.6");
+    private static final AttributeType OBJECT_CLASS_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.0");
+    private static final AttributeType OU_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.11");
+    private static final AttributeType OWNER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.32");
+    private static final AttributeType O_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.10");
+    private static final AttributeType PHYSICAL_DELIVERY_OFFICE_NAME_ATTRIBUTE_TYPE =
+            CoreSchemaImpl.getInstance().getAttributeType("2.5.4.19");
+    private static final AttributeType POSTAL_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.16");
+    private static final AttributeType POSTAL_CODE_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.17");
+    private static final AttributeType POST_OFFICE_BOX_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.18");
+    private static final AttributeType PREFERRED_DELIVERY_METHOD_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.28");
+    private static final AttributeType REGISTERED_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.26");
+    private static final AttributeType ROLE_OCCUPANT_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.33");
+    private static final AttributeType SEARCH_GUIDE_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.14");
+    private static final AttributeType SEE_ALSO_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.34");
+    private static final AttributeType SERIAL_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.5");
+    private static final AttributeType SN_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.4");
+    private static final AttributeType STREET_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.9");
+    private static final AttributeType STRUCTURAL_OBJECT_CLASS_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.21.9");
+    private static final AttributeType ST_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.8");
+    private static final AttributeType SUBSCHEMA_SUBENTRY_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.18.10");
+    private static final AttributeType SUPPORTED_AUTH_PASSWORD_SCHEMES_ATTRIBUTE_TYPE =
+            CoreSchemaImpl.getInstance().getAttributeType("1.3.6.1.4.1.4203.1.3.3");
+    private static final AttributeType SUPPORTED_CONTROL_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.13");
+    private static final AttributeType SUPPORTED_EXTENSION_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.7");
+    private static final AttributeType SUPPORTED_FEATURES_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.4203.1.3.5");
+    private static final AttributeType SUPPORTED_LDAP_VERSION_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.15");
+    private static final AttributeType SUPPORTED_SASL_MECHANISMS_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("1.3.6.1.4.1.1466.101.120.14");
+    private static final AttributeType TELEPHONE_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.20");
+    private static final AttributeType TELETEX_TERMINAL_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.22");
+    private static final AttributeType TELEX_NUMBER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.21");
+    private static final AttributeType TITLE_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.12");
+    private static final AttributeType UID_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("0.9.2342.19200300.100.1.1");
+    private static final AttributeType UNIQUE_MEMBER_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.50");
+    private static final AttributeType USER_PASSWORD_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.35");
+    private static final AttributeType VENDOR_NAME_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.1.4");
+    private static final AttributeType VENDOR_VERSION_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("1.3.6.1.1.5");
+    private static final AttributeType X121_ADDRESS_ATTRIBUTE_TYPE = CoreSchemaImpl.getInstance()
+            .getAttributeType("2.5.4.24");
+    private static final AttributeType X500_UNIQUE_IDENTIFIER_ATTRIBUTE_TYPE = CoreSchemaImpl
+            .getInstance().getAttributeType("2.5.4.45");
 
-  // Core Object Classes
-  private static final ObjectClass ALIAS_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.1");
-  private static final ObjectClass APPLICATION_PROCESS_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.11");
-  private static final ObjectClass AUTH_PASSWORD_OBJECT_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("1.3.6.1.4.1.4203.1.4.7");
-  private static final ObjectClass COUNTRY_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.2");
-  private static final ObjectClass DC_OBJECT_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("1.3.6.1.4.1.1466.344");
-  private static final ObjectClass DEVICE_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.14");
-  private static final ObjectClass EXTENSIBLE_OBJECT_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("1.3.6.1.4.1.1466.101.120.111");
-  private static final ObjectClass GROUP_OF_NAMES_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.9");
-  private static final ObjectClass GROUP_OF_UNIQUE_NAMES_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.17");
-  private static final ObjectClass LOCALITY_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.3");
-  private static final ObjectClass ORGANIZATIONAL_PERSON_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.7");
-  private static final ObjectClass ORGANIZATIONAL_ROLE_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.8");
-  private static final ObjectClass ORGANIZATIONAL_UNIT_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.5");
-  private static final ObjectClass ORGANIZATION_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.4");
-  private static final ObjectClass PERSON_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.6");
-  private static final ObjectClass RESIDENTIAL_PERSON_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.10");
-  private static final ObjectClass SUBSCHEMA_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.20.1");
-  private static final ObjectClass TOP_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("2.5.6.0");
-  private static final ObjectClass UID_OBJECT_OBJECT_CLASS = CoreSchemaImpl
-      .getInstance().getObjectClass("1.3.6.1.1.3.1");
+    // Core Object Classes
+    private static final ObjectClass ALIAS_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.1");
+    private static final ObjectClass APPLICATION_PROCESS_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("2.5.6.11");
+    private static final ObjectClass AUTH_PASSWORD_OBJECT_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("1.3.6.1.4.1.4203.1.4.7");
+    private static final ObjectClass COUNTRY_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.2");
+    private static final ObjectClass DC_OBJECT_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("1.3.6.1.4.1.1466.344");
+    private static final ObjectClass DEVICE_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.14");
+    private static final ObjectClass EXTENSIBLE_OBJECT_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("1.3.6.1.4.1.1466.101.120.111");
+    private static final ObjectClass GROUP_OF_NAMES_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.9");
+    private static final ObjectClass GROUP_OF_UNIQUE_NAMES_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("2.5.6.17");
+    private static final ObjectClass LOCALITY_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.3");
+    private static final ObjectClass ORGANIZATIONAL_PERSON_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("2.5.6.7");
+    private static final ObjectClass ORGANIZATIONAL_ROLE_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("2.5.6.8");
+    private static final ObjectClass ORGANIZATIONAL_UNIT_OBJECT_CLASS = CoreSchemaImpl
+            .getInstance().getObjectClass("2.5.6.5");
+    private static final ObjectClass ORGANIZATION_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.4");
+    private static final ObjectClass PERSON_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.6");
+    private static final ObjectClass RESIDENTIAL_PERSON_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.10");
+    private static final ObjectClass SUBSCHEMA_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.20.1");
+    private static final ObjectClass TOP_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("2.5.6.0");
+    private static final ObjectClass UID_OBJECT_OBJECT_CLASS = CoreSchemaImpl.getInstance()
+            .getObjectClass("1.3.6.1.1.3.1");
 
+    /**
+     * Returns a reference to the {@code aliasedObjectName} Attribute Type which
+     * has the OID {@code 2.5.4.1}.
+     *
+     * @return A reference to the {@code aliasedObjectName} Attribute Type.
+     */
+    public static AttributeType getAliasedObjectNameAttributeType() {
+        return ALIASED_OBJECT_NAME_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code alias} Object Class which has the OID
+     * {@code 2.5.6.1}.
+     *
+     * @return A reference to the {@code alias} Object Class.
+     */
+    public static ObjectClass getAliasObjectClass() {
+        return ALIAS_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code aliasedObjectName} Attribute Type which
-   * has the OID {@code 2.5.4.1}.
-   *
-   * @return A reference to the {@code aliasedObjectName} Attribute Type.
-   */
-  public static AttributeType getAliasedObjectNameAttributeType()
-  {
-    return ALIASED_OBJECT_NAME_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code altServer} Attribute Type which has the
+     * OID {@code 1.3.6.1.4.1.1466.101.120.6}.
+     *
+     * @return A reference to the {@code altServer} Attribute Type.
+     */
+    public static AttributeType getAltServerAttributeType() {
+        return ALT_SERVER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code applicationProcess} Object Class which
+     * has the OID {@code 2.5.6.11}.
+     *
+     * @return A reference to the {@code applicationProcess} Object Class.
+     */
+    public static ObjectClass getApplicationProcessObjectClass() {
+        return APPLICATION_PROCESS_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code Attribute Type Description Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.3}.
+     *
+     * @return A reference to the {@code Attribute Type Description Syntax}.
+     */
+    public static Syntax getAttributeTypeDescriptionSyntax() {
+        return ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code alias} Object Class which has the OID
-   * {@code 2.5.6.1}.
-   *
-   * @return A reference to the {@code alias} Object Class.
-   */
-  public static ObjectClass getAliasObjectClass()
-  {
-    return ALIAS_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code attributeTypes} Attribute Type which
+     * has the OID {@code 2.5.21.5}.
+     *
+     * @return A reference to the {@code attributeTypes} Attribute Type.
+     */
+    public static AttributeType getAttributeTypesAttributeType() {
+        return ATTRIBUTE_TYPES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Authentication Password Syntax} which
+     * has the OID {@code 1.3.6.1.4.1.4203.1.1.2}.
+     *
+     * @return A reference to the {@code Authentication Password Syntax}.
+     */
+    public static Syntax getAuthenticationPasswordSyntax() {
+        return AUTHENTICATION_PASSWORD_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code authPassword} Attribute Type which has
+     * the OID {@code 1.3.6.1.4.1.4203.1.3.4}.
+     *
+     * @return A reference to the {@code authPassword} Attribute Type.
+     */
+    public static AttributeType getAuthPasswordAttributeType() {
+        return AUTH_PASSWORD_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code altServer} Attribute Type which has the
-   * OID {@code 1.3.6.1.4.1.1466.101.120.6}.
-   *
-   * @return A reference to the {@code altServer} Attribute Type.
-   */
-  public static AttributeType getAltServerAttributeType()
-  {
-    return ALT_SERVER_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code authPasswordExactMatch} Matching Rule
+     * which has the OID {@code 1.3.6.1.4.1.4203.1.2.2}.
+     *
+     * @return A reference to the {@code authPasswordExactMatch} Matching Rule.
+     */
+    public static MatchingRule getAuthPasswordExactMatchingRule() {
+        return AUTH_PASSWORD_EXACT_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code authPasswordObject} Object Class which
+     * has the OID {@code 1.3.6.1.4.1.4203.1.4.7}.
+     *
+     * @return A reference to the {@code authPasswordObject} Object Class.
+     */
+    public static ObjectClass getAuthPasswordObjectObjectClass() {
+        return AUTH_PASSWORD_OBJECT_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code Binary Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.5}.
+     *
+     * @return A reference to the {@code Binary Syntax}.
+     */
+    public static Syntax getBinarySyntax() {
+        return BINARY_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code applicationProcess} Object Class which
-   * has the OID {@code 2.5.6.11}.
-   *
-   * @return A reference to the {@code applicationProcess} Object Class.
-   */
-  public static ObjectClass getApplicationProcessObjectClass()
-  {
-    return APPLICATION_PROCESS_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code bitStringMatch} Matching Rule which has
+     * the OID {@code 2.5.13.16}.
+     *
+     * @return A reference to the {@code bitStringMatch} Matching Rule.
+     */
+    public static MatchingRule getBitStringMatchingRule() {
+        return BIT_STRING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code Bit String Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.6}.
+     *
+     * @return A reference to the {@code Bit String Syntax}.
+     */
+    public static Syntax getBitStringSyntax() {
+        return BIT_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code booleanMatch} Matching Rule which has
+     * the OID {@code 2.5.13.13}.
+     *
+     * @return A reference to the {@code booleanMatch} Matching Rule.
+     */
+    public static MatchingRule getBooleanMatchingRule() {
+        return BOOLEAN_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code Attribute Type Description Syntax} which
-   * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.3}.
-   *
-   * @return A reference to the {@code Attribute Type Description Syntax}.
-   */
-  public static Syntax getAttributeTypeDescriptionSyntax()
-  {
-    return ATTRIBUTE_TYPE_DESCRIPTION_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code Boolean Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.7}.
+     *
+     * @return A reference to the {@code Boolean Syntax}.
+     */
+    public static Syntax getBooleanSyntax() {
+        return BOOLEAN_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code businessCategory} Attribute Type which
+     * has the OID {@code 2.5.4.15}.
+     *
+     * @return A reference to the {@code businessCategory} Attribute Type.
+     */
+    public static AttributeType getBusinessCategoryAttributeType() {
+        return BUSINESS_CATEGORY_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseExactIA5Match} Matching Rule which
+     * has the OID {@code 1.3.6.1.4.1.1466.109.114.1}.
+     *
+     * @return A reference to the {@code caseExactIA5Match} Matching Rule.
+     */
+    public static MatchingRule getCaseExactIA5MatchingRule() {
+        return CASE_EXACT_IA5_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code attributeTypes} Attribute Type which has
-   * the OID {@code 2.5.21.5}.
-   *
-   * @return A reference to the {@code attributeTypes} Attribute Type.
-   */
-  public static AttributeType getAttributeTypesAttributeType()
-  {
-    return ATTRIBUTE_TYPES_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code caseExactMatch} Matching Rule which has
+     * the OID {@code 2.5.13.5}.
+     *
+     * @return A reference to the {@code caseExactMatch} Matching Rule.
+     */
+    public static MatchingRule getCaseExactMatchingRule() {
+        return CASE_EXACT_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseExactOrderingMatch} Matching Rule
+     * which has the OID {@code 2.5.13.6}.
+     *
+     * @return A reference to the {@code caseExactOrderingMatch} Matching Rule.
+     */
+    public static MatchingRule getCaseExactOrderingMatchingRule() {
+        return CASE_EXACT_ORDERING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseExactSubstringsMatch} Matching Rule
+     * which has the OID {@code 2.5.13.7}.
+     *
+     * @return A reference to the {@code caseExactSubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getCaseExactSubstringsMatchingRule() {
+        return CASE_EXACT_SUBSTRINGS_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code Authentication Password Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.4203.1.1.2}.
-   *
-   * @return A reference to the {@code Authentication Password Syntax}.
-   */
-  public static Syntax getAuthenticationPasswordSyntax()
-  {
-    return AUTHENTICATION_PASSWORD_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code caseIgnoreIA5Match} Matching Rule which
+     * has the OID {@code 1.3.6.1.4.1.1466.109.114.2}.
+     *
+     * @return A reference to the {@code caseIgnoreIA5Match} Matching Rule.
+     */
+    public static MatchingRule getCaseIgnoreIA5MatchingRule() {
+        return CASE_IGNORE_IA5_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseIgnoreIA5SubstringsMatch} Matching
+     * Rule which has the OID {@code 1.3.6.1.4.1.1466.109.114.3}.
+     *
+     * @return A reference to the {@code caseIgnoreIA5SubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getCaseIgnoreIA5SubstringsMatchingRule() {
+        return CASE_IGNORE_IA5_SUBSTRINGS_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseIgnoreListMatch} Matching Rule
+     * which has the OID {@code 2.5.13.11}.
+     *
+     * @return A reference to the {@code caseIgnoreListMatch} Matching Rule.
+     */
+    public static MatchingRule getCaseIgnoreListMatchingRule() {
+        return CASE_IGNORE_LIST_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code authPassword} Attribute Type which has
-   * the OID {@code 1.3.6.1.4.1.4203.1.3.4}.
-   *
-   * @return A reference to the {@code authPassword} Attribute Type.
-   */
-  public static AttributeType getAuthPasswordAttributeType()
-  {
-    return AUTH_PASSWORD_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code caseIgnoreListSubstringsMatch} Matching
+     * Rule which has the OID {@code 2.5.13.12}.
+     *
+     * @return A reference to the {@code caseIgnoreListSubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getCaseIgnoreListSubstringsMatchingRule() {
+        return CASE_IGNORE_LIST_SUBSTRINGS_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseIgnoreMatch} Matching Rule which
+     * has the OID {@code 2.5.13.2}.
+     *
+     * @return A reference to the {@code caseIgnoreMatch} Matching Rule.
+     */
+    public static MatchingRule getCaseIgnoreMatchingRule() {
+        return CASE_IGNORE_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code caseIgnoreOrderingMatch} Matching Rule
+     * which has the OID {@code 2.5.13.3}.
+     *
+     * @return A reference to the {@code caseIgnoreOrderingMatch} Matching Rule.
+     */
+    public static MatchingRule getCaseIgnoreOrderingMatchingRule() {
+        return CASE_IGNORE_ORDERING_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code authPasswordExactMatch} Matching Rule
-   * which has the OID {@code 1.3.6.1.4.1.4203.1.2.2}.
-   *
-   * @return A reference to the {@code authPasswordExactMatch} Matching Rule.
-   */
-  public static MatchingRule getAuthPasswordExactMatchingRule()
-  {
-    return AUTH_PASSWORD_EXACT_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code caseIgnoreSubstringsMatch} Matching
+     * Rule which has the OID {@code 2.5.13.4}.
+     *
+     * @return A reference to the {@code caseIgnoreSubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getCaseIgnoreSubstringsMatchingRule() {
+        return CASE_IGNORE_SUBSTRINGS_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code c} Attribute Type which has the OID
+     * {@code 2.5.4.6}.
+     *
+     * @return A reference to the {@code c} Attribute Type.
+     */
+    public static AttributeType getCAttributeType() {
+        return C_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Certificate List Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.9}.
+     *
+     * @return A reference to the {@code Certificate List Syntax}.
+     */
+    public static Syntax getCertificateListSyntax() {
+        return CERTIFICATE_LIST_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code authPasswordObject} Object Class which
-   * has the OID {@code 1.3.6.1.4.1.4203.1.4.7}.
-   *
-   * @return A reference to the {@code authPasswordObject} Object Class.
-   */
-  public static ObjectClass getAuthPasswordObjectObjectClass()
-  {
-    return AUTH_PASSWORD_OBJECT_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code Certificate Pair Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.10}.
+     *
+     * @return A reference to the {@code Certificate Pair Syntax}.
+     */
+    public static Syntax getCertificatePairSyntax() {
+        return CERTIFICATE_PAIR_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code Certificate Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.8}.
+     *
+     * @return A reference to the {@code Certificate Syntax}.
+     */
+    public static Syntax getCertificateSyntax() {
+        return CERTIFICATE_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code cn} Attribute Type which has the OID
+     * {@code 2.5.4.3}.
+     *
+     * @return A reference to the {@code cn} Attribute Type.
+     */
+    public static AttributeType getCNAttributeType() {
+        return CN_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Binary Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.5}.
-   *
-   * @return A reference to the {@code Binary Syntax}.
-   */
-  public static Syntax getBinarySyntax()
-  {
-    return BINARY_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code country} Object Class which has the OID
+     * {@code 2.5.6.2}.
+     *
+     * @return A reference to the {@code country} Object Class.
+     */
+    public static ObjectClass getCountryObjectClass() {
+        return COUNTRY_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code Country String Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.11}.
+     *
+     * @return A reference to the {@code Country String Syntax}.
+     */
+    public static Syntax getCountryStringSyntax() {
+        return COUNTRY_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code createTimestamp} Attribute Type which
+     * has the OID {@code 2.5.18.1}.
+     *
+     * @return A reference to the {@code createTimestamp} Attribute Type.
+     */
+    public static AttributeType getCreateTimestampAttributeType() {
+        return CREATE_TIMESTAMP_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code bitStringMatch} Matching Rule which has
-   * the OID {@code 2.5.13.16}.
-   *
-   * @return A reference to the {@code bitStringMatch} Matching Rule.
-   */
-  public static MatchingRule getBitStringMatchingRule()
-  {
-    return BIT_STRING_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code creatorsName} Attribute Type which has
+     * the OID {@code 2.5.18.3}.
+     *
+     * @return A reference to the {@code creatorsName} Attribute Type.
+     */
+    public static AttributeType getCreatorsNameAttributeType() {
+        return CREATORS_NAME_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code dc} Attribute Type which has the OID
+     * {@code 0.9.2342.19200300.100.1.25}.
+     *
+     * @return A reference to the {@code dc} Attribute Type.
+     */
+    public static AttributeType getDCAttributeType() {
+        return DC_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code dcObject} Object Class which has the
+     * OID {@code 1.3.6.1.4.1.1466.344}.
+     *
+     * @return A reference to the {@code dcObject} Object Class.
+     */
+    public static ObjectClass getDCObjectObjectClass() {
+        return DC_OBJECT_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code Bit String Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.6}.
-   *
-   * @return A reference to the {@code Bit String Syntax}.
-   */
-  public static Syntax getBitStringSyntax()
-  {
-    return BIT_STRING_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code Delivery Method Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.14}.
+     *
+     * @return A reference to the {@code Delivery Method Syntax}.
+     */
+    public static Syntax getDeliveryMethodSyntax() {
+        return DELIVERY_METHOD_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code description} Attribute Type which has
+     * the OID {@code 2.5.4.13}.
+     *
+     * @return A reference to the {@code description} Attribute Type.
+     */
+    public static AttributeType getDescriptionAttributeType() {
+        return DESCRIPTION_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code destinationIndicator} Attribute Type
+     * which has the OID {@code 2.5.4.27}.
+     *
+     * @return A reference to the {@code destinationIndicator} Attribute Type.
+     */
+    public static AttributeType getDestinationIndicatorAttributeType() {
+        return DESTINATION_INDICATOR_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code booleanMatch} Matching Rule which has the
-   * OID {@code 2.5.13.13}.
-   *
-   * @return A reference to the {@code booleanMatch} Matching Rule.
-   */
-  public static MatchingRule getBooleanMatchingRule()
-  {
-    return BOOLEAN_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code device} Object Class which has the OID
+     * {@code 2.5.6.14}.
+     *
+     * @return A reference to the {@code device} Object Class.
+     */
+    public static ObjectClass getDeviceObjectClass() {
+        return DEVICE_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code directoryStringFirstComponentMatch}
+     * Matching Rule which has the OID {@code 2.5.13.31}.
+     *
+     * @return A reference to the {@code directoryStringFirstComponentMatch}
+     *         Matching Rule.
+     */
+    public static MatchingRule getDirectoryStringFirstComponentMatchingRule() {
+        return DIRECTORY_STRING_FIRST_COMPONENT_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code Directory String Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.15}.
+     *
+     * @return A reference to the {@code Directory String Syntax}.
+     */
+    public static Syntax getDirectoryStringSyntax() {
+        return DIRECTORY_STRING_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code Boolean Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.7}.
-   *
-   * @return A reference to the {@code Boolean Syntax}.
-   */
-  public static Syntax getBooleanSyntax()
-  {
-    return BOOLEAN_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code distinguishedName} Attribute Type which
+     * has the OID {@code 2.5.4.49}.
+     *
+     * @return A reference to the {@code distinguishedName} Attribute Type.
+     */
+    public static AttributeType getDistinguishedNameAttributeType() {
+        return DISTINGUISHED_NAME_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code distinguishedNameMatch} Matching Rule
+     * which has the OID {@code 2.5.13.1}.
+     *
+     * @return A reference to the {@code distinguishedNameMatch} Matching Rule.
+     */
+    public static MatchingRule getDistinguishedNameMatchingRule() {
+        return DISTINGUISHED_NAME_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code DIT Content Rule Description Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.16}.
+     *
+     * @return A reference to the {@code DIT Content Rule Description Syntax}.
+     */
+    public static Syntax getDITContentRuleDescriptionSyntax() {
+        return DIT_CONTENT_RULE_DESCRIPTION_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code businessCategory} Attribute Type which
-   * has the OID {@code 2.5.4.15}.
-   *
-   * @return A reference to the {@code businessCategory} Attribute Type.
-   */
-  public static AttributeType getBusinessCategoryAttributeType()
-  {
-    return BUSINESS_CATEGORY_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code ditContentRules} Attribute Type which
+     * has the OID {@code 2.5.21.2}.
+     *
+     * @return A reference to the {@code ditContentRules} Attribute Type.
+     */
+    public static AttributeType getDITContentRulesAttributeType() {
+        return DIT_CONTENT_RULES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code DIT Structure Rule Description Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.17}.
+     *
+     * @return A reference to the {@code DIT Structure Rule Description Syntax}.
+     */
+    public static Syntax getDITStructureRuleDescriptionSyntax() {
+        return DIT_STRUCTURE_RULE_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code ditStructureRules} Attribute Type which
+     * has the OID {@code 2.5.21.1}.
+     *
+     * @return A reference to the {@code ditStructureRules} Attribute Type.
+     */
+    public static AttributeType getDITStructureRulesAttributeType() {
+        return DIT_STRUCTURE_RULES_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseExactIA5Match} Matching Rule which
-   * has the OID {@code 1.3.6.1.4.1.1466.109.114.1}.
-   *
-   * @return A reference to the {@code caseExactIA5Match} Matching Rule.
-   */
-  public static MatchingRule getCaseExactIA5MatchingRule()
-  {
-    return CASE_EXACT_IA5_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code dnQualifier} Attribute Type which has
+     * the OID {@code 2.5.4.46}.
+     *
+     * @return A reference to the {@code dnQualifier} Attribute Type.
+     */
+    public static AttributeType getDNQualifierAttributeType() {
+        return DN_QUALIFIER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code DN Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.12}.
+     *
+     * @return A reference to the {@code DN Syntax}.
+     */
+    public static Syntax getDNSyntax() {
+        return DN_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code Enhanced Guide Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.21}.
+     *
+     * @return A reference to the {@code Enhanced Guide Syntax}.
+     */
+    public static Syntax getEnhancedGuideSyntax() {
+        return ENHANCED_GUIDE_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code caseExactMatch} Matching Rule which has
-   * the OID {@code 2.5.13.5}.
-   *
-   * @return A reference to the {@code caseExactMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseExactMatchingRule()
-  {
-    return CASE_EXACT_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code enhancedSearchGuide} Attribute Type
+     * which has the OID {@code 2.5.4.47}.
+     *
+     * @return A reference to the {@code enhancedSearchGuide} Attribute Type.
+     */
+    public static AttributeType getEnhancedSearchGuideAttributeType() {
+        return ENHANCED_SEARCH_GUIDE_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code entryUUID} Attribute Type which has the
+     * OID {@code 1.3.6.1.1.16.4}.
+     *
+     * @return A reference to the {@code entryUUID} Attribute Type.
+     */
+    public static AttributeType getEntryUUIDAttributeType() {
+        return ENTRY_UUID_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code extensibleObject} Object Class which
+     * has the OID {@code 1.3.6.1.4.1.1466.101.120.111}.
+     *
+     * @return A reference to the {@code extensibleObject} Object Class.
+     */
+    public static ObjectClass getExtensibleObjectObjectClass() {
+        return EXTENSIBLE_OBJECT_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code caseExactOrderingMatch} Matching Rule
-   * which has the OID {@code 2.5.13.6}.
-   *
-   * @return A reference to the {@code caseExactOrderingMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseExactOrderingMatchingRule()
-  {
-    return CASE_EXACT_ORDERING_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code facsimileTelephoneNumber} Attribute
+     * Type which has the OID {@code 2.5.4.23}.
+     *
+     * @return A reference to the {@code facsimileTelephoneNumber} Attribute
+     *         Type.
+     */
+    public static AttributeType getFacsimileTelephoneNumberAttributeType() {
+        return FACSIMILE_TELEPHONE_NUMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Facsimile Telephone Number Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.22}.
+     *
+     * @return A reference to the {@code Facsimile Telephone Number Syntax}.
+     */
+    public static Syntax getFacsimileTelephoneNumberSyntax() {
+        return FACSIMILE_TELEPHONE_NUMBER_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code Fax Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.23}.
+     *
+     * @return A reference to the {@code Fax Syntax}.
+     */
+    public static Syntax getFaxSyntax() {
+        return FAX_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code caseExactSubstringsMatch} Matching Rule
-   * which has the OID {@code 2.5.13.7}.
-   *
-   * @return A reference to the {@code caseExactSubstringsMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseExactSubstringsMatchingRule()
-  {
-    return CASE_EXACT_SUBSTRINGS_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code generalizedTimeMatch} Matching Rule
+     * which has the OID {@code 2.5.13.27}.
+     *
+     * @return A reference to the {@code generalizedTimeMatch} Matching Rule.
+     */
+    public static MatchingRule getGeneralizedTimeMatchingRule() {
+        return GENERALIZED_TIME_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code generalizedTimeOrderingMatch} Matching
+     * Rule which has the OID {@code 2.5.13.28}.
+     *
+     * @return A reference to the {@code generalizedTimeOrderingMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getGeneralizedTimeOrderingMatchingRule() {
+        return GENERALIZED_TIME_ORDERING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code Generalized Time Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.24}.
+     *
+     * @return A reference to the {@code Generalized Time Syntax}.
+     */
+    public static Syntax getGeneralizedTimeSyntax() {
+        return GENERALIZED_TIME_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreIA5Match} Matching Rule which
-   * has the OID {@code 1.3.6.1.4.1.1466.109.114.2}.
-   *
-   * @return A reference to the {@code caseIgnoreIA5Match} Matching Rule.
-   */
-  public static MatchingRule getCaseIgnoreIA5MatchingRule()
-  {
-    return CASE_IGNORE_IA5_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code generationQualifier} Attribute Type
+     * which has the OID {@code 2.5.4.44}.
+     *
+     * @return A reference to the {@code generationQualifier} Attribute Type.
+     */
+    public static AttributeType getGenerationQualifierAttributeType() {
+        return GENERATION_QUALIFIER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code givenName} Attribute Type which has the
+     * OID {@code 2.5.4.42}.
+     *
+     * @return A reference to the {@code givenName} Attribute Type.
+     */
+    public static AttributeType getGivenNameAttributeType() {
+        return GIVEN_NAME_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code governingStructureRule} Attribute Type
+     * which has the OID {@code 2.5.21.10}.
+     *
+     * @return A reference to the {@code governingStructureRule} Attribute Type.
+     */
+    public static AttributeType getGoverningStructureRuleAttributeType() {
+        return GOVERNING_STRUCTURE_RULE_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreIA5SubstringsMatch} Matching
-   * Rule which has the OID {@code 1.3.6.1.4.1.1466.109.114.3}.
-   *
-   * @return A reference to the {@code caseIgnoreIA5SubstringsMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getCaseIgnoreIA5SubstringsMatchingRule()
-  {
-    return CASE_IGNORE_IA5_SUBSTRINGS_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code groupOfNames} Object Class which has
+     * the OID {@code 2.5.6.9}.
+     *
+     * @return A reference to the {@code groupOfNames} Object Class.
+     */
+    public static ObjectClass getGroupOfNamesObjectClass() {
+        return GROUP_OF_NAMES_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code groupOfUniqueNames} Object Class which
+     * has the OID {@code 2.5.6.17}.
+     *
+     * @return A reference to the {@code groupOfUniqueNames} Object Class.
+     */
+    public static ObjectClass getGroupOfUniqueNamesObjectClass() {
+        return GROUP_OF_UNIQUE_NAMES_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code Guide Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.25}.
+     *
+     * @return A reference to the {@code Guide Syntax}.
+     */
+    public static Syntax getGuideSyntax() {
+        return GUIDE_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreListMatch} Matching Rule which
-   * has the OID {@code 2.5.13.11}.
-   *
-   * @return A reference to the {@code caseIgnoreListMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseIgnoreListMatchingRule()
-  {
-    return CASE_IGNORE_LIST_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code houseIdentifier} Attribute Type which
+     * has the OID {@code 2.5.4.51}.
+     *
+     * @return A reference to the {@code houseIdentifier} Attribute Type.
+     */
+    public static AttributeType getHouseIdentifierAttributeType() {
+        return HOUSE_IDENTIFIER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code IA5 String Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.26}.
+     *
+     * @return A reference to the {@code IA5 String Syntax}.
+     */
+    public static Syntax getIA5StringSyntax() {
+        return IA5_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code initials} Attribute Type which has the
+     * OID {@code 2.5.4.43}.
+     *
+     * @return A reference to the {@code initials} Attribute Type.
+     */
+    public static AttributeType getInitialsAttributeType() {
+        return INITIALS_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreListSubstringsMatch} Matching
-   * Rule which has the OID {@code 2.5.13.12}.
-   *
-   * @return A reference to the {@code caseIgnoreListSubstringsMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getCaseIgnoreListSubstringsMatchingRule()
-  {
-    return CASE_IGNORE_LIST_SUBSTRINGS_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the singleton core schema.
+     *
+     * @return The core schema.
+     */
+    public static Schema getInstance() {
+        return CoreSchemaImpl.getInstance();
+    }
 
+    /**
+     * Returns a reference to the {@code integerFirstComponentMatch} Matching
+     * Rule which has the OID {@code 2.5.13.29}.
+     *
+     * @return A reference to the {@code integerFirstComponentMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getIntegerFirstComponentMatchingRule() {
+        return INTEGER_FIRST_COMPONENT_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code integerMatch} Matching Rule which has
+     * the OID {@code 2.5.13.14}.
+     *
+     * @return A reference to the {@code integerMatch} Matching Rule.
+     */
+    public static MatchingRule getIntegerMatchingRule() {
+        return INTEGER_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreMatch} Matching Rule which has
-   * the OID {@code 2.5.13.2}.
-   *
-   * @return A reference to the {@code caseIgnoreMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseIgnoreMatchingRule()
-  {
-    return CASE_IGNORE_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code integerOrderingMatch} Matching Rule
+     * which has the OID {@code 2.5.13.15}.
+     *
+     * @return A reference to the {@code integerOrderingMatch} Matching Rule.
+     */
+    public static MatchingRule getIntegerOrderingMatchingRule() {
+        return INTEGER_ORDERING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code Integer Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.27}.
+     *
+     * @return A reference to the {@code Integer Syntax}.
+     */
+    public static Syntax getIntegerSyntax() {
+        return INTEGER_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code internationalISDNNumber} Attribute Type
+     * which has the OID {@code 2.5.4.25}.
+     *
+     * @return A reference to the {@code internationalISDNNumber} Attribute
+     *         Type.
+     */
+    public static AttributeType getInternationalISDNNumberAttributeType() {
+        return INTERNATIONAL_ISDN_NUMBER_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreOrderingMatch} Matching Rule
-   * which has the OID {@code 2.5.13.3}.
-   *
-   * @return A reference to the {@code caseIgnoreOrderingMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseIgnoreOrderingMatchingRule()
-  {
-    return CASE_IGNORE_ORDERING_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code JPEG Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.28}.
+     *
+     * @return A reference to the {@code JPEG Syntax}.
+     */
+    public static Syntax getJPEGSyntax() {
+        return JPEG_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code keywordMatch} Matching Rule which has
+     * the OID {@code 2.5.13.33}.
+     *
+     * @return A reference to the {@code keywordMatch} Matching Rule.
+     */
+    public static MatchingRule getKeywordMatchingRule() {
+        return KEYWORD_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code l} Attribute Type which has the OID
+     * {@code 2.5.4.7}.
+     *
+     * @return A reference to the {@code l} Attribute Type.
+     */
+    public static AttributeType getLAttributeType() {
+        return L_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code caseIgnoreSubstringsMatch} Matching Rule
-   * which has the OID {@code 2.5.13.4}.
-   *
-   * @return A reference to the {@code caseIgnoreSubstringsMatch} Matching Rule.
-   */
-  public static MatchingRule getCaseIgnoreSubstringsMatchingRule()
-  {
-    return CASE_IGNORE_SUBSTRINGS_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code LDAP Syntax Description Syntax} which
+     * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.54}.
+     *
+     * @return A reference to the {@code LDAP Syntax Description Syntax}.
+     */
+    public static Syntax getLDAPSyntaxDescriptionSyntax() {
+        return LDAP_SYNTAX_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code ldapSyntaxes} Attribute Type which has
+     * the OID {@code 1.3.6.1.4.1.1466.101.120.16}.
+     *
+     * @return A reference to the {@code ldapSyntaxes} Attribute Type.
+     */
+    public static AttributeType getLDAPSyntaxesAttributeType() {
+        return LDAP_SYNTAXES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code locality} Object Class which has the
+     * OID {@code 2.5.6.3}.
+     *
+     * @return A reference to the {@code locality} Object Class.
+     */
+    public static ObjectClass getLocalityObjectClass() {
+        return LOCALITY_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code c} Attribute Type which has the OID
-   * {@code 2.5.4.6}.
-   *
-   * @return A reference to the {@code c} Attribute Type.
-   */
-  public static AttributeType getCAttributeType()
-  {
-    return C_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code Matching Rule Description Syntax} which
+     * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.30}.
+     *
+     * @return A reference to the {@code Matching Rule Description Syntax}.
+     */
+    public static Syntax getMatchingRuleDescriptionSyntax() {
+        return MATCHING_RULE_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code matchingRules} Attribute Type which has
+     * the OID {@code 2.5.21.4}.
+     *
+     * @return A reference to the {@code matchingRules} Attribute Type.
+     */
+    public static AttributeType getMatchingRulesAttributeType() {
+        return MATCHING_RULES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code matchingRuleUse} Attribute Type which
+     * has the OID {@code 2.5.21.8}.
+     *
+     * @return A reference to the {@code matchingRuleUse} Attribute Type.
+     */
+    public static AttributeType getMatchingRuleUseAttributeType() {
+        return MATCHING_RULE_USE_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Certificate List Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.9}.
-   *
-   * @return A reference to the {@code Certificate List Syntax}.
-   */
-  public static Syntax getCertificateListSyntax()
-  {
-    return CERTIFICATE_LIST_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code Matching Rule Use Description Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.31}.
+     *
+     * @return A reference to the {@code Matching Rule Use Description Syntax}.
+     */
+    public static Syntax getMatchingRuleUseDescriptionSyntax() {
+        return MATCHING_RULE_USE_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code member} Attribute Type which has the
+     * OID {@code 2.5.4.31}.
+     *
+     * @return A reference to the {@code member} Attribute Type.
+     */
+    public static AttributeType getMemberAttributeType() {
+        return MEMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code modifiersName} Attribute Type which has
+     * the OID {@code 2.5.18.4}.
+     *
+     * @return A reference to the {@code modifiersName} Attribute Type.
+     */
+    public static AttributeType getModifiersNameAttributeType() {
+        return MODIFIERS_NAME_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Certificate Pair Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.10}.
-   *
-   * @return A reference to the {@code Certificate Pair Syntax}.
-   */
-  public static Syntax getCertificatePairSyntax()
-  {
-    return CERTIFICATE_PAIR_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code modifyTimestamp} Attribute Type which
+     * has the OID {@code 2.5.18.2}.
+     *
+     * @return A reference to the {@code modifyTimestamp} Attribute Type.
+     */
+    public static AttributeType getModifyTimestampAttributeType() {
+        return MODIFY_TIMESTAMP_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Name and Optional UID Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.34}.
+     *
+     * @return A reference to the {@code Name and Optional UID Syntax}.
+     */
+    public static Syntax getNameAndOptionalUIDSyntax() {
+        return NAME_AND_OPTIONAL_UID_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code name} Attribute Type which has the OID
+     * {@code 2.5.4.41}.
+     *
+     * @return A reference to the {@code name} Attribute Type.
+     */
+    public static AttributeType getNameAttributeType() {
+        return NAME_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Certificate Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.8}.
-   *
-   * @return A reference to the {@code Certificate Syntax}.
-   */
-  public static Syntax getCertificateSyntax()
-  {
-    return CERTIFICATE_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code Name Form Description Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.35}.
+     *
+     * @return A reference to the {@code Name Form Description Syntax}.
+     */
+    public static Syntax getNameFormDescriptionSyntax() {
+        return NAME_FORM_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code nameForms} Attribute Type which has the
+     * OID {@code 2.5.21.7}.
+     *
+     * @return A reference to the {@code nameForms} Attribute Type.
+     */
+    public static AttributeType getNameFormsAttributeType() {
+        return NAME_FORMS_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code namingContexts} Attribute Type which
+     * has the OID {@code 1.3.6.1.4.1.1466.101.120.5}.
+     *
+     * @return A reference to the {@code namingContexts} Attribute Type.
+     */
+    public static AttributeType getNamingContextsAttributeType() {
+        return NAMING_CONTEXTS_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code cn} Attribute Type which has the OID
-   * {@code 2.5.4.3}.
-   *
-   * @return A reference to the {@code cn} Attribute Type.
-   */
-  public static AttributeType getCNAttributeType()
-  {
-    return CN_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code numericStringMatch} Matching Rule which
+     * has the OID {@code 2.5.13.8}.
+     *
+     * @return A reference to the {@code numericStringMatch} Matching Rule.
+     */
+    public static MatchingRule getNumericStringMatchingRule() {
+        return NUMERIC_STRING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code numericStringOrderingMatch} Matching
+     * Rule which has the OID {@code 2.5.13.9}.
+     *
+     * @return A reference to the {@code numericStringOrderingMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getNumericStringOrderingMatchingRule() {
+        return NUMERIC_STRING_ORDERING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code numericStringSubstringsMatch} Matching
+     * Rule which has the OID {@code 2.5.13.10}.
+     *
+     * @return A reference to the {@code numericStringSubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getNumericStringSubstringsMatchingRule() {
+        return NUMERIC_STRING_SUBSTRINGS_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code country} Object Class which has the OID
-   * {@code 2.5.6.2}.
-   *
-   * @return A reference to the {@code country} Object Class.
-   */
-  public static ObjectClass getCountryObjectClass()
-  {
-    return COUNTRY_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code Numeric String Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.36}.
+     *
+     * @return A reference to the {@code Numeric String Syntax}.
+     */
+    public static Syntax getNumericStringSyntax() {
+        return NUMERIC_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code o} Attribute Type which has the OID
+     * {@code 2.5.4.10}.
+     *
+     * @return A reference to the {@code o} Attribute Type.
+     */
+    public static AttributeType getOAttributeType() {
+        return O_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code objectClass} Attribute Type which has
+     * the OID {@code 2.5.4.0}.
+     *
+     * @return A reference to the {@code objectClass} Attribute Type.
+     */
+    public static AttributeType getObjectClassAttributeType() {
+        return OBJECT_CLASS_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Country String Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.11}.
-   *
-   * @return A reference to the {@code Country String Syntax}.
-   */
-  public static Syntax getCountryStringSyntax()
-  {
-    return COUNTRY_STRING_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code Object Class Description Syntax} which
+     * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.37}.
+     *
+     * @return A reference to the {@code Object Class Description Syntax}.
+     */
+    public static Syntax getObjectClassDescriptionSyntax() {
+        return OBJECT_CLASS_DESCRIPTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code objectClasses} Attribute Type which has
+     * the OID {@code 2.5.21.6}.
+     *
+     * @return A reference to the {@code objectClasses} Attribute Type.
+     */
+    public static AttributeType getObjectClassesAttributeType() {
+        return OBJECT_CLASSES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code objectIdentifierFirstComponentMatch}
+     * Matching Rule which has the OID {@code 2.5.13.30}.
+     *
+     * @return A reference to the {@code objectIdentifierFirstComponentMatch}
+     *         Matching Rule.
+     */
+    public static MatchingRule getObjectIdentifierFirstComponentMatchingRule() {
+        return OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code createTimestamp} Attribute Type which has
-   * the OID {@code 2.5.18.1}.
-   *
-   * @return A reference to the {@code createTimestamp} Attribute Type.
-   */
-  public static AttributeType getCreateTimestampAttributeType()
-  {
-    return CREATE_TIMESTAMP_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code objectIdentifierMatch} Matching Rule
+     * which has the OID {@code 2.5.13.0}.
+     *
+     * @return A reference to the {@code objectIdentifierMatch} Matching Rule.
+     */
+    public static MatchingRule getObjectIdentifierMatchingRule() {
+        return OBJECT_IDENTIFIER_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code octetStringMatch} Matching Rule which
+     * has the OID {@code 2.5.13.17}.
+     *
+     * @return A reference to the {@code octetStringMatch} Matching Rule.
+     */
+    public static MatchingRule getOctetStringMatchingRule() {
+        return OCTET_STRING_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code octetStringOrderingMatch} Matching Rule
+     * which has the OID {@code 2.5.13.18}.
+     *
+     * @return A reference to the {@code octetStringOrderingMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getOctetStringOrderingMatchingRule() {
+        return OCTET_STRING_ORDERING_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code creatorsName} Attribute Type which has
-   * the OID {@code 2.5.18.3}.
-   *
-   * @return A reference to the {@code creatorsName} Attribute Type.
-   */
-  public static AttributeType getCreatorsNameAttributeType()
-  {
-    return CREATORS_NAME_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code octetStringSubstringsMatch} Matching
+     * Rule which has the OID {@code 2.5.13.19}.
+     *
+     * @return A reference to the {@code octetStringSubstringsMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getOctetStringSubstringsMatchingRule() {
+        return OCTET_STRING_SUBSTRINGS_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code Octet String Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.40}.
+     *
+     * @return A reference to the {@code Octet String Syntax}.
+     */
+    public static Syntax getOctetStringSyntax() {
+        return OCTET_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code OID Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.38}.
+     *
+     * @return A reference to the {@code OID Syntax}.
+     */
+    public static Syntax getOIDSyntax() {
+        return OID_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code dc} Attribute Type which has the OID
-   * {@code 0.9.2342.19200300.100.1.25}.
-   *
-   * @return A reference to the {@code dc} Attribute Type.
-   */
-  public static AttributeType getDCAttributeType()
-  {
-    return DC_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code organizationalPerson} Object Class
+     * which has the OID {@code 2.5.6.7}.
+     *
+     * @return A reference to the {@code organizationalPerson} Object Class.
+     */
+    public static ObjectClass getOrganizationalPersonObjectClass() {
+        return ORGANIZATIONAL_PERSON_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code organizationalRole} Object Class which
+     * has the OID {@code 2.5.6.8}.
+     *
+     * @return A reference to the {@code organizationalRole} Object Class.
+     */
+    public static ObjectClass getOrganizationalRoleObjectClass() {
+        return ORGANIZATIONAL_ROLE_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code organizationalUnit} Object Class which
+     * has the OID {@code 2.5.6.5}.
+     *
+     * @return A reference to the {@code organizationalUnit} Object Class.
+     */
+    public static ObjectClass getOrganizationalUnitObjectClass() {
+        return ORGANIZATIONAL_UNIT_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code dcObject} Object Class which has the OID
-   * {@code 1.3.6.1.4.1.1466.344}.
-   *
-   * @return A reference to the {@code dcObject} Object Class.
-   */
-  public static ObjectClass getDCObjectObjectClass()
-  {
-    return DC_OBJECT_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code organization} Object Class which has
+     * the OID {@code 2.5.6.4}.
+     *
+     * @return A reference to the {@code organization} Object Class.
+     */
+    public static ObjectClass getOrganizationObjectClass() {
+        return ORGANIZATION_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code Other Mailbox Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.39}.
+     *
+     * @return A reference to the {@code Other Mailbox Syntax}.
+     */
+    public static Syntax getOtherMailboxSyntax() {
+        return OTHER_MAILBOX_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code ou} Attribute Type which has the OID
+     * {@code 2.5.4.11}.
+     *
+     * @return A reference to the {@code ou} Attribute Type.
+     */
+    public static AttributeType getOUAttributeType() {
+        return OU_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Delivery Method Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.14}.
-   *
-   * @return A reference to the {@code Delivery Method Syntax}.
-   */
-  public static Syntax getDeliveryMethodSyntax()
-  {
-    return DELIVERY_METHOD_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code owner} Attribute Type which has the OID
+     * {@code 2.5.4.32}.
+     *
+     * @return A reference to the {@code owner} Attribute Type.
+     */
+    public static AttributeType getOwnerAttributeType() {
+        return OWNER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code person} Object Class which has the OID
+     * {@code 2.5.6.6}.
+     *
+     * @return A reference to the {@code person} Object Class.
+     */
+    public static ObjectClass getPersonObjectClass() {
+        return PERSON_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code physicalDeliveryOfficeName} Attribute
+     * Type which has the OID {@code 2.5.4.19}.
+     *
+     * @return A reference to the {@code physicalDeliveryOfficeName} Attribute
+     *         Type.
+     */
+    public static AttributeType getPhysicalDeliveryOfficeNameAttributeType() {
+        return PHYSICAL_DELIVERY_OFFICE_NAME_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code description} Attribute Type which has the
-   * OID {@code 2.5.4.13}.
-   *
-   * @return A reference to the {@code description} Attribute Type.
-   */
-  public static AttributeType getDescriptionAttributeType()
-  {
-    return DESCRIPTION_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code destinationIndicator} Attribute Type
-   * which has the OID {@code 2.5.4.27}.
-   *
-   * @return A reference to the {@code destinationIndicator} Attribute Type.
-   */
-  public static AttributeType getDestinationIndicatorAttributeType()
-  {
-    return DESTINATION_INDICATOR_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code device} Object Class which has the OID
-   * {@code 2.5.6.14}.
-   *
-   * @return A reference to the {@code device} Object Class.
-   */
-  public static ObjectClass getDeviceObjectClass()
-  {
-    return DEVICE_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code directoryStringFirstComponentMatch}
-   * Matching Rule which has the OID {@code 2.5.13.31}.
-   *
-   * @return A reference to the {@code directoryStringFirstComponentMatch}
-   *         Matching Rule.
-   */
-  public static MatchingRule getDirectoryStringFirstComponentMatchingRule()
-  {
-    return DIRECTORY_STRING_FIRST_COMPONENT_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Directory String Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.15}.
-   *
-   * @return A reference to the {@code Directory String Syntax}.
-   */
-  public static Syntax getDirectoryStringSyntax()
-  {
-    return DIRECTORY_STRING_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code distinguishedName} Attribute Type which
-   * has the OID {@code 2.5.4.49}.
-   *
-   * @return A reference to the {@code distinguishedName} Attribute Type.
-   */
-  public static AttributeType getDistinguishedNameAttributeType()
-  {
-    return DISTINGUISHED_NAME_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code distinguishedNameMatch} Matching Rule
-   * which has the OID {@code 2.5.13.1}.
-   *
-   * @return A reference to the {@code distinguishedNameMatch} Matching Rule.
-   */
-  public static MatchingRule getDistinguishedNameMatchingRule()
-  {
-    return DISTINGUISHED_NAME_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code DIT Content Rule Description Syntax}
-   * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.16}.
-   *
-   * @return A reference to the {@code DIT Content Rule Description Syntax}.
-   */
-  public static Syntax getDITContentRuleDescriptionSyntax()
-  {
-    return DIT_CONTENT_RULE_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code ditContentRules} Attribute Type which has
-   * the OID {@code 2.5.21.2}.
-   *
-   * @return A reference to the {@code ditContentRules} Attribute Type.
-   */
-  public static AttributeType getDITContentRulesAttributeType()
-  {
-    return DIT_CONTENT_RULES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code DIT Structure Rule Description Syntax}
-   * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.17}.
-   *
-   * @return A reference to the {@code DIT Structure Rule Description Syntax}.
-   */
-  public static Syntax getDITStructureRuleDescriptionSyntax()
-  {
-    return DIT_STRUCTURE_RULE_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code ditStructureRules} Attribute Type which
-   * has the OID {@code 2.5.21.1}.
-   *
-   * @return A reference to the {@code ditStructureRules} Attribute Type.
-   */
-  public static AttributeType getDITStructureRulesAttributeType()
-  {
-    return DIT_STRUCTURE_RULES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code dnQualifier} Attribute Type which has the
-   * OID {@code 2.5.4.46}.
-   *
-   * @return A reference to the {@code dnQualifier} Attribute Type.
-   */
-  public static AttributeType getDNQualifierAttributeType()
-  {
-    return DN_QUALIFIER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code DN Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.12}.
-   *
-   * @return A reference to the {@code DN Syntax}.
-   */
-  public static Syntax getDNSyntax()
-  {
-    return DN_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Enhanced Guide Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.21}.
-   *
-   * @return A reference to the {@code Enhanced Guide Syntax}.
-   */
-  public static Syntax getEnhancedGuideSyntax()
-  {
-    return ENHANCED_GUIDE_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code enhancedSearchGuide} Attribute Type which
-   * has the OID {@code 2.5.4.47}.
-   *
-   * @return A reference to the {@code enhancedSearchGuide} Attribute Type.
-   */
-  public static AttributeType getEnhancedSearchGuideAttributeType()
-  {
-    return ENHANCED_SEARCH_GUIDE_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code entryUUID} Attribute Type which has the
-   * OID {@code 1.3.6.1.1.16.4}.
-   *
-   * @return A reference to the {@code entryUUID} Attribute Type.
-   */
-  public static AttributeType getEntryUUIDAttributeType()
-  {
-    return ENTRY_UUID_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code extensibleObject} Object Class which has
-   * the OID {@code 1.3.6.1.4.1.1466.101.120.111}.
-   *
-   * @return A reference to the {@code extensibleObject} Object Class.
-   */
-  public static ObjectClass getExtensibleObjectObjectClass()
-  {
-    return EXTENSIBLE_OBJECT_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code facsimileTelephoneNumber} Attribute Type
-   * which has the OID {@code 2.5.4.23}.
-   *
-   * @return A reference to the {@code facsimileTelephoneNumber} Attribute Type.
-   */
-  public static AttributeType getFacsimileTelephoneNumberAttributeType()
-  {
-    return FACSIMILE_TELEPHONE_NUMBER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Facsimile Telephone Number Syntax} which
-   * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.22}.
-   *
-   * @return A reference to the {@code Facsimile Telephone Number Syntax}.
-   */
-  public static Syntax getFacsimileTelephoneNumberSyntax()
-  {
-    return FACSIMILE_TELEPHONE_NUMBER_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Fax Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.23}.
-   *
-   * @return A reference to the {@code Fax Syntax}.
-   */
-  public static Syntax getFaxSyntax()
-  {
-    return FAX_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code generalizedTimeMatch} Matching Rule which
-   * has the OID {@code 2.5.13.27}.
-   *
-   * @return A reference to the {@code generalizedTimeMatch} Matching Rule.
-   */
-  public static MatchingRule getGeneralizedTimeMatchingRule()
-  {
-    return GENERALIZED_TIME_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code generalizedTimeOrderingMatch} Matching
-   * Rule which has the OID {@code 2.5.13.28}.
-   *
-   * @return A reference to the {@code generalizedTimeOrderingMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getGeneralizedTimeOrderingMatchingRule()
-  {
-    return GENERALIZED_TIME_ORDERING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Generalized Time Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.24}.
-   *
-   * @return A reference to the {@code Generalized Time Syntax}.
-   */
-  public static Syntax getGeneralizedTimeSyntax()
-  {
-    return GENERALIZED_TIME_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code generationQualifier} Attribute Type which
-   * has the OID {@code 2.5.4.44}.
-   *
-   * @return A reference to the {@code generationQualifier} Attribute Type.
-   */
-  public static AttributeType getGenerationQualifierAttributeType()
-  {
-    return GENERATION_QUALIFIER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code givenName} Attribute Type which has the
-   * OID {@code 2.5.4.42}.
-   *
-   * @return A reference to the {@code givenName} Attribute Type.
-   */
-  public static AttributeType getGivenNameAttributeType()
-  {
-    return GIVEN_NAME_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code governingStructureRule} Attribute Type
-   * which has the OID {@code 2.5.21.10}.
-   *
-   * @return A reference to the {@code governingStructureRule} Attribute Type.
-   */
-  public static AttributeType getGoverningStructureRuleAttributeType()
-  {
-    return GOVERNING_STRUCTURE_RULE_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code groupOfNames} Object Class which has the
-   * OID {@code 2.5.6.9}.
-   *
-   * @return A reference to the {@code groupOfNames} Object Class.
-   */
-  public static ObjectClass getGroupOfNamesObjectClass()
-  {
-    return GROUP_OF_NAMES_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code groupOfUniqueNames} Object Class which
-   * has the OID {@code 2.5.6.17}.
-   *
-   * @return A reference to the {@code groupOfUniqueNames} Object Class.
-   */
-  public static ObjectClass getGroupOfUniqueNamesObjectClass()
-  {
-    return GROUP_OF_UNIQUE_NAMES_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Guide Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.25}.
-   *
-   * @return A reference to the {@code Guide Syntax}.
-   */
-  public static Syntax getGuideSyntax()
-  {
-    return GUIDE_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code houseIdentifier} Attribute Type which has
-   * the OID {@code 2.5.4.51}.
-   *
-   * @return A reference to the {@code houseIdentifier} Attribute Type.
-   */
-  public static AttributeType getHouseIdentifierAttributeType()
-  {
-    return HOUSE_IDENTIFIER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code IA5 String Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.26}.
-   *
-   * @return A reference to the {@code IA5 String Syntax}.
-   */
-  public static Syntax getIA5StringSyntax()
-  {
-    return IA5_STRING_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code initials} Attribute Type which has the
-   * OID {@code 2.5.4.43}.
-   *
-   * @return A reference to the {@code initials} Attribute Type.
-   */
-  public static AttributeType getInitialsAttributeType()
-  {
-    return INITIALS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the singleton core schema.
-   *
-   * @return The core schema.
-   */
-  public static Schema getInstance()
-  {
-    return CoreSchemaImpl.getInstance();
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code integerFirstComponentMatch} Matching Rule
-   * which has the OID {@code 2.5.13.29}.
-   *
-   * @return A reference to the {@code integerFirstComponentMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getIntegerFirstComponentMatchingRule()
-  {
-    return INTEGER_FIRST_COMPONENT_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code integerMatch} Matching Rule which has the
-   * OID {@code 2.5.13.14}.
-   *
-   * @return A reference to the {@code integerMatch} Matching Rule.
-   */
-  public static MatchingRule getIntegerMatchingRule()
-  {
-    return INTEGER_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code integerOrderingMatch} Matching Rule which
-   * has the OID {@code 2.5.13.15}.
-   *
-   * @return A reference to the {@code integerOrderingMatch} Matching Rule.
-   */
-  public static MatchingRule getIntegerOrderingMatchingRule()
-  {
-    return INTEGER_ORDERING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Integer Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.27}.
-   *
-   * @return A reference to the {@code Integer Syntax}.
-   */
-  public static Syntax getIntegerSyntax()
-  {
-    return INTEGER_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code internationalISDNNumber} Attribute Type
-   * which has the OID {@code 2.5.4.25}.
-   *
-   * @return A reference to the {@code internationalISDNNumber} Attribute Type.
-   */
-  public static AttributeType getInternationalISDNNumberAttributeType()
-  {
-    return INTERNATIONAL_ISDN_NUMBER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code JPEG Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.28}.
-   *
-   * @return A reference to the {@code JPEG Syntax}.
-   */
-  public static Syntax getJPEGSyntax()
-  {
-    return JPEG_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code keywordMatch} Matching Rule which has the
-   * OID {@code 2.5.13.33}.
-   *
-   * @return A reference to the {@code keywordMatch} Matching Rule.
-   */
-  public static MatchingRule getKeywordMatchingRule()
-  {
-    return KEYWORD_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code l} Attribute Type which has the OID
-   * {@code 2.5.4.7}.
-   *
-   * @return A reference to the {@code l} Attribute Type.
-   */
-  public static AttributeType getLAttributeType()
-  {
-    return L_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code LDAP Syntax Description Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.1466.115.121.1.54}.
-   *
-   * @return A reference to the {@code LDAP Syntax Description Syntax}.
-   */
-  public static Syntax getLDAPSyntaxDescriptionSyntax()
-  {
-    return LDAP_SYNTAX_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code ldapSyntaxes} Attribute Type which has
-   * the OID {@code 1.3.6.1.4.1.1466.101.120.16}.
-   *
-   * @return A reference to the {@code ldapSyntaxes} Attribute Type.
-   */
-  public static AttributeType getLDAPSyntaxesAttributeType()
-  {
-    return LDAP_SYNTAXES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code locality} Object Class which has the OID
-   * {@code 2.5.6.3}.
-   *
-   * @return A reference to the {@code locality} Object Class.
-   */
-  public static ObjectClass getLocalityObjectClass()
-  {
-    return LOCALITY_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Matching Rule Description Syntax} which
-   * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.30}.
-   *
-   * @return A reference to the {@code Matching Rule Description Syntax}.
-   */
-  public static Syntax getMatchingRuleDescriptionSyntax()
-  {
-    return MATCHING_RULE_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code matchingRules} Attribute Type which has
-   * the OID {@code 2.5.21.4}.
-   *
-   * @return A reference to the {@code matchingRules} Attribute Type.
-   */
-  public static AttributeType getMatchingRulesAttributeType()
-  {
-    return MATCHING_RULES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code matchingRuleUse} Attribute Type which has
-   * the OID {@code 2.5.21.8}.
-   *
-   * @return A reference to the {@code matchingRuleUse} Attribute Type.
-   */
-  public static AttributeType getMatchingRuleUseAttributeType()
-  {
-    return MATCHING_RULE_USE_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Matching Rule Use Description Syntax}
-   * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.31}.
-   *
-   * @return A reference to the {@code Matching Rule Use Description Syntax}.
-   */
-  public static Syntax getMatchingRuleUseDescriptionSyntax()
-  {
-    return MATCHING_RULE_USE_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code member} Attribute Type which has the OID
-   * {@code 2.5.4.31}.
-   *
-   * @return A reference to the {@code member} Attribute Type.
-   */
-  public static AttributeType getMemberAttributeType()
-  {
-    return MEMBER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code modifiersName} Attribute Type which has
-   * the OID {@code 2.5.18.4}.
-   *
-   * @return A reference to the {@code modifiersName} Attribute Type.
-   */
-  public static AttributeType getModifiersNameAttributeType()
-  {
-    return MODIFIERS_NAME_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code modifyTimestamp} Attribute Type which has
-   * the OID {@code 2.5.18.2}.
-   *
-   * @return A reference to the {@code modifyTimestamp} Attribute Type.
-   */
-  public static AttributeType getModifyTimestampAttributeType()
-  {
-    return MODIFY_TIMESTAMP_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Name and Optional UID Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.1466.115.121.1.34}.
-   *
-   * @return A reference to the {@code Name and Optional UID Syntax}.
-   */
-  public static Syntax getNameAndOptionalUIDSyntax()
-  {
-    return NAME_AND_OPTIONAL_UID_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code name} Attribute Type which has the OID
-   * {@code 2.5.4.41}.
-   *
-   * @return A reference to the {@code name} Attribute Type.
-   */
-  public static AttributeType getNameAttributeType()
-  {
-    return NAME_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Name Form Description Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.1466.115.121.1.35}.
-   *
-   * @return A reference to the {@code Name Form Description Syntax}.
-   */
-  public static Syntax getNameFormDescriptionSyntax()
-  {
-    return NAME_FORM_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code nameForms} Attribute Type which has the
-   * OID {@code 2.5.21.7}.
-   *
-   * @return A reference to the {@code nameForms} Attribute Type.
-   */
-  public static AttributeType getNameFormsAttributeType()
-  {
-    return NAME_FORMS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code namingContexts} Attribute Type which has
-   * the OID {@code 1.3.6.1.4.1.1466.101.120.5}.
-   *
-   * @return A reference to the {@code namingContexts} Attribute Type.
-   */
-  public static AttributeType getNamingContextsAttributeType()
-  {
-    return NAMING_CONTEXTS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code numericStringMatch} Matching Rule which
-   * has the OID {@code 2.5.13.8}.
-   *
-   * @return A reference to the {@code numericStringMatch} Matching Rule.
-   */
-  public static MatchingRule getNumericStringMatchingRule()
-  {
-    return NUMERIC_STRING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code numericStringOrderingMatch} Matching Rule
-   * which has the OID {@code 2.5.13.9}.
-   *
-   * @return A reference to the {@code numericStringOrderingMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getNumericStringOrderingMatchingRule()
-  {
-    return NUMERIC_STRING_ORDERING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code numericStringSubstringsMatch} Matching
-   * Rule which has the OID {@code 2.5.13.10}.
-   *
-   * @return A reference to the {@code numericStringSubstringsMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getNumericStringSubstringsMatchingRule()
-  {
-    return NUMERIC_STRING_SUBSTRINGS_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Numeric String Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.36}.
-   *
-   * @return A reference to the {@code Numeric String Syntax}.
-   */
-  public static Syntax getNumericStringSyntax()
-  {
-    return NUMERIC_STRING_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code o} Attribute Type which has the OID
-   * {@code 2.5.4.10}.
-   *
-   * @return A reference to the {@code o} Attribute Type.
-   */
-  public static AttributeType getOAttributeType()
-  {
-    return O_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code objectClass} Attribute Type which has the
-   * OID {@code 2.5.4.0}.
-   *
-   * @return A reference to the {@code objectClass} Attribute Type.
-   */
-  public static AttributeType getObjectClassAttributeType()
-  {
-    return OBJECT_CLASS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Object Class Description Syntax} which
-   * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.37}.
-   *
-   * @return A reference to the {@code Object Class Description Syntax}.
-   */
-  public static Syntax getObjectClassDescriptionSyntax()
-  {
-    return OBJECT_CLASS_DESCRIPTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code objectClasses} Attribute Type which has
-   * the OID {@code 2.5.21.6}.
-   *
-   * @return A reference to the {@code objectClasses} Attribute Type.
-   */
-  public static AttributeType getObjectClassesAttributeType()
-  {
-    return OBJECT_CLASSES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code objectIdentifierFirstComponentMatch}
-   * Matching Rule which has the OID {@code 2.5.13.30}.
-   *
-   * @return A reference to the {@code objectIdentifierFirstComponentMatch}
-   *         Matching Rule.
-   */
-  public static MatchingRule getObjectIdentifierFirstComponentMatchingRule()
-  {
-    return OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code objectIdentifierMatch} Matching Rule
-   * which has the OID {@code 2.5.13.0}.
-   *
-   * @return A reference to the {@code objectIdentifierMatch} Matching Rule.
-   */
-  public static MatchingRule getObjectIdentifierMatchingRule()
-  {
-    return OBJECT_IDENTIFIER_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code octetStringMatch} Matching Rule which has
-   * the OID {@code 2.5.13.17}.
-   *
-   * @return A reference to the {@code octetStringMatch} Matching Rule.
-   */
-  public static MatchingRule getOctetStringMatchingRule()
-  {
-    return OCTET_STRING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code octetStringOrderingMatch} Matching Rule
-   * which has the OID {@code 2.5.13.18}.
-   *
-   * @return A reference to the {@code octetStringOrderingMatch} Matching Rule.
-   */
-  public static MatchingRule getOctetStringOrderingMatchingRule()
-  {
-    return OCTET_STRING_ORDERING_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code octetStringSubstringsMatch} Matching Rule
-   * which has the OID {@code 2.5.13.19}.
-   *
-   * @return A reference to the {@code octetStringSubstringsMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getOctetStringSubstringsMatchingRule()
-  {
-    return OCTET_STRING_SUBSTRINGS_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Octet String Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.40}.
-   *
-   * @return A reference to the {@code Octet String Syntax}.
-   */
-  public static Syntax getOctetStringSyntax()
-  {
-    return OCTET_STRING_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code OID Syntax} which has the OID {@code
-   * 1.3.6.1.4.1.1466.115.121.1.38}.
-   *
-   * @return A reference to the {@code OID Syntax}.
-   */
-  public static Syntax getOIDSyntax()
-  {
-    return OID_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code organizationalPerson} Object Class which
-   * has the OID {@code 2.5.6.7}.
-   *
-   * @return A reference to the {@code organizationalPerson} Object Class.
-   */
-  public static ObjectClass getOrganizationalPersonObjectClass()
-  {
-    return ORGANIZATIONAL_PERSON_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code organizationalRole} Object Class which
-   * has the OID {@code 2.5.6.8}.
-   *
-   * @return A reference to the {@code organizationalRole} Object Class.
-   */
-  public static ObjectClass getOrganizationalRoleObjectClass()
-  {
-    return ORGANIZATIONAL_ROLE_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code organizationalUnit} Object Class which
-   * has the OID {@code 2.5.6.5}.
-   *
-   * @return A reference to the {@code organizationalUnit} Object Class.
-   */
-  public static ObjectClass getOrganizationalUnitObjectClass()
-  {
-    return ORGANIZATIONAL_UNIT_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code organization} Object Class which has the
-   * OID {@code 2.5.6.4}.
-   *
-   * @return A reference to the {@code organization} Object Class.
-   */
-  public static ObjectClass getOrganizationObjectClass()
-  {
-    return ORGANIZATION_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Other Mailbox Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.39}.
-   *
-   * @return A reference to the {@code Other Mailbox Syntax}.
-   */
-  public static Syntax getOtherMailboxSyntax()
-  {
-    return OTHER_MAILBOX_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code ou} Attribute Type which has the OID
-   * {@code 2.5.4.11}.
-   *
-   * @return A reference to the {@code ou} Attribute Type.
-   */
-  public static AttributeType getOUAttributeType()
-  {
-    return OU_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code owner} Attribute Type which has the OID
-   * {@code 2.5.4.32}.
-   *
-   * @return A reference to the {@code owner} Attribute Type.
-   */
-  public static AttributeType getOwnerAttributeType()
-  {
-    return OWNER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code person} Object Class which has the OID
-   * {@code 2.5.6.6}.
-   *
-   * @return A reference to the {@code person} Object Class.
-   */
-  public static ObjectClass getPersonObjectClass()
-  {
-    return PERSON_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code physicalDeliveryOfficeName} Attribute
-   * Type which has the OID {@code 2.5.4.19}.
-   *
-   * @return A reference to the {@code physicalDeliveryOfficeName} Attribute
-   *         Type.
-   */
-  public static AttributeType getPhysicalDeliveryOfficeNameAttributeType()
-  {
-    return PHYSICAL_DELIVERY_OFFICE_NAME_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code postalAddress} Attribute Type which has
-   * the OID {@code 2.5.4.16}.
-   *
-   * @return A reference to the {@code postalAddress} Attribute Type.
-   */
-  public static AttributeType getPostalAddressAttributeType()
-  {
-    return POSTAL_ADDRESS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Postal Address Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.41}.
-   *
-   * @return A reference to the {@code Postal Address Syntax}.
-   */
-  public static Syntax getPostalAddressSyntax()
-  {
-    return POSTAL_ADDRESS_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code postalCode} Attribute Type which has the
-   * OID {@code 2.5.4.17}.
-   *
-   * @return A reference to the {@code postalCode} Attribute Type.
-   */
-  public static AttributeType getPostalCodeAttributeType()
-  {
-    return POSTAL_CODE_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code postOfficeBox} Attribute Type which has
-   * the OID {@code 2.5.4.18}.
-   *
-   * @return A reference to the {@code postOfficeBox} Attribute Type.
-   */
-  public static AttributeType getPostOfficeBoxAttributeType()
-  {
-    return POST_OFFICE_BOX_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code preferredDeliveryMethod} Attribute Type
-   * which has the OID {@code 2.5.4.28}.
-   *
-   * @return A reference to the {@code preferredDeliveryMethod} Attribute Type.
-   */
-  public static AttributeType getPreferredDeliveryMethodAttributeType()
-  {
-    return PREFERRED_DELIVERY_METHOD_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code presentationAddressMatch} Matching Rule
-   * which has the OID {@code 2.5.13.22}.
-   *
-   * @return A reference to the {@code presentationAddressMatch} Matching Rule.
-   */
-  public static MatchingRule getPresentationAddressMatchingRule()
-  {
-    return PRESENTATION_ADDRESS_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Presentation Address Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.1466.115.121.1.43}.
-   *
-   * @return A reference to the {@code Presentation Address Syntax}.
-   */
-  public static Syntax getPresentationAddressSyntax()
-  {
-    return PRESENTATION_ADDRESS_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Printable String Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.44}.
-   *
-   * @return A reference to the {@code Printable String Syntax}.
-   */
-  public static Syntax getPrintableStringSyntax()
-  {
-    return PRINTABLE_STRING_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code protocolInformationMatch} Matching Rule
-   * which has the OID {@code 2.5.13.24}.
-   *
-   * @return A reference to the {@code protocolInformationMatch} Matching Rule.
-   */
-  public static MatchingRule getProtocolInformationMatchingRule()
-  {
-    return PROTOCOL_INFORMATION_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Protocol Information Syntax} which has
-   * the OID {@code 1.3.6.1.4.1.1466.115.121.1.42}.
-   *
-   * @return A reference to the {@code Protocol Information Syntax}.
-   */
-  public static Syntax getProtocolInformationSyntax()
-  {
-    return PROTOCOL_INFORMATION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code registeredAddress} Attribute Type which
-   * has the OID {@code 2.5.4.26}.
-   *
-   * @return A reference to the {@code registeredAddress} Attribute Type.
-   */
-  public static AttributeType getRegisteredAddressAttributeType()
-  {
-    return REGISTERED_ADDRESS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code residentialPerson} Object Class which has
-   * the OID {@code 2.5.6.10}.
-   *
-   * @return A reference to the {@code residentialPerson} Object Class.
-   */
-  public static ObjectClass getResidentialPersonObjectClass()
-  {
-    return RESIDENTIAL_PERSON_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code roleOccupant} Attribute Type which has
-   * the OID {@code 2.5.4.33}.
-   *
-   * @return A reference to the {@code roleOccupant} Attribute Type.
-   */
-  public static AttributeType getRoleOccupantAttributeType()
-  {
-    return ROLE_OCCUPANT_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code searchGuide} Attribute Type which has the
-   * OID {@code 2.5.4.14}.
-   *
-   * @return A reference to the {@code searchGuide} Attribute Type.
-   */
-  public static AttributeType getSearchGuideAttributeType()
-  {
-    return SEARCH_GUIDE_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code seeAlso} Attribute Type which has the OID
-   * {@code 2.5.4.34}.
-   *
-   * @return A reference to the {@code seeAlso} Attribute Type.
-   */
-  public static AttributeType getSeeAlsoAttributeType()
-  {
-    return SEE_ALSO_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code serialNumber} Attribute Type which has
-   * the OID {@code 2.5.4.5}.
-   *
-   * @return A reference to the {@code serialNumber} Attribute Type.
-   */
-  public static AttributeType getSerialNumberAttributeType()
-  {
-    return SERIAL_NUMBER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code sn} Attribute Type which has the OID
-   * {@code 2.5.4.4}.
-   *
-   * @return A reference to the {@code sn} Attribute Type.
-   */
-  public static AttributeType getSNAttributeType()
-  {
-    return SN_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code st} Attribute Type which has the OID
-   * {@code 2.5.4.8}.
-   *
-   * @return A reference to the {@code st} Attribute Type.
-   */
-  public static AttributeType getSTAttributeType()
-  {
-    return ST_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code street} Attribute Type which has the OID
-   * {@code 2.5.4.9}.
-   *
-   * @return A reference to the {@code street} Attribute Type.
-   */
-  public static AttributeType getStreetAttributeType()
-  {
-    return STREET_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code structuralObjectClass} Attribute Type
-   * which has the OID {@code 2.5.21.9}.
-   *
-   * @return A reference to the {@code structuralObjectClass} Attribute Type.
-   */
-  public static AttributeType getStructuralObjectClassAttributeType()
-  {
-    return STRUCTURAL_OBJECT_CLASS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code subschema} Object Class which has the OID
-   * {@code 2.5.20.1}.
-   *
-   * @return A reference to the {@code subschema} Object Class.
-   */
-  public static ObjectClass getSubschemaObjectClass()
-  {
-    return SUBSCHEMA_OBJECT_CLASS;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code subschemaSubentry} Attribute Type which
-   * has the OID {@code 2.5.18.10}.
-   *
-   * @return A reference to the {@code subschemaSubentry} Attribute Type.
-   */
-  public static AttributeType getSubschemaSubentryAttributeType()
-  {
-    return SUBSCHEMA_SUBENTRY_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Substring Assertion Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.58}.
-   *
-   * @return A reference to the {@code Substring Assertion Syntax}.
-   */
-  public static Syntax getSubstringAssertionSyntax()
-  {
-    return SUBSTRING_ASSERTION_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Supported Algorithm Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.49}.
-   *
-   * @return A reference to the {@code Supported Algorithm Syntax}.
-   */
-  public static Syntax getSupportedAlgorithmSyntax()
-  {
-    return SUPPORTED_ALGORITHM_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedAuthPasswordSchemes} Attribute
-   * Type which has the OID {@code 1.3.6.1.4.1.4203.1.3.3}.
-   *
-   * @return A reference to the {@code supportedAuthPasswordSchemes} Attribute
-   *         Type.
-   */
-  public static AttributeType getSupportedAuthPasswordSchemesAttributeType()
-  {
-    return SUPPORTED_AUTH_PASSWORD_SCHEMES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedControl} Attribute Type which
-   * has the OID {@code 1.3.6.1.4.1.1466.101.120.13}.
-   *
-   * @return A reference to the {@code supportedControl} Attribute Type.
-   */
-  public static AttributeType getSupportedControlAttributeType()
-  {
-    return SUPPORTED_CONTROL_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedExtension} Attribute Type which
-   * has the OID {@code 1.3.6.1.4.1.1466.101.120.7}.
-   *
-   * @return A reference to the {@code supportedExtension} Attribute Type.
-   */
-  public static AttributeType getSupportedExtensionAttributeType()
-  {
-    return SUPPORTED_EXTENSION_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedFeatures} Attribute Type which
-   * has the OID {@code 1.3.6.1.4.1.4203.1.3.5}.
-   *
-   * @return A reference to the {@code supportedFeatures} Attribute Type.
-   */
-  public static AttributeType getSupportedFeaturesAttributeType()
-  {
-    return SUPPORTED_FEATURES_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedLDAPVersion} Attribute Type
-   * which has the OID {@code 1.3.6.1.4.1.1466.101.120.15}.
-   *
-   * @return A reference to the {@code supportedLDAPVersion} Attribute Type.
-   */
-  public static AttributeType getSupportedLDAPVersionAttributeType()
-  {
-    return SUPPORTED_LDAP_VERSION_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code supportedSASLMechanisms} Attribute Type
-   * which has the OID {@code 1.3.6.1.4.1.1466.101.120.14}.
-   *
-   * @return A reference to the {@code supportedSASLMechanisms} Attribute Type.
-   */
-  public static AttributeType getSupportedSASLMechanismsAttributeType()
-  {
-    return SUPPORTED_SASL_MECHANISMS_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code telephoneNumber} Attribute Type which has
-   * the OID {@code 2.5.4.20}.
-   *
-   * @return A reference to the {@code telephoneNumber} Attribute Type.
-   */
-  public static AttributeType getTelephoneNumberAttributeType()
-  {
-    return TELEPHONE_NUMBER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code telephoneNumberMatch} Matching Rule which
-   * has the OID {@code 2.5.13.20}.
-   *
-   * @return A reference to the {@code telephoneNumberMatch} Matching Rule.
-   */
-  public static MatchingRule getTelephoneNumberMatchingRule()
-  {
-    return TELEPHONE_NUMBER_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code telephoneNumberSubstringsMatch} Matching
-   * Rule which has the OID {@code 2.5.13.21}.
-   *
-   * @return A reference to the {@code telephoneNumberSubstringsMatch} Matching
-   *         Rule.
-   */
-  public static MatchingRule getTelephoneNumberSubstringsMatchingRule()
-  {
-    return TELEPHONE_NUMBER_SUBSTRINGS_MATCHING_RULE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Telephone Number Syntax} which has the
-   * OID {@code 1.3.6.1.4.1.1466.115.121.1.50}.
-   *
-   * @return A reference to the {@code Telephone Number Syntax}.
-   */
-  public static Syntax getTelephoneNumberSyntax()
-  {
-    return TELEPHONE_NUMBER_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code teletexTerminalIdentifier} Attribute Type
-   * which has the OID {@code 2.5.4.22}.
-   *
-   * @return A reference to the {@code teletexTerminalIdentifier} Attribute
-   *         Type.
-   */
-  public static AttributeType getTeletexTerminalIdentifierAttributeType()
-  {
-    return TELETEX_TERMINAL_IDENTIFIER_ATTRIBUTE_TYPE;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code Teletex Terminal Identifier Syntax} which
-   * has the OID {@code 1.3.6.1.4.1.1466.115.121.1.51}.
-   *
-   * @return A reference to the {@code Teletex Terminal Identifier Syntax}.
-   */
-  public static Syntax getTeletexTerminalIdentifierSyntax()
-  {
-    return TELETEX_TERMINAL_IDENTIFIER_SYNTAX;
-  }
-
-
-
-  /**
-   * Returns a reference to the {@code telexNumber} Attribute Type which has the
-   * OID {@code 2.5.4.21}.
-   *
-   * @return A reference to the {@code telexNumber} Attribute Type.
-   */
-  public static AttributeType getTelexNumberAttributeType()
-  {
-    return TELEX_NUMBER_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code postalAddress} Attribute Type which has
+     * the OID {@code 2.5.4.16}.
+     *
+     * @return A reference to the {@code postalAddress} Attribute Type.
+     */
+    public static AttributeType getPostalAddressAttributeType() {
+        return POSTAL_ADDRESS_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Postal Address Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.41}.
+     *
+     * @return A reference to the {@code Postal Address Syntax}.
+     */
+    public static Syntax getPostalAddressSyntax() {
+        return POSTAL_ADDRESS_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code postalCode} Attribute Type which has
+     * the OID {@code 2.5.4.17}.
+     *
+     * @return A reference to the {@code postalCode} Attribute Type.
+     */
+    public static AttributeType getPostalCodeAttributeType() {
+        return POSTAL_CODE_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code Telex Number Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.52}.
-   *
-   * @return A reference to the {@code Telex Number Syntax}.
-   */
-  public static Syntax getTelexNumberSyntax()
-  {
-    return TELEX_NUMBER_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code postOfficeBox} Attribute Type which has
+     * the OID {@code 2.5.4.18}.
+     *
+     * @return A reference to the {@code postOfficeBox} Attribute Type.
+     */
+    public static AttributeType getPostOfficeBoxAttributeType() {
+        return POST_OFFICE_BOX_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code preferredDeliveryMethod} Attribute Type
+     * which has the OID {@code 2.5.4.28}.
+     *
+     * @return A reference to the {@code preferredDeliveryMethod} Attribute
+     *         Type.
+     */
+    public static AttributeType getPreferredDeliveryMethodAttributeType() {
+        return PREFERRED_DELIVERY_METHOD_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code presentationAddressMatch} Matching Rule
+     * which has the OID {@code 2.5.13.22}.
+     *
+     * @return A reference to the {@code presentationAddressMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getPresentationAddressMatchingRule() {
+        return PRESENTATION_ADDRESS_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code title} Attribute Type which has the OID
-   * {@code 2.5.4.12}.
-   *
-   * @return A reference to the {@code title} Attribute Type.
-   */
-  public static AttributeType getTitleAttributeType()
-  {
-    return TITLE_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code Presentation Address Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.43}.
+     *
+     * @return A reference to the {@code Presentation Address Syntax}.
+     */
+    public static Syntax getPresentationAddressSyntax() {
+        return PRESENTATION_ADDRESS_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code Printable String Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.44}.
+     *
+     * @return A reference to the {@code Printable String Syntax}.
+     */
+    public static Syntax getPrintableStringSyntax() {
+        return PRINTABLE_STRING_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code protocolInformationMatch} Matching Rule
+     * which has the OID {@code 2.5.13.24}.
+     *
+     * @return A reference to the {@code protocolInformationMatch} Matching
+     *         Rule.
+     */
+    public static MatchingRule getProtocolInformationMatchingRule() {
+        return PROTOCOL_INFORMATION_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code top} Object Class which has the OID
-   * {@code 2.5.6.0}.
-   *
-   * @return A reference to the {@code top} Object Class.
-   */
-  public static ObjectClass getTopObjectClass()
-  {
-    return TOP_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code Protocol Information Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.42}.
+     *
+     * @return A reference to the {@code Protocol Information Syntax}.
+     */
+    public static Syntax getProtocolInformationSyntax() {
+        return PROTOCOL_INFORMATION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code registeredAddress} Attribute Type which
+     * has the OID {@code 2.5.4.26}.
+     *
+     * @return A reference to the {@code registeredAddress} Attribute Type.
+     */
+    public static AttributeType getRegisteredAddressAttributeType() {
+        return REGISTERED_ADDRESS_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code residentialPerson} Object Class which
+     * has the OID {@code 2.5.6.10}.
+     *
+     * @return A reference to the {@code residentialPerson} Object Class.
+     */
+    public static ObjectClass getResidentialPersonObjectClass() {
+        return RESIDENTIAL_PERSON_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code uid} Attribute Type which has the OID
-   * {@code 0.9.2342.19200300.100.1.1}.
-   *
-   * @return A reference to the {@code uid} Attribute Type.
-   */
-  public static AttributeType getUIDAttributeType()
-  {
-    return UID_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code roleOccupant} Attribute Type which has
+     * the OID {@code 2.5.4.33}.
+     *
+     * @return A reference to the {@code roleOccupant} Attribute Type.
+     */
+    public static AttributeType getRoleOccupantAttributeType() {
+        return ROLE_OCCUPANT_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code searchGuide} Attribute Type which has
+     * the OID {@code 2.5.4.14}.
+     *
+     * @return A reference to the {@code searchGuide} Attribute Type.
+     */
+    public static AttributeType getSearchGuideAttributeType() {
+        return SEARCH_GUIDE_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code seeAlso} Attribute Type which has the
+     * OID {@code 2.5.4.34}.
+     *
+     * @return A reference to the {@code seeAlso} Attribute Type.
+     */
+    public static AttributeType getSeeAlsoAttributeType() {
+        return SEE_ALSO_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code uidObject} Object Class which has the OID
-   * {@code 1.3.6.1.1.3.1}.
-   *
-   * @return A reference to the {@code uidObject} Object Class.
-   */
-  public static ObjectClass getUIDObjectObjectClass()
-  {
-    return UID_OBJECT_OBJECT_CLASS;
-  }
+    /**
+     * Returns a reference to the {@code serialNumber} Attribute Type which has
+     * the OID {@code 2.5.4.5}.
+     *
+     * @return A reference to the {@code serialNumber} Attribute Type.
+     */
+    public static AttributeType getSerialNumberAttributeType() {
+        return SERIAL_NUMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code sn} Attribute Type which has the OID
+     * {@code 2.5.4.4}.
+     *
+     * @return A reference to the {@code sn} Attribute Type.
+     */
+    public static AttributeType getSNAttributeType() {
+        return SN_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code st} Attribute Type which has the OID
+     * {@code 2.5.4.8}.
+     *
+     * @return A reference to the {@code st} Attribute Type.
+     */
+    public static AttributeType getSTAttributeType() {
+        return ST_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code uniqueMember} Attribute Type which has
-   * the OID {@code 2.5.4.50}.
-   *
-   * @return A reference to the {@code uniqueMember} Attribute Type.
-   */
-  public static AttributeType getUniqueMemberAttributeType()
-  {
-    return UNIQUE_MEMBER_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code street} Attribute Type which has the
+     * OID {@code 2.5.4.9}.
+     *
+     * @return A reference to the {@code street} Attribute Type.
+     */
+    public static AttributeType getStreetAttributeType() {
+        return STREET_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code structuralObjectClass} Attribute Type
+     * which has the OID {@code 2.5.21.9}.
+     *
+     * @return A reference to the {@code structuralObjectClass} Attribute Type.
+     */
+    public static AttributeType getStructuralObjectClassAttributeType() {
+        return STRUCTURAL_OBJECT_CLASS_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code subschema} Object Class which has the
+     * OID {@code 2.5.20.1}.
+     *
+     * @return A reference to the {@code subschema} Object Class.
+     */
+    public static ObjectClass getSubschemaObjectClass() {
+        return SUBSCHEMA_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code uniqueMemberMatch} Matching Rule which
-   * has the OID {@code 2.5.13.23}.
-   *
-   * @return A reference to the {@code uniqueMemberMatch} Matching Rule.
-   */
-  public static MatchingRule getUniqueMemberMatchingRule()
-  {
-    return UNIQUE_MEMBER_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code subschemaSubentry} Attribute Type which
+     * has the OID {@code 2.5.18.10}.
+     *
+     * @return A reference to the {@code subschemaSubentry} Attribute Type.
+     */
+    public static AttributeType getSubschemaSubentryAttributeType() {
+        return SUBSCHEMA_SUBENTRY_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Substring Assertion Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.58}.
+     *
+     * @return A reference to the {@code Substring Assertion Syntax}.
+     */
+    public static Syntax getSubstringAssertionSyntax() {
+        return SUBSTRING_ASSERTION_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code Supported Algorithm Syntax} which has
+     * the OID {@code 1.3.6.1.4.1.1466.115.121.1.49}.
+     *
+     * @return A reference to the {@code Supported Algorithm Syntax}.
+     */
+    public static Syntax getSupportedAlgorithmSyntax() {
+        return SUPPORTED_ALGORITHM_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code userPassword} Attribute Type which has
-   * the OID {@code 2.5.4.35}.
-   *
-   * @return A reference to the {@code userPassword} Attribute Type.
-   */
-  public static AttributeType getUserPasswordAttributeType()
-  {
-    return USER_PASSWORD_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code supportedAuthPasswordSchemes} Attribute
+     * Type which has the OID {@code 1.3.6.1.4.1.4203.1.3.3}.
+     *
+     * @return A reference to the {@code supportedAuthPasswordSchemes} Attribute
+     *         Type.
+     */
+    public static AttributeType getSupportedAuthPasswordSchemesAttributeType() {
+        return SUPPORTED_AUTH_PASSWORD_SCHEMES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code supportedControl} Attribute Type which
+     * has the OID {@code 1.3.6.1.4.1.1466.101.120.13}.
+     *
+     * @return A reference to the {@code supportedControl} Attribute Type.
+     */
+    public static AttributeType getSupportedControlAttributeType() {
+        return SUPPORTED_CONTROL_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code supportedExtension} Attribute Type
+     * which has the OID {@code 1.3.6.1.4.1.1466.101.120.7}.
+     *
+     * @return A reference to the {@code supportedExtension} Attribute Type.
+     */
+    public static AttributeType getSupportedExtensionAttributeType() {
+        return SUPPORTED_EXTENSION_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code UTC Time Syntax} which has the OID
-   * {@code 1.3.6.1.4.1.1466.115.121.1.53}.
-   *
-   * @return A reference to the {@code UTC Time Syntax}.
-   */
-  public static Syntax getUTCTimeSyntax()
-  {
-    return UTC_TIME_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code supportedFeatures} Attribute Type which
+     * has the OID {@code 1.3.6.1.4.1.4203.1.3.5}.
+     *
+     * @return A reference to the {@code supportedFeatures} Attribute Type.
+     */
+    public static AttributeType getSupportedFeaturesAttributeType() {
+        return SUPPORTED_FEATURES_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code supportedLDAPVersion} Attribute Type
+     * which has the OID {@code 1.3.6.1.4.1.1466.101.120.15}.
+     *
+     * @return A reference to the {@code supportedLDAPVersion} Attribute Type.
+     */
+    public static AttributeType getSupportedLDAPVersionAttributeType() {
+        return SUPPORTED_LDAP_VERSION_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code supportedSASLMechanisms} Attribute Type
+     * which has the OID {@code 1.3.6.1.4.1.1466.101.120.14}.
+     *
+     * @return A reference to the {@code supportedSASLMechanisms} Attribute
+     *         Type.
+     */
+    public static AttributeType getSupportedSASLMechanismsAttributeType() {
+        return SUPPORTED_SASL_MECHANISMS_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code uuidMatch} Matching Rule which has the
-   * OID {@code 1.3.6.1.1.16.2}.
-   *
-   * @return A reference to the {@code uuidMatch} Matching Rule.
-   */
-  public static MatchingRule getUUIDMatchingRule()
-  {
-    return UUID_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code telephoneNumber} Attribute Type which
+     * has the OID {@code 2.5.4.20}.
+     *
+     * @return A reference to the {@code telephoneNumber} Attribute Type.
+     */
+    public static AttributeType getTelephoneNumberAttributeType() {
+        return TELEPHONE_NUMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code telephoneNumberMatch} Matching Rule
+     * which has the OID {@code 2.5.13.20}.
+     *
+     * @return A reference to the {@code telephoneNumberMatch} Matching Rule.
+     */
+    public static MatchingRule getTelephoneNumberMatchingRule() {
+        return TELEPHONE_NUMBER_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code telephoneNumberSubstringsMatch}
+     * Matching Rule which has the OID {@code 2.5.13.21}.
+     *
+     * @return A reference to the {@code telephoneNumberSubstringsMatch}
+     *         Matching Rule.
+     */
+    public static MatchingRule getTelephoneNumberSubstringsMatchingRule() {
+        return TELEPHONE_NUMBER_SUBSTRINGS_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code uuidOrderingMatch} Matching Rule which
-   * has the OID {@code 1.3.6.1.1.16.3}.
-   *
-   * @return A reference to the {@code uuidOrderingMatch} Matching Rule.
-   */
-  public static MatchingRule getUUIDOrderingMatchingRule()
-  {
-    return UUID_ORDERING_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code Telephone Number Syntax} which has the
+     * OID {@code 1.3.6.1.4.1.1466.115.121.1.50}.
+     *
+     * @return A reference to the {@code Telephone Number Syntax}.
+     */
+    public static Syntax getTelephoneNumberSyntax() {
+        return TELEPHONE_NUMBER_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code teletexTerminalIdentifier} Attribute
+     * Type which has the OID {@code 2.5.4.22}.
+     *
+     * @return A reference to the {@code teletexTerminalIdentifier} Attribute
+     *         Type.
+     */
+    public static AttributeType getTeletexTerminalIdentifierAttributeType() {
+        return TELETEX_TERMINAL_IDENTIFIER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Teletex Terminal Identifier Syntax}
+     * which has the OID {@code 1.3.6.1.4.1.1466.115.121.1.51}.
+     *
+     * @return A reference to the {@code Teletex Terminal Identifier Syntax}.
+     */
+    public static Syntax getTeletexTerminalIdentifierSyntax() {
+        return TELETEX_TERMINAL_IDENTIFIER_SYNTAX;
+    }
 
-  /**
-   * Returns a reference to the {@code UUID Syntax} which has the OID {@code
-   * 1.3.6.1.1.16.1}.
-   *
-   * @return A reference to the {@code UUID Syntax}.
-   */
-  public static Syntax getUUIDSyntax()
-  {
-    return UUID_SYNTAX;
-  }
+    /**
+     * Returns a reference to the {@code telexNumber} Attribute Type which has
+     * the OID {@code 2.5.4.21}.
+     *
+     * @return A reference to the {@code telexNumber} Attribute Type.
+     */
+    public static AttributeType getTelexNumberAttributeType() {
+        return TELEX_NUMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code Telex Number Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.52}.
+     *
+     * @return A reference to the {@code Telex Number Syntax}.
+     */
+    public static Syntax getTelexNumberSyntax() {
+        return TELEX_NUMBER_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code title} Attribute Type which has the OID
+     * {@code 2.5.4.12}.
+     *
+     * @return A reference to the {@code title} Attribute Type.
+     */
+    public static AttributeType getTitleAttributeType() {
+        return TITLE_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code vendorName} Attribute Type which has the
-   * OID {@code 1.3.6.1.1.4}.
-   *
-   * @return A reference to the {@code vendorName} Attribute Type.
-   */
-  public static AttributeType getVendorNameAttributeType()
-  {
-    return VENDOR_NAME_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code top} Object Class which has the OID
+     * {@code 2.5.6.0}.
+     *
+     * @return A reference to the {@code top} Object Class.
+     */
+    public static ObjectClass getTopObjectClass() {
+        return TOP_OBJECT_CLASS;
+    }
 
+    /**
+     * Returns a reference to the {@code uid} Attribute Type which has the OID
+     * {@code 0.9.2342.19200300.100.1.1}.
+     *
+     * @return A reference to the {@code uid} Attribute Type.
+     */
+    public static AttributeType getUIDAttributeType() {
+        return UID_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code uidObject} Object Class which has the
+     * OID {@code 1.3.6.1.1.3.1}.
+     *
+     * @return A reference to the {@code uidObject} Object Class.
+     */
+    public static ObjectClass getUIDObjectObjectClass() {
+        return UID_OBJECT_OBJECT_CLASS;
+    }
 
-  /**
-   * Returns a reference to the {@code vendorVersion} Attribute Type which has
-   * the OID {@code 1.3.6.1.1.5}.
-   *
-   * @return A reference to the {@code vendorVersion} Attribute Type.
-   */
-  public static AttributeType getVendorVersionAttributeType()
-  {
-    return VENDOR_VERSION_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code uniqueMember} Attribute Type which has
+     * the OID {@code 2.5.4.50}.
+     *
+     * @return A reference to the {@code uniqueMember} Attribute Type.
+     */
+    public static AttributeType getUniqueMemberAttributeType() {
+        return UNIQUE_MEMBER_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code uniqueMemberMatch} Matching Rule which
+     * has the OID {@code 2.5.13.23}.
+     *
+     * @return A reference to the {@code uniqueMemberMatch} Matching Rule.
+     */
+    public static MatchingRule getUniqueMemberMatchingRule() {
+        return UNIQUE_MEMBER_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code userPassword} Attribute Type which has
+     * the OID {@code 2.5.4.35}.
+     *
+     * @return A reference to the {@code userPassword} Attribute Type.
+     */
+    public static AttributeType getUserPasswordAttributeType() {
+        return USER_PASSWORD_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code wordMatch} Matching Rule which has the
-   * OID {@code 2.5.13.32}.
-   *
-   * @return A reference to the {@code wordMatch} Matching Rule.
-   */
-  public static MatchingRule getWordMatchingRule()
-  {
-    return WORD_MATCHING_RULE;
-  }
+    /**
+     * Returns a reference to the {@code UTC Time Syntax} which has the OID
+     * {@code 1.3.6.1.4.1.1466.115.121.1.53}.
+     *
+     * @return A reference to the {@code UTC Time Syntax}.
+     */
+    public static Syntax getUTCTimeSyntax() {
+        return UTC_TIME_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code uuidMatch} Matching Rule which has the
+     * OID {@code 1.3.6.1.1.16.2}.
+     *
+     * @return A reference to the {@code uuidMatch} Matching Rule.
+     */
+    public static MatchingRule getUUIDMatchingRule() {
+        return UUID_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code uuidOrderingMatch} Matching Rule which
+     * has the OID {@code 1.3.6.1.1.16.3}.
+     *
+     * @return A reference to the {@code uuidOrderingMatch} Matching Rule.
+     */
+    public static MatchingRule getUUIDOrderingMatchingRule() {
+        return UUID_ORDERING_MATCHING_RULE;
+    }
 
-  /**
-   * Returns a reference to the {@code x121Address} Attribute Type which has the
-   * OID {@code 2.5.4.24}.
-   *
-   * @return A reference to the {@code x121Address} Attribute Type.
-   */
-  public static AttributeType getX121AddressAttributeType()
-  {
-    return X121_ADDRESS_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code UUID Syntax} which has the OID
+     * {@code 1.3.6.1.1.16.1}.
+     *
+     * @return A reference to the {@code UUID Syntax}.
+     */
+    public static Syntax getUUIDSyntax() {
+        return UUID_SYNTAX;
+    }
 
+    /**
+     * Returns a reference to the {@code vendorName} Attribute Type which has
+     * the OID {@code 1.3.6.1.1.4}.
+     *
+     * @return A reference to the {@code vendorName} Attribute Type.
+     */
+    public static AttributeType getVendorNameAttributeType() {
+        return VENDOR_NAME_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code vendorVersion} Attribute Type which has
+     * the OID {@code 1.3.6.1.1.5}.
+     *
+     * @return A reference to the {@code vendorVersion} Attribute Type.
+     */
+    public static AttributeType getVendorVersionAttributeType() {
+        return VENDOR_VERSION_ATTRIBUTE_TYPE;
+    }
 
-  /**
-   * Returns a reference to the {@code x500UniqueIdentifier} Attribute Type
-   * which has the OID {@code 2.5.4.45}.
-   *
-   * @return A reference to the {@code x500UniqueIdentifier} Attribute Type.
-   */
-  public static AttributeType getX500UniqueIdentifierAttributeType()
-  {
-    return X500_UNIQUE_IDENTIFIER_ATTRIBUTE_TYPE;
-  }
+    /**
+     * Returns a reference to the {@code wordMatch} Matching Rule which has the
+     * OID {@code 2.5.13.32}.
+     *
+     * @return A reference to the {@code wordMatch} Matching Rule.
+     */
+    public static MatchingRule getWordMatchingRule() {
+        return WORD_MATCHING_RULE;
+    }
 
+    /**
+     * Returns a reference to the {@code x121Address} Attribute Type which has
+     * the OID {@code 2.5.4.24}.
+     *
+     * @return A reference to the {@code x121Address} Attribute Type.
+     */
+    public static AttributeType getX121AddressAttributeType() {
+        return X121_ADDRESS_ATTRIBUTE_TYPE;
+    }
 
+    /**
+     * Returns a reference to the {@code x500UniqueIdentifier} Attribute Type
+     * which has the OID {@code 2.5.4.45}.
+     *
+     * @return A reference to the {@code x500UniqueIdentifier} Attribute Type.
+     */
+    public static AttributeType getX500UniqueIdentifierAttributeType() {
+        return X500_UNIQUE_IDENTIFIER_ATTRIBUTE_TYPE;
+    }
 
-  // Prevent instantiation
-  private CoreSchema()
-  {
-    // Nothing to do.
-  }
+    // Prevent instantiation
+    private CoreSchema() {
+        // Nothing to do.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java
index 86bb032..4bd86db 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,1065 +25,923 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+final class CoreSchemaImpl {
+    private static final Map<String, List<String>> X500_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("X.500"));
 
+    private static final Map<String, List<String>> RFC2252_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 2252"));
 
-final class CoreSchemaImpl
-{
-  private static final Map<String, List<String>> X500_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("X.500"));
+    private static final Map<String, List<String>> RFC3045_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 3045"));
 
-  private static final Map<String, List<String>> RFC2252_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 2252"));
+    private static final Map<String, List<String>> RFC3112_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 3112"));
 
-  private static final Map<String, List<String>> RFC3045_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 3045"));
+    private static final Map<String, List<String>> RFC4512_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 4512"));
 
-  private static final Map<String, List<String>> RFC3112_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 3112"));
+    private static final Map<String, List<String>> RFC4517_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 4517"));
 
-  private static final Map<String, List<String>> RFC4512_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 4512"));
+    private static final Map<String, List<String>> RFC4519_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 4519"));
 
-  private static final Map<String, List<String>> RFC4517_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 4517"));
+    private static final Map<String, List<String>> RFC4530_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("RFC 4530"));
 
-  private static final Map<String, List<String>> RFC4519_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 4519"));
+    static final Map<String, List<String>> OPENDS_ORIGIN = Collections.singletonMap(
+            SCHEMA_PROPERTY_ORIGIN, Collections.singletonList("OpenDS Directory Server"));
 
-  private static final Map<String, List<String>> RFC4530_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("RFC 4530"));
+    private static final String EMPTY_STRING = "".intern();
 
-  static final Map<String, List<String>> OPENDS_ORIGIN = Collections
-      .singletonMap(SCHEMA_PROPERTY_ORIGIN, Collections
-          .singletonList("OpenDS Directory Server"));
+    private static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
 
-  private static final String EMPTY_STRING = "".intern();
+    private static final Schema SINGLETON;
 
-  private static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
+    static {
+        final SchemaBuilder builder = new SchemaBuilder("Core Schema");
+        defaultSyntaxes(builder);
+        defaultMatchingRules(builder);
+        defaultAttributeTypes(builder);
+        defaultObjectClasses(builder);
 
-  private static final Schema SINGLETON;
+        addRFC4519(builder);
+        addRFC4530(builder);
+        addRFC3045(builder);
+        addRFC3112(builder);
+        addSunProprietary(builder);
 
-  static
-  {
-    final SchemaBuilder builder = new SchemaBuilder("Core Schema");
-    defaultSyntaxes(builder);
-    defaultMatchingRules(builder);
-    defaultAttributeTypes(builder);
-    defaultObjectClasses(builder);
+        SINGLETON = builder.toSchema().asNonStrictSchema();
+    }
 
-    addRFC4519(builder);
-    addRFC4530(builder);
-    addRFC3045(builder);
-    addRFC3112(builder);
-    addSunProprietary(builder);
+    static Schema getInstance() {
+        return SINGLETON;
+    }
 
-    SINGLETON = builder.toSchema().asNonStrictSchema();
-  }
+    private static void addRFC3045(final SchemaBuilder builder) {
+        builder.addAttributeType("1.3.6.1.1.4", Collections.singletonList("vendorName"),
+                EMPTY_STRING, false, null, EMR_CASE_EXACT_IA5_OID, null, null, null,
+                SYNTAX_DIRECTORY_STRING_OID, true, false, true, AttributeUsage.DSA_OPERATION,
+                RFC3045_ORIGIN, false);
 
+        builder.addAttributeType("1.3.6.1.1.5", Collections.singletonList("vendorVersion"),
+                EMPTY_STRING, false, null, EMR_CASE_EXACT_IA5_OID, null, null, null,
+                SYNTAX_DIRECTORY_STRING_OID, true, false, true, AttributeUsage.DSA_OPERATION,
+                RFC3045_ORIGIN, false);
+    }
 
+    private static void addRFC3112(final SchemaBuilder builder) {
+        builder.addSyntax(SYNTAX_AUTH_PASSWORD_OID, SYNTAX_AUTH_PASSWORD_DESCRIPTION,
+                RFC3112_ORIGIN, new AuthPasswordSyntaxImpl(), false);
+        builder.addMatchingRule(EMR_AUTH_PASSWORD_EXACT_OID, Collections
+                .singletonList(EMR_AUTH_PASSWORD_EXACT_NAME), EMR_AUTH_PASSWORD_EXACT_DESCRIPTION,
+                false, SYNTAX_AUTH_PASSWORD_OID, RFC3112_ORIGIN,
+                new AuthPasswordExactEqualityMatchingRuleImpl(), false);
+        builder.addAttributeType("1.3.6.1.4.1.4203.1.3.3", Collections
+                .singletonList("supportedAuthPasswordSchemes"),
+                "supported password storage schemes", false, null, EMR_CASE_EXACT_IA5_OID, null,
+                null, null, SYNTAX_IA5_STRING_OID, false, false, false,
+                AttributeUsage.DSA_OPERATION, RFC3112_ORIGIN, false);
+        builder.addAttributeType("1.3.6.1.4.1.4203.1.3.4", Collections
+                .singletonList("authPassword"), "password authentication information", false, null,
+                EMR_AUTH_PASSWORD_EXACT_OID, null, null, null, SYNTAX_AUTH_PASSWORD_OID, false,
+                false, false, AttributeUsage.USER_APPLICATIONS, RFC3112_ORIGIN, false);
+        builder.addObjectClass("1.3.6.1.4.1.4203.1.4.7", Collections
+                .singletonList("authPasswordObject"), "authentication password mix in class",
+                false, EMPTY_STRING_SET, EMPTY_STRING_SET, Collections.singleton("authPassword"),
+                ObjectClassType.AUXILIARY, RFC3112_ORIGIN, false);
+    }
 
-  static Schema getInstance()
-  {
-    return SINGLETON;
-  }
+    private static void addRFC4519(final SchemaBuilder builder) {
+        builder.addAttributeType("2.5.4.15", Collections.singletonList("businessCategory"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.41", Collections.singletonList("name"), EMPTY_STRING,
+                false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.6", Arrays.asList("c", "countryName"), EMPTY_STRING, false,
+                "name", null, null, null, null, SYNTAX_COUNTRY_STRING_OID, true, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-  private static void addRFC3045(final SchemaBuilder builder)
-  {
-    builder.addAttributeType("1.3.6.1.1.4", Collections
-        .singletonList("vendorName"), EMPTY_STRING, false, null,
-        EMR_CASE_EXACT_IA5_OID, null, null, null, SYNTAX_DIRECTORY_STRING_OID,
-        true, false, true, AttributeUsage.DSA_OPERATION, RFC3045_ORIGIN, false);
+        builder.addAttributeType("2.5.4.3", Arrays.asList("cn", "commonName"), EMPTY_STRING, false,
+                "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.1.5", Collections
-        .singletonList("vendorVersion"), EMPTY_STRING, false, null,
-        EMR_CASE_EXACT_IA5_OID, null, null, null, SYNTAX_DIRECTORY_STRING_OID,
-        true, false, true, AttributeUsage.DSA_OPERATION, RFC3045_ORIGIN, false);
-  }
+        builder.addAttributeType("0.9.2342.19200300.100.1.25", Arrays.asList("dc",
+                "domainComponent"), EMPTY_STRING, false, null, EMR_CASE_IGNORE_IA5_OID, null,
+                SMR_CASE_IGNORE_IA5_OID, null, SYNTAX_IA5_STRING_OID, true, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.13", Collections.singletonList("description"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.27", Collections.singletonList("destinationIndicator"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_PRINTABLE_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-  private static void addRFC3112(final SchemaBuilder builder)
-  {
-    builder.addSyntax(SYNTAX_AUTH_PASSWORD_OID,
-        SYNTAX_AUTH_PASSWORD_DESCRIPTION, RFC3112_ORIGIN,
-        new AuthPasswordSyntaxImpl(), false);
-    builder.addMatchingRule(EMR_AUTH_PASSWORD_EXACT_OID, Collections
-        .singletonList(EMR_AUTH_PASSWORD_EXACT_NAME),
-        EMR_AUTH_PASSWORD_EXACT_DESCRIPTION, false, SYNTAX_AUTH_PASSWORD_OID,
-        RFC3112_ORIGIN, new AuthPasswordExactEqualityMatchingRuleImpl(), false);
-    builder.addAttributeType("1.3.6.1.4.1.4203.1.3.3", Collections
-        .singletonList("supportedAuthPasswordSchemes"),
-        "supported password storage schemes", false, null,
-        EMR_CASE_EXACT_IA5_OID, null, null, null, SYNTAX_IA5_STRING_OID, false,
-        false, false, AttributeUsage.DSA_OPERATION, RFC3112_ORIGIN, false);
-    builder.addAttributeType("1.3.6.1.4.1.4203.1.3.4", Collections
-        .singletonList("authPassword"), "password authentication information",
-        false, null, EMR_AUTH_PASSWORD_EXACT_OID, null, null, null,
-        SYNTAX_AUTH_PASSWORD_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC3112_ORIGIN, false);
-    builder.addObjectClass("1.3.6.1.4.1.4203.1.4.7", Collections
-        .singletonList("authPasswordObject"),
-        "authentication password mix in class", false, EMPTY_STRING_SET,
-        EMPTY_STRING_SET, Collections.singleton("authPassword"),
-        ObjectClassType.AUXILIARY, RFC3112_ORIGIN, false);
-  }
+        builder.addAttributeType("2.5.4.49", Collections.singletonList("distinguishedName"),
+                EMPTY_STRING, false, null, EMR_DN_OID, null, null, null, SYNTAX_DN_OID, false,
+                false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.46", Collections.singletonList("dnQualifier"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, OMR_CASE_IGNORE_OID,
+                SMR_CASE_IGNORE_OID, null, SYNTAX_PRINTABLE_STRING_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
+        builder.addAttributeType("2.5.4.47", Collections.singletonList("enhancedSearchGuide"),
+                EMPTY_STRING, false, null, null, null, null, null, SYNTAX_ENHANCED_GUIDE_OID,
+                false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-  private static void addRFC4519(final SchemaBuilder builder)
-  {
-    builder.addAttributeType("2.5.4.15", Collections
-        .singletonList("businessCategory"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.23", Collections.singletonList("facsimileTelephoneNumber"),
+                EMPTY_STRING, false, null, null, null, null, null, SYNTAX_FAXNUMBER_OID, false,
+                false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.41", Collections.singletonList("name"),
-        EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null,
-        SMR_CASE_IGNORE_OID, null, SYNTAX_DIRECTORY_STRING_OID, false, false,
-        false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.44", Collections.singletonList("generationQualifier"),
+                EMPTY_STRING, false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.6", Arrays.asList("c", "countryName"),
-        EMPTY_STRING, false, "name", null, null, null, null,
-        SYNTAX_COUNTRY_STRING_OID, true, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.42", Collections.singletonList("givenName"), EMPTY_STRING,
+                false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.3", Arrays.asList("cn", "commonName"),
-        EMPTY_STRING, false, "name", null, null, null, null, null, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.51", Collections.singletonList("houseIdentifier"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("0.9.2342.19200300.100.1.25", Arrays.asList("dc",
-        "domainComponent"), EMPTY_STRING, false, null, EMR_CASE_IGNORE_IA5_OID,
-        null, SMR_CASE_IGNORE_IA5_OID, null, SYNTAX_IA5_STRING_OID, true,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.43", Collections.singletonList("initials"), EMPTY_STRING,
+                false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.13", Collections
-        .singletonList("description"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.25", Collections.singletonList("internationalISDNNumber"),
+                EMPTY_STRING, false, null, EMR_NUMERIC_STRING_OID, null, SMR_NUMERIC_STRING_OID,
+                null, SYNTAX_NUMERIC_STRING_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.27", Collections
-        .singletonList("destinationIndicator"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_PRINTABLE_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.7", Arrays.asList("l", "localityName"), EMPTY_STRING,
+                false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.49", Collections
-        .singletonList("distinguishedName"), EMPTY_STRING, false, null,
-        EMR_DN_OID, null, null, null, SYNTAX_DN_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.31", Collections.singletonList("member"), EMPTY_STRING,
+                false, "distinguishedName", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.46", Collections
-        .singletonList("dnQualifier"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, OMR_CASE_IGNORE_OID, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_PRINTABLE_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.10", Arrays.asList("o", "organizationName"), EMPTY_STRING,
+                false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.47", Collections
-        .singletonList("enhancedSearchGuide"), EMPTY_STRING, false, null, null,
-        null, null, null, SYNTAX_ENHANCED_GUIDE_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.11", Arrays.asList("ou", "organizationalUnitName"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.23", Collections
-        .singletonList("facsimileTelephoneNumber"), EMPTY_STRING, false, null,
-        null, null, null, null, SYNTAX_FAXNUMBER_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.32", Collections.singletonList("owner"), EMPTY_STRING,
+                false, "distinguishedName", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.44", Collections
-        .singletonList("generationQualifier"), EMPTY_STRING, false, "name",
-        null, null, null, null, null, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.19", Collections
+                .singletonList("physicalDeliveryOfficeName"), EMPTY_STRING, false, null,
+                EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null, SYNTAX_DIRECTORY_STRING_OID,
+                false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.42",
-        Collections.singletonList("givenName"), EMPTY_STRING, false, "name",
-        null, null, null, null, null, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.16", Collections.singletonList("postalAddress"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.51", Collections
-        .singletonList("houseIdentifier"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.17", Collections.singletonList("postalCode"), EMPTY_STRING,
+                false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.43", Collections.singletonList("initials"),
-        EMPTY_STRING, false, "name", null, null, null, null, null, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.18", Collections.singletonList("postOfficeBox"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.25", Collections
-        .singletonList("internationalISDNNumber"), EMPTY_STRING, false, null,
-        EMR_NUMERIC_STRING_OID, null, SMR_NUMERIC_STRING_OID, null,
-        SYNTAX_NUMERIC_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.28", Collections.singletonList("preferredDeliveryMethod"),
+                EMPTY_STRING, false, null, null, null, null, null, SYNTAX_DELIVERY_METHOD_OID,
+                true, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.7", Arrays.asList("l", "localityName"),
-        EMPTY_STRING, false, "name", null, null, null, null, null, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.26", Collections.singletonList("registeredAddress"),
+                EMPTY_STRING, false, "postalAddress", null, null, null, null,
+                SYNTAX_POSTAL_ADDRESS_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.31", Collections.singletonList("member"),
-        EMPTY_STRING, false, "distinguishedName", null, null, null, null, null,
-        false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN,
-        false);
+        builder.addAttributeType("2.5.4.33", Collections.singletonList("roleOccupant"),
+                EMPTY_STRING, false, "distinguishedName", null, null, null, null, null, false,
+                false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.10",
-        Arrays.asList("o", "organizationName"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.14", Collections.singletonList("searchGuide"),
+                EMPTY_STRING, false, null, null, null, null, null, SYNTAX_GUIDE_OID, false, false,
+                false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.11", Arrays.asList("ou",
-        "organizationalUnitName"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.34", Collections.singletonList("seeAlso"), EMPTY_STRING,
+                false, "distinguishedName", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.32", Collections.singletonList("owner"),
-        EMPTY_STRING, false, "distinguishedName", null, null, null, null, null,
-        false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN,
-        false);
+        builder.addAttributeType("2.5.4.5", Collections.singletonList("serialNumber"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_PRINTABLE_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.19", Collections
-        .singletonList("physicalDeliveryOfficeName"), EMPTY_STRING, false,
-        null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.4", Arrays.asList("sn", "surname"), EMPTY_STRING, false,
+                "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.16", Collections
-        .singletonList("postalAddress"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.8", Arrays.asList("st", "stateOrProvinceName"),
+                EMPTY_STRING, false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.17", Collections
-        .singletonList("postalCode"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.9", Arrays.asList("street", "streetAddress"), EMPTY_STRING,
+                false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.18", Collections
-        .singletonList("postOfficeBox"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.20", Collections.singletonList("telephoneNumber"),
+                EMPTY_STRING, false, null, EMR_TELEPHONE_OID, null, SMR_TELEPHONE_OID, null,
+                SYNTAX_TELEPHONE_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.28", Collections
-        .singletonList("preferredDeliveryMethod"), EMPTY_STRING, false, null,
-        null, null, null, null, SYNTAX_DELIVERY_METHOD_OID, true, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.22",
+                Collections.singletonList("teletexTerminalIdentifier"), EMPTY_STRING, false, null,
+                null, null, null, null, SYNTAX_TELETEX_TERM_ID_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.26", Collections
-        .singletonList("registeredAddress"), EMPTY_STRING, false,
-        "postalAddress", null, null, null, null, SYNTAX_POSTAL_ADDRESS_OID,
-        false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN,
-        false);
+        builder.addAttributeType("2.5.4.21", Collections.singletonList("telexNumber"),
+                EMPTY_STRING, false, null, null, null, null, null, SYNTAX_TELEX_OID, false, false,
+                false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.33", Collections
-        .singletonList("roleOccupant"), EMPTY_STRING, false,
-        "distinguishedName", null, null, null, null, null, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.12", Collections.singletonList("title"), EMPTY_STRING,
+                false, "name", null, null, null, null, null, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.14", Collections
-        .singletonList("searchGuide"), EMPTY_STRING, false, null, null, null,
-        null, null, SYNTAX_GUIDE_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("0.9.2342.19200300.100.1.1", Arrays.asList("uid", "userid"),
+                EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
+                SYNTAX_DIRECTORY_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.34", Collections.singletonList("seeAlso"),
-        EMPTY_STRING, false, "distinguishedName", null, null, null, null, null,
-        false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN,
-        false);
+        builder.addAttributeType("2.5.4.50", Collections.singletonList("uniqueMember"),
+                EMPTY_STRING, false, null, EMR_UNIQUE_MEMBER_OID, null, null, null,
+                SYNTAX_NAME_AND_OPTIONAL_UID_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.5", Collections
-        .singletonList("serialNumber"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_PRINTABLE_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.35", Collections.singletonList("userPassword"),
+                EMPTY_STRING, false, null, EMR_OCTET_STRING_OID, null, null, null,
+                SYNTAX_OCTET_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.4", Arrays.asList("sn", "surname"),
-        EMPTY_STRING, false, "name", null, null, null, null, null, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.24", Collections.singletonList("x121Address"),
+                EMPTY_STRING, false, null, EMR_NUMERIC_STRING_OID, null, SMR_NUMERIC_STRING_OID,
+                null, SYNTAX_NUMERIC_STRING_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.8", Arrays.asList("st",
-        "stateOrProvinceName"), EMPTY_STRING, false, "name", null, null, null,
-        null, null, false, false, false, AttributeUsage.USER_APPLICATIONS,
-        RFC4519_ORIGIN, false);
+        builder.addAttributeType("2.5.4.45", Collections.singletonList("x500UniqueIdentifier"),
+                EMPTY_STRING, false, null, EMR_BIT_STRING_OID, null, null, null,
+                SYNTAX_BIT_STRING_OID, false, false, false, AttributeUsage.USER_APPLICATIONS,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.9", Arrays
-        .asList("street", "streetAddress"), EMPTY_STRING, false, null,
-        EMR_CASE_IGNORE_OID, null, SMR_CASE_IGNORE_OID, null,
-        SYNTAX_DIRECTORY_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        Set<String> attrs = new HashSet<String>();
+        attrs.add("seeAlso");
+        attrs.add("ou");
+        attrs.add("l");
+        attrs.add("description");
 
-    builder.addAttributeType("2.5.4.20", Collections
-        .singletonList("telephoneNumber"), EMPTY_STRING, false, null,
-        EMR_TELEPHONE_OID, null, SMR_TELEPHONE_OID, null, SYNTAX_TELEPHONE_OID,
-        false, false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN,
-        false);
+        builder.addObjectClass("2.5.6.11", Collections.singletonList("applicationProcess"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections
+                        .singleton("cn"), attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.22", Collections
-        .singletonList("teletexTerminalIdentifier"), EMPTY_STRING, false, null,
-        null, null, null, null, SYNTAX_TELETEX_TERM_ID_OID, false, false,
-        false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("searchGuide");
+        attrs.add("description");
 
-    builder.addAttributeType("2.5.4.21", Collections
-        .singletonList("telexNumber"), EMPTY_STRING, false, null, null, null,
-        null, null, SYNTAX_TELEX_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.2", Collections.singletonList("country"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("c"),
+                attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.12", Collections.singletonList("title"),
-        EMPTY_STRING, false, "name", null, null, null, null, null, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addObjectClass("1.3.6.1.4.1.1466.344", Collections.singletonList("dcObject"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections
+                        .singleton("dc"), EMPTY_STRING_SET, ObjectClassType.AUXILIARY,
+                RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("0.9.2342.19200300.100.1.1", Arrays.asList("uid",
-        "userid"), EMPTY_STRING, false, null, EMR_CASE_IGNORE_OID, null,
-        SMR_CASE_IGNORE_OID, null, SYNTAX_DIRECTORY_STRING_OID, false, false,
-        false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("serialNumber");
+        attrs.add("seeAlso");
+        attrs.add("owner");
+        attrs.add("ou");
+        attrs.add("o");
+        attrs.add("l");
+        attrs.add("description");
 
-    builder.addAttributeType("2.5.4.50", Collections
-        .singletonList("uniqueMember"), EMPTY_STRING, false, null,
-        EMR_UNIQUE_MEMBER_OID, null, null, null,
-        SYNTAX_NAME_AND_OPTIONAL_UID_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.14", Collections.singletonList("device"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("cn"),
+                attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addAttributeType("2.5.4.35", Collections
-        .singletonList("userPassword"), EMPTY_STRING, false, null,
-        EMR_OCTET_STRING_OID, null, null, null, SYNTAX_OCTET_STRING_OID, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        Set<String> must = new HashSet<String>();
+        must.add("member");
+        must.add("cn");
 
-    builder.addAttributeType("2.5.4.24", Collections
-        .singletonList("x121Address"), EMPTY_STRING, false, null,
-        EMR_NUMERIC_STRING_OID, null, SMR_NUMERIC_STRING_OID, null,
-        SYNTAX_NUMERIC_STRING_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("businessCategory");
+        attrs.add("seeAlso");
+        attrs.add("owner");
+        attrs.add("ou");
+        attrs.add("o");
+        attrs.add("description");
 
-    builder.addAttributeType("2.5.4.45", Collections
-        .singletonList("x500UniqueIdentifier"), EMPTY_STRING, false, null,
-        EMR_BIT_STRING_OID, null, null, null, SYNTAX_BIT_STRING_OID, false,
-        false, false, AttributeUsage.USER_APPLICATIONS, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.9", Collections.singletonList("groupOfNames"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), must, attrs,
+                ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    Set<String> attrs = new HashSet<String>();
-    attrs.add("seeAlso");
-    attrs.add("ou");
-    attrs.add("l");
-    attrs.add("description");
+        attrs = new HashSet<String>();
+        attrs.add("businessCategory");
+        attrs.add("seeAlso");
+        attrs.add("owner");
+        attrs.add("ou");
+        attrs.add("o");
+        attrs.add("description");
 
-    builder.addObjectClass("2.5.6.11", Collections
-        .singletonList("applicationProcess"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("cn"), attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.17", Collections.singletonList("groupOfUniqueNames"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), must, attrs,
+                ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    attrs = new HashSet<String>();
-    attrs.add("searchGuide");
-    attrs.add("description");
+        attrs = new HashSet<String>();
+        attrs.add("street");
+        attrs.add("seeAlso");
+        attrs.add("searchGuide");
+        attrs.add("st");
+        attrs.add("l");
+        attrs.add("description");
 
-    builder.addObjectClass("2.5.6.2", Collections.singletonList("country"),
-        EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME),
-        Collections.singleton("c"), attrs, ObjectClassType.STRUCTURAL,
-        RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.3", Collections.singletonList("locality"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), EMPTY_STRING_SET, attrs,
+                ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addObjectClass("1.3.6.1.4.1.1466.344", Collections
-        .singletonList("dcObject"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("dc"),
-        EMPTY_STRING_SET, ObjectClassType.AUXILIARY, RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("userPassword");
+        attrs.add("searchGuide");
+        attrs.add("seeAlso");
+        attrs.add("businessCategory");
+        attrs.add("x121Address");
+        attrs.add("registeredAddress");
+        attrs.add("destinationIndicator");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("telexNumber");
+        attrs.add("teletexTerminalIdentifier");
+        attrs.add("telephoneNumber");
+        attrs.add("internationalISDNNumber");
+        attrs.add("facsimileTelephoneNumber");
+        attrs.add("street");
+        attrs.add("postOfficeBox");
+        attrs.add("postalCode");
+        attrs.add("postalAddress");
+        attrs.add("physicalDeliveryOfficeName");
+        attrs.add("st");
+        attrs.add("l");
+        attrs.add("description");
 
-    attrs = new HashSet<String>();
-    attrs.add("serialNumber");
-    attrs.add("seeAlso");
-    attrs.add("owner");
-    attrs.add("ou");
-    attrs.add("o");
-    attrs.add("l");
-    attrs.add("description");
+        builder.addObjectClass("2.5.6.4", Collections.singletonList("organization"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("o"),
+                attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addObjectClass("2.5.6.14", Collections.singletonList("device"),
-        EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME),
-        Collections.singleton("cn"), attrs, ObjectClassType.STRUCTURAL,
-        RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("title");
+        attrs.add("x121Address");
+        attrs.add("registeredAddress");
+        attrs.add("destinationIndicator");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("telexNumber");
+        attrs.add("teletexTerminalIdentifier");
+        attrs.add("telephoneNumber");
+        attrs.add("internationalISDNNumber");
+        attrs.add("facsimileTelephoneNumber");
+        attrs.add("street");
+        attrs.add("postOfficeBox");
+        attrs.add("postalCode");
+        attrs.add("postalAddress");
+        attrs.add("physicalDeliveryOfficeName");
+        attrs.add("ou");
+        attrs.add("st");
+        attrs.add("l");
 
-    Set<String> must = new HashSet<String>();
-    must.add("member");
-    must.add("cn");
+        builder.addObjectClass("2.5.6.7", Collections.singletonList("organizationalPerson"),
+                EMPTY_STRING, false, Collections.singleton("person"), EMPTY_STRING_SET, attrs,
+                ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    attrs = new HashSet<String>();
-    attrs.add("businessCategory");
-    attrs.add("seeAlso");
-    attrs.add("owner");
-    attrs.add("ou");
-    attrs.add("o");
-    attrs.add("description");
+        attrs = new HashSet<String>();
+        attrs.add("x121Address");
+        attrs.add("registeredAddress");
+        attrs.add("destinationIndicator");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("telexNumber");
+        attrs.add("teletexTerminalIdentifier");
+        attrs.add("telephoneNumber");
+        attrs.add("internationalISDNNumber");
+        attrs.add("facsimileTelephoneNumber");
+        attrs.add("seeAlso");
+        attrs.add("roleOccupant");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("street");
+        attrs.add("postOfficeBox");
+        attrs.add("postalCode");
+        attrs.add("postalAddress");
+        attrs.add("physicalDeliveryOfficeName");
+        attrs.add("ou");
+        attrs.add("st");
+        attrs.add("l");
+        attrs.add("description");
 
-    builder.addObjectClass("2.5.6.9",
-        Collections.singletonList("groupOfNames"), EMPTY_STRING, false,
-        Collections.singleton(TOP_OBJECTCLASS_NAME), must, attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.8", Collections.singletonList("organizationalRole"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections
+                        .singleton("cn"), attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    attrs = new HashSet<String>();
-    attrs.add("businessCategory");
-    attrs.add("seeAlso");
-    attrs.add("owner");
-    attrs.add("ou");
-    attrs.add("o");
-    attrs.add("description");
+        attrs = new HashSet<String>();
+        attrs.add("businessCategory");
+        attrs.add("description");
+        attrs.add("destinationIndicator");
+        attrs.add("facsimileTelephoneNumber");
+        attrs.add("internationalISDNNumber");
+        attrs.add("l");
+        attrs.add("physicalDeliveryOfficeName");
+        attrs.add("postalAddress");
+        attrs.add("postalCode");
+        attrs.add("postOfficeBox");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("registeredAddress");
+        attrs.add("searchGuide");
+        attrs.add("seeAlso");
+        attrs.add("st");
+        attrs.add("street");
+        attrs.add("telephoneNumber");
+        attrs.add("teletexTerminalIdentifier");
+        attrs.add("telexNumber");
+        attrs.add("userPassword");
+        attrs.add("x121Address");
 
-    builder.addObjectClass("2.5.6.17", Collections
-        .singletonList("groupOfUniqueNames"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), must, attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
+        builder.addObjectClass("2.5.6.5", Collections.singletonList("organizationalUnit"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections
+                        .singleton("ou"), attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    attrs = new HashSet<String>();
-    attrs.add("street");
-    attrs.add("seeAlso");
-    attrs.add("searchGuide");
-    attrs.add("st");
-    attrs.add("l");
-    attrs.add("description");
+        must = new HashSet<String>();
+        must.add("sn");
+        must.add("cn");
 
-    builder.addObjectClass("2.5.6.3", Collections.singletonList("locality"),
-        EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME),
-        EMPTY_STRING_SET, attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN,
-        false);
+        attrs = new HashSet<String>();
+        attrs.add("userPassword");
+        attrs.add("telephoneNumber");
+        attrs.add("destinationIndicator");
+        attrs.add("seeAlso");
+        attrs.add("description");
 
-    attrs = new HashSet<String>();
-    attrs.add("userPassword");
-    attrs.add("searchGuide");
-    attrs.add("seeAlso");
-    attrs.add("businessCategory");
-    attrs.add("x121Address");
-    attrs.add("registeredAddress");
-    attrs.add("destinationIndicator");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("telexNumber");
-    attrs.add("teletexTerminalIdentifier");
-    attrs.add("telephoneNumber");
-    attrs.add("internationalISDNNumber");
-    attrs.add("facsimileTelephoneNumber");
-    attrs.add("street");
-    attrs.add("postOfficeBox");
-    attrs.add("postalCode");
-    attrs.add("postalAddress");
-    attrs.add("physicalDeliveryOfficeName");
-    attrs.add("st");
-    attrs.add("l");
-    attrs.add("description");
+        builder.addObjectClass("2.5.6.6", Collections.singletonList("person"), EMPTY_STRING, false,
+                Collections.singleton(TOP_OBJECTCLASS_NAME), must, attrs,
+                ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addObjectClass("2.5.6.4",
-        Collections.singletonList("organization"), EMPTY_STRING, false,
-        Collections.singleton(TOP_OBJECTCLASS_NAME),
-        Collections.singleton("o"), attrs, ObjectClassType.STRUCTURAL,
-        RFC4519_ORIGIN, false);
+        attrs = new HashSet<String>();
+        attrs.add("businessCategory");
+        attrs.add("x121Address");
+        attrs.add("registeredAddress");
+        attrs.add("destinationIndicator");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("telexNumber");
+        attrs.add("teletexTerminalIdentifier");
+        attrs.add("telephoneNumber");
+        attrs.add("internationalISDNNumber");
+        attrs.add("facsimileTelephoneNumber");
+        attrs.add("preferredDeliveryMethod");
+        attrs.add("street");
+        attrs.add("postOfficeBox");
+        attrs.add("postalCode");
+        attrs.add("postalAddress");
+        attrs.add("physicalDeliveryOfficeName");
+        attrs.add("st");
+        attrs.add("l");
 
-    attrs = new HashSet<String>();
-    attrs.add("title");
-    attrs.add("x121Address");
-    attrs.add("registeredAddress");
-    attrs.add("destinationIndicator");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("telexNumber");
-    attrs.add("teletexTerminalIdentifier");
-    attrs.add("telephoneNumber");
-    attrs.add("internationalISDNNumber");
-    attrs.add("facsimileTelephoneNumber");
-    attrs.add("street");
-    attrs.add("postOfficeBox");
-    attrs.add("postalCode");
-    attrs.add("postalAddress");
-    attrs.add("physicalDeliveryOfficeName");
-    attrs.add("ou");
-    attrs.add("st");
-    attrs.add("l");
+        builder.addObjectClass("2.5.6.10", Collections.singletonList("residentialPerson"),
+                EMPTY_STRING, false, Collections.singleton("person"), Collections.singleton("l"),
+                attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
 
-    builder.addObjectClass("2.5.6.7", Collections
-        .singletonList("organizationalPerson"), EMPTY_STRING, false,
-        Collections.singleton("person"), EMPTY_STRING_SET, attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
+        builder.addObjectClass("1.3.6.1.1.3.1", Collections.singletonList("uidObject"),
+                EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), Collections
+                        .singleton("uid"), attrs, ObjectClassType.AUXILIARY, RFC4519_ORIGIN, false);
+    }
 
-    attrs = new HashSet<String>();
-    attrs.add("x121Address");
-    attrs.add("registeredAddress");
-    attrs.add("destinationIndicator");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("telexNumber");
-    attrs.add("teletexTerminalIdentifier");
-    attrs.add("telephoneNumber");
-    attrs.add("internationalISDNNumber");
-    attrs.add("facsimileTelephoneNumber");
-    attrs.add("seeAlso");
-    attrs.add("roleOccupant");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("street");
-    attrs.add("postOfficeBox");
-    attrs.add("postalCode");
-    attrs.add("postalAddress");
-    attrs.add("physicalDeliveryOfficeName");
-    attrs.add("ou");
-    attrs.add("st");
-    attrs.add("l");
-    attrs.add("description");
+    private static void addRFC4530(final SchemaBuilder builder) {
+        builder.addSyntax(SYNTAX_UUID_OID, SYNTAX_UUID_DESCRIPTION, RFC4530_ORIGIN,
+                new UUIDSyntaxImpl(), false);
+        builder.addMatchingRule(EMR_UUID_OID, Collections.singletonList(EMR_UUID_NAME),
+                EMPTY_STRING, false, SYNTAX_UUID_OID, RFC4530_ORIGIN,
+                new UUIDEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_UUID_OID, Collections.singletonList(OMR_UUID_NAME),
+                EMPTY_STRING, false, SYNTAX_UUID_OID, RFC4530_ORIGIN,
+                new UUIDOrderingMatchingRuleImpl(), false);
+        builder.addAttributeType("1.3.6.1.1.16.4", Collections.singletonList("entryUUID"),
+                "UUID of the entry", false, null, EMR_UUID_OID, OMR_UUID_OID, null, null,
+                SYNTAX_UUID_OID, true, false, true, AttributeUsage.DIRECTORY_OPERATION,
+                RFC4530_ORIGIN, false);
+    }
 
-    builder.addObjectClass("2.5.6.8", Collections
-        .singletonList("organizationalRole"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("cn"), attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
-
-    attrs = new HashSet<String>();
-    attrs.add("businessCategory");
-    attrs.add("description");
-    attrs.add("destinationIndicator");
-    attrs.add("facsimileTelephoneNumber");
-    attrs.add("internationalISDNNumber");
-    attrs.add("l");
-    attrs.add("physicalDeliveryOfficeName");
-    attrs.add("postalAddress");
-    attrs.add("postalCode");
-    attrs.add("postOfficeBox");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("registeredAddress");
-    attrs.add("searchGuide");
-    attrs.add("seeAlso");
-    attrs.add("st");
-    attrs.add("street");
-    attrs.add("telephoneNumber");
-    attrs.add("teletexTerminalIdentifier");
-    attrs.add("telexNumber");
-    attrs.add("userPassword");
-    attrs.add("x121Address");
-
-    builder.addObjectClass("2.5.6.5", Collections
-        .singletonList("organizationalUnit"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("ou"), attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
-
-    must = new HashSet<String>();
-    must.add("sn");
-    must.add("cn");
-
-    attrs = new HashSet<String>();
-    attrs.add("userPassword");
-    attrs.add("telephoneNumber");
-    attrs.add("destinationIndicator");
-    attrs.add("seeAlso");
-    attrs.add("description");
-
-    builder.addObjectClass("2.5.6.6", Collections.singletonList("person"),
-        EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME), must,
-        attrs, ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
-
-    attrs = new HashSet<String>();
-    attrs.add("businessCategory");
-    attrs.add("x121Address");
-    attrs.add("registeredAddress");
-    attrs.add("destinationIndicator");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("telexNumber");
-    attrs.add("teletexTerminalIdentifier");
-    attrs.add("telephoneNumber");
-    attrs.add("internationalISDNNumber");
-    attrs.add("facsimileTelephoneNumber");
-    attrs.add("preferredDeliveryMethod");
-    attrs.add("street");
-    attrs.add("postOfficeBox");
-    attrs.add("postalCode");
-    attrs.add("postalAddress");
-    attrs.add("physicalDeliveryOfficeName");
-    attrs.add("st");
-    attrs.add("l");
-
-    builder.addObjectClass("2.5.6.10", Collections
-        .singletonList("residentialPerson"), EMPTY_STRING, false, Collections
-        .singleton("person"), Collections.singleton("l"), attrs,
-        ObjectClassType.STRUCTURAL, RFC4519_ORIGIN, false);
-
-    builder.addObjectClass("1.3.6.1.1.3.1", Collections
-        .singletonList("uidObject"), EMPTY_STRING, false, Collections
-        .singleton(TOP_OBJECTCLASS_NAME), Collections.singleton("uid"), attrs,
-        ObjectClassType.AUXILIARY, RFC4519_ORIGIN, false);
-  }
-
-
-
-  private static void addRFC4530(final SchemaBuilder builder)
-  {
-    builder.addSyntax(SYNTAX_UUID_OID, SYNTAX_UUID_DESCRIPTION, RFC4530_ORIGIN,
-        new UUIDSyntaxImpl(), false);
-    builder.addMatchingRule(EMR_UUID_OID, Collections
-        .singletonList(EMR_UUID_NAME), EMPTY_STRING, false, SYNTAX_UUID_OID,
-        RFC4530_ORIGIN, new UUIDEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_UUID_OID, Collections
-        .singletonList(OMR_UUID_NAME), EMPTY_STRING, false, SYNTAX_UUID_OID,
-        RFC4530_ORIGIN, new UUIDOrderingMatchingRuleImpl(), false);
-    builder.addAttributeType("1.3.6.1.1.16.4", Collections
-        .singletonList("entryUUID"), "UUID of the entry", false, null,
-        EMR_UUID_OID, OMR_UUID_OID, null, null, SYNTAX_UUID_OID, true, false,
-        true, AttributeUsage.DIRECTORY_OPERATION, RFC4530_ORIGIN, false);
-  }
-
-
-
-  private static void addSunProprietary(final SchemaBuilder builder)
-  {
-    builder.addSyntax(SYNTAX_USER_PASSWORD_OID,
-        SYNTAX_USER_PASSWORD_DESCRIPTION, OPENDS_ORIGIN,
-        new UserPasswordSyntaxImpl(), false);
-    builder.addMatchingRule(EMR_USER_PASSWORD_EXACT_OID, Collections
-        .singletonList(EMR_USER_PASSWORD_EXACT_NAME),
-        EMR_USER_PASSWORD_EXACT_DESCRIPTION, false, SYNTAX_USER_PASSWORD_OID,
-        OPENDS_ORIGIN, new UserPasswordExactEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(AMR_DOUBLE_METAPHONE_OID, Collections
-        .singletonList(AMR_DOUBLE_METAPHONE_NAME),
-        AMR_DOUBLE_METAPHONE_DESCRIPTION, false, SYNTAX_DIRECTORY_STRING_OID,
-        OPENDS_ORIGIN, new DoubleMetaphoneApproximateMatchingRuleImpl(), false);
-
-  }
-
-
-
-  private static void defaultAttributeTypes(final SchemaBuilder builder)
-  {
-    builder.addAttributeType("2.5.4.0", Collections
-        .singletonList("objectClass"), EMPTY_STRING, false, null, EMR_OID_NAME,
-        null, null, null, SYNTAX_OID_OID, false, false, false,
-        AttributeUsage.USER_APPLICATIONS, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.4.1", Collections
-        .singletonList("aliasedObjectName"), EMPTY_STRING, false, null,
-        EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.18.1", Collections
-        .singletonList("createTimestamp"), EMPTY_STRING, false, null,
-        EMR_GENERALIZED_TIME_NAME, OMR_GENERALIZED_TIME_NAME, null, null,
-        SYNTAX_GENERALIZED_TIME_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.18.2", Collections
-        .singletonList("modifyTimestamp"), EMPTY_STRING, false, null,
-        EMR_GENERALIZED_TIME_NAME, OMR_GENERALIZED_TIME_NAME, null, null,
-        SYNTAX_GENERALIZED_TIME_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.18.3", Collections
-        .singletonList("creatorsName"), EMPTY_STRING, false, null, EMR_DN_NAME,
-        null, null, null, SYNTAX_DN_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.18.4", Collections
-        .singletonList("modifiersName"), EMPTY_STRING, false, null,
-        EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-
-    builder.addAttributeType("2.5.18.10", Collections
-        .singletonList("subschemaSubentry"), EMPTY_STRING, false, null,
-        EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+    private static void addSunProprietary(final SchemaBuilder builder) {
+        builder.addSyntax(SYNTAX_USER_PASSWORD_OID, SYNTAX_USER_PASSWORD_DESCRIPTION,
+                OPENDS_ORIGIN, new UserPasswordSyntaxImpl(), false);
+        builder.addMatchingRule(EMR_USER_PASSWORD_EXACT_OID, Collections
+                .singletonList(EMR_USER_PASSWORD_EXACT_NAME), EMR_USER_PASSWORD_EXACT_DESCRIPTION,
+                false, SYNTAX_USER_PASSWORD_OID, OPENDS_ORIGIN,
+                new UserPasswordExactEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(AMR_DOUBLE_METAPHONE_OID, Collections
+                .singletonList(AMR_DOUBLE_METAPHONE_NAME), AMR_DOUBLE_METAPHONE_DESCRIPTION, false,
+                SYNTAX_DIRECTORY_STRING_OID, OPENDS_ORIGIN,
+                new DoubleMetaphoneApproximateMatchingRuleImpl(), false);
 
-    builder.addAttributeType("2.5.21.5", Collections
-        .singletonList("attributeTypes"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
-        SYNTAX_ATTRIBUTE_TYPE_OID, false, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+    }
 
-    builder.addAttributeType("2.5.21.6", Collections
-        .singletonList("objectClasses"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null, SYNTAX_OBJECTCLASS_OID,
-        false, false, false, AttributeUsage.DIRECTORY_OPERATION,
-        RFC4512_ORIGIN, false);
+    private static void defaultAttributeTypes(final SchemaBuilder builder) {
+        builder.addAttributeType("2.5.4.0", Collections.singletonList("objectClass"), EMPTY_STRING,
+                false, null, EMR_OID_NAME, null, null, null, SYNTAX_OID_OID, false, false, false,
+                AttributeUsage.USER_APPLICATIONS, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.4", Collections
-        .singletonList("matchingRules"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
-        SYNTAX_MATCHING_RULE_OID, false, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.4.1", Collections.singletonList("aliasedObjectName"),
+                EMPTY_STRING, false, null, EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true,
+                false, false, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.8", Collections
-        .singletonList("matchingRuleUse"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
-        SYNTAX_MATCHING_RULE_USE_OID, false, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.18.1", Collections.singletonList("createTimestamp"),
+                EMPTY_STRING, false, null, EMR_GENERALIZED_TIME_NAME, OMR_GENERALIZED_TIME_NAME,
+                null, null, SYNTAX_GENERALIZED_TIME_OID, true, false, true,
+                AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.9", Collections
-        .singletonList("structuralObjectClass"), EMPTY_STRING, false, null,
-        EMR_OID_NAME, null, null, null, SYNTAX_OID_OID, true, false, true,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.18.2", Collections.singletonList("modifyTimestamp"),
+                EMPTY_STRING, false, null, EMR_GENERALIZED_TIME_NAME, OMR_GENERALIZED_TIME_NAME,
+                null, null, SYNTAX_GENERALIZED_TIME_OID, true, false, true,
+                AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.10", Collections
-        .singletonList("governingStructureRule"), EMPTY_STRING, false, null,
-        EMR_INTEGER_NAME, null, null, null, SYNTAX_INTEGER_OID, true, false,
-        true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.18.3", Collections.singletonList("creatorsName"),
+                EMPTY_STRING, false, null, EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true,
+                false, true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.5", Collections
-        .singletonList("namingContexts"), EMPTY_STRING, false, null, null,
-        null, null, null, SYNTAX_DN_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.18.4", Collections.singletonList("modifiersName"),
+                EMPTY_STRING, false, null, EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true,
+                false, true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.6", Collections
-        .singletonList("altServer"), EMPTY_STRING, false, null, null, null,
-        null, null, SYNTAX_IA5_STRING_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.18.10", Collections.singletonList("subschemaSubentry"),
+                EMPTY_STRING, false, null, EMR_DN_NAME, null, null, null, SYNTAX_DN_OID, true,
+                false, true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.7", Collections
-        .singletonList("supportedExtension"), EMPTY_STRING, false, null, null,
-        null, null, null, SYNTAX_OID_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.5", Collections.singletonList("attributeTypes"),
+                EMPTY_STRING, false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_ATTRIBUTE_TYPE_OID, false, false, false, AttributeUsage.DIRECTORY_OPERATION,
+                RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.13", Collections
-        .singletonList("supportedControl"), EMPTY_STRING, false, null, null,
-        null, null, null, SYNTAX_OID_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.6", Collections.singletonList("objectClasses"),
+                EMPTY_STRING, false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_OBJECTCLASS_OID, false, false, false, AttributeUsage.DIRECTORY_OPERATION,
+                RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.14", Collections
-        .singletonList("supportedSASLMechanisms"), EMPTY_STRING, false, null,
-        null, null, null, null, SYNTAX_DIRECTORY_STRING_OID, false, false,
-        false, AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.4", Collections.singletonList("matchingRules"),
+                EMPTY_STRING, false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_MATCHING_RULE_OID, false, false, false, AttributeUsage.DIRECTORY_OPERATION,
+                RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.4203.1.3.5", Collections
-        .singletonList("supportedFeatures"), EMPTY_STRING, false, null,
-        EMR_OID_NAME, null, null, null, SYNTAX_OID_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.8", Collections.singletonList("matchingRuleUse"),
+                EMPTY_STRING, false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_MATCHING_RULE_USE_OID, false, false, false,
+                AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.15", Collections
-        .singletonList("supportedLDAPVersion"), EMPTY_STRING, false, null,
-        null, null, null, null, SYNTAX_INTEGER_OID, false, false, false,
-        AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.9", Collections.singletonList("structuralObjectClass"),
+                EMPTY_STRING, false, null, EMR_OID_NAME, null, null, null, SYNTAX_OID_OID, true,
+                false, true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("1.3.6.1.4.1.1466.101.120.16", Collections
-        .singletonList("ldapSyntaxes"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null, SYNTAX_LDAP_SYNTAX_OID,
-        false, false, false, AttributeUsage.DIRECTORY_OPERATION,
-        RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.10", Collections.singletonList("governingStructureRule"),
+                EMPTY_STRING, false, null, EMR_INTEGER_NAME, null, null, null, SYNTAX_INTEGER_OID,
+                true, false, true, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.1", Collections
-        .singletonList("ditStructureRules"), EMPTY_STRING, false, null,
-        EMR_INTEGER_FIRST_COMPONENT_NAME, null, null, null,
-        SYNTAX_DIT_STRUCTURE_RULE_OID, false, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.5", Collections
+                .singletonList("namingContexts"), EMPTY_STRING, false, null, null, null, null,
+                null, SYNTAX_DN_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.7",
-        Collections.singletonList("nameForms"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null, SYNTAX_NAME_FORM_OID,
-        false, false, false, AttributeUsage.DIRECTORY_OPERATION,
-        RFC4512_ORIGIN, false);
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.6", Collections
+                .singletonList("altServer"), EMPTY_STRING, false, null, null, null, null, null,
+                SYNTAX_IA5_STRING_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
-    builder.addAttributeType("2.5.21.2", Collections
-        .singletonList("ditContentRules"), EMPTY_STRING, false, null,
-        EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
-        SYNTAX_DIT_CONTENT_RULE_OID, false, false, false,
-        AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
-  }
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.7", Collections
+                .singletonList("supportedExtension"), EMPTY_STRING, false, null, null, null, null,
+                null, SYNTAX_OID_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.13", Collections
+                .singletonList("supportedControl"), EMPTY_STRING, false, null, null, null, null,
+                null, SYNTAX_OID_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.14", Collections
+                .singletonList("supportedSASLMechanisms"), EMPTY_STRING, false, null, null, null,
+                null, null, SYNTAX_DIRECTORY_STRING_OID, false, false, false,
+                AttributeUsage.DSA_OPERATION, RFC4512_ORIGIN, false);
 
-  private static void defaultMatchingRules(final SchemaBuilder builder)
-  {
-    builder.addMatchingRule(EMR_BIT_STRING_OID, Collections
-        .singletonList(EMR_BIT_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_BIT_STRING_OID, RFC4512_ORIGIN,
-        new BitStringEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_BOOLEAN_OID, Collections
-        .singletonList(EMR_BOOLEAN_NAME), EMPTY_STRING, false,
-        SYNTAX_BOOLEAN_OID, RFC4512_ORIGIN,
-        new BooleanEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_CASE_EXACT_IA5_OID, Collections
-        .singletonList(EMR_CASE_EXACT_IA5_NAME), EMPTY_STRING, false,
-        SYNTAX_IA5_STRING_OID, RFC4512_ORIGIN,
-        new CaseExactIA5EqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_CASE_EXACT_IA5_OID, Collections
-        .singletonList(SMR_CASE_EXACT_IA5_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new CaseExactIA5SubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_CASE_EXACT_OID, Collections
-        .singletonList(EMR_CASE_EXACT_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new CaseExactEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_CASE_EXACT_OID, Collections
-        .singletonList(OMR_CASE_EXACT_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new CaseExactOrderingMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_CASE_EXACT_OID, Collections
-        .singletonList(SMR_CASE_EXACT_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new CaseExactSubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_CASE_IGNORE_IA5_OID, Collections
-        .singletonList(EMR_CASE_IGNORE_IA5_NAME), EMPTY_STRING, false,
-        SYNTAX_IA5_STRING_OID, RFC4512_ORIGIN,
-        new CaseIgnoreIA5EqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_CASE_IGNORE_IA5_OID, Collections
-        .singletonList(SMR_CASE_IGNORE_IA5_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new CaseIgnoreIA5SubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_CASE_IGNORE_LIST_OID, Collections
-        .singletonList(EMR_CASE_IGNORE_LIST_NAME), EMPTY_STRING, false,
-        SYNTAX_POSTAL_ADDRESS_OID, RFC4512_ORIGIN,
-        new CaseIgnoreListEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_CASE_IGNORE_LIST_OID, Collections
-        .singletonList(SMR_CASE_IGNORE_LIST_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new CaseIgnoreListSubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_CASE_IGNORE_OID, Collections
-        .singletonList(EMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new CaseIgnoreEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_CASE_IGNORE_OID, Collections
-        .singletonList(OMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new CaseIgnoreOrderingMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_CASE_IGNORE_OID, Collections
-        .singletonList(SMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new CaseIgnoreSubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID,
-        Collections.singletonList(EMR_DIRECTORY_STRING_FIRST_COMPONENT_NAME),
-        EMPTY_STRING, false, SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new DirectoryStringFirstComponentEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_DN_OID, Collections.singletonList(EMR_DN_NAME),
-        EMPTY_STRING, false, SYNTAX_DN_OID, RFC4512_ORIGIN,
-        new DistinguishedNameEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_GENERALIZED_TIME_OID, Collections
-        .singletonList(EMR_GENERALIZED_TIME_NAME), EMPTY_STRING, false,
-        SYNTAX_GENERALIZED_TIME_OID, RFC4512_ORIGIN,
-        new GeneralizedTimeEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_GENERALIZED_TIME_OID, Collections
-        .singletonList(OMR_GENERALIZED_TIME_NAME), EMPTY_STRING, false,
-        SYNTAX_GENERALIZED_TIME_OID, RFC4512_ORIGIN,
-        new GeneralizedTimeOrderingMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_INTEGER_FIRST_COMPONENT_OID, Collections
-        .singletonList(EMR_INTEGER_FIRST_COMPONENT_NAME), EMPTY_STRING, false,
-        SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
-        new IntegerFirstComponentEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_INTEGER_OID, Collections
-        .singletonList(EMR_INTEGER_NAME), EMPTY_STRING, false,
-        SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
-        new IntegerEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_INTEGER_OID, Collections
-        .singletonList(OMR_INTEGER_NAME), EMPTY_STRING, false,
-        SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
-        new IntegerOrderingMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_KEYWORD_OID, Collections
-        .singletonList(EMR_KEYWORD_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new KeywordEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_NUMERIC_STRING_OID, Collections
-        .singletonList(EMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_NUMERIC_STRING_OID, RFC4512_ORIGIN,
-        new NumericStringEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_NUMERIC_STRING_OID, Collections
-        .singletonList(OMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_NUMERIC_STRING_OID, RFC4512_ORIGIN,
-        new NumericStringOrderingMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_NUMERIC_STRING_OID, Collections
-        .singletonList(SMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new NumericStringSubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_OID_FIRST_COMPONENT_OID, Collections
-        .singletonList(EMR_OID_FIRST_COMPONENT_NAME), EMPTY_STRING, false,
-        SYNTAX_OID_OID, RFC4512_ORIGIN,
-        new ObjectIdentifierFirstComponentEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_OID_OID, Collections
-        .singletonList(EMR_OID_NAME), EMPTY_STRING, false, SYNTAX_OID_OID,
-        RFC4512_ORIGIN, new ObjectIdentifierEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_OCTET_STRING_OID, Collections
-        .singletonList(EMR_OCTET_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_OCTET_STRING_OID, RFC4512_ORIGIN,
-        new OctetStringEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(OMR_OCTET_STRING_OID, Collections
-        .singletonList(OMR_OCTET_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_OCTET_STRING_OID, RFC4512_ORIGIN,
-        new OctetStringOrderingMatchingRuleImpl(), false);
-    // SMR octet string is not in any LDAP RFC and its from X.500
-    builder.addMatchingRule(SMR_OCTET_STRING_OID, Collections
-        .singletonList(SMR_OCTET_STRING_NAME), EMPTY_STRING, false,
-        SYNTAX_OCTET_STRING_OID, X500_ORIGIN,
-        new OctetStringSubstringMatchingRuleImpl(), false);
-    // Depreciated in RFC 4512
-    builder.addMatchingRule(EMR_PROTOCOL_INFORMATION_OID, Collections
-        .singletonList(EMR_PROTOCOL_INFORMATION_NAME), EMPTY_STRING, false,
-        SYNTAX_PROTOCOL_INFORMATION_OID, RFC2252_ORIGIN,
-        new ProtocolInformationEqualityMatchingRuleImpl(), false);
-    // Depreciated in RFC 4512
-    builder.addMatchingRule(EMR_PRESENTATION_ADDRESS_OID, Collections
-        .singletonList(EMR_PRESENTATION_ADDRESS_NAME), EMPTY_STRING, false,
-        SYNTAX_PRESENTATION_ADDRESS_OID, RFC2252_ORIGIN,
-        new PresentationAddressEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_TELEPHONE_OID, Collections
-        .singletonList(EMR_TELEPHONE_NAME), EMPTY_STRING, false,
-        SYNTAX_TELEPHONE_OID, RFC4512_ORIGIN,
-        new TelephoneNumberEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(SMR_TELEPHONE_OID, Collections
-        .singletonList(SMR_TELEPHONE_NAME), EMPTY_STRING, false,
-        SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
-        new TelephoneNumberSubstringMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_UNIQUE_MEMBER_OID, Collections
-        .singletonList(EMR_UNIQUE_MEMBER_NAME), EMPTY_STRING, false,
-        SYNTAX_NAME_AND_OPTIONAL_UID_OID, RFC4512_ORIGIN,
-        new UniqueMemberEqualityMatchingRuleImpl(), false);
-    builder.addMatchingRule(EMR_WORD_OID, Collections
-        .singletonList(EMR_WORD_NAME), EMPTY_STRING, false,
-        SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
-        new WordEqualityMatchingRuleImpl(), false);
-  }
+        builder.addAttributeType("1.3.6.1.4.1.4203.1.3.5", Collections
+                .singletonList("supportedFeatures"), EMPTY_STRING, false, null, EMR_OID_NAME, null,
+                null, null, SYNTAX_OID_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.15", Collections
+                .singletonList("supportedLDAPVersion"), EMPTY_STRING, false, null, null, null,
+                null, null, SYNTAX_INTEGER_OID, false, false, false, AttributeUsage.DSA_OPERATION,
+                RFC4512_ORIGIN, false);
 
+        builder.addAttributeType("1.3.6.1.4.1.1466.101.120.16", Collections
+                .singletonList("ldapSyntaxes"), EMPTY_STRING, false, null,
+                EMR_OID_FIRST_COMPONENT_NAME, null, null, null, SYNTAX_LDAP_SYNTAX_OID, false,
+                false, false, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-  private static void defaultObjectClasses(final SchemaBuilder builder)
-  {
-    builder.addObjectClass(TOP_OBJECTCLASS_OID, Collections
-        .singletonList(TOP_OBJECTCLASS_NAME), TOP_OBJECTCLASS_DESCRIPTION,
-        false, EMPTY_STRING_SET, Collections.singleton("objectClass"),
-        EMPTY_STRING_SET, ObjectClassType.ABSTRACT, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.1", Collections.singletonList("ditStructureRules"),
+                EMPTY_STRING, false, null, EMR_INTEGER_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_DIT_STRUCTURE_RULE_OID, false, false, false,
+                AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addObjectClass("2.5.6.1", Collections.singletonList("alias"),
-        EMPTY_STRING, false, Collections.singleton("top"), Collections
-            .singleton("aliasedObjectName"), EMPTY_STRING_SET,
-        ObjectClassType.STRUCTURAL, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.7", Collections.singletonList("nameForms"), EMPTY_STRING,
+                false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null, SYNTAX_NAME_FORM_OID,
+                false, false, false, AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
 
-    builder.addObjectClass(EXTENSIBLE_OBJECT_OBJECTCLASS_OID, Collections
-        .singletonList(EXTENSIBLE_OBJECT_OBJECTCLASS_NAME), EMPTY_STRING,
-        false, Collections.singleton(TOP_OBJECTCLASS_NAME), EMPTY_STRING_SET,
-        EMPTY_STRING_SET, ObjectClassType.AUXILIARY, RFC4512_ORIGIN, false);
+        builder.addAttributeType("2.5.21.2", Collections.singletonList("ditContentRules"),
+                EMPTY_STRING, false, null, EMR_OID_FIRST_COMPONENT_NAME, null, null, null,
+                SYNTAX_DIT_CONTENT_RULE_OID, false, false, false,
+                AttributeUsage.DIRECTORY_OPERATION, RFC4512_ORIGIN, false);
+    }
 
-    final Set<String> subschemaAttrs = new HashSet<String>();
-    subschemaAttrs.add("dITStructureRules");
-    subschemaAttrs.add("nameForms");
-    subschemaAttrs.add("ditContentRules");
-    subschemaAttrs.add("objectClasses");
-    subschemaAttrs.add("attributeTypes");
-    subschemaAttrs.add("matchingRules");
-    subschemaAttrs.add("matchingRuleUse");
+    private static void defaultMatchingRules(final SchemaBuilder builder) {
+        builder.addMatchingRule(EMR_BIT_STRING_OID, Collections.singletonList(EMR_BIT_STRING_NAME),
+                EMPTY_STRING, false, SYNTAX_BIT_STRING_OID, RFC4512_ORIGIN,
+                new BitStringEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_BOOLEAN_OID, Collections.singletonList(EMR_BOOLEAN_NAME),
+                EMPTY_STRING, false, SYNTAX_BOOLEAN_OID, RFC4512_ORIGIN,
+                new BooleanEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_CASE_EXACT_IA5_OID, Collections
+                .singletonList(EMR_CASE_EXACT_IA5_NAME), EMPTY_STRING, false,
+                SYNTAX_IA5_STRING_OID, RFC4512_ORIGIN, new CaseExactIA5EqualityMatchingRuleImpl(),
+                false);
+        builder.addMatchingRule(SMR_CASE_EXACT_IA5_OID, Collections
+                .singletonList(SMR_CASE_EXACT_IA5_NAME), EMPTY_STRING, false,
+                SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new CaseExactIA5SubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_CASE_EXACT_OID, Collections.singletonList(EMR_CASE_EXACT_NAME),
+                EMPTY_STRING, false, SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new CaseExactEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_CASE_EXACT_OID, Collections.singletonList(OMR_CASE_EXACT_NAME),
+                EMPTY_STRING, false, SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new CaseExactOrderingMatchingRuleImpl(), false);
+        builder.addMatchingRule(SMR_CASE_EXACT_OID, Collections.singletonList(SMR_CASE_EXACT_NAME),
+                EMPTY_STRING, false, SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new CaseExactSubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_CASE_IGNORE_IA5_OID, Collections
+                .singletonList(EMR_CASE_IGNORE_IA5_NAME), EMPTY_STRING, false,
+                SYNTAX_IA5_STRING_OID, RFC4512_ORIGIN, new CaseIgnoreIA5EqualityMatchingRuleImpl(),
+                false);
+        builder.addMatchingRule(SMR_CASE_IGNORE_IA5_OID, Collections
+                .singletonList(SMR_CASE_IGNORE_IA5_NAME), EMPTY_STRING, false,
+                SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new CaseIgnoreIA5SubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_CASE_IGNORE_LIST_OID, Collections
+                .singletonList(EMR_CASE_IGNORE_LIST_NAME), EMPTY_STRING, false,
+                SYNTAX_POSTAL_ADDRESS_OID, RFC4512_ORIGIN,
+                new CaseIgnoreListEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(SMR_CASE_IGNORE_LIST_OID, Collections
+                .singletonList(SMR_CASE_IGNORE_LIST_NAME), EMPTY_STRING, false,
+                SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new CaseIgnoreListSubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_CASE_IGNORE_OID, Collections
+                .singletonList(EMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
+                SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new CaseIgnoreEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_CASE_IGNORE_OID, Collections
+                .singletonList(OMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
+                SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new CaseIgnoreOrderingMatchingRuleImpl(), false);
+        builder.addMatchingRule(SMR_CASE_IGNORE_OID, Collections
+                .singletonList(SMR_CASE_IGNORE_NAME), EMPTY_STRING, false,
+                SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new CaseIgnoreSubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID, Collections
+                .singletonList(EMR_DIRECTORY_STRING_FIRST_COMPONENT_NAME), EMPTY_STRING, false,
+                SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new DirectoryStringFirstComponentEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_DN_OID, Collections.singletonList(EMR_DN_NAME), EMPTY_STRING,
+                false, SYNTAX_DN_OID, RFC4512_ORIGIN,
+                new DistinguishedNameEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_GENERALIZED_TIME_OID, Collections
+                .singletonList(EMR_GENERALIZED_TIME_NAME), EMPTY_STRING, false,
+                SYNTAX_GENERALIZED_TIME_OID, RFC4512_ORIGIN,
+                new GeneralizedTimeEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_GENERALIZED_TIME_OID, Collections
+                .singletonList(OMR_GENERALIZED_TIME_NAME), EMPTY_STRING, false,
+                SYNTAX_GENERALIZED_TIME_OID, RFC4512_ORIGIN,
+                new GeneralizedTimeOrderingMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_INTEGER_FIRST_COMPONENT_OID, Collections
+                .singletonList(EMR_INTEGER_FIRST_COMPONENT_NAME), EMPTY_STRING, false,
+                SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
+                new IntegerFirstComponentEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_INTEGER_OID, Collections.singletonList(EMR_INTEGER_NAME),
+                EMPTY_STRING, false, SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
+                new IntegerEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_INTEGER_OID, Collections.singletonList(OMR_INTEGER_NAME),
+                EMPTY_STRING, false, SYNTAX_INTEGER_OID, RFC4512_ORIGIN,
+                new IntegerOrderingMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_KEYWORD_OID, Collections.singletonList(EMR_KEYWORD_NAME),
+                EMPTY_STRING, false, SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new KeywordEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_NUMERIC_STRING_OID, Collections
+                .singletonList(EMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_NUMERIC_STRING_OID, RFC4512_ORIGIN,
+                new NumericStringEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(OMR_NUMERIC_STRING_OID, Collections
+                .singletonList(OMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_NUMERIC_STRING_OID, RFC4512_ORIGIN,
+                new NumericStringOrderingMatchingRuleImpl(), false);
+        builder.addMatchingRule(SMR_NUMERIC_STRING_OID, Collections
+                .singletonList(SMR_NUMERIC_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new NumericStringSubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_OID_FIRST_COMPONENT_OID, Collections
+                .singletonList(EMR_OID_FIRST_COMPONENT_NAME), EMPTY_STRING, false, SYNTAX_OID_OID,
+                RFC4512_ORIGIN, new ObjectIdentifierFirstComponentEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_OID_OID, Collections.singletonList(EMR_OID_NAME), EMPTY_STRING,
+                false, SYNTAX_OID_OID, RFC4512_ORIGIN,
+                new ObjectIdentifierEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_OCTET_STRING_OID, Collections
+                .singletonList(EMR_OCTET_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_OCTET_STRING_OID, RFC4512_ORIGIN, new OctetStringEqualityMatchingRuleImpl(),
+                false);
+        builder.addMatchingRule(OMR_OCTET_STRING_OID, Collections
+                .singletonList(OMR_OCTET_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_OCTET_STRING_OID, RFC4512_ORIGIN, new OctetStringOrderingMatchingRuleImpl(),
+                false);
+        // SMR octet string is not in any LDAP RFC and its from X.500
+        builder.addMatchingRule(SMR_OCTET_STRING_OID, Collections
+                .singletonList(SMR_OCTET_STRING_NAME), EMPTY_STRING, false,
+                SYNTAX_OCTET_STRING_OID, X500_ORIGIN, new OctetStringSubstringMatchingRuleImpl(),
+                false);
+        // Depreciated in RFC 4512
+        builder.addMatchingRule(EMR_PROTOCOL_INFORMATION_OID, Collections
+                .singletonList(EMR_PROTOCOL_INFORMATION_NAME), EMPTY_STRING, false,
+                SYNTAX_PROTOCOL_INFORMATION_OID, RFC2252_ORIGIN,
+                new ProtocolInformationEqualityMatchingRuleImpl(), false);
+        // Depreciated in RFC 4512
+        builder.addMatchingRule(EMR_PRESENTATION_ADDRESS_OID, Collections
+                .singletonList(EMR_PRESENTATION_ADDRESS_NAME), EMPTY_STRING, false,
+                SYNTAX_PRESENTATION_ADDRESS_OID, RFC2252_ORIGIN,
+                new PresentationAddressEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_TELEPHONE_OID, Collections.singletonList(EMR_TELEPHONE_NAME),
+                EMPTY_STRING, false, SYNTAX_TELEPHONE_OID, RFC4512_ORIGIN,
+                new TelephoneNumberEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(SMR_TELEPHONE_OID, Collections.singletonList(SMR_TELEPHONE_NAME),
+                EMPTY_STRING, false, SYNTAX_SUBSTRING_ASSERTION_OID, RFC4512_ORIGIN,
+                new TelephoneNumberSubstringMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_UNIQUE_MEMBER_OID, Collections
+                .singletonList(EMR_UNIQUE_MEMBER_NAME), EMPTY_STRING, false,
+                SYNTAX_NAME_AND_OPTIONAL_UID_OID, RFC4512_ORIGIN,
+                new UniqueMemberEqualityMatchingRuleImpl(), false);
+        builder.addMatchingRule(EMR_WORD_OID, Collections.singletonList(EMR_WORD_NAME),
+                EMPTY_STRING, false, SYNTAX_DIRECTORY_STRING_OID, RFC4512_ORIGIN,
+                new WordEqualityMatchingRuleImpl(), false);
+    }
 
-    builder.addObjectClass("2.5.20.1", Collections.singletonList("subschema"),
-        EMPTY_STRING, false, Collections.singleton(TOP_OBJECTCLASS_NAME),
-        EMPTY_STRING_SET, subschemaAttrs, ObjectClassType.AUXILIARY,
-        RFC4512_ORIGIN, false);
-  }
+    private static void defaultObjectClasses(final SchemaBuilder builder) {
+        builder.addObjectClass(TOP_OBJECTCLASS_OID,
+                Collections.singletonList(TOP_OBJECTCLASS_NAME), TOP_OBJECTCLASS_DESCRIPTION,
+                false, EMPTY_STRING_SET, Collections.singleton("objectClass"), EMPTY_STRING_SET,
+                ObjectClassType.ABSTRACT, RFC4512_ORIGIN, false);
 
+        builder.addObjectClass("2.5.6.1", Collections.singletonList("alias"), EMPTY_STRING, false,
+                Collections.singleton("top"), Collections.singleton("aliasedObjectName"),
+                EMPTY_STRING_SET, ObjectClassType.STRUCTURAL, RFC4512_ORIGIN, false);
 
+        builder.addObjectClass(EXTENSIBLE_OBJECT_OBJECTCLASS_OID, Collections
+                .singletonList(EXTENSIBLE_OBJECT_OBJECTCLASS_NAME), EMPTY_STRING, false,
+                Collections.singleton(TOP_OBJECTCLASS_NAME), EMPTY_STRING_SET, EMPTY_STRING_SET,
+                ObjectClassType.AUXILIARY, RFC4512_ORIGIN, false);
 
-  private static void defaultSyntaxes(final SchemaBuilder builder)
-  {
-    // All RFC 4512 / 4517
-    builder.addSyntax(SYNTAX_ATTRIBUTE_TYPE_OID,
-        SYNTAX_ATTRIBUTE_TYPE_DESCRIPTION, RFC4512_ORIGIN,
-        new AttributeTypeSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_BINARY_OID, SYNTAX_BINARY_DESCRIPTION,
-        RFC4512_ORIGIN, new BinarySyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_BIT_STRING_OID, SYNTAX_BIT_STRING_DESCRIPTION,
-        RFC4512_ORIGIN, new BitStringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_BOOLEAN_OID, SYNTAX_BOOLEAN_DESCRIPTION,
-        RFC4512_ORIGIN, new BooleanSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_CERTLIST_OID, SYNTAX_CERTLIST_DESCRIPTION,
-        RFC4512_ORIGIN, new CertificateListSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_CERTPAIR_OID, SYNTAX_CERTPAIR_DESCRIPTION,
-        RFC4512_ORIGIN, new CertificatePairSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_CERTIFICATE_OID, SYNTAX_CERTIFICATE_DESCRIPTION,
-        RFC4512_ORIGIN, new CertificateSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_COUNTRY_STRING_OID,
-        SYNTAX_COUNTRY_STRING_DESCRIPTION, RFC4512_ORIGIN,
-        new CountryStringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_DELIVERY_METHOD_OID,
-        SYNTAX_DELIVERY_METHOD_DESCRIPTION, RFC4512_ORIGIN,
-        new DeliveryMethodSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_DIRECTORY_STRING_OID,
-        SYNTAX_DIRECTORY_STRING_DESCRIPTION, RFC4512_ORIGIN,
-        new DirectoryStringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_DIT_CONTENT_RULE_OID,
-        SYNTAX_DIT_CONTENT_RULE_DESCRIPTION, RFC4512_ORIGIN,
-        new DITContentRuleSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_DIT_STRUCTURE_RULE_OID,
-        SYNTAX_DIT_STRUCTURE_RULE_DESCRIPTION, RFC4512_ORIGIN,
-        new DITStructureRuleSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_DN_OID, SYNTAX_DN_DESCRIPTION, RFC4512_ORIGIN,
-        new DistinguishedNameSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_ENHANCED_GUIDE_OID,
-        SYNTAX_ENHANCED_GUIDE_DESCRIPTION, RFC4512_ORIGIN,
-        new EnhancedGuideSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_FAXNUMBER_OID, SYNTAX_FAXNUMBER_DESCRIPTION,
-        RFC4512_ORIGIN, new FacsimileNumberSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_FAX_OID, SYNTAX_FAX_DESCRIPTION, RFC4512_ORIGIN,
-        new FaxSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_GENERALIZED_TIME_OID,
-        SYNTAX_GENERALIZED_TIME_DESCRIPTION, RFC4512_ORIGIN,
-        new GeneralizedTimeSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_GUIDE_OID, SYNTAX_GUIDE_DESCRIPTION,
-        RFC4512_ORIGIN, new GuideSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_IA5_STRING_OID, SYNTAX_IA5_STRING_DESCRIPTION,
-        RFC4512_ORIGIN, new IA5StringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_INTEGER_OID, SYNTAX_INTEGER_DESCRIPTION,
-        RFC4512_ORIGIN, new IntegerSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_JPEG_OID, SYNTAX_JPEG_DESCRIPTION, RFC4512_ORIGIN,
-        new JPEGSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_MATCHING_RULE_OID,
-        SYNTAX_MATCHING_RULE_DESCRIPTION, RFC4512_ORIGIN,
-        new MatchingRuleSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_MATCHING_RULE_USE_OID,
-        SYNTAX_MATCHING_RULE_USE_DESCRIPTION, RFC4512_ORIGIN,
-        new MatchingRuleUseSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_LDAP_SYNTAX_OID, SYNTAX_LDAP_SYNTAX_DESCRIPTION,
-        RFC4512_ORIGIN, new LDAPSyntaxDescriptionSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_NAME_AND_OPTIONAL_UID_OID,
-        SYNTAX_NAME_AND_OPTIONAL_UID_DESCRIPTION, RFC4517_ORIGIN,
-        new NameAndOptionalUIDSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_NAME_FORM_OID, SYNTAX_NAME_FORM_DESCRIPTION,
-        RFC4512_ORIGIN, new NameFormSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_NUMERIC_STRING_OID,
-        SYNTAX_NUMERIC_STRING_DESCRIPTION, RFC4512_ORIGIN,
-        new NumericStringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_OBJECTCLASS_OID, SYNTAX_OBJECTCLASS_DESCRIPTION,
-        RFC4512_ORIGIN, new ObjectClassSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_OCTET_STRING_OID, SYNTAX_OCTET_STRING_DESCRIPTION,
-        RFC4512_ORIGIN, new OctetStringSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_OID_OID, SYNTAX_OID_DESCRIPTION, RFC4512_ORIGIN,
-        new OIDSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_OTHER_MAILBOX_OID,
-        SYNTAX_OTHER_MAILBOX_DESCRIPTION, RFC4512_ORIGIN,
-        new OtherMailboxSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_POSTAL_ADDRESS_OID,
-        SYNTAX_POSTAL_ADDRESS_DESCRIPTION, RFC4512_ORIGIN,
-        new PostalAddressSyntaxImpl(), false);
-    // Depreciated in RFC 4512
-    builder.addSyntax(SYNTAX_PRESENTATION_ADDRESS_OID,
-        SYNTAX_PRESENTATION_ADDRESS_DESCRIPTION, RFC2252_ORIGIN,
-        new PresentationAddressSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_PRINTABLE_STRING_OID,
-        SYNTAX_PRINTABLE_STRING_DESCRIPTION, RFC4512_ORIGIN,
-        new PrintableStringSyntaxImpl(), false);
-    // Depreciated in RFC 4512
-    builder.addSyntax(SYNTAX_PROTOCOL_INFORMATION_OID,
-        SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION, RFC2252_ORIGIN,
-        new ProtocolInformationSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_SUBSTRING_ASSERTION_OID,
-        SYNTAX_SUBSTRING_ASSERTION_DESCRIPTION, RFC4512_ORIGIN,
-        new SubstringAssertionSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_SUPPORTED_ALGORITHM_OID,
-        SYNTAX_SUPPORTED_ALGORITHM_DESCRIPTION, RFC4512_ORIGIN,
-        new SupportedAlgorithmSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_TELEPHONE_OID, SYNTAX_TELEPHONE_DESCRIPTION,
-        RFC4512_ORIGIN, new TelephoneNumberSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_TELETEX_TERM_ID_OID,
-        SYNTAX_TELETEX_TERM_ID_DESCRIPTION, RFC4512_ORIGIN,
-        new TeletexTerminalIdentifierSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_TELEX_OID, SYNTAX_TELEX_DESCRIPTION,
-        RFC4512_ORIGIN, new TelexNumberSyntaxImpl(), false);
-    builder.addSyntax(SYNTAX_UTC_TIME_OID, SYNTAX_UTC_TIME_DESCRIPTION,
-        RFC4512_ORIGIN, new UTCTimeSyntaxImpl(), false);
-  }
+        final Set<String> subschemaAttrs = new HashSet<String>();
+        subschemaAttrs.add("dITStructureRules");
+        subschemaAttrs.add("nameForms");
+        subschemaAttrs.add("ditContentRules");
+        subschemaAttrs.add("objectClasses");
+        subschemaAttrs.add("attributeTypes");
+        subschemaAttrs.add("matchingRules");
+        subschemaAttrs.add("matchingRuleUse");
 
+        builder.addObjectClass("2.5.20.1", Collections.singletonList("subschema"), EMPTY_STRING,
+                false, Collections.singleton(TOP_OBJECTCLASS_NAME), EMPTY_STRING_SET,
+                subschemaAttrs, ObjectClassType.AUXILIARY, RFC4512_ORIGIN, false);
+    }
 
+    private static void defaultSyntaxes(final SchemaBuilder builder) {
+        // All RFC 4512 / 4517
+        builder.addSyntax(SYNTAX_ATTRIBUTE_TYPE_OID, SYNTAX_ATTRIBUTE_TYPE_DESCRIPTION,
+                RFC4512_ORIGIN, new AttributeTypeSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_BINARY_OID, SYNTAX_BINARY_DESCRIPTION, RFC4512_ORIGIN,
+                new BinarySyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_BIT_STRING_OID, SYNTAX_BIT_STRING_DESCRIPTION, RFC4512_ORIGIN,
+                new BitStringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_BOOLEAN_OID, SYNTAX_BOOLEAN_DESCRIPTION, RFC4512_ORIGIN,
+                new BooleanSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_CERTLIST_OID, SYNTAX_CERTLIST_DESCRIPTION, RFC4512_ORIGIN,
+                new CertificateListSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_CERTPAIR_OID, SYNTAX_CERTPAIR_DESCRIPTION, RFC4512_ORIGIN,
+                new CertificatePairSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_CERTIFICATE_OID, SYNTAX_CERTIFICATE_DESCRIPTION, RFC4512_ORIGIN,
+                new CertificateSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_COUNTRY_STRING_OID, SYNTAX_COUNTRY_STRING_DESCRIPTION,
+                RFC4512_ORIGIN, new CountryStringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_DELIVERY_METHOD_OID, SYNTAX_DELIVERY_METHOD_DESCRIPTION,
+                RFC4512_ORIGIN, new DeliveryMethodSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_DIRECTORY_STRING_OID, SYNTAX_DIRECTORY_STRING_DESCRIPTION,
+                RFC4512_ORIGIN, new DirectoryStringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_DIT_CONTENT_RULE_OID, SYNTAX_DIT_CONTENT_RULE_DESCRIPTION,
+                RFC4512_ORIGIN, new DITContentRuleSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_DIT_STRUCTURE_RULE_OID, SYNTAX_DIT_STRUCTURE_RULE_DESCRIPTION,
+                RFC4512_ORIGIN, new DITStructureRuleSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_DN_OID, SYNTAX_DN_DESCRIPTION, RFC4512_ORIGIN,
+                new DistinguishedNameSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_ENHANCED_GUIDE_OID, SYNTAX_ENHANCED_GUIDE_DESCRIPTION,
+                RFC4512_ORIGIN, new EnhancedGuideSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_FAXNUMBER_OID, SYNTAX_FAXNUMBER_DESCRIPTION, RFC4512_ORIGIN,
+                new FacsimileNumberSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_FAX_OID, SYNTAX_FAX_DESCRIPTION, RFC4512_ORIGIN,
+                new FaxSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_GENERALIZED_TIME_OID, SYNTAX_GENERALIZED_TIME_DESCRIPTION,
+                RFC4512_ORIGIN, new GeneralizedTimeSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_GUIDE_OID, SYNTAX_GUIDE_DESCRIPTION, RFC4512_ORIGIN,
+                new GuideSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_IA5_STRING_OID, SYNTAX_IA5_STRING_DESCRIPTION, RFC4512_ORIGIN,
+                new IA5StringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_INTEGER_OID, SYNTAX_INTEGER_DESCRIPTION, RFC4512_ORIGIN,
+                new IntegerSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_JPEG_OID, SYNTAX_JPEG_DESCRIPTION, RFC4512_ORIGIN,
+                new JPEGSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_MATCHING_RULE_OID, SYNTAX_MATCHING_RULE_DESCRIPTION,
+                RFC4512_ORIGIN, new MatchingRuleSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_MATCHING_RULE_USE_OID, SYNTAX_MATCHING_RULE_USE_DESCRIPTION,
+                RFC4512_ORIGIN, new MatchingRuleUseSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_LDAP_SYNTAX_OID, SYNTAX_LDAP_SYNTAX_DESCRIPTION, RFC4512_ORIGIN,
+                new LDAPSyntaxDescriptionSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_NAME_AND_OPTIONAL_UID_OID,
+                SYNTAX_NAME_AND_OPTIONAL_UID_DESCRIPTION, RFC4517_ORIGIN,
+                new NameAndOptionalUIDSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_NAME_FORM_OID, SYNTAX_NAME_FORM_DESCRIPTION, RFC4512_ORIGIN,
+                new NameFormSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_NUMERIC_STRING_OID, SYNTAX_NUMERIC_STRING_DESCRIPTION,
+                RFC4512_ORIGIN, new NumericStringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_OBJECTCLASS_OID, SYNTAX_OBJECTCLASS_DESCRIPTION, RFC4512_ORIGIN,
+                new ObjectClassSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_OCTET_STRING_OID, SYNTAX_OCTET_STRING_DESCRIPTION, RFC4512_ORIGIN,
+                new OctetStringSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_OID_OID, SYNTAX_OID_DESCRIPTION, RFC4512_ORIGIN,
+                new OIDSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_OTHER_MAILBOX_OID, SYNTAX_OTHER_MAILBOX_DESCRIPTION,
+                RFC4512_ORIGIN, new OtherMailboxSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_POSTAL_ADDRESS_OID, SYNTAX_POSTAL_ADDRESS_DESCRIPTION,
+                RFC4512_ORIGIN, new PostalAddressSyntaxImpl(), false);
+        // Depreciated in RFC 4512
+        builder.addSyntax(SYNTAX_PRESENTATION_ADDRESS_OID, SYNTAX_PRESENTATION_ADDRESS_DESCRIPTION,
+                RFC2252_ORIGIN, new PresentationAddressSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_PRINTABLE_STRING_OID, SYNTAX_PRINTABLE_STRING_DESCRIPTION,
+                RFC4512_ORIGIN, new PrintableStringSyntaxImpl(), false);
+        // Depreciated in RFC 4512
+        builder.addSyntax(SYNTAX_PROTOCOL_INFORMATION_OID, SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION,
+                RFC2252_ORIGIN, new ProtocolInformationSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_SUBSTRING_ASSERTION_OID, SYNTAX_SUBSTRING_ASSERTION_DESCRIPTION,
+                RFC4512_ORIGIN, new SubstringAssertionSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_SUPPORTED_ALGORITHM_OID, SYNTAX_SUPPORTED_ALGORITHM_DESCRIPTION,
+                RFC4512_ORIGIN, new SupportedAlgorithmSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_TELEPHONE_OID, SYNTAX_TELEPHONE_DESCRIPTION, RFC4512_ORIGIN,
+                new TelephoneNumberSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_TELETEX_TERM_ID_OID, SYNTAX_TELETEX_TERM_ID_DESCRIPTION,
+                RFC4512_ORIGIN, new TeletexTerminalIdentifierSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_TELEX_OID, SYNTAX_TELEX_DESCRIPTION, RFC4512_ORIGIN,
+                new TelexNumberSyntaxImpl(), false);
+        builder.addSyntax(SYNTAX_UTC_TIME_OID, SYNTAX_UTC_TIME_DESCRIPTION, RFC4512_ORIGIN,
+                new UTCTimeSyntaxImpl(), false);
+    }
 
-  private CoreSchemaImpl()
-  {
-    // Prevent instantiation.
-  }
+    private CoreSchemaImpl() {
+        // Prevent instantiation.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java
index 207cf8c..f735c65 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_COUNTRY_STRING_NOT_PRINTABLE;
@@ -37,97 +34,70 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the country string attribute syntax, which should be a
  * two-character ISO 3166 country code. However, for maintainability, it will
  * accept any value consisting entirely of two printable characters. In most
  * ways, it will behave like the directory string attribute syntax.
  */
-final class CountryStringSyntaxImpl extends AbstractSyntaxImpl
-{
+final class CountryStringSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_COUNTRY_STRING_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String stringValue = toLowerCase(value.toString());
-    if (stringValue.length() != 2)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH
-          .get(stringValue));
-      return false;
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
     }
 
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(stringValue.charAt(0))
-        || !PrintableStringSyntaxImpl.isPrintableCharacter(stringValue
-            .charAt(1)))
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_COUNTRY_STRING_NOT_PRINTABLE
-          .get(stringValue));
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
 
-    return true;
-  }
+    public String getName() {
+        return SYNTAX_COUNTRY_STRING_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String stringValue = toLowerCase(value.toString());
+        if (stringValue.length() != 2) {
+            invalidReason.append(ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH.get(stringValue));
+            return false;
+        }
+
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(stringValue.charAt(0))
+                || !PrintableStringSyntaxImpl.isPrintableCharacter(stringValue.charAt(1))) {
+            invalidReason.append(ERR_ATTR_SYNTAX_COUNTRY_STRING_NOT_PRINTABLE.get(stringValue));
+            return false;
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
index a45e2ba..4daa04c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,637 +27,516 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a DIT content rule, which defines the set of allowed,
  * required, and prohibited attributes for entries with a given structural
- * objectclass, and also indicates which auxiliary classes may be included
- * in the entry.
+ * objectclass, and also indicates which auxiliary classes may be included in
+ * the entry.
  */
-public final class DITContentRule extends SchemaElement
-{
-  // The structural objectclass for this DIT content rule.
-  private final String structuralClassOID;
+public final class DITContentRule extends SchemaElement {
+    // The structural objectclass for this DIT content rule.
+    private final String structuralClassOID;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // The set of auxiliary objectclasses that entries with this content
-  // rule may contain, in a mapping between the objectclass and the
-  // user-defined name for that class.
-  private final Set<String> auxiliaryClassOIDs;
+    // The set of auxiliary objectclasses that entries with this content
+    // rule may contain, in a mapping between the objectclass and the
+    // user-defined name for that class.
+    private final Set<String> auxiliaryClassOIDs;
 
-  // The set of optional attribute types for this DIT content rule.
-  private final Set<String> optionalAttributeOIDs;
+    // The set of optional attribute types for this DIT content rule.
+    private final Set<String> optionalAttributeOIDs;
 
-  // The set of prohibited attribute types for this DIT content rule.
-  private final Set<String> prohibitedAttributeOIDs;
+    // The set of prohibited attribute types for this DIT content rule.
+    private final Set<String> prohibitedAttributeOIDs;
 
-  // The set of required attribute types for this DIT content rule.
-  private final Set<String> requiredAttributeOIDs;
+    // The set of required attribute types for this DIT content rule.
+    private final Set<String> requiredAttributeOIDs;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  private ObjectClass structuralClass;
-  private Set<ObjectClass> auxiliaryClasses = Collections.emptySet();
-  private Set<AttributeType> optionalAttributes = Collections.emptySet();
-  private Set<AttributeType> prohibitedAttributes = Collections.emptySet();
-  private Set<AttributeType> requiredAttributes = Collections.emptySet();
+    private ObjectClass structuralClass;
+    private Set<ObjectClass> auxiliaryClasses = Collections.emptySet();
+    private Set<AttributeType> optionalAttributes = Collections.emptySet();
+    private Set<AttributeType> prohibitedAttributes = Collections.emptySet();
+    private Set<AttributeType> requiredAttributes = Collections.emptySet();
 
+    DITContentRule(final String structuralClassOID, final List<String> names,
+            final String description, final boolean obsolete, final Set<String> auxiliaryClassOIDs,
+            final Set<String> optionalAttributeOIDs, final Set<String> prohibitedAttributeOIDs,
+            final Set<String> requiredAttributeOIDs,
+            final Map<String, List<String>> extraProperties, final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(structuralClassOID, names);
+        Validator.ensureNotNull(auxiliaryClassOIDs, optionalAttributeOIDs, prohibitedAttributeOIDs,
+                requiredAttributeOIDs);
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.structuralClassOID = structuralClassOID;
+        this.auxiliaryClassOIDs = auxiliaryClassOIDs;
+        this.optionalAttributeOIDs = optionalAttributeOIDs;
+        this.prohibitedAttributeOIDs = prohibitedAttributeOIDs;
+        this.requiredAttributeOIDs = requiredAttributeOIDs;
 
-  DITContentRule(final String structuralClassOID, final List<String> names,
-      final String description, final boolean obsolete,
-      final Set<String> auxiliaryClassOIDs,
-      final Set<String> optionalAttributeOIDs,
-      final Set<String> prohibitedAttributeOIDs,
-      final Set<String> requiredAttributeOIDs,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(structuralClassOID, names);
-    Validator.ensureNotNull(auxiliaryClassOIDs, optionalAttributeOIDs,
-        prohibitedAttributeOIDs, requiredAttributeOIDs);
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.structuralClassOID = structuralClassOID;
-    this.auxiliaryClassOIDs = auxiliaryClassOIDs;
-    this.optionalAttributeOIDs = optionalAttributeOIDs;
-    this.prohibitedAttributeOIDs = prohibitedAttributeOIDs;
-    this.requiredAttributeOIDs = requiredAttributeOIDs;
-
-    if (definition != null)
-    {
-      this.definition = definition;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
     }
-    else
-    {
-      this.definition = buildDefinition();
+
+    /**
+     * Returns an unmodifiable set containing the auxiliary objectclasses that
+     * may be used for entries associated with this DIT content rule.
+     *
+     * @return An unmodifiable set containing the auxiliary objectclasses that
+     *         may be used for entries associated with this DIT content rule.
+     */
+    public Set<ObjectClass> getAuxiliaryClasses() {
+        return auxiliaryClasses;
     }
-  }
 
-
-
-  /**
-   * Returns an unmodifiable set containing the auxiliary objectclasses that may
-   * be used for entries associated with this DIT content rule.
-   *
-   * @return An unmodifiable set containing the auxiliary objectclasses that may
-   *         be used for entries associated with this DIT content rule.
-   */
-  public Set<ObjectClass> getAuxiliaryClasses()
-  {
-    return auxiliaryClasses;
-  }
-
-
-
-  /**
-   * Returns the name or structural class OID for this schema definition. If it
-   * has one or more names, then the primary name will be returned. If it does
-   * not have any names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return structuralClassOID;
+    /**
+     * Returns the name or structural class OID for this schema definition. If
+     * it has one or more names, then the primary name will be returned. If it
+     * does not have any names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return structuralClassOID;
+        }
+        return names.get(0);
     }
-    return names.get(0);
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the optional attributes for this DIT
-   * content rule.
-   *
-   * @return An unmodifiable set containing the optional attributes for this DIT
-   *         content rule.
-   */
-  public Set<AttributeType> getOptionalAttributes()
-  {
-    return optionalAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the prohibited attributes for this
-   * DIT content rule.
-   *
-   * @return An unmodifiable set containing the prohibited attributes for this
-   *         DIT content rule.
-   */
-  public Set<AttributeType> getProhibitedAttributes()
-  {
-    return prohibitedAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the required attributes for this DIT
-   * content rule.
-   *
-   * @return An unmodifiable set containing the required attributes for this DIT
-   *         content rule.
-   */
-  public Set<AttributeType> getRequiredAttributes()
-  {
-    return requiredAttributes;
-  }
-
-
-
-  /**
-   * Returns the structural objectclass for this DIT content rule.
-   *
-   * @return The structural objectclass for this DIT content rule.
-   */
-  public ObjectClass getStructuralClass()
-  {
-    return structuralClass;
-  }
-
-
-
-  /**
-   * Returns the structural class OID for this schema definition.
-   *
-   * @return The structural class OID for this schema definition.
-   */
-  public String getStructuralClassOID()
-  {
-    return structuralClassOID;
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return structuralClassOID.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
     }
-    return false;
-  }
 
+    /**
+     * Returns an unmodifiable set containing the optional attributes for this
+     * DIT content rule.
+     *
+     * @return An unmodifiable set containing the optional attributes for this
+     *         DIT content rule.
+     */
+    public Set<AttributeType> getOptionalAttributes() {
+        return optionalAttributes;
+    }
 
+    /**
+     * Returns an unmodifiable set containing the prohibited attributes for this
+     * DIT content rule.
+     *
+     * @return An unmodifiable set containing the prohibited attributes for this
+     *         DIT content rule.
+     */
+    public Set<AttributeType> getProhibitedAttributes() {
+        return prohibitedAttributes;
+    }
 
-  /**
-   * Indicates whether this schema definition has the specified name or
-   * structural class OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <code>true</code> if the provided value matches the OID or one of
-   *         the names assigned to this schema definition, or <code>false</code>
-   *         if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || structuralClassOID.equals(value);
-  }
+    /**
+     * Returns an unmodifiable set containing the required attributes for this
+     * DIT content rule.
+     *
+     * @return An unmodifiable set containing the required attributes for this
+     *         DIT content rule.
+     */
+    public Set<AttributeType> getRequiredAttributes() {
+        return requiredAttributes;
+    }
 
+    /**
+     * Returns the structural objectclass for this DIT content rule.
+     *
+     * @return The structural objectclass for this DIT content rule.
+     */
+    public ObjectClass getStructuralClass() {
+        return structuralClass;
+    }
 
+    /**
+     * Returns the structural class OID for this schema definition.
+     *
+     * @return The structural class OID for this schema definition.
+     */
+    public String getStructuralClassOID() {
+        return structuralClassOID;
+    }
 
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
+    @Override
+    public int hashCode() {
+        return structuralClassOID.hashCode();
+    }
 
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
 
+    /**
+     * Indicates whether this schema definition has the specified name or
+     * structural class OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <code>true</code> if the provided value matches the OID or one of
+     *         the names assigned to this schema definition, or
+     *         <code>false</code> if not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || structuralClassOID.equals(value);
+    }
 
-  /**
-   * Indicates whether the provided attribute type is included in the optional
-   * attribute list for this DIT content rule.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is optional for
-   *         this DIT content rule, or <code>false</code> if not.
-   */
-  public boolean isOptional(final AttributeType attributeType)
-  {
-    return optionalAttributes.contains(attributeType);
-  }
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
 
+    /**
+     * Indicates whether the provided attribute type is included in the optional
+     * attribute list for this DIT content rule.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is optional for
+     *         this DIT content rule, or <code>false</code> if not.
+     */
+    public boolean isOptional(final AttributeType attributeType) {
+        return optionalAttributes.contains(attributeType);
+    }
 
+    /**
+     * Indicates whether the provided attribute type is included in the required
+     * attribute list for this DIT content rule.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required by
+     *         this DIT content rule, or <code>false</code> if not.
+     */
+    public boolean isRequired(final AttributeType attributeType) {
+        return requiredAttributes.contains(attributeType);
+    }
 
-  /**
-   * Indicates whether the provided attribute type is included in the required
-   * attribute list for this DIT content rule.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required by
-   *         this DIT content rule, or <code>false</code> if not.
-   */
-  public boolean isRequired(final AttributeType attributeType)
-  {
-    return requiredAttributes.contains(attributeType);
-  }
+    /**
+     * Indicates whether the provided attribute type is in the list of required
+     * or optional attributes for this DIT content rule.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required or
+     *         allowed for this DIT content rule, or <code>false</code> if it is
+     *         not.
+     */
+    public boolean isRequiredOrOptional(final AttributeType attributeType) {
+        return isRequired(attributeType) || isOptional(attributeType);
+    }
 
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
 
+    DITContentRule duplicate() {
+        return new DITContentRule(structuralClassOID, names, description, isObsolete,
+                auxiliaryClassOIDs, optionalAttributeOIDs, prohibitedAttributeOIDs,
+                requiredAttributeOIDs, extraProperties, definition);
+    }
 
-  /**
-   * Indicates whether the provided attribute type is in the list of required or
-   * optional attributes for this DIT content rule.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required or
-   *         allowed for this DIT content rule, or <code>false</code> if it is
-   *         not.
-   */
-  public boolean isRequiredOrOptional(final AttributeType attributeType)
-  {
-    return isRequired(attributeType) || isOptional(attributeType);
-  }
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(structuralClassOID);
 
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
 
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
 
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
 
-
-
-  DITContentRule duplicate()
-  {
-    return new DITContentRule(structuralClassOID, names, description,
-        isObsolete, auxiliaryClassOIDs, optionalAttributeOIDs,
-        prohibitedAttributeOIDs, requiredAttributeOIDs, extraProperties,
-        definition);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(structuralClassOID);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
+        }
+
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
+        }
+
+        if (!auxiliaryClassOIDs.isEmpty()) {
+            final Iterator<String> iterator = auxiliaryClassOIDs.iterator();
+
+            final String firstClass = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" AUX (");
+                buffer.append(firstClass);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" AUX ");
+                buffer.append(firstClass);
+            }
+        }
+
+        if (!requiredAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = requiredAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MUST ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" MUST ");
+                buffer.append(firstName);
+            }
+        }
+
+        if (!optionalAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = optionalAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MAY ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" MAY ");
+                buffer.append(firstName);
+            }
+        }
+
+        if (!prohibitedAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = prohibitedAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NOT ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" NOT ");
+                buffer.append(firstName);
+            }
+        }
     }
 
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
+    void validate(final Schema schema, final List<LocalizableMessage> warnings)
+            throws SchemaException {
+        // Get the objectclass with the specified OID. If it does not exist
+        // or is not structural, then fail.
+        if (structuralClassOID != null) {
+            try {
+                structuralClass = schema.getObjectClass(structuralClassOID);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DCR_UNKNOWN_STRUCTURAL_CLASS1.get(getNameOrOID(),
+                                structuralClassOID);
+                throw new SchemaException(message, e);
+            }
+            if (structuralClass.getObjectClassType() != ObjectClassType.STRUCTURAL) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DCR_STRUCTURAL_CLASS_NOT_STRUCTURAL1.get(getNameOrOID(),
+                                structuralClass.getNameOrOID(), structuralClass
+                                        .getObjectClassType().toString());
+                warnings.add(message);
+            }
+        }
+
+        if (!auxiliaryClassOIDs.isEmpty()) {
+            auxiliaryClasses = new HashSet<ObjectClass>(auxiliaryClassOIDs.size());
+            ObjectClass objectClass;
+            for (final String oid : auxiliaryClassOIDs) {
+                try {
+                    objectClass = schema.getObjectClass(oid);
+                } catch (final UnknownSchemaElementException e) {
+                    // This isn't good because it is an unknown auxiliary class.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_UNKNOWN_AUXILIARY_CLASS1.get(getNameOrOID(), oid);
+                    throw new SchemaException(message, e);
+                }
+                if (objectClass.getObjectClassType() != ObjectClassType.AUXILIARY) {
+                    // This isn't good because it isn't an auxiliary class.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_AUXILIARY_CLASS_NOT_AUXILIARY1.get(getNameOrOID(),
+                                    structuralClass.getOID(), structuralClass.getObjectClassType()
+                                            .toString());
+                    throw new SchemaException(message);
+                }
+                auxiliaryClasses.add(objectClass);
+            }
+        }
+
+        if (!requiredAttributeOIDs.isEmpty()) {
+            requiredAttributes = new HashSet<AttributeType>(requiredAttributeOIDs.size());
+            AttributeType attributeType;
+            for (final String oid : requiredAttributeOIDs) {
+                try {
+                    attributeType = schema.getAttributeType(oid);
+                } catch (final UnknownSchemaElementException e) {
+                    // This isn't good because it means that the DIT content
+                    // rule
+                    // requires an attribute type that we don't know anything
+                    // about.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR1.get(getNameOrOID(), oid);
+                    throw new SchemaException(message, e);
+                }
+                requiredAttributes.add(attributeType);
+            }
+        }
+
+        if (!optionalAttributeOIDs.isEmpty()) {
+            optionalAttributes = new HashSet<AttributeType>(optionalAttributeOIDs.size());
+            AttributeType attributeType;
+            for (final String oid : optionalAttributeOIDs) {
+                try {
+                    attributeType = schema.getAttributeType(oid);
+                } catch (final UnknownSchemaElementException e) {
+                    // This isn't good because it means that the DIT content
+                    // rule
+                    // requires an attribute type that we don't know anything
+                    // about.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR1.get(getNameOrOID(), oid);
+                    throw new SchemaException(message, e);
+                }
+                optionalAttributes.add(attributeType);
+            }
+        }
+
+        if (!prohibitedAttributeOIDs.isEmpty()) {
+            prohibitedAttributes = new HashSet<AttributeType>(prohibitedAttributeOIDs.size());
+            AttributeType attributeType;
+            for (final String oid : prohibitedAttributeOIDs) {
+                try {
+                    attributeType = schema.getAttributeType(oid);
+                } catch (final UnknownSchemaElementException e) {
+                    // This isn't good because it means that the DIT content
+                    // rule
+                    // requires an attribute type that we don't know anything
+                    // about.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR1.get(getNameOrOID(), oid);
+                    throw new SchemaException(message, e);
+                }
+                prohibitedAttributes.add(attributeType);
+            }
+        }
+
+        // Make sure that none of the prohibited attributes is required by
+        // the structural or any of the auxiliary classes.
+        for (final AttributeType t : prohibitedAttributes) {
+            if (structuralClass.isRequired(t)) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DCR_PROHIBITED_REQUIRED_BY_STRUCTURAL.get(getNameOrOID(), t
+                                .getNameOrOID(), structuralClass.getNameOrOID());
+                throw new SchemaException(message);
+            }
+
+            for (final ObjectClass oc : auxiliaryClasses) {
+                if (oc.isRequired(t)) {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_PROHIBITED_REQUIRED_BY_AUXILIARY.get(
+                                    getNameOrOID(), t.getNameOrOID(), oc.getNameOrOID());
+                    throw new SchemaException(message);
+                }
+            }
+        }
+
+        auxiliaryClasses = Collections.unmodifiableSet(auxiliaryClasses);
+        optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
+        prohibitedAttributes = Collections.unmodifiableSet(prohibitedAttributes);
+        requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
     }
-
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
-
-    if (!auxiliaryClassOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = auxiliaryClassOIDs.iterator();
-
-      final String firstClass = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" AUX (");
-        buffer.append(firstClass);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
-        }
-
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" AUX ");
-        buffer.append(firstClass);
-      }
-    }
-
-    if (!requiredAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = requiredAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MUST ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
-        }
-
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MUST ");
-        buffer.append(firstName);
-      }
-    }
-
-    if (!optionalAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = optionalAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MAY ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
-        }
-
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MAY ");
-        buffer.append(firstName);
-      }
-    }
-
-    if (!prohibitedAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = prohibitedAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NOT ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
-        }
-
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" NOT ");
-        buffer.append(firstName);
-      }
-    }
-  }
-
-
-
-  void validate(final Schema schema, final List<LocalizableMessage> warnings)
-      throws SchemaException
-  {
-    // Get the objectclass with the specified OID. If it does not exist
-    // or is not structural, then fail.
-    if (structuralClassOID != null)
-    {
-      try
-      {
-        structuralClass = schema.getObjectClass(structuralClassOID);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_UNKNOWN_STRUCTURAL_CLASS1
-            .get(getNameOrOID(), structuralClassOID);
-        throw new SchemaException(message, e);
-      }
-      if (structuralClass.getObjectClassType() != ObjectClassType.STRUCTURAL)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_STRUCTURAL_CLASS_NOT_STRUCTURAL1
-            .get(getNameOrOID(), structuralClass.getNameOrOID(),
-                structuralClass.getObjectClassType().toString());
-        warnings.add(message);
-      }
-    }
-
-    if (!auxiliaryClassOIDs.isEmpty())
-    {
-      auxiliaryClasses = new HashSet<ObjectClass>(auxiliaryClassOIDs.size());
-      ObjectClass objectClass;
-      for (final String oid : auxiliaryClassOIDs)
-      {
-        try
-        {
-          objectClass = schema.getObjectClass(oid);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          // This isn't good because it is an unknown auxiliary class.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_UNKNOWN_AUXILIARY_CLASS1
-              .get(getNameOrOID(), oid);
-          throw new SchemaException(message, e);
-        }
-        if (objectClass.getObjectClassType() != ObjectClassType.AUXILIARY)
-        {
-          // This isn't good because it isn't an auxiliary class.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_AUXILIARY_CLASS_NOT_AUXILIARY1
-              .get(getNameOrOID(), structuralClass.getOID(), structuralClass
-                  .getObjectClassType().toString());
-          throw new SchemaException(message);
-        }
-        auxiliaryClasses.add(objectClass);
-      }
-    }
-
-    if (!requiredAttributeOIDs.isEmpty())
-    {
-      requiredAttributes = new HashSet<AttributeType>(requiredAttributeOIDs
-          .size());
-      AttributeType attributeType;
-      for (final String oid : requiredAttributeOIDs)
-      {
-        try
-        {
-          attributeType = schema.getAttributeType(oid);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          // This isn't good because it means that the DIT content rule
-          // requires an attribute type that we don't know anything
-          // about.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR1
-              .get(getNameOrOID(), oid);
-          throw new SchemaException(message, e);
-        }
-        requiredAttributes.add(attributeType);
-      }
-    }
-
-    if (!optionalAttributeOIDs.isEmpty())
-    {
-      optionalAttributes = new HashSet<AttributeType>(optionalAttributeOIDs
-          .size());
-      AttributeType attributeType;
-      for (final String oid : optionalAttributeOIDs)
-      {
-        try
-        {
-          attributeType = schema.getAttributeType(oid);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          // This isn't good because it means that the DIT content rule
-          // requires an attribute type that we don't know anything
-          // about.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR1
-              .get(getNameOrOID(), oid);
-          throw new SchemaException(message, e);
-        }
-        optionalAttributes.add(attributeType);
-      }
-    }
-
-    if (!prohibitedAttributeOIDs.isEmpty())
-    {
-      prohibitedAttributes = new HashSet<AttributeType>(prohibitedAttributeOIDs
-          .size());
-      AttributeType attributeType;
-      for (final String oid : prohibitedAttributeOIDs)
-      {
-        try
-        {
-          attributeType = schema.getAttributeType(oid);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          // This isn't good because it means that the DIT content rule
-          // requires an attribute type that we don't know anything
-          // about.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR1
-              .get(getNameOrOID(), oid);
-          throw new SchemaException(message, e);
-        }
-        prohibitedAttributes.add(attributeType);
-      }
-    }
-
-    // Make sure that none of the prohibited attributes is required by
-    // the structural or any of the auxiliary classes.
-    for (final AttributeType t : prohibitedAttributes)
-    {
-      if (structuralClass.isRequired(t))
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_PROHIBITED_REQUIRED_BY_STRUCTURAL
-            .get(getNameOrOID(), t.getNameOrOID(), structuralClass.getNameOrOID());
-        throw new SchemaException(message);
-      }
-
-      for (final ObjectClass oc : auxiliaryClasses)
-      {
-        if (oc.isRequired(t))
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_PROHIBITED_REQUIRED_BY_AUXILIARY
-              .get(getNameOrOID(), t.getNameOrOID(), oc.getNameOrOID());
-          throw new SchemaException(message);
-        }
-      }
-    }
-
-    auxiliaryClasses = Collections.unmodifiableSet(auxiliaryClasses);
-    optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
-    prohibitedAttributes = Collections.unmodifiableSet(prohibitedAttributes);
-    requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java
index 7b1a520..4a0fffe 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,9 +27,10 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_INVALID1;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_CONTENT_RULE_NAME;
 
@@ -42,169 +42,124 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the DIT content rule description syntax, which is used
  * to hold DIT content rule definitions in the server schema. The format of this
  * syntax is defined in RFC 2252.
  */
-final class DITContentRuleSyntaxImpl extends AbstractSyntaxImpl
-{
+final class DITContentRuleSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_DIT_CONTENT_RULE_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeDITContentRule method to determine if the
-    // value is acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("DITConentRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("aux"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("not"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_DCR_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_DIT_CONTENT_RULE_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeDITContentRule method to determine if the
+        // value is acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("DITConentRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("aux")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("not")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("DITContentRuleSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_DCR_INVALID1
+                    .get(definition, de.getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java
index 0d2cb87..8c3101c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,346 +26,278 @@
 
 package org.forgerock.opendj.ldap.schema;
 
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DSR_UNKNOWN_NAME_FORM;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DSR_UNKNOWN_RULE_ID;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_DSR_VALIDATION_FAIL;
 
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a DIT structure rule, which is used to indicate the types
  * of children that entries may have.
  */
-public final class DITStructureRule extends SchemaElement
-{
-  // The rule ID for this DIT structure rule.
-  private final Integer ruleID;
+public final class DITStructureRule extends SchemaElement {
+    // The rule ID for this DIT structure rule.
+    private final Integer ruleID;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // The name form for this DIT structure rule.
-  private final String nameFormOID;
+    // The name form for this DIT structure rule.
+    private final String nameFormOID;
 
-  // The set of superior DIT structure rules.
-  private final Set<Integer> superiorRuleIDs;
+    // The set of superior DIT structure rules.
+    private final Set<Integer> superiorRuleIDs;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  private NameForm nameForm;
-  private Set<DITStructureRule> superiorRules = Collections.emptySet();
+    private NameForm nameForm;
+    private Set<DITStructureRule> superiorRules = Collections.emptySet();
 
-  // Indicates whether or not validation has been performed.
-  private boolean needsValidating = true;
+    // Indicates whether or not validation has been performed.
+    private boolean needsValidating = true;
 
-  // The indicates whether or not validation failed.
-  private boolean isValid = false;
+    // The indicates whether or not validation failed.
+    private boolean isValid = false;
 
+    DITStructureRule(final Integer ruleID, final List<String> names, final String description,
+            final boolean obsolete, final String nameFormOID, final Set<Integer> superiorRuleIDs,
+            final Map<String, List<String>> extraProperties, final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(ruleID, nameFormOID, superiorRuleIDs);
+        this.ruleID = ruleID;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.nameFormOID = nameFormOID;
+        this.superiorRuleIDs = superiorRuleIDs;
 
-  DITStructureRule(final Integer ruleID, final List<String> names,
-      final String description, final boolean obsolete,
-      final String nameFormOID, final Set<Integer> superiorRuleIDs,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(ruleID, nameFormOID, superiorRuleIDs);
-    this.ruleID = ruleID;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.nameFormOID = nameFormOID;
-    this.superiorRuleIDs = superiorRuleIDs;
-
-    if (definition != null)
-    {
-      this.definition = definition;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
     }
-    else
-    {
-      this.definition = buildDefinition();
+
+    /**
+     * Retrieves the name form for this DIT structure rule.
+     *
+     * @return The name form for this DIT structure rule.
+     */
+    public NameForm getNameForm() {
+        return nameForm;
     }
-  }
 
-
-
-  /**
-   * Retrieves the name form for this DIT structure rule.
-   *
-   * @return The name form for this DIT structure rule.
-   */
-  public NameForm getNameForm()
-  {
-    return nameForm;
-  }
-
-
-
-  /**
-   * Retrieves the name or rule ID for this schema definition. If it has one or
-   * more names, then the primary name will be returned. If it does not have any
-   * names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrRuleID()
-  {
-    if (names.isEmpty())
-    {
-      return ruleID.toString();
+    /**
+     * Retrieves the name or rule ID for this schema definition. If it has one
+     * or more names, then the primary name will be returned. If it does not
+     * have any names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrRuleID() {
+        if (names.isEmpty()) {
+            return ruleID.toString();
+        }
+        return names.get(0);
     }
-    return names.get(0);
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Retrieves the rule ID for this DIT structure rule.
-   *
-   * @return The rule ID for this DIT structure rule.
-   */
-  public Integer getRuleID()
-  {
-    return ruleID;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the superior rules for this DIT
-   * structure rule.
-   *
-   * @return An unmodifiable set containing the superior rules for this DIT
-   *         structure rule.
-   */
-  public Set<DITStructureRule> getSuperiorRules()
-  {
-    return superiorRules;
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return ruleID.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
     }
-    return false;
-  }
 
+    /**
+     * Retrieves the rule ID for this DIT structure rule.
+     *
+     * @return The rule ID for this DIT structure rule.
+     */
+    public Integer getRuleID() {
+        return ruleID;
+    }
 
+    /**
+     * Returns an unmodifiable set containing the superior rules for this DIT
+     * structure rule.
+     *
+     * @return An unmodifiable set containing the superior rules for this DIT
+     *         structure rule.
+     */
+    public Set<DITStructureRule> getSuperiorRules() {
+        return superiorRules;
+    }
 
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
+    @Override
+    public int hashCode() {
+        return ruleID.hashCode();
+    }
 
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
 
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
 
-  /**
-   * Retrieves the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
+    /**
+     * Retrieves the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
 
+    DITStructureRule duplicate() {
+        return new DITStructureRule(ruleID, names, description, isObsolete, nameFormOID,
+                superiorRuleIDs, extraProperties, definition);
+    }
 
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(ruleID);
 
-  DITStructureRule duplicate()
-  {
-    return new DITStructureRule(ruleID, names, description, isObsolete,
-        nameFormOID, superiorRuleIDs, extraProperties, definition);
-  }
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
 
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
 
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
 
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(ruleID);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
-    }
-
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
-    }
-
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
-
-    buffer.append(" FORM ");
-    buffer.append(nameFormOID);
-
-    if (superiorRuleIDs != null && !superiorRuleIDs.isEmpty())
-    {
-      final Iterator<Integer> iterator = superiorRuleIDs.iterator();
-
-      final Integer firstRule = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" SUP ( ");
-        buffer.append(firstRule);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" ");
-          buffer.append(iterator.next());
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" SUP ");
-        buffer.append(firstRule);
-      }
-    }
-  }
-
-
-
-  boolean validate(final Schema schema,
-      final List<DITStructureRule> invalidSchemaElements,
-      final List<LocalizableMessage> warnings)
-  {
-    // Avoid validating this schema element more than once. This may occur if
-    // multiple rules specify the same superior.
-    if (!needsValidating)
-    {
-      return isValid;
-    }
-
-    // Prevent re-validation.
-    needsValidating = false;
-
-    try
-    {
-      nameForm = schema.getNameForm(nameFormOID);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_UNKNOWN_NAME_FORM
-          .get(getNameOrRuleID(), nameFormOID);
-      failValidation(invalidSchemaElements, warnings, message);
-      return false;
-    }
-
-    if (!superiorRuleIDs.isEmpty())
-    {
-      superiorRules = new HashSet<DITStructureRule>(superiorRuleIDs.size());
-      DITStructureRule rule;
-      for (final Integer id : superiorRuleIDs)
-      {
-        try
-        {
-          rule = schema.getDITStructureRule(id);
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
         }
-        catch (final UnknownSchemaElementException e)
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_UNKNOWN_RULE_ID
-              .get(getNameOrRuleID(), id);
-          failValidation(invalidSchemaElements, warnings, message);
-          return false;
+
+        buffer.append(" FORM ");
+        buffer.append(nameFormOID);
+
+        if (superiorRuleIDs != null && !superiorRuleIDs.isEmpty()) {
+            final Iterator<Integer> iterator = superiorRuleIDs.iterator();
+
+            final Integer firstRule = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" SUP ( ");
+                buffer.append(firstRule);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" SUP ");
+                buffer.append(firstRule);
+            }
         }
-        superiorRules.add(rule);
-      }
     }
-    superiorRules = Collections.unmodifiableSet(superiorRules);
 
-    return (isValid = true);
-  }
+    boolean validate(final Schema schema, final List<DITStructureRule> invalidSchemaElements,
+            final List<LocalizableMessage> warnings) {
+        // Avoid validating this schema element more than once. This may occur
+        // if
+        // multiple rules specify the same superior.
+        if (!needsValidating) {
+            return isValid;
+        }
 
+        // Prevent re-validation.
+        needsValidating = false;
 
+        try {
+            nameForm = schema.getNameForm(nameFormOID);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_DSR_UNKNOWN_NAME_FORM.get(getNameOrRuleID(), nameFormOID);
+            failValidation(invalidSchemaElements, warnings, message);
+            return false;
+        }
 
-  private void failValidation(final List<DITStructureRule> invalidSchemaElements,
-      final List<LocalizableMessage> warnings, final LocalizableMessage message)
-  {
-    invalidSchemaElements.add(this);
-    warnings.add(ERR_DSR_VALIDATION_FAIL.get(toString(), message));
-  }
+        if (!superiorRuleIDs.isEmpty()) {
+            superiorRules = new HashSet<DITStructureRule>(superiorRuleIDs.size());
+            DITStructureRule rule;
+            for (final Integer id : superiorRuleIDs) {
+                try {
+                    rule = schema.getDITStructureRule(id);
+                } catch (final UnknownSchemaElementException e) {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DSR_UNKNOWN_RULE_ID.get(getNameOrRuleID(), id);
+                    failValidation(invalidSchemaElements, warnings, message);
+                    return false;
+                }
+                superiorRules.add(rule);
+            }
+        }
+        superiorRules = Collections.unmodifiableSet(superiorRules);
+
+        return (isValid = true);
+    }
+
+    private void failValidation(final List<DITStructureRule> invalidSchemaElements,
+            final List<LocalizableMessage> warnings, final LocalizableMessage message) {
+        invalidSchemaElements.add(this);
+        warnings.add(ERR_DSR_VALIDATION_FAIL.get(toString(), message));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java
index c759e35..4daec0e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_INTEGER_FIRST_COMPONENT_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_STRUCTURE_RULE_NAME;
@@ -42,166 +39,127 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the DIT structure rule description syntax, which is
  * used to hold DIT structure rule definitions in the server schema. The format
  * of this syntax is defined in RFC 2252.
  */
-final class DITStructureRuleSyntaxImpl extends AbstractSyntaxImpl
-{
+final class DITStructureRuleSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_INTEGER_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_DIT_STRUCTURE_RULE_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeDITStructureRule method to determine if the
-    // value is acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readRuleID(reader);
-
-      String nameForm = null;
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("form"))
-        {
-          nameForm = SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          SchemaUtils.readRuleIDs(reader);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-
-      if (nameForm == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_INTEGER_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_DSR_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_DIT_STRUCTURE_RULE_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeDITStructureRule method to determine if the
+        // value is acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readRuleID(reader);
+
+            String nameForm = null;
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("form")) {
+                    nameForm = SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    SchemaUtils.readRuleIDs(reader);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+
+            if (nameForm == null) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("DITStructureRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_DSR_INVALID1
+                    .get(definition, de.getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DefaultSchema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DefaultSchema.java
index 56c287f..aa5de46 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DefaultSchema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DefaultSchema.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,21 +26,15 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 /**
  * This class is used to maintain a reference to the default schema and avoid
  * having to reference the core schema in the {@link Schema} class since this
  * can cause initialization errors because the CoreSchema depends on Schema.
  */
-final class DefaultSchema
-{
-  private DefaultSchema()
-  {
-    // Prevent instantiation.
-  }
+final class DefaultSchema {
+    private DefaultSchema() {
+        // Prevent instantiation.
+    }
 
-
-
-  static volatile Schema schema = Schema.getCoreSchema();
+    static volatile Schema schema = Schema.getCoreSchema();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java
index 22644a6..bc099ba 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,10 +26,9 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
 import java.util.HashSet;
@@ -39,8 +37,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the delivery method attribute syntax. This contains one or
  * more of a fixed set of values. If there are multiple values, then they are
@@ -59,110 +55,84 @@
  * <LI>telephone</LI>
  * </UL>
  */
-final class DeliveryMethodSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * The set of values that may be used as delivery methods.
-   */
-  private static final HashSet<String> ALLOWED_VALUES = new HashSet<String>();
-  {
-    ALLOWED_VALUES.add("any");
-    ALLOWED_VALUES.add("mhs");
-    ALLOWED_VALUES.add("physical");
-    ALLOWED_VALUES.add("telex");
-    ALLOWED_VALUES.add("teletex");
-    ALLOWED_VALUES.add("g3fax");
-    ALLOWED_VALUES.add("g4fax");
-    ALLOWED_VALUES.add("ia5");
-    ALLOWED_VALUES.add("videotex");
-    ALLOWED_VALUES.add("telephone");
-  }
-
-
-
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_DELIVERY_METHOD_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String stringValue = toLowerCase(value.toString());
-    final StringTokenizer tokenizer = new StringTokenizer(stringValue, " $");
-    if (!tokenizer.hasMoreTokens())
+final class DeliveryMethodSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * The set of values that may be used as delivery methods.
+     */
+    private static final HashSet<String> ALLOWED_VALUES = new HashSet<String>();
     {
-      invalidReason.append(ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS
-          .get(value.toString()));
-      return false;
+        ALLOWED_VALUES.add("any");
+        ALLOWED_VALUES.add("mhs");
+        ALLOWED_VALUES.add("physical");
+        ALLOWED_VALUES.add("telex");
+        ALLOWED_VALUES.add("teletex");
+        ALLOWED_VALUES.add("g3fax");
+        ALLOWED_VALUES.add("g4fax");
+        ALLOWED_VALUES.add("ia5");
+        ALLOWED_VALUES.add("videotex");
+        ALLOWED_VALUES.add("telephone");
     }
 
-    while (tokenizer.hasMoreTokens())
-    {
-      final String token = tokenizer.nextToken();
-      if (!ALLOWED_VALUES.contains(token))
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT
-            .get(value.toString(), token));
-        return false;
-      }
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
     }
 
-    return true;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
+
+    public String getName() {
+        return SYNTAX_DELIVERY_METHOD_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String stringValue = toLowerCase(value.toString());
+        final StringTokenizer tokenizer = new StringTokenizer(stringValue, " $");
+        if (!tokenizer.hasMoreTokens()) {
+            invalidReason.append(ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS.get(value.toString()));
+            return false;
+        }
+
+        while (tokenizer.hasMoreTokens()) {
+            final String token = tokenizer.nextToken();
+            if (!ALLOWED_VALUES.contains(token)) {
+                invalidReason.append(ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT.get(value
+                        .toString(), token));
+                return false;
+            }
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java
index 587c66f..6947bff 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -42,8 +39,6 @@
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the directoryStringFirstComponentMatch matching rule
  * defined in X.520 and referenced in RFC 2252. This rule is intended for use
@@ -52,86 +47,72 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-final class DirectoryStringFirstComponentEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class DirectoryStringFirstComponentEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return new DefaultEqualityAssertion(SchemaConstants.SINGLE_SPACE_VALUE);
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return new DefaultEqualityAssertion(ByteString.empty());
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return new DefaultEqualityAssertion(SchemaConstants.SINGLE_SPACE_VALUE);
+            } else {
+                // The value is empty, so it is already normalized.
+                return new DefaultEqualityAssertion(ByteString.empty());
+            }
         }
-      }
+
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return new DefaultEqualityAssertion(ByteString.valueOf(buffer.toString()));
     }
 
-    return new DefaultEqualityAssertion(ByteString.valueOf(buffer.toString()));
-  }
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
 
+        // We'll do this a character at a time. First, skip over any leading
+        // whitespace.
+        reader.skipWhitespaces();
 
+        if (reader.remaining() <= 0) {
+            // This means that the value was empty or contained only
+            // whitespace.
+            // That is illegal.
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
+            throw DecodeException.error(message);
+        }
 
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
+        // The next character must be an open parenthesis. If it is not,
+        // then
+        // that is an error.
+        final char c = reader.read();
+        if (c != '(') {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1),
+                            String.valueOf(c));
+            throw DecodeException.error(message);
+        }
 
-    // We'll do this a character at a time. First, skip over any leading
-    // whitespace.
-    reader.skipWhitespaces();
+        // Skip over any spaces immediately following the opening
+        // parenthesis.
+        reader.skipWhitespaces();
 
-    if (reader.remaining() <= 0)
-    {
-      // This means that the value was empty or contained only
-      // whitespace.
-      // That is illegal.
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
-      throw DecodeException.error(message);
+        // The next set of characters must be the OID.
+        final String string = SchemaUtils.readQuotedString(reader);
+
+        // Grab the substring between the start pos and the current pos
+        return ByteString.valueOf(string);
     }
-
-    // The next character must be an open parenthesis. If it is not,
-    // then
-    // that is an error.
-    final char c = reader.read();
-    if (c != '(')
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS
-          .get(definition, (reader.pos() - 1), String.valueOf(c));
-      throw DecodeException.error(message);
-    }
-
-    // Skip over any spaces immediately following the opening
-    // parenthesis.
-    reader.skipWhitespaces();
-
-    // The next set of characters must be the OID.
-    final String string = SchemaUtils.readQuotedString(reader);
-
-    // Grab the substring between the start pos and the current pos
-    return ByteString.valueOf(string);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java
index a395e9e..3760d61 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,97 +27,68 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DIRECTORYSTRING_INVALID_ZEROLENGTH_VALUE;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the directory string attribute syntax, which is simply a
  * set of UTF-8 characters. By default, they will be treated in a
  * case-insensitive manner, and equality, ordering, substring, and approximate
  * matching will be allowed.
  */
-final class DirectoryStringSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_DIRECTORY_STRING_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    if (value.length() > 0 || schema.allowZeroLengthDirectoryStrings())
-    {
-      return true;
+final class DirectoryStringSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
     }
-    else
-    {
-      invalidReason
-          .append(ERR_ATTR_SYNTAX_DIRECTORYSTRING_INVALID_ZEROLENGTH_VALUE
-              .get());
-      return false;
+
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
-  }
+
+    public String getName() {
+        return SYNTAX_DIRECTORY_STRING_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        if (value.length() > 0 || schema.allowZeroLengthDirectoryStrings()) {
+            return true;
+        } else {
+            invalidReason.append(ERR_ATTR_SYNTAX_DIRECTORYSTRING_INVALID_ZEROLENGTH_VALUE.get());
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java
index 5e55697..227a618 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,191 +25,160 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 
 import java.util.Iterator;
 import java.util.TreeSet;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.RDN;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
 /**
  * This class defines the distinguishedNameMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-final class DistinguishedNameEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    try
-    {
-      DN dn = DN.valueOf(value.toString(), schema.asNonStrictSchema());
-      StringBuilder builder = new StringBuilder(value.length());
-      return ByteString.valueOf(normalizeDN(builder, dn));
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      throw DecodeException.error(e.getMessageObject());
-    }
-  }
-
-  /**
-   * Returns the normalized string representation of a DN.
-   *
-   * @param builder The StringBuilder to use to construct the normalized string.
-   * @param dn The DN.
-   * @return The normalized string representation of the provided DN.
-   */
-  private static StringBuilder normalizeDN(final StringBuilder builder,
-                                          final DN dn)
-  {
-    if(dn.rdn() == null)
-    {
-      return builder;
-    }
-
-    int i = dn.size() - 1;
-    normalizeRDN(builder, dn.parent(i).rdn());
-    for (i--; i >= 0; i--)
-    {
-      builder.append('\u0000');
-      normalizeRDN(builder, dn.parent(i).rdn());
-    }
-    return builder;
-  }
-
-  /**
-   * Returns the normalized string representation of a RDN.
-   *
-   * @param builder The StringBuilder to use to construct the normalized string.
-   * @param rdn The RDN.
-   * @return The normalized string representation of the provided RDN.
-   */
-  private static StringBuilder normalizeRDN(final StringBuilder builder,
-                                           final RDN rdn)
-  {
-    final int sz = rdn.size();
-    if (sz == 1)
-    {
-      return normalizeAVA(builder, rdn.getFirstAVA());
-    }
-    else
-    {
-      // Need to sort the AVAs before comparing.
-      TreeSet<AVA> a = new TreeSet<AVA>();
-      for(AVA ava : rdn)
-      {
-        a.add(ava);
-      }
-      Iterator<AVA> i = a.iterator();
-      // Normalize the first AVA.
-      normalizeAVA(builder, i.next());
-      while(i.hasNext())
-      {
-        builder.append('\u0001');
-        normalizeAVA(builder, i.next());
-      }
-
-      return builder;
-    }
-  }
-
-  /**
-   * Returns the normalized string representation of an AVA.
-   *
-   * @param builder The StringBuilder to use to construct the normalized string.
-   * @param ava The AVA.
-   * @return The normalized string representation of the provided AVA.
-   */
-  private static StringBuilder normalizeAVA(final StringBuilder builder,
-                                           final AVA ava)
-  {
-    ByteString value = ava.getAttributeValue();
-    final MatchingRule matchingRule =
-        ava.getAttributeType().getEqualityMatchingRule();
-    if (matchingRule != null)
-    {
-      try
-      {
-        value =
-            matchingRule.normalizeAttributeValue(ava.getAttributeValue());
-      }
-      catch (final DecodeException de)
-      {
-        // Ignore - we'll drop back to the user provided value.
-      }
-    }
-
-    if (!ava.getAttributeType().getNames().iterator().hasNext())
-    {
-      builder.append(ava.getAttributeType().getOID());
-      builder.append("=#");
-      StaticUtils.toHex(value, builder);
-    }
-    else
-    {
-      final String name = ava.getAttributeType().getNameOrOID();
-      // Normalizing.
-      StaticUtils.toLowerCase(name, builder);
-
-      builder.append("=");
-
-      final Syntax syntax = ava.getAttributeType().getSyntax();
-      if (!syntax.isHumanReadable())
-      {
-        builder.append("#");
-        StaticUtils.toHex(value, builder);
-      }
-      else
-      {
-        final String str = value.toString();
-        if (str.length() == 0)
-        {
-          return builder;
+final class DistinguishedNameEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        try {
+            DN dn = DN.valueOf(value.toString(), schema.asNonStrictSchema());
+            StringBuilder builder = new StringBuilder(value.length());
+            return ByteString.valueOf(normalizeDN(builder, dn));
+        } catch (final LocalizedIllegalArgumentException e) {
+            throw DecodeException.error(e.getMessageObject());
         }
-        char c = str.charAt(0);
-        int startPos = 0;
-        if ((c == ' ') || (c == '#'))
-        {
-          builder.append('\\');
-          builder.append(c);
-          startPos = 1;
+    }
+
+    /**
+     * Returns the normalized string representation of a DN.
+     *
+     * @param builder
+     *            The StringBuilder to use to construct the normalized string.
+     * @param dn
+     *            The DN.
+     * @return The normalized string representation of the provided DN.
+     */
+    private static StringBuilder normalizeDN(final StringBuilder builder, final DN dn) {
+        if (dn.rdn() == null) {
+            return builder;
         }
-        final int length = str.length();
-        for (int si = startPos; si < length; si++)
-        {
-          c = str.charAt(si);
-          if (c < ' ')
-          {
-            for (final byte b : getBytes(String.valueOf(c)))
-            {
-              builder.append('\\');
-              builder.append(StaticUtils.byteToLowerHex(b));
+
+        int i = dn.size() - 1;
+        normalizeRDN(builder, dn.parent(i).rdn());
+        for (i--; i >= 0; i--) {
+            builder.append('\u0000');
+            normalizeRDN(builder, dn.parent(i).rdn());
+        }
+        return builder;
+    }
+
+    /**
+     * Returns the normalized string representation of a RDN.
+     *
+     * @param builder
+     *            The StringBuilder to use to construct the normalized string.
+     * @param rdn
+     *            The RDN.
+     * @return The normalized string representation of the provided RDN.
+     */
+    private static StringBuilder normalizeRDN(final StringBuilder builder, final RDN rdn) {
+        final int sz = rdn.size();
+        if (sz == 1) {
+            return normalizeAVA(builder, rdn.getFirstAVA());
+        } else {
+            // Need to sort the AVAs before comparing.
+            TreeSet<AVA> a = new TreeSet<AVA>();
+            for (AVA ava : rdn) {
+                a.add(ava);
             }
-          }
-          else
-          {
-            if ((c == ' ' && si == length - 1)
-                || (c == '"' || c == '+' || c == ',' || c == ';' || c == '<'
-                    || c == '=' || c == '>' || c == '\\' || c == '\u0000'))
-            {
-              builder.append('\\');
+            Iterator<AVA> i = a.iterator();
+            // Normalize the first AVA.
+            normalizeAVA(builder, i.next());
+            while (i.hasNext()) {
+                builder.append('\u0001');
+                normalizeAVA(builder, i.next());
             }
-            builder.append(c);
-          }
+
+            return builder;
         }
-      }
     }
-    return builder;
-  }
+
+    /**
+     * Returns the normalized string representation of an AVA.
+     *
+     * @param builder
+     *            The StringBuilder to use to construct the normalized string.
+     * @param ava
+     *            The AVA.
+     * @return The normalized string representation of the provided AVA.
+     */
+    private static StringBuilder normalizeAVA(final StringBuilder builder, final AVA ava) {
+        ByteString value = ava.getAttributeValue();
+        final MatchingRule matchingRule = ava.getAttributeType().getEqualityMatchingRule();
+        if (matchingRule != null) {
+            try {
+                value = matchingRule.normalizeAttributeValue(ava.getAttributeValue());
+            } catch (final DecodeException de) {
+                // Ignore - we'll drop back to the user provided value.
+            }
+        }
+
+        if (!ava.getAttributeType().getNames().iterator().hasNext()) {
+            builder.append(ava.getAttributeType().getOID());
+            builder.append("=#");
+            StaticUtils.toHex(value, builder);
+        } else {
+            final String name = ava.getAttributeType().getNameOrOID();
+            // Normalizing.
+            StaticUtils.toLowerCase(name, builder);
+
+            builder.append("=");
+
+            final Syntax syntax = ava.getAttributeType().getSyntax();
+            if (!syntax.isHumanReadable()) {
+                builder.append("#");
+                StaticUtils.toHex(value, builder);
+            } else {
+                final String str = value.toString();
+                if (str.length() == 0) {
+                    return builder;
+                }
+                char c = str.charAt(0);
+                int startPos = 0;
+                if ((c == ' ') || (c == '#')) {
+                    builder.append('\\');
+                    builder.append(c);
+                    startPos = 1;
+                }
+                final int length = str.length();
+                for (int si = startPos; si < length; si++) {
+                    c = str.charAt(si);
+                    if (c < ' ') {
+                        for (final byte b : getBytes(String.valueOf(c))) {
+                            builder.append('\\');
+                            builder.append(StaticUtils.byteToLowerHex(b));
+                        }
+                    } else {
+                        if ((c == ' ' && si == length - 1)
+                                || (c == '"' || c == '+' || c == ',' || c == ';' || c == '<'
+                                        || c == '=' || c == '>' || c == '\\' || c == '\u0000')) {
+                            builder.append('\\');
+                        }
+                        builder.append(c);
+                    }
+                }
+            }
+        }
+        return builder;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java
index 34f5072..a162d42 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_DN_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DN_NAME;
@@ -38,58 +35,39 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.DN;
 
-
-
 /**
  * This class defines the distinguished name attribute syntax, which is used for
  * attributes that hold distinguished names (DNs). Equality and substring
  * matching will be allowed by default.
  */
-final class DistinguishedNameSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_DN_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_DN_NAME;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    try
-    {
-      DN.valueOf(value.toString(), schema);
-    }
-    catch (final LocalizedIllegalArgumentException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
+final class DistinguishedNameSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_DN_OID;
     }
 
-    return true;
-  }
+    public String getName() {
+        return SYNTAX_DN_NAME;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        try {
+            DN.valueOf(value.toString(), schema);
+        } catch (final LocalizedIllegalArgumentException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
index 2e5627c..3d06ccf 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,15 +25,11 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class defines an approximate matching rule based on the Double Metaphone
  * algorithm. The Metaphone and Double Metaphone algorithms were originally
@@ -53,1053 +48,900 @@
  * redundant checks that aren't needed. It has also been updated to always only
  * generate a single value rather than one or possibly two values.
  */
-final class DoubleMetaphoneApproximateMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
+final class DoubleMetaphoneApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl {
 
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    String valueString = value.toString();
-    final int length = valueString.length();
-    if (length == 0)
-    {
-      // The value is empty, so it is already normalized.
-      return ByteString.empty();
-    }
-
-    final int last = length - 1;
-
-    // Pad the value to allow for checks to go past the end of the
-    // value.
-    valueString = valueString.toUpperCase() + "     ";
-
-    // The metaphone value that is being constructed.
-    final StringBuilder metaphone = new StringBuilder(4);
-
-    // Skip over GN, KN, PN, WR, and PS at the beginning of a word.
-    int pos = 0;
-    String substring = valueString.substring(0, 2);
-    if (substring.equals("GN") || substring.equals("KN")
-        || substring.equals("PN") || substring.equals("WR")
-        || substring.equals("PS"))
-    {
-      pos++;
-    }
-
-    // 'X' at the beginning of a word will sound like Z, but Z will
-    // always be mapped to S.
-    else if (valueString.charAt(0) == 'X')
-    {
-      metaphone.append("S");
-      pos++;
-    }
-
-    // Loop until we have at least four metaphone characters or have
-    // reached the end of the string.
-    while (metaphone.length() < 4 && pos < length)
-    {
-      // Check the character at the current position against various
-      // targets.
-      char posMinusFour;
-      char posMinusThree;
-      char posMinusTwo;
-      char posMinusOne;
-      char posPlusOne;
-      char posPlusTwo;
-      switch (valueString.charAt(pos))
-      {
-      case 'A':
-      case 'E':
-      case 'I':
-      case 'O':
-      case 'U':
-      case 'Y':
-        // All initial vowels map to 'A'. All others will be ignored.
-        if (pos == 0)
-        {
-          metaphone.append("A");
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        String valueString = value.toString();
+        final int length = valueString.length();
+        if (length == 0) {
+            // The value is empty, so it is already normalized.
+            return ByteString.empty();
         }
 
-        pos++;
-        break;
+        final int last = length - 1;
 
-      case 'B':
-        // B and BB will be mapped to P, with the exception of "MB" as
-        // in "crumb", but that will be handled elsewhere.
-        metaphone.append("P");
+        // Pad the value to allow for checks to go past the end of the
+        // value.
+        valueString = valueString.toUpperCase() + "     ";
 
-        if (valueString.charAt(++pos) == 'B')
-        {
-          pos++;
-        }
+        // The metaphone value that is being constructed.
+        final StringBuilder metaphone = new StringBuilder(4);
 
-        break;
-
-      case 'C':
-        // Check for various Germanic sequences, which will be mapped to
-        // 'K'. This basically includes all occurrences of "ACH" where
-        // the preceding character is not a vowel and the following
-        // character is neither an 'E' nor an 'I' except in "BACHER" and
-        // "MACHER".
-        if (pos > 1
-            && !isVowel(posMinusTwo = valueString.charAt(pos - 2))
-            && hasSubstring(valueString, pos - 1, "ACH")
-            && (posPlusTwo = valueString.charAt(pos + 2)) != 'I'
-            && (posPlusTwo != 'E' || valueString.charAt(pos + 3) == 'R'
-                && (posMinusTwo == 'B' || posMinusTwo == 'M')))
-        {
-          metaphone.append("K");
-          pos += 2;
-          break;
-        }
-
-        // Check for a special case of "caesar", which will be maped to
-        // 'S'.
-        if (pos == 0 && hasSubstring(valueString, pos + 1, "AESAR"))
-        {
-          metaphone.append("S");
-          pos += 2;
-          break;
-        }
-
-        // CH can be treated in lots of different ways.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H')
-        {
-          // Check for "chia" as in "chianti" and map to 'K'.
-          if (hasSubstring(valueString, pos + 2, "IA"))
-          {
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-
-          // Check for "chae" as in "michael" and map to 'K'.
-          if (hasSubstring(valueString, pos + 2, "AE"))
-          {
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-
-          // Check for a Greek root at the beginning of the value like
-          // chemistry or chorus and map to 'K'.
-          if (pos == 0
-              && !hasSubstring(valueString, 2, "ORE")
-              && (hasSubstring(valueString, 2, "ARAC")
-                  || hasSubstring(valueString, 2, "ARIS")
-                  || hasSubstring(valueString, 2, "OR")
-                  || hasSubstring(valueString, 2, "YM")
-                  || hasSubstring(valueString, 2, "IA") || hasSubstring(
-                  valueString, 2, "EM")))
-          {
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-
-          // Check for "CH" values that produce a "KH" sound that will
-          // be mapped to 'K'.
-          if (isGermanic(valueString)
-              || hasSubstring(valueString, pos - 2, "ORCHES")
-              || hasSubstring(valueString, pos - 2, "ARCHIT")
-              || hasSubstring(valueString, pos - 2, "ORCHID")
-              || (posPlusTwo = valueString.charAt(pos + 2)) == 'T'
-              || posPlusTwo == 'S'
-              || (pos == 0
-                  || (posMinusOne = valueString.charAt(pos - 1)) == 'A'
-                  || posMinusOne == 'O' || posMinusOne == 'U' || posMinusOne == 'E')
-              && (posPlusTwo == 'L' || posPlusTwo == 'R' || posPlusTwo == 'N'
-                  || posPlusTwo == 'M' || posPlusTwo == 'B'
-                  || posPlusTwo == 'H' || posPlusTwo == 'F'
-                  || posPlusTwo == 'V' || posPlusTwo == 'W'))
-          {
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-
-          // All other "CH" values.
-          if (pos > 0)
-          {
-            if (hasSubstring(valueString, 0, "MC"))
-            {
-              metaphone.append("K");
-            }
-            else
-            {
-              metaphone.append("X");
-            }
-          }
-          else
-          {
-            metaphone.append("X");
-          }
-
-          pos += 2;
-          break;
-        }
-
-        // Check for "CZ" as in "czerny" but not "wicz" and map to 'S'.
-        if (posPlusOne == 'Z' && !hasSubstring(valueString, pos - 2, "WI"))
-        {
-          metaphone.append("S");
-          pos += 2;
-          break;
-        }
-
-        // Check for "CIA" as in "focaccia" and map to 'X'.
-        if (posPlusOne == 'I' && valueString.charAt(pos + 2) == 'A')
-        {
-          metaphone.append("X");
-          pos += 3;
-          break;
-        }
-
-        // Check for a double C but not in values that start with "McC"
-        if (posPlusOne == 'C' && !(pos == 1 && valueString.charAt(0) == 'M'))
-        {
-          if (((posPlusTwo = valueString.charAt(pos + 2)) == 'I'
-              || posPlusTwo == 'E' || posPlusTwo == 'H')
-              && !(posPlusTwo == 'H' && valueString.charAt(pos + 3) == 'U'))
-          {
-            if (pos == 1 && valueString.charAt(pos - 1) == 'A'
-                || hasSubstring(valueString, pos - 1, "UCCEE")
-                || hasSubstring(valueString, pos - 1, "UCCES"))
-            {
-              // Values like "accident", "accede", and "succeed".
-              metaphone.append("K");
-              pos += 2;
-              break;
-            }
-            else
-            {
-              // Values like "bacci" or "bertucci".
-              metaphone.append("X");
-              pos += 3;
-              break;
-            }
-          }
-          else
-          {
-            // This is Pierce's Rule, whatever that means.
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-        }
-
-        // Check for CK, CG, or CQ and map to 'K'. Check for CI, CE, and
-        // CY and map to "S".
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'K'
-            || posPlusOne == 'G' || posPlusOne == 'Q')
-        {
-          metaphone.append("K");
-          pos += 2;
-          break;
-        }
-
-        // Check for CI, CE, or CY and map to 'S'.
-        if (posPlusOne == 'I' || posPlusOne == 'E' || posPlusOne == 'Y')
-        {
-          metaphone.append("S");
-          pos += 2;
-          break;
-        }
-
-        // All other cases of "C" will be mapped to 'K'. However, the
-        // number of positions that we skip ahead may vary. If there is
-        // a value that consists of two words like "mac caffrey", then
-        // skip ahead three. For the character combinations of "CK" and
-        // "CQ", then skip ahead two. For the character combinations of
-        // "CC" except "CCE" and "CCI", then skip ahead two. For all
-        // other cases, skip ahead one.
-        metaphone.append("K");
-        switch (valueString.charAt(pos + 1))
-        {
-        case ' ':
-          switch (valueString.charAt(pos + 2))
-          {
-          case 'C':
-          case 'Q':
-          case 'G':
-            pos += 3;
-            break;
-          default:
+        // Skip over GN, KN, PN, WR, and PS at the beginning of a word.
+        int pos = 0;
+        String substring = valueString.substring(0, 2);
+        if (substring.equals("GN") || substring.equals("KN") || substring.equals("PN")
+                || substring.equals("WR") || substring.equals("PS")) {
             pos++;
-            break;
-          }
-          break;
-
-        case 'K':
-        case 'Q':
-          pos += 2;
-          break;
-
-        case 'C':
-          switch (valueString.charAt(pos + 2))
-          {
-          case 'E':
-          case 'I':
+        } else if (valueString.charAt(0) == 'X') {
+            // 'X' at the beginning of a word will sound like Z, but Z will
+            // always be mapped to S.
+            metaphone.append("S");
             pos++;
-            break;
-          default:
-            pos += 2;
-            break;
-          }
-          break;
+        }
+
+        // Loop until we have at least four metaphone characters or have
+        // reached the end of the string.
+        while (metaphone.length() < 4 && pos < length) {
+            // Check the character at the current position against various
+            // targets.
+            char posMinusFour;
+            char posMinusThree;
+            char posMinusTwo;
+            char posMinusOne;
+            char posPlusOne;
+            char posPlusTwo;
+            switch (valueString.charAt(pos)) {
+            case 'A':
+            case 'E':
+            case 'I':
+            case 'O':
+            case 'U':
+            case 'Y':
+                // All initial vowels map to 'A'. All others will be ignored.
+                if (pos == 0) {
+                    metaphone.append("A");
+                }
+
+                pos++;
+                break;
+
+            case 'B':
+                // B and BB will be mapped to P, with the exception of "MB" as
+                // in "crumb", but that will be handled elsewhere.
+                metaphone.append("P");
+
+                if (valueString.charAt(++pos) == 'B') {
+                    pos++;
+                }
+
+                break;
+
+            case 'C':
+                // Check for various Germanic sequences, which will be mapped to
+                // 'K'. This basically includes all occurrences of "ACH" where
+                // the preceding character is not a vowel and the following
+                // character is neither an 'E' nor an 'I' except in "BACHER" and
+                // "MACHER".
+                if (pos > 1
+                        && !isVowel(posMinusTwo = valueString.charAt(pos - 2))
+                        && hasSubstring(valueString, pos - 1, "ACH")
+                        && (posPlusTwo = valueString.charAt(pos + 2)) != 'I'
+                        && (posPlusTwo != 'E' || valueString.charAt(pos + 3) == 'R'
+                                && (posMinusTwo == 'B' || posMinusTwo == 'M'))) {
+                    metaphone.append("K");
+                    pos += 2;
+                    break;
+                }
+
+                // Check for a special case of "caesar", which will be maped to
+                // 'S'.
+                if (pos == 0 && hasSubstring(valueString, pos + 1, "AESAR")) {
+                    metaphone.append("S");
+                    pos += 2;
+                    break;
+                }
+
+                // CH can be treated in lots of different ways.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H') {
+                    // Check for "chia" as in "chianti" and map to 'K'.
+                    if (hasSubstring(valueString, pos + 2, "IA")) {
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+
+                    // Check for "chae" as in "michael" and map to 'K'.
+                    if (hasSubstring(valueString, pos + 2, "AE")) {
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+
+                    // Check for a Greek root at the beginning of the value like
+                    // chemistry or chorus and map to 'K'.
+                    if (pos == 0
+                            && !hasSubstring(valueString, 2, "ORE")
+                            && (hasSubstring(valueString, 2, "ARAC")
+                                    || hasSubstring(valueString, 2, "ARIS")
+                                    || hasSubstring(valueString, 2, "OR")
+                                    || hasSubstring(valueString, 2, "YM")
+                                    || hasSubstring(valueString, 2, "IA") || hasSubstring(
+                                        valueString, 2, "EM"))) {
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+
+                    // Check for "CH" values that produce a "KH" sound that will
+                    // be mapped to 'K'.
+                    if (isGermanic(valueString)
+                            || hasSubstring(valueString, pos - 2, "ORCHES")
+                            || hasSubstring(valueString, pos - 2, "ARCHIT")
+                            || hasSubstring(valueString, pos - 2, "ORCHID")
+                            || (posPlusTwo = valueString.charAt(pos + 2)) == 'T'
+                            || posPlusTwo == 'S'
+                            || (pos == 0 || (posMinusOne = valueString.charAt(pos - 1)) == 'A'
+                                    || posMinusOne == 'O' || posMinusOne == 'U' || posMinusOne == 'E')
+                            && (posPlusTwo == 'L' || posPlusTwo == 'R' || posPlusTwo == 'N'
+                                    || posPlusTwo == 'M' || posPlusTwo == 'B' || posPlusTwo == 'H'
+                                    || posPlusTwo == 'F' || posPlusTwo == 'V' || posPlusTwo == 'W')) {
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+
+                    // All other "CH" values.
+                    if (pos > 0) {
+                        if (hasSubstring(valueString, 0, "MC")) {
+                            metaphone.append("K");
+                        } else {
+                            metaphone.append("X");
+                        }
+                    } else {
+                        metaphone.append("X");
+                    }
+
+                    pos += 2;
+                    break;
+                }
+
+                // Check for "CZ" as in "czerny" but not "wicz" and map to 'S'.
+                if (posPlusOne == 'Z' && !hasSubstring(valueString, pos - 2, "WI")) {
+                    metaphone.append("S");
+                    pos += 2;
+                    break;
+                }
+
+                // Check for "CIA" as in "focaccia" and map to 'X'.
+                if (posPlusOne == 'I' && valueString.charAt(pos + 2) == 'A') {
+                    metaphone.append("X");
+                    pos += 3;
+                    break;
+                }
+
+                // Check for a double C but not in values that start with "McC"
+                if (posPlusOne == 'C' && !(pos == 1 && valueString.charAt(0) == 'M')) {
+                    if (((posPlusTwo = valueString.charAt(pos + 2)) == 'I' || posPlusTwo == 'E' || posPlusTwo == 'H')
+                            && !(posPlusTwo == 'H' && valueString.charAt(pos + 3) == 'U')) {
+                        if (pos == 1 && valueString.charAt(pos - 1) == 'A'
+                                || hasSubstring(valueString, pos - 1, "UCCEE")
+                                || hasSubstring(valueString, pos - 1, "UCCES")) {
+                            // Values like "accident", "accede", and "succeed".
+                            metaphone.append("K");
+                            pos += 2;
+                            break;
+                        } else {
+                            // Values like "bacci" or "bertucci".
+                            metaphone.append("X");
+                            pos += 3;
+                            break;
+                        }
+                    } else {
+                        // This is Pierce's Rule, whatever that means.
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+                }
+
+                // Check for CK, CG, or CQ and map to 'K'. Check for CI, CE, and
+                // CY and map to "S".
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'K' || posPlusOne == 'G'
+                        || posPlusOne == 'Q') {
+                    metaphone.append("K");
+                    pos += 2;
+                    break;
+                }
+
+                // Check for CI, CE, or CY and map to 'S'.
+                if (posPlusOne == 'I' || posPlusOne == 'E' || posPlusOne == 'Y') {
+                    metaphone.append("S");
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases of "C" will be mapped to 'K'. However, the
+                // number of positions that we skip ahead may vary. If there is
+                // a value that consists of two words like "mac caffrey", then
+                // skip ahead three. For the character combinations of "CK" and
+                // "CQ", then skip ahead two. For the character combinations of
+                // "CC" except "CCE" and "CCI", then skip ahead two. For all
+                // other cases, skip ahead one.
+                metaphone.append("K");
+                switch (valueString.charAt(pos + 1)) {
+                case ' ':
+                    switch (valueString.charAt(pos + 2)) {
+                    case 'C':
+                    case 'Q':
+                    case 'G':
+                        pos += 3;
+                        break;
+                    default:
+                        pos++;
+                        break;
+                    }
+                    break;
+
+                case 'K':
+                case 'Q':
+                    pos += 2;
+                    break;
+
+                case 'C':
+                    switch (valueString.charAt(pos + 2)) {
+                    case 'E':
+                    case 'I':
+                        pos++;
+                        break;
+                    default:
+                        pos += 2;
+                        break;
+                    }
+                    break;
+                default:
+                    pos++;
+                }
+                break;
+
+            case 'D':
+                // DG will be mapped to either 'J' (in cases like edge) or 'TK'
+                // (in cases like Edgar).
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'G') {
+                    if ((posPlusTwo = valueString.charAt(pos + 2)) == 'I' || posPlusTwo == 'E'
+                            || posPlusTwo == 'Y') {
+                        metaphone.append("J");
+                        pos += 3;
+                        break;
+                    } else {
+                        metaphone.append("TK");
+                        pos += 2;
+                        break;
+                    }
+                }
+
+                // DT and DD will be mapped to 'T'.
+                if (posPlusOne == 'T' || posPlusOne == 'D') {
+                    metaphone.append("T");
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases will be mapped to 'T'.
+                metaphone.append("T");
+                pos++;
+                break;
+
+            case 'F':
+                // F always maps to F. If there is a double F, then skip the
+                // second one.
+                metaphone.append("F");
+                pos++;
+                if (valueString.charAt(pos) == 'F') {
+                    pos++;
+                }
+                break;
+
+            case 'G':
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H') {
+                    // A "GH" that is not preceded by a vowel will be mapped to
+                    // 'K'.
+                    if (pos > 0 && !isVowel(valueString.charAt(pos - 1))) {
+                        metaphone.append("K");
+                        pos += 2;
+                        break;
+                    }
+
+                    if (pos == 0) {
+                        if (valueString.charAt(pos + 2) == 'I') {
+                            // Words like ghislane or ghiradelli
+                            metaphone.append("J");
+                        } else {
+                            metaphone.append("K");
+                        }
+
+                        pos += 2;
+                        break;
+                    }
+
+                    // A refined version of Parker's Rule.
+                    if (pos > 1
+                            && ((posMinusTwo = valueString.charAt(pos - 2)) == 'B'
+                                    || posMinusTwo == 'H' || posMinusTwo == 'D')
+                            || pos > 2
+                            && ((posMinusThree = valueString.charAt(pos - 3)) == 'B'
+                                    || posMinusThree == 'H' || posMinusThree == 'D')
+                            || pos > 3
+                            && ((posMinusFour = valueString.charAt(pos - 4)) == 'B' || posMinusFour == 'H')) {
+                        pos += 2;
+                        break;
+                    } else {
+                        if (pos > 2
+                                && valueString.charAt(pos - 1) == 'U'
+                                && ((posMinusThree = valueString.charAt(pos - 3)) == 'C'
+                                        || posMinusThree == 'G' || posMinusThree == 'L'
+                                        || posMinusThree == 'R' || posMinusThree == 'T')) {
+                            // Words like laugh, McLaughlin, cough, rough are
+                            // mapped
+                            // to 'F'.
+                            metaphone.append("F");
+                        } else if (pos > 0 && valueString.charAt(pos - 1) != 'I') {
+                            metaphone.append("K");
+                        }
+
+                        pos += 2;
+                        break;
+                    }
+                }
+
+                if (posPlusOne == 'N') {
+                    if (pos == 1 && isVowel(valueString.charAt(0)) && !isSlavoGermanic(valueString)) {
+                        metaphone.append("KN");
+                        pos += 2;
+                        break;
+                    } else {
+                        if (!hasSubstring(valueString, pos + 2, "EY")
+                                && !isSlavoGermanic(valueString)) {
+                            metaphone.append("N");
+                        } else {
+                            metaphone.append("KN");
+                        }
+
+                        pos += 2;
+                        break;
+                    }
+                }
+
+                // GLI as in tagliaro will be mapped to "KL".
+                if (posPlusOne == 'L' && valueString.charAt(pos + 2) == 'I') {
+                    metaphone.append("KL");
+                    pos += 2;
+                    break;
+                }
+
+                // Forms of GY, GE, and GI at the beginning of a word will map
+                // to 'K'.
+                if (pos == 0
+                        && (posPlusOne == 'Y'
+                                || (substring = valueString.substring(pos + 1, pos + 3))
+                                        .equals("ES") || substring.equals("EP")
+                                || substring.equals("EB") || substring.equals("EL")
+                                || substring.equals("EY") || substring.equals("IB")
+                                || substring.equals("IL") || substring.equals("IN")
+                                || substring.equals("IE") || substring.equals("EI") || substring
+                                    .equals("ER"))) {
+                    metaphone.append("K");
+                    pos += 2;
+                    break;
+                }
+
+                // Some occurrences of GER and GY in a word will be mapped to
+                // 'K'.
+                posPlusTwo = valueString.charAt(pos + 2);
+                if ((posPlusOne == 'E' && posPlusTwo == 'R' || posPlusOne == 'Y')
+                        && (posMinusOne = valueString.charAt(pos - 1)) != 'E' && posMinusOne != 'I'
+                        && !hasSubstring(valueString, 0, "DANGER")
+                        && !hasSubstring(valueString, 0, "RANGER")
+                        && !hasSubstring(valueString, 0, "MANGER")
+                        && !hasSubstring(valueString, pos - 1, "RGY")
+                        && !hasSubstring(valueString, pos - 1, "OGY")) {
+                    metaphone.append("K");
+                    pos += 2;
+                    break;
+                }
+
+                // Check for Italian uses like 'biaggi" and map to 'J'.
+                if (posPlusOne == 'E' || posPlusOne == 'I' || posPlusOne == 'Y'
+                        || hasSubstring(valueString, pos - 1, "AGGI")
+                        || hasSubstring(valueString, pos - 1, "OGGI")) {
+                    // Germanic uses will be mapped to 'K'.
+                    if (isGermanic(valueString) || hasSubstring(valueString, pos + 1, "ET")) {
+                        metaphone.append("K");
+                    } else {
+                        metaphone.append("J");
+                    }
+
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases will be mapped to 'K'. If there is a double
+                // G, then skip two. Otherwise, just skip one.
+                metaphone.append("K");
+                pos++;
+
+                if (posPlusOne == 'G') {
+                    pos++;
+                }
+
+                break;
+
+            case 'H':
+                // The letter 'H' will only be processed if it is immediately
+                // followed by a vowel and is either the start of the word or
+                // preceded by a vowel.
+                if (isVowel(valueString.charAt(pos + 1))) {
+                    if (pos == 0 || isVowel(valueString.charAt(pos - 1))) {
+                        metaphone.append("H");
+                        pos++;
+                    }
+                }
+
+                pos++;
+                break;
+
+            case 'J':
+                // Take care of obvious Spanish uses that should map to 'H'.
+                if (hasSubstring(valueString, 0, "SAN ")) {
+                    metaphone.append("H");
+                    pos++;
+                    break;
+                }
+
+                if (hasSubstring(valueString, pos, "JOSE")) {
+                    if (pos == 0 && valueString.charAt(pos + 4) == ' ') {
+                        metaphone.append("H");
+                    } else {
+                        metaphone.append("J");
+                    }
+
+                    pos++;
+                    break;
+                }
+
+                // All other cases will be mapped to 'J'.
+                metaphone.append("J");
+
+                if (valueString.charAt(pos + 1) == 'J') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'K':
+                // 'K' will always be mapped to 'K'. KK will be treated like K.
+                metaphone.append("K");
+
+                if (valueString.charAt(pos + 1) == 'K') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'L':
+                // 'L' will always be mapped to 'L'. LL will be treated like L,
+                // even for potential Spanish uses.
+                metaphone.append("L");
+
+                if (valueString.charAt(pos + 1) == 'L') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'M':
+                // 'M' will always be mapped to 'M'. MM will be treated like M.
+                // UMB in cases like "dumb" and "thumb" will be treated like M.
+                metaphone.append("M");
+
+                if (valueString.charAt(pos + 1) == 'M') {
+                    pos++;
+                } else if (hasSubstring(valueString, pos - 1, "UMB")) {
+                    if (pos + 1 == last || hasSubstring(valueString, pos + 2, "ER")) {
+                        pos++;
+                    }
+                }
+
+                pos++;
+                break;
+
+            case 'N':
+                // 'N' will always be mapped to 'N'. NN will be treated like N.
+                metaphone.append("N");
+
+                if (valueString.charAt(pos + 1) == 'N') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'P':
+                // PH will be mapped to 'F'.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H') {
+                    metaphone.append("F");
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases will be mapped to 'P', with PP and PB being
+                // treated like P.
+                metaphone.append("P");
+
+                if (posPlusOne == 'P' || posPlusOne == 'B') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'Q':
+                // 'Q' will always be mapped to 'K'. QQ will be treated like Q.
+                metaphone.append("K");
+
+                if (valueString.charAt(pos + 1) == 'Q') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'R':
+                // Ignore R at the end of French words.
+                if (pos == last && !isSlavoGermanic(valueString)
+                        && hasSubstring(valueString, pos - 2, "IE")
+                        && !hasSubstring(valueString, pos - 4, "ME")
+                        && !hasSubstring(valueString, pos - 4, "MA")) {
+                    pos++;
+                    break;
+                }
+
+                // All other cases will be mapped to 'R', with RR treated like
+                // R.
+                metaphone.append("R");
+
+                if (valueString.charAt(pos + 1) == 'R') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'S':
+                // Special cases like isle and carlysle will be silent.
+                if (hasSubstring(valueString, pos - 1, "ISL")
+                        || hasSubstring(valueString, pos - 1, "YSL")) {
+                    pos++;
+                    break;
+                }
+
+                // Special case of sugar mapped to 'X'.
+                if (hasSubstring(valueString, pos + 1, "UGAR")) {
+                    metaphone.append("X");
+                    pos++;
+                    break;
+                }
+
+                // SH is generally mapped to 'X', but not in Germanic cases.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H') {
+                    if (hasSubstring(valueString, pos + 1, "HEIM")
+                            || hasSubstring(valueString, pos + 1, "HOEK")
+                            || hasSubstring(valueString, pos + 1, "HOLM")
+                            || hasSubstring(valueString, pos + 1, "HOLZ")) {
+                        metaphone.append("S");
+                    } else {
+                        metaphone.append("X");
+                    }
+
+                    pos += 2;
+                    break;
+                }
+
+                // Italian and Armenian cases will map to "S".
+                if (hasSubstring(valueString, pos + 1, "IO")
+                        || hasSubstring(valueString, pos + 1, "IA")) {
+                    metaphone.append("S");
+                    pos += 3;
+                    break;
+                }
+
+                // SZ should be mapped to 'S'.
+                if (posPlusOne == 'Z') {
+                    metaphone.append("S");
+                    pos += 2;
+                    break;
+                }
+
+                // Various combinations at the beginning of words will be mapped
+                // to 'S'.
+                if (pos == 0
+                        && (posPlusOne == 'M' || posPlusOne == 'N' || posPlusOne == 'L' || posPlusOne == 'W')) {
+                    metaphone.append("S");
+                    pos++;
+                    break;
+                }
+
+                // SC should be mapped to either SK, X, or S.
+                if (posPlusOne == 'C') {
+                    if ((posPlusTwo = valueString.charAt(pos + 2)) == 'H') {
+                        if (hasSubstring(valueString, pos + 3, "OO")
+                                || hasSubstring(valueString, pos + 3, "UY")
+                                || hasSubstring(valueString, pos + 3, "ED")
+                                || hasSubstring(valueString, pos + 3, "EM")) {
+                            metaphone.append("SK");
+                        } else {
+                            metaphone.append("X");
+                        }
+
+                        pos += 3;
+                        break;
+                    }
+
+                    if (posPlusTwo == 'I' || posPlusTwo == 'E' || posPlusTwo == 'Y') {
+                        metaphone.append("S");
+                        pos += 3;
+                        break;
+                    }
+
+                    metaphone.append("SK");
+                    pos += 3;
+                    break;
+                }
+
+                // Ignore a trailing S in French words. All others will be
+                // mapped to 'S'.
+                if (!(pos == last && (hasSubstring(valueString, pos - 2, "AI") || hasSubstring(
+                        valueString, pos - 2, "OI")))) {
+                    metaphone.append("S");
+                }
+
+                if (posPlusOne == 'S' || posPlusOne == 'Z') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'T':
+                // "TION", "TIA", and "TCH" will be mapped to 'X'.
+                if (hasSubstring(valueString, pos, "TION") || hasSubstring(valueString, pos, "TIA")
+                        || hasSubstring(valueString, pos, "TCH")) {
+                    metaphone.append("X");
+                    pos += 3;
+                    break;
+                }
+
+                // TH or TTH will be mapped to either T (for Germanic cases) or
+                // 0 (zero) for the rest.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H' || posPlusOne == 'T'
+                        && valueString.charAt(pos + 2) == 'H') {
+                    if (isGermanic(valueString) || hasSubstring(valueString, pos + 2, "OM")
+                            || hasSubstring(valueString, pos + 2, "AM")) {
+                        metaphone.append("T");
+                    } else {
+                        metaphone.append("0");
+                    }
+
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases will map to T, with TT and TD being treated
+                // like T.
+                metaphone.append("T");
+
+                if (posPlusOne == 'T' || posPlusOne == 'D') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'V':
+                // 'V' will always be mapped to 'F', with VV treated like V.
+                metaphone.append("F");
+
+                if (valueString.charAt(pos + 1) == 'V') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'W':
+                // WR should always map to R.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'R') {
+                    metaphone.append("R");
+                    pos += 2;
+                    break;
+                }
+
+                // W[AEIOUYH] at the beginning of the word should be mapped to
+                // A.
+                if (pos == 0 && (isVowel(posPlusOne) || posPlusOne == 'H')) {
+                    metaphone.append("A");
+
+                    // FIXME -- This isn't in the algorithm as written. Should
+                    // it
+                    // be?
+                    pos += 2;
+                    break;
+                }
+
+                // A Polish value like WICZ or WITZ should be mapped to TS.
+                if (hasSubstring(valueString, pos + 1, "WICZ")
+                        || hasSubstring(valueString, pos + 1, "WITZ")) {
+                    metaphone.append("TS");
+                    pos += 4;
+                    break;
+                }
+
+                // Otherwise, we'll just skip it.
+                pos++;
+                break;
+
+            case 'X':
+                // X maps to KS except at the end of French words.
+                if (!(pos == last && (hasSubstring(valueString, pos - 3, "IAU")
+                        || hasSubstring(valueString, pos - 3, "EAU")
+                        || hasSubstring(valueString, pos - 2, "AU") || hasSubstring(valueString,
+                            pos - 2, "OU")))) {
+                    metaphone.append("KS");
+                }
+
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'C' || posPlusOne == 'X') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case 'Z':
+                // Chinese usages like zhao will map to J.
+                if ((posPlusOne = valueString.charAt(pos + 1)) == 'H') {
+                    metaphone.append("J");
+                    pos += 2;
+                    break;
+                }
+
+                // All other cases map to "S". ZZ will be treated like Z.
+                metaphone.append("S");
+
+                if (posPlusOne == 'Z') {
+                    pos++;
+                }
+
+                pos++;
+                break;
+
+            case '\u00C7': // C with a cedilla
+                // This will always be mapped to 'S'.
+                metaphone.append("S");
+                pos++;
+                break;
+
+            case '\u00D1': // N with a tilde
+                // This will always be mapped to 'N'.
+                metaphone.append("N");
+                pos++;
+                break;
+
+            default:
+                // We don't have any special treatment for this character, so
+                // skip it.
+                pos++;
+                break;
+            }
+        }
+
+        return ByteString.valueOf(metaphone.toString());
+    }
+
+    /**
+     * Indicates whether the provided value has the given substring at the
+     * specified position.
+     *
+     * @param value
+     *            The value containing the range for which to make the
+     *            determination.
+     * @param start
+     *            The position in the value at which to start the comparison.
+     * @param substring
+     *            The substring to compare against the specified value range.
+     * @return <CODE>true</CODE> if the specified portion of the value matches
+     *         the given substring, or <CODE>false</CODE> if it does not.
+     */
+    private boolean hasSubstring(final String value, final int start, final String substring) {
+        try {
+            // This can happen since a lot of the rules "look behind" and
+            // rightfully don't check if it's the first character
+            if (start < 0) {
+                return false;
+            }
+
+            final int end = start + substring.length();
+
+            // value isn't big enough to do the comparison
+            if (end > value.length()) {
+                return false;
+            }
+
+            for (int i = 0, pos = start; pos < end; i++, pos++) {
+                if (value.charAt(pos) != substring.charAt(i)) {
+                    return false;
+                }
+            }
+
+            return true;
+        } catch (final Exception e) {
+            StaticUtils.DEBUG_LOG.throwing("DoubleMetaphoneApproximateMatchingRule",
+                    "hasSubstring", e);
+
+            return false;
+        }
+    }
+
+    /**
+     * Indicates whether the provided string appears Germanic (starts with
+     * "VAN ", "VON ", or "SCH").
+     *
+     * @param s
+     *            The string for which to make the determination.
+     * @return <CODE>true</CODE> if the provided string appears Germanic, or
+     *         <CODE>false</CODE> if not.
+     */
+    private boolean isGermanic(final String s) {
+        return s.startsWith("VAN ") || s.startsWith("VON ") || s.startsWith("SCH");
+    }
+
+    /**
+     * Indicates whether the provided string appears to be Slavo-Germanic.
+     *
+     * @param s
+     *            The string for which to make the determination.
+     * @return <CODE>true</CODE> if the provided string appears to be
+     *         Slavo-Germanic, or <CODE>false</CODE> if not.
+     */
+    private boolean isSlavoGermanic(final String s) {
+        return s.contains("W") || s.contains("K") || s.contains("CZ") || s.contains("WITZ");
+    }
+
+    /**
+     * Indicates whether the provided character is a vowel (including "Y").
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided character is a vowel, or
+     *         <CODE>false</CODE> if not.
+     */
+    private boolean isVowel(final char c) {
+        switch (c) {
+        case 'A':
+        case 'E':
+        case 'I':
+        case 'O':
+        case 'U':
+        case 'Y':
+            return true;
+
         default:
-          pos++;
+            return false;
         }
-        break;
-
-      case 'D':
-        // DG will be mapped to either 'J' (in cases like edge) or 'TK'
-        // (in cases like Edgar).
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'G')
-        {
-          if ((posPlusTwo = valueString.charAt(pos + 2)) == 'I'
-              || posPlusTwo == 'E' || posPlusTwo == 'Y')
-          {
-            metaphone.append("J");
-            pos += 3;
-            break;
-          }
-          else
-          {
-            metaphone.append("TK");
-            pos += 2;
-            break;
-          }
-        }
-
-        // DT and DD will be mapped to 'T'.
-        if (posPlusOne == 'T' || posPlusOne == 'D')
-        {
-          metaphone.append("T");
-          pos += 2;
-          break;
-        }
-
-        // All other cases will be mapped to 'T'.
-        metaphone.append("T");
-        pos++;
-        break;
-
-      case 'F':
-        // F always maps to F. If there is a double F, then skip the
-        // second one.
-        metaphone.append("F");
-        pos++;
-        if (valueString.charAt(pos) == 'F')
-        {
-          pos++;
-        }
-        break;
-
-      case 'G':
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H')
-        {
-          // A "GH" that is not preceded by a vowel will be mapped to
-          // 'K'.
-          if (pos > 0 && !isVowel(valueString.charAt(pos - 1)))
-          {
-            metaphone.append("K");
-            pos += 2;
-            break;
-          }
-
-          if (pos == 0)
-          {
-            if (valueString.charAt(pos + 2) == 'I')
-            {
-              // Words like ghislane or ghiradelli
-              metaphone.append("J");
-            }
-            else
-            {
-              metaphone.append("K");
-            }
-
-            pos += 2;
-            break;
-          }
-
-          // A refined version of Parker's Rule.
-          if (pos > 1
-              && ((posMinusTwo = valueString.charAt(pos - 2)) == 'B'
-                  || posMinusTwo == 'H' || posMinusTwo == 'D')
-              || pos > 2
-              && ((posMinusThree = valueString.charAt(pos - 3)) == 'B'
-                  || posMinusThree == 'H' || posMinusThree == 'D')
-              || pos > 3
-              && ((posMinusFour = valueString.charAt(pos - 4)) == 'B' || posMinusFour == 'H'))
-          {
-            pos += 2;
-            break;
-          }
-          else
-          {
-            if (pos > 2
-                && valueString.charAt(pos - 1) == 'U'
-                && ((posMinusThree = valueString.charAt(pos - 3)) == 'C'
-                    || posMinusThree == 'G' || posMinusThree == 'L'
-                    || posMinusThree == 'R' || posMinusThree == 'T'))
-            {
-              // Words like laugh, McLaughlin, cough, rough are mapped
-              // to 'F'.
-              metaphone.append("F");
-            }
-            else if (pos > 0 && valueString.charAt(pos - 1) != 'I')
-            {
-              metaphone.append("K");
-            }
-
-            pos += 2;
-            break;
-          }
-        }
-
-        if (posPlusOne == 'N')
-        {
-          if (pos == 1 && isVowel(valueString.charAt(0))
-              && !isSlavoGermanic(valueString))
-          {
-            metaphone.append("KN");
-            pos += 2;
-            break;
-          }
-          else
-          {
-            if (!hasSubstring(valueString, pos + 2, "EY")
-                && !isSlavoGermanic(valueString))
-            {
-              metaphone.append("N");
-            }
-            else
-            {
-              metaphone.append("KN");
-            }
-
-            pos += 2;
-            break;
-          }
-        }
-
-        // GLI as in tagliaro will be mapped to "KL".
-        if (posPlusOne == 'L' && valueString.charAt(pos + 2) == 'I')
-        {
-          metaphone.append("KL");
-          pos += 2;
-          break;
-        }
-
-        // Forms of GY, GE, and GI at the beginning of a word will map
-        // to 'K'.
-        if (pos == 0
-            && (posPlusOne == 'Y'
-                || (substring = valueString.substring(pos + 1, pos + 3))
-                    .equals("ES") || substring.equals("EP")
-                || substring.equals("EB") || substring.equals("EL")
-                || substring.equals("EY") || substring.equals("IB")
-                || substring.equals("IL") || substring.equals("IN")
-                || substring.equals("IE") || substring.equals("EI") || substring
-                .equals("ER")))
-        {
-          metaphone.append("K");
-          pos += 2;
-          break;
-        }
-
-        // Some occurrences of GER and GY in a word will be mapped to
-        // 'K'.
-        posPlusTwo = valueString.charAt(pos + 2);
-        if ((posPlusOne == 'E' && posPlusTwo == 'R' || posPlusOne == 'Y')
-            && (posMinusOne = valueString.charAt(pos - 1)) != 'E'
-            && posMinusOne != 'I' && !hasSubstring(valueString, 0, "DANGER")
-            && !hasSubstring(valueString, 0, "RANGER")
-            && !hasSubstring(valueString, 0, "MANGER")
-            && !hasSubstring(valueString, pos - 1, "RGY")
-            && !hasSubstring(valueString, pos - 1, "OGY"))
-        {
-          metaphone.append("K");
-          pos += 2;
-          break;
-        }
-
-        // Check for Italian uses like 'biaggi" and map to 'J'.
-        if (posPlusOne == 'E' || posPlusOne == 'I' || posPlusOne == 'Y'
-            || hasSubstring(valueString, pos - 1, "AGGI")
-            || hasSubstring(valueString, pos - 1, "OGGI"))
-        {
-          // Germanic uses will be mapped to 'K'.
-          if (isGermanic(valueString)
-              || hasSubstring(valueString, pos + 1, "ET"))
-          {
-            metaphone.append("K");
-          }
-          else
-          {
-            metaphone.append("J");
-          }
-
-          pos += 2;
-          break;
-        }
-
-        // All other cases will be mapped to 'K'. If there is a double
-        // G, then skip two. Otherwise, just skip one.
-        metaphone.append("K");
-        pos++;
-
-        if (posPlusOne == 'G')
-        {
-          pos++;
-        }
-
-        break;
-
-      case 'H':
-        // The letter 'H' will only be processed if it is immediately
-        // followed by a vowel and is either the start of the word or
-        // preceded by a vowel.
-        if (isVowel(valueString.charAt(pos + 1)))
-        {
-          if (pos == 0 || isVowel(valueString.charAt(pos - 1)))
-          {
-            metaphone.append("H");
-            pos++;
-          }
-        }
-
-        pos++;
-        break;
-
-      case 'J':
-        // Take care of obvious Spanish uses that should map to 'H'.
-        if (hasSubstring(valueString, 0, "SAN "))
-        {
-          metaphone.append("H");
-          pos++;
-          break;
-        }
-
-        if (hasSubstring(valueString, pos, "JOSE"))
-        {
-          if (pos == 0 && valueString.charAt(pos + 4) == ' ')
-          {
-            metaphone.append("H");
-          }
-          else
-          {
-            metaphone.append("J");
-          }
-
-          pos++;
-          break;
-        }
-
-        // All other cases will be mapped to 'J'.
-        metaphone.append("J");
-
-        if (valueString.charAt(pos + 1) == 'J')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'K':
-        // 'K' will always be mapped to 'K'. KK will be treated like K.
-        metaphone.append("K");
-
-        if (valueString.charAt(pos + 1) == 'K')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'L':
-        // 'L' will always be mapped to 'L'. LL will be treated like L,
-        // even for potential Spanish uses.
-        metaphone.append("L");
-
-        if (valueString.charAt(pos + 1) == 'L')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'M':
-        // 'M' will always be mapped to 'M'. MM will be treated like M.
-        // UMB in cases like "dumb" and "thumb" will be treated like M.
-        metaphone.append("M");
-
-        if (valueString.charAt(pos + 1) == 'M')
-        {
-          pos++;
-        }
-        else if (hasSubstring(valueString, pos - 1, "UMB"))
-        {
-          if (pos + 1 == last || hasSubstring(valueString, pos + 2, "ER"))
-          {
-            pos++;
-          }
-        }
-
-        pos++;
-        break;
-
-      case 'N':
-        // 'N' will always be mapped to 'N'. NN will be treated like N.
-        metaphone.append("N");
-
-        if (valueString.charAt(pos + 1) == 'N')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'P':
-        // PH will be mapped to 'F'.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H')
-        {
-          metaphone.append("F");
-          pos += 2;
-          break;
-        }
-
-        // All other cases will be mapped to 'P', with PP and PB being
-        // treated like P.
-        metaphone.append("P");
-
-        if (posPlusOne == 'P' || posPlusOne == 'B')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'Q':
-        // 'Q' will always be mapped to 'K'. QQ will be treated like Q.
-        metaphone.append("K");
-
-        if (valueString.charAt(pos + 1) == 'Q')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'R':
-        // Ignore R at the end of French words.
-        if (pos == last && !isSlavoGermanic(valueString)
-            && hasSubstring(valueString, pos - 2, "IE")
-            && !hasSubstring(valueString, pos - 4, "ME")
-            && !hasSubstring(valueString, pos - 4, "MA"))
-        {
-          pos++;
-          break;
-        }
-
-        // All other cases will be mapped to 'R', with RR treated like
-        // R.
-        metaphone.append("R");
-
-        if (valueString.charAt(pos + 1) == 'R')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'S':
-        // Special cases like isle and carlysle will be silent.
-        if (hasSubstring(valueString, pos - 1, "ISL")
-            || hasSubstring(valueString, pos - 1, "YSL"))
-        {
-          pos++;
-          break;
-        }
-
-        // Special case of sugar mapped to 'X'.
-        if (hasSubstring(valueString, pos + 1, "UGAR"))
-        {
-          metaphone.append("X");
-          pos++;
-          break;
-        }
-
-        // SH is generally mapped to 'X', but not in Germanic cases.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H')
-        {
-          if (hasSubstring(valueString, pos + 1, "HEIM")
-              || hasSubstring(valueString, pos + 1, "HOEK")
-              || hasSubstring(valueString, pos + 1, "HOLM")
-              || hasSubstring(valueString, pos + 1, "HOLZ"))
-          {
-            metaphone.append("S");
-          }
-          else
-          {
-            metaphone.append("X");
-          }
-
-          pos += 2;
-          break;
-        }
-
-        // Italian and Armenian cases will map to "S".
-        if (hasSubstring(valueString, pos + 1, "IO")
-            || hasSubstring(valueString, pos + 1, "IA"))
-        {
-          metaphone.append("S");
-          pos += 3;
-          break;
-        }
-
-        // SZ should be mapped to 'S'.
-        if (posPlusOne == 'Z')
-        {
-          metaphone.append("S");
-          pos += 2;
-          break;
-        }
-
-        // Various combinations at the beginning of words will be mapped
-        // to 'S'.
-        if (pos == 0
-            && (posPlusOne == 'M' || posPlusOne == 'N' || posPlusOne == 'L' || posPlusOne == 'W'))
-        {
-          metaphone.append("S");
-          pos++;
-          break;
-        }
-
-        // SC should be mapped to either SK, X, or S.
-        if (posPlusOne == 'C')
-        {
-          if ((posPlusTwo = valueString.charAt(pos + 2)) == 'H')
-          {
-            if (hasSubstring(valueString, pos + 3, "OO")
-                || hasSubstring(valueString, pos + 3, "UY")
-                || hasSubstring(valueString, pos + 3, "ED")
-                || hasSubstring(valueString, pos + 3, "EM"))
-            {
-              metaphone.append("SK");
-            }
-            else
-            {
-              metaphone.append("X");
-            }
-
-            pos += 3;
-            break;
-          }
-
-          if (posPlusTwo == 'I' || posPlusTwo == 'E' || posPlusTwo == 'Y')
-          {
-            metaphone.append("S");
-            pos += 3;
-            break;
-          }
-
-          metaphone.append("SK");
-          pos += 3;
-          break;
-        }
-
-        // Ignore a trailing S in French words. All others will be
-        // mapped to 'S'.
-        if (!(pos == last && (hasSubstring(valueString, pos - 2, "AI") || hasSubstring(
-            valueString, pos - 2, "OI"))))
-        {
-          metaphone.append("S");
-        }
-
-        if (posPlusOne == 'S' || posPlusOne == 'Z')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'T':
-        // "TION", "TIA", and "TCH" will be mapped to 'X'.
-        if (hasSubstring(valueString, pos, "TION")
-            || hasSubstring(valueString, pos, "TIA")
-            || hasSubstring(valueString, pos, "TCH"))
-        {
-          metaphone.append("X");
-          pos += 3;
-          break;
-        }
-
-        // TH or TTH will be mapped to either T (for Germanic cases) or
-        // 0 (zero) for the rest.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H'
-            || posPlusOne == 'T' && valueString.charAt(pos + 2) == 'H')
-        {
-          if (isGermanic(valueString)
-              || hasSubstring(valueString, pos + 2, "OM")
-              || hasSubstring(valueString, pos + 2, "AM"))
-          {
-            metaphone.append("T");
-          }
-          else
-          {
-            metaphone.append("0");
-          }
-
-          pos += 2;
-          break;
-        }
-
-        // All other cases will map to T, with TT and TD being treated
-        // like T.
-        metaphone.append("T");
-
-        if (posPlusOne == 'T' || posPlusOne == 'D')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'V':
-        // 'V' will always be mapped to 'F', with VV treated like V.
-        metaphone.append("F");
-
-        if (valueString.charAt(pos + 1) == 'V')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'W':
-        // WR should always map to R.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'R')
-        {
-          metaphone.append("R");
-          pos += 2;
-          break;
-        }
-
-        // W[AEIOUYH] at the beginning of the word should be mapped to
-        // A.
-        if (pos == 0 && (isVowel(posPlusOne) || posPlusOne == 'H'))
-        {
-          metaphone.append("A");
-
-          // FIXME -- This isn't in the algorithm as written. Should it
-          // be?
-          pos += 2;
-          break;
-        }
-
-        // A Polish value like WICZ or WITZ should be mapped to TS.
-        if (hasSubstring(valueString, pos + 1, "WICZ")
-            || hasSubstring(valueString, pos + 1, "WITZ"))
-        {
-          metaphone.append("TS");
-          pos += 4;
-          break;
-        }
-
-        // Otherwise, we'll just skip it.
-        pos++;
-        break;
-
-      case 'X':
-        // X maps to KS except at the end of French words.
-        if (!(pos == last && (hasSubstring(valueString, pos - 3, "IAU")
-            || hasSubstring(valueString, pos - 3, "EAU")
-            || hasSubstring(valueString, pos - 2, "AU") || hasSubstring(
-            valueString, pos - 2, "OU"))))
-        {
-          metaphone.append("KS");
-        }
-
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'C'
-            || posPlusOne == 'X')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case 'Z':
-        // Chinese usages like zhao will map to J.
-        if ((posPlusOne = valueString.charAt(pos + 1)) == 'H')
-        {
-          metaphone.append("J");
-          pos += 2;
-          break;
-        }
-
-        // All other cases map to "S". ZZ will be treated like Z.
-        metaphone.append("S");
-
-        if (posPlusOne == 'Z')
-        {
-          pos++;
-        }
-
-        pos++;
-        break;
-
-      case '\u00C7': // C with a cedilla
-        // This will always be mapped to 'S'.
-        metaphone.append("S");
-        pos++;
-        break;
-
-      case '\u00D1': // N with a tilde
-        // This will always be mapped to 'N'.
-        metaphone.append("N");
-        pos++;
-        break;
-
-      default:
-        // We don't have any special treatment for this character, so
-        // skip it.
-        pos++;
-        break;
-      }
     }
-
-    return ByteString.valueOf(metaphone.toString());
-  }
-
-
-
-  /**
-   * Indicates whether the provided value has the given substring at the
-   * specified position.
-   *
-   * @param value
-   *          The value containing the range for which to make the
-   *          determination.
-   * @param start
-   *          The position in the value at which to start the comparison.
-   * @param substring
-   *          The substring to compare against the specified value range.
-   * @return <CODE>true</CODE> if the specified portion of the value matches the
-   *         given substring, or <CODE>false</CODE> if it does not.
-   */
-  private boolean hasSubstring(final String value, final int start,
-      final String substring)
-  {
-    try
-    {
-      // This can happen since a lot of the rules "look behind" and
-      // rightfully don't check if it's the first character
-      if (start < 0)
-      {
-        return false;
-      }
-
-      final int end = start + substring.length();
-
-      // value isn't big enough to do the comparison
-      if (end > value.length())
-      {
-        return false;
-      }
-
-      for (int i = 0, pos = start; pos < end; i++, pos++)
-      {
-        if (value.charAt(pos) != substring.charAt(i))
-        {
-          return false;
-        }
-      }
-
-      return true;
-    }
-    catch (final Exception e)
-    {
-      StaticUtils.DEBUG_LOG.throwing("DoubleMetaphoneApproximateMatchingRule",
-          "hasSubstring", e);
-
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Indicates whether the provided string appears Germanic (starts with "VAN ",
-   * "VON ", or "SCH").
-   *
-   * @param s
-   *          The string for which to make the determination.
-   * @return <CODE>true</CODE> if the provided string appears Germanic, or
-   *         <CODE>false</CODE> if not.
-   */
-  private boolean isGermanic(final String s)
-  {
-    return s.startsWith("VAN ") || s.startsWith("VON ") || s.startsWith("SCH");
-  }
-
-
-
-  /**
-   * Indicates whether the provided string appears to be Slavo-Germanic.
-   *
-   * @param s
-   *          The string for which to make the determination.
-   * @return <CODE>true</CODE> if the provided string appears to be
-   *         Slavo-Germanic, or <CODE>false</CODE> if not.
-   */
-  private boolean isSlavoGermanic(final String s)
-  {
-    return s.contains("W") || s.contains("K") || s.contains("CZ")
-        || s.contains("WITZ");
-  }
-
-
-
-  /**
-   * Indicates whether the provided character is a vowel (including "Y").
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided character is a vowel, or
-   *         <CODE>false</CODE> if not.
-   */
-  private boolean isVowel(final char c)
-  {
-    switch (c)
-    {
-    case 'A':
-    case 'E':
-    case 'I':
-    case 'O':
-    case 'U':
-    case 'Y':
-      return true;
-
-    default:
-      return false;
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java
index 22add85..219a28b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
@@ -42,143 +39,109 @@
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the enhanced guide attribute syntax, which may be used
  * to provide criteria for generating search filters for entries of a given
  * objectclass.
  */
-final class EnhancedGuideSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_ENHANCED_GUIDE_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get a lowercase string version of the provided value.
-    final String valueStr = toLowerCase(value.toString());
-
-    // Find the position of the first octothorpe. It should denote the
-    // end of the objectclass.
-    final int sharpPos = valueStr.indexOf('#');
-    if (sharpPos < 0)
-    {
-
-      invalidReason
-          .append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SHARP1.get(valueStr));
-      return false;
+final class EnhancedGuideSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
     }
 
-    // Get the objectclass and see if it is a valid name or OID.
-    final String ocName = valueStr.substring(0, sharpPos).trim();
-    final int ocLength = ocName.length();
-    if (ocLength == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_OC1.get(valueStr));
-      return false;
+    public String getName() {
+        return SYNTAX_ENHANCED_GUIDE_NAME;
     }
 
-    try
-    {
-      SchemaUtils.readOID(new SubstringReader(ocName.substring(ocLength)),
-          schema.allowMalformedNamesAndOptions());
-    }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
     }
 
-    // Find the last octothorpe and make sure it is followed by a valid
-    // scope.
-    final int lastSharpPos = valueStr.lastIndexOf('#');
-    if (lastSharpPos == sharpPos)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_FINAL_SHARP
-          .get(valueStr));
-      return false;
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    final String scopeStr = valueStr.substring(lastSharpPos + 1).trim();
-    if (!(scopeStr.equals("baseobject") || scopeStr.equals("onelevel")
-        || scopeStr.equals("wholesubtree") || scopeStr
-        .equals("subordinatesubtree")))
-    {
-      if (scopeStr.length() == 0)
-      {
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get a lowercase string version of the provided value.
+        final String valueStr = toLowerCase(value.toString());
 
-        invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SCOPE
-            .get(valueStr));
-      }
-      else
-      {
+        // Find the position of the first octothorpe. It should denote the
+        // end of the objectclass.
+        final int sharpPos = valueStr.indexOf('#');
+        if (sharpPos < 0) {
 
-        invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_INVALID_SCOPE.get(
-            valueStr, scopeStr));
-      }
+            invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SHARP1.get(valueStr));
+            return false;
+        }
 
-      return false;
+        // Get the objectclass and see if it is a valid name or OID.
+        final String ocName = valueStr.substring(0, sharpPos).trim();
+        final int ocLength = ocName.length();
+        if (ocLength == 0) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_OC1.get(valueStr));
+            return false;
+        }
+
+        try {
+            SchemaUtils.readOID(new SubstringReader(ocName.substring(ocLength)), schema
+                    .allowMalformedNamesAndOptions());
+        } catch (final DecodeException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
+
+        // Find the last octothorpe and make sure it is followed by a valid
+        // scope.
+        final int lastSharpPos = valueStr.lastIndexOf('#');
+        if (lastSharpPos == sharpPos) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_FINAL_SHARP.get(valueStr));
+            return false;
+        }
+
+        final String scopeStr = valueStr.substring(lastSharpPos + 1).trim();
+        if (!(scopeStr.equals("baseobject") || scopeStr.equals("onelevel")
+                || scopeStr.equals("wholesubtree") || scopeStr.equals("subordinatesubtree"))) {
+            if (scopeStr.length() == 0) {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SCOPE.get(valueStr));
+            } else {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_INVALID_SCOPE.get(valueStr,
+                        scopeStr));
+            }
+
+            return false;
+        }
+
+        // Everything between the two octothorpes must be the criteria. Make
+        // sure it is valid.
+        final String criteria = valueStr.substring(sharpPos + 1, lastSharpPos).trim();
+        final int criteriaLength = criteria.length();
+        if (criteriaLength == 0) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_CRITERIA.get(valueStr));
+            return false;
+        }
+
+        return GuideSyntaxImpl.criteriaIsValid(schema, criteria, valueStr, invalidReason);
     }
-
-    // Everything between the two octothorpes must be the criteria. Make
-    // sure it is valid.
-    final String criteria = valueStr.substring(sharpPos + 1, lastSharpPos)
-        .trim();
-    final int criteriaLength = criteria.length();
-    if (criteriaLength == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_CRITERIA
-          .get(valueStr));
-      return false;
-    }
-
-    return GuideSyntaxImpl.criteriaIsValid(schema, criteria,
-        valueStr, invalidReason);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java
index a1c8d65..3d7d7e3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE;
 
 import org.forgerock.opendj.ldap.ByteSequence;
@@ -36,38 +33,27 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class is the ordering matching rule implementation for an enum syntax
  * implmentation. The ordering is determined by the order of the entries in the
  * X-ENUM extension value.
  */
-final class EnumOrderingMatchingRule extends AbstractOrderingMatchingRuleImpl
-{
-  private final EnumSyntaxImpl syntax;
+final class EnumOrderingMatchingRule extends AbstractOrderingMatchingRuleImpl {
+    private final EnumSyntaxImpl syntax;
 
-
-
-  EnumOrderingMatchingRule(final EnumSyntaxImpl syntax)
-  {
-    Validator.ensureNotNull(syntax);
-    this.syntax = syntax;
-  }
-
-
-
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final int index = syntax.indexOf(value);
-    if (index < 0)
-    {
-      throw DecodeException
-          .error(WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE.get(value
-              .toString(), syntax.getName()));
+    EnumOrderingMatchingRule(final EnumSyntaxImpl syntax) {
+        Validator.ensureNotNull(syntax);
+        this.syntax = syntax;
     }
-    return ByteString.valueOf(index);
-  }
+
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final int index = syntax.indexOf(value);
+        if (index < 0) {
+            throw DecodeException.error(WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE.get(value
+                    .toString(), syntax.getName()));
+        }
+        return ByteString.valueOf(index);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java
index 88e5953..681388f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -49,144 +46,101 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class provides an enumeration-based mechanism where a new syntax and its
  * corresponding matching rules can be created on-the-fly. An enum syntax is an
  * LDAPSyntaxDescriptionSyntax with X-ENUM extension.
  */
-final class EnumSyntaxImpl extends AbstractSyntaxImpl
-{
-  private final String oid;
-  // Set of read-only enum entries.
-  private final List<String> entries;
+final class EnumSyntaxImpl extends AbstractSyntaxImpl {
+    private final String oid;
+    // Set of read-only enum entries.
+    private final List<String> entries;
 
+    EnumSyntaxImpl(final String oid, final List<String> entries) {
+        Validator.ensureNotNull(oid, entries);
+        this.oid = oid;
+        final List<String> entryStrings = new ArrayList<String>(entries.size());
 
-
-  EnumSyntaxImpl(final String oid, final List<String> entries)
-  {
-    Validator.ensureNotNull(oid, entries);
-    this.oid = oid;
-    final List<String> entryStrings = new ArrayList<String>(entries.size());
-
-    for (final String entry : entries)
-    {
-      final String normalized = normalize(ByteString.valueOf(entry));
-      if (!entryStrings.contains(normalized))
-      {
-        entryStrings.add(normalized);
-      }
-    }
-    this.entries = Collections.unmodifiableList(entryStrings);
-  }
-
-
-
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return oid;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OID_GENERIC_ENUM + "." + oid;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public int indexOf(final ByteSequence value)
-  {
-    return entries.indexOf(normalize(value));
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // The value is acceptable if it belongs to the set.
-    final boolean isAllowed = entries.contains(normalize(value));
-
-    if (!isAllowed)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE
-          .get(value.toString(), oid);
-      invalidReason.append(message);
-    }
-
-    return isAllowed;
-  }
-
-
-
-  private String normalize(final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return " ";
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return "";
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        for (final String entry : entries) {
+            final String normalized = normalize(ByteString.valueOf(entry));
+            if (!entryStrings.contains(normalized)) {
+                entryStrings.add(normalized);
+            }
         }
-      }
+        this.entries = Collections.unmodifiableList(entryStrings);
     }
 
-    return buffer.toString();
-  }
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
+    }
+
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
+
+    public String getName() {
+        return oid;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OID_GENERIC_ENUM + "." + oid;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public int indexOf(final ByteSequence value) {
+        return entries.indexOf(normalize(value));
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // The value is acceptable if it belongs to the set.
+        final boolean isAllowed = entries.contains(normalize(value));
+
+        if (!isAllowed) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_INVALID_VALUE.get(value.toString(), oid);
+            invalidReason.append(message);
+        }
+
+        return isAllowed;
+    }
+
+    private String normalize(final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return " ";
+            } else {
+                // The value is empty, so it is already normalized.
+                return "";
+            }
+        }
+
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return buffer.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EqualLengthApproximateMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EqualLengthApproximateMatchingRuleImpl.java
index 0a061bc..7659372 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EqualLengthApproximateMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/EqualLengthApproximateMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,42 +25,33 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 /**
  * This class implements an extremely simple approximate matching rule that will
  * consider two values approximately equal only if they have the same length. It
  * is intended purely for testing purposes.
  */
-final class EqualLengthApproximateMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        return attributeValue.length() == value.length() ? ConditionResult.TRUE
-            : ConditionResult.FALSE;
-      }
-    };
-  }
+final class EqualLengthApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                return attributeValue.length() == value.length() ? ConditionResult.TRUE
+                        : ConditionResult.FALSE;
+            }
+        };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return value.toByteString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return value.toByteString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java
index 5369e5c..81ebb4c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_FAXNUMBER_EMPTY;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_FAXNUMBER_END_WITH_DOLLAR;
@@ -44,8 +41,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the facsimile telephone number attribute syntax, which
  * contains a printable string (the number) followed by zero or more parameters.
@@ -61,178 +56,141 @@
  * <LI>uncompressed</LI>
  * </UL>
  */
-final class FacsimileNumberSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * The set of allowed fax parameter values, formatted entirely in lowercase
-   * characters.
-   */
-  public static final HashSet<String> ALLOWED_FAX_PARAMETERS = new HashSet<String>(
-      7);
+final class FacsimileNumberSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * The set of allowed fax parameter values, formatted entirely in lowercase
+     * characters.
+     */
+    public static final HashSet<String> ALLOWED_FAX_PARAMETERS = new HashSet<String>(7);
 
-  static
-  {
-    ALLOWED_FAX_PARAMETERS.add("twodimensional");
-    ALLOWED_FAX_PARAMETERS.add("fineresolution");
-    ALLOWED_FAX_PARAMETERS.add("unlimitedlength");
-    ALLOWED_FAX_PARAMETERS.add("b4length");
-    ALLOWED_FAX_PARAMETERS.add("a3width");
-    ALLOWED_FAX_PARAMETERS.add("b4width");
-    ALLOWED_FAX_PARAMETERS.add("uncompressed");
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_FAXNUMBER_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get a lowercase string representation of the value and find its
-    // length.
-    final String valueString = toLowerCase(value.toString());
-    final int valueLength = valueString.length();
-
-    // The value must contain at least one character.
-    if (valueLength == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_EMPTY.get());
-      return false;
+    static {
+        ALLOWED_FAX_PARAMETERS.add("twodimensional");
+        ALLOWED_FAX_PARAMETERS.add("fineresolution");
+        ALLOWED_FAX_PARAMETERS.add("unlimitedlength");
+        ALLOWED_FAX_PARAMETERS.add("b4length");
+        ALLOWED_FAX_PARAMETERS.add("a3width");
+        ALLOWED_FAX_PARAMETERS.add("b4width");
+        ALLOWED_FAX_PARAMETERS.add("uncompressed");
     }
 
-    // The first character must be a printable string character.
-    char c = valueString.charAt(0);
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_NOT_PRINTABLE.get(
-          valueString, String.valueOf(c), 0));
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
 
-    // Continue reading until we find a dollar sign or the end of the
-    // string. Every intermediate character must be a printable string
-    // character.
-    int pos = 1;
-    for (; pos < valueLength; pos++)
-    {
-      c = valueString.charAt(pos);
-      if (c == '$')
-      {
-        pos++;
-        break;
-      }
-      else
-      {
-        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-        {
-
-          invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_NOT_PRINTABLE.get(
-              valueString, String.valueOf(c), pos));
-        }
-      }
+    public String getName() {
+        return SYNTAX_FAXNUMBER_NAME;
     }
 
-    if (pos >= valueLength)
-    {
-      // We're at the end of the value, so it must be valid unless the
-      // last character was a dollar sign.
-      if (c == '$')
-      {
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
 
-        invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_END_WITH_DOLLAR
-            .get(valueString));
-        return false;
-      }
-      else
-      {
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
         return true;
-      }
     }
 
-    // Continue reading until we find the end of the string. Each
-    // substring must be a valid fax parameter.
-    int paramStartPos = pos;
-    while (pos < valueLength)
-    {
-      c = valueString.charAt(pos++);
-      if (c == '$')
-      {
-        final String paramStr = valueString.substring(paramStartPos, pos);
-        if (!ALLOWED_FAX_PARAMETERS.contains(paramStr))
-        {
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get a lowercase string representation of the value and find its
+        // length.
+        final String valueString = toLowerCase(value.toString());
+        final int valueLength = valueString.length();
 
-          invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_ILLEGAL_PARAMETER.get(
-              valueString, paramStr, paramStartPos, (pos - 1)));
-          return false;
+        // The value must contain at least one character.
+        if (valueLength == 0) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_EMPTY.get());
+            return false;
         }
 
-        paramStartPos = pos;
-      }
-    }
+        // The first character must be a printable string character.
+        char c = valueString.charAt(0);
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
 
-    // We must be at the end of the value. Read the last parameter and
-    // make sure it is valid.
-    final String paramStr = valueString.substring(paramStartPos);
-    if (!ALLOWED_FAX_PARAMETERS.contains(paramStr))
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_ILLEGAL_PARAMETER.get(
-          valueString, paramStr, paramStartPos, (pos - 1)));
-      return false;
-    }
+            invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_NOT_PRINTABLE.get(valueString, String
+                    .valueOf(c), 0));
+            return false;
+        }
 
-    // If we've gotten here, then the value must be valid.
-    return true;
-  }
+        // Continue reading until we find a dollar sign or the end of the
+        // string. Every intermediate character must be a printable string
+        // character.
+        int pos = 1;
+        for (; pos < valueLength; pos++) {
+            c = valueString.charAt(pos);
+            if (c == '$') {
+                pos++;
+                break;
+            } else {
+                if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_NOT_PRINTABLE.get(valueString,
+                            String.valueOf(c), pos));
+                }
+            }
+        }
+
+        if (pos >= valueLength) {
+            // We're at the end of the value, so it must be valid unless the
+            // last character was a dollar sign.
+            if (c == '$') {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_END_WITH_DOLLAR.get(valueString));
+                return false;
+            } else {
+                return true;
+            }
+        }
+
+        // Continue reading until we find the end of the string. Each
+        // substring must be a valid fax parameter.
+        int paramStartPos = pos;
+        while (pos < valueLength) {
+            c = valueString.charAt(pos++);
+            if (c == '$') {
+                final String paramStr = valueString.substring(paramStartPos, pos);
+                if (!ALLOWED_FAX_PARAMETERS.contains(paramStr)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_ILLEGAL_PARAMETER.get(
+                            valueString, paramStr, paramStartPos, (pos - 1)));
+                    return false;
+                }
+
+                paramStartPos = pos;
+            }
+        }
+
+        // We must be at the end of the value. Read the last parameter and
+        // make sure it is valid.
+        final String paramStr = valueString.substring(paramStartPos);
+        if (!ALLOWED_FAX_PARAMETERS.contains(paramStr)) {
+            invalidReason.append(ERR_ATTR_SYNTAX_FAXNUMBER_ILLEGAL_PARAMETER.get(valueString,
+                    paramStr, paramStartPos, (pos - 1)));
+            return false;
+        }
+
+        // If we've gotten here, then the value must be valid.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java
index 646c1a7..58460c3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_FAX_NAME;
@@ -36,64 +33,48 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the fax attribute syntax. This should be restricted to
  * holding only fax message contents, but we will accept any set of bytes. It
  * will be treated much like the octet string attribute syntax.
  */
-final class FaxSyntaxImpl extends AbstractSyntaxImpl
-{
+final class FaxSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_FAX_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_FAX_NAME;
-  }
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the fax syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the fax syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java
index 2fa2c49..6ff75c1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,25 +25,17 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the generalizedTimeMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-final class GeneralizedTimeEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return ByteString.valueOf(GeneralizedTimeSyntaxImpl
-        .decodeGeneralizedTimeValue(value));
-  }
+final class GeneralizedTimeEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return ByteString.valueOf(GeneralizedTimeSyntaxImpl.decodeGeneralizedTimeValue(value));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java
index 24d8b45..fba9ef9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,25 +25,17 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the generalizedTimeOrderingMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-final class GeneralizedTimeOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    return ByteString.valueOf(GeneralizedTimeSyntaxImpl
-        .decodeGeneralizedTimeValue(value));
-  }
+final class GeneralizedTimeOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        return ByteString.valueOf(GeneralizedTimeSyntaxImpl.decodeGeneralizedTimeValue(value));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java
index 92ab76e..d72bed1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
@@ -43,1369 +40,1256 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class implements the fax attribute syntax. This should be restricted to
  * holding only fax message contents, but we will accept any set of bytes. It
  * will be treated much like the octet string attribute syntax.
  */
-final class GeneralizedTimeSyntaxImpl extends AbstractSyntaxImpl
-{
+final class GeneralizedTimeSyntaxImpl extends AbstractSyntaxImpl {
 
-  // UTC TimeZone is assumed to never change over JVM lifetime
-  private static final TimeZone TIME_ZONE_UTC_OBJ = TimeZone
-      .getTimeZone(TIME_ZONE_UTC);
+    // UTC TimeZone is assumed to never change over JVM lifetime
+    private static final TimeZone TIME_ZONE_UTC_OBJ = TimeZone.getTimeZone(TIME_ZONE_UTC);
 
+    /**
+     * Decodes the provided normalized value as a generalized time value and
+     * retrieves a timestamp containing its representation.
+     *
+     * @param value
+     *            The normalized value to decode using the generalized time
+     *            syntax.
+     * @return The timestamp created from the provided generalized time value.
+     * @throws DecodeException
+     *             If the provided value cannot be parsed as a valid generalized
+     *             time string.
+     */
+    static long decodeGeneralizedTimeValue(final ByteSequence value) throws DecodeException {
+        int year = 0;
+        int month = 0;
+        int day = 0;
+        int hour = 0;
+        int minute = 0;
+        int second = 0;
 
-
-  /**
-   * Decodes the provided normalized value as a generalized time value and
-   * retrieves a timestamp containing its representation.
-   *
-   * @param value
-   *          The normalized value to decode using the generalized time syntax.
-   * @return The timestamp created from the provided generalized time value.
-   * @throws DecodeException
-   *           If the provided value cannot be parsed as a valid generalized
-   *           time string.
-   */
-  static long decodeGeneralizedTimeValue(final ByteSequence value)
-      throws DecodeException
-  {
-    int year = 0;
-    int month = 0;
-    int day = 0;
-    int hour = 0;
-    int minute = 0;
-    int second = 0;
-
-    // Get the value as a string and verify that it is at least long
-    // enough for "YYYYMMDDhhZ", which is the shortest allowed value.
-    final String valueString = value.toString().toUpperCase();
-    final int length = valueString.length();
-    if (length < 11)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_TOO_SHORT
-          .get(valueString);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // The first four characters are the century and year, and they must
-    // be numeric digits between 0 and 9.
-    for (int i = 0; i < 4; i++)
-    {
-      switch (valueString.charAt(i))
-      {
-      case '0':
-        year = year * 10;
-        break;
-
-      case '1':
-        year = year * 10 + 1;
-        break;
-
-      case '2':
-        year = year * 10 + 2;
-        break;
-
-      case '3':
-        year = year * 10 + 3;
-        break;
-
-      case '4':
-        year = year * 10 + 4;
-        break;
-
-      case '5':
-        year = year * 10 + 5;
-        break;
-
-      case '6':
-        year = year * 10 + 6;
-        break;
-
-      case '7':
-        year = year * 10 + 7;
-        break;
-
-      case '8':
-        year = year * 10 + 8;
-        break;
-
-      case '9':
-        year = year * 10 + 9;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_YEAR
-            .get(valueString, String.valueOf(valueString.charAt(i)));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-    }
-
-    // The next two characters are the month, and they must form the
-    // string representation of an integer between 01 and 12.
-    char m1 = valueString.charAt(4);
-    final char m2 = valueString.charAt(5);
-    switch (m1)
-    {
-    case '0':
-      // m2 must be a digit between 1 and 9.
-      switch (m2)
-      {
-      case '1':
-        month = Calendar.JANUARY;
-        break;
-
-      case '2':
-        month = Calendar.FEBRUARY;
-        break;
-
-      case '3':
-        month = Calendar.MARCH;
-        break;
-
-      case '4':
-        month = Calendar.APRIL;
-        break;
-
-      case '5':
-        month = Calendar.MAY;
-        break;
-
-      case '6':
-        month = Calendar.JUNE;
-        break;
-
-      case '7':
-        month = Calendar.JULY;
-        break;
-
-      case '8':
-        month = Calendar.AUGUST;
-        break;
-
-      case '9':
-        month = Calendar.SEPTEMBER;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH
-            .get(valueString, valueString.substring(4, 6));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-    case '1':
-      // m2 must be a digit between 0 and 2.
-      switch (m2)
-      {
-      case '0':
-        month = Calendar.OCTOBER;
-        break;
-
-      case '1':
-        month = Calendar.NOVEMBER;
-        break;
-
-      case '2':
-        month = Calendar.DECEMBER;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH
-            .get(valueString, valueString.substring(4, 6));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH
-          .get(valueString, valueString.substring(4, 6));
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // The next two characters should be the day of the month, and they
-    // must form the string representation of an integer between 01 and
-    // 31. This doesn't do any validation against the year or month, so
-    // it will allow dates like April 31, or February 29 in a non-leap
-    // year, but we'll let those slide.
-    final char d1 = valueString.charAt(6);
-    final char d2 = valueString.charAt(7);
-    switch (d1)
-    {
-    case '0':
-      // d2 must be a digit between 1 and 9.
-      switch (d2)
-      {
-      case '1':
-        day = 1;
-        break;
-
-      case '2':
-        day = 2;
-        break;
-
-      case '3':
-        day = 3;
-        break;
-
-      case '4':
-        day = 4;
-        break;
-
-      case '5':
-        day = 5;
-        break;
-
-      case '6':
-        day = 6;
-        break;
-
-      case '7':
-        day = 7;
-        break;
-
-      case '8':
-        day = 8;
-        break;
-
-      case '9':
-        day = 9;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(6, 8));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    case '1':
-      // d2 must be a digit between 0 and 9.
-      switch (d2)
-      {
-      case '0':
-        day = 10;
-        break;
-
-      case '1':
-        day = 11;
-        break;
-
-      case '2':
-        day = 12;
-        break;
-
-      case '3':
-        day = 13;
-        break;
-
-      case '4':
-        day = 14;
-        break;
-
-      case '5':
-        day = 15;
-        break;
-
-      case '6':
-        day = 16;
-        break;
-
-      case '7':
-        day = 17;
-        break;
-
-      case '8':
-        day = 18;
-        break;
-
-      case '9':
-        day = 19;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(6, 8));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    case '2':
-      // d2 must be a digit between 0 and 9.
-      switch (d2)
-      {
-      case '0':
-        day = 20;
-        break;
-
-      case '1':
-        day = 21;
-        break;
-
-      case '2':
-        day = 22;
-        break;
-
-      case '3':
-        day = 23;
-        break;
-
-      case '4':
-        day = 24;
-        break;
-
-      case '5':
-        day = 25;
-        break;
-
-      case '6':
-        day = 26;
-        break;
-
-      case '7':
-        day = 27;
-        break;
-
-      case '8':
-        day = 28;
-        break;
-
-      case '9':
-        day = 29;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(6, 8));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    case '3':
-      // d2 must be either 0 or 1.
-      switch (d2)
-      {
-      case '0':
-        day = 30;
-        break;
-
-      case '1':
-        day = 31;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(6, 8));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY
-          .get(valueString, valueString.substring(6, 8));
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // The next two characters must be the hour, and they must form the
-    // string representation of an integer between 00 and 23.
-    final char h1 = valueString.charAt(8);
-    final char h2 = valueString.charAt(9);
-    switch (h1)
-    {
-    case '0':
-      switch (h2)
-      {
-      case '0':
-        hour = 0;
-        break;
-
-      case '1':
-        hour = 1;
-        break;
-
-      case '2':
-        hour = 2;
-        break;
-
-      case '3':
-        hour = 3;
-        break;
-
-      case '4':
-        hour = 4;
-        break;
-
-      case '5':
-        hour = 5;
-        break;
-
-      case '6':
-        hour = 6;
-        break;
-
-      case '7':
-        hour = 7;
-        break;
-
-      case '8':
-        hour = 8;
-        break;
-
-      case '9':
-        hour = 9;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR
-            .get(valueString, valueString.substring(8, 10));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    case '1':
-      switch (h2)
-      {
-      case '0':
-        hour = 10;
-        break;
-
-      case '1':
-        hour = 11;
-        break;
-
-      case '2':
-        hour = 12;
-        break;
-
-      case '3':
-        hour = 13;
-        break;
-
-      case '4':
-        hour = 14;
-        break;
-
-      case '5':
-        hour = 15;
-        break;
-
-      case '6':
-        hour = 16;
-        break;
-
-      case '7':
-        hour = 17;
-        break;
-
-      case '8':
-        hour = 18;
-        break;
-
-      case '9':
-        hour = 19;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR
-            .get(valueString, valueString.substring(8, 10));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    case '2':
-      switch (h2)
-      {
-      case '0':
-        hour = 20;
-        break;
-
-      case '1':
-        hour = 21;
-        break;
-
-      case '2':
-        hour = 22;
-        break;
-
-      case '3':
-        hour = 23;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR
-            .get(valueString, valueString.substring(8, 10));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      break;
-
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR
-          .get(valueString, valueString.substring(8, 10));
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // Next, there should be either two digits comprising an integer
-    // between 00 and 59 (for the minute), a letter 'Z' (for the UTC
-    // specifier), a plus or minus sign followed by two or four digits
-    // (for the UTC offset), or a period or comma representing the
-    // fraction.
-    m1 = valueString.charAt(10);
-    switch (m1)
-    {
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-      // There must be at least two more characters, and the next one
-      // must be a digit between 0 and 9.
-      if (length < 13)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(m1), 10);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      minute = 10 * (m1 - '0');
-
-      switch (valueString.charAt(11))
-      {
-      case '0':
-        break;
-
-      case '1':
-        minute += 1;
-        break;
-
-      case '2':
-        minute += 2;
-        break;
-
-      case '3':
-        minute += 3;
-        break;
-
-      case '4':
-        minute += 4;
-        break;
-
-      case '5':
-        minute += 5;
-        break;
-
-      case '6':
-        minute += 6;
-        break;
-
-      case '7':
-        minute += 7;
-        break;
-
-      case '8':
-        minute += 8;
-        break;
-
-      case '9':
-        minute += 9;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MINUTE
-            .get(valueString, valueString.substring(10, 12));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      break;
-
-    case 'Z':
-      // This is fine only if we are at the end of the value.
-      if (length == 11)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(m1), 10);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    case '+':
-    case '-':
-      // These are fine only if there are exactly two or four more
-      // digits that specify a valid offset.
-      if (length == 13 || length == 15)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(getTimeZoneForOffset(valueString, 10));
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(m1), 10);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    case '.':
-    case ',':
-      return finishDecodingFraction(valueString, 11, year, month, day, hour,
-          minute, second, 3600000);
-
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(m1), 10);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // Next, there should be either two digits comprising an integer
-    // between 00 and 60 (for the second, including a possible leap
-    // second), a letter 'Z' (for the UTC specifier), a plus or minus
-    // sign followed by two or four digits (for the UTC offset), or a
-    // period or comma to start the fraction.
-    final char s1 = valueString.charAt(12);
-    switch (s1)
-    {
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-      // There must be at least two more characters, and the next one
-      // must be a digit between 0 and 9.
-      if (length < 15)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 12);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      second = 10 * (s1 - '0');
-
-      switch (valueString.charAt(13))
-      {
-      case '0':
-        break;
-
-      case '1':
-        second += 1;
-        break;
-
-      case '2':
-        second += 2;
-        break;
-
-      case '3':
-        second += 3;
-        break;
-
-      case '4':
-        second += 4;
-        break;
-
-      case '5':
-        second += 5;
-        break;
-
-      case '6':
-        second += 6;
-        break;
-
-      case '7':
-        second += 7;
-        break;
-
-      case '8':
-        second += 8;
-        break;
-
-      case '9':
-        second += 9;
-        break;
-
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MINUTE
-            .get(valueString, valueString.substring(12, 14));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      break;
-
-    case '6':
-      // There must be at least two more characters and the next one
-      // must be a 0.
-      if (length < 15)
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 12);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      if (valueString.charAt(13) != '0')
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_SECOND
-            .get(valueString, valueString.substring(12, 14));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      second = 60;
-      break;
-
-    case 'Z':
-      // This is fine only if we are at the end of the value.
-      if (length == 13)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 12);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    case '+':
-    case '-':
-      // These are fine only if there are exactly two or four more
-      // digits that specify a valid offset.
-      if (length == 15 || length == 17)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(getTimeZoneForOffset(valueString, 12));
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 12);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    case '.':
-    case ',':
-      return finishDecodingFraction(valueString, 13, year, month, day, hour,
-          minute, second, 60000);
-
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(s1), 12);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-
-    // Next, there should be either a period or comma followed by
-    // between one and three digits (to specify the sub-second), a
-    // letter 'Z' (for the UTC specifier), or a plus or minus sign
-    // followed by two our four digits (for the UTC offset).
-    switch (valueString.charAt(14))
-    {
-    case '.':
-    case ',':
-      return finishDecodingFraction(valueString, 15, year, month, day, hour,
-          minute, second, 1000);
-
-    case 'Z':
-      // This is fine only if we are at the end of the value.
-      if (length == 15)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(valueString.charAt(14)), 14);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    case '+':
-    case '-':
-      // These are fine only if there are exactly two or four more
-      // digits that specify a valid offset.
-      if (length == 17 || length == 19)
-      {
-        try
-        {
-          final GregorianCalendar calendar = new GregorianCalendar();
-          calendar.setLenient(false);
-          calendar.setTimeZone(getTimeZoneForOffset(valueString, 14));
-          calendar.set(year, month, day, hour, minute, second);
-          calendar.set(Calendar.MILLISECOND, 0);
-          return calendar.getTimeInMillis();
-        }
-        catch (final Exception e)
-        {
-          // This should only happen if the provided date wasn't legal
-          // (e.g., September 31).
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-              .get(valueString, String.valueOf(e));
-          final DecodeException de = DecodeException.error(message, e);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "valueIsAcceptable", de);
-          throw de;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(valueString.charAt(14)), 14);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(valueString.charAt(14)), 14);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", e);
-      throw e;
-    }
-  }
-
-
-
-  /**
-   * Completes decoding the generalized time value containing a fractional
-   * component. It will also decode the trailing 'Z' or offset.
-   *
-   * @param value
-   *          The whole value, including the fractional component and time zone
-   *          information.
-   * @param startPos
-   *          The position of the first character after the period in the value
-   *          string.
-   * @param year
-   *          The year decoded from the provided value.
-   * @param month
-   *          The month decoded from the provided value.
-   * @param day
-   *          The day decoded from the provided value.
-   * @param hour
-   *          The hour decoded from the provided value.
-   * @param minute
-   *          The minute decoded from the provided value.
-   * @param second
-   *          The second decoded from the provided value.
-   * @param multiplier
-   *          The multiplier value that should be used to scale the fraction
-   *          appropriately. If it's a fraction of an hour, then it should be
-   *          3600000 (60*60*1000). If it's a fraction of a minute, then it
-   *          should be 60000. If it's a fraction of a second, then it should be
-   *          1000.
-   * @return The timestamp created from the provided generalized time value
-   *         including the fractional element.
-   * @throws DecodeException
-   *           If the provided value cannot be parsed as a valid generalized
-   *           time string.
-   */
-  private static long finishDecodingFraction(final String value,
-      final int startPos, final int year, final int month, final int day,
-      final int hour, final int minute, final int second, final int multiplier)
-      throws DecodeException
-  {
-    final int length = value.length();
-    final StringBuilder fractionBuffer = new StringBuilder(2 + length
-        - startPos);
-    fractionBuffer.append("0.");
-
-    TimeZone timeZone = null;
-
-    outerLoop: for (int i = startPos; i < length; i++)
-    {
-      final char c = value.charAt(i);
-      switch (c)
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        fractionBuffer.append(c);
-        break;
-
-      case 'Z':
-        // This is only acceptable if we're at the end of the value.
-        if (i != value.length() - 1)
-        {
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR
-              .get(value, String.valueOf(c));
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "finishDecodingFraction", e);
-          throw e;
+        // Get the value as a string and verify that it is at least long
+        // enough for "YYYYMMDDhhZ", which is the shortest allowed value.
+        final String valueString = value.toString().toUpperCase();
+        final int length = valueString.length();
+        if (length < 11) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_TOO_SHORT.get(valueString);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
         }
 
-        timeZone = TIME_ZONE_UTC_OBJ;
-        break outerLoop;
+        // The first four characters are the century and year, and they must
+        // be numeric digits between 0 and 9.
+        for (int i = 0; i < 4; i++) {
+            switch (valueString.charAt(i)) {
+            case '0':
+                year = year * 10;
+                break;
 
-      case '+':
-      case '-':
-        timeZone = getTimeZoneForOffset(value, i);
-        break outerLoop;
+            case '1':
+                year = year * 10 + 1;
+                break;
 
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR
-            .get(value, String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "finishDecodingFraction", e);
-        throw e;
-      }
-    }
+            case '2':
+                year = year * 10 + 2;
+                break;
 
-    if (fractionBuffer.length() == 2)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_EMPTY_FRACTION
-          .get(value);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "finishDecodingFraction", e);
-      throw e;
-    }
+            case '3':
+                year = year * 10 + 3;
+                break;
 
-    if (timeZone == null)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_NO_TIME_ZONE_INFO
-          .get(value);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "finishDecodingFraction", e);
-      throw e;
-    }
+            case '4':
+                year = year * 10 + 4;
+                break;
 
-    final Double fractionValue = Double.parseDouble(fractionBuffer.toString());
-    final long additionalMilliseconds = Math.round(fractionValue * multiplier);
+            case '5':
+                year = year * 10 + 5;
+                break;
 
-    try
-    {
-      final GregorianCalendar calendar = new GregorianCalendar();
-      calendar.setLenient(false);
-      calendar.setTimeZone(timeZone);
-      calendar.set(year, month, day, hour, minute, second);
-      calendar.set(Calendar.MILLISECOND, 0);
-      return calendar.getTimeInMillis() + additionalMilliseconds;
-    }
-    catch (final Exception e)
-    {
+            case '6':
+                year = year * 10 + 6;
+                break;
 
-      // This should only happen if the provided date wasn't legal
-      // (e.g., September 31).
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME
-          .get(value, String.valueOf(e));
-      final DecodeException de = DecodeException.error(message, e);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "valueIsAcceptable", de);
-      throw de;
-    }
-  }
+            case '7':
+                year = year * 10 + 7;
+                break;
 
+            case '8':
+                year = year * 10 + 8;
+                break;
 
+            case '9':
+                year = year * 10 + 9;
+                break;
 
-  /**
-   * Decodes a time zone offset from the provided value.
-   *
-   * @param value
-   *          The whole value, including the offset.
-   * @param startPos
-   *          The position of the first character that is contained in the
-   *          offset. This should be the position of the plus or minus
-   *          character.
-   * @return The {@code TimeZone} object representing the decoded time zone.
-   * @throws DecodeException
-   *           If the provided value does not contain a valid offset.
-   */
-  private static TimeZone getTimeZoneForOffset(final String value,
-      final int startPos) throws DecodeException
-  {
-    final String offSetStr = value.substring(startPos);
-    if (offSetStr.length() != 3 && offSetStr.length() != 5)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-          .get(value, offSetStr);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "getTimeZoneForOffset", e);
-      throw e;
-    }
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_YEAR.get(valueString, String
+                                .valueOf(valueString.charAt(i)));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+        }
 
-    // The first character must be either a plus or minus.
-    switch (offSetStr.charAt(0))
-    {
-    case '+':
-    case '-':
-      // These are OK.
-      break;
+        // The next two characters are the month, and they must form the
+        // string representation of an integer between 01 and 12.
+        char m1 = valueString.charAt(4);
+        final char m2 = valueString.charAt(5);
+        switch (m1) {
+        case '0':
+            // m2 must be a digit between 1 and 9.
+            switch (m2) {
+            case '1':
+                month = Calendar.JANUARY;
+                break;
 
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-          .get(value, offSetStr);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "getTimeZoneForOffset", e);
-      throw e;
-    }
+            case '2':
+                month = Calendar.FEBRUARY;
+                break;
 
-    // The first two characters must be an integer between 00 and 23.
-    switch (offSetStr.charAt(1))
-    {
-    case '0':
-    case '1':
-      switch (offSetStr.charAt(2))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
+            case '3':
+                month = Calendar.MARCH;
+                break;
 
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-            .get(value, offSetStr);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "getTimeZoneForOffset", e);
-        throw e;
-      }
-      break;
+            case '4':
+                month = Calendar.APRIL;
+                break;
 
-    case '2':
-      switch (offSetStr.charAt(2))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-        // These are all fine.
-        break;
+            case '5':
+                month = Calendar.MAY;
+                break;
 
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-            .get(value, offSetStr);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "getTimeZoneForOffset", e);
-        throw e;
-      }
-      break;
+            case '6':
+                month = Calendar.JUNE;
+                break;
 
-    default:
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-          .get(value, offSetStr);
-      final DecodeException e = DecodeException.error(message);
-      StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-          "getTimeZoneForOffset", e);
-      throw e;
-    }
+            case '7':
+                month = Calendar.JULY;
+                break;
 
-    // If there are two more characters, then they must be an integer
-    // between 00 and 59.
-    if (offSetStr.length() == 5)
-    {
-      switch (offSetStr.charAt(3))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-        switch (offSetStr.charAt(4))
-        {
+            case '8':
+                month = Calendar.AUGUST;
+                break;
+
+            case '9':
+                month = Calendar.SEPTEMBER;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH.get(valueString,
+                                valueString.substring(4, 6));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+        case '1':
+            // m2 must be a digit between 0 and 2.
+            switch (m2) {
+            case '0':
+                month = Calendar.OCTOBER;
+                break;
+
+            case '1':
+                month = Calendar.NOVEMBER;
+                break;
+
+            case '2':
+                month = Calendar.DECEMBER;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH.get(valueString,
+                                valueString.substring(4, 6));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MONTH.get(valueString, valueString
+                            .substring(4, 6));
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
+        }
+
+        // The next two characters should be the day of the month, and they
+        // must form the string representation of an integer between 01 and
+        // 31. This doesn't do any validation against the year or month, so
+        // it will allow dates like April 31, or February 29 in a non-leap
+        // year, but we'll let those slide.
+        final char d1 = valueString.charAt(6);
+        final char d2 = valueString.charAt(7);
+        switch (d1) {
+        case '0':
+            // d2 must be a digit between 1 and 9.
+            switch (d2) {
+            case '1':
+                day = 1;
+                break;
+
+            case '2':
+                day = 2;
+                break;
+
+            case '3':
+                day = 3;
+                break;
+
+            case '4':
+                day = 4;
+                break;
+
+            case '5':
+                day = 5;
+                break;
+
+            case '6':
+                day = 6;
+                break;
+
+            case '7':
+                day = 7;
+                break;
+
+            case '8':
+                day = 8;
+                break;
+
+            case '9':
+                day = 9;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(6, 8));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        case '1':
+            // d2 must be a digit between 0 and 9.
+            switch (d2) {
+            case '0':
+                day = 10;
+                break;
+
+            case '1':
+                day = 11;
+                break;
+
+            case '2':
+                day = 12;
+                break;
+
+            case '3':
+                day = 13;
+                break;
+
+            case '4':
+                day = 14;
+                break;
+
+            case '5':
+                day = 15;
+                break;
+
+            case '6':
+                day = 16;
+                break;
+
+            case '7':
+                day = 17;
+                break;
+
+            case '8':
+                day = 18;
+                break;
+
+            case '9':
+                day = 19;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(6, 8));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        case '2':
+            // d2 must be a digit between 0 and 9.
+            switch (d2) {
+            case '0':
+                day = 20;
+                break;
+
+            case '1':
+                day = 21;
+                break;
+
+            case '2':
+                day = 22;
+                break;
+
+            case '3':
+                day = 23;
+                break;
+
+            case '4':
+                day = 24;
+                break;
+
+            case '5':
+                day = 25;
+                break;
+
+            case '6':
+                day = 26;
+                break;
+
+            case '7':
+                day = 27;
+                break;
+
+            case '8':
+                day = 28;
+                break;
+
+            case '9':
+                day = 29;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(6, 8));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        case '3':
+            // d2 must be either 0 or 1.
+            switch (d2) {
+            case '0':
+                day = 30;
+                break;
+
+            case '1':
+                day = 31;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(6, 8));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_DAY.get(valueString, valueString
+                            .substring(6, 8));
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
+        }
+
+        // The next two characters must be the hour, and they must form the
+        // string representation of an integer between 00 and 23.
+        final char h1 = valueString.charAt(8);
+        final char h2 = valueString.charAt(9);
+        switch (h1) {
+        case '0':
+            switch (h2) {
+            case '0':
+                hour = 0;
+                break;
+
+            case '1':
+                hour = 1;
+                break;
+
+            case '2':
+                hour = 2;
+                break;
+
+            case '3':
+                hour = 3;
+                break;
+
+            case '4':
+                hour = 4;
+                break;
+
+            case '5':
+                hour = 5;
+                break;
+
+            case '6':
+                hour = 6;
+                break;
+
+            case '7':
+                hour = 7;
+                break;
+
+            case '8':
+                hour = 8;
+                break;
+
+            case '9':
+                hour = 9;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR.get(valueString, valueString
+                                .substring(8, 10));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        case '1':
+            switch (h2) {
+            case '0':
+                hour = 10;
+                break;
+
+            case '1':
+                hour = 11;
+                break;
+
+            case '2':
+                hour = 12;
+                break;
+
+            case '3':
+                hour = 13;
+                break;
+
+            case '4':
+                hour = 14;
+                break;
+
+            case '5':
+                hour = 15;
+                break;
+
+            case '6':
+                hour = 16;
+                break;
+
+            case '7':
+                hour = 17;
+                break;
+
+            case '8':
+                hour = 18;
+                break;
+
+            case '9':
+                hour = 19;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR.get(valueString, valueString
+                                .substring(8, 10));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        case '2':
+            switch (h2) {
+            case '0':
+                hour = 20;
+                break;
+
+            case '1':
+                hour = 21;
+                break;
+
+            case '2':
+                hour = 22;
+                break;
+
+            case '3':
+                hour = 23;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR.get(valueString, valueString
+                                .substring(8, 10));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            break;
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_HOUR.get(valueString, valueString
+                            .substring(8, 10));
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
+        }
+
+        // Next, there should be either two digits comprising an integer
+        // between 00 and 59 (for the minute), a letter 'Z' (for the UTC
+        // specifier), a plus or minus sign followed by two or four digits
+        // (for the UTC offset), or a period or comma representing the
+        // fraction.
+        m1 = valueString.charAt(10);
+        switch (m1) {
         case '0':
         case '1':
         case '2':
         case '3':
         case '4':
         case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-          // These are all fine.
-          break;
+            // There must be at least two more characters, and the next one
+            // must be a digit between 0 and 9.
+            if (length < 13) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(m1), 10);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            minute = 10 * (m1 - '0');
+
+            switch (valueString.charAt(11)) {
+            case '0':
+                break;
+
+            case '1':
+                minute += 1;
+                break;
+
+            case '2':
+                minute += 2;
+                break;
+
+            case '3':
+                minute += 3;
+                break;
+
+            case '4':
+                minute += 4;
+                break;
+
+            case '5':
+                minute += 5;
+                break;
+
+            case '6':
+                minute += 6;
+                break;
+
+            case '7':
+                minute += 7;
+                break;
+
+            case '8':
+                minute += 8;
+                break;
+
+            case '9':
+                minute += 9;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MINUTE.get(valueString,
+                                valueString.substring(10, 12));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            break;
+
+        case 'Z':
+            // This is fine only if we are at the end of the value.
+            if (length == 11) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(m1), 10);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        case '+':
+        case '-':
+            // These are fine only if there are exactly two or four more
+            // digits that specify a valid offset.
+            if (length == 13 || length == 15) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(getTimeZoneForOffset(valueString, 10));
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(m1), 10);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        case '.':
+        case ',':
+            return finishDecodingFraction(valueString, 11, year, month, day, hour, minute, second,
+                    3600000);
 
         default:
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-              .get(value, offSetStr);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-              "getTimeZoneForOffset", e);
-          throw e;
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                            .valueOf(m1), 10);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
         }
-        break;
 
-      default:
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET
-            .get(value, offSetStr);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
-            "getTimeZoneForOffset", e);
-        throw e;
-      }
+        // Next, there should be either two digits comprising an integer
+        // between 00 and 60 (for the second, including a possible leap
+        // second), a letter 'Z' (for the UTC specifier), a plus or minus
+        // sign followed by two or four digits (for the UTC offset), or a
+        // period or comma to start the fraction.
+        final char s1 = valueString.charAt(12);
+        switch (s1) {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+            // There must be at least two more characters, and the next one
+            // must be a digit between 0 and 9.
+            if (length < 15) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(s1), 12);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            second = 10 * (s1 - '0');
+
+            switch (valueString.charAt(13)) {
+            case '0':
+                break;
+
+            case '1':
+                second += 1;
+                break;
+
+            case '2':
+                second += 2;
+                break;
+
+            case '3':
+                second += 3;
+                break;
+
+            case '4':
+                second += 4;
+                break;
+
+            case '5':
+                second += 5;
+                break;
+
+            case '6':
+                second += 6;
+                break;
+
+            case '7':
+                second += 7;
+                break;
+
+            case '8':
+                second += 8;
+                break;
+
+            case '9':
+                second += 9;
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_MINUTE.get(valueString,
+                                valueString.substring(12, 14));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            break;
+
+        case '6':
+            // There must be at least two more characters and the next one
+            // must be a 0.
+            if (length < 15) {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(s1), 12);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            if (valueString.charAt(13) != '0') {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_SECOND.get(valueString,
+                                valueString.substring(12, 14));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            second = 60;
+            break;
+
+        case 'Z':
+            // This is fine only if we are at the end of the value.
+            if (length == 13) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(s1), 12);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        case '+':
+        case '-':
+            // These are fine only if there are exactly two or four more
+            // digits that specify a valid offset.
+            if (length == 15 || length == 17) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(getTimeZoneForOffset(valueString, 12));
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(s1), 12);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        case '.':
+        case ',':
+            return finishDecodingFraction(valueString, 13, year, month, day, hour, minute, second,
+                    60000);
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                            .valueOf(s1), 12);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
+        }
+
+        // Next, there should be either a period or comma followed by
+        // between one and three digits (to specify the sub-second), a
+        // letter 'Z' (for the UTC specifier), or a plus or minus sign
+        // followed by two our four digits (for the UTC offset).
+        switch (valueString.charAt(14)) {
+        case '.':
+        case ',':
+            return finishDecodingFraction(valueString, 15, year, month, day, hour, minute, second,
+                    1000);
+
+        case 'Z':
+            // This is fine only if we are at the end of the value.
+            if (length == 15) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(TIME_ZONE_UTC_OBJ);
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(valueString.charAt(14)), 14);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        case '+':
+        case '-':
+            // These are fine only if there are exactly two or four more
+            // digits that specify a valid offset.
+            if (length == 17 || length == 19) {
+                try {
+                    final GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setLenient(false);
+                    calendar.setTimeZone(getTimeZoneForOffset(valueString, 14));
+                    calendar.set(year, month, day, hour, minute, second);
+                    calendar.set(Calendar.MILLISECOND, 0);
+                    return calendar.getTimeInMillis();
+                } catch (final Exception e) {
+                    // This should only happen if the provided date wasn't legal
+                    // (e.g., September 31).
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(valueString, String
+                                    .valueOf(e));
+                    final DecodeException de = DecodeException.error(message, e);
+                    StaticUtils.DEBUG_LOG
+                            .throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+                    throw de;
+                }
+            } else {
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(valueString.charAt(14)), 14);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_CHAR.get(valueString, String
+                            .valueOf(valueString.charAt(14)), 14);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", e);
+            throw e;
+        }
     }
 
-    // If we've gotten here, then it looks like a valid offset. We can
-    // create a time zone by using "GMT" followed by the offset.
-    return TimeZone.getTimeZone("GMT" + offSetStr);
-  }
+    /**
+     * Completes decoding the generalized time value containing a fractional
+     * component. It will also decode the trailing 'Z' or offset.
+     *
+     * @param value
+     *            The whole value, including the fractional component and time
+     *            zone information.
+     * @param startPos
+     *            The position of the first character after the period in the
+     *            value string.
+     * @param year
+     *            The year decoded from the provided value.
+     * @param month
+     *            The month decoded from the provided value.
+     * @param day
+     *            The day decoded from the provided value.
+     * @param hour
+     *            The hour decoded from the provided value.
+     * @param minute
+     *            The minute decoded from the provided value.
+     * @param second
+     *            The second decoded from the provided value.
+     * @param multiplier
+     *            The multiplier value that should be used to scale the fraction
+     *            appropriately. If it's a fraction of an hour, then it should
+     *            be 3600000 (60*60*1000). If it's a fraction of a minute, then
+     *            it should be 60000. If it's a fraction of a second, then it
+     *            should be 1000.
+     * @return The timestamp created from the provided generalized time value
+     *         including the fractional element.
+     * @throws DecodeException
+     *             If the provided value cannot be parsed as a valid generalized
+     *             time string.
+     */
+    private static long finishDecodingFraction(final String value, final int startPos,
+            final int year, final int month, final int day, final int hour, final int minute,
+            final int second, final int multiplier) throws DecodeException {
+        final int length = value.length();
+        final StringBuilder fractionBuffer = new StringBuilder(2 + length - startPos);
+        fractionBuffer.append("0.");
 
+        TimeZone timeZone = null;
 
+    outerLoop:
+        for (int i = startPos; i < length; i++) {
+            final char c = value.charAt(i);
+            switch (c) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                fractionBuffer.append(c);
+                break;
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_GENERALIZED_TIME_OID;
-  }
+            case 'Z':
+                // This is only acceptable if we're at the end of the value.
+                if (i != value.length() - 1) {
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR.get(value,
+                                    String.valueOf(c));
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax",
+                            "finishDecodingFraction", e);
+                    throw e;
+                }
 
+                timeZone = TIME_ZONE_UTC_OBJ;
+                break outerLoop;
 
+            case '+':
+            case '-':
+                timeZone = getTimeZoneForOffset(value, i);
+                break outerLoop;
 
-  public String getName()
-  {
-    return SYNTAX_GENERALIZED_TIME_NAME;
-  }
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR.get(value, String
+                                .valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG
+                        .throwing("GeneralizedTimeSyntax", "finishDecodingFraction", e);
+                throw e;
+            }
+        }
 
+        if (fractionBuffer.length() == 2) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_EMPTY_FRACTION.get(value);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "finishDecodingFraction", e);
+            throw e;
+        }
 
+        if (timeZone == null) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_NO_TIME_ZONE_INFO.get(value);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "finishDecodingFraction", e);
+            throw e;
+        }
 
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_GENERALIZED_TIME_OID;
-  }
+        final Double fractionValue = Double.parseDouble(fractionBuffer.toString());
+        final long additionalMilliseconds = Math.round(fractionValue * multiplier);
 
+        try {
+            final GregorianCalendar calendar = new GregorianCalendar();
+            calendar.setLenient(false);
+            calendar.setTimeZone(timeZone);
+            calendar.set(year, month, day, hour, minute, second);
+            calendar.set(Calendar.MILLISECOND, 0);
+            return calendar.getTimeInMillis() + additionalMilliseconds;
+        } catch (final Exception e) {
 
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    try
-    {
-      decodeGeneralizedTimeValue(value);
-      return true;
+            // This should only happen if the provided date wasn't legal
+            // (e.g., September 31).
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(value, String.valueOf(e));
+            final DecodeException de = DecodeException.error(message, e);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "valueIsAcceptable", de);
+            throw de;
+        }
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
+
+    /**
+     * Decodes a time zone offset from the provided value.
+     *
+     * @param value
+     *            The whole value, including the offset.
+     * @param startPos
+     *            The position of the first character that is contained in the
+     *            offset. This should be the position of the plus or minus
+     *            character.
+     * @return The {@code TimeZone} object representing the decoded time zone.
+     * @throws DecodeException
+     *             If the provided value does not contain a valid offset.
+     */
+    private static TimeZone getTimeZoneForOffset(final String value, final int startPos)
+            throws DecodeException {
+        final String offSetStr = value.substring(startPos);
+        if (offSetStr.length() != 3 && offSetStr.length() != 5) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+            throw e;
+        }
+
+        // The first character must be either a plus or minus.
+        switch (offSetStr.charAt(0)) {
+        case '+':
+        case '-':
+            // These are OK.
+            break;
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+            throw e;
+        }
+
+        // The first two characters must be an integer between 00 and 23.
+        switch (offSetStr.charAt(1)) {
+        case '0':
+        case '1':
+            switch (offSetStr.charAt(2)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+                throw e;
+            }
+            break;
+
+        case '2':
+            switch (offSetStr.charAt(2)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+                // These are all fine.
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+                throw e;
+            }
+            break;
+
+        default:
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+            final DecodeException e = DecodeException.error(message);
+            StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+            throw e;
+        }
+
+        // If there are two more characters, then they must be an integer
+        // between 00 and 59.
+        if (offSetStr.length() == 5) {
+            switch (offSetStr.charAt(3)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+                switch (offSetStr.charAt(4)) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                    // These are all fine.
+                    break;
+
+                default:
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset",
+                            e);
+                    throw e;
+                }
+                break;
+
+            default:
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_GENERALIZED_TIME_INVALID_OFFSET.get(value, offSetStr);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("GeneralizedTimeSyntax", "getTimeZoneForOffset", e);
+                throw e;
+            }
+        }
+
+        // If we've gotten here, then it looks like a valid offset. We can
+        // create a time zone by using "GMT" followed by the offset.
+        return TimeZone.getTimeZone("GMT" + offSetStr);
     }
-  }
+
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_GENERALIZED_TIME_OID;
+    }
+
+    public String getName() {
+        return SYNTAX_GENERALIZED_TIME_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_GENERALIZED_TIME_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        try {
+            decodeGeneralizedTimeValue(value);
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java
index 0a8f293..5571b7e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,381 +26,312 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import java.util.*;
-
-
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 /**
  * Tool for generating CoreSchema.java.
  */
-final class GenerateCoreSchema
-{
-  private static final Set<String> ABBREVIATIONS = new HashSet<String>(Arrays
-      .asList("SASL", "LDAP", "DN", "DIT", "RDN", "JPEG", "OID", "UUID", "IA5",
-          "UID", "UTC", "X500", "X121", "C", "CN", "O", "OU", "L", "DC",
-          "ISDN", "SN", "ST"));
+final class GenerateCoreSchema {
+    private static final Set<String> ABBREVIATIONS = new HashSet<String>(Arrays.asList("SASL",
+            "LDAP", "DN", "DIT", "RDN", "JPEG", "OID", "UUID", "IA5", "UID", "UTC", "X500", "X121",
+            "C", "CN", "O", "OU", "L", "DC", "ISDN", "SN", "ST"));
 
+    /**
+     * Tool for generating CoreSchema.java.
+     *
+     * @param args
+     *            The command line arguments (none required).
+     */
+    public static void main(final String[] args) {
+        testSplitNameIntoWords();
 
+        final Schema schema = Schema.getCoreSchema();
 
-  /**
-   * Tool for generating CoreSchema.java.
-   *
-   * @param args
-   *          The command line arguments (none required).
-   */
-  public static void main(final String[] args)
-  {
-    testSplitNameIntoWords();
+        final SortedMap<String, Syntax> syntaxes = new TreeMap<String, Syntax>();
+        for (final Syntax syntax : schema.getSyntaxes()) {
+            if (isOpenDSOID(syntax.getOID())) {
+                continue;
+            }
 
-    final Schema schema = Schema.getCoreSchema();
-
-    final SortedMap<String, Syntax> syntaxes = new TreeMap<String, Syntax>();
-    for (final Syntax syntax : schema.getSyntaxes())
-    {
-      if (isOpenDSOID(syntax.getOID()))
-      {
-        continue;
-      }
-
-      final String name = syntax.getDescription().replaceAll(" Syntax$", "");
-      final String fieldName = name.replace(" ", "_").toUpperCase(
-          Locale.ENGLISH).concat("_SYNTAX");
-      syntaxes.put(fieldName, syntax);
-    }
-
-    final SortedMap<String, MatchingRule> matchingRules = new TreeMap<String, MatchingRule>();
-    for (final MatchingRule matchingRule : schema.getMatchingRules())
-    {
-      if (isOpenDSOID(matchingRule.getOID()))
-      {
-        continue;
-      }
-
-      final String name = matchingRule.getNameOrOID().replaceAll("Match$", "");
-      final String fieldName = splitNameIntoWords(name)
-          .concat("_MATCHING_RULE");
-      matchingRules.put(fieldName, matchingRule);
-    }
-
-    final SortedMap<String, AttributeType> attributeTypes = new TreeMap<String, AttributeType>();
-    for (final AttributeType attributeType : schema.getAttributeTypes())
-    {
-      if (isOpenDSOID(attributeType.getOID()))
-      {
-        continue;
-      }
-      final String name = attributeType.getNameOrOID();
-      final String fieldName = splitNameIntoWords(name).concat(
-          "_ATTRIBUTE_TYPE");
-      attributeTypes.put(fieldName, attributeType);
-    }
-
-    final SortedMap<String, ObjectClass> objectClasses = new TreeMap<String, ObjectClass>();
-    for (final ObjectClass objectClass : schema.getObjectClasses())
-    {
-      if (isOpenDSOID(objectClass.getOID()))
-      {
-        continue;
-      }
-      final String name = objectClass.getNameOrOID();
-      final String fieldName = splitNameIntoWords(name).concat("_OBJECT_CLASS");
-
-      objectClasses.put(fieldName, objectClass);
-    }
-
-    System.out.println();
-    System.out.println();
-    System.out.println();
-    System.out.println("package org.forgerock.opendj.ldap.schema;");
-    System.out.println();
-    System.out.println();
-    System.out.println();
-    System.out.println("/**");
-    System.out.println(" * The OpenDJ SDK core schema contains standard LDAP "
-        + "RFC schema elements. These include:");
-    System.out.println(" * <ul>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc4512\">RFC 4512 -");
-    System.out
-        .println(" * Lightweight Directory Access Protocol (LDAP): Directory Information");
-    System.out.println(" * Models </a>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc4517\">RFC 4517 -");
-    System.out
-        .println(" * Lightweight Directory Access Protocol (LDAP): Syntaxes and Matching");
-    System.out.println(" * Rules </a>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc4519\">RFC 4519 -");
-    System.out
-        .println(" * Lightweight Directory Access Protocol (LDAP): Schema for User");
-    System.out.println(" * Applications </a>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc4530\">RFC 4530 -");
-    System.out
-        .println(" * Lightweight Directory Access Protocol (LDAP): entryUUID Operational");
-    System.out.println(" * Attribute </a>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc3045\">RFC 3045 - Storing");
-    System.out.println(" * Vendor Information in the LDAP Root DSE </a>");
-    System.out
-        .println(" * <li><a href=\"http://tools.ietf.org/html/rfc3112\">RFC 3112 - LDAP");
-    System.out.println(" * Authentication Password Schema </a>");
-    System.out.println(" * </ul>");
-    System.out.println(" * <p>");
-    System.out
-        .println(" * The core schema is non-strict: attempts to retrieve");
-    System.out
-        .println(" * non-existent Attribute Types will return a temporary");
-    System.out.println(" * Attribute Type having the Octet String syntax.");
-    System.out.println(" */");
-    System.out.println("public final class CoreSchema");
-    System.out.println("{");
-
-    System.out.println("  // Core Syntaxes");
-    for (final Map.Entry<String, Syntax> syntax : syntaxes.entrySet())
-    {
-      System.out.println("  private static final Syntax " + syntax.getKey()
-          + " =");
-      System.out.println("    CoreSchemaImpl.getInstance().getSyntax(\""
-          + syntax.getValue().getOID() + "\");");
-    }
-
-    System.out.println();
-    System.out.println("  // Core Matching Rules");
-    for (final Map.Entry<String, MatchingRule> matchingRule : matchingRules
-        .entrySet())
-    {
-      System.out.println("  private static final MatchingRule "
-          + matchingRule.getKey() + " =");
-      System.out.println("    CoreSchemaImpl.getInstance().getMatchingRule(\""
-          + matchingRule.getValue().getOID() + "\");");
-    }
-
-    System.out.println();
-    System.out.println("  // Core Attribute Types");
-    for (final Map.Entry<String, AttributeType> attributeType : attributeTypes
-        .entrySet())
-    {
-      System.out.println("  private static final AttributeType "
-          + attributeType.getKey() + " =");
-      System.out.println("    CoreSchemaImpl.getInstance().getAttributeType(\""
-          + attributeType.getValue().getOID() + "\");");
-    }
-
-    System.out.println();
-    System.out.println("  // Core Object Classes");
-    for (final Map.Entry<String, ObjectClass> objectClass : objectClasses
-        .entrySet())
-    {
-      System.out.println("  private static final ObjectClass "
-          + objectClass.getKey() + " =");
-      System.out.println("    CoreSchemaImpl.getInstance().getObjectClass(\""
-          + objectClass.getValue().getOID() + "\");");
-    }
-
-    System.out.println();
-    System.out.println();
-    System.out.println();
-    System.out.println("  // Prevent instantiation");
-    System.out.println("  private CoreSchema()");
-    System.out.println("  {");
-    System.out.println("    // Nothing to do.");
-    System.out.println("  }");
-
-    System.out.println();
-    System.out.println();
-    System.out.println();
-    System.out.println("  /**");
-    System.out
-        .println("   * Returns a reference to the singleton core schema.");
-    System.out.println("   *");
-    System.out.println("   * @return The core schema.");
-    System.out.println("   */");
-    System.out.println("  public static Schema getInstance()");
-    System.out.println("  {");
-    System.out.println("    return CoreSchemaImpl.getInstance();");
-    System.out.println("  }");
-
-    for (final Map.Entry<String, Syntax> syntax : syntaxes.entrySet())
-    {
-      System.out.println();
-      System.out.println();
-      System.out.println();
-
-      final String description = toCodeJavaDoc(syntax.getValue()
-          .getDescription().replaceAll(" Syntax$", "")
-          + " Syntax");
-      System.out.println("  /**");
-      System.out.println("   * Returns a reference to the " + description);
-      System.out.println("   * which has the OID "
-          + toCodeJavaDoc(syntax.getValue().getOID()) + ".");
-      System.out.println("   *");
-      System.out
-          .println("   * @return A reference to the " + description + ".");
-
-      System.out.println("   */");
-      System.out.println("  public static Syntax get"
-          + toJavaName(syntax.getKey()) + "()");
-      System.out.println("  {");
-      System.out.println("    return " + syntax.getKey() + ";");
-      System.out.println("  }");
-    }
-
-    for (final Map.Entry<String, MatchingRule> matchingRule : matchingRules
-        .entrySet())
-    {
-      System.out.println();
-      System.out.println();
-      System.out.println();
-
-      final String description = toCodeJavaDoc(matchingRule.getValue()
-          .getNameOrOID());
-      System.out.println("  /**");
-      System.out.println("   * Returns a reference to the " + description
-          + " Matching Rule");
-      System.out.println("   * which has the OID "
-          + toCodeJavaDoc(matchingRule.getValue().getOID()) + ".");
-      System.out.println("   *");
-      System.out.println("   * @return A reference to the " + description
-          + " Matching Rule.");
-
-      System.out.println("   */");
-      System.out.println("  public static MatchingRule get"
-          + toJavaName(matchingRule.getKey()) + "()");
-      System.out.println("  {");
-      System.out.println("    return " + matchingRule.getKey() + ";");
-      System.out.println("  }");
-    }
-
-    for (final Map.Entry<String, AttributeType> attributeType : attributeTypes
-        .entrySet())
-    {
-      System.out.println();
-      System.out.println();
-      System.out.println();
-
-      final String description = toCodeJavaDoc(attributeType.getValue()
-          .getNameOrOID());
-      System.out.println("  /**");
-      System.out.println("   * Returns a reference to the " + description
-          + " Attribute Type");
-      System.out.println("   * which has the OID "
-          + toCodeJavaDoc(attributeType.getValue().getOID()) + ".");
-      System.out.println("   *");
-      System.out.println("   * @return A reference to the " + description
-          + " Attribute Type.");
-
-      System.out.println("   */");
-      System.out.println("  public static AttributeType get"
-          + toJavaName(attributeType.getKey()) + "()");
-      System.out.println("  {");
-      System.out.println("    return " + attributeType.getKey() + ";");
-      System.out.println("  }");
-    }
-
-    for (final Map.Entry<String, ObjectClass> objectClass : objectClasses
-        .entrySet())
-    {
-      System.out.println();
-      System.out.println();
-      System.out.println();
-
-      final String description = toCodeJavaDoc(objectClass.getValue()
-          .getNameOrOID());
-      System.out.println("  /**");
-      System.out.println("   * Returns a reference to the " + description
-          + " Object Class");
-      System.out.println("   * which has the OID "
-          + toCodeJavaDoc(objectClass.getValue().getOID()) + ".");
-      System.out.println("   *");
-      System.out.println("   * @return A reference to the " + description
-          + " Object Class.");
-
-      System.out.println("   */");
-      System.out.println("  public static ObjectClass get"
-          + toJavaName(objectClass.getKey()) + "()");
-      System.out.println("  {");
-      System.out.println("    return " + objectClass.getKey() + ";");
-      System.out.println("  }");
-    }
-
-    System.out.println("}");
-  }
-
-
-
-  private static boolean isOpenDSOID(final String oid)
-  {
-    return oid.startsWith(SchemaConstants.OID_OPENDS_SERVER_BASE + ".");
-  }
-
-
-
-  private static String splitNameIntoWords(final String name)
-  {
-    String splitName = name.replaceAll("([A-Z][a-z])", "_$1");
-    splitName = splitName.replaceAll("([a-z])([A-Z])", "$1_$2");
-
-    return splitName.toUpperCase(Locale.ENGLISH);
-  }
-
-
-
-  private static void testSplitNameIntoWords()
-  {
-    final String[][] values = new String[][] {
-        { "oneTwoThree", "ONE_TWO_THREE" }, { "oneTWOThree", "ONE_TWO_THREE" },
-        { "oneX500Three", "ONE_X500_THREE" }, { "oneTwoX500", "ONE_TWO_X500" },
-        { "oneTwoX500", "ONE_TWO_X500" }, { "x500TwoThree", "X500_TWO_THREE" }, };
-
-    for (final String[] test : values)
-    {
-      final String actual = splitNameIntoWords(test[0]);
-      final String expected = test[1];
-      if (!actual.equals(expected))
-      {
-        System.out.println("Test Split Failure: " + test[0] + " -> " + actual
-            + " != " + expected);
-      }
-    }
-  }
-
-
-
-  private static String toCodeJavaDoc(final String text)
-  {
-    return String.format("{@code %s}", text);
-  }
-
-
-
-  private static String toJavaName(final String splitName)
-  {
-    final StringBuilder builder = new StringBuilder();
-    for (final String word : splitName.split("_"))
-    {
-      if (ABBREVIATIONS.contains(word))
-      {
-        builder.append(word);
-      }
-      else
-      {
-        builder.append(word.charAt(0));
-        if (word.length() > 1)
-        {
-          builder.append(word.substring(1).toLowerCase(Locale.ENGLISH));
+            final String name = syntax.getDescription().replaceAll(" Syntax$", "");
+            final String fieldName =
+                    name.replace(" ", "_").toUpperCase(Locale.ENGLISH).concat("_SYNTAX");
+            syntaxes.put(fieldName, syntax);
         }
-      }
+
+        final SortedMap<String, MatchingRule> matchingRules = new TreeMap<String, MatchingRule>();
+        for (final MatchingRule matchingRule : schema.getMatchingRules()) {
+            if (isOpenDSOID(matchingRule.getOID())) {
+                continue;
+            }
+
+            final String name = matchingRule.getNameOrOID().replaceAll("Match$", "");
+            final String fieldName = splitNameIntoWords(name).concat("_MATCHING_RULE");
+            matchingRules.put(fieldName, matchingRule);
+        }
+
+        final SortedMap<String, AttributeType> attributeTypes =
+                new TreeMap<String, AttributeType>();
+        for (final AttributeType attributeType : schema.getAttributeTypes()) {
+            if (isOpenDSOID(attributeType.getOID())) {
+                continue;
+            }
+            final String name = attributeType.getNameOrOID();
+            final String fieldName = splitNameIntoWords(name).concat("_ATTRIBUTE_TYPE");
+            attributeTypes.put(fieldName, attributeType);
+        }
+
+        final SortedMap<String, ObjectClass> objectClasses = new TreeMap<String, ObjectClass>();
+        for (final ObjectClass objectClass : schema.getObjectClasses()) {
+            if (isOpenDSOID(objectClass.getOID())) {
+                continue;
+            }
+            final String name = objectClass.getNameOrOID();
+            final String fieldName = splitNameIntoWords(name).concat("_OBJECT_CLASS");
+
+            objectClasses.put(fieldName, objectClass);
+        }
+
+        System.out.println();
+        System.out.println();
+        System.out.println();
+        System.out.println("package org.forgerock.opendj.ldap.schema;");
+        System.out.println();
+        System.out.println();
+        System.out.println();
+        System.out.println("/**");
+        System.out.println(" * The OpenDJ SDK core schema contains standard LDAP "
+                + "RFC schema elements. These include:");
+        System.out.println(" * <ul>");
+        System.out.println(" * <li><a href=\"http://tools.ietf.org/html/rfc4512\">RFC 4512 -");
+        System.out
+                .println(" * Lightweight Directory Access Protocol (LDAP): Directory Information");
+        System.out.println(" * Models </a>");
+        System.out.println(" * <li><a href=\"http://tools.ietf.org/html/rfc4517\">RFC 4517 -");
+        System.out
+                .println(" * Lightweight Directory Access Protocol (LDAP): Syntaxes and Matching");
+        System.out.println(" * Rules </a>");
+        System.out.println(" * <li><a href=\"http://tools.ietf.org/html/rfc4519\">RFC 4519 -");
+        System.out.println(" * Lightweight Directory Access Protocol (LDAP): Schema for User");
+        System.out.println(" * Applications </a>");
+        System.out.println(" * <li><a href=\"http://tools.ietf.org/html/rfc4530\">RFC 4530 -");
+        System.out
+                .println(" * Lightweight Directory Access Protocol (LDAP): entryUUID Operational");
+        System.out.println(" * Attribute </a>");
+        System.out
+                .println(" * <li><a href=\"http://tools.ietf.org/html/rfc3045\">RFC 3045 - Storing");
+        System.out.println(" * Vendor Information in the LDAP Root DSE </a>");
+        System.out.println(" * <li><a href=\"http://tools.ietf.org/html/rfc3112\">RFC 3112 - LDAP");
+        System.out.println(" * Authentication Password Schema </a>");
+        System.out.println(" * </ul>");
+        System.out.println(" * <p>");
+        System.out.println(" * The core schema is non-strict: attempts to retrieve");
+        System.out.println(" * non-existent Attribute Types will return a temporary");
+        System.out.println(" * Attribute Type having the Octet String syntax.");
+        System.out.println(" */");
+        System.out.println("public final class CoreSchema");
+        System.out.println("{");
+
+        System.out.println("  // Core Syntaxes");
+        for (final Map.Entry<String, Syntax> syntax : syntaxes.entrySet()) {
+            System.out.println("  private static final Syntax " + syntax.getKey() + " =");
+            System.out.println("    CoreSchemaImpl.getInstance().getSyntax(\""
+                    + syntax.getValue().getOID() + "\");");
+        }
+
+        System.out.println();
+        System.out.println("  // Core Matching Rules");
+        for (final Map.Entry<String, MatchingRule> matchingRule : matchingRules.entrySet()) {
+            System.out.println("  private static final MatchingRule " + matchingRule.getKey()
+                    + " =");
+            System.out.println("    CoreSchemaImpl.getInstance().getMatchingRule(\""
+                    + matchingRule.getValue().getOID() + "\");");
+        }
+
+        System.out.println();
+        System.out.println("  // Core Attribute Types");
+        for (final Map.Entry<String, AttributeType> attributeType : attributeTypes.entrySet()) {
+            System.out.println("  private static final AttributeType " + attributeType.getKey()
+                    + " =");
+            System.out.println("    CoreSchemaImpl.getInstance().getAttributeType(\""
+                    + attributeType.getValue().getOID() + "\");");
+        }
+
+        System.out.println();
+        System.out.println("  // Core Object Classes");
+        for (final Map.Entry<String, ObjectClass> objectClass : objectClasses.entrySet()) {
+            System.out.println("  private static final ObjectClass " + objectClass.getKey() + " =");
+            System.out.println("    CoreSchemaImpl.getInstance().getObjectClass(\""
+                    + objectClass.getValue().getOID() + "\");");
+        }
+
+        System.out.println();
+        System.out.println();
+        System.out.println();
+        System.out.println("  // Prevent instantiation");
+        System.out.println("  private CoreSchema()");
+        System.out.println("  {");
+        System.out.println("    // Nothing to do.");
+        System.out.println("  }");
+
+        System.out.println();
+        System.out.println();
+        System.out.println();
+        System.out.println("  /**");
+        System.out.println("   * Returns a reference to the singleton core schema.");
+        System.out.println("   *");
+        System.out.println("   * @return The core schema.");
+        System.out.println("   */");
+        System.out.println("  public static Schema getInstance()");
+        System.out.println("  {");
+        System.out.println("    return CoreSchemaImpl.getInstance();");
+        System.out.println("  }");
+
+        for (final Map.Entry<String, Syntax> syntax : syntaxes.entrySet()) {
+            System.out.println();
+            System.out.println();
+            System.out.println();
+
+            final String description =
+                    toCodeJavaDoc(syntax.getValue().getDescription().replaceAll(" Syntax$", "")
+                            + " Syntax");
+            System.out.println("  /**");
+            System.out.println("   * Returns a reference to the " + description);
+            System.out.println("   * which has the OID "
+                    + toCodeJavaDoc(syntax.getValue().getOID()) + ".");
+            System.out.println("   *");
+            System.out.println("   * @return A reference to the " + description + ".");
+
+            System.out.println("   */");
+            System.out.println("  public static Syntax get" + toJavaName(syntax.getKey()) + "()");
+            System.out.println("  {");
+            System.out.println("    return " + syntax.getKey() + ";");
+            System.out.println("  }");
+        }
+
+        for (final Map.Entry<String, MatchingRule> matchingRule : matchingRules.entrySet()) {
+            System.out.println();
+            System.out.println();
+            System.out.println();
+
+            final String description = toCodeJavaDoc(matchingRule.getValue().getNameOrOID());
+            System.out.println("  /**");
+            System.out.println("   * Returns a reference to the " + description + " Matching Rule");
+            System.out.println("   * which has the OID "
+                    + toCodeJavaDoc(matchingRule.getValue().getOID()) + ".");
+            System.out.println("   *");
+            System.out
+                    .println("   * @return A reference to the " + description + " Matching Rule.");
+
+            System.out.println("   */");
+            System.out.println("  public static MatchingRule get"
+                    + toJavaName(matchingRule.getKey()) + "()");
+            System.out.println("  {");
+            System.out.println("    return " + matchingRule.getKey() + ";");
+            System.out.println("  }");
+        }
+
+        for (final Map.Entry<String, AttributeType> attributeType : attributeTypes.entrySet()) {
+            System.out.println();
+            System.out.println();
+            System.out.println();
+
+            final String description = toCodeJavaDoc(attributeType.getValue().getNameOrOID());
+            System.out.println("  /**");
+            System.out
+                    .println("   * Returns a reference to the " + description + " Attribute Type");
+            System.out.println("   * which has the OID "
+                    + toCodeJavaDoc(attributeType.getValue().getOID()) + ".");
+            System.out.println("   *");
+            System.out.println("   * @return A reference to the " + description
+                    + " Attribute Type.");
+
+            System.out.println("   */");
+            System.out.println("  public static AttributeType get"
+                    + toJavaName(attributeType.getKey()) + "()");
+            System.out.println("  {");
+            System.out.println("    return " + attributeType.getKey() + ";");
+            System.out.println("  }");
+        }
+
+        for (final Map.Entry<String, ObjectClass> objectClass : objectClasses.entrySet()) {
+            System.out.println();
+            System.out.println();
+            System.out.println();
+
+            final String description = toCodeJavaDoc(objectClass.getValue().getNameOrOID());
+            System.out.println("  /**");
+            System.out.println("   * Returns a reference to the " + description + " Object Class");
+            System.out.println("   * which has the OID "
+                    + toCodeJavaDoc(objectClass.getValue().getOID()) + ".");
+            System.out.println("   *");
+            System.out.println("   * @return A reference to the " + description + " Object Class.");
+
+            System.out.println("   */");
+            System.out.println("  public static ObjectClass get" + toJavaName(objectClass.getKey())
+                    + "()");
+            System.out.println("  {");
+            System.out.println("    return " + objectClass.getKey() + ";");
+            System.out.println("  }");
+        }
+
+        System.out.println("}");
     }
-    return builder.toString();
-  }
 
+    private static boolean isOpenDSOID(final String oid) {
+        return oid.startsWith(SchemaConstants.OID_OPENDS_SERVER_BASE + ".");
+    }
 
+    private static String splitNameIntoWords(final String name) {
+        String splitName = name.replaceAll("([A-Z][a-z])", "_$1");
+        splitName = splitName.replaceAll("([a-z])([A-Z])", "$1_$2");
 
-  private GenerateCoreSchema()
-  {
-    // Prevent instantiation.
-  }
+        return splitName.toUpperCase(Locale.ENGLISH);
+    }
+
+    private static void testSplitNameIntoWords() {
+        final String[][] values =
+                new String[][] { { "oneTwoThree", "ONE_TWO_THREE" },
+                    { "oneTWOThree", "ONE_TWO_THREE" }, { "oneX500Three", "ONE_X500_THREE" },
+                    { "oneTwoX500", "ONE_TWO_X500" }, { "oneTwoX500", "ONE_TWO_X500" },
+                    { "x500TwoThree", "X500_TWO_THREE" }, };
+
+        for (final String[] test : values) {
+            final String actual = splitNameIntoWords(test[0]);
+            final String expected = test[1];
+            if (!actual.equals(expected)) {
+                System.out.println("Test Split Failure: " + test[0] + " -> " + actual + " != "
+                        + expected);
+            }
+        }
+    }
+
+    private static String toCodeJavaDoc(final String text) {
+        return String.format("{@code %s}", text);
+    }
+
+    private static String toJavaName(final String splitName) {
+        final StringBuilder builder = new StringBuilder();
+        for (final String word : splitName.split("_")) {
+            if (ABBREVIATIONS.contains(word)) {
+                builder.append(word);
+            } else {
+                builder.append(word.charAt(0));
+                if (word.length() > 1) {
+                    builder.append(word.substring(1).toLowerCase(Locale.ENGLISH));
+                }
+            }
+        }
+        return builder.toString();
+    }
+
+    private GenerateCoreSchema() {
+        // Prevent instantiation.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java
index 775978f..e1000b2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
@@ -42,394 +39,297 @@
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the guide attribute syntax, which may be used to
  * provide criteria for generating search filters for entries, optionally tied
  * to a specified objectclass.
  */
-final class GuideSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * Determines whether the provided string represents a valid criteria
-   * according to the guide syntax.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param criteria
-   *          The portion of the criteria for which to make the determination.
-   * @param valueStr
-   *          The complete guide value provided by the client.
-   * @param invalidReason
-   *          The buffer to which to append the reason that the criteria is
-   *          invalid if a problem is found.
-   * @return <CODE>true</CODE> if the provided string does contain a valid
-   *         criteria, or <CODE>false</CODE> if not.
-   */
-  static boolean criteriaIsValid(final Schema schema,
-      final String criteria, final String valueStr,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    // See if the criteria starts with a '!'. If so, then just evaluate
-    // everything after that as a criteria.
-    char c = criteria.charAt(0);
-    if (c == '!')
-    {
-      return criteriaIsValid(schema, criteria.substring(1), valueStr,
-          invalidReason);
-    }
+final class GuideSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * Determines whether the provided string represents a valid criteria
+     * according to the guide syntax.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param criteria
+     *            The portion of the criteria for which to make the
+     *            determination.
+     * @param valueStr
+     *            The complete guide value provided by the client.
+     * @param invalidReason
+     *            The buffer to which to append the reason that the criteria is
+     *            invalid if a problem is found.
+     * @return <CODE>true</CODE> if the provided string does contain a valid
+     *         criteria, or <CODE>false</CODE> if not.
+     */
+    static boolean criteriaIsValid(final Schema schema, final String criteria,
+            final String valueStr, final LocalizableMessageBuilder invalidReason) {
+        // See if the criteria starts with a '!'. If so, then just evaluate
+        // everything after that as a criteria.
+        char c = criteria.charAt(0);
+        if (c == '!') {
+            return criteriaIsValid(schema, criteria.substring(1), valueStr, invalidReason);
+        }
 
-    // See if the criteria starts with a '('. If so, then find the
-    // corresponding ')' and parse what's in between as a criteria.
-    if (c == '(')
-    {
-      final int length = criteria.length();
-      int depth = 1;
+        // See if the criteria starts with a '('. If so, then find the
+        // corresponding ')' and parse what's in between as a criteria.
+        if (c == '(') {
+            final int length = criteria.length();
+            int depth = 1;
 
-      for (int i = 1; i < length; i++)
-      {
-        c = criteria.charAt(i);
-        if (c == ')')
-        {
-          depth--;
-          if (depth == 0)
-          {
-            final String subCriteria = criteria.substring(1, i);
-            if (!criteriaIsValid(schema, subCriteria, valueStr, invalidReason))
-            {
-              return false;
+            for (int i = 1; i < length; i++) {
+                c = criteria.charAt(i);
+                if (c == ')') {
+                    depth--;
+                    if (depth == 0) {
+                        final String subCriteria = criteria.substring(1, i);
+                        if (!criteriaIsValid(schema, subCriteria, valueStr, invalidReason)) {
+                            return false;
+                        }
+
+                        // If we are at the end of the value, then it was valid.
+                        // Otherwise, the next character must be a pipe or an
+                        // ampersand followed by another set of criteria.
+                        if (i == length - 1) {
+                            return true;
+                        } else {
+                            c = criteria.charAt(i + 1);
+                            if (c == '|' || c == '&') {
+                                return criteriaIsValid(schema, criteria.substring(i + 2), valueStr,
+                                        invalidReason);
+                            } else {
+
+                                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(
+                                        valueStr, criteria, c, (i + 1)));
+                                return false;
+                            }
+                        }
+                    }
+                } else if (c == '(') {
+                    depth++;
+                }
             }
 
-            // If we are at the end of the value, then it was valid.
-            // Otherwise, the next character must be a pipe or an
-            // ampersand followed by another set of criteria.
-            if (i == length - 1)
-            {
-              return true;
-            }
-            else
-            {
-              c = criteria.charAt(i + 1);
-              if (c == '|' || c == '&')
-              {
-                return criteriaIsValid(schema,
-                    criteria.substring(i + 2), valueStr,
-                    invalidReason);
-              }
-              else
-              {
+            // If we've gotten here, then we went through the entire value
+            // without finding the appropriate closing parenthesis.
 
-                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(
-                    valueStr, criteria, c, (i + 1)));
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_MISSING_CLOSE_PAREN.get(valueStr, criteria));
+            return false;
+        }
+
+        // See if the criteria starts with a '?'. If so, then it must be
+        // either "?true" or "?false".
+        if (c == '?') {
+            if (criteria.startsWith("?true")) {
+                if (criteria.length() == 5) {
+                    return true;
+                } else {
+                    // The only characters allowed next are a pipe or an
+                    // ampersand.
+                    c = criteria.charAt(5);
+                    if (c == '|' || c == '&') {
+                        return criteriaIsValid(schema, criteria.substring(6), valueStr,
+                                invalidReason);
+                    } else {
+                        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(valueStr,
+                                criteria, c, 5));
+                        return false;
+                    }
+                }
+            } else if (criteria.startsWith("?false")) {
+                if (criteria.length() == 6) {
+                    return true;
+                } else {
+                    // The only characters allowed next are a pipe or an
+                    // ampersand.
+                    c = criteria.charAt(6);
+                    if (c == '|' || c == '&') {
+                        return criteriaIsValid(schema, criteria.substring(7), valueStr,
+                                invalidReason);
+                    } else {
+                        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(valueStr,
+                                criteria, c, 6));
+                        return false;
+                    }
+                }
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_QUESTION_MARK.get(valueStr,
+                        criteria));
                 return false;
-              }
             }
-          }
         }
-        else if (c == '(')
-        {
-          depth++;
+
+        // See if the criteria is either "true" or "false". If so, then it
+        // is valid.
+        if (criteria.equals("true") || criteria.equals("false")) {
+            return true;
         }
-      }
 
-      // If we've gotten here, then we went through the entire value
-      // without finding the appropriate closing parenthesis.
-
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_MISSING_CLOSE_PAREN.get(
-          valueStr, criteria));
-      return false;
-    }
-
-    // See if the criteria starts with a '?'. If so, then it must be
-    // either "?true" or "?false".
-    if (c == '?')
-    {
-      if (criteria.startsWith("?true"))
-      {
-        if (criteria.length() == 5)
-        {
-          return true;
-        }
-        else
-        {
-          // The only characters allowed next are a pipe or an
-          // ampersand.
-          c = criteria.charAt(5);
-          if (c == '|' || c == '&')
-          {
-            return criteriaIsValid(schema, criteria.substring(6), valueStr,
-                invalidReason);
-          }
-          else
-          {
-            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(
-                valueStr, criteria, c, 5));
+        // The only thing that will be allowed is an attribute type name or
+        // OID followed by a dollar sign and a match type. Find the dollar
+        // sign and verify whether the value before it is a valid attribute
+        // type name or OID.
+        final int dollarPos = criteria.indexOf('$');
+        if (dollarPos < 0) {
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_DOLLAR.get(valueStr, criteria));
             return false;
-          }
-        }
-      }
-      else if (criteria.startsWith("?false"))
-      {
-        if (criteria.length() == 6)
-        {
-          return true;
-        }
-        else
-        {
-          // The only characters allowed next are a pipe or an
-          // ampersand.
-          c = criteria.charAt(6);
-          if (c == '|' || c == '&')
-          {
-            return criteriaIsValid(schema, criteria.substring(7), valueStr,
-                invalidReason);
-          }
-          else
-          {
-            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(
-                valueStr, criteria, c, 6));
+        } else if (dollarPos == 0) {
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_ATTR.get(valueStr, criteria));
             return false;
-          }
+        } else if (dollarPos == criteria.length() - 1) {
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_MATCH_TYPE.get(valueStr, criteria));
+            return false;
+        } else {
+            try {
+                SchemaUtils.readOID(new SubstringReader(criteria.substring(0, dollarPos)), schema
+                        .allowMalformedNamesAndOptions());
+            } catch (final DecodeException de) {
+                invalidReason.append(de.getMessageObject());
+                return false;
+            }
         }
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_QUESTION_MARK.get(
-            valueStr, criteria));
-        return false;
-      }
+
+        // The substring immediately after the dollar sign must be one of
+        // "eq", "substr", "ge", "le", or "approx". It may be followed by
+        // the end of the value, a pipe, or an ampersand.
+        int endPos;
+        c = criteria.charAt(dollarPos + 1);
+        switch (c) {
+        case 'e':
+            if (criteria.startsWith("eq", dollarPos + 1)) {
+                endPos = dollarPos + 3;
+                break;
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr,
+                        criteria, dollarPos + 1));
+                return false;
+            }
+
+        case 's':
+            if (criteria.startsWith("substr", dollarPos + 1)) {
+                endPos = dollarPos + 7;
+                break;
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr,
+                        criteria, dollarPos + 1));
+                return false;
+            }
+
+        case 'g':
+            if (criteria.startsWith("ge", dollarPos + 1)) {
+                endPos = dollarPos + 3;
+                break;
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr,
+                        criteria, dollarPos + 1));
+                return false;
+            }
+
+        case 'l':
+            if (criteria.startsWith("le", dollarPos + 1)) {
+                endPos = dollarPos + 3;
+                break;
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr,
+                        criteria, dollarPos + 1));
+                return false;
+            }
+
+        case 'a':
+            if (criteria.startsWith("approx", dollarPos + 1)) {
+                endPos = dollarPos + 7;
+                break;
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr,
+                        criteria, dollarPos + 1));
+                return false;
+            }
+
+        default:
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(valueStr, criteria,
+                    dollarPos + 1));
+            return false;
+        }
+
+        // See if we are at the end of the value. If so, then it is valid.
+        // Otherwise, the next character must be a pipe or an ampersand.
+        if (endPos >= criteria.length()) {
+            return true;
+        } else {
+            c = criteria.charAt(endPos);
+            if (c == '|' || c == '&') {
+                return criteriaIsValid(schema, criteria.substring(endPos + 1), valueStr,
+                        invalidReason);
+            } else {
+                invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(valueStr, criteria, c,
+                        endPos));
+                return false;
+            }
+        }
     }
 
-    // See if the criteria is either "true" or "false". If so, then it
-    // is valid.
-    if (criteria.equals("true") || criteria.equals("false"))
-    {
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
     }
 
-    // The only thing that will be allowed is an attribute type name or
-    // OID followed by a dollar sign and a match type. Find the dollar
-    // sign and verify whether the value before it is a valid attribute
-    // type name or OID.
-    final int dollarPos = criteria.indexOf('$');
-    if (dollarPos < 0)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_DOLLAR.get(valueStr,
-          criteria));
-      return false;
-    }
-    else if (dollarPos == 0)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_ATTR
-          .get(valueStr, criteria));
-      return false;
-    }
-    else if (dollarPos == criteria.length() - 1)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_MATCH_TYPE.get(valueStr,
-          criteria));
-      return false;
-    }
-    else
-    {
-      try
-      {
-        SchemaUtils.readOID(new SubstringReader(criteria
-            .substring(0, dollarPos)),
-            schema.allowMalformedNamesAndOptions());
-      }
-      catch (final DecodeException de)
-      {
-        invalidReason.append(de.getMessageObject());
-        return false;
-      }
+    public String getName() {
+        return SYNTAX_GUIDE_NAME;
     }
 
-    // The substring immediately after the dollar sign must be one of
-    // "eq", "substr", "ge", "le", or "approx". It may be followed by
-    // the end of the value, a pipe, or an ampersand.
-    int endPos;
-    c = criteria.charAt(dollarPos + 1);
-    switch (c)
-    {
-    case 'e':
-      if (criteria.startsWith("eq", dollarPos + 1))
-      {
-        endPos = dollarPos + 3;
-        break;
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-            valueStr, criteria, dollarPos + 1));
-        return false;
-      }
-
-    case 's':
-      if (criteria.startsWith("substr", dollarPos + 1))
-      {
-        endPos = dollarPos + 7;
-        break;
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-            valueStr, criteria, dollarPos + 1));
-        return false;
-      }
-
-    case 'g':
-      if (criteria.startsWith("ge", dollarPos + 1))
-      {
-        endPos = dollarPos + 3;
-        break;
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-            valueStr, criteria, dollarPos + 1));
-        return false;
-      }
-
-    case 'l':
-      if (criteria.startsWith("le", dollarPos + 1))
-      {
-        endPos = dollarPos + 3;
-        break;
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-            valueStr, criteria, dollarPos + 1));
-        return false;
-      }
-
-    case 'a':
-      if (criteria.startsWith("approx", dollarPos + 1))
-      {
-        endPos = dollarPos + 7;
-        break;
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-            valueStr, criteria, dollarPos + 1));
-        return false;
-      }
-
-    default:
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_INVALID_MATCH_TYPE.get(
-          valueStr, criteria, dollarPos + 1));
-      return false;
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
     }
 
-    // See if we are at the end of the value. If so, then it is valid.
-    // Otherwise, the next character must be a pipe or an ampersand.
-    if (endPos >= criteria.length())
-    {
-      return true;
-    }
-    else
-    {
-      c = criteria.charAt(endPos);
-      if (c == '|' || c == '&')
-      {
-        return criteriaIsValid(schema,
-            criteria.substring(endPos + 1), valueStr, invalidReason);
-      }
-      else
-      {
-        invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_ILLEGAL_CHAR.get(valueStr,
-            criteria, c, endPos));
-        return false;
-      }
-    }
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_GUIDE_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get a lowercase string version of the provided value.
-    final String valueStr = toLowerCase(value.toString());
-
-    // Find the position of the octothorpe. If there isn't one, then the
-    // entire value should be the criteria.
-    final int sharpPos = valueStr.indexOf('#');
-    if (sharpPos < 0)
-    {
-      return criteriaIsValid(schema, valueStr, valueStr, invalidReason);
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    // Get the objectclass and see if it is a valid name or OID.
-    final String ocName = valueStr.substring(0, sharpPos).trim();
-    final int ocLength = ocName.length();
-    if (ocLength == 0)
-    {
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get a lowercase string version of the provided value.
+        final String valueStr = toLowerCase(value.toString());
 
-      invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_OC1.get(valueStr));
-      return false;
-    }
+        // Find the position of the octothorpe. If there isn't one, then the
+        // entire value should be the criteria.
+        final int sharpPos = valueStr.indexOf('#');
+        if (sharpPos < 0) {
+            return criteriaIsValid(schema, valueStr, valueStr, invalidReason);
+        }
 
-    try
-    {
-      SchemaUtils.readOID(new SubstringReader(ocName.substring(0, ocLength)),
-          schema.allowMalformedNamesAndOptions());
-    }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
-    }
+        // Get the objectclass and see if it is a valid name or OID.
+        final String ocName = valueStr.substring(0, sharpPos).trim();
+        final int ocLength = ocName.length();
+        if (ocLength == 0) {
 
-    // The rest of the value must be the criteria.
-    return criteriaIsValid(schema, valueStr.substring(sharpPos + 1),
-        valueStr, invalidReason);
-  }
+            invalidReason.append(ERR_ATTR_SYNTAX_GUIDE_NO_OC1.get(valueStr));
+            return false;
+        }
+
+        try {
+            SchemaUtils.readOID(new SubstringReader(ocName.substring(0, ocLength)), schema
+                    .allowMalformedNamesAndOptions());
+        } catch (final DecodeException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
+
+        // The rest of the value must be the criteria.
+        return criteriaIsValid(schema, valueStr.substring(sharpPos + 1), valueStr, invalidReason);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java
index 12348d1..c94080c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
@@ -36,95 +33,72 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the IA5 string attribute syntax, which is simply a set
  * of ASCII characters. By default, they will be treated in a case-insensitive
  * manner, and equality, ordering, substring, and approximate matching will be
  * allowed.
  */
-final class IA5StringSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_IA5_STRING_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We will allow any value that does not contain any non-ASCII
-    // characters. Empty values are acceptable as well.
-    byte b;
-    for (int i = 0; i < value.length(); i++)
-    {
-      b = value.byteAt(i);
-      if ((b & 0x7F) != b)
-      {
-
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER
-            .get(value.toString(), String.valueOf(b));
-        invalidReason.append(message);
-        return false;
-      }
+final class IA5StringSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
     }
 
-    return true;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
+
+    public String getName() {
+        return SYNTAX_IA5_STRING_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We will allow any value that does not contain any non-ASCII
+        // characters. Empty values are acceptable as well.
+        byte b;
+        for (int i = 0; i < value.length(); i++) {
+            b = value.byteAt(i);
+            if ((b & 0x7F) != b) {
+
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_IA5_ILLEGAL_CHARACTER.get(value.toString(), String
+                                .valueOf(b));
+                invalidReason.append(message);
+                return false;
+            }
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java
index 346e18e..a87a2f7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -37,30 +34,23 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class defines the integerMatch matching rule defined in X.520 and
  * referenced in RFC 2252.
  */
-final class IntegerEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
+final class IntegerEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
 
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    try
-    {
-      return ByteString.valueOf(Integer.parseInt(value.toString()));
-    }
-    catch (final Exception e)
-    {
-      StaticUtils.DEBUG_LOG.throwing("IntegerEqualityMatchingRule",
-          "normalizeAttributeValue", e);
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        try {
+            return ByteString.valueOf(Integer.parseInt(value.toString()));
+        } catch (final Exception e) {
+            StaticUtils.DEBUG_LOG.throwing("IntegerEqualityMatchingRule",
+                    "normalizeAttributeValue", e);
 
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_ILLEGAL_INTEGER
-          .get(value.toString());
-      throw DecodeException.error(message);
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
+            throw DecodeException.error(message);
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
index 42f1806..43e226f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,20 +25,20 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EMPTY_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the integerFirstComponentMatch matching rule defined in
  * X.520 and referenced in RFC 2252. This rule is intended for use with
@@ -48,77 +47,65 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-final class IntegerFirstComponentEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
+final class IntegerFirstComponentEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
 
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    try
-    {
-      final String definition = value.toString();
-      final SubstringReader reader = new SubstringReader(definition);
-      final int intValue = SchemaUtils.readRuleID(reader);
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        try {
+            final String definition = value.toString();
+            final SubstringReader reader = new SubstringReader(definition);
+            final int intValue = SchemaUtils.readRuleID(reader);
 
-      return new Assertion()
-      {
-        public ConditionResult matches(final ByteSequence attributeValue)
-        {
-          final int actualIntValue = attributeValue.toByteString().toInt();
-          return intValue == actualIntValue ? ConditionResult.TRUE
-              : ConditionResult.FALSE;
+            return new Assertion() {
+                public ConditionResult matches(final ByteSequence attributeValue) {
+                    final int actualIntValue = attributeValue.toByteString().toInt();
+                    return intValue == actualIntValue ? ConditionResult.TRUE
+                            : ConditionResult.FALSE;
+                }
+            };
+        } catch (final Exception e) {
+            StaticUtils.DEBUG_LOG.throwing("IntegerFirstComponentEqualityMatchingRule",
+                    "getAssertion", e);
+
+            final LocalizableMessage message =
+                    ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT.get(value.toString());
+            throw DecodeException.error(message);
         }
-      };
-    }
-    catch (final Exception e)
-    {
-      StaticUtils.DEBUG_LOG.throwing(
-          "IntegerFirstComponentEqualityMatchingRule", "getAssertion", e);
 
-      final LocalizableMessage message = ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT
-          .get(value.toString());
-      throw DecodeException.error(message);
     }
 
-  }
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
 
+        // We'll do this a character at a time. First, skip over any leading
+        // whitespace.
+        reader.skipWhitespaces();
 
+        if (reader.remaining() <= 0) {
+            // This means that the value was empty or contained only
+            // whitespace. That is illegal.
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
+            throw DecodeException.error(message);
+        }
 
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
+        // The next character must be an open parenthesis. If it is not,
+        // then that is an error.
+        final char c = reader.read();
+        if (c != '(') {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1),
+                            String.valueOf(c));
+            throw DecodeException.error(message);
+        }
 
-    // We'll do this a character at a time. First, skip over any leading
-    // whitespace.
-    reader.skipWhitespaces();
+        // Skip over any spaces immediately following the opening
+        // parenthesis.
+        reader.skipWhitespaces();
 
-    if (reader.remaining() <= 0)
-    {
-      // This means that the value was empty or contained only
-      // whitespace. That is illegal.
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
-      throw DecodeException.error(message);
+        // The next set of characters must be the OID.
+        return ByteString.valueOf(SchemaUtils.readRuleID(reader));
     }
-
-    // The next character must be an open parenthesis. If it is not,
-    // then that is an error.
-    final char c = reader.read();
-    if (c != '(')
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS
-          .get(definition, (reader.pos() - 1), String.valueOf(c));
-      throw DecodeException.error(message);
-    }
-
-    // Skip over any spaces immediately following the opening
-    // parenthesis.
-    reader.skipWhitespaces();
-
-    // The next set of characters must be the OID.
-    return ByteString.valueOf(SchemaUtils.readRuleID(reader));
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java
index fd73297..9860c93 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -37,31 +34,23 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class defines the integerOrderingMatch matching rule defined in X.520
  * and referenced in RFC 4519.
  */
-final class IntegerOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
+final class IntegerOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
 
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    try
-    {
-      return ByteString.valueOf(Integer.parseInt(value.toString()));
-    }
-    catch (final Exception e)
-    {
-      StaticUtils.DEBUG_LOG.throwing("IntegerOrderingMatchingRule",
-          "normalizeAttributeValue", e);
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        try {
+            return ByteString.valueOf(Integer.parseInt(value.toString()));
+        } catch (final Exception e) {
+            StaticUtils.DEBUG_LOG.throwing("IntegerOrderingMatchingRule",
+                    "normalizeAttributeValue", e);
 
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_ILLEGAL_INTEGER
-          .get(value.toString());
-      throw DecodeException.error(message);
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString());
+            throw DecodeException.error(message);
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java
index 0cf17b6..ab6b15f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_INTEGER_DASH_NEEDS_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_INTEGER_EMPTY_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_INTEGER_INITIAL_ZERO;
@@ -41,187 +38,153 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class defines the integer attribute syntax, which holds an
  * arbitrarily-long integer value. Equality, ordering, and substring matching
  * will be allowed by default.
  */
-final class IntegerSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_INTEGER_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_INTEGER_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_INTEGER_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_EXACT_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String valueString = value.toString();
-    final int length = valueString.length();
-
-    if (length == 0)
-    {
-      invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_EMPTY_VALUE
-          .get(valueString));
-      return false;
+final class IntegerSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_INTEGER_OID;
     }
-    else if (length == 1)
-    {
-      switch (valueString.charAt(0))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
+
+    public String getName() {
+        return SYNTAX_INTEGER_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_INTEGER_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_EXACT_OID;
+    }
+
+    public boolean isHumanReadable() {
         return true;
-      case '-':
-        invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_DASH_NEEDS_VALUE
-            .get(valueString));
-        return false;
-      default:
-        invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(
-            valueString, valueString.charAt(0), 0));
-        return false;
-      }
     }
-    else
-    {
-      boolean negative = false;
 
-      switch (valueString.charAt(0))
-      {
-      case '0':
-        invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INITIAL_ZERO
-            .get(valueString));
-        return false;
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      case '-':
-        // This is fine too.
-        negative = true;
-        break;
-      default:
-        invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(
-            valueString, valueString.charAt(0), 0));
-        return false;
-      }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String valueString = value.toString();
+        final int length = valueString.length();
 
-      switch (valueString.charAt(1))
-      {
-      case '0':
-        // This is fine as long as the value isn't negative.
-        if (negative)
-        {
-          invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INITIAL_ZERO
-              .get(valueString));
-          return false;
+        if (length == 0) {
+            invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_EMPTY_VALUE.get(valueString));
+            return false;
+        } else if (length == 1) {
+            switch (valueString.charAt(0)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                return true;
+            case '-':
+                invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_DASH_NEEDS_VALUE.get(valueString));
+                return false;
+            default:
+                invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(valueString,
+                        valueString.charAt(0), 0));
+                return false;
+            }
+        } else {
+            boolean negative = false;
+
+            switch (valueString.charAt(0)) {
+            case '0':
+                invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INITIAL_ZERO.get(valueString));
+                return false;
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            case '-':
+                // This is fine too.
+                negative = true;
+                break;
+            default:
+                invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(valueString,
+                        valueString.charAt(0), 0));
+                return false;
+            }
+
+            switch (valueString.charAt(1)) {
+            case '0':
+                // This is fine as long as the value isn't negative.
+                if (negative) {
+                    invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INITIAL_ZERO.get(valueString));
+                    return false;
+                }
+                break;
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(valueString,
+                        valueString.charAt(0), 0));
+                return false;
+            }
+
+            for (int i = 2; i < length; i++) {
+                switch (valueString.charAt(i)) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                    // These are all fine.
+                    break;
+                default:
+                    invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(
+                            valueString, valueString.charAt(0), 0));
+                    return false;
+                }
+            }
+
+            return true;
         }
-        break;
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(
-            valueString, valueString.charAt(0), 0));
-        return false;
-      }
-
-      for (int i = 2; i < length; i++)
-      {
-        switch (valueString.charAt(i))
-        {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-          // These are all fine.
-          break;
-        default:
-          invalidReason.append(WARN_ATTR_SYNTAX_INTEGER_INVALID_CHARACTER.get(
-              valueString, valueString.charAt(0), 0));
-          return false;
-        }
-      }
-
-      return true;
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java
index e70c768..72d7c96 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_JPEG_NAME;
@@ -36,63 +33,47 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the JPEG attribute syntax. This should be restricted to
  * holding only JPEG image contents, but we will accept any set of bytes. It
  * will be treated much like the octet string attribute syntax.
  */
-final class JPEGSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+final class JPEGSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_JPEG_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_JPEG_NAME;
-  }
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the fax syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the fax syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java
index add3f0d..a860ee4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,15 +25,15 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
 
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 /**
  * This class implements the keywordMatch matching rule defined in X.520. That
@@ -55,125 +54,102 @@
  * <LI>An equal sign</LI>
  * </UL>
  */
-final class KeywordEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    final String normalStr = normalize(value);
+final class KeywordEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String normalStr = normalize(value);
 
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        // See if the assertion value is contained in the attribute
-        // value. If not, then it isn't a match.
-        final String valueStr1 = attributeValue.toString();
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                // See if the assertion value is contained in the attribute
+                // value. If not, then it isn't a match.
+                final String valueStr1 = attributeValue.toString();
 
-        final int pos = valueStr1.indexOf(normalStr);
-        if (pos < 0)
-        {
-          return ConditionResult.FALSE;
-        }
+                final int pos = valueStr1.indexOf(normalStr);
+                if (pos < 0) {
+                    return ConditionResult.FALSE;
+                }
 
-        if (pos > 0)
-        {
-          final char c = valueStr1.charAt(pos - 1);
-          switch (c)
-          {
-          case ' ':
-          case '.':
-          case ',':
-          case '/':
-          case '$':
-          case '+':
-          case '-':
-          case '_':
-          case '#':
-          case '=':
-            // These are all acceptable.
-            break;
+                if (pos > 0) {
+                    final char c = valueStr1.charAt(pos - 1);
+                    switch (c) {
+                    case ' ':
+                    case '.':
+                    case ',':
+                    case '/':
+                    case '$':
+                    case '+':
+                    case '-':
+                    case '_':
+                    case '#':
+                    case '=':
+                        // These are all acceptable.
+                        break;
 
-          default:
-            // Anything else is not.
-            return ConditionResult.FALSE;
-          }
-        }
+                    default:
+                        // Anything else is not.
+                        return ConditionResult.FALSE;
+                    }
+                }
 
-        if (valueStr1.length() > pos + normalStr.length())
-        {
-          final char c = valueStr1.charAt(pos + normalStr.length());
-          switch (c)
-          {
-          case ' ':
-          case '.':
-          case ',':
-          case '/':
-          case '$':
-          case '+':
-          case '-':
-          case '_':
-          case '#':
-          case '=':
-            // These are all acceptable.
-            break;
+                if (valueStr1.length() > pos + normalStr.length()) {
+                    final char c = valueStr1.charAt(pos + normalStr.length());
+                    switch (c) {
+                    case ' ':
+                    case '.':
+                    case ',':
+                    case '/':
+                    case '$':
+                    case '+':
+                    case '-':
+                    case '_':
+                    case '#':
+                    case '=':
+                        // These are all acceptable.
+                        break;
 
-          default:
-            // Anything else is not.
-            return ConditionResult.FALSE;
-          }
-        }
+                    default:
+                        // Anything else is not.
+                        return ConditionResult.FALSE;
+                    }
+                }
 
-        // If we've gotten here, then we can assume it is a match.
-        return ConditionResult.TRUE;
-      }
-    };
-  }
-
-
-
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return ByteString.valueOf(normalize(value));
-  }
-
-
-
-  private String normalize(final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return " ".intern();
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return "".intern();
-      }
+                // If we've gotten here, then we can assume it is a match.
+                return ConditionResult.TRUE;
+            }
+        };
     }
 
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-      }
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return ByteString.valueOf(normalize(value));
     }
 
-    return buffer.toString();
-  }
+    private String normalize(final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return " ".intern();
+            } else {
+                // The value is empty, so it is already normalized.
+                return "".intern();
+            }
+        }
+
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return buffer.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java
index 3cc60c1..74510ba 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,15 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_LDAP_SYNTAX_NAME;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.regex.Pattern;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -45,187 +46,151 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class defines the LDAP syntax description syntax, which is used to hold
  * attribute syntax definitions in the schema. The format of this syntax is
  * defined in RFC 2252.
  */
-final class LDAPSyntaxDescriptionSyntaxImpl extends AbstractSyntaxImpl
-{
+final class LDAPSyntaxDescriptionSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_LDAP_SYNTAX_NAME;
+    }
 
+    public boolean isHumanReadable() {
+        return true;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_LDAP_SYNTAX_NAME;
-  }
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeNameForm method to determine if the value is
+        // acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeNameForm method to determine if the value is
-    // acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the syntax. It is an
-          // arbitrary string of characters enclosed in single quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-
-      for (final Map.Entry<String, List<String>> property : extraProperties
-          .entrySet())
-      {
-        if (property.getKey().equalsIgnoreCase("x-pattern"))
-        {
-          final Iterator<String> values = property.getValue().iterator();
-          if (values.hasNext())
-          {
-            final String pattern = values.next();
-            try
-            {
-              Pattern.compile(values.next());
-            }
-            catch (final Exception e)
-            {
-              final LocalizableMessage message = WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN
-                  .get(oid, pattern);
-              final DecodeException de = DecodeException.error(message, e);
-              StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
-                  "valueIsAcceptable", de);
-              throw de;
-            }
-            break;
-          }
-        }
-        else if (property.getKey().equalsIgnoreCase("x-enum"))
-        {
-          final List<String> values = property.getValue();
-          for (int i = 0; i < values.size() - 1; i++)
-          {
-            final String entry = values.get(i);
-            for (int j = i + 1; j < values.size(); j++)
-            {
-              if (entry.equals(values.get(j)))
-              {
-                final LocalizableMessage message = WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE
-                    .get(oid, entry, j);
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1.get(definition);
                 final DecodeException e = DecodeException.error(message);
-                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
-                    "valueIsAcceptable", e);
+                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax", "valueIsAcceptable",
+                        e);
                 throw e;
-              }
             }
-          }
-        }
-      }
 
-      return true;
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax", "valueIsAcceptable",
+                        e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the syntax. It is an
+                    // arbitrary string of characters enclosed in single quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
+                            "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+
+            for (final Map.Entry<String, List<String>> property : extraProperties.entrySet()) {
+                if (property.getKey().equalsIgnoreCase("x-pattern")) {
+                    final Iterator<String> values = property.getValue().iterator();
+                    if (values.hasNext()) {
+                        final String pattern = values.next();
+                        try {
+                            Pattern.compile(values.next());
+                        } catch (final Exception e) {
+                            final LocalizableMessage message =
+                                    WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN.get(oid,
+                                            pattern);
+                            final DecodeException de = DecodeException.error(message, e);
+                            StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
+                                    "valueIsAcceptable", de);
+                            throw de;
+                        }
+                        break;
+                    }
+                } else if (property.getKey().equalsIgnoreCase("x-enum")) {
+                    final List<String> values = property.getValue();
+                    for (int i = 0; i < values.size() - 1; i++) {
+                        final String entry = values.get(i);
+                        for (int j = i + 1; j < values.size(); j++) {
+                            if (entry.equals(values.get(j))) {
+                                final LocalizableMessage message =
+                                        WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid,
+                                                entry, j);
+                                final DecodeException e = DecodeException.error(message);
+                                StaticUtils.DEBUG_LOG.throwing("LDAPSyntaxDescriptionSyntax",
+                                        "valueIsAcceptable", e);
+                                throw e;
+                            }
+                        }
+                    }
+                }
+            }
+
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_ATTRSYNTAX_INVALID1.get(definition, de
+                    .getMessageObject()));
+            return false;
+        }
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_ATTRSYNTAX_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java
index c77a0ca..1e1dd74 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,9 +26,8 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_MR_UNKNOWN_SYNTAX1;
+import static org.forgerock.opendj.ldap.CoreMessages.WARN_MATCHING_RULE_NOT_IMPLEMENTED1;
 
 import java.util.Comparator;
 import java.util.Iterator;
@@ -44,8 +42,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with matching
  * rules, which are used by servers to compare attribute values against
@@ -61,417 +57,331 @@
  * will be preserved when the associated fields are accessed via their getters
  * or via the {@link #toString()} methods.
  */
-public final class MatchingRule extends SchemaElement
-{
-  private final String oid;
-  private final List<String> names;
-  private final boolean isObsolete;
-  private final String syntaxOID;
-  private final String definition;
-  private MatchingRuleImpl impl;
-  private Syntax syntax;
-  private Schema schema;
+public final class MatchingRule extends SchemaElement {
+    private final String oid;
+    private final List<String> names;
+    private final boolean isObsolete;
+    private final String syntaxOID;
+    private final String definition;
+    private MatchingRuleImpl impl;
+    private Syntax syntax;
+    private Schema schema;
 
+    MatchingRule(final String oid, final List<String> names, final String description,
+            final boolean obsolete, final String syntax,
+            final Map<String, List<String>> extraProperties, final String definition,
+            final MatchingRuleImpl implementation) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid, names, description, syntax);
+        Validator.ensureNotNull(extraProperties);
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.syntaxOID = syntax;
 
-  MatchingRule(final String oid, final List<String> names,
-      final String description, final boolean obsolete, final String syntax,
-      final Map<String, List<String>> extraProperties, final String definition,
-      final MatchingRuleImpl implementation)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(oid, names, description, syntax);
-    Validator.ensureNotNull(extraProperties);
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.syntaxOID = syntax;
-
-    if (definition != null)
-    {
-      this.definition = definition;
-    }
-    else
-    {
-      this.definition = buildDefinition();
-    }
-    this.impl = implementation;
-  }
-
-
-
-  /**
-   * Get a comparator that can be used to compare the attribute values
-   * normalized by this matching rule.
-   *
-   * @return A comparator that can be used to compare the attribute values
-   *         normalized by this matching rule.
-   */
-  public Comparator<ByteSequence> comparator()
-  {
-    return impl.comparator(schema);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (o == null)
-    {
-      return false;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
+        this.impl = implementation;
     }
 
-    if (this == o)
-    {
-      return true;
+    /**
+     * Get a comparator that can be used to compare the attribute values
+     * normalized by this matching rule.
+     *
+     * @return A comparator that can be used to compare the attribute values
+     *         normalized by this matching rule.
+     */
+    public Comparator<ByteSequence> comparator() {
+        return impl.comparator(schema);
     }
 
-    if (!(o instanceof MatchingRule))
-    {
-      return false;
-    }
-
-    return getOID().equals(((MatchingRule) o).getOID());
-  }
-
-
-
-  /**
-   * Returns the normalized form of the provided assertion value, which is best
-   * suite for efficiently performing matching operations on that value. The
-   * assertion value is guarenteed to be valid against this matching rule's
-   * assertion syntax.
-   *
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if the syntax of the value is not valid.
-   */
-  public Assertion getAssertion(final ByteSequence value)
-      throws DecodeException
-  {
-    return impl.getAssertion(schema, value);
-  }
-
-
-
-  /**
-   * Returns the normalized form of the provided assertion substring values,
-   * which is best suite for efficiently performing matching operations on that
-   * value.
-   *
-   * @param subInitial
-   *          The normalized substring value fragment that should appear at the
-   *          beginning of the target value.
-   * @param subAnyElements
-   *          The normalized substring value fragments that should appear in the
-   *          middle of the target value.
-   * @param subFinal
-   *          The normalized substring value fragment that should appear at the
-   *          end of the target value.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if the syntax of the value is not valid.
-   */
-  public Assertion getAssertion(final ByteSequence subInitial,
-      final List<? extends ByteSequence> subAnyElements,
-      final ByteSequence subFinal) throws DecodeException
-  {
-    return impl.getAssertion(schema, subInitial, subAnyElements, subFinal);
-  }
-
-
-
-  /**
-   * Returns the normalized form of the provided assertion value, which is best
-   * suite for efficiently performing greater than or equal ordering matching
-   * operations on that value. The assertion value is guarenteed to be valid
-   * against this matching rule's assertion syntax.
-   *
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if the syntax of the value is not valid.
-   */
-  public Assertion getGreaterOrEqualAssertion(final ByteSequence value)
-      throws DecodeException
-  {
-    return impl.getGreaterOrEqualAssertion(schema, value);
-  }
-
-
-
-  /**
-   * Returns the normalized form of the provided assertion value, which is best
-   * suite for efficiently performing greater than or equal ordering matching
-   * operations on that value. The assertion value is guarenteed to be valid
-   * against this matching rule's assertion syntax.
-   *
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if the syntax of the value is not valid.
-   */
-  public Assertion getLessOrEqualAssertion(final ByteSequence value)
-      throws DecodeException
-  {
-    return impl.getLessOrEqualAssertion(schema, value);
-  }
-
-
-
-  /**
-   * Returns the name or OID for this schema definition. If it has one or more
-   * names, then the primary name will be returned. If it does not have any
-   * names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return oid;
-    }
-    return names.get(0);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Returns the OID for this schema definition.
-   *
-   * @return The OID for this schema definition.
-   */
-  public String getOID()
-  {
-
-    return oid;
-  }
-
-
-
-  /**
-   * Returns the OID of the assertion value syntax with which this matching rule
-   * is associated.
-   *
-   * @return The OID of the assertion value syntax with which this matching rule
-   *         is associated.
-   */
-  public Syntax getSyntax()
-  {
-    return syntax;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int hashCode()
-  {
-    return oid.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name or OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <code>true</code> if the provided value matches the OID or one of
-   *         the names assigned to this schema definition, or <code>false</code>
-   *         if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || getOID().equals(value);
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
-
-
-
-  /**
-   * Returns the normalized form of the provided attribute value, which is best
-   * suite for efficiently performing matching operations on that value.
-   *
-   * @param value
-   *          The attribute value to be normalized.
-   * @return The normalized version of the provided attribute value.
-   * @throws DecodeException
-   *           if the syntax of the value is not valid.
-   */
-  public ByteString normalizeAttributeValue(final ByteSequence value)
-      throws DecodeException
-  {
-    return impl.normalizeAttributeValue(schema, value);
-  }
-
-
-
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
-
-
-
-  MatchingRule duplicate()
-  {
-    return new MatchingRule(oid, names, description, isObsolete, syntaxOID,
-        extraProperties, definition, impl);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object o) {
+        if (o == null) {
+            return false;
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof MatchingRule)) {
+            return false;
+        }
+
+        return getOID().equals(((MatchingRule) o).getOID());
     }
 
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
+    /**
+     * Returns the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing matching operations on that value.
+     * The assertion value is guarenteed to be valid against this matching
+     * rule's assertion syntax.
+     *
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if the syntax of the value is not valid.
+     */
+    public Assertion getAssertion(final ByteSequence value) throws DecodeException {
+        return impl.getAssertion(schema, value);
     }
 
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
+    /**
+     * Returns the normalized form of the provided assertion substring values,
+     * which is best suite for efficiently performing matching operations on
+     * that value.
+     *
+     * @param subInitial
+     *            The normalized substring value fragment that should appear at
+     *            the beginning of the target value.
+     * @param subAnyElements
+     *            The normalized substring value fragments that should appear in
+     *            the middle of the target value.
+     * @param subFinal
+     *            The normalized substring value fragment that should appear at
+     *            the end of the target value.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if the syntax of the value is not valid.
+     */
+    public Assertion getAssertion(final ByteSequence subInitial,
+            final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal)
+            throws DecodeException {
+        return impl.getAssertion(schema, subInitial, subAnyElements, subFinal);
     }
 
-    buffer.append(" SYNTAX ");
-    buffer.append(syntaxOID);
-  }
-
-
-
-  void validate(final Schema schema, final List<LocalizableMessage> warnings)
-      throws SchemaException
-  {
-    // Try finding an implementation in the core schema
-    if (impl == null && Schema.getDefaultSchema().hasMatchingRule(oid))
-    {
-      impl = Schema.getDefaultSchema().getMatchingRule(oid).impl;
-    }
-    if (impl == null && Schema.getCoreSchema().hasMatchingRule(oid))
-    {
-      impl = Schema.getCoreSchema().getMatchingRule(oid).impl;
+    /**
+     * Returns the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing greater than or equal ordering
+     * matching operations on that value. The assertion value is guarenteed to
+     * be valid against this matching rule's assertion syntax.
+     *
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if the syntax of the value is not valid.
+     */
+    public Assertion getGreaterOrEqualAssertion(final ByteSequence value) throws DecodeException {
+        return impl.getGreaterOrEqualAssertion(schema, value);
     }
 
-    if (impl == null)
-    {
-      impl = Schema.getDefaultMatchingRule().impl;
-      final LocalizableMessage message = WARN_MATCHING_RULE_NOT_IMPLEMENTED1
-          .get(getNameOrOID(), Schema.getDefaultMatchingRule().getOID());
-      warnings.add(message);
+    /**
+     * Returns the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing greater than or equal ordering
+     * matching operations on that value. The assertion value is guarenteed to
+     * be valid against this matching rule's assertion syntax.
+     *
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if the syntax of the value is not valid.
+     */
+    public Assertion getLessOrEqualAssertion(final ByteSequence value) throws DecodeException {
+        return impl.getLessOrEqualAssertion(schema, value);
     }
 
-    try
-    {
-      // Make sure the specific syntax is defined in this schema.
-      syntax = schema.getSyntax(syntaxOID);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_UNKNOWN_SYNTAX1.get(
-          getNameOrOID(), syntaxOID);
-      throw new SchemaException(message, e);
+    /**
+     * Returns the name or OID for this schema definition. If it has one or more
+     * names, then the primary name will be returned. If it does not have any
+     * names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return oid;
+        }
+        return names.get(0);
     }
 
-    this.schema = schema;
-  }
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
+    }
+
+    /**
+     * Returns the OID for this schema definition.
+     *
+     * @return The OID for this schema definition.
+     */
+    public String getOID() {
+
+        return oid;
+    }
+
+    /**
+     * Returns the OID of the assertion value syntax with which this matching
+     * rule is associated.
+     *
+     * @return The OID of the assertion value syntax with which this matching
+     *         rule is associated.
+     */
+    public Syntax getSyntax() {
+        return syntax;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
+
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Indicates whether this schema definition has the specified name or OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <code>true</code> if the provided value matches the OID or one of
+     *         the names assigned to this schema definition, or
+     *         <code>false</code> if not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || getOID().equals(value);
+    }
+
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
+
+    /**
+     * Returns the normalized form of the provided attribute value, which is
+     * best suite for efficiently performing matching operations on that value.
+     *
+     * @param value
+     *            The attribute value to be normalized.
+     * @return The normalized version of the provided attribute value.
+     * @throws DecodeException
+     *             if the syntax of the value is not valid.
+     */
+    public ByteString normalizeAttributeValue(final ByteSequence value) throws DecodeException {
+        return impl.normalizeAttributeValue(schema, value);
+    }
+
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
+
+    MatchingRule duplicate() {
+        return new MatchingRule(oid, names, description, isObsolete, syntaxOID, extraProperties,
+                definition, impl);
+    }
+
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
+
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
+        }
+
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
+        }
+
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
+        }
+
+        buffer.append(" SYNTAX ");
+        buffer.append(syntaxOID);
+    }
+
+    void validate(final Schema schema, final List<LocalizableMessage> warnings)
+            throws SchemaException {
+        // Try finding an implementation in the core schema
+        if (impl == null && Schema.getDefaultSchema().hasMatchingRule(oid)) {
+            impl = Schema.getDefaultSchema().getMatchingRule(oid).impl;
+        }
+        if (impl == null && Schema.getCoreSchema().hasMatchingRule(oid)) {
+            impl = Schema.getCoreSchema().getMatchingRule(oid).impl;
+        }
+
+        if (impl == null) {
+            impl = Schema.getDefaultMatchingRule().impl;
+            final LocalizableMessage message =
+                    WARN_MATCHING_RULE_NOT_IMPLEMENTED1.get(getNameOrOID(), Schema
+                            .getDefaultMatchingRule().getOID());
+            warnings.add(message);
+        }
+
+        try {
+            // Make sure the specific syntax is defined in this schema.
+            syntax = schema.getSyntax(syntaxOID);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_MR_UNKNOWN_SYNTAX1.get(getNameOrOID(), syntaxOID);
+            throw new SchemaException(message, e);
+        }
+
+        this.schema = schema;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java
index c322bc9..99fc96e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import java.util.Comparator;
 import java.util.List;
 
@@ -36,122 +33,108 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This interface defines the set of methods that must be implemented to define
  * a new matching rule.
  */
-public interface MatchingRuleImpl
-{
-  /**
-   * Get a comparator that can be used to compare the attribute values
-   * normalized by this matching rule.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @return A comparator that can be used to compare the attribute values
-   *         normalized by this matching rule.
-   */
-  public Comparator<ByteSequence> comparator(Schema schema);
+public interface MatchingRuleImpl {
+    /**
+     * Get a comparator that can be used to compare the attribute values
+     * normalized by this matching rule.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @return A comparator that can be used to compare the attribute values
+     *         normalized by this matching rule.
+     */
+    public Comparator<ByteSequence> comparator(Schema schema);
 
+    /**
+     * Retrieves the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing matching operations on that value.
+     * The assertion value is guarenteed to be valid against this matching
+     * rule's assertion syntax.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if an syntax error occured while parsing the value.
+     */
+    public Assertion getAssertion(Schema schema, ByteSequence value) throws DecodeException;
 
+    /**
+     * Retrieves the normalized form of the provided assertion substring values,
+     * which is best suite for efficiently performing matching operations on
+     * that value.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @param subInitial
+     *            The normalized substring value fragment that should appear at
+     *            the beginning of the target value.
+     * @param subAnyElements
+     *            The normalized substring value fragments that should appear in
+     *            the middle of the target value.
+     * @param subFinal
+     *            The normalized substring value fragment that should appear at
+     *            the end of the target value.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if an syntax error occured while parsing the value.
+     */
+    public Assertion getAssertion(Schema schema, ByteSequence subInitial,
+            List<? extends ByteSequence> subAnyElements, ByteSequence subFinal)
+            throws DecodeException;
 
-  /**
-   * Retrieves the normalized form of the provided assertion value, which is
-   * best suite for efficiently performing matching operations on that value.
-   * The assertion value is guarenteed to be valid against this matching rule's
-   * assertion syntax.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if an syntax error occured while parsing the value.
-   */
-  public Assertion getAssertion(Schema schema, ByteSequence value)
-      throws DecodeException;
+    /**
+     * Retrieves the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing greater than or equal matching
+     * operations on that value. The assertion value is guarenteed to be valid
+     * against this matching rule's assertion syntax.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if an syntax error occured while parsing the value.
+     */
+    public Assertion getGreaterOrEqualAssertion(Schema schema, ByteSequence value)
+            throws DecodeException;
 
+    /**
+     * Retrieves the normalized form of the provided assertion value, which is
+     * best suite for efficiently performing greater than or equal matching
+     * operations on that value. The assertion value is guarenteed to be valid
+     * against this matching rule's assertion syntax.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @param value
+     *            The syntax checked assertion value to be normalized.
+     * @return The normalized version of the provided assertion value.
+     * @throws DecodeException
+     *             if an syntax error occured while parsing the value.
+     */
+    public Assertion getLessOrEqualAssertion(Schema schema, ByteSequence value)
+            throws DecodeException;
 
-
-  /**
-   * Retrieves the normalized form of the provided assertion substring values,
-   * which is best suite for efficiently performing matching operations on that
-   * value.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @param subInitial
-   *          The normalized substring value fragment that should appear at the
-   *          beginning of the target value.
-   * @param subAnyElements
-   *          The normalized substring value fragments that should appear in the
-   *          middle of the target value.
-   * @param subFinal
-   *          The normalized substring value fragment that should appear at the
-   *          end of the target value.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if an syntax error occured while parsing the value.
-   */
-  public Assertion getAssertion(Schema schema, ByteSequence subInitial,
-      List<? extends ByteSequence> subAnyElements, ByteSequence subFinal)
-      throws DecodeException;
-
-
-
-  /**
-   * Retrieves the normalized form of the provided assertion value, which is
-   * best suite for efficiently performing greater than or equal matching
-   * operations on that value. The assertion value is guarenteed to be valid
-   * against this matching rule's assertion syntax.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if an syntax error occured while parsing the value.
-   */
-  public Assertion getGreaterOrEqualAssertion(Schema schema, ByteSequence value)
-      throws DecodeException;
-
-
-
-  /**
-   * Retrieves the normalized form of the provided assertion value, which is
-   * best suite for efficiently performing greater than or equal matching
-   * operations on that value. The assertion value is guarenteed to be valid
-   * against this matching rule's assertion syntax.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @param value
-   *          The syntax checked assertion value to be normalized.
-   * @return The normalized version of the provided assertion value.
-   * @throws DecodeException
-   *           if an syntax error occured while parsing the value.
-   */
-  public Assertion getLessOrEqualAssertion(Schema schema, ByteSequence value)
-      throws DecodeException;
-
-
-
-  /**
-   * Retrieves the normalized form of the provided attribute value, which is
-   * best suite for efficiently performing matching operations on that value.
-   *
-   * @param schema
-   *          The schema in which this matching rule is defined.
-   * @param value
-   *          The attribute value to be normalized.
-   * @return The normalized version of the provided attribute value.
-   * @throws DecodeException
-   *           if an syntax error occured while parsing the value.
-   */
-  public ByteString normalizeAttributeValue(Schema schema, ByteSequence value)
-      throws DecodeException;
+    /**
+     * Retrieves the normalized form of the provided attribute value, which is
+     * best suite for efficiently performing matching operations on that value.
+     *
+     * @param schema
+     *            The schema in which this matching rule is defined.
+     * @param value
+     *            The attribute value to be normalized.
+     * @return The normalized version of the provided attribute value.
+     * @throws DecodeException
+     *             if an syntax error occured while parsing the value.
+     */
+    public ByteString normalizeAttributeValue(Schema schema, ByteSequence value)
+            throws DecodeException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java
index 6f00952..2e65238 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,9 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_NAME;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -41,177 +39,139 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the matching rule description syntax, which is used to
  * hold matching rule definitions in the server schema. The format of this
  * syntax is defined in RFC 2252.
  */
-final class MatchingRuleSyntaxImpl extends AbstractSyntaxImpl
-{
+final class MatchingRuleSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_MATCHING_RULE_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeMatchingRule method to determine if the value
-    // is acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-      String syntax = null;
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the matching rule. It is
-          // an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the matching rule should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("syntax"))
-        {
-          syntax = SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-
-      // Make sure that a syntax was specified.
-      if (syntax == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_MR_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_MATCHING_RULE_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeMatchingRule method to determine if the value
+        // is acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+            String syntax = null;
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the matching rule. It
+                    // is
+                    // an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the matching rule should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("syntax")) {
+                    syntax = SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+
+            // Make sure that a syntax was specified.
+            if (syntax == null) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason
+                    .append(ERR_ATTR_SYNTAX_MR_INVALID1.get(definition, de.getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java
index 1bd90c5..b582c50 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,344 +26,274 @@
 
 package org.forgerock.opendj.ldap.schema;
 
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_MATCHING_RULE1;
 
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with a
  * matching rule use definition, which may be used to restrict the set of
  * attribute types that may be used for a given matching rule.
  */
-public final class MatchingRuleUse extends SchemaElement
-{
-  // The OID of the matching rule associated with this matching rule
-  // use definition.
-  private final String oid;
+public final class MatchingRuleUse extends SchemaElement {
+    // The OID of the matching rule associated with this matching rule
+    // use definition.
+    private final String oid;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // The set of attribute types with which this matching rule use is
-  // associated.
-  private final Set<String> attributeOIDs;
+    // The set of attribute types with which this matching rule use is
+    // associated.
+    private final Set<String> attributeOIDs;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  private MatchingRule matchingRule;
-  private Set<AttributeType> attributes = Collections.emptySet();
+    private MatchingRule matchingRule;
+    private Set<AttributeType> attributes = Collections.emptySet();
 
+    MatchingRuleUse(final String oid, final List<String> names, final String description,
+            final boolean obsolete, final Set<String> attributeOIDs,
+            final Map<String, List<String>> extraProperties, final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid, names, attributeOIDs);
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.attributeOIDs = attributeOIDs;
 
-  MatchingRuleUse(final String oid, final List<String> names,
-      final String description, final boolean obsolete,
-      final Set<String> attributeOIDs,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(oid, names, attributeOIDs);
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.attributeOIDs = attributeOIDs;
-
-    if (definition != null)
-    {
-      this.definition = definition;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
     }
-    else
-    {
-      this.definition = buildDefinition();
+
+    /**
+     * Returns an unmodifiable set containing the attributes associated with
+     * this matching rule use.
+     *
+     * @return An unmodifiable set containing the attributes associated with
+     *         this matching rule use.
+     */
+    public Set<AttributeType> getAttributes() {
+        return attributes;
     }
-  }
 
-
-
-  /**
-   * Returns an unmodifiable set containing the attributes associated with this
-   * matching rule use.
-   *
-   * @return An unmodifiable set containing the attributes associated with this
-   *         matching rule use.
-   */
-  public Set<AttributeType> getAttributes()
-  {
-    return attributes;
-  }
-
-
-
-  /**
-   * Returns the matching rule for this matching rule use.
-   *
-   * @return The matching rule for this matching rule use.
-   */
-  public MatchingRule getMatchingRule()
-  {
-    return matchingRule;
-  }
-
-
-
-  /**
-   * Returns the matching rule OID for this schema definition.
-   *
-   * @return The OID for this schema definition.
-   */
-  public String getMatchingRuleOID()
-  {
-    return oid;
-  }
-
-
-
-  /**
-   * Returns the name or matching rule OID for this schema definition. If it has
-   * one or more names, then the primary name will be returned. If it does not
-   * have any names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return oid;
+    /**
+     * Returns the matching rule for this matching rule use.
+     *
+     * @return The matching rule for this matching rule use.
+     */
+    public MatchingRule getMatchingRule() {
+        return matchingRule;
     }
-    return names.get(0);
-  }
 
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Indicates whether the provided attribute type is referenced by this
-   * matching rule use.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return {@code true} if the provided attribute type is referenced by this
-   *         matching rule use, or {@code false} if it is not.
-   */
-  public boolean hasAttribute(final AttributeType attributeType)
-  {
-    return attributes.contains(attributeType);
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return oid.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
+    /**
+     * Returns the matching rule OID for this schema definition.
+     *
+     * @return The OID for this schema definition.
+     */
+    public String getMatchingRuleOID() {
+        return oid;
     }
-    return false;
-  }
 
+    /**
+     * Returns the name or matching rule OID for this schema definition. If it
+     * has one or more names, then the primary name will be returned. If it does
+     * not have any names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return oid;
+        }
+        return names.get(0);
+    }
 
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
+    }
 
-  /**
-   * Indicates whether this schema definition has the specified name or matching
-   * rule OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <code>true</code> if the provided value matches the OID or one of
-   *         the names assigned to this schema definition, or <code>false</code>
-   *         if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || oid.equals(value);
-  }
+    /**
+     * Indicates whether the provided attribute type is referenced by this
+     * matching rule use.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return {@code true} if the provided attribute type is referenced by this
+     *         matching rule use, or {@code false} if it is not.
+     */
+    public boolean hasAttribute(final AttributeType attributeType) {
+        return attributes.contains(attributeType);
+    }
 
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
 
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
 
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
+    /**
+     * Indicates whether this schema definition has the specified name or
+     * matching rule OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <code>true</code> if the provided value matches the OID or one of
+     *         the names assigned to this schema definition, or
+     *         <code>false</code> if not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || oid.equals(value);
+    }
 
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
 
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
 
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
+    MatchingRuleUse duplicate() {
+        return new MatchingRuleUse(oid, names, description, isObsolete, attributeOIDs,
+                extraProperties, definition);
+    }
 
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
 
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
 
-  MatchingRuleUse duplicate()
-  {
-    return new MatchingRuleUse(oid, names, description, isObsolete,
-        attributeOIDs, extraProperties, definition);
-  }
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
 
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
 
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
-    }
-
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
-    }
-
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
-
-    if (!attributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = attributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" APPLIES ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" APPLIES ");
-        buffer.append(firstName);
-      }
-    }
-  }
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
+        }
 
+        if (!attributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = attributeOIDs.iterator();
 
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" APPLIES ( ");
+                buffer.append(firstName);
 
-  void validate(final Schema schema, final List<LocalizableMessage> warnings)
-      throws SchemaException
-  {
-    try
-    {
-      matchingRule = schema.getMatchingRule(oid);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // This is bad because the matching rule use is associated with a
-      // matching rule that we don't know anything about.
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_MATCHING_RULE1
-          .get(getNameOrOID(), oid);
-      throw new SchemaException(message, e);
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" APPLIES ");
+                buffer.append(firstName);
+            }
+        }
     }
 
-    attributes = new HashSet<AttributeType>(attributeOIDs.size());
-    AttributeType attributeType;
-    for (final String attribute : attributeOIDs)
-    {
-      try
-      {
-        attributeType = schema.getAttributeType(attribute);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR1
-            .get(getNameOrOID(), attribute);
-        throw new SchemaException(message, e);
-      }
-      attributes.add(attributeType);
+    void validate(final Schema schema, final List<LocalizableMessage> warnings)
+            throws SchemaException {
+        try {
+            matchingRule = schema.getMatchingRule(oid);
+        } catch (final UnknownSchemaElementException e) {
+            // This is bad because the matching rule use is associated with a
+            // matching rule that we don't know anything about.
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_MATCHING_RULE1.get(getNameOrOID(), oid);
+            throw new SchemaException(message, e);
+        }
+
+        attributes = new HashSet<AttributeType>(attributeOIDs.size());
+        AttributeType attributeType;
+        for (final String attribute : attributeOIDs) {
+            try {
+                attributeType = schema.getAttributeType(attribute);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR1.get(getNameOrOID(), attribute);
+                throw new SchemaException(message, e);
+            }
+            attributes.add(attributeType);
+        }
+        attributes = Collections.unmodifiableSet(attributes);
     }
-    attributes = Collections.unmodifiableSet(attributes);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java
index 3d810aa..d772b82 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,9 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_USE_NAME;
 
 import java.util.Set;
 
@@ -43,177 +41,140 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the matching rule use description syntax, which is used
  * to hold matching rule use definitions in the server schema. The format of
  * this syntax is defined in RFC 2252.
  */
-final class MatchingRuleUseSyntaxImpl extends AbstractSyntaxImpl
-{
+final class MatchingRuleUseSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_MATCHING_RULE_USE_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeAttributeType method to determine if the
-    // value is acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      Set<String> attributes = null;
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("applies"))
-        {
-          attributes = SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-
-      // Make sure that the set of attributes was defined.
-      if (attributes == null || attributes.size() == 0)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_MRUSE_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_MATCHING_RULE_USE_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeAttributeType method to determine if the
+        // value is acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            Set<String> attributes = null;
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("applies")) {
+                    attributes =
+                            SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+
+            // Make sure that the set of attributes was defined.
+            if (attributes == null || attributes.size() == 0) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("MatchingRuleUseSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_MRUSE_INVALID1.get(definition, de
+                    .getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java
index 47512bb..50dccae 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,122 +26,99 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAMEANDUID_ILLEGAL_BINARY_DIGIT;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAMEANDUID_INVALID_DN;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_UNIQUE_MEMBER_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_NAME_AND_OPTIONAL_UID_NAME;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.DN;
 
-
-
 /**
  * This class implements the name and optional UID attribute syntax, which holds
  * values consisting of a DN, optionally followed by an octothorpe (#) and a bit
  * string value.
  */
-final class NameAndOptionalUIDSyntaxImpl extends AbstractSyntaxImpl
-{
+final class NameAndOptionalUIDSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_UNIQUE_MEMBER_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_NAME_AND_OPTIONAL_UID_NAME;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String valueString = value.toString().trim();
-    final int valueLength = valueString.length();
-
-    // See if the value contains the "optional uid" portion. If we think
-    // it does, then mark its location.
-    int dnEndPos = valueLength;
-    int sharpPos = -1;
-    if (valueString.endsWith("'B") || valueString.endsWith("'b"))
-    {
-      sharpPos = valueString.lastIndexOf("#'");
-      if (sharpPos > 0)
-      {
-        dnEndPos = sharpPos;
-      }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_UNIQUE_MEMBER_OID;
     }
 
-    // Take the DN portion of the string and try to normalize it.
-    try
-    {
-      DN.valueOf(valueString.substring(0, dnEndPos), schema);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      // We couldn't normalize the DN for some reason. The value cannot
-      // be acceptable.
-      invalidReason.append(ERR_ATTR_SYNTAX_NAMEANDUID_INVALID_DN.get(
-          valueString, e.getMessageObject()));
-      return false;
+    public String getName() {
+        return SYNTAX_NAME_AND_OPTIONAL_UID_NAME;
     }
 
-    // If there is an "optional uid", then normalize it and make sure it
-    // only contains valid binary digits.
-    if (sharpPos > 0)
-    {
-      final int endPos = valueLength - 2;
-      for (int i = sharpPos + 2; i < endPos; i++)
-      {
-        final char c = valueString.charAt(i);
-        if (!(c == '0' || c == '1'))
-        {
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
 
-          invalidReason.append(ERR_ATTR_SYNTAX_NAMEANDUID_ILLEGAL_BINARY_DIGIT
-              .get(valueString, String.valueOf(c), i));
-          return false;
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String valueString = value.toString().trim();
+        final int valueLength = valueString.length();
+
+        // See if the value contains the "optional uid" portion. If we think
+        // it does, then mark its location.
+        int dnEndPos = valueLength;
+        int sharpPos = -1;
+        if (valueString.endsWith("'B") || valueString.endsWith("'b")) {
+            sharpPos = valueString.lastIndexOf("#'");
+            if (sharpPos > 0) {
+                dnEndPos = sharpPos;
+            }
         }
-      }
-    }
 
-    // If we've gotten here, then the value is acceptable.
-    return true;
-  }
+        // Take the DN portion of the string and try to normalize it.
+        try {
+            DN.valueOf(valueString.substring(0, dnEndPos), schema);
+        } catch (final LocalizedIllegalArgumentException e) {
+            // We couldn't normalize the DN for some reason. The value cannot
+            // be acceptable.
+            invalidReason.append(ERR_ATTR_SYNTAX_NAMEANDUID_INVALID_DN.get(valueString, e
+                    .getMessageObject()));
+            return false;
+        }
+
+        // If there is an "optional uid", then normalize it and make sure it
+        // only contains valid binary digits.
+        if (sharpPos > 0) {
+            final int endPos = valueLength - 2;
+            for (int i = sharpPos + 2; i < endPos; i++) {
+                final char c = valueString.charAt(i);
+                if (!(c == '0' || c == '1')) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_NAMEANDUID_ILLEGAL_BINARY_DIGIT.get(
+                            valueString, String.valueOf(c), i));
+                    return false;
+                }
+            }
+        }
+
+        // If we've gotten here, then the value is acceptable.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
index cce207d..7a0273e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,469 +27,376 @@
 
 package org.forgerock.opendj.ldap.schema;
 
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_STRUCTURAL_CLASS_NOT_STRUCTURAL1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_STRUCTURAL_CLASS1;
 
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with a name
  * form, which defines the attribute type(s) that must and/or may be used in the
  * RDN of an entry with a given structural objectclass.
  */
-public final class NameForm extends SchemaElement
-{
-  // The OID that may be used to reference this definition.
-  private final String oid;
+public final class NameForm extends SchemaElement {
+    // The OID that may be used to reference this definition.
+    private final String oid;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // The reference to the structural objectclass for this name form.
-  private final String structuralClassOID;
+    // The reference to the structural objectclass for this name form.
+    private final String structuralClassOID;
 
-  // The set of optional attribute types for this name form.
-  private final Set<String> optionalAttributeOIDs;
+    // The set of optional attribute types for this name form.
+    private final Set<String> optionalAttributeOIDs;
 
-  // The set of required attribute types for this name form.
-  private final Set<String> requiredAttributeOIDs;
+    // The set of required attribute types for this name form.
+    private final Set<String> requiredAttributeOIDs;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  private ObjectClass structuralClass;
-  private Set<AttributeType> optionalAttributes = Collections.emptySet();
-  private Set<AttributeType> requiredAttributes = Collections.emptySet();
+    private ObjectClass structuralClass;
+    private Set<AttributeType> optionalAttributes = Collections.emptySet();
+    private Set<AttributeType> requiredAttributes = Collections.emptySet();
 
+    NameForm(final String oid, final List<String> names, final String description,
+            final boolean obsolete, final String structuralClassOID,
+            final Set<String> requiredAttributeOIDs, final Set<String> optionalAttributeOIDs,
+            final Map<String, List<String>> extraProperties, final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid, names);
+        Validator.ensureNotNull(structuralClassOID, requiredAttributeOIDs, optionalAttributeOIDs);
+        Validator.ensureTrue(requiredAttributeOIDs.size() > 0, "required attribute is empty");
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.structuralClassOID = structuralClassOID;
+        this.requiredAttributeOIDs = requiredAttributeOIDs;
+        this.optionalAttributeOIDs = optionalAttributeOIDs;
 
-  NameForm(final String oid, final List<String> names,
-      final String description, final boolean obsolete,
-      final String structuralClassOID, final Set<String> requiredAttributeOIDs,
-      final Set<String> optionalAttributeOIDs,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(oid, names);
-    Validator.ensureNotNull(structuralClassOID, requiredAttributeOIDs,
-        optionalAttributeOIDs);
-    Validator.ensureTrue(requiredAttributeOIDs.size() > 0,
-        "required attribute is empty");
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.structuralClassOID = structuralClassOID;
-    this.requiredAttributeOIDs = requiredAttributeOIDs;
-    this.optionalAttributeOIDs = optionalAttributeOIDs;
-
-    if (definition != null)
-    {
-      this.definition = definition;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
     }
-    else
-    {
-      this.definition = buildDefinition();
+
+    /**
+     * Returns the name or OID for this schema definition. If it has one or more
+     * names, then the primary name will be returned. If it does not have any
+     * names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return oid;
+        }
+        return names.get(0);
     }
-  }
 
-
-
-  /**
-   * Returns the name or OID for this schema definition. If it has one or more
-   * names, then the primary name will be returned. If it does not have any
-   * names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return oid;
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
     }
-    return names.get(0);
-  }
 
+    /**
+     * Returns the OID for this schema definition.
+     *
+     * @return The OID for this schema definition.
+     */
+    public String getOID() {
 
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Returns the OID for this schema definition.
-   *
-   * @return The OID for this schema definition.
-   */
-  public String getOID()
-  {
-
-    return oid;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the optional attributes for this
-   * name form.
-   *
-   * @return An unmodifiable set containing the optional attributes for this
-   *         name form.
-   */
-  public Set<AttributeType> getOptionalAttributes()
-  {
-    return optionalAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the required attributes for this
-   * name form.
-   *
-   * @return An unmodifiable set containing the required attributes for this
-   *         name form.
-   */
-  public Set<AttributeType> getRequiredAttributes()
-  {
-    return requiredAttributes;
-  }
-
-
-
-  /**
-   * Returns the reference to the structural objectclass for this name form.
-   *
-   * @return The reference to the structural objectclass for this name form.
-   */
-  public ObjectClass getStructuralClass()
-  {
-    return structuralClass;
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return oid.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
+        return oid;
     }
-    return false;
-  }
 
+    /**
+     * Returns an unmodifiable set containing the optional attributes for this
+     * name form.
+     *
+     * @return An unmodifiable set containing the optional attributes for this
+     *         name form.
+     */
+    public Set<AttributeType> getOptionalAttributes() {
+        return optionalAttributes;
+    }
 
+    /**
+     * Returns an unmodifiable set containing the required attributes for this
+     * name form.
+     *
+     * @return An unmodifiable set containing the required attributes for this
+     *         name form.
+     */
+    public Set<AttributeType> getRequiredAttributes() {
+        return requiredAttributes;
+    }
 
-  /**
-   * Indicates whether this schema definition has the specified name or OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <code>true</code> if the provided value matches the OID or one of
-   *         the names assigned to this schema definition, or <code>false</code>
-   *         if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || getOID().equals(value);
-  }
+    /**
+     * Returns the reference to the structural objectclass for this name form.
+     *
+     * @return The reference to the structural objectclass for this name form.
+     */
+    public ObjectClass getStructuralClass() {
+        return structuralClass;
+    }
 
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
 
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
 
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
+    /**
+     * Indicates whether this schema definition has the specified name or OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <code>true</code> if the provided value matches the OID or one of
+     *         the names assigned to this schema definition, or
+     *         <code>false</code> if not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || getOID().equals(value);
+    }
 
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
 
+    /**
+     * Indicates whether the provided attribute type is included in the optional
+     * attribute list for this name form.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is optional for
+     *         this name form, or <code>false</code> if not.
+     */
+    public boolean isOptional(final AttributeType attributeType) {
+        return optionalAttributes.contains(attributeType);
+    }
 
-  /**
-   * Indicates whether the provided attribute type is included in the optional
-   * attribute list for this name form.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is optional for
-   *         this name form, or <code>false</code> if not.
-   */
-  public boolean isOptional(final AttributeType attributeType)
-  {
-    return optionalAttributes.contains(attributeType);
-  }
+    /**
+     * Indicates whether the provided attribute type is included in the required
+     * attribute list for this name form.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required by
+     *         this name form, or <code>false</code> if not.
+     */
+    public boolean isRequired(final AttributeType attributeType) {
+        return requiredAttributes.contains(attributeType);
+    }
 
+    /**
+     * Indicates whether the provided attribute type is in the list of required
+     * or optional attributes for this name form.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required or
+     *         allowed for this name form, or <code>false</code> if it is not.
+     */
+    public boolean isRequiredOrOptional(final AttributeType attributeType) {
+        return isRequired(attributeType) || isOptional(attributeType);
+    }
 
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
 
-  /**
-   * Indicates whether the provided attribute type is included in the required
-   * attribute list for this name form.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required by
-   *         this name form, or <code>false</code> if not.
-   */
-  public boolean isRequired(final AttributeType attributeType)
-  {
-    return requiredAttributes.contains(attributeType);
-  }
+    NameForm duplicate() {
+        return new NameForm(oid, names, description, isObsolete, structuralClassOID,
+                requiredAttributeOIDs, optionalAttributeOIDs, extraProperties, definition);
+    }
 
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
 
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
 
-  /**
-   * Indicates whether the provided attribute type is in the list of required or
-   * optional attributes for this name form.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required or
-   *         allowed for this name form, or <code>false</code> if it is
-   *         not.
-   */
-  public boolean isRequiredOrOptional(final AttributeType attributeType)
-  {
-    return isRequired(attributeType) || isOptional(attributeType);
-  }
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
 
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
 
-
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
-
-
-
-  NameForm duplicate()
-  {
-    return new NameForm(oid, names, description, isObsolete,
-        structuralClassOID, requiredAttributeOIDs, optionalAttributeOIDs,
-        extraProperties, definition);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
-    }
-
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
-    }
-
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
-
-    buffer.append(" OC ");
-    buffer.append(structuralClassOID);
-
-    if (!requiredAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = requiredAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MUST ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MUST ");
-        buffer.append(firstName);
-      }
-    }
-
-    if (!optionalAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = optionalAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MAY ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MAY ");
-        buffer.append(firstName);
-      }
-    }
-  }
+        buffer.append(" OC ");
+        buffer.append(structuralClassOID);
 
+        if (!requiredAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = requiredAttributeOIDs.iterator();
 
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MUST ( ");
+                buffer.append(firstName);
 
-  void validate(final Schema schema, final List<LocalizableMessage> warnings)
-      throws SchemaException
-  {
-    try
-    {
-      structuralClass = schema.getObjectClass(structuralClassOID);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message =
-        ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_STRUCTURAL_CLASS1
-          .get(getNameOrOID(), structuralClassOID);
-      throw new SchemaException(message, e);
-    }
-    if (structuralClass.getObjectClassType() != ObjectClassType.STRUCTURAL)
-    {
-      // This is bad because the associated structural class type is not
-      // structural.
-      final LocalizableMessage message =
-        ERR_ATTR_SYNTAX_NAME_FORM_STRUCTURAL_CLASS_NOT_STRUCTURAL1
-          .get(getNameOrOID(), structuralClass.getNameOrOID(),
-              String.valueOf(structuralClass.getObjectClassType()));
-      throw new SchemaException(message);
-    }
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
 
-    requiredAttributes = new HashSet<AttributeType>(requiredAttributeOIDs
-        .size());
-    AttributeType attributeType;
-    for (final String oid : requiredAttributeOIDs)
-    {
-      try
-      {
-        attributeType = schema.getAttributeType(oid);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        // This isn't good because it means that the name form requires
-        // an attribute type that we don't know anything about.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR1
-            .get(getNameOrOID(), oid);
-        throw new SchemaException(message, e);
-      }
-      requiredAttributes.add(attributeType);
-    }
-
-    if (!optionalAttributeOIDs.isEmpty())
-    {
-      optionalAttributes = new HashSet<AttributeType>(optionalAttributeOIDs
-          .size());
-      for (final String oid : optionalAttributeOIDs)
-      {
-        try
-        {
-          attributeType = schema.getAttributeType(oid);
+                buffer.append(" )");
+            } else {
+                buffer.append(" MUST ");
+                buffer.append(firstName);
+            }
         }
-        catch (final UnknownSchemaElementException e)
-        {
-          // This isn't good because it means that the name form
-          // requires an attribute type that we don't know anything
-          // about.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR1
-              .get(getNameOrOID(), oid);
-          throw new SchemaException(message, e);
+
+        if (!optionalAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = optionalAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MAY ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" MAY ");
+                buffer.append(firstName);
+            }
         }
-        optionalAttributes.add(attributeType);
-      }
     }
 
-    optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
-    requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
-  }
+    void validate(final Schema schema, final List<LocalizableMessage> warnings)
+            throws SchemaException {
+        try {
+            structuralClass = schema.getObjectClass(structuralClassOID);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_STRUCTURAL_CLASS1.get(getNameOrOID(),
+                            structuralClassOID);
+            throw new SchemaException(message, e);
+        }
+        if (structuralClass.getObjectClassType() != ObjectClassType.STRUCTURAL) {
+            // This is bad because the associated structural class type is not
+            // structural.
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_NAME_FORM_STRUCTURAL_CLASS_NOT_STRUCTURAL1.get(getNameOrOID(),
+                            structuralClass.getNameOrOID(), String.valueOf(structuralClass
+                                    .getObjectClassType()));
+            throw new SchemaException(message);
+        }
+
+        requiredAttributes = new HashSet<AttributeType>(requiredAttributeOIDs.size());
+        AttributeType attributeType;
+        for (final String oid : requiredAttributeOIDs) {
+            try {
+                attributeType = schema.getAttributeType(oid);
+            } catch (final UnknownSchemaElementException e) {
+                // This isn't good because it means that the name form requires
+                // an attribute type that we don't know anything about.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR1.get(getNameOrOID(), oid);
+                throw new SchemaException(message, e);
+            }
+            requiredAttributes.add(attributeType);
+        }
+
+        if (!optionalAttributeOIDs.isEmpty()) {
+            optionalAttributes = new HashSet<AttributeType>(optionalAttributeOIDs.size());
+            for (final String oid : optionalAttributeOIDs) {
+                try {
+                    attributeType = schema.getAttributeType(oid);
+                } catch (final UnknownSchemaElementException e) {
+                    // This isn't good because it means that the name form
+                    // requires an attribute type that we don't know anything
+                    // about.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR1.get(getNameOrOID(),
+                                    oid);
+                    throw new SchemaException(message, e);
+                }
+                optionalAttributes.add(attributeType);
+            }
+        }
+
+        optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
+        requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java
index c1d4483..ba5f24e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_NAME_FORM_NAME;
@@ -44,186 +41,143 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the name form description syntax, which is used to hold
  * name form definitions in the server schema. The format of this syntax is
  * defined in RFC 2252.
  */
-final class NameFormSyntaxImpl extends AbstractSyntaxImpl
-{
+final class NameFormSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_NAME_FORM_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeNameForm method to determine if the value is
-    // acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG
-            .throwing("NameFormSyntax", "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), c);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG
-            .throwing("NameFormSyntax", "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-
-      String structuralClass = null;
-      Set<String> requiredAttributes = null;
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("oc"))
-        {
-          structuralClass = SchemaUtils.readOID(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          requiredAttributes = SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable",
-              e);
-          throw e;
-        }
-      }
-
-      // Make sure that a structural class was specified. If not, then
-      // it cannot be valid.
-      if (structuralClass == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG
-            .throwing("NameFormSyntax", "valueIsAcceptable", e);
-        throw e;
-      }
-
-      if (requiredAttributes == null || requiredAttributes.size() == 0)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG
-            .throwing("NameFormSyntax", "valueIsAcceptable", e);
-        throw e;
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_NAME_FORM_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_NAME_FORM_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeNameForm method to determine if the value is
+        // acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), c);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            String structuralClass = null;
+            Set<String> requiredAttributes = null;
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("oc")) {
+                    structuralClass =
+                            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    requiredAttributes =
+                            SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+
+            // Make sure that a structural class was specified. If not, then
+            // it cannot be valid.
+            if (structuralClass == null) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            if (requiredAttributes == null || requiredAttributes.size() == 0) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("NameFormSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_NAME_FORM_INVALID1.get(definition, de
+                    .getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java
index afd0ddc..db006d9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,26 +32,19 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the numericStringMatch matching rule defined in X.520
  * and referenced in RFC 2252. It allows for values with numeric digits and
  * spaces, but ignores spaces when performing matching.
  */
-final class NumericStringEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class NumericStringEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    if (buffer.length() == 0)
-    {
-      return ByteString.empty();
+        if (buffer.length() == 0) {
+            return ByteString.empty();
+        }
+        return ByteString.valueOf(buffer.toString());
     }
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java
index 644439f..a829417 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,25 +32,18 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This implements defines the numericStringOrderingMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-final class NumericStringOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class NumericStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    if (buffer.length() == 0)
-    {
-      return ByteString.empty();
+        if (buffer.length() == 0) {
+            return ByteString.empty();
+        }
+        return ByteString.valueOf(buffer.toString());
     }
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java
index 4118721..57d6d7d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.NO_CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,25 +32,18 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the numericStringSubstringsMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-final class NumericStringSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
+final class NumericStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, NO_CASE_FOLD);
 
-    if (buffer.length() == 0)
-    {
-      return ByteString.empty();
+        if (buffer.length() == 0) {
+            return ByteString.empty();
+        }
+        return ByteString.valueOf(buffer.toString());
     }
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java
index 0e0b710..9de306f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.isDigit;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NUMERIC_STRING_EMPTY_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_NUMERIC_STRING_ILLEGAL_CHAR;
@@ -40,96 +37,74 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the numeric string attribute syntax, which may be hold
  * one or more numeric digits and/or spaces. Equality, ordering, and substring
  * matching will be allowed by default.
  */
-final class NumericStringSyntaxImpl extends AbstractSyntaxImpl
-{
+final class NumericStringSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_NUMERIC_STRING_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_NUMERIC_STRING_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_NUMERIC_STRING_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_EXACT_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String valueString = value.toString();
-    final int length = valueString.length();
-
-    // It must have at least one digit or space.
-    if (length == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_NUMERIC_STRING_EMPTY_VALUE.get());
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_NUMERIC_STRING_OID;
     }
 
-    // Iterate through the characters and make sure they are all digits
-    // or spaces.
-    for (int i = 0; i < length; i++)
-    {
-      final char c = valueString.charAt(i);
-      if (!(isDigit(c) || c == ' '))
-      {
-
-        invalidReason.append(WARN_ATTR_SYNTAX_NUMERIC_STRING_ILLEGAL_CHAR.get(
-            valueString, String.valueOf(c), i));
-        return false;
-      }
+    public String getName() {
+        return SYNTAX_NUMERIC_STRING_NAME;
     }
 
-    return true;
-  }
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_NUMERIC_STRING_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_EXACT_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String valueString = value.toString();
+        final int length = valueString.length();
+
+        // It must have at least one digit or space.
+        if (length == 0) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_NUMERIC_STRING_EMPTY_VALUE.get());
+            return false;
+        }
+
+        // Iterate through the characters and make sure they are all digits
+        // or spaces.
+        for (int i = 0; i < length; i++) {
+            final char c = valueString.charAt(i);
+            if (!(isDigit(c) || c == ' ')) {
+
+                invalidReason.append(WARN_ATTR_SYNTAX_NUMERIC_STRING_ILLEGAL_CHAR.get(valueString,
+                        String.valueOf(c), i));
+                return false;
+            }
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java
index 6aa5aa2..9dea244 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OID_NAME;
@@ -40,71 +37,52 @@
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class defines the OID syntax, which holds either an identifier name or a
  * numeric OID. Equality and substring matching will be allowed by default.
  */
-final class OIDSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_OID_NAME;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    try
-    {
-      SchemaUtils.readOID(new SubstringReader(value.toString()),
-          schema.allowMalformedNamesAndOptions());
-      return true;
+final class OIDSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(de.getMessageObject());
-      return false;
+
+    public String getName() {
+        return SYNTAX_OID_NAME;
     }
-  }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        try {
+            SchemaUtils.readOID(new SubstringReader(value.toString()), schema
+                    .allowMalformedNamesAndOptions());
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(de.getMessageObject());
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
index 4bc909a..7bf6a1b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,21 +26,22 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EXTENSIBLE_OBJECT_OBJECTCLASS_NAME;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EXTENSIBLE_OBJECT_OBJECTCLASS_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.TOP_OBJECTCLASS_NAME;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with an
  * objectclass, which contains a collection of attributes that must and/or may
@@ -51,780 +51,635 @@
  * provided, the ordering will be preserved when the associated fields are
  * accessed via their getters or via the {@link #toString()} methods.
  */
-public final class ObjectClass extends SchemaElement
-{
-  // The OID that may be used to reference this definition.
-  private final String oid;
+public final class ObjectClass extends SchemaElement {
+    // The OID that may be used to reference this definition.
+    private final String oid;
 
-  // The set of user defined names for this definition.
-  private final List<String> names;
+    // The set of user defined names for this definition.
+    private final List<String> names;
 
-  // Indicates whether this definition is declared "obsolete".
-  private final boolean isObsolete;
+    // Indicates whether this definition is declared "obsolete".
+    private final boolean isObsolete;
 
-  // The reference to the superior objectclasses.
-  private final Set<String> superiorClassOIDs;
+    // The reference to the superior objectclasses.
+    private final Set<String> superiorClassOIDs;
 
-  // The objectclass type for this objectclass.
-  private final ObjectClassType objectClassType;
+    // The objectclass type for this objectclass.
+    private final ObjectClassType objectClassType;
 
-  // The set of required attribute types for this objectclass.
-  private final Set<String> requiredAttributeOIDs;
+    // The set of required attribute types for this objectclass.
+    private final Set<String> requiredAttributeOIDs;
 
-  // The set of optional attribute types for this objectclass.
-  private final Set<String> optionalAttributeOIDs;
+    // The set of optional attribute types for this objectclass.
+    private final Set<String> optionalAttributeOIDs;
 
-  // The definition string used to create this objectclass.
-  private final String definition;
+    // The definition string used to create this objectclass.
+    private final String definition;
 
-  private Set<ObjectClass> superiorClasses = Collections.emptySet();
-  private Set<AttributeType> declaredRequiredAttributes = Collections
-      .emptySet();
-  private Set<AttributeType> requiredAttributes = Collections.emptySet();
-  private Set<AttributeType> declaredOptionalAttributes = Collections
-      .emptySet();
-  private Set<AttributeType> optionalAttributes = Collections.emptySet();
+    private Set<ObjectClass> superiorClasses = Collections.emptySet();
+    private Set<AttributeType> declaredRequiredAttributes = Collections.emptySet();
+    private Set<AttributeType> requiredAttributes = Collections.emptySet();
+    private Set<AttributeType> declaredOptionalAttributes = Collections.emptySet();
+    private Set<AttributeType> optionalAttributes = Collections.emptySet();
 
-  // Indicates whether or not validation has been performed.
-  private boolean needsValidating = true;
+    // Indicates whether or not validation has been performed.
+    private boolean needsValidating = true;
 
-  // The indicates whether or not validation failed.
-  private boolean isValid = false;
+    // The indicates whether or not validation failed.
+    private boolean isValid = false;
 
+    ObjectClass(final String oid, final List<String> names, final String description,
+            final boolean obsolete, final Set<String> superiorClassOIDs,
+            final Set<String> requiredAttributeOIDs, final Set<String> optionalAttributeOIDs,
+            final ObjectClassType objectClassType, final Map<String, List<String>> extraProperties,
+            final String definition) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid, names);
+        Validator.ensureNotNull(superiorClassOIDs, requiredAttributeOIDs, optionalAttributeOIDs,
+                objectClassType);
+        this.oid = oid;
+        this.names = names;
+        this.isObsolete = obsolete;
+        this.superiorClassOIDs = superiorClassOIDs;
+        this.objectClassType = objectClassType;
+        this.requiredAttributeOIDs = requiredAttributeOIDs;
+        this.optionalAttributeOIDs = optionalAttributeOIDs;
 
-  ObjectClass(final String oid, final List<String> names,
-      final String description, final boolean obsolete,
-      final Set<String> superiorClassOIDs,
-      final Set<String> requiredAttributeOIDs,
-      final Set<String> optionalAttributeOIDs,
-      final ObjectClassType objectClassType,
-      final Map<String, List<String>> extraProperties, final String definition)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(oid, names);
-    Validator.ensureNotNull(superiorClassOIDs, requiredAttributeOIDs,
-        optionalAttributeOIDs, objectClassType);
-    this.oid = oid;
-    this.names = names;
-    this.isObsolete = obsolete;
-    this.superiorClassOIDs = superiorClassOIDs;
-    this.objectClassType = objectClassType;
-    this.requiredAttributeOIDs = requiredAttributeOIDs;
-    this.optionalAttributeOIDs = optionalAttributeOIDs;
-
-    if (definition != null)
-    {
-      this.definition = definition;
-    }
-    else
-    {
-      this.definition = buildDefinition();
-    }
-  }
-
-
-
-  /**
-   * Construct a extensibleObject object class where the set of allowed
-   * attribute types of this object class is implicitly the set of all attribute
-   * types of userApplications usage.
-   *
-   * @param description
-   *          The description for this schema definition
-   * @param extraProperties
-   *          The map of "extra" properties for this schema definition
-   */
-  ObjectClass(final String description,
-      final Map<String, List<String>> extraProperties)
-  {
-    super(description, extraProperties);
-    this.oid = EXTENSIBLE_OBJECT_OBJECTCLASS_OID;
-    this.names = Collections.singletonList(EXTENSIBLE_OBJECT_OBJECTCLASS_NAME);
-    this.isObsolete = false;
-    this.superiorClassOIDs = Collections.singleton(TOP_OBJECTCLASS_NAME);
-    this.objectClassType = ObjectClassType.AUXILIARY;
-    this.requiredAttributeOIDs = Collections.emptySet();
-    this.optionalAttributeOIDs = Collections.emptySet();
-
-    this.definition = buildDefinition();
-  }
-
-
-
-  @Override
-  public boolean equals(final Object o)
-  {
-    if (this == o)
-    {
-      return true;
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
+        }
     }
 
-    if (o instanceof ObjectClass)
-    {
-      final ObjectClass other = (ObjectClass) o;
-      return oid.equals(other.oid);
+    /**
+     * Construct a extensibleObject object class where the set of allowed
+     * attribute types of this object class is implicitly the set of all
+     * attribute types of userApplications usage.
+     *
+     * @param description
+     *            The description for this schema definition
+     * @param extraProperties
+     *            The map of "extra" properties for this schema definition
+     */
+    ObjectClass(final String description, final Map<String, List<String>> extraProperties) {
+        super(description, extraProperties);
+        this.oid = EXTENSIBLE_OBJECT_OBJECTCLASS_OID;
+        this.names = Collections.singletonList(EXTENSIBLE_OBJECT_OBJECTCLASS_NAME);
+        this.isObsolete = false;
+        this.superiorClassOIDs = Collections.singleton(TOP_OBJECTCLASS_NAME);
+        this.objectClassType = ObjectClassType.AUXILIARY;
+        this.requiredAttributeOIDs = Collections.emptySet();
+        this.optionalAttributeOIDs = Collections.emptySet();
+
+        this.definition = buildDefinition();
     }
 
-    return false;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the optional attributes for this
-   * object class. Note that this set will not automatically include any
-   * optional attributes for superior object classes.
-   *
-   * @return An unmodifiable set containing the optional attributes for this
-   *         object class.
-   */
-  public Set<AttributeType> getDeclaredOptionalAttributes()
-  {
-    return declaredOptionalAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the required attributes for this
-   * object class. Note that this set will not automatically include any
-   * required attributes for superior object classes.
-   *
-   * @return An unmodifiable set containing the required attributes for this
-   *         object class.
-   */
-  public Set<AttributeType> getDeclaredRequiredAttributes()
-  {
-    return declaredRequiredAttributes;
-  }
-
-
-
-  /**
-   * Returns the name or OID for this schema definition. If it has one or more
-   * names, then the primary name will be returned. If it does not have any
-   * names, then the OID will be returned.
-   *
-   * @return The name or OID for this schema definition.
-   */
-  public String getNameOrOID()
-  {
-    if (names.isEmpty())
-    {
-      return oid;
-    }
-    return names.get(0);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the user-defined names that may be
-   * used to reference this schema definition.
-   *
-   * @return Returns an unmodifiable list containing the user-defined names that
-   *         may be used to reference this schema definition.
-   */
-  public List<String> getNames()
-  {
-    return names;
-  }
-
-
-
-  /**
-   * Returns the objectclass type for this objectclass.
-   *
-   * @return The objectclass type for this objectclass.
-   */
-  public ObjectClassType getObjectClassType()
-  {
-
-    return objectClassType;
-  }
-
-
-
-  /**
-   * Returns the OID for this schema definition.
-   *
-   * @return The OID for this schema definition.
-   */
-  public String getOID()
-  {
-
-    return oid;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the optional attributes for this
-   * object class and any superior object classes that it might have.
-   *
-   * @return An unmodifiable set containing the optional attributes for this
-   *         object class and any superior object classes that it might have.
-   */
-  public Set<AttributeType> getOptionalAttributes()
-  {
-    return optionalAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the required attributes for this
-   * object class and any superior object classes that it might have.
-   *
-   * @return An unmodifiable set containing the required attributes for this
-   *         object class and any superior object classes that it might have.
-   */
-  public Set<AttributeType> getRequiredAttributes()
-  {
-    return requiredAttributes;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the superior classes for this object
-   * class.
-   *
-   * @return An unmodifiable set containing the superior classes for this object
-   *         class.
-   */
-  public Set<ObjectClass> getSuperiorClasses()
-  {
-    return superiorClasses;
-  }
-
-
-
-  @Override
-  public int hashCode()
-  {
-    return oid.hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name.
-   *
-   * @param name
-   *          The name for which to make the determination.
-   * @return <code>true</code> if the specified name is assigned to this schema
-   *         definition, or <code>false</code> if not.
-   */
-  public boolean hasName(final String name)
-  {
-    for (final String n : names)
-    {
-      if (n.equalsIgnoreCase(name))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition has the specified name or OID.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <code>true</code> if the provided value matches the OID or one of
-   *         the names assigned to this schema definition, or <code>false</code>
-   *         if not.
-   */
-  public boolean hasNameOrOID(final String value)
-  {
-    return hasName(value) || getOID().equals(value);
-  }
-
-
-
-  /**
-   * Indicates whether this objectclass is a descendant of the provided class.
-   *
-   * @param objectClass
-   *          The objectClass for which to make the determination.
-   * @return <code>true</code> if this objectclass is a descendant of the
-   *         provided class, or <code>false</code> if not.
-   */
-  public boolean isDescendantOf(final ObjectClass objectClass)
-  {
-    for (final ObjectClass sup : superiorClasses)
-    {
-      if (sup.equals(objectClass) || sup.isDescendantOf(objectClass))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether this schema definition is declared "obsolete".
-   *
-   * @return <code>true</code> if this schema definition is declared "obsolete",
-   *         or <code>false</code> if not.
-   */
-  public boolean isObsolete()
-  {
-    return isObsolete;
-  }
-
-
-
-  /**
-   * Indicates whether the provided attribute type is included in the optional
-   * attribute list for this or any of its superior objectclasses.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is optional for
-   *         this objectclass or any of its superior classes, or
-   *         <code>false</code> if not.
-   */
-  public boolean isOptional(final AttributeType attributeType)
-  {
-    return optionalAttributes.contains(attributeType);
-  }
-
-
-
-  /**
-   * Indicates whether the provided attribute type is included in the required
-   * attribute list for this or any of its superior objectclasses.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required by
-   *         this objectclass or any of its superior classes, or
-   *         <code>false</code> if not.
-   */
-  public boolean isRequired(final AttributeType attributeType)
-  {
-    return requiredAttributes.contains(attributeType);
-  }
-
-
-
-  /**
-   * Indicates whether the provided attribute type is in the list of required or
-   * optional attributes for this objectclass or any of its superior classes.
-   *
-   * @param attributeType
-   *          The attribute type for which to make the determination.
-   * @return <code>true</code> if the provided attribute type is required or
-   *         allowed for this objectclass or any of its superior classes, or
-   *         <code>false</code> if it is not.
-   */
-  public boolean isRequiredOrOptional(final AttributeType attributeType)
-  {
-    return isRequired(attributeType) || isOptional(attributeType);
-  }
-
-
-
-  /**
-   * Returns the string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
-
-
-
-  ObjectClass duplicate()
-  {
-    return new ObjectClass(oid, names, description, isObsolete,
-        superiorClassOIDs, requiredAttributeOIDs, optionalAttributeOIDs,
-        objectClassType, extraProperties, definition);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (!names.isEmpty())
-    {
-      final Iterator<String> iterator = names.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" NAME ( '");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append("' '");
-          buffer.append(iterator.next());
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) {
+            return true;
         }
 
-        buffer.append("' )");
-      }
-      else
-      {
-        buffer.append(" NAME '");
-        buffer.append(firstName);
-        buffer.append("'");
-      }
-    }
-
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
-    }
-
-    if (isObsolete)
-    {
-      buffer.append(" OBSOLETE");
-    }
-
-    if (!superiorClassOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = superiorClassOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" SUP ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+        if (o instanceof ObjectClass) {
+            final ObjectClass other = (ObjectClass) o;
+            return oid.equals(other.oid);
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" SUP ");
-        buffer.append(firstName);
-      }
+        return false;
     }
 
-    if (objectClassType != null)
-    {
-      buffer.append(" ");
-      buffer.append(objectClassType.toString());
+    /**
+     * Returns an unmodifiable set containing the optional attributes for this
+     * object class. Note that this set will not automatically include any
+     * optional attributes for superior object classes.
+     *
+     * @return An unmodifiable set containing the optional attributes for this
+     *         object class.
+     */
+    public Set<AttributeType> getDeclaredOptionalAttributes() {
+        return declaredOptionalAttributes;
     }
 
-    if (!requiredAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = requiredAttributeOIDs.iterator();
+    /**
+     * Returns an unmodifiable set containing the required attributes for this
+     * object class. Note that this set will not automatically include any
+     * required attributes for superior object classes.
+     *
+     * @return An unmodifiable set containing the required attributes for this
+     *         object class.
+     */
+    public Set<AttributeType> getDeclaredRequiredAttributes() {
+        return declaredRequiredAttributes;
+    }
 
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MUST ( ");
-        buffer.append(firstName);
+    /**
+     * Returns the name or OID for this schema definition. If it has one or more
+     * names, then the primary name will be returned. If it does not have any
+     * names, then the OID will be returned.
+     *
+     * @return The name or OID for this schema definition.
+     */
+    public String getNameOrOID() {
+        if (names.isEmpty()) {
+            return oid;
+        }
+        return names.get(0);
+    }
 
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+    /**
+     * Returns an unmodifiable list containing the user-defined names that may
+     * be used to reference this schema definition.
+     *
+     * @return Returns an unmodifiable list containing the user-defined names
+     *         that may be used to reference this schema definition.
+     */
+    public List<String> getNames() {
+        return names;
+    }
+
+    /**
+     * Returns the objectclass type for this objectclass.
+     *
+     * @return The objectclass type for this objectclass.
+     */
+    public ObjectClassType getObjectClassType() {
+
+        return objectClassType;
+    }
+
+    /**
+     * Returns the OID for this schema definition.
+     *
+     * @return The OID for this schema definition.
+     */
+    public String getOID() {
+
+        return oid;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the optional attributes for this
+     * object class and any superior object classes that it might have.
+     *
+     * @return An unmodifiable set containing the optional attributes for this
+     *         object class and any superior object classes that it might have.
+     */
+    public Set<AttributeType> getOptionalAttributes() {
+        return optionalAttributes;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the required attributes for this
+     * object class and any superior object classes that it might have.
+     *
+     * @return An unmodifiable set containing the required attributes for this
+     *         object class and any superior object classes that it might have.
+     */
+    public Set<AttributeType> getRequiredAttributes() {
+        return requiredAttributes;
+    }
+
+    /**
+     * Returns an unmodifiable set containing the superior classes for this
+     * object class.
+     *
+     * @return An unmodifiable set containing the superior classes for this
+     *         object class.
+     */
+    public Set<ObjectClass> getSuperiorClasses() {
+        return superiorClasses;
+    }
+
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
+
+    /**
+     * Indicates whether this schema definition has the specified name.
+     *
+     * @param name
+     *            The name for which to make the determination.
+     * @return <code>true</code> if the specified name is assigned to this
+     *         schema definition, or <code>false</code> if not.
+     */
+    public boolean hasName(final String name) {
+        for (final String n : names) {
+            if (n.equalsIgnoreCase(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Indicates whether this schema definition has the specified name or OID.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <code>true</code> if the provided value matches the OID or one of
+     *         the names assigned to this schema definition, or
+     *         <code>false</code> if not.
+     */
+    public boolean hasNameOrOID(final String value) {
+        return hasName(value) || getOID().equals(value);
+    }
+
+    /**
+     * Indicates whether this objectclass is a descendant of the provided class.
+     *
+     * @param objectClass
+     *            The objectClass for which to make the determination.
+     * @return <code>true</code> if this objectclass is a descendant of the
+     *         provided class, or <code>false</code> if not.
+     */
+    public boolean isDescendantOf(final ObjectClass objectClass) {
+        for (final ObjectClass sup : superiorClasses) {
+            if (sup.equals(objectClass) || sup.isDescendantOf(objectClass)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Indicates whether this schema definition is declared "obsolete".
+     *
+     * @return <code>true</code> if this schema definition is declared
+     *         "obsolete", or <code>false</code> if not.
+     */
+    public boolean isObsolete() {
+        return isObsolete;
+    }
+
+    /**
+     * Indicates whether the provided attribute type is included in the optional
+     * attribute list for this or any of its superior objectclasses.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is optional for
+     *         this objectclass or any of its superior classes, or
+     *         <code>false</code> if not.
+     */
+    public boolean isOptional(final AttributeType attributeType) {
+        return optionalAttributes.contains(attributeType);
+    }
+
+    /**
+     * Indicates whether the provided attribute type is included in the required
+     * attribute list for this or any of its superior objectclasses.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required by
+     *         this objectclass or any of its superior classes, or
+     *         <code>false</code> if not.
+     */
+    public boolean isRequired(final AttributeType attributeType) {
+        return requiredAttributes.contains(attributeType);
+    }
+
+    /**
+     * Indicates whether the provided attribute type is in the list of required
+     * or optional attributes for this objectclass or any of its superior
+     * classes.
+     *
+     * @param attributeType
+     *            The attribute type for which to make the determination.
+     * @return <code>true</code> if the provided attribute type is required or
+     *         allowed for this objectclass or any of its superior classes, or
+     *         <code>false</code> if it is not.
+     */
+    public boolean isRequiredOrOptional(final AttributeType attributeType) {
+        return isRequired(attributeType) || isOptional(attributeType);
+    }
+
+    /**
+     * Returns the string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
+
+    ObjectClass duplicate() {
+        return new ObjectClass(oid, names, description, isObsolete, superiorClassOIDs,
+                requiredAttributeOIDs, optionalAttributeOIDs, objectClassType, extraProperties,
+                definition);
+    }
+
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
+
+        if (!names.isEmpty()) {
+            final Iterator<String> iterator = names.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" NAME ( '");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append("' '");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append("' )");
+            } else {
+                buffer.append(" NAME '");
+                buffer.append(firstName);
+                buffer.append("'");
+            }
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MUST ");
-        buffer.append(firstName);
-      }
-    }
-
-    if (!optionalAttributeOIDs.isEmpty())
-    {
-      final Iterator<String> iterator = optionalAttributeOIDs.iterator();
-
-      final String firstName = iterator.next();
-      if (iterator.hasNext())
-      {
-        buffer.append(" MAY ( ");
-        buffer.append(firstName);
-
-        while (iterator.hasNext())
-        {
-          buffer.append(" $ ");
-          buffer.append(iterator.next());
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
         }
 
-        buffer.append(" )");
-      }
-      else
-      {
-        buffer.append(" MAY ");
-        buffer.append(firstName);
-      }
-    }
-  }
-
-
-
-  boolean validate(final Schema schema,
-      final List<ObjectClass> invalidSchemaElements,
-      final List<LocalizableMessage> warnings)
-  {
-    // Avoid validating this schema element more than once. This may occur if
-    // multiple object classes specify the same superior.
-    if (!needsValidating)
-    {
-      return isValid;
-    }
-
-    // Prevent re-validation.
-    needsValidating = false;
-
-    // Init a flag to check to inheritance from top (only needed for
-    // structural object classes) per RFC 4512
-    boolean derivesTop = objectClassType != ObjectClassType.STRUCTURAL;
-
-    if (!superiorClassOIDs.isEmpty())
-    {
-      superiorClasses = new HashSet<ObjectClass>(superiorClassOIDs.size());
-      ObjectClass superiorClass;
-      for (final String superClassOid : superiorClassOIDs)
-      {
-        try
-        {
-          superiorClass = schema.getObjectClass(superClassOid);
-        }
-        catch (final UnknownSchemaElementException e)
-        {
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_SUPERIOR_CLASS1
-              .get(getNameOrOID(), superClassOid);
-          failValidation(invalidSchemaElements, warnings, message);
-          return false;
+        if (isObsolete) {
+            buffer.append(" OBSOLETE");
         }
 
-        // Make sure that the inheritance configuration is acceptable.
-        final ObjectClassType superiorType = superiorClass.getObjectClassType();
-        switch (objectClassType)
-        {
-        case ABSTRACT:
-          // Abstract classes may only inherit from other abstract
-          // classes.
-          if (superiorType != ObjectClassType.ABSTRACT)
-          {
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1
-                .get(getNameOrOID(), objectClassType.toString(), superiorType.toString(),
-                    superiorClass.getNameOrOID());
+        if (!superiorClassOIDs.isEmpty()) {
+            final Iterator<String> iterator = superiorClassOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" SUP ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" SUP ");
+                buffer.append(firstName);
+            }
+        }
+
+        if (objectClassType != null) {
+            buffer.append(" ");
+            buffer.append(objectClassType.toString());
+        }
+
+        if (!requiredAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = requiredAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MUST ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" MUST ");
+                buffer.append(firstName);
+            }
+        }
+
+        if (!optionalAttributeOIDs.isEmpty()) {
+            final Iterator<String> iterator = optionalAttributeOIDs.iterator();
+
+            final String firstName = iterator.next();
+            if (iterator.hasNext()) {
+                buffer.append(" MAY ( ");
+                buffer.append(firstName);
+
+                while (iterator.hasNext()) {
+                    buffer.append(" $ ");
+                    buffer.append(iterator.next());
+                }
+
+                buffer.append(" )");
+            } else {
+                buffer.append(" MAY ");
+                buffer.append(firstName);
+            }
+        }
+    }
+
+    boolean validate(final Schema schema, final List<ObjectClass> invalidSchemaElements,
+            final List<LocalizableMessage> warnings) {
+        // Avoid validating this schema element more than once. This may occur
+        // if
+        // multiple object classes specify the same superior.
+        if (!needsValidating) {
+            return isValid;
+        }
+
+        // Prevent re-validation.
+        needsValidating = false;
+
+        // Init a flag to check to inheritance from top (only needed for
+        // structural object classes) per RFC 4512
+        boolean derivesTop = objectClassType != ObjectClassType.STRUCTURAL;
+
+        if (!superiorClassOIDs.isEmpty()) {
+            superiorClasses = new HashSet<ObjectClass>(superiorClassOIDs.size());
+            ObjectClass superiorClass;
+            for (final String superClassOid : superiorClassOIDs) {
+                try {
+                    superiorClass = schema.getObjectClass(superClassOid);
+                } catch (final UnknownSchemaElementException e) {
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_SUPERIOR_CLASS1.get(
+                                    getNameOrOID(), superClassOid);
+                    failValidation(invalidSchemaElements, warnings, message);
+                    return false;
+                }
+
+                // Make sure that the inheritance configuration is acceptable.
+                final ObjectClassType superiorType = superiorClass.getObjectClassType();
+                switch (objectClassType) {
+                case ABSTRACT:
+                    // Abstract classes may only inherit from other abstract
+                    // classes.
+                    if (superiorType != ObjectClassType.ABSTRACT) {
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1.get(
+                                        getNameOrOID(), objectClassType.toString(), superiorType
+                                                .toString(), superiorClass.getNameOrOID());
+                        failValidation(invalidSchemaElements, warnings, message);
+                        return false;
+                    }
+                    break;
+
+                case AUXILIARY:
+                    // Auxiliary classes may only inherit from abstract classes
+                    // or
+                    // other auxiliary classes.
+                    if (superiorType != ObjectClassType.ABSTRACT
+                            && superiorType != ObjectClassType.AUXILIARY) {
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1.get(
+                                        getNameOrOID(), objectClassType.toString(), superiorType
+                                                .toString(), superiorClass.getNameOrOID());
+                        failValidation(invalidSchemaElements, warnings, message);
+                        return false;
+                    }
+                    break;
+
+                case STRUCTURAL:
+                    // Structural classes may only inherit from abstract classes
+                    // or other structural classes.
+                    if (superiorType != ObjectClassType.ABSTRACT
+                            && superiorType != ObjectClassType.STRUCTURAL) {
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1.get(
+                                        getNameOrOID(), objectClassType.toString(), superiorType
+                                                .toString(), superiorClass.getNameOrOID());
+                        failValidation(invalidSchemaElements, warnings, message);
+                        return false;
+                    }
+                    break;
+                }
+
+                // All existing structural object classes defined in this schema
+                // are implicitly guaranteed to inherit from top
+                if (!derivesTop && superiorType == ObjectClassType.STRUCTURAL) {
+                    derivesTop = true;
+                }
+
+                // First ensure that the superior has been validated and fail if
+                // it is
+                // invalid.
+                if (!superiorClass.validate(schema, invalidSchemaElements, warnings)) {
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_CLASS.get(getNameOrOID(),
+                                    superClassOid);
+                    failValidation(invalidSchemaElements, warnings, message);
+                    return false;
+                }
+
+                // Inherit all required attributes from superior class.
+                Iterator<AttributeType> i = superiorClass.getRequiredAttributes().iterator();
+                if (i.hasNext() && requiredAttributes == Collections.EMPTY_SET) {
+                    requiredAttributes = new HashSet<AttributeType>();
+                }
+                while (i.hasNext()) {
+                    requiredAttributes.add(i.next());
+                }
+
+                // Inherit all optional attributes from superior class.
+                i = superiorClass.getRequiredAttributes().iterator();
+                if (i.hasNext() && requiredAttributes == Collections.EMPTY_SET) {
+                    requiredAttributes = new HashSet<AttributeType>();
+                }
+                while (i.hasNext()) {
+                    requiredAttributes.add(i.next());
+                }
+
+                superiorClasses.add(superiorClass);
+            }
+        }
+
+        if (!derivesTop) {
+            derivesTop = isDescendantOf(schema.getObjectClass("2.5.6.0"));
+        }
+
+        // Structural classes must have the "top" objectclass somewhere
+        // in the superior chain.
+        if (!derivesTop) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_OBJECTCLASS_STRUCTURAL_SUPERIOR_NOT_TOP1.get(getNameOrOID());
             failValidation(invalidSchemaElements, warnings, message);
             return false;
-          }
-          break;
-
-        case AUXILIARY:
-          // Auxiliary classes may only inherit from abstract classes or
-          // other auxiliary classes.
-          if (superiorType != ObjectClassType.ABSTRACT
-              && superiorType != ObjectClassType.AUXILIARY)
-          {
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1
-                .get(getNameOrOID(), objectClassType.toString(), superiorType.toString(),
-                    superiorClass.getNameOrOID());
-            failValidation(invalidSchemaElements, warnings, message);
-            return false;
-          }
-          break;
-
-        case STRUCTURAL:
-          // Structural classes may only inherit from abstract classes
-          // or other structural classes.
-          if (superiorType != ObjectClassType.ABSTRACT
-              && superiorType != ObjectClassType.STRUCTURAL)
-          {
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_TYPE1
-                .get(getNameOrOID(), objectClassType.toString(), superiorType.toString(),
-                    superiorClass.getNameOrOID());
-            failValidation(invalidSchemaElements, warnings, message);
-            return false;
-          }
-          break;
         }
 
-        // All existing structural object classes defined in this schema
-        // are implicitly guaranteed to inherit from top
-        if (!derivesTop && superiorType == ObjectClassType.STRUCTURAL)
-        {
-          derivesTop = true;
+        if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID)) {
+            declaredOptionalAttributes = new HashSet<AttributeType>(requiredAttributeOIDs.size());
+            for (final AttributeType attributeType : schema.getAttributeTypes()) {
+                if (attributeType.getUsage() == AttributeUsage.USER_APPLICATIONS) {
+                    declaredOptionalAttributes.add(attributeType);
+                }
+            }
+            optionalAttributes = declaredRequiredAttributes;
+        } else {
+            if (!requiredAttributeOIDs.isEmpty()) {
+                declaredRequiredAttributes =
+                        new HashSet<AttributeType>(requiredAttributeOIDs.size());
+                AttributeType attributeType;
+                for (final String requiredAttribute : requiredAttributeOIDs) {
+                    try {
+                        attributeType = schema.getAttributeType(requiredAttribute);
+                    } catch (final UnknownSchemaElementException e) {
+                        // This isn't good because it means that the objectclass
+                        // requires an attribute type that we don't know
+                        // anything
+                        // about.
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR1.get(
+                                        getNameOrOID(), requiredAttribute);
+                        failValidation(invalidSchemaElements, warnings, message);
+                        return false;
+                    }
+                    declaredRequiredAttributes.add(attributeType);
+                }
+                if (requiredAttributes == Collections.EMPTY_SET) {
+                    requiredAttributes = declaredRequiredAttributes;
+                } else {
+                    requiredAttributes.addAll(declaredRequiredAttributes);
+                }
+            }
+
+            if (!optionalAttributeOIDs.isEmpty()) {
+                declaredOptionalAttributes =
+                        new HashSet<AttributeType>(optionalAttributeOIDs.size());
+                AttributeType attributeType;
+                for (final String optionalAttribute : optionalAttributeOIDs) {
+                    try {
+                        attributeType = schema.getAttributeType(optionalAttribute);
+                    } catch (final UnknownSchemaElementException e) {
+                        // This isn't good because it means that the objectclass
+                        // requires an attribute type that we don't know
+                        // anything
+                        // about.
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR1.get(
+                                        getNameOrOID(), optionalAttribute);
+                        failValidation(invalidSchemaElements, warnings, message);
+                        return false;
+                    }
+                    declaredOptionalAttributes.add(attributeType);
+                }
+                if (optionalAttributes == Collections.EMPTY_SET) {
+                    optionalAttributes = declaredOptionalAttributes;
+                } else {
+                    optionalAttributes.addAll(declaredOptionalAttributes);
+                }
+            }
         }
 
-        // First ensure that the superior has been validated and fail if it is
-        // invalid.
-        if (!superiorClass.validate(schema, invalidSchemaElements, warnings))
-        {
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_INVALID_SUPERIOR_CLASS
-              .get(getNameOrOID(), superClassOid);
-          failValidation(invalidSchemaElements, warnings, message);
-          return false;
-        }
+        declaredOptionalAttributes = Collections.unmodifiableSet(declaredOptionalAttributes);
+        declaredRequiredAttributes = Collections.unmodifiableSet(declaredRequiredAttributes);
+        optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
+        requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
+        superiorClasses = Collections.unmodifiableSet(superiorClasses);
 
-        // Inherit all required attributes from superior class.
-        Iterator<AttributeType> i = superiorClass.getRequiredAttributes()
-            .iterator();
-        if (i.hasNext() && requiredAttributes == Collections.EMPTY_SET)
-        {
-          requiredAttributes = new HashSet<AttributeType>();
-        }
-        while (i.hasNext())
-        {
-          requiredAttributes.add(i.next());
-        }
-
-        // Inherit all optional attributes from superior class.
-        i = superiorClass.getRequiredAttributes().iterator();
-        if (i.hasNext() && requiredAttributes == Collections.EMPTY_SET)
-        {
-          requiredAttributes = new HashSet<AttributeType>();
-        }
-        while (i.hasNext())
-        {
-          requiredAttributes.add(i.next());
-        }
-
-        superiorClasses.add(superiorClass);
-      }
+        return (isValid = true);
     }
 
-    if (!derivesTop)
-    {
-      derivesTop = isDescendantOf(schema.getObjectClass("2.5.6.0"));
+    private void failValidation(final List<ObjectClass> invalidSchemaElements,
+            final List<LocalizableMessage> warnings, final LocalizableMessage message) {
+        invalidSchemaElements.add(this);
+        warnings.add(ERR_OC_VALIDATION_FAIL.get(toString(), message));
     }
-
-    // Structural classes must have the "top" objectclass somewhere
-    // in the superior chain.
-    if (!derivesTop)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_STRUCTURAL_SUPERIOR_NOT_TOP1
-          .get(getNameOrOID());
-      failValidation(invalidSchemaElements, warnings, message);
-      return false;
-    }
-
-    if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID))
-    {
-      declaredOptionalAttributes = new HashSet<AttributeType>(
-          requiredAttributeOIDs.size());
-      for (final AttributeType attributeType : schema.getAttributeTypes())
-      {
-        if (attributeType.getUsage() == AttributeUsage.USER_APPLICATIONS)
-        {
-          declaredOptionalAttributes.add(attributeType);
-        }
-      }
-      optionalAttributes = declaredRequiredAttributes;
-    }
-    else
-    {
-      if (!requiredAttributeOIDs.isEmpty())
-      {
-        declaredRequiredAttributes = new HashSet<AttributeType>(
-            requiredAttributeOIDs.size());
-        AttributeType attributeType;
-        for (final String requiredAttribute : requiredAttributeOIDs)
-        {
-          try
-          {
-            attributeType = schema.getAttributeType(requiredAttribute);
-          }
-          catch (final UnknownSchemaElementException e)
-          {
-            // This isn't good because it means that the objectclass
-            // requires an attribute type that we don't know anything
-            // about.
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR1
-                .get(getNameOrOID(), requiredAttribute);
-            failValidation(invalidSchemaElements, warnings, message);
-            return false;
-          }
-          declaredRequiredAttributes.add(attributeType);
-        }
-        if (requiredAttributes == Collections.EMPTY_SET)
-        {
-          requiredAttributes = declaredRequiredAttributes;
-        }
-        else
-        {
-          requiredAttributes.addAll(declaredRequiredAttributes);
-        }
-      }
-
-      if (!optionalAttributeOIDs.isEmpty())
-      {
-        declaredOptionalAttributes = new HashSet<AttributeType>(
-            optionalAttributeOIDs.size());
-        AttributeType attributeType;
-        for (final String optionalAttribute : optionalAttributeOIDs)
-        {
-          try
-          {
-            attributeType = schema.getAttributeType(optionalAttribute);
-          }
-          catch (final UnknownSchemaElementException e)
-          {
-            // This isn't good because it means that the objectclass
-            // requires an attribute type that we don't know anything
-            // about.
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR1
-                .get(getNameOrOID(), optionalAttribute);
-            failValidation(invalidSchemaElements, warnings, message);
-            return false;
-          }
-          declaredOptionalAttributes.add(attributeType);
-        }
-        if (optionalAttributes == Collections.EMPTY_SET)
-        {
-          optionalAttributes = declaredOptionalAttributes;
-        }
-        else
-        {
-          optionalAttributes.addAll(declaredOptionalAttributes);
-        }
-      }
-    }
-
-    declaredOptionalAttributes = Collections
-        .unmodifiableSet(declaredOptionalAttributes);
-    declaredRequiredAttributes = Collections
-        .unmodifiableSet(declaredRequiredAttributes);
-    optionalAttributes = Collections.unmodifiableSet(optionalAttributes);
-    requiredAttributes = Collections.unmodifiableSet(requiredAttributes);
-    superiorClasses = Collections.unmodifiableSet(superiorClasses);
-
-    return (isValid = true);
-  }
-
-
-
-  private void failValidation(final List<ObjectClass> invalidSchemaElements,
-      final List<LocalizableMessage> warnings, final LocalizableMessage message)
-  {
-    invalidSchemaElements.add(this);
-    warnings.add(ERR_OC_VALIDATION_FAIL.get(toString(), message));
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java
index 81c8605..ae703b0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,12 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1;
+import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OBJECTCLASS_NAME;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -41,178 +42,131 @@
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the object class description syntax, which is used to
  * hold objectclass definitions in the server schema. The format of this syntax
  * is defined in RFC 2252.
  */
-final class ObjectClassSyntaxImpl extends AbstractSyntaxImpl
-{
+final class ObjectClassSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OID_FIRST_COMPONENT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_OBJECTCLASS_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll use the decodeObjectClass method to determine if the value
-    // is acceptable.
-    final String definition = value.toString();
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
-
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1
-            .get(definition);
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        final DecodeException e = DecodeException.error(message);
-        StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax",
-            "valueIsAcceptable", e);
-        throw e;
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      SchemaUtils.readOID(reader,
-          schema.allowMalformedNamesAndOptions());
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          SchemaUtils.readNameDescriptors(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("abstract"))
-        {
-          // This indicates that entries must not include this
-          // objectclass unless they also include a non-abstract
-          // objectclass that inherits from this class. We do not need
-          // any more parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("structural"))
-        {
-          // This indicates that this is a structural objectclass.
-          // We do not need any more parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("auxiliary"))
-        {
-          // This indicates that this is an auxiliary objectclass.
-          // We do not need any more parsing for this token.
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          SchemaUtils.readOIDs(reader,
-              schema.allowMalformedNamesAndOptions());
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          SchemaUtils.readExtensions(reader);
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          final DecodeException e = DecodeException.error(message);
-          StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax",
-              "valueIsAcceptable", e);
-          throw e;
-        }
-      }
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OID_FIRST_COMPONENT_OID;
     }
-    catch (final DecodeException de)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1.get(definition,
-          de.getMessageObject()));
-      return false;
+
+    public String getName() {
+        return SYNTAX_OBJECTCLASS_NAME;
     }
-  }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll use the decodeObjectClass method to determine if the value
+        // is acceptable.
+        final String definition = value.toString();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
+
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
+
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1.get(definition);
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                final DecodeException e = DecodeException.error(message);
+                StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
+                throw e;
+            }
+
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
+
+            // The next set of characters must be the OID.
+            SchemaUtils.readOID(reader, schema.allowMalformedNamesAndOptions());
+
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
+
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    SchemaUtils.readNameDescriptors(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("abstract")) {
+                    // This indicates that entries must not include this
+                    // objectclass unless they also include a non-abstract
+                    // objectclass that inherits from this class. We do not need
+                    // any more parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("structural")) {
+                    // This indicates that this is a structural objectclass.
+                    // We do not need any more parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("auxiliary")) {
+                    // This indicates that this is an auxiliary objectclass.
+                    // We do not need any more parsing for this token.
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    SchemaUtils.readOIDs(reader, schema.allowMalformedNamesAndOptions());
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    SchemaUtils.readExtensions(reader);
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    final DecodeException e = DecodeException.error(message);
+                    StaticUtils.DEBUG_LOG.throwing("ObjectClassSyntax", "valueIsAcceptable", e);
+                    throw e;
+                }
+            }
+            return true;
+        } catch (final DecodeException de) {
+            invalidReason.append(ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1.get(definition, de
+                    .getMessageObject()));
+            return false;
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java
index 690a032..76f301e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,55 +26,46 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 /**
  * This enumeration defines the set of possible objectclass types that may be
  * used, as defined in RFC 2252.
  */
-public enum ObjectClassType
-{
-  /**
-   * The objectclass type that to use for classes declared "abstract".
-   */
-  ABSTRACT("ABSTRACT"),
+public enum ObjectClassType {
+    /**
+     * The objectclass type that to use for classes declared "abstract".
+     */
+    ABSTRACT("ABSTRACT"),
 
-  /**
-   * The objectclass type that to use for classes declared "structural".
-   */
-  STRUCTURAL("STRUCTURAL"),
+    /**
+     * The objectclass type that to use for classes declared "structural".
+     */
+    STRUCTURAL("STRUCTURAL"),
 
-  /**
-   * The objectclass type that to use for classes declared "auxiliary".
-   */
-  AUXILIARY("AUXILIARY");
+    /**
+     * The objectclass type that to use for classes declared "auxiliary".
+     */
+    AUXILIARY("AUXILIARY");
 
-  // The string representation of this objectclass type.
-  private final String typeString;
+    // The string representation of this objectclass type.
+    private final String typeString;
 
+    /**
+     * Creates a new objectclass type with the provided string representation.
+     *
+     * @param typeString
+     *            The string representation for this objectclass type.
+     */
+    private ObjectClassType(final String typeString) {
+        this.typeString = typeString;
+    }
 
-
-  /**
-   * Creates a new objectclass type with the provided string representation.
-   *
-   * @param typeString
-   *          The string representation for this objectclass type.
-   */
-  private ObjectClassType(final String typeString)
-  {
-    this.typeString = typeString;
-  }
-
-
-
-  /**
-   * Retrieves a string representation of this objectclass type.
-   *
-   * @return A string representation of this objectclass type.
-   */
-  @Override
-  public String toString()
-  {
-    return typeString;
-  }
+    /**
+     * Retrieves a string representation of this objectclass type.
+     *
+     * @return A string representation of this objectclass type.
+     */
+    @Override
+    public String toString() {
+        return typeString;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
index c028032..6435293 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,121 +26,94 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DecodeException;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class defines the objectIdentifierMatch matching rule defined in X.520
  * and referenced in RFC 2252. This expects to work on OIDs and will match
  * either an attribute/objectclass name or a numeric OID. NOTE: This matching
  * rule requires a schema to lookup object identifiers in the descriptor form.
  */
-final class ObjectIdentifierEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  static String resolveNames(final Schema schema, final String oid)
-  {
-    if (!StaticUtils.isDigit(oid.charAt(0)))
-    {
-      // Do an best effort attempt to normalize names to OIDs.
+final class ObjectIdentifierEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    static String resolveNames(final Schema schema, final String oid) {
+        if (!StaticUtils.isDigit(oid.charAt(0))) {
+            // Do an best effort attempt to normalize names to OIDs.
 
-      String schemaName = null;
+            String schemaName = null;
 
-      if (schema.hasAttributeType(oid))
-      {
-        schemaName = schema.getAttributeType(oid).getOID();
-      }
+            if (schema.hasAttributeType(oid)) {
+                schemaName = schema.getAttributeType(oid).getOID();
+            }
 
-      if (schemaName == null)
-      {
-        if (schema.hasDITContentRule(oid))
-        {
-          schemaName = schema.getDITContentRule(oid).getStructuralClass()
-              .getOID();
+            if (schemaName == null) {
+                if (schema.hasDITContentRule(oid)) {
+                    schemaName = schema.getDITContentRule(oid).getStructuralClass().getOID();
+                }
+            }
+
+            if (schemaName == null) {
+                if (schema.hasSyntax(oid)) {
+                    schemaName = schema.getSyntax(oid).getOID();
+                }
+            }
+
+            if (schemaName == null) {
+                if (schema.hasObjectClass(oid)) {
+                    schemaName = schema.getObjectClass(oid).getOID();
+                }
+            }
+
+            if (schemaName == null) {
+                if (schema.hasMatchingRule(oid)) {
+                    schemaName = schema.getMatchingRule(oid).getOID();
+                }
+            }
+
+            if (schemaName == null) {
+                if (schema.hasMatchingRuleUse(oid)) {
+                    schemaName = schema.getMatchingRuleUse(oid).getMatchingRule().getOID();
+                }
+            }
+
+            if (schemaName == null) {
+                if (schema.hasNameForm(oid)) {
+                    schemaName = schema.getNameForm(oid).getOID();
+                }
+            }
+
+            if (schemaName != null) {
+                return schemaName;
+            } else {
+                return StaticUtils.toLowerCase(oid);
+            }
         }
-      }
-
-      if (schemaName == null)
-      {
-        if (schema.hasSyntax(oid))
-        {
-          schemaName = schema.getSyntax(oid).getOID();
-        }
-      }
-
-      if (schemaName == null)
-      {
-        if (schema.hasObjectClass(oid))
-        {
-          schemaName = schema.getObjectClass(oid).getOID();
-        }
-      }
-
-      if (schemaName == null)
-      {
-        if (schema.hasMatchingRule(oid))
-        {
-          schemaName = schema.getMatchingRule(oid).getOID();
-        }
-      }
-
-      if (schemaName == null)
-      {
-        if (schema.hasMatchingRuleUse(oid))
-        {
-          schemaName = schema.getMatchingRuleUse(oid).getMatchingRule()
-              .getOID();
-        }
-      }
-
-      if (schemaName == null)
-      {
-        if (schema.hasNameForm(oid))
-        {
-          schemaName = schema.getNameForm(oid).getOID();
-        }
-      }
-
-      if (schemaName != null)
-      {
-        return schemaName;
-      }
-      else
-      {
-        return StaticUtils.toLowerCase(oid);
-      }
+        return oid;
     }
-    return oid;
-  }
 
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
+        final String normalized =
+                resolveNames(schema, SchemaUtils.readOID(reader, schema
+                        .allowMalformedNamesAndOptions()));
+        return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
+    }
 
-
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
-    final String normalized = resolveNames(schema, SchemaUtils.readOID(reader,
-        schema.allowMalformedNamesAndOptions()));
-    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
-  }
-
-
-
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
-    final String normalized = resolveNames(schema, SchemaUtils.readOID(reader,
-        schema.allowMalformedNamesAndOptions()));
-    return ByteString.valueOf(normalized);
-  }
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
+        final String normalized =
+                resolveNames(schema, SchemaUtils.readOID(reader, schema
+                        .allowMalformedNamesAndOptions()));
+        return ByteString.valueOf(normalized);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
index d8a4ac6..6e728e7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EMPTY_VALUE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS;
 
@@ -40,8 +37,6 @@
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * This class implements the objectIdentifierFirstComponentMatch matching rule
  * defined in X.520 and referenced in RFC 2252. This rule is intended for use
@@ -50,59 +45,52 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-final class ObjectIdentifierFirstComponentEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
-    final String normalized = ObjectIdentifierEqualityMatchingRuleImpl
-        .resolveNames(schema, SchemaUtils.readOID(reader,
-            schema.allowMalformedNamesAndOptions()));
-    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
-  }
-
-
-
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    final String definition = value.toString();
-    final SubstringReader reader = new SubstringReader(definition);
-
-    // We'll do this a character at a time. First, skip over any leading
-    // whitespace.
-    reader.skipWhitespaces();
-
-    if (reader.remaining() <= 0)
-    {
-      // This means that the value was empty or contained only
-      // whitespace. That is illegal.
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
-      throw DecodeException.error(message);
+final class ObjectIdentifierFirstComponentEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
+        final String normalized =
+                ObjectIdentifierEqualityMatchingRuleImpl.resolveNames(schema, SchemaUtils.readOID(
+                        reader, schema.allowMalformedNamesAndOptions()));
+        return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
     }
 
-    // The next character must be an open parenthesis. If it is not,
-    // then that is an error.
-    final char c = reader.read();
-    if (c != '(')
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS
-          .get(definition, (reader.pos() - 1), String.valueOf(c));
-      throw DecodeException.error(message);
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String definition = value.toString();
+        final SubstringReader reader = new SubstringReader(definition);
+
+        // We'll do this a character at a time. First, skip over any leading
+        // whitespace.
+        reader.skipWhitespaces();
+
+        if (reader.remaining() <= 0) {
+            // This means that the value was empty or contained only
+            // whitespace. That is illegal.
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_EMPTY_VALUE.get();
+            throw DecodeException.error(message);
+        }
+
+        // The next character must be an open parenthesis. If it is not,
+        // then that is an error.
+        final char c = reader.read();
+        if (c != '(') {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1),
+                            String.valueOf(c));
+            throw DecodeException.error(message);
+        }
+
+        // Skip over any spaces immediately following the opening
+        // parenthesis.
+        reader.skipWhitespaces();
+
+        // The next set of characters must be the OID.
+        final String normalized =
+                ObjectIdentifierEqualityMatchingRuleImpl.resolveNames(schema, SchemaUtils.readOID(
+                        reader, schema.allowMalformedNamesAndOptions()));
+        return ByteString.valueOf(normalized);
     }
-
-    // Skip over any spaces immediately following the opening
-    // parenthesis.
-    reader.skipWhitespaces();
-
-    // The next set of characters must be the OID.
-    final String normalized = ObjectIdentifierEqualityMatchingRuleImpl
-        .resolveNames(schema, SchemaUtils.readOID(reader,
-            schema.allowMalformedNamesAndOptions()));
-    return ByteString.valueOf(normalized);
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java
index b4e5c23..e76e5cb 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,24 +25,16 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the octetStringMatch matching rule defined in X.520. It
  * will be used as the default equality matching rule for the binary and octet
  * string syntaxes.
  */
-final class OctetStringEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return value.toByteString();
-  }
+final class OctetStringEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return value.toByteString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java
index 51a046e..c4a9b99 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,24 +25,16 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the octetStringOrderingMatch matching rule defined in
  * X.520. This will be the default ordering matching rule for the binary and
  * octet string syntaxes.
  */
-final class OctetStringOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return value.toByteString();
-  }
+final class OctetStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return value.toByteString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java
index f5f7412..b37690e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,24 +25,16 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines the octetStringSubstringsMatch matching rule defined in
  * X.520. It will be used as the default substring matching rule for the binary
  * and octet string syntaxes.
  */
-final class OctetStringSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return value.toByteString();
-  }
+final class OctetStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return value.toByteString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java
index d4c239a..d378b70 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OCTET_STRING_NAME;
@@ -36,63 +33,47 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the octet string attribute syntax, which is equivalent
  * to the binary syntax and should be considered a replacement for it. Equality,
  * ordering, and substring matching will be allowed by default.
  */
-final class OctetStringSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+final class OctetStringSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_OCTET_STRING_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_OCTET_STRING_NAME;
-  }
+    public boolean isHumanReadable() {
+        return true;
+    }
 
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the octet string syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the octet string syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java
index 3a16521..f97fb90 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_LIST_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_LIST_OID;
@@ -37,137 +34,109 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the other mailbox attribute syntax, which consists of a
  * printable string component (the mailbox type) followed by a dollar sign and
  * an IA5 string component (the mailbox). Equality and substring matching will
  * be allowed by default.
  */
-final class OtherMailboxSyntaxImpl extends AbstractSyntaxImpl
-{
+final class OtherMailboxSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_LIST_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_OTHER_MAILBOX_NAME;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_LIST_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Check to see if the provided value was null. If so, then that's
-    // not acceptable.
-    if (value == null)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_EMPTY_VALUE.get());
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_LIST_OID;
     }
 
-    // Get the value as a string and determine its length. If it is
-    // empty, then that's not acceptable.
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-    if (valueLength == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_EMPTY_VALUE.get());
-      return false;
+    public String getName() {
+        return SYNTAX_OTHER_MAILBOX_NAME;
     }
 
-    // Iterate through the characters in the vale until we find a dollar
-    // sign. Every character up to that point must be a printable string
-    // character.
-    int pos = 0;
-    for (; pos < valueLength; pos++)
-    {
-      final char c = valueString.charAt(pos);
-      if (c == '$')
-      {
-        if (pos == 0)
-        {
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_LIST_OID;
+    }
 
-          invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_NO_MBTYPE
-              .get(valueString));
-          return false;
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Check to see if the provided value was null. If so, then that's
+        // not acceptable.
+        if (value == null) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_EMPTY_VALUE.get());
+            return false;
         }
 
-        pos++;
-        break;
-      }
-      else if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-      {
+        // Get the value as a string and determine its length. If it is
+        // empty, then that's not acceptable.
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+        if (valueLength == 0) {
 
-        invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_ILLEGAL_MBTYPE_CHAR
-            .get(valueString, String.valueOf(c), pos));
-        return false;
-      }
+            invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_EMPTY_VALUE.get());
+            return false;
+        }
+
+        // Iterate through the characters in the vale until we find a dollar
+        // sign. Every character up to that point must be a printable string
+        // character.
+        int pos = 0;
+        for (; pos < valueLength; pos++) {
+            final char c = valueString.charAt(pos);
+            if (c == '$') {
+                if (pos == 0) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_NO_MBTYPE.get(valueString));
+                    return false;
+                }
+
+                pos++;
+                break;
+            } else if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_ILLEGAL_MBTYPE_CHAR.get(
+                        valueString, String.valueOf(c), pos));
+                return false;
+            }
+        }
+
+        // Make sure there is at least one character left for the mailbox.
+        if (pos >= valueLength) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_NO_MAILBOX.get(valueString));
+            return false;
+        }
+
+        // The remaining characters in the value must be IA5 (ASCII)
+        // characters.
+        for (; pos < valueLength; pos++) {
+            final char c = valueString.charAt(pos);
+            if (c != (c & 0x7F)) {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_ILLEGAL_MB_CHAR.get(valueString,
+                        String.valueOf(c), pos));
+                return false;
+            }
+        }
+
+        // If we've gotten here, then the value is OK.
+        return true;
     }
-
-    // Make sure there is at least one character left for the mailbox.
-    if (pos >= valueLength)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_NO_MAILBOX
-          .get(valueString));
-      return false;
-    }
-
-    // The remaining characters in the value must be IA5 (ASCII)
-    // characters.
-    for (; pos < valueLength; pos++)
-    {
-      final char c = valueString.charAt(pos);
-      if (c != (c & 0x7F))
-      {
-
-        invalidReason.append(ERR_ATTR_SYNTAX_OTHER_MAILBOX_ILLEGAL_MB_CHAR.get(
-            valueString, String.valueOf(c), pos));
-        return false;
-      }
-    }
-
-    // If we've gotten here, then the value is OK.
-    return true;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java
index f59b424..4a9b15e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_POSTAL_ADDRESS_NAME;
@@ -36,8 +33,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the postal address attribute syntax, which is a list of
  * UCS (Universal Character Set, as defined in the ISO 10646 specification and
@@ -45,57 +40,43 @@
  * they will be treated in a case-insensitive manner, and equality and substring
  * matching will be allowed.
  */
-final class PostalAddressSyntaxImpl extends AbstractSyntaxImpl
-{
+final class PostalAddressSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_POSTAL_ADDRESS_NAME;
+    }
 
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_POSTAL_ADDRESS_NAME;
-  }
+    public boolean isHumanReadable() {
+        return true;
+    }
 
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We'll allow any value.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We'll allow any value.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java
index 9e33bfd..a8a9793 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,51 +32,38 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the presentationAddressMatch matching rule defined in
  * X.520 and referenced in RFC 2252. However, since this matching rule and the
  * associated syntax have been deprecated, this matching rule behaves exactly
  * like the caseIgnoreMatch rule.
  */
-final class PresentationAddressEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class PresentationAddressEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java
index 45faf43..e708a20 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,86 +26,62 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the presentation address attribute syntax, which is
  * defined in RFC 1278. However, because this LDAP syntax is being deprecated,
  * this implementation behaves exactly like the directory string syntax.
  */
-final class PresentationAddressSyntaxImpl extends AbstractSyntaxImpl
-{
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
+final class PresentationAddressSyntaxImpl extends AbstractSyntaxImpl {
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
+    }
 
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_PRESENTATION_ADDRESS_NAME;
+    }
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
 
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
 
+    public boolean isHumanReadable() {
+        return true;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_PRESENTATION_ADDRESS_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We will accept any value for this syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We will accept any value for this syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java
index 76ca2ec..07c5b3f 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,16 +26,13 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_PRINTABLE_STRING_EMPTY_VALUE;
+import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_PRINTABLE_STRING_ILLEGAL_CHARACTER;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the printable string attribute syntax, which is simply
  * a string of characters from a limited ASCII character set (uppercase and
@@ -44,202 +40,173 @@
  * By default, they will be treated in a case-insensitive manner, and equality,
  * ordering, substring, and approximate matching will be allowed.
  */
-final class PrintableStringSyntaxImpl extends AbstractSyntaxImpl
-{
+final class PrintableStringSyntaxImpl extends AbstractSyntaxImpl {
 
-  /**
-   * Indicates whether the provided character is a valid printable character.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided character is a printable
-   *         character, or <CODE>false</CODE> if not.
-   */
-  static boolean isPrintableCharacter(final char c)
-  {
-    switch (c)
-    {
-    case 'a':
-    case 'b':
-    case 'c':
-    case 'd':
-    case 'e':
-    case 'f':
-    case 'g':
-    case 'h':
-    case 'i':
-    case 'j':
-    case 'k':
-    case 'l':
-    case 'm':
-    case 'n':
-    case 'o':
-    case 'p':
-    case 'q':
-    case 'r':
-    case 's':
-    case 't':
-    case 'u':
-    case 'v':
-    case 'w':
-    case 'x':
-    case 'y':
-    case 'z':
-    case 'A':
-    case 'B':
-    case 'C':
-    case 'D':
-    case 'E':
-    case 'F':
-    case 'G':
-    case 'H':
-    case 'I':
-    case 'J':
-    case 'K':
-    case 'L':
-    case 'M':
-    case 'N':
-    case 'O':
-    case 'P':
-    case 'Q':
-    case 'R':
-    case 'S':
-    case 'T':
-    case 'U':
-    case 'V':
-    case 'W':
-    case 'X':
-    case 'Y':
-    case 'Z':
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-    case '6':
-    case '7':
-    case '8':
-    case '9':
-    case '\'':
-    case '(':
-    case ')':
-    case '+':
-    case ',':
-    case '-':
-    case '.':
-    case '=':
-    case '/':
-    case ':':
-    case '?':
-    case ' ':
-      return true;
-    default:
-      return false;
-    }
-  }
-
-
-
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_PRINTABLE_STRING_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Check to see if the provided value was null. If so, then that's
-    // not acceptable.
-    if (value == null)
-    {
-
-      invalidReason.append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_EMPTY_VALUE.get());
-      return false;
+    /**
+     * Indicates whether the provided character is a valid printable character.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided character is a printable
+     *         character, or <CODE>false</CODE> if not.
+     */
+    static boolean isPrintableCharacter(final char c) {
+        switch (c) {
+        case 'a':
+        case 'b':
+        case 'c':
+        case 'd':
+        case 'e':
+        case 'f':
+        case 'g':
+        case 'h':
+        case 'i':
+        case 'j':
+        case 'k':
+        case 'l':
+        case 'm':
+        case 'n':
+        case 'o':
+        case 'p':
+        case 'q':
+        case 'r':
+        case 's':
+        case 't':
+        case 'u':
+        case 'v':
+        case 'w':
+        case 'x':
+        case 'y':
+        case 'z':
+        case 'A':
+        case 'B':
+        case 'C':
+        case 'D':
+        case 'E':
+        case 'F':
+        case 'G':
+        case 'H':
+        case 'I':
+        case 'J':
+        case 'K':
+        case 'L':
+        case 'M':
+        case 'N':
+        case 'O':
+        case 'P':
+        case 'Q':
+        case 'R':
+        case 'S':
+        case 'T':
+        case 'U':
+        case 'V':
+        case 'W':
+        case 'X':
+        case 'Y':
+        case 'Z':
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+        case '\'':
+        case '(':
+        case ')':
+        case '+':
+        case ',':
+        case '-':
+        case '.':
+        case '=':
+        case '/':
+        case ':':
+        case '?':
+        case ' ':
+            return true;
+        default:
+            return false;
+        }
     }
 
-    // Get the value as a string and determine its length. If it is
-    // empty, then that's not acceptable.
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-    if (valueLength == 0)
-    {
-
-      invalidReason.append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_EMPTY_VALUE.get());
-      return false;
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
     }
 
-    // Iterate through all the characters and see if they are
-    // acceptable.
-    for (int i = 0; i < valueLength; i++)
-    {
-      final char c = valueString.charAt(i);
-      if (!isPrintableCharacter(c))
-      {
-
-        invalidReason
-            .append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_ILLEGAL_CHARACTER.get(
-                valueString, String.valueOf(c), i));
-        return false;
-      }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
 
-    // If we've gotten here, then the value is OK.
-    return true;
-  }
+    public String getName() {
+        return SYNTAX_PRINTABLE_STRING_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Check to see if the provided value was null. If so, then that's
+        // not acceptable.
+        if (value == null) {
+
+            invalidReason.append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_EMPTY_VALUE.get());
+            return false;
+        }
+
+        // Get the value as a string and determine its length. If it is
+        // empty, then that's not acceptable.
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+        if (valueLength == 0) {
+
+            invalidReason.append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_EMPTY_VALUE.get());
+            return false;
+        }
+
+        // Iterate through all the characters and see if they are
+        // acceptable.
+        for (int i = 0; i < valueLength; i++) {
+            final char c = valueString.charAt(i);
+            if (!isPrintableCharacter(c)) {
+
+                invalidReason.append(WARN_ATTR_SYNTAX_PRINTABLE_STRING_ILLEGAL_CHARACTER.get(
+                        valueString, String.valueOf(c), i));
+                return false;
+            }
+        }
+
+        // If we've gotten here, then the value is OK.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java
index dd0f2b0..aa9cd7a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
@@ -35,51 +32,38 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the protocolInformationMatch matching rule defined in
  * X.520 and referenced in RFC 2252. However, since this matching rule and the
  * associated syntax have been deprecated, this matching rule behaves exactly
  * like the caseIgnoreMatch rule.
  */
-final class ProtocolInformationEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+final class ProtocolInformationEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
 
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return SchemaConstants.SINGLE_SPACE_VALUE;
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return ByteString.empty();
-      }
-    }
-
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return SchemaConstants.SINGLE_SPACE_VALUE;
+            } else {
+                // The value is empty, so it is already normalized.
+                return ByteString.empty();
+            }
         }
-      }
-    }
 
-    return ByteString.valueOf(buffer.toString());
-  }
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java
index 8aef2a7..7a5b2b0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,87 +26,63 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the protocol information attribute syntax, which is
  * being deprecated. As such, this implementation behaves exactly like the
  * directory string syntax.
  */
-final class ProtocolInformationSyntaxImpl extends AbstractSyntaxImpl
-{
+final class ProtocolInformationSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
+    }
 
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_PROTOCOL_INFORMATION_NAME;
+    }
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
 
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
 
+    public boolean isHumanReadable() {
+        return true;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_PROTOCOL_INFORMATION_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We will accept any value for this syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We will accept any value for this syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java
index cb9b34a..75758ef 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,10 +26,11 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
-import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
+import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_VALUE;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.AMR_DOUBLE_METAPHONE_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_IGNORE_OID;
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
 
 import java.util.regex.Pattern;
 
@@ -40,85 +40,58 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class provides a regex mechanism where a new syntax and its
  * corresponding matching rules can be created on-the-fly. A regex syntax is an
  * LDAPSyntaxDescriptionSyntax with X-PATTERN extension.
  */
-final class RegexSyntaxImpl extends AbstractSyntaxImpl
-{
-  // The Pattern associated with the regex.
-  private final Pattern pattern;
+final class RegexSyntaxImpl extends AbstractSyntaxImpl {
+    // The Pattern associated with the regex.
+    private final Pattern pattern;
 
-
-
-  RegexSyntaxImpl(final Pattern pattern)
-  {
-    Validator.ensureNotNull(pattern);
-    this.pattern = pattern;
-  }
-
-
-
-  @Override
-  public String getApproximateMatchingRule()
-  {
-    return AMR_DOUBLE_METAPHONE_OID;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return "Regex(" + pattern.toString() + ")";
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    final String strValue = value.toString();
-    final boolean matches = pattern.matcher(strValue).matches();
-    if (!matches)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_VALUE
-          .get(strValue, pattern.pattern());
-      invalidReason.append(message);
+    RegexSyntaxImpl(final Pattern pattern) {
+        Validator.ensureNotNull(pattern);
+        this.pattern = pattern;
     }
-    return matches;
-  }
+
+    @Override
+    public String getApproximateMatchingRule() {
+        return AMR_DOUBLE_METAPHONE_OID;
+    }
+
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
+    }
+
+    public String getName() {
+        return "Regex(" + pattern.toString() + ")";
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
+        return true;
+    }
+
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        final String strValue = value.toString();
+        final boolean matches = pattern.matcher(strValue).matches();
+        if (!matches) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_VALUE
+                            .get(strValue, pattern.pattern());
+            invalidReason.append(message);
+        }
+        return matches;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
index 651cfc9..303f04e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,22 +26,36 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.AttributeDescription.objectClass;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.Attributes;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entries;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.EntryNotFoundException;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.LinkedAttribute;
+import org.forgerock.opendj.ldap.RDN;
+import org.forgerock.opendj.ldap.ResultHandler;
 
 import com.forgerock.opendj.util.FutureResultTransformer;
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure that holds information about the
  * components of the LDAP schema. It includes the following kinds of elements:
@@ -57,3349 +70,2465 @@
  * <LI>Name form definitions</LI>
  * </UL>
  */
-public final class Schema
-{
-  private static final class EmptyImpl implements Impl
-  {
+public final class Schema {
+    private static final class EmptyImpl implements Impl {
 
-    private EmptyImpl()
-    {
-      // Nothing to do.
+        private EmptyImpl() {
+            // Nothing to do.
+        }
+
+        public boolean allowMalformedNamesAndOptions() {
+            return true;
+        }
+
+        public boolean allowNonStandardTelephoneNumbers() {
+            return true;
+        }
+
+        public boolean allowZeroLengthDirectoryStrings() {
+            return false;
+        }
+
+        @Override
+        public AttributeType getAttributeType(final String name) {
+            // Construct an placeholder attribute type with the given name,
+            // the default matching rule, and the default syntax. The OID of
+            // the attribute will be the normalized OID alias with "-oid"
+            // appended to the given name.
+            final StringBuilder builder = new StringBuilder(name.length() + 4);
+            StaticUtils.toLowerCase(name, builder);
+            builder.append("-oid");
+            final String noid = builder.toString();
+
+            return new AttributeType(noid, Collections.singletonList(name), "", Schema
+                    .getDefaultMatchingRule(), Schema.getDefaultSyntax());
+        }
+
+        @Override
+        public Collection<AttributeType> getAttributeTypes() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public List<AttributeType> getAttributeTypesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final ObjectClass structuralClass) {
+            return null;
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final String name) {
+            throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRules() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRulesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public DITStructureRule getDITStructureRule(final int ruleID) {
+            throw new UnknownSchemaElementException(WARN_DSR_UNKNOWN.get(String.valueOf(ruleID)));
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRules(final NameForm nameForm) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRulesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStuctureRules() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public MatchingRule getMatchingRule(final String name) {
+            throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRules() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRulesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) {
+            return null;
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final String name) {
+            throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUses() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public NameForm getNameForm(final String name) {
+            throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms(final ObjectClass structuralClass) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<NameForm> getNameFormsWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public ObjectClass getObjectClass(final String name) {
+            throw new UnknownSchemaElementException(WARN_OBJECTCLASS_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClasses() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClassesWithName(final String name) {
+            return Collections.emptyList();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String getSchemaName() {
+            return "Empty Schema";
+        }
+
+        @Override
+        public Syntax getSyntax(final String numericOID) {
+            // Fake up a syntax substituted by the default syntax.
+            return new Syntax(numericOID);
+        }
+
+        @Override
+        public Collection<Syntax> getSyntaxes() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public Collection<LocalizableMessage> getWarnings() {
+            return Collections.emptyList();
+        }
+
+        @Override
+        public boolean hasAttributeType(final String name) {
+            // In theory a non-strict schema always contains the requested
+            // attribute type, so we could always return true. However, we
+            // should provide a way for callers to differentiate between a
+            // real attribute type and a faked up attribute type.
+            return false;
+        }
+
+        @Override
+        public boolean hasDITContentRule(final String name) {
+            return false;
+        }
+
+        @Override
+        public boolean hasDITStructureRule(final int ruleID) {
+            return false;
+        }
+
+        @Override
+        public boolean hasMatchingRule(final String name) {
+            return false;
+        }
+
+        @Override
+        public boolean hasMatchingRuleUse(final String name) {
+            return false;
+        }
+
+        @Override
+        public boolean hasNameForm(final String name) {
+            return false;
+        }
+
+        @Override
+        public boolean hasObjectClass(final String name) {
+            return false;
+        }
+
+        @Override
+        public boolean hasSyntax(final String numericOID) {
+            return false;
+        }
+
+        @Override
+        public boolean isStrict() {
+            return false;
+        }
     }
 
+    private static interface Impl {
+        AttributeType getAttributeType(String name);
 
+        Collection<AttributeType> getAttributeTypes();
 
-    public boolean allowMalformedNamesAndOptions()
-    {
-      return true;
+        List<AttributeType> getAttributeTypesWithName(String name);
+
+        DITContentRule getDITContentRule(ObjectClass structuralClass);
+
+        DITContentRule getDITContentRule(String name);
+
+        Collection<DITContentRule> getDITContentRules();
+
+        Collection<DITContentRule> getDITContentRulesWithName(String name);
+
+        DITStructureRule getDITStructureRule(int ruleID);
+
+        Collection<DITStructureRule> getDITStructureRules(NameForm nameForm);
+
+        Collection<DITStructureRule> getDITStructureRulesWithName(String name);
+
+        Collection<DITStructureRule> getDITStuctureRules();
+
+        MatchingRule getMatchingRule(String name);
+
+        Collection<MatchingRule> getMatchingRules();
+
+        Collection<MatchingRule> getMatchingRulesWithName(String name);
+
+        MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule);
+
+        MatchingRuleUse getMatchingRuleUse(String name);
+
+        Collection<MatchingRuleUse> getMatchingRuleUses();
+
+        Collection<MatchingRuleUse> getMatchingRuleUsesWithName(String name);
+
+        NameForm getNameForm(String name);
+
+        Collection<NameForm> getNameForms();
+
+        Collection<NameForm> getNameForms(ObjectClass structuralClass);
+
+        Collection<NameForm> getNameFormsWithName(String name);
+
+        ObjectClass getObjectClass(String name);
+
+        Collection<ObjectClass> getObjectClasses();
+
+        Collection<ObjectClass> getObjectClassesWithName(String name);
+
+        String getSchemaName();
+
+        Syntax getSyntax(String numericOID);
+
+        Collection<Syntax> getSyntaxes();
+
+        Collection<LocalizableMessage> getWarnings();
+
+        boolean hasAttributeType(String name);
+
+        boolean hasDITContentRule(String name);
+
+        boolean hasDITStructureRule(int ruleID);
+
+        boolean hasMatchingRule(String name);
+
+        boolean hasMatchingRuleUse(String name);
+
+        boolean hasNameForm(String name);
+
+        boolean hasObjectClass(String name);
+
+        boolean hasSyntax(String numericOID);
+
+        boolean isStrict();
+
+        boolean allowMalformedNamesAndOptions();
+
+        boolean allowNonStandardTelephoneNumbers();
+
+        boolean allowZeroLengthDirectoryStrings();
     }
 
+    private static final class NonStrictImpl implements Impl {
+        private final Impl strictImpl;
 
+        private NonStrictImpl(final Impl strictImpl) {
+            this.strictImpl = strictImpl;
+        }
 
-    public boolean allowNonStandardTelephoneNumbers()
-    {
-      return true;
+        public boolean allowMalformedNamesAndOptions() {
+            return strictImpl.allowMalformedNamesAndOptions();
+        }
+
+        public boolean allowNonStandardTelephoneNumbers() {
+            return strictImpl.allowNonStandardTelephoneNumbers();
+        }
+
+        public boolean allowZeroLengthDirectoryStrings() {
+            return strictImpl.allowZeroLengthDirectoryStrings();
+        }
+
+        @Override
+        public AttributeType getAttributeType(final String name) {
+            if (!strictImpl.hasAttributeType(name)) {
+                // Construct an placeholder attribute type with the given name,
+                // the default matching rule, and the default syntax. The OID of
+                // the attribute will be the normalized OID alias with "-oid"
+                // appended to the given name.
+                final StringBuilder builder = new StringBuilder(name.length() + 4);
+                StaticUtils.toLowerCase(name, builder);
+                builder.append("-oid");
+                final String noid = builder.toString();
+
+                return new AttributeType(noid, Collections.singletonList(name), "", Schema
+                        .getDefaultMatchingRule(), Schema.getDefaultSyntax());
+            }
+            return strictImpl.getAttributeType(name);
+        }
+
+        @Override
+        public Collection<AttributeType> getAttributeTypes() {
+            return strictImpl.getAttributeTypes();
+        }
+
+        @Override
+        public List<AttributeType> getAttributeTypesWithName(final String name) {
+            return strictImpl.getAttributeTypesWithName(name);
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final ObjectClass structuralClass) {
+            return strictImpl.getDITContentRule(structuralClass);
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final String name) {
+            return strictImpl.getDITContentRule(name);
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRules() {
+            return strictImpl.getDITContentRules();
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRulesWithName(final String name) {
+            return strictImpl.getDITContentRulesWithName(name);
+        }
+
+        @Override
+        public DITStructureRule getDITStructureRule(final int ruleID) {
+            return strictImpl.getDITStructureRule(ruleID);
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRules(final NameForm nameForm) {
+            return strictImpl.getDITStructureRules(nameForm);
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRulesWithName(final String name) {
+            return strictImpl.getDITStructureRulesWithName(name);
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStuctureRules() {
+            return strictImpl.getDITStuctureRules();
+        }
+
+        @Override
+        public MatchingRule getMatchingRule(final String name) {
+            return strictImpl.getMatchingRule(name);
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRules() {
+            return strictImpl.getMatchingRules();
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRulesWithName(final String name) {
+            return strictImpl.getMatchingRulesWithName(name);
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) {
+            return strictImpl.getMatchingRuleUse(matchingRule);
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final String name) {
+            return strictImpl.getMatchingRuleUse(name);
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUses() {
+            return strictImpl.getMatchingRuleUses();
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(final String name) {
+            return strictImpl.getMatchingRuleUsesWithName(name);
+        }
+
+        @Override
+        public NameForm getNameForm(final String name) {
+            return strictImpl.getNameForm(name);
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms() {
+            return strictImpl.getNameForms();
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms(final ObjectClass structuralClass) {
+            return strictImpl.getNameForms(structuralClass);
+        }
+
+        @Override
+        public Collection<NameForm> getNameFormsWithName(final String name) {
+            return strictImpl.getNameFormsWithName(name);
+        }
+
+        @Override
+        public ObjectClass getObjectClass(final String name) {
+            return strictImpl.getObjectClass(name);
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClasses() {
+            return strictImpl.getObjectClasses();
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClassesWithName(final String name) {
+            return strictImpl.getObjectClassesWithName(name);
+        }
+
+        @Override
+        public String getSchemaName() {
+            return strictImpl.getSchemaName();
+        }
+
+        @Override
+        public Syntax getSyntax(final String numericOID) {
+            if (!strictImpl.hasSyntax(numericOID)) {
+                return new Syntax(numericOID);
+            }
+            return strictImpl.getSyntax(numericOID);
+        }
+
+        @Override
+        public Collection<Syntax> getSyntaxes() {
+            return strictImpl.getSyntaxes();
+        }
+
+        @Override
+        public Collection<LocalizableMessage> getWarnings() {
+            return strictImpl.getWarnings();
+        }
+
+        @Override
+        public boolean hasAttributeType(final String name) {
+            // In theory a non-strict schema always contains the requested
+            // attribute type, so we could always return true. However, we
+            // should provide a way for callers to differentiate between a
+            // real attribute type and a faked up attribute type.
+            return strictImpl.hasAttributeType(name);
+        }
+
+        @Override
+        public boolean hasDITContentRule(final String name) {
+            return strictImpl.hasDITContentRule(name);
+        }
+
+        @Override
+        public boolean hasDITStructureRule(final int ruleID) {
+            return strictImpl.hasDITStructureRule(ruleID);
+        }
+
+        @Override
+        public boolean hasMatchingRule(final String name) {
+            return strictImpl.hasMatchingRule(name);
+        }
+
+        @Override
+        public boolean hasMatchingRuleUse(final String name) {
+            return strictImpl.hasMatchingRuleUse(name);
+        }
+
+        @Override
+        public boolean hasNameForm(final String name) {
+            return strictImpl.hasNameForm(name);
+        }
+
+        @Override
+        public boolean hasObjectClass(final String name) {
+            return strictImpl.hasObjectClass(name);
+        }
+
+        @Override
+        public boolean hasSyntax(final String numericOID) {
+            return strictImpl.hasSyntax(numericOID);
+        }
+
+        @Override
+        public boolean isStrict() {
+            return false;
+        }
     }
 
+    private static final class StrictImpl implements Impl {
+        private final Map<Integer, DITStructureRule> id2StructureRules;
 
+        private final Map<String, List<AttributeType>> name2AttributeTypes;
 
-    public boolean allowZeroLengthDirectoryStrings()
-    {
-      return false;
+        private final Map<String, List<DITContentRule>> name2ContentRules;
+
+        private final Map<String, List<MatchingRule>> name2MatchingRules;
+
+        private final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses;
+
+        private final Map<String, List<NameForm>> name2NameForms;
+
+        private final Map<String, List<ObjectClass>> name2ObjectClasses;
+
+        private final Map<String, List<DITStructureRule>> name2StructureRules;
+
+        private final Map<String, List<DITStructureRule>> nameForm2StructureRules;
+
+        private final Map<String, AttributeType> numericOID2AttributeTypes;
+
+        private final Map<String, DITContentRule> numericOID2ContentRules;
+
+        private final Map<String, MatchingRule> numericOID2MatchingRules;
+
+        private final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses;
+
+        private final Map<String, NameForm> numericOID2NameForms;
+
+        private final Map<String, ObjectClass> numericOID2ObjectClasses;
+
+        private final Map<String, Syntax> numericOID2Syntaxes;
+
+        private final Map<String, List<NameForm>> objectClass2NameForms;
+
+        private final List<LocalizableMessage> warnings;
+
+        private final String schemaName;
+
+        private final boolean allowNonStandardTelephoneNumbers;
+
+        private final boolean allowZeroLengthDirectoryStrings;
+
+        private final boolean allowMalformedNamesAndOptions;
+
+        StrictImpl(final String schemaName, final boolean allowMalformedNamesAndOptions,
+                final boolean allowNonStandardTelephoneNumbers,
+                final boolean allowZeroLengthDirectoryStrings,
+                final Map<String, Syntax> numericOID2Syntaxes,
+                final Map<String, MatchingRule> numericOID2MatchingRules,
+                final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses,
+                final Map<String, AttributeType> numericOID2AttributeTypes,
+                final Map<String, ObjectClass> numericOID2ObjectClasses,
+                final Map<String, NameForm> numericOID2NameForms,
+                final Map<String, DITContentRule> numericOID2ContentRules,
+                final Map<Integer, DITStructureRule> id2StructureRules,
+                final Map<String, List<MatchingRule>> name2MatchingRules,
+                final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses,
+                final Map<String, List<AttributeType>> name2AttributeTypes,
+                final Map<String, List<ObjectClass>> name2ObjectClasses,
+                final Map<String, List<NameForm>> name2NameForms,
+                final Map<String, List<DITContentRule>> name2ContentRules,
+                final Map<String, List<DITStructureRule>> name2StructureRules,
+                final Map<String, List<NameForm>> objectClass2NameForms,
+                final Map<String, List<DITStructureRule>> nameForm2StructureRules,
+                final List<LocalizableMessage> warnings) {
+            this.schemaName = schemaName;
+            this.allowMalformedNamesAndOptions = allowMalformedNamesAndOptions;
+            this.allowNonStandardTelephoneNumbers = allowNonStandardTelephoneNumbers;
+            this.allowZeroLengthDirectoryStrings = allowZeroLengthDirectoryStrings;
+            this.numericOID2Syntaxes = Collections.unmodifiableMap(numericOID2Syntaxes);
+            this.numericOID2MatchingRules = Collections.unmodifiableMap(numericOID2MatchingRules);
+            this.numericOID2MatchingRuleUses =
+                    Collections.unmodifiableMap(numericOID2MatchingRuleUses);
+            this.numericOID2AttributeTypes = Collections.unmodifiableMap(numericOID2AttributeTypes);
+            this.numericOID2ObjectClasses = Collections.unmodifiableMap(numericOID2ObjectClasses);
+            this.numericOID2NameForms = Collections.unmodifiableMap(numericOID2NameForms);
+            this.numericOID2ContentRules = Collections.unmodifiableMap(numericOID2ContentRules);
+            this.id2StructureRules = Collections.unmodifiableMap(id2StructureRules);
+            this.name2MatchingRules = Collections.unmodifiableMap(name2MatchingRules);
+            this.name2MatchingRuleUses = Collections.unmodifiableMap(name2MatchingRuleUses);
+            this.name2AttributeTypes = Collections.unmodifiableMap(name2AttributeTypes);
+            this.name2ObjectClasses = Collections.unmodifiableMap(name2ObjectClasses);
+            this.name2NameForms = Collections.unmodifiableMap(name2NameForms);
+            this.name2ContentRules = Collections.unmodifiableMap(name2ContentRules);
+            this.name2StructureRules = Collections.unmodifiableMap(name2StructureRules);
+            this.objectClass2NameForms = Collections.unmodifiableMap(objectClass2NameForms);
+            this.nameForm2StructureRules = Collections.unmodifiableMap(nameForm2StructureRules);
+            this.warnings = Collections.unmodifiableList(warnings);
+        }
+
+        public boolean allowMalformedNamesAndOptions() {
+            return allowMalformedNamesAndOptions;
+        }
+
+        public boolean allowNonStandardTelephoneNumbers() {
+            return allowNonStandardTelephoneNumbers;
+        }
+
+        public boolean allowZeroLengthDirectoryStrings() {
+            return allowZeroLengthDirectoryStrings;
+        }
+
+        @Override
+        public AttributeType getAttributeType(final String name) {
+            final AttributeType type = numericOID2AttributeTypes.get(name);
+            if (type != null) {
+                return type;
+            }
+            final List<AttributeType> attributes =
+                    name2AttributeTypes.get(StaticUtils.toLowerCase(name));
+            if (attributes != null) {
+                if (attributes.size() == 1) {
+                    return attributes.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_ATTR_TYPE_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<AttributeType> getAttributeTypes() {
+            return numericOID2AttributeTypes.values();
+        }
+
+        @Override
+        public List<AttributeType> getAttributeTypesWithName(final String name) {
+            final List<AttributeType> attributes =
+                    name2AttributeTypes.get(StaticUtils.toLowerCase(name));
+            if (attributes == null) {
+                return Collections.emptyList();
+            } else {
+                return attributes;
+            }
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final ObjectClass structuralClass) {
+            return numericOID2ContentRules.get(structuralClass.getOID());
+        }
+
+        @Override
+        public DITContentRule getDITContentRule(final String name) {
+            final DITContentRule rule = numericOID2ContentRules.get(name);
+            if (rule != null) {
+                return rule;
+            }
+            final List<DITContentRule> rules = name2ContentRules.get(StaticUtils.toLowerCase(name));
+            if (rules != null) {
+                if (rules.size() == 1) {
+                    return rules.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_DCR_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRules() {
+            return numericOID2ContentRules.values();
+        }
+
+        @Override
+        public Collection<DITContentRule> getDITContentRulesWithName(final String name) {
+            final List<DITContentRule> rules = name2ContentRules.get(StaticUtils.toLowerCase(name));
+            if (rules == null) {
+                return Collections.emptyList();
+            } else {
+                return rules;
+            }
+        }
+
+        @Override
+        public DITStructureRule getDITStructureRule(final int ruleID) {
+            final DITStructureRule rule = id2StructureRules.get(ruleID);
+            if (rule == null) {
+                throw new UnknownSchemaElementException(WARN_DSR_UNKNOWN
+                        .get(String.valueOf(ruleID)));
+            }
+            return rule;
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRules(final NameForm nameForm) {
+            final List<DITStructureRule> rules = nameForm2StructureRules.get(nameForm.getOID());
+            if (rules == null) {
+                return Collections.emptyList();
+            } else {
+                return rules;
+            }
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStructureRulesWithName(final String name) {
+            final List<DITStructureRule> rules =
+                    name2StructureRules.get(StaticUtils.toLowerCase(name));
+            if (rules == null) {
+                return Collections.emptyList();
+            } else {
+                return rules;
+            }
+        }
+
+        @Override
+        public Collection<DITStructureRule> getDITStuctureRules() {
+            return id2StructureRules.values();
+        }
+
+        @Override
+        public MatchingRule getMatchingRule(final String name) {
+            final MatchingRule rule = numericOID2MatchingRules.get(name);
+            if (rule != null) {
+                return rule;
+            }
+            final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils.toLowerCase(name));
+            if (rules != null) {
+                if (rules.size() == 1) {
+                    return rules.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_MR_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRules() {
+            return numericOID2MatchingRules.values();
+        }
+
+        @Override
+        public Collection<MatchingRule> getMatchingRulesWithName(final String name) {
+            final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils.toLowerCase(name));
+            if (rules == null) {
+                return Collections.emptyList();
+            } else {
+                return rules;
+            }
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) {
+            return numericOID2MatchingRuleUses.get(matchingRule.getOID());
+        }
+
+        @Override
+        public MatchingRuleUse getMatchingRuleUse(final String name) {
+            final MatchingRuleUse rule = numericOID2MatchingRuleUses.get(name);
+            if (rule != null) {
+                return rule;
+            }
+            final List<MatchingRuleUse> uses =
+                    name2MatchingRuleUses.get(StaticUtils.toLowerCase(name));
+            if (uses != null) {
+                if (uses.size() == 1) {
+                    return uses.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_MRU_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUses() {
+            return numericOID2MatchingRuleUses.values();
+        }
+
+        @Override
+        public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(final String name) {
+            final List<MatchingRuleUse> rules =
+                    name2MatchingRuleUses.get(StaticUtils.toLowerCase(name));
+            if (rules == null) {
+                return Collections.emptyList();
+            } else {
+                return rules;
+            }
+        }
+
+        @Override
+        public NameForm getNameForm(final String name) {
+            final NameForm form = numericOID2NameForms.get(name);
+            if (form != null) {
+                return form;
+            }
+            final List<NameForm> forms = name2NameForms.get(StaticUtils.toLowerCase(name));
+            if (forms != null) {
+                if (forms.size() == 1) {
+                    return forms.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_NAMEFORM_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms() {
+            return numericOID2NameForms.values();
+        }
+
+        @Override
+        public Collection<NameForm> getNameForms(final ObjectClass structuralClass) {
+            final List<NameForm> forms = objectClass2NameForms.get(structuralClass.getOID());
+            if (forms == null) {
+                return Collections.emptyList();
+            } else {
+                return forms;
+            }
+        }
+
+        @Override
+        public Collection<NameForm> getNameFormsWithName(final String name) {
+            final List<NameForm> forms = name2NameForms.get(StaticUtils.toLowerCase(name));
+            if (forms == null) {
+                return Collections.emptyList();
+            } else {
+                return forms;
+            }
+        }
+
+        @Override
+        public ObjectClass getObjectClass(final String name) {
+            final ObjectClass oc = numericOID2ObjectClasses.get(name);
+            if (oc != null) {
+                return oc;
+            }
+            final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils.toLowerCase(name));
+            if (classes != null) {
+                if (classes.size() == 1) {
+                    return classes.get(0);
+                }
+                throw new UnknownSchemaElementException(WARN_OBJECTCLASS_AMBIGIOUS.get(name));
+            }
+            throw new UnknownSchemaElementException(WARN_OBJECTCLASS_UNKNOWN.get(name));
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClasses() {
+            return numericOID2ObjectClasses.values();
+        }
+
+        @Override
+        public Collection<ObjectClass> getObjectClassesWithName(final String name) {
+            final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils.toLowerCase(name));
+            if (classes == null) {
+                return Collections.emptyList();
+            } else {
+                return classes;
+            }
+        }
+
+        @Override
+        public String getSchemaName() {
+            return schemaName;
+        }
+
+        @Override
+        public Syntax getSyntax(final String numericOID) {
+            final Syntax syntax = numericOID2Syntaxes.get(numericOID);
+            if (syntax == null) {
+                throw new UnknownSchemaElementException(WARN_SYNTAX_UNKNOWN.get(numericOID));
+            }
+            return syntax;
+        }
+
+        @Override
+        public Collection<Syntax> getSyntaxes() {
+            return numericOID2Syntaxes.values();
+        }
+
+        @Override
+        public Collection<LocalizableMessage> getWarnings() {
+            return warnings;
+        }
+
+        @Override
+        public boolean hasAttributeType(final String name) {
+            if (numericOID2AttributeTypes.containsKey(name)) {
+                return true;
+            }
+            final List<AttributeType> attributes =
+                    name2AttributeTypes.get(StaticUtils.toLowerCase(name));
+            return attributes != null && attributes.size() == 1;
+        }
+
+        @Override
+        public boolean hasDITContentRule(final String name) {
+            if (numericOID2ContentRules.containsKey(name)) {
+                return true;
+            }
+            final List<DITContentRule> rules = name2ContentRules.get(StaticUtils.toLowerCase(name));
+            return rules != null && rules.size() == 1;
+        }
+
+        @Override
+        public boolean hasDITStructureRule(final int ruleID) {
+            return id2StructureRules.containsKey(ruleID);
+        }
+
+        @Override
+        public boolean hasMatchingRule(final String name) {
+            if (numericOID2MatchingRules.containsKey(name)) {
+                return true;
+            }
+            final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils.toLowerCase(name));
+            return rules != null && rules.size() == 1;
+        }
+
+        @Override
+        public boolean hasMatchingRuleUse(final String name) {
+            if (numericOID2MatchingRuleUses.containsKey(name)) {
+                return true;
+            }
+            final List<MatchingRuleUse> uses =
+                    name2MatchingRuleUses.get(StaticUtils.toLowerCase(name));
+            return uses != null && uses.size() == 1;
+        }
+
+        @Override
+        public boolean hasNameForm(final String name) {
+            if (numericOID2NameForms.containsKey(name)) {
+                return true;
+            }
+            final List<NameForm> forms = name2NameForms.get(StaticUtils.toLowerCase(name));
+            return forms != null && forms.size() == 1;
+        }
+
+        @Override
+        public boolean hasObjectClass(final String name) {
+            if (numericOID2ObjectClasses.containsKey(name)) {
+                return true;
+            }
+            final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils.toLowerCase(name));
+            return classes != null && classes.size() == 1;
+        }
+
+        @Override
+        public boolean hasSyntax(final String numericOID) {
+            return numericOID2Syntaxes.containsKey(numericOID);
+        }
+
+        @Override
+        public boolean isStrict() {
+            return true;
+        }
     }
 
+    /*
+     * WARNING: do not reference the core schema in the following declarations.
+     */
 
+    private static final Schema EMPTY_SCHEMA = new Schema(new EmptyImpl());
 
-    @Override
-    public AttributeType getAttributeType(final String name)
-    {
-      // Construct an placeholder attribute type with the given name,
-      // the default matching rule, and the default syntax. The OID of
-      // the attribute will be the normalized OID alias with "-oid"
-      // appended to the given name.
-      final StringBuilder builder = new StringBuilder(name.length() + 4);
-      StaticUtils.toLowerCase(name, builder);
-      builder.append("-oid");
-      final String noid = builder.toString();
+    static final String ATTR_ATTRIBUTE_TYPES = "attributeTypes";
 
-      return new AttributeType(noid, Collections.singletonList(name), "",
-          Schema.getDefaultMatchingRule(), Schema.getDefaultSyntax());
-    }
+    static final String ATTR_DIT_CONTENT_RULES = "dITContentRules";
 
+    static final String ATTR_DIT_STRUCTURE_RULES = "dITStructureRules";
 
+    static final String ATTR_LDAP_SYNTAXES = "ldapSyntaxes";
 
-    @Override
-    public Collection<AttributeType> getAttributeTypes()
-    {
-      return Collections.emptyList();
-    }
+    static final String ATTR_MATCHING_RULE_USE = "matchingRuleUse";
 
+    static final String ATTR_MATCHING_RULES = "matchingRules";
 
+    static final String ATTR_NAME_FORMS = "nameForms";
 
-    @Override
-    public List<AttributeType> getAttributeTypesWithName(final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final ObjectClass structuralClass)
-    {
-      return null;
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final String name)
-    {
-      throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRules()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRulesWithName(
-        final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public DITStructureRule getDITStructureRule(final int ruleID)
-    {
-      throw new UnknownSchemaElementException(WARN_DSR_UNKNOWN.get(String
-          .valueOf(ruleID)));
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRules(
-        final NameForm nameForm)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRulesWithName(
-        final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStuctureRules()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public MatchingRule getMatchingRule(final String name)
-    {
-      throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRules()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRulesWithName(final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule)
-    {
-      return null;
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final String name)
-    {
-      throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUses()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(
-        final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public NameForm getNameForm(final String name)
-    {
-      throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms(final ObjectClass structuralClass)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameFormsWithName(final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public ObjectClass getObjectClass(final String name)
-    {
-      throw new UnknownSchemaElementException(
-          WARN_OBJECTCLASS_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClasses()
-    {
-      return Collections.emptyList();
-    }
-
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClassesWithName(final String name)
-    {
-      return Collections.emptyList();
-    }
-
-
+    static final String ATTR_OBJECT_CLASSES = "objectClasses";
 
     /**
-     * {@inheritDoc}
+     * Returns the core schema. The core schema is non-strict and contains the
+     * following standard LDAP schema elements:
+     * <ul>
+     * <li><a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
+     * Directory Access Protocol (LDAP): Directory Information Models </a>
+     * <li><a href="http://tools.ietf.org/html/rfc4517">RFC 4517 - Lightweight
+     * Directory Access Protocol (LDAP): Syntaxes and Matching Rules </a>
+     * <li><a href="http://tools.ietf.org/html/rfc4519">RFC 4519 - Lightweight
+     * Directory Access Protocol (LDAP): Schema for User Applications </a>
+     * <li><a href="http://tools.ietf.org/html/rfc4530">RFC 4530 - Lightweight
+     * Directory Access Protocol (LDAP): entryUUID Operational Attribute </a>
+     * <li><a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing
+     * Vendor Information in the LDAP root DSE </a>
+     * <li><a href="http://tools.ietf.org/html/rfc3112">RFC 3112 - LDAP
+     * Authentication Password Schema </a>
+     * </ul>
+     *
+     * @return The core schema.
      */
-    @Override
-    public String getSchemaName()
-    {
-      return "Empty Schema";
+    public static Schema getCoreSchema() {
+        return CoreSchemaImpl.getInstance();
     }
 
-
-
-    @Override
-    public Syntax getSyntax(final String numericOID)
-    {
-      // Fake up a syntax substituted by the default syntax.
-      return new Syntax(numericOID);
+    /**
+     * Returns the default schema which should be used by this application. The
+     * default schema is initially set to the core schema.
+     *
+     * @return The default schema which should be used by this application.
+     */
+    public static Schema getDefaultSchema() {
+        return DefaultSchema.schema;
     }
 
-
-
-    @Override
-    public Collection<Syntax> getSyntaxes()
-    {
-      return Collections.emptyList();
+    /**
+     * Returns the empty schema. The empty schema is non-strict and does not
+     * contain any schema elements.
+     *
+     * @return The empty schema.
+     */
+    public static Schema getEmptySchema() {
+        return EMPTY_SCHEMA;
     }
 
+    /**
+     * Asynchronously reads the schema contained in the named subschema
+     * sub-entry.
+     * <p>
+     * If the requested schema is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, the returned future will never return {@code null}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the subschema sub-entry.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the retrieved schema.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public static FutureResult<Schema> readSchemaAsync(final Connection connection, final DN name,
+            final ResultHandler<? super Schema> handler) {
+        final FutureResultTransformer<SchemaBuilder, Schema> future =
+                new FutureResultTransformer<SchemaBuilder, Schema>(handler) {
 
+                    @Override
+                    protected Schema transformResult(final SchemaBuilder builder)
+                            throws ErrorResultException {
+                        return builder.toSchema();
+                    }
 
-    @Override
-    public Collection<LocalizableMessage> getWarnings()
-    {
-      return Collections.emptyList();
+                };
+
+        final SchemaBuilder builder = new SchemaBuilder();
+        final FutureResult<SchemaBuilder> innerFuture =
+                builder.addSchemaAsync(connection, name, future, true);
+        future.setFutureResult(innerFuture);
+        return future;
     }
 
-
-
-    @Override
-    public boolean hasAttributeType(final String name)
-    {
-      // In theory a non-strict schema always contains the requested
-      // attribute type, so we could always return true. However, we
-      // should provide a way for callers to differentiate between a
-      // real attribute type and a faked up attribute type.
-      return false;
+    /**
+     * Reads the schema contained in the named subschema sub-entry.
+     * <p>
+     * If the requested schema is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}. More
+     * specifically, this method will never return {@code null}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the subschema sub-entry.
+     * @return The schema from the Directory Server.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public static Schema readSchema(final Connection connection, final DN name)
+            throws ErrorResultException, InterruptedException {
+        return new SchemaBuilder().addSchema(connection, name, true).toSchema();
     }
 
+    /**
+     * Asynchronously reads the schema contained in the subschema sub-entry
+     * which applies to the named entry.
+     * <p>
+     * If the requested entry or its associated schema are not returned by the
+     * Directory Server then the request will fail with an
+     * {@link EntryNotFoundException}. More specifically, the returned future
+     * will never return {@code null}.
+     * <p>
+     * This implementation first reads the {@code subschemaSubentry} attribute
+     * of the entry in order to identify the schema and then invokes
+     * {@link #readSchemaAsync(Connection, DN, ResultHandler)} to read the
+     * schema.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the entry whose schema is to be
+     *            located.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @return A future representing the retrieved schema.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public static FutureResult<Schema> readSchemaForEntryAsync(final Connection connection,
+            final DN name, final ResultHandler<? super Schema> handler) {
+        final FutureResultTransformer<SchemaBuilder, Schema> future =
+                new FutureResultTransformer<SchemaBuilder, Schema>(handler) {
 
+                    @Override
+                    protected Schema transformResult(final SchemaBuilder builder)
+                            throws ErrorResultException {
+                        return builder.toSchema();
+                    }
 
-    @Override
-    public boolean hasDITContentRule(final String name)
-    {
-      return false;
+                };
+
+        final SchemaBuilder builder = new SchemaBuilder();
+        final FutureResult<SchemaBuilder> innerFuture =
+                builder.addSchemaForEntryAsync(connection, name, future, true);
+        future.setFutureResult(innerFuture);
+        return future;
+
     }
 
-
-
-    @Override
-    public boolean hasDITStructureRule(final int ruleID)
-    {
-      return false;
+    /**
+     * Reads the schema contained in the subschema sub-entry which applies to
+     * the named entry.
+     * <p>
+     * If the requested entry or its associated schema are not returned by the
+     * Directory Server then the request will fail with an
+     * {@link EntryNotFoundException}. More specifically, this method will never
+     * return {@code null}.
+     * <p>
+     * This implementation first reads the {@code subschemaSubentry} attribute
+     * of the entry in order to identify the schema and then invokes
+     * {@link #readSchema(Connection, DN)} to read the schema.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the entry whose schema is to be
+     *            located.
+     * @return The schema from the Directory Server which applies to the named
+     *         entry.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public static Schema readSchemaForEntry(final Connection connection, final DN name)
+            throws ErrorResultException, InterruptedException {
+        return new SchemaBuilder().addSchemaForEntry(connection, name, true).toSchema();
     }
 
-
-
-    @Override
-    public boolean hasMatchingRule(final String name)
-    {
-      return false;
+    /**
+     * Sets the default schema which should be used by this application. The
+     * default schema is initially set to the core schema.
+     *
+     * @param schema
+     *            The default schema which should be used by this application.
+     */
+    public static void setDefaultSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        DefaultSchema.schema = schema;
     }
 
-
-
-    @Override
-    public boolean hasMatchingRuleUse(final String name)
-    {
-      return false;
+    /**
+     * Parses the provided entry as a subschema subentry. Any problems
+     * encountered while parsing the entry can be retrieved using the returned
+     * schema's {@link #getWarnings()} method.
+     *
+     * @param entry
+     *            The subschema subentry to be parsed.
+     * @return The parsed schema.
+     */
+    public static Schema valueOf(final Entry entry) {
+        return new SchemaBuilder(entry).toSchema();
     }
 
-
-
-    @Override
-    public boolean hasNameForm(final String name)
-    {
-      return false;
+    static MatchingRule getDefaultMatchingRule() {
+        return CoreSchema.getCaseIgnoreMatchingRule();
     }
 
-
-
-    @Override
-    public boolean hasObjectClass(final String name)
-    {
-      return false;
+    static Syntax getDefaultSyntax() {
+        return CoreSchema.getDirectoryStringSyntax();
     }
 
+    private final Impl impl;
 
-
-    @Override
-    public boolean hasSyntax(final String numericOID)
-    {
-      return false;
+    Schema(final String schemaName, final boolean allowMalformedNamesAndOptions,
+            final boolean allowNonStandardTelephoneNumbers,
+            final boolean allowZeroLengthDirectoryStrings,
+            final Map<String, Syntax> numericOID2Syntaxes,
+            final Map<String, MatchingRule> numericOID2MatchingRules,
+            final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses,
+            final Map<String, AttributeType> numericOID2AttributeTypes,
+            final Map<String, ObjectClass> numericOID2ObjectClasses,
+            final Map<String, NameForm> numericOID2NameForms,
+            final Map<String, DITContentRule> numericOID2ContentRules,
+            final Map<Integer, DITStructureRule> id2StructureRules,
+            final Map<String, List<MatchingRule>> name2MatchingRules,
+            final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses,
+            final Map<String, List<AttributeType>> name2AttributeTypes,
+            final Map<String, List<ObjectClass>> name2ObjectClasses,
+            final Map<String, List<NameForm>> name2NameForms,
+            final Map<String, List<DITContentRule>> name2ContentRules,
+            final Map<String, List<DITStructureRule>> name2StructureRules,
+            final Map<String, List<NameForm>> objectClass2NameForms,
+            final Map<String, List<DITStructureRule>> nameForm2StructureRules,
+            final List<LocalizableMessage> warnings) {
+        impl =
+                new StrictImpl(schemaName, allowMalformedNamesAndOptions,
+                        allowNonStandardTelephoneNumbers, allowZeroLengthDirectoryStrings,
+                        numericOID2Syntaxes, numericOID2MatchingRules, numericOID2MatchingRuleUses,
+                        numericOID2AttributeTypes, numericOID2ObjectClasses, numericOID2NameForms,
+                        numericOID2ContentRules, id2StructureRules, name2MatchingRules,
+                        name2MatchingRuleUses, name2AttributeTypes, name2ObjectClasses,
+                        name2NameForms, name2ContentRules, name2StructureRules,
+                        objectClass2NameForms, nameForm2StructureRules, warnings);
     }
 
-
-
-    @Override
-    public boolean isStrict()
-    {
-      return false;
-    }
-  }
-
-
-
-  private static interface Impl
-  {
-    AttributeType getAttributeType(String name);
-
-
-
-    Collection<AttributeType> getAttributeTypes();
-
-
-
-    List<AttributeType> getAttributeTypesWithName(String name);
-
-
-
-    DITContentRule getDITContentRule(ObjectClass structuralClass);
-
-
-
-    DITContentRule getDITContentRule(String name);
-
-
-
-    Collection<DITContentRule> getDITContentRules();
-
-
-
-    Collection<DITContentRule> getDITContentRulesWithName(String name);
-
-
-
-    DITStructureRule getDITStructureRule(int ruleID);
-
-
-
-    Collection<DITStructureRule> getDITStructureRules(NameForm nameForm);
-
-
-
-    Collection<DITStructureRule> getDITStructureRulesWithName(String name);
-
-
-
-    Collection<DITStructureRule> getDITStuctureRules();
-
-
-
-    MatchingRule getMatchingRule(String name);
-
-
-
-    Collection<MatchingRule> getMatchingRules();
-
-
-
-    Collection<MatchingRule> getMatchingRulesWithName(String name);
-
-
-
-    MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule);
-
-
-
-    MatchingRuleUse getMatchingRuleUse(String name);
-
-
-
-    Collection<MatchingRuleUse> getMatchingRuleUses();
-
-
-
-    Collection<MatchingRuleUse> getMatchingRuleUsesWithName(String name);
-
-
-
-    NameForm getNameForm(String name);
-
-
-
-    Collection<NameForm> getNameForms();
-
-
-
-    Collection<NameForm> getNameForms(ObjectClass structuralClass);
-
-
-
-    Collection<NameForm> getNameFormsWithName(String name);
-
-
-
-    ObjectClass getObjectClass(String name);
-
-
-
-    Collection<ObjectClass> getObjectClasses();
-
-
-
-    Collection<ObjectClass> getObjectClassesWithName(String name);
-
-
-
-    String getSchemaName();
-
-
-
-    Syntax getSyntax(String numericOID);
-
-
-
-    Collection<Syntax> getSyntaxes();
-
-
-
-    Collection<LocalizableMessage> getWarnings();
-
-
-
-    boolean hasAttributeType(String name);
-
-
-
-    boolean hasDITContentRule(String name);
-
-
-
-    boolean hasDITStructureRule(int ruleID);
-
-
-
-    boolean hasMatchingRule(String name);
-
-
-
-    boolean hasMatchingRuleUse(String name);
-
-
-
-    boolean hasNameForm(String name);
-
-
-
-    boolean hasObjectClass(String name);
-
-
-
-    boolean hasSyntax(String numericOID);
-
-
-
-    boolean isStrict();
-
-
-
-    boolean allowMalformedNamesAndOptions();
-
-
-
-    boolean allowNonStandardTelephoneNumbers();
-
-
-
-    boolean allowZeroLengthDirectoryStrings();
-  }
-
-
-
-  private static final class NonStrictImpl implements Impl
-  {
-    private final Impl strictImpl;
-
-
-
-    private NonStrictImpl(final Impl strictImpl)
-    {
-      this.strictImpl = strictImpl;
+    private Schema(final Impl impl) {
+        this.impl = impl;
     }
 
-
-
-    public boolean allowMalformedNamesAndOptions()
-    {
-      return strictImpl.allowMalformedNamesAndOptions();
+    /**
+     * Returns {@code true} if this schema allows certain illegal characters in
+     * OIDs and attribute options. When this compatibility option is set to
+     * {@code true} the following illegal characters will be permitted in
+     * addition to those permitted in section 1.4 of RFC 4512:
+     *
+     * <pre>
+     * USCORE  = %x5F ; underscore ("_")
+     * DOT     = %x2E ; period (".")
+     * </pre>
+     *
+     * By default this compatibility option is set to {@code true} because these
+     * characters are often used for naming purposes (such as collation rules).
+     *
+     * @return {@code true} if this schema allows certain illegal characters in
+     *         OIDs and attribute options.
+     * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
+     *      Directory Access Protocol (LDAP): Directory Information Models </a>
+     */
+    public boolean allowMalformedNamesAndOptions() {
+        return impl.allowMalformedNamesAndOptions();
     }
 
-
-
-    public boolean allowNonStandardTelephoneNumbers()
-    {
-      return strictImpl.allowNonStandardTelephoneNumbers();
+    /**
+     * Returns {@code true} if the Telephone Number syntax defined for this
+     * schema allows values which do not conform to the E.123 international
+     * telephone number format.
+     * <p>
+     * By default this compatibility option is set to {@code true}.
+     *
+     * @return {@code true} if the Telephone Number syntax defined for this
+     *         schema allows values which do not conform to the E.123
+     *         international telephone number format.
+     */
+    public boolean allowNonStandardTelephoneNumbers() {
+        return impl.allowNonStandardTelephoneNumbers();
     }
 
-
-
-    public boolean allowZeroLengthDirectoryStrings()
-    {
-      return strictImpl.allowZeroLengthDirectoryStrings();
+    /**
+     * Returns {@code true} if zero-length values will be allowed by the
+     * Directory String syntax defined for this schema. This is technically
+     * forbidden by the LDAP specification, but it was allowed in earlier
+     * versions of the server, and the discussion of the directory string syntax
+     * in RFC 2252 does not explicitly state that they are not allowed.
+     * <p>
+     * By default this compatibility option is set to {@code false}.
+     *
+     * @return {@code true} if zero-length values will be allowed by the
+     *         Directory String syntax defined for this schema, or {@code false}
+     *         if not.
+     */
+    public boolean allowZeroLengthDirectoryStrings() {
+        return impl.allowZeroLengthDirectoryStrings();
     }
 
-
-
-    @Override
-    public AttributeType getAttributeType(final String name)
-    {
-      if (!strictImpl.hasAttributeType(name))
-      {
-        // Construct an placeholder attribute type with the given name,
-        // the default matching rule, and the default syntax. The OID of
-        // the attribute will be the normalized OID alias with "-oid"
-        // appended to the given name.
-        final StringBuilder builder = new StringBuilder(name.length() + 4);
-        StaticUtils.toLowerCase(name, builder);
-        builder.append("-oid");
-        final String noid = builder.toString();
-
-        return new AttributeType(noid, Collections.singletonList(name), "",
-            Schema.getDefaultMatchingRule(), Schema.getDefaultSyntax());
-      }
-      return strictImpl.getAttributeType(name);
-    }
-
-
-
-    @Override
-    public Collection<AttributeType> getAttributeTypes()
-    {
-      return strictImpl.getAttributeTypes();
-    }
-
-
-
-    @Override
-    public List<AttributeType> getAttributeTypesWithName(final String name)
-    {
-      return strictImpl.getAttributeTypesWithName(name);
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final ObjectClass structuralClass)
-    {
-      return strictImpl.getDITContentRule(structuralClass);
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final String name)
-    {
-      return strictImpl.getDITContentRule(name);
-    }
-
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRules()
-    {
-      return strictImpl.getDITContentRules();
-    }
-
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRulesWithName(
-        final String name)
-    {
-      return strictImpl.getDITContentRulesWithName(name);
-    }
-
-
-
-    @Override
-    public DITStructureRule getDITStructureRule(final int ruleID)
-    {
-      return strictImpl.getDITStructureRule(ruleID);
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRules(
-        final NameForm nameForm)
-    {
-      return strictImpl.getDITStructureRules(nameForm);
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRulesWithName(
-        final String name)
-    {
-      return strictImpl.getDITStructureRulesWithName(name);
-    }
-
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStuctureRules()
-    {
-      return strictImpl.getDITStuctureRules();
-    }
-
-
-
-    @Override
-    public MatchingRule getMatchingRule(final String name)
-    {
-      return strictImpl.getMatchingRule(name);
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRules()
-    {
-      return strictImpl.getMatchingRules();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRulesWithName(final String name)
-    {
-      return strictImpl.getMatchingRulesWithName(name);
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule)
-    {
-      return strictImpl.getMatchingRuleUse(matchingRule);
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final String name)
-    {
-      return strictImpl.getMatchingRuleUse(name);
-    }
-
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUses()
-    {
-      return strictImpl.getMatchingRuleUses();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(
-        final String name)
-    {
-      return strictImpl.getMatchingRuleUsesWithName(name);
-    }
-
-
-
-    @Override
-    public NameForm getNameForm(final String name)
-    {
-      return strictImpl.getNameForm(name);
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms()
-    {
-      return strictImpl.getNameForms();
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms(final ObjectClass structuralClass)
-    {
-      return strictImpl.getNameForms(structuralClass);
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameFormsWithName(final String name)
-    {
-      return strictImpl.getNameFormsWithName(name);
-    }
-
-
-
-    @Override
-    public ObjectClass getObjectClass(final String name)
-    {
-      return strictImpl.getObjectClass(name);
-    }
-
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClasses()
-    {
-      return strictImpl.getObjectClasses();
-    }
-
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClassesWithName(final String name)
-    {
-      return strictImpl.getObjectClassesWithName(name);
-    }
-
-
-
-    @Override
-    public String getSchemaName()
-    {
-      return strictImpl.getSchemaName();
-    }
-
-
-
-    @Override
-    public Syntax getSyntax(final String numericOID)
-    {
-      if (!strictImpl.hasSyntax(numericOID))
-      {
-        return new Syntax(numericOID);
-      }
-      return strictImpl.getSyntax(numericOID);
-    }
-
-
-
-    @Override
-    public Collection<Syntax> getSyntaxes()
-    {
-      return strictImpl.getSyntaxes();
-    }
-
-
-
-    @Override
-    public Collection<LocalizableMessage> getWarnings()
-    {
-      return strictImpl.getWarnings();
-    }
-
-
-
-    @Override
-    public boolean hasAttributeType(final String name)
-    {
-      // In theory a non-strict schema always contains the requested
-      // attribute type, so we could always return true. However, we
-      // should provide a way for callers to differentiate between a
-      // real attribute type and a faked up attribute type.
-      return strictImpl.hasAttributeType(name);
-    }
-
-
-
-    @Override
-    public boolean hasDITContentRule(final String name)
-    {
-      return strictImpl.hasDITContentRule(name);
-    }
-
-
-
-    @Override
-    public boolean hasDITStructureRule(final int ruleID)
-    {
-      return strictImpl.hasDITStructureRule(ruleID);
-    }
-
-
-
-    @Override
-    public boolean hasMatchingRule(final String name)
-    {
-      return strictImpl.hasMatchingRule(name);
-    }
-
-
-
-    @Override
-    public boolean hasMatchingRuleUse(final String name)
-    {
-      return strictImpl.hasMatchingRuleUse(name);
-    }
-
-
-
-    @Override
-    public boolean hasNameForm(final String name)
-    {
-      return strictImpl.hasNameForm(name);
-    }
-
-
-
-    @Override
-    public boolean hasObjectClass(final String name)
-    {
-      return strictImpl.hasObjectClass(name);
-    }
-
-
-
-    @Override
-    public boolean hasSyntax(final String numericOID)
-    {
-      return strictImpl.hasSyntax(numericOID);
-    }
-
-
-
-    @Override
-    public boolean isStrict()
-    {
-      return false;
-    }
-  }
-
-
-
-  private static final class StrictImpl implements Impl
-  {
-    private final Map<Integer, DITStructureRule> id2StructureRules;
-
-    private final Map<String, List<AttributeType>> name2AttributeTypes;
-
-    private final Map<String, List<DITContentRule>> name2ContentRules;
-
-    private final Map<String, List<MatchingRule>> name2MatchingRules;
-
-    private final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses;
-
-    private final Map<String, List<NameForm>> name2NameForms;
-
-    private final Map<String, List<ObjectClass>> name2ObjectClasses;
-
-    private final Map<String, List<DITStructureRule>> name2StructureRules;
-
-    private final Map<String, List<DITStructureRule>> nameForm2StructureRules;
-
-    private final Map<String, AttributeType> numericOID2AttributeTypes;
-
-    private final Map<String, DITContentRule> numericOID2ContentRules;
-
-    private final Map<String, MatchingRule> numericOID2MatchingRules;
-
-    private final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses;
-
-    private final Map<String, NameForm> numericOID2NameForms;
-
-    private final Map<String, ObjectClass> numericOID2ObjectClasses;
-
-    private final Map<String, Syntax> numericOID2Syntaxes;
-
-    private final Map<String, List<NameForm>> objectClass2NameForms;
-
-    private final List<LocalizableMessage> warnings;
-
-    private final String schemaName;
-
-    private final boolean allowNonStandardTelephoneNumbers;
-
-    private final boolean allowZeroLengthDirectoryStrings;
-
-    private final boolean allowMalformedNamesAndOptions;
-
-
-
-    StrictImpl(final String schemaName,
-        final boolean allowMalformedNamesAndOptions,
-        final boolean allowNonStandardTelephoneNumbers,
-        final boolean allowZeroLengthDirectoryStrings,
-        final Map<String, Syntax> numericOID2Syntaxes,
-        final Map<String, MatchingRule> numericOID2MatchingRules,
-        final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses,
-        final Map<String, AttributeType> numericOID2AttributeTypes,
-        final Map<String, ObjectClass> numericOID2ObjectClasses,
-        final Map<String, NameForm> numericOID2NameForms,
-        final Map<String, DITContentRule> numericOID2ContentRules,
-        final Map<Integer, DITStructureRule> id2StructureRules,
-        final Map<String, List<MatchingRule>> name2MatchingRules,
-        final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses,
-        final Map<String, List<AttributeType>> name2AttributeTypes,
-        final Map<String, List<ObjectClass>> name2ObjectClasses,
-        final Map<String, List<NameForm>> name2NameForms,
-        final Map<String, List<DITContentRule>> name2ContentRules,
-        final Map<String, List<DITStructureRule>> name2StructureRules,
-        final Map<String, List<NameForm>> objectClass2NameForms,
-        final Map<String, List<DITStructureRule>> nameForm2StructureRules,
-        final List<LocalizableMessage> warnings)
-    {
-      this.schemaName = schemaName;
-      this.allowMalformedNamesAndOptions = allowMalformedNamesAndOptions;
-      this.allowNonStandardTelephoneNumbers = allowNonStandardTelephoneNumbers;
-      this.allowZeroLengthDirectoryStrings = allowZeroLengthDirectoryStrings;
-      this.numericOID2Syntaxes = Collections
-          .unmodifiableMap(numericOID2Syntaxes);
-      this.numericOID2MatchingRules = Collections
-          .unmodifiableMap(numericOID2MatchingRules);
-      this.numericOID2MatchingRuleUses = Collections
-          .unmodifiableMap(numericOID2MatchingRuleUses);
-      this.numericOID2AttributeTypes = Collections
-          .unmodifiableMap(numericOID2AttributeTypes);
-      this.numericOID2ObjectClasses = Collections
-          .unmodifiableMap(numericOID2ObjectClasses);
-      this.numericOID2NameForms = Collections
-          .unmodifiableMap(numericOID2NameForms);
-      this.numericOID2ContentRules = Collections
-          .unmodifiableMap(numericOID2ContentRules);
-      this.id2StructureRules = Collections.unmodifiableMap(id2StructureRules);
-      this.name2MatchingRules = Collections.unmodifiableMap(name2MatchingRules);
-      this.name2MatchingRuleUses = Collections
-          .unmodifiableMap(name2MatchingRuleUses);
-      this.name2AttributeTypes = Collections
-          .unmodifiableMap(name2AttributeTypes);
-      this.name2ObjectClasses = Collections.unmodifiableMap(name2ObjectClasses);
-      this.name2NameForms = Collections.unmodifiableMap(name2NameForms);
-      this.name2ContentRules = Collections.unmodifiableMap(name2ContentRules);
-      this.name2StructureRules = Collections
-          .unmodifiableMap(name2StructureRules);
-      this.objectClass2NameForms = Collections
-          .unmodifiableMap(objectClass2NameForms);
-      this.nameForm2StructureRules = Collections
-          .unmodifiableMap(nameForm2StructureRules);
-      this.warnings = Collections.unmodifiableList(warnings);
-    }
-
-
-
-    public boolean allowMalformedNamesAndOptions()
-    {
-      return allowMalformedNamesAndOptions;
-    }
-
-
-
-    public boolean allowNonStandardTelephoneNumbers()
-    {
-      return allowNonStandardTelephoneNumbers;
-    }
-
-
-
-    public boolean allowZeroLengthDirectoryStrings()
-    {
-      return allowZeroLengthDirectoryStrings;
-    }
-
-
-
-    @Override
-    public AttributeType getAttributeType(final String name)
-    {
-      final AttributeType type = numericOID2AttributeTypes.get(name);
-      if (type != null)
-      {
-        return type;
-      }
-      final List<AttributeType> attributes = name2AttributeTypes
-          .get(StaticUtils.toLowerCase(name));
-      if (attributes != null)
-      {
-        if (attributes.size() == 1)
-        {
-          return attributes.get(0);
+    /**
+     * Returns a non-strict view of this schema.
+     * <p>
+     * See the description of {@link #isStrict()} for more details.
+     *
+     * @return A non-strict view of this schema.
+     * @see Schema#isStrict()
+     */
+    public Schema asNonStrictSchema() {
+        if (impl.isStrict()) {
+            return new Schema(new NonStrictImpl(impl));
+        } else {
+            return this;
         }
-        throw new UnknownSchemaElementException(
-            WARN_ATTR_TYPE_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name));
     }
 
-
-
-    @Override
-    public Collection<AttributeType> getAttributeTypes()
-    {
-      return numericOID2AttributeTypes.values();
-    }
-
-
-
-    @Override
-    public List<AttributeType> getAttributeTypesWithName(final String name)
-    {
-      final List<AttributeType> attributes = name2AttributeTypes
-          .get(StaticUtils.toLowerCase(name));
-      if (attributes == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return attributes;
-      }
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final ObjectClass structuralClass)
-    {
-      return numericOID2ContentRules.get(structuralClass.getOID());
-    }
-
-
-
-    @Override
-    public DITContentRule getDITContentRule(final String name)
-    {
-      final DITContentRule rule = numericOID2ContentRules.get(name);
-      if (rule != null)
-      {
-        return rule;
-      }
-      final List<DITContentRule> rules = name2ContentRules.get(StaticUtils
-          .toLowerCase(name));
-      if (rules != null)
-      {
-        if (rules.size() == 1)
-        {
-          return rules.get(0);
+    /**
+     * Returns a strict view of this schema.
+     * <p>
+     * See the description of {@link #isStrict()} for more details.
+     *
+     * @return A strict view of this schema.
+     * @see Schema#isStrict()
+     */
+    public Schema asStrictSchema() {
+        if (impl.isStrict()) {
+            return this;
+        } else {
+            return new Schema(((NonStrictImpl) impl).strictImpl);
         }
-        throw new UnknownSchemaElementException(WARN_DCR_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name));
     }
 
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRules()
-    {
-      return numericOID2ContentRules.values();
+    /**
+     * Returns the attribute type with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the attribute type to retrieve.
+     * @return The requested attribute type.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested attribute type
+     *             was not found or if the provided name is ambiguous.
+     */
+    public AttributeType getAttributeType(final String name) {
+        return impl.getAttributeType(name);
     }
 
-
-
-    @Override
-    public Collection<DITContentRule> getDITContentRulesWithName(
-        final String name)
-    {
-      final List<DITContentRule> rules = name2ContentRules.get(StaticUtils
-          .toLowerCase(name));
-      if (rules == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return rules;
-      }
+    /**
+     * Returns an unmodifiable collection containing all of the attribute types
+     * contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the attribute types
+     *         contained in this schema.
+     */
+    public Collection<AttributeType> getAttributeTypes() {
+        return impl.getAttributeTypes();
     }
 
-
-
-    @Override
-    public DITStructureRule getDITStructureRule(final int ruleID)
-    {
-      final DITStructureRule rule = id2StructureRules.get(ruleID);
-      if (rule == null)
-      {
-        throw new UnknownSchemaElementException(WARN_DSR_UNKNOWN.get(String
-            .valueOf(ruleID)));
-      }
-      return rule;
+    /**
+     * Returns an unmodifiable collection containing all of the attribute types
+     * having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the attribute types to retrieve.
+     * @return An unmodifiable collection containing all of the attribute types
+     *         having the specified name or numeric OID.
+     */
+    public List<AttributeType> getAttributeTypesWithName(final String name) {
+        return impl.getAttributeTypesWithName(name);
     }
 
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRules(
-        final NameForm nameForm)
-    {
-      final List<DITStructureRule> rules = nameForm2StructureRules.get(nameForm
-          .getOID());
-      if (rules == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return rules;
-      }
+    /**
+     * Returns the DIT content rule associated with the provided structural
+     * object class, or {@code null} if no rule is defined.
+     *
+     * @param structuralClass
+     *            The structural object class .
+     * @return The DIT content rule associated with the provided structural
+     *         object class, or {@code null} if no rule is defined.
+     */
+    public DITContentRule getDITContentRule(final ObjectClass structuralClass) {
+        return impl.getDITContentRule(structuralClass);
     }
 
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStructureRulesWithName(
-        final String name)
-    {
-      final List<DITStructureRule> rules = name2StructureRules.get(StaticUtils
-          .toLowerCase(name));
-      if (rules == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return rules;
-      }
+    /**
+     * Returns the DIT content rule with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the DIT content rule to retrieve.
+     * @return The requested DIT content rule.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested DIT content rule
+     *             was not found or if the provided name is ambiguous.
+     */
+    public DITContentRule getDITContentRule(final String name) {
+        return impl.getDITContentRule(name);
     }
 
-
-
-    @Override
-    public Collection<DITStructureRule> getDITStuctureRules()
-    {
-      return id2StructureRules.values();
+    /**
+     * Returns an unmodifiable collection containing all of the DIT content
+     * rules contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the DIT content
+     *         rules contained in this schema.
+     */
+    public Collection<DITContentRule> getDITContentRules() {
+        return impl.getDITContentRules();
     }
 
+    /**
+     * Returns an unmodifiable collection containing all of the DIT content
+     * rules having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the DIT content rules to retrieve.
+     * @return An unmodifiable collection containing all of the DIT content
+     *         rules having the specified name or numeric OID.
+     */
+    public Collection<DITContentRule> getDITContentRulesWithName(final String name) {
+        return impl.getDITContentRulesWithName(name);
+    }
 
+    /**
+     * Returns the DIT structure rule with the specified name or numeric OID.
+     *
+     * @param ruleID
+     *            The ID of the DIT structure rule to retrieve.
+     * @return The requested DIT structure rule.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested DIT structure
+     *             rule was not found.
+     */
+    public DITStructureRule getDITStructureRule(final int ruleID) {
+        return impl.getDITStructureRule(ruleID);
+    }
 
-    @Override
-    public MatchingRule getMatchingRule(final String name)
-    {
-      final MatchingRule rule = numericOID2MatchingRules.get(name);
-      if (rule != null)
-      {
-        return rule;
-      }
-      final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils
-          .toLowerCase(name));
-      if (rules != null)
-      {
-        if (rules.size() == 1)
-        {
-          return rules.get(0);
+    /**
+     * Returns an unmodifiable collection containing all of the DIT structure
+     * rules associated with the provided name form.
+     *
+     * @param nameForm
+     *            The name form.
+     * @return An unmodifiable collection containing all of the DIT structure
+     *         rules associated with the provided name form.
+     */
+    public Collection<DITStructureRule> getDITStructureRules(final NameForm nameForm) {
+        return impl.getDITStructureRules(nameForm);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the DIT structure
+     * rules having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the DIT structure rules to retrieve.
+     * @return An unmodifiable collection containing all of the DIT structure
+     *         rules having the specified name or numeric OID.
+     */
+    public Collection<DITStructureRule> getDITStructureRulesWithName(final String name) {
+        return impl.getDITStructureRulesWithName(name);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the DIT structure
+     * rules contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the DIT structure
+     *         rules contained in this schema.
+     */
+    public Collection<DITStructureRule> getDITStuctureRules() {
+        return impl.getDITStuctureRules();
+    }
+
+    /**
+     * Returns the matching rule with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rule to retrieve.
+     * @return The requested matching rule.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested matching rule
+     *             was not found or if the provided name is ambiguous.
+     */
+    public MatchingRule getMatchingRule(final String name) {
+        return impl.getMatchingRule(name);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the matching rules
+     * contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the matching rules
+     *         contained in this schema.
+     */
+    public Collection<MatchingRule> getMatchingRules() {
+        return impl.getMatchingRules();
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the matching rules
+     * having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rules to retrieve.
+     * @return An unmodifiable collection containing all of the matching rules
+     *         having the specified name or numeric OID.
+     */
+    public Collection<MatchingRule> getMatchingRulesWithName(final String name) {
+        return impl.getMatchingRulesWithName(name);
+    }
+
+    /**
+     * Returns the matching rule use associated with the provided matching rule,
+     * or {@code null} if no use is defined.
+     *
+     * @param matchingRule
+     *            The matching rule whose matching rule use is to be retrieved.
+     * @return The matching rule use associated with the provided matching rule,
+     *         or {@code null} if no use is defined.
+     */
+    public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) {
+        return getMatchingRuleUse(matchingRule.getOID());
+    }
+
+    /**
+     * Returns the matching rule use with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rule use to retrieve.
+     * @return The requested matching rule use.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested matching rule
+     *             use was not found or if the provided name is ambiguous.
+     */
+    public MatchingRuleUse getMatchingRuleUse(final String name) {
+        return impl.getMatchingRuleUse(name);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the matching rule
+     * uses contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the matching rule
+     *         uses contained in this schema.
+     */
+    public Collection<MatchingRuleUse> getMatchingRuleUses() {
+        return impl.getMatchingRuleUses();
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the matching rule
+     * uses having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rule uses to retrieve.
+     * @return An unmodifiable collection containing all of the matching rule
+     *         uses having the specified name or numeric OID.
+     */
+    public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(final String name) {
+        return impl.getMatchingRuleUsesWithName(name);
+    }
+
+    /**
+     * Returns the name form with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the name form to retrieve.
+     * @return The requested name form.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested name form was
+     *             not found or if the provided name is ambiguous.
+     */
+    public NameForm getNameForm(final String name) {
+        return impl.getNameForm(name);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the name forms
+     * contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the name forms
+     *         contained in this schema.
+     */
+    public Collection<NameForm> getNameForms() {
+        return impl.getNameForms();
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the name forms
+     * associated with the provided structural object class.
+     *
+     * @param structuralClass
+     *            The structural object class whose name forms are to be
+     *            retrieved.
+     * @return An unmodifiable collection containing all of the name forms
+     *         associated with the provided structural object class.
+     */
+    public Collection<NameForm> getNameForms(final ObjectClass structuralClass) {
+        return impl.getNameForms(structuralClass);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the name forms
+     * having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the name forms to retrieve.
+     * @return An unmodifiable collection containing all of the name forms
+     *         having the specified name or numeric OID.
+     */
+    public Collection<NameForm> getNameFormsWithName(final String name) {
+        return impl.getNameFormsWithName(name);
+    }
+
+    /**
+     * Returns the object class with the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the object class to retrieve.
+     * @return The requested object class.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested object class was
+     *             not found or if the provided name is ambiguous.
+     */
+    public ObjectClass getObjectClass(final String name) {
+        return impl.getObjectClass(name);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the object classes
+     * contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the object classes
+     *         contained in this schema.
+     */
+    public Collection<ObjectClass> getObjectClasses() {
+        return impl.getObjectClasses();
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the object classes
+     * having the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the object classes to retrieve.
+     * @return An unmodifiable collection containing all of the object classes
+     *         having the specified name or numeric OID.
+     */
+    public Collection<ObjectClass> getObjectClassesWithName(final String name) {
+        return impl.getObjectClassesWithName(name);
+    }
+
+    /**
+     * Returns the user-friendly name of this schema which may be used for
+     * debugging purposes. The format of the schema name is not defined but
+     * should contain the distinguished name of the subschema sub-entry for
+     * those schemas retrieved from a Directory Server.
+     *
+     * @return The user-friendly name of this schema which may be used for
+     *         debugging purposes.
+     */
+    public String getSchemaName() {
+        return impl.getSchemaName();
+    }
+
+    /**
+     * Returns the syntax with the specified numeric OID.
+     *
+     * @param numericOID
+     *            The OID of the syntax to retrieve.
+     * @return The requested syntax.
+     * @throws UnknownSchemaElementException
+     *             If this is a strict schema and the requested syntax was not
+     *             found or if the provided name is ambiguous.
+     */
+    public Syntax getSyntax(final String numericOID) {
+        return impl.getSyntax(numericOID);
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the syntaxes
+     * contained in this schema.
+     *
+     * @return An unmodifiable collection containing all of the syntaxes
+     *         contained in this schema.
+     */
+    public Collection<Syntax> getSyntaxes() {
+        return impl.getSyntaxes();
+    }
+
+    /**
+     * Returns an unmodifiable collection containing all of the warnings that
+     * were detected when this schema was constructed.
+     *
+     * @return An unmodifiable collection containing all of the warnings that
+     *         were detected when this schema was constructed.
+     */
+    public Collection<LocalizableMessage> getWarnings() {
+        return impl.getWarnings();
+    }
+
+    /**
+     * Indicates whether or not this schema contains an attribute type with the
+     * specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the attribute type.
+     * @return {@code true} if this schema contains an attribute type with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasAttributeType(final String name) {
+        return impl.hasAttributeType(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a DIT content rule with the
+     * specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the DIT content rule.
+     * @return {@code true} if this schema contains a DIT content rule with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasDITContentRule(final String name) {
+        return impl.hasDITContentRule(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a DIT structure rule with
+     * the specified rule ID.
+     *
+     * @param ruleID
+     *            The ID of the DIT structure rule.
+     * @return {@code true} if this schema contains a DIT structure rule with
+     *         the specified rule ID, otherwise {@code false}.
+     */
+    public boolean hasDITStructureRule(final int ruleID) {
+        return impl.hasDITStructureRule(ruleID);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a matching rule with the
+     * specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rule.
+     * @return {@code true} if this schema contains a matching rule with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasMatchingRule(final String name) {
+        return impl.hasMatchingRule(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a matching rule use with
+     * the specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the matching rule use.
+     * @return {@code true} if this schema contains a matching rule use with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasMatchingRuleUse(final String name) {
+        return impl.hasMatchingRuleUse(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a name form with the
+     * specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the name form.
+     * @return {@code true} if this schema contains a name form with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasNameForm(final String name) {
+        return impl.hasNameForm(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains an object class with the
+     * specified name or numeric OID.
+     *
+     * @param name
+     *            The name or OID of the object class.
+     * @return {@code true} if this schema contains an object class with the
+     *         specified name or numeric OID, otherwise {@code false}.
+     */
+    public boolean hasObjectClass(final String name) {
+        return impl.hasObjectClass(name);
+    }
+
+    /**
+     * Indicates whether or not this schema contains a syntax with the specified
+     * numeric OID.
+     *
+     * @param numericOID
+     *            The OID of the syntax.
+     * @return {@code true} if this schema contains a syntax with the specified
+     *         numeric OID, otherwise {@code false}.
+     */
+    public boolean hasSyntax(final String numericOID) {
+        return impl.hasSyntax(numericOID);
+    }
+
+    /**
+     * Indicates whether or not this schema is strict.
+     * <p>
+     * Attribute type queries against non-strict schema always succeed: if the
+     * requested attribute type is not found then a temporary attribute type is
+     * created automatically having the Octet String syntax and associated
+     * matching rules.
+     * <p>
+     * Strict schema, on the other hand, throw an
+     * {@link UnknownSchemaElementException} whenever an attempt is made to
+     * retrieve a non-existent attribute type.
+     *
+     * @return {@code true} if this schema is strict.
+     */
+    public boolean isStrict() {
+        return impl.isStrict();
+    }
+
+    /**
+     * Adds the definitions of all the schema elements contained in this schema
+     * to the provided subschema subentry. Any existing attributes (including
+     * schema definitions) contained in the provided entry will be preserved.
+     *
+     * @param entry
+     *            The subschema subentry to which all schema definitions should
+     *            be added.
+     * @return The updated subschema subentry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public Entry toEntry(final Entry entry) {
+        Attribute attr = new LinkedAttribute(Schema.ATTR_LDAP_SYNTAXES);
+        for (final Syntax syntax : getSyntaxes()) {
+            attr.add(syntax.toString());
         }
-        throw new UnknownSchemaElementException(WARN_MR_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRules()
-    {
-      return numericOID2MatchingRules.values();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRule> getMatchingRulesWithName(final String name)
-    {
-      final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils
-          .toLowerCase(name));
-      if (rules == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return rules;
-      }
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule)
-    {
-      return numericOID2MatchingRuleUses.get(matchingRule.getOID());
-    }
-
-
-
-    @Override
-    public MatchingRuleUse getMatchingRuleUse(final String name)
-    {
-      final MatchingRuleUse rule = numericOID2MatchingRuleUses.get(name);
-      if (rule != null)
-      {
-        return rule;
-      }
-      final List<MatchingRuleUse> uses = name2MatchingRuleUses.get(StaticUtils
-          .toLowerCase(name));
-      if (uses != null)
-      {
-        if (uses.size() == 1)
-        {
-          return uses.get(0);
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
         }
-        throw new UnknownSchemaElementException(WARN_MRU_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name));
-    }
 
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUses()
-    {
-      return numericOID2MatchingRuleUses.values();
-    }
-
-
-
-    @Override
-    public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(
-        final String name)
-    {
-      final List<MatchingRuleUse> rules = name2MatchingRuleUses.get(StaticUtils
-          .toLowerCase(name));
-      if (rules == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return rules;
-      }
-    }
-
-
-
-    @Override
-    public NameForm getNameForm(final String name)
-    {
-      final NameForm form = numericOID2NameForms.get(name);
-      if (form != null)
-      {
-        return form;
-      }
-      final List<NameForm> forms = name2NameForms.get(StaticUtils
-          .toLowerCase(name));
-      if (forms != null)
-      {
-        if (forms.size() == 1)
-        {
-          return forms.get(0);
+        attr = new LinkedAttribute(Schema.ATTR_ATTRIBUTE_TYPES);
+        for (final AttributeType attributeType : getAttributeTypes()) {
+            attr.add(attributeType.toString());
         }
-        throw new UnknownSchemaElementException(
-            WARN_NAMEFORM_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name));
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms()
-    {
-      return numericOID2NameForms.values();
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameForms(final ObjectClass structuralClass)
-    {
-      final List<NameForm> forms = objectClass2NameForms.get(structuralClass
-          .getOID());
-      if (forms == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return forms;
-      }
-    }
-
-
-
-    @Override
-    public Collection<NameForm> getNameFormsWithName(final String name)
-    {
-      final List<NameForm> forms = name2NameForms.get(StaticUtils
-          .toLowerCase(name));
-      if (forms == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return forms;
-      }
-    }
-
-
-
-    @Override
-    public ObjectClass getObjectClass(final String name)
-    {
-      final ObjectClass oc = numericOID2ObjectClasses.get(name);
-      if (oc != null)
-      {
-        return oc;
-      }
-      final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils
-          .toLowerCase(name));
-      if (classes != null)
-      {
-        if (classes.size() == 1)
-        {
-          return classes.get(0);
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
         }
-        throw new UnknownSchemaElementException(
-            WARN_OBJECTCLASS_AMBIGIOUS.get(name));
-      }
-      throw new UnknownSchemaElementException(
-          WARN_OBJECTCLASS_UNKNOWN.get(name));
-    }
 
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClasses()
-    {
-      return numericOID2ObjectClasses.values();
-    }
-
-
-
-    @Override
-    public Collection<ObjectClass> getObjectClassesWithName(final String name)
-    {
-      final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils
-          .toLowerCase(name));
-      if (classes == null)
-      {
-        return Collections.emptyList();
-      }
-      else
-      {
-        return classes;
-      }
-    }
-
-
-
-    @Override
-    public String getSchemaName()
-    {
-      return schemaName;
-    }
-
-
-
-    @Override
-    public Syntax getSyntax(final String numericOID)
-    {
-      final Syntax syntax = numericOID2Syntaxes.get(numericOID);
-      if (syntax == null)
-      {
-        throw new UnknownSchemaElementException(
-            WARN_SYNTAX_UNKNOWN.get(numericOID));
-      }
-      return syntax;
-    }
-
-
-
-    @Override
-    public Collection<Syntax> getSyntaxes()
-    {
-      return numericOID2Syntaxes.values();
-    }
-
-
-
-    @Override
-    public Collection<LocalizableMessage> getWarnings()
-    {
-      return warnings;
-    }
-
-
-
-    @Override
-    public boolean hasAttributeType(final String name)
-    {
-      if (numericOID2AttributeTypes.containsKey(name))
-      {
-        return true;
-      }
-      final List<AttributeType> attributes = name2AttributeTypes
-          .get(StaticUtils.toLowerCase(name));
-      return attributes != null && attributes.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasDITContentRule(final String name)
-    {
-      if (numericOID2ContentRules.containsKey(name))
-      {
-        return true;
-      }
-      final List<DITContentRule> rules = name2ContentRules.get(StaticUtils
-          .toLowerCase(name));
-      return rules != null && rules.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasDITStructureRule(final int ruleID)
-    {
-      return id2StructureRules.containsKey(ruleID);
-    }
-
-
-
-    @Override
-    public boolean hasMatchingRule(final String name)
-    {
-      if (numericOID2MatchingRules.containsKey(name))
-      {
-        return true;
-      }
-      final List<MatchingRule> rules = name2MatchingRules.get(StaticUtils
-          .toLowerCase(name));
-      return rules != null && rules.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasMatchingRuleUse(final String name)
-    {
-      if (numericOID2MatchingRuleUses.containsKey(name))
-      {
-        return true;
-      }
-      final List<MatchingRuleUse> uses = name2MatchingRuleUses.get(StaticUtils
-          .toLowerCase(name));
-      return uses != null && uses.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasNameForm(final String name)
-    {
-      if (numericOID2NameForms.containsKey(name))
-      {
-        return true;
-      }
-      final List<NameForm> forms = name2NameForms.get(StaticUtils
-          .toLowerCase(name));
-      return forms != null && forms.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasObjectClass(final String name)
-    {
-      if (numericOID2ObjectClasses.containsKey(name))
-      {
-        return true;
-      }
-      final List<ObjectClass> classes = name2ObjectClasses.get(StaticUtils
-          .toLowerCase(name));
-      return classes != null && classes.size() == 1;
-    }
-
-
-
-    @Override
-    public boolean hasSyntax(final String numericOID)
-    {
-      return numericOID2Syntaxes.containsKey(numericOID);
-    }
-
-
-
-    @Override
-    public boolean isStrict()
-    {
-      return true;
-    }
-  }
-
-
-
-  /*
-   * WARNING: do not reference the core schema in the following declarations.
-   */
-
-  private static final Schema EMPTY_SCHEMA = new Schema(new EmptyImpl());
-
-  static final String ATTR_ATTRIBUTE_TYPES = "attributeTypes";
-
-  static final String ATTR_DIT_CONTENT_RULES = "dITContentRules";
-
-  static final String ATTR_DIT_STRUCTURE_RULES = "dITStructureRules";
-
-  static final String ATTR_LDAP_SYNTAXES = "ldapSyntaxes";
-
-  static final String ATTR_MATCHING_RULE_USE = "matchingRuleUse";
-
-  static final String ATTR_MATCHING_RULES = "matchingRules";
-
-  static final String ATTR_NAME_FORMS = "nameForms";
-
-  static final String ATTR_OBJECT_CLASSES = "objectClasses";
-
-
-
-  /**
-   * Returns the core schema. The core schema is non-strict and contains the
-   * following standard LDAP schema elements:
-   * <ul>
-   * <li><a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
-   * Directory Access Protocol (LDAP): Directory Information Models </a>
-   * <li><a href="http://tools.ietf.org/html/rfc4517">RFC 4517 - Lightweight
-   * Directory Access Protocol (LDAP): Syntaxes and Matching Rules </a>
-   * <li><a href="http://tools.ietf.org/html/rfc4519">RFC 4519 - Lightweight
-   * Directory Access Protocol (LDAP): Schema for User Applications </a>
-   * <li><a href="http://tools.ietf.org/html/rfc4530">RFC 4530 - Lightweight
-   * Directory Access Protocol (LDAP): entryUUID Operational Attribute </a>
-   * <li><a href="http://tools.ietf.org/html/rfc3045">RFC 3045 - Storing Vendor
-   * Information in the LDAP root DSE </a>
-   * <li><a href="http://tools.ietf.org/html/rfc3112">RFC 3112 - LDAP
-   * Authentication Password Schema </a>
-   * </ul>
-   *
-   * @return The core schema.
-   */
-  public static Schema getCoreSchema()
-  {
-    return CoreSchemaImpl.getInstance();
-  }
-
-
-
-  /**
-   * Returns the default schema which should be used by this application. The
-   * default schema is initially set to the core schema.
-   *
-   * @return The default schema which should be used by this application.
-   */
-  public static Schema getDefaultSchema()
-  {
-    return DefaultSchema.schema;
-  }
-
-
-
-  /**
-   * Returns the empty schema. The empty schema is non-strict and does not
-   * contain any schema elements.
-   *
-   * @return The empty schema.
-   */
-  public static Schema getEmptySchema()
-  {
-    return EMPTY_SCHEMA;
-  }
-
-
-
-  /**
-   * Asynchronously reads the schema contained in the named subschema sub-entry.
-   * <p>
-   * If the requested schema is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, the returned future will never return {@code null}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the subschema sub-entry.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the retrieved schema.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public static FutureResult<Schema> readSchemaAsync(
-      final Connection connection, final DN name,
-      final ResultHandler<? super Schema> handler)
-  {
-    final FutureResultTransformer<SchemaBuilder, Schema> future =
-      new FutureResultTransformer<SchemaBuilder, Schema>(handler)
-    {
-
-      @Override
-      protected Schema transformResult(final SchemaBuilder builder)
-          throws ErrorResultException
-      {
-        return builder.toSchema();
-      }
-
-    };
-
-    final SchemaBuilder builder = new SchemaBuilder();
-    final FutureResult<SchemaBuilder> innerFuture = builder.addSchemaAsync(
-        connection, name, future, true);
-    future.setFutureResult(innerFuture);
-    return future;
-  }
-
-
-
-  /**
-   * Reads the schema contained in the named subschema sub-entry.
-   * <p>
-   * If the requested schema is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}. More
-   * specifically, this method will never return {@code null}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the subschema sub-entry.
-   * @return The schema from the Directory Server.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public static Schema readSchema(final Connection connection, final DN name)
-      throws ErrorResultException, InterruptedException
-  {
-    return new SchemaBuilder().addSchema(connection, name, true).toSchema();
-  }
-
-
-
-  /**
-   * Asynchronously reads the schema contained in the subschema sub-entry which
-   * applies to the named entry.
-   * <p>
-   * If the requested entry or its associated schema are not returned by the
-   * Directory Server then the request will fail with an
-   * {@link EntryNotFoundException}. More specifically, the returned future will
-   * never return {@code null}.
-   * <p>
-   * This implementation first reads the {@code subschemaSubentry} attribute of
-   * the entry in order to identify the schema and then invokes
-   * {@link #readSchemaAsync(Connection, DN, ResultHandler)} to read the
-   * schema.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the entry whose schema is to be located.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @return A future representing the retrieved schema.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public static FutureResult<Schema> readSchemaForEntryAsync(
-      final Connection connection, final DN name,
-      final ResultHandler<? super Schema> handler)
-  {
-    final FutureResultTransformer<SchemaBuilder, Schema> future =
-      new FutureResultTransformer<SchemaBuilder, Schema>(handler)
-    {
-
-      @Override
-      protected Schema transformResult(final SchemaBuilder builder)
-          throws ErrorResultException
-      {
-        return builder.toSchema();
-      }
-
-    };
-
-    final SchemaBuilder builder = new SchemaBuilder();
-    final FutureResult<SchemaBuilder> innerFuture = builder
-        .addSchemaForEntryAsync(connection, name, future, true);
-    future.setFutureResult(innerFuture);
-    return future;
-
-  }
-
-
-
-  /**
-   * Reads the schema contained in the subschema sub-entry which applies to the
-   * named entry.
-   * <p>
-   * If the requested entry or its associated schema are not returned by the
-   * Directory Server then the request will fail with an
-   * {@link EntryNotFoundException}. More specifically, this method will never
-   * return {@code null}.
-   * <p>
-   * This implementation first reads the {@code subschemaSubentry} attribute of
-   * the entry in order to identify the schema and then invokes
-   * {@link #readSchema(Connection, DN)} to read the schema.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the entry whose schema is to be located.
-   * @return The schema from the Directory Server which applies to the named
-   *         entry.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public static Schema readSchemaForEntry(final Connection connection,
-      final DN name) throws ErrorResultException, InterruptedException
-  {
-    return new SchemaBuilder().addSchemaForEntry(connection, name, true)
-        .toSchema();
-  }
-
-
-
-  /**
-   * Sets the default schema which should be used by this application. The
-   * default schema is initially set to the core schema.
-   *
-   * @param schema
-   *          The default schema which should be used by this application.
-   */
-  public static void setDefaultSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    DefaultSchema.schema = schema;
-  }
-
-
-
-  /**
-   * Parses the provided entry as a subschema subentry. Any problems encountered
-   * while parsing the entry can be retrieved using the returned schema's
-   * {@link #getWarnings()} method.
-   *
-   * @param entry
-   *          The subschema subentry to be parsed.
-   * @return The parsed schema.
-   */
-  public static Schema valueOf(final Entry entry)
-  {
-    return new SchemaBuilder(entry).toSchema();
-  }
-
-
-
-  static MatchingRule getDefaultMatchingRule()
-  {
-    return CoreSchema.getCaseIgnoreMatchingRule();
-  }
-
-
-
-  static Syntax getDefaultSyntax()
-  {
-    return CoreSchema.getDirectoryStringSyntax();
-  }
-
-
-
-  private final Impl impl;
-
-
-
-  Schema(final String schemaName,
-      final boolean allowMalformedNamesAndOptions,
-      final boolean allowNonStandardTelephoneNumbers,
-      final boolean allowZeroLengthDirectoryStrings,
-      final Map<String, Syntax> numericOID2Syntaxes,
-      final Map<String, MatchingRule> numericOID2MatchingRules,
-      final Map<String, MatchingRuleUse> numericOID2MatchingRuleUses,
-      final Map<String, AttributeType> numericOID2AttributeTypes,
-      final Map<String, ObjectClass> numericOID2ObjectClasses,
-      final Map<String, NameForm> numericOID2NameForms,
-      final Map<String, DITContentRule> numericOID2ContentRules,
-      final Map<Integer, DITStructureRule> id2StructureRules,
-      final Map<String, List<MatchingRule>> name2MatchingRules,
-      final Map<String, List<MatchingRuleUse>> name2MatchingRuleUses,
-      final Map<String, List<AttributeType>> name2AttributeTypes,
-      final Map<String, List<ObjectClass>> name2ObjectClasses,
-      final Map<String, List<NameForm>> name2NameForms,
-      final Map<String, List<DITContentRule>> name2ContentRules,
-      final Map<String, List<DITStructureRule>> name2StructureRules,
-      final Map<String, List<NameForm>> objectClass2NameForms,
-      final Map<String, List<DITStructureRule>> nameForm2StructureRules,
-      final List<LocalizableMessage> warnings)
-  {
-    impl = new StrictImpl(schemaName, allowMalformedNamesAndOptions,
-        allowNonStandardTelephoneNumbers, allowZeroLengthDirectoryStrings,
-        numericOID2Syntaxes, numericOID2MatchingRules,
-        numericOID2MatchingRuleUses, numericOID2AttributeTypes,
-        numericOID2ObjectClasses, numericOID2NameForms,
-        numericOID2ContentRules, id2StructureRules, name2MatchingRules,
-        name2MatchingRuleUses, name2AttributeTypes, name2ObjectClasses,
-        name2NameForms, name2ContentRules, name2StructureRules,
-        objectClass2NameForms, nameForm2StructureRules, warnings);
-  }
-
-
-
-  private Schema(final Impl impl)
-  {
-    this.impl = impl;
-  }
-
-
-
-  /**
-   * Returns {@code true} if this schema allows certain illegal characters in
-   * OIDs and attribute options. When this compatibility option is set to
-   * {@code true} the following illegal characters will be permitted in addition
-   * to those permitted in section 1.4 of RFC 4512:
-   *
-   * <pre>
-   * USCORE  = %x5F ; underscore ("_")
-   * DOT     = %x2E ; period (".")
-   * </pre>
-   *
-   * By default this compatibility option is set to {@code true} because these
-   * characters are often used for naming purposes (such as collation rules).
-   *
-   * @return {@code true} if this schema allows certain illegal characters in
-   *         OIDs and attribute options.
-   * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
-   *      Directory Access Protocol (LDAP): Directory Information Models </a>
-   */
-  public boolean allowMalformedNamesAndOptions()
-  {
-    return impl.allowMalformedNamesAndOptions();
-  }
-
-
-
-  /**
-   * Returns {@code true} if the Telephone Number syntax defined for this schema
-   * allows values which do not conform to the E.123 international telephone
-   * number format.
-   * <p>
-   * By default this compatibility option is set to {@code true}.
-   *
-   * @return {@code true} if the Telephone Number syntax defined for this schema
-   *         allows values which do not conform to the E.123 international
-   *         telephone number format.
-   */
-  public boolean allowNonStandardTelephoneNumbers()
-  {
-    return impl.allowNonStandardTelephoneNumbers();
-  }
-
-
-
-  /**
-   * Returns {@code true} if zero-length values will be allowed by the Directory
-   * String syntax defined for this schema. This is technically forbidden by the
-   * LDAP specification, but it was allowed in earlier versions of the server,
-   * and the discussion of the directory string syntax in RFC 2252 does not
-   * explicitly state that they are not allowed.
-   * <p>
-   * By default this compatibility option is set to {@code false}.
-   *
-   * @return {@code true} if zero-length values will be allowed by the Directory
-   *         String syntax defined for this schema, or {@code false} if not.
-   */
-  public boolean allowZeroLengthDirectoryStrings()
-  {
-    return impl.allowZeroLengthDirectoryStrings();
-  }
-
-
-
-  /**
-   * Returns a non-strict view of this schema.
-   * <p>
-   * See the description of {@link #isStrict()} for more details.
-   *
-   * @return A non-strict view of this schema.
-   * @see Schema#isStrict()
-   */
-  public Schema asNonStrictSchema()
-  {
-    if (impl.isStrict())
-    {
-      return new Schema(new NonStrictImpl(impl));
-    }
-    else
-    {
-      return this;
-    }
-  }
-
-
-
-  /**
-   * Returns a strict view of this schema.
-   * <p>
-   * See the description of {@link #isStrict()} for more details.
-   *
-   * @return A strict view of this schema.
-   * @see Schema#isStrict()
-   */
-  public Schema asStrictSchema()
-  {
-    if (impl.isStrict())
-    {
-      return this;
-    }
-    else
-    {
-      return new Schema(((NonStrictImpl) impl).strictImpl);
-    }
-  }
-
-
-
-  /**
-   * Returns the attribute type with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the attribute type to retrieve.
-   * @return The requested attribute type.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested attribute type was
-   *           not found or if the provided name is ambiguous.
-   */
-  public AttributeType getAttributeType(final String name)
-  {
-    return impl.getAttributeType(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the attribute types
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the attribute types
-   *         contained in this schema.
-   */
-  public Collection<AttributeType> getAttributeTypes()
-  {
-    return impl.getAttributeTypes();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the attribute types
-   * having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the attribute types to retrieve.
-   * @return An unmodifiable collection containing all of the attribute types
-   *         having the specified name or numeric OID.
-   */
-  public List<AttributeType> getAttributeTypesWithName(final String name)
-  {
-    return impl.getAttributeTypesWithName(name);
-  }
-
-
-
-  /**
-   * Returns the DIT content rule associated with the provided structural object
-   * class, or {@code null} if no rule is defined.
-   *
-   * @param structuralClass
-   *          The structural object class .
-   * @return The DIT content rule associated with the provided structural object
-   *         class, or {@code null} if no rule is defined.
-   */
-  public DITContentRule getDITContentRule(final ObjectClass structuralClass)
-  {
-    return impl.getDITContentRule(structuralClass);
-  }
-
-
-
-  /**
-   * Returns the DIT content rule with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the DIT content rule to retrieve.
-   * @return The requested DIT content rule.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested DIT content rule was
-   *           not found or if the provided name is ambiguous.
-   */
-  public DITContentRule getDITContentRule(final String name)
-  {
-    return impl.getDITContentRule(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the DIT content rules
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the DIT content rules
-   *         contained in this schema.
-   */
-  public Collection<DITContentRule> getDITContentRules()
-  {
-    return impl.getDITContentRules();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the DIT content rules
-   * having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the DIT content rules to retrieve.
-   * @return An unmodifiable collection containing all of the DIT content rules
-   *         having the specified name or numeric OID.
-   */
-  public Collection<DITContentRule> getDITContentRulesWithName(final String name)
-  {
-    return impl.getDITContentRulesWithName(name);
-  }
-
-
-
-  /**
-   * Returns the DIT structure rule with the specified name or numeric OID.
-   *
-   * @param ruleID
-   *          The ID of the DIT structure rule to retrieve.
-   * @return The requested DIT structure rule.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested DIT structure rule
-   *           was not found.
-   */
-  public DITStructureRule getDITStructureRule(final int ruleID)
-  {
-    return impl.getDITStructureRule(ruleID);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the DIT structure
-   * rules associated with the provided name form.
-   *
-   * @param nameForm
-   *          The name form.
-   * @return An unmodifiable collection containing all of the DIT structure
-   *         rules associated with the provided name form.
-   */
-  public Collection<DITStructureRule> getDITStructureRules(
-      final NameForm nameForm)
-  {
-    return impl.getDITStructureRules(nameForm);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the DIT structure
-   * rules having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the DIT structure rules to retrieve.
-   * @return An unmodifiable collection containing all of the DIT structure
-   *         rules having the specified name or numeric OID.
-   */
-  public Collection<DITStructureRule> getDITStructureRulesWithName(
-      final String name)
-  {
-    return impl.getDITStructureRulesWithName(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the DIT structure
-   * rules contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the DIT structure
-   *         rules contained in this schema.
-   */
-  public Collection<DITStructureRule> getDITStuctureRules()
-  {
-    return impl.getDITStuctureRules();
-  }
-
-
-
-  /**
-   * Returns the matching rule with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rule to retrieve.
-   * @return The requested matching rule.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested matching rule was
-   *           not found or if the provided name is ambiguous.
-   */
-  public MatchingRule getMatchingRule(final String name)
-  {
-    return impl.getMatchingRule(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the matching rules
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the matching rules
-   *         contained in this schema.
-   */
-  public Collection<MatchingRule> getMatchingRules()
-  {
-    return impl.getMatchingRules();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the matching rules
-   * having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rules to retrieve.
-   * @return An unmodifiable collection containing all of the matching rules
-   *         having the specified name or numeric OID.
-   */
-  public Collection<MatchingRule> getMatchingRulesWithName(final String name)
-  {
-    return impl.getMatchingRulesWithName(name);
-  }
-
-
-
-  /**
-   * Returns the matching rule use associated with the provided matching rule,
-   * or {@code null} if no use is defined.
-   *
-   * @param matchingRule
-   *          The matching rule whose matching rule use is to be retrieved.
-   * @return The matching rule use associated with the provided matching rule,
-   *         or {@code null} if no use is defined.
-   */
-  public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule)
-  {
-    return getMatchingRuleUse(matchingRule.getOID());
-  }
-
-
-
-  /**
-   * Returns the matching rule use with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rule use to retrieve.
-   * @return The requested matching rule use.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested matching rule use
-   *           was not found or if the provided name is ambiguous.
-   */
-  public MatchingRuleUse getMatchingRuleUse(final String name)
-  {
-    return impl.getMatchingRuleUse(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the matching rule uses
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the matching rule uses
-   *         contained in this schema.
-   */
-  public Collection<MatchingRuleUse> getMatchingRuleUses()
-  {
-    return impl.getMatchingRuleUses();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the matching rule uses
-   * having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rule uses to retrieve.
-   * @return An unmodifiable collection containing all of the matching rule uses
-   *         having the specified name or numeric OID.
-   */
-  public Collection<MatchingRuleUse> getMatchingRuleUsesWithName(
-      final String name)
-  {
-    return impl.getMatchingRuleUsesWithName(name);
-  }
-
-
-
-  /**
-   * Returns the name form with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the name form to retrieve.
-   * @return The requested name form.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested name form was not
-   *           found or if the provided name is ambiguous.
-   */
-  public NameForm getNameForm(final String name)
-  {
-    return impl.getNameForm(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the name forms
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the name forms
-   *         contained in this schema.
-   */
-  public Collection<NameForm> getNameForms()
-  {
-    return impl.getNameForms();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the name forms
-   * associated with the provided structural object class.
-   *
-   * @param structuralClass
-   *          The structural object class whose name forms are to be retrieved.
-   * @return An unmodifiable collection containing all of the name forms
-   *         associated with the provided structural object class.
-   */
-  public Collection<NameForm> getNameForms(final ObjectClass structuralClass)
-  {
-    return impl.getNameForms(structuralClass);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the name forms having
-   * the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the name forms to retrieve.
-   * @return An unmodifiable collection containing all of the name forms having
-   *         the specified name or numeric OID.
-   */
-  public Collection<NameForm> getNameFormsWithName(final String name)
-  {
-    return impl.getNameFormsWithName(name);
-  }
-
-
-
-  /**
-   * Returns the object class with the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the object class to retrieve.
-   * @return The requested object class.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested object class was not
-   *           found or if the provided name is ambiguous.
-   */
-  public ObjectClass getObjectClass(final String name)
-  {
-    return impl.getObjectClass(name);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the object classes
-   * contained in this schema.
-   *
-   * @return An unmodifiable collection containing all of the object classes
-   *         contained in this schema.
-   */
-  public Collection<ObjectClass> getObjectClasses()
-  {
-    return impl.getObjectClasses();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the object classes
-   * having the specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the object classes to retrieve.
-   * @return An unmodifiable collection containing all of the object classes
-   *         having the specified name or numeric OID.
-   */
-  public Collection<ObjectClass> getObjectClassesWithName(final String name)
-  {
-    return impl.getObjectClassesWithName(name);
-  }
-
-
-
-  /**
-   * Returns the user-friendly name of this schema which may be used for
-   * debugging purposes. The format of the schema name is not defined but should
-   * contain the distinguished name of the subschema sub-entry for those schemas
-   * retrieved from a Directory Server.
-   *
-   * @return The user-friendly name of this schema which may be used for
-   *         debugging purposes.
-   */
-  public String getSchemaName()
-  {
-    return impl.getSchemaName();
-  }
-
-
-
-  /**
-   * Returns the syntax with the specified numeric OID.
-   *
-   * @param numericOID
-   *          The OID of the syntax to retrieve.
-   * @return The requested syntax.
-   * @throws UnknownSchemaElementException
-   *           If this is a strict schema and the requested syntax was not found
-   *           or if the provided name is ambiguous.
-   */
-  public Syntax getSyntax(final String numericOID)
-  {
-    return impl.getSyntax(numericOID);
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the syntaxes contained
-   * in this schema.
-   *
-   * @return An unmodifiable collection containing all of the syntaxes contained
-   *         in this schema.
-   */
-  public Collection<Syntax> getSyntaxes()
-  {
-    return impl.getSyntaxes();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable collection containing all of the warnings that were
-   * detected when this schema was constructed.
-   *
-   * @return An unmodifiable collection containing all of the warnings that were
-   *         detected when this schema was constructed.
-   */
-  public Collection<LocalizableMessage> getWarnings()
-  {
-    return impl.getWarnings();
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains an attribute type with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the attribute type.
-   * @return {@code true} if this schema contains an attribute type with the
-   *         specified name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasAttributeType(final String name)
-  {
-    return impl.hasAttributeType(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a DIT content rule with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the DIT content rule.
-   * @return {@code true} if this schema contains a DIT content rule with the
-   *         specified name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasDITContentRule(final String name)
-  {
-    return impl.hasDITContentRule(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a DIT structure rule with the
-   * specified rule ID.
-   *
-   * @param ruleID
-   *          The ID of the DIT structure rule.
-   * @return {@code true} if this schema contains a DIT structure rule with the
-   *         specified rule ID, otherwise {@code false}.
-   */
-  public boolean hasDITStructureRule(final int ruleID)
-  {
-    return impl.hasDITStructureRule(ruleID);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a matching rule with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rule.
-   * @return {@code true} if this schema contains a matching rule with the
-   *         specified name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasMatchingRule(final String name)
-  {
-    return impl.hasMatchingRule(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a matching rule use with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the matching rule use.
-   * @return {@code true} if this schema contains a matching rule use with the
-   *         specified name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasMatchingRuleUse(final String name)
-  {
-    return impl.hasMatchingRuleUse(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a name form with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the name form.
-   * @return {@code true} if this schema contains a name form with the specified
-   *         name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasNameForm(final String name)
-  {
-    return impl.hasNameForm(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains an object class with the
-   * specified name or numeric OID.
-   *
-   * @param name
-   *          The name or OID of the object class.
-   * @return {@code true} if this schema contains an object class with the
-   *         specified name or numeric OID, otherwise {@code false}.
-   */
-  public boolean hasObjectClass(final String name)
-  {
-    return impl.hasObjectClass(name);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema contains a syntax with the specified
-   * numeric OID.
-   *
-   * @param numericOID
-   *          The OID of the syntax.
-   * @return {@code true} if this schema contains a syntax with the specified
-   *         numeric OID, otherwise {@code false}.
-   */
-  public boolean hasSyntax(final String numericOID)
-  {
-    return impl.hasSyntax(numericOID);
-  }
-
-
-
-  /**
-   * Indicates whether or not this schema is strict.
-   * <p>
-   * Attribute type queries against non-strict schema always succeed: if the
-   * requested attribute type is not found then a temporary attribute type is
-   * created automatically having the Octet String syntax and associated
-   * matching rules.
-   * <p>
-   * Strict schema, on the other hand, throw an
-   * {@link UnknownSchemaElementException} whenever an attempt is made to
-   * retrieve a non-existent attribute type.
-   *
-   * @return {@code true} if this schema is strict.
-   */
-  public boolean isStrict()
-  {
-    return impl.isStrict();
-  }
-
-
-
-  /**
-   * Adds the definitions of all the schema elements contained in this schema to
-   * the provided subschema subentry. Any existing attributes (including schema
-   * definitions) contained in the provided entry will be preserved.
-   *
-   * @param entry
-   *          The subschema subentry to which all schema definitions should be
-   *          added.
-   * @return The updated subschema subentry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public Entry toEntry(final Entry entry)
-  {
-    Attribute attr = new LinkedAttribute(Schema.ATTR_LDAP_SYNTAXES);
-    for (final Syntax syntax : getSyntaxes())
-    {
-      attr.add(syntax.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_ATTRIBUTE_TYPES);
-    for (final AttributeType attributeType : getAttributeTypes())
-    {
-      attr.add(attributeType.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_OBJECT_CLASSES);
-    for (final ObjectClass objectClass : getObjectClasses())
-    {
-      attr.add(objectClass.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_MATCHING_RULE_USE);
-    for (final MatchingRuleUse matchingRuleUse : getMatchingRuleUses())
-    {
-      attr.add(matchingRuleUse.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_MATCHING_RULES);
-    for (final MatchingRule matchingRule : getMatchingRules())
-    {
-      attr.add(matchingRule.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_DIT_CONTENT_RULES);
-    for (final DITContentRule ditContentRule : getDITContentRules())
-    {
-      attr.add(ditContentRule.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_DIT_STRUCTURE_RULES);
-    for (final DITStructureRule ditStructureRule : getDITStuctureRules())
-    {
-      attr.add(ditStructureRule.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    attr = new LinkedAttribute(Schema.ATTR_NAME_FORMS);
-    for (final NameForm nameForm : getNameForms())
-    {
-      attr.add(nameForm.toString());
-    }
-    if (!attr.isEmpty())
-    {
-      entry.addAttribute(attr);
-    }
-
-    return entry;
-  }
-
-
-
-  /**
-   * Returns {@code true} if the provided entry is valid according to this
-   * schema and the specified schema validation policy.
-   * <p>
-   * If attribute value validation is enabled then following checks will be
-   * performed:
-   * <ul>
-   * <li>checking that there is at least one value
-   * <li>checking that single-valued attributes contain only a single value
-   * </ul>
-   * In particular, attribute values will not be checked for conformance to
-   * their syntax since this is expected to have already been performed while
-   * adding the values to the entry.
-   *
-   * @param entry
-   *          The entry to be validated.
-   * @param policy
-   *          The schema validation policy.
-   * @param errorMessages
-   *          A collection into which any schema validation warnings or error
-   *          messages can be placed, or {@code null} if they should not be
-   *          saved.
-   * @return {@code true} if an entry conforms to this schema based on the
-   *         provided schema validation policy.
-   */
-  public boolean validateEntry(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final Collection<LocalizableMessage> errorMessages)
-  {
-    // First check that the object classes are recognized and that there is one
-    // structural object class.
-    ObjectClass structuralObjectClass = null;
-    final Attribute objectClassAttribute = entry.getAttribute(objectClass());
-    final List<ObjectClass> objectClasses = new LinkedList<ObjectClass>();
-    if (objectClassAttribute != null)
-    {
-      for (final ByteString v : objectClassAttribute)
-      {
-        final String objectClassName = v.toString();
-        final ObjectClass objectClass;
-        try
-        {
-          objectClass = getObjectClass(objectClassName);
-          objectClasses.add(objectClass);
+        attr = new LinkedAttribute(Schema.ATTR_OBJECT_CLASSES);
+        for (final ObjectClass objectClass : getObjectClasses()) {
+            attr.add(objectClass.toString());
         }
-        catch (final UnknownSchemaElementException e)
-        {
-          if (policy.checkAttributesAndObjectClasses().needsChecking())
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_UNKNOWN_OBJECT_CLASS
-                  .get(entry.getName().toString(), objectClassName);
-              errorMessages.add(message);
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        attr = new LinkedAttribute(Schema.ATTR_MATCHING_RULE_USE);
+        for (final MatchingRuleUse matchingRuleUse : getMatchingRuleUses()) {
+            attr.add(matchingRuleUse.toString());
+        }
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        attr = new LinkedAttribute(Schema.ATTR_MATCHING_RULES);
+        for (final MatchingRule matchingRule : getMatchingRules()) {
+            attr.add(matchingRule.toString());
+        }
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        attr = new LinkedAttribute(Schema.ATTR_DIT_CONTENT_RULES);
+        for (final DITContentRule ditContentRule : getDITContentRules()) {
+            attr.add(ditContentRule.toString());
+        }
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        attr = new LinkedAttribute(Schema.ATTR_DIT_STRUCTURE_RULES);
+        for (final DITStructureRule ditStructureRule : getDITStuctureRules()) {
+            attr.add(ditStructureRule.toString());
+        }
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        attr = new LinkedAttribute(Schema.ATTR_NAME_FORMS);
+        for (final NameForm nameForm : getNameForms()) {
+            attr.add(nameForm.toString());
+        }
+        if (!attr.isEmpty()) {
+            entry.addAttribute(attr);
+        }
+
+        return entry;
+    }
+
+    /**
+     * Returns {@code true} if the provided entry is valid according to this
+     * schema and the specified schema validation policy.
+     * <p>
+     * If attribute value validation is enabled then following checks will be
+     * performed:
+     * <ul>
+     * <li>checking that there is at least one value
+     * <li>checking that single-valued attributes contain only a single value
+     * </ul>
+     * In particular, attribute values will not be checked for conformance to
+     * their syntax since this is expected to have already been performed while
+     * adding the values to the entry.
+     *
+     * @param entry
+     *            The entry to be validated.
+     * @param policy
+     *            The schema validation policy.
+     * @param errorMessages
+     *            A collection into which any schema validation warnings or
+     *            error messages can be placed, or {@code null} if they should
+     *            not be saved.
+     * @return {@code true} if an entry conforms to this schema based on the
+     *         provided schema validation policy.
+     */
+    public boolean validateEntry(final Entry entry, final SchemaValidationPolicy policy,
+            final Collection<LocalizableMessage> errorMessages) {
+        // First check that the object classes are recognized and that there is
+        // one
+        // structural object class.
+        ObjectClass structuralObjectClass = null;
+        final Attribute objectClassAttribute = entry.getAttribute(objectClass());
+        final List<ObjectClass> objectClasses = new LinkedList<ObjectClass>();
+        if (objectClassAttribute != null) {
+            for (final ByteString v : objectClassAttribute) {
+                final String objectClassName = v.toString();
+                final ObjectClass objectClass;
+                try {
+                    objectClass = getObjectClass(objectClassName);
+                    objectClasses.add(objectClass);
+                } catch (final UnknownSchemaElementException e) {
+                    if (policy.checkAttributesAndObjectClasses().needsChecking()) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_UNKNOWN_OBJECT_CLASS.get(entry.getName()
+                                            .toString(), objectClassName);
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkAttributesAndObjectClasses().isReject()) {
+                            return false;
+                        }
+                    }
+                    continue;
+                }
+
+                if (objectClass.getObjectClassType() == ObjectClassType.STRUCTURAL) {
+                    if (structuralObjectClass == null
+                            || objectClass.isDescendantOf(structuralObjectClass)) {
+                        structuralObjectClass = objectClass;
+                    } else if (!structuralObjectClass.isDescendantOf(objectClass)) {
+                        if (policy.requireSingleStructuralObjectClass().needsChecking()) {
+                            if (errorMessages != null) {
+                                final LocalizableMessage message =
+                                        ERR_ENTRY_SCHEMA_MULTIPLE_STRUCTURAL_CLASSES.get(entry
+                                                .getName().toString(), structuralObjectClass
+                                                .getNameOrOID(), objectClassName);
+                                errorMessages.add(message);
+                            }
+                            if (policy.requireSingleStructuralObjectClass().isReject()) {
+                                return false;
+                            }
+                        }
+                    }
+                }
             }
-            if (policy.checkAttributesAndObjectClasses().isReject())
-            {
-              return false;
-            }
-          }
-          continue;
         }
 
-        if (objectClass.getObjectClassType() == ObjectClassType.STRUCTURAL)
-        {
-          if (structuralObjectClass == null
-              || objectClass.isDescendantOf(structuralObjectClass))
-          {
-            structuralObjectClass = objectClass;
-          }
-          else if (!structuralObjectClass.isDescendantOf(objectClass))
-          {
-            if (policy.requireSingleStructuralObjectClass().needsChecking())
-            {
-              if (errorMessages != null)
-              {
-                final LocalizableMessage message = ERR_ENTRY_SCHEMA_MULTIPLE_STRUCTURAL_CLASSES
-                    .get(entry.getName().toString(),
-                        structuralObjectClass.getNameOrOID(), objectClassName);
-                errorMessages.add(message);
-              }
-              if (policy.requireSingleStructuralObjectClass().isReject())
-              {
-                return false;
-              }
-            }
-          }
-        }
-      }
-    }
+        Collection<DITStructureRule> ditStructureRules = Collections.emptyList();
+        DITContentRule ditContentRule = null;
 
-    Collection<DITStructureRule> ditStructureRules = Collections.emptyList();
-    DITContentRule ditContentRule = null;
-
-    if (structuralObjectClass == null)
-    {
-      if (policy.requireSingleStructuralObjectClass().needsChecking())
-      {
-        if (errorMessages != null)
-        {
-          final LocalizableMessage message = ERR_ENTRY_SCHEMA_NO_STRUCTURAL_CLASS
-              .get(entry.getName().toString());
-          errorMessages.add(message);
-        }
-        if (policy.requireSingleStructuralObjectClass().isReject())
-        {
-          return false;
-        }
-      }
-    }
-    else
-    {
-      ditContentRule = getDITContentRule(structuralObjectClass);
-      if (ditContentRule != null && ditContentRule.isObsolete())
-      {
-        ditContentRule = null;
-      }
-    }
-
-    // Check entry conforms to object classes and optional content rule.
-    if (!checkAttributesAndObjectClasses(entry, policy, errorMessages,
-        objectClasses, ditContentRule))
-    {
-      return false;
-    }
-
-    // Check that the name of the entry conforms to at least one applicable name
-    // form.
-    if (policy.checkNameForms().needsChecking()
-        && structuralObjectClass != null)
-    {
-      /**
-       * There may be multiple name forms registered with this structural object
-       * class. However, we need to select only one of the name forms and its
-       * corresponding DIT structure rule(s). We will iterate over all the name
-       * forms and see if at least one is acceptable before rejecting the entry.
-       * DIT structure rules corresponding to other non-acceptable name forms
-       * are not applied.
-       */
-      boolean foundMatchingNameForms = false;
-      NameForm nameForm = null;
-      final List<LocalizableMessage> nameFormWarnings =
-        (errorMessages != null) ? new LinkedList<LocalizableMessage>() : null;
-      for (final NameForm nf : getNameForms(structuralObjectClass))
-      {
-        if (nf.isObsolete())
-        {
-          continue;
-        }
-
-        // If there are any candidate name forms then at least one should be
-        // valid.
-        foundMatchingNameForms = true;
-
-        if (checkNameForm(entry, policy, nameFormWarnings, nf))
-        {
-          nameForm = nf;
-          break;
-        }
-      }
-
-      if (foundMatchingNameForms)
-      {
-        if (nameForm != null)
-        {
-          ditStructureRules = getDITStructureRules(nameForm);
-        }
-        else
-        {
-          // We couldn't match this entry against any of the name forms, so
-          // append the reasons why they didn't match and reject if required.
-          if (errorMessages != null)
-          {
-            errorMessages.addAll(nameFormWarnings);
-          }
-          if (policy.checkNameForms().isReject())
-          {
-            return false;
-          }
-        }
-      }
-    }
-
-    // Check DIT structure rules - this needs the parent entry.
-    if (policy.checkDITStructureRules().needsChecking()
-        && !entry.getName().isRootDN())
-    {
-      boolean foundMatchingRules = false;
-      boolean foundValidRule = false;
-      final List<LocalizableMessage> ruleWarnings =
-        (errorMessages != null) ? new LinkedList<LocalizableMessage>() : null;
-      ObjectClass parentStructuralObjectClass = null;
-      boolean parentEntryHasBeenRead = false;
-      for (final DITStructureRule rule : ditStructureRules)
-      {
-        if (rule.isObsolete())
-        {
-          continue;
-        }
-
-        foundMatchingRules = true;
-
-        // A DIT structure rule with no superiors is automatically valid, so
-        // avoid reading the parent.
-        if (rule.getSuperiorRules().isEmpty())
-        {
-          foundValidRule = true;
-          break;
-        }
-
-        if (!parentEntryHasBeenRead)
-        {
-          // Don't drop out immediately on failure because there may be some
-          // applicable rules which do not require the parent entry.
-          parentStructuralObjectClass = getParentStructuralObjectClass(entry,
-              policy, ruleWarnings);
-          parentEntryHasBeenRead = true;
-        }
-
-        if (parentStructuralObjectClass != null)
-        {
-          if (checkDITStructureRule(entry, policy, ruleWarnings, rule,
-              structuralObjectClass, parentStructuralObjectClass))
-          {
-            foundValidRule = true;
-            break;
-          }
-        }
-      }
-
-      if (foundMatchingRules)
-      {
-        if (!foundValidRule)
-        {
-          // We couldn't match this entry against any of the rules, so
-          // append the reasons why they didn't match and reject if required.
-          if (errorMessages != null)
-          {
-            errorMessages.addAll(ruleWarnings);
-          }
-          if (policy.checkDITStructureRules().isReject())
-          {
-            return false;
-          }
-        }
-      }
-      else
-      {
-        // There is no DIT structure rule for this entry, but there may
-        // be one for the parent entry. If there is such a rule for the
-        // parent entry, then this entry will not be valid.
-
-        // The parent won't have been read yet.
-        parentStructuralObjectClass = getParentStructuralObjectClass(entry,
-            policy, ruleWarnings);
-        if (parentStructuralObjectClass == null)
-        {
-          if (errorMessages != null)
-          {
-            errorMessages.addAll(ruleWarnings);
-          }
-          if (policy.checkDITStructureRules().isReject())
-          {
-            return false;
-          }
-        }
-        else
-        {
-          for (final NameForm nf : getNameForms(parentStructuralObjectClass))
-          {
-            if (!nf.isObsolete())
-            {
-              for (final DITStructureRule rule : getDITStructureRules(nf))
-              {
-                if (!rule.isObsolete())
-                {
-                  if (errorMessages != null)
-                  {
-                    final LocalizableMessage message = ERR_ENTRY_SCHEMA_DSR_MISSING_DSR
-                        .get(entry.getName().toString(), rule.getNameOrRuleID());
+        if (structuralObjectClass == null) {
+            if (policy.requireSingleStructuralObjectClass().needsChecking()) {
+                if (errorMessages != null) {
+                    final LocalizableMessage message =
+                            ERR_ENTRY_SCHEMA_NO_STRUCTURAL_CLASS.get(entry.getName().toString());
                     errorMessages.add(message);
-                  }
-                  if (policy.checkDITStructureRules().isReject())
-                  {
+                }
+                if (policy.requireSingleStructuralObjectClass().isReject()) {
                     return false;
-                  }
-
-                  // We could break out of the loop here in warn mode but
-                  // continuing allows us to collect all conflicts.
                 }
-              }
             }
-          }
-        }
-      }
-    }
-
-    // If we've gotten here, then the entry is acceptable.
-    return true;
-  }
-
-
-
-  private boolean checkAttributesAndObjectClasses(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final Collection<LocalizableMessage> errorMessages,
-      final List<ObjectClass> objectClasses, final DITContentRule ditContentRule)
-  {
-    // Check object classes.
-    final boolean checkDITContentRule = policy.checkDITContentRules()
-        .needsChecking() && ditContentRule != null;
-    final boolean checkObjectClasses = policy.checkAttributesAndObjectClasses()
-        .needsChecking();
-    final boolean checkAttributeValues = policy.checkAttributeValues()
-        .needsChecking();
-
-    if (checkObjectClasses || checkDITContentRule)
-    {
-      for (final ObjectClass objectClass : objectClasses)
-      {
-        // Make sure that any auxiliary object classes are permitted by the
-        // content rule.
-        if (checkDITContentRule)
-        {
-          if (objectClass.getObjectClassType() == ObjectClassType.AUXILIARY
-              && !ditContentRule.getAuxiliaryClasses().contains(objectClass))
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_DCR_PROHIBITED_AUXILIARY_OC
-                  .get(entry.getName().toString(), objectClass.getNameOrOID(),
-                      ditContentRule.getNameOrOID());
-              errorMessages.add(message);
+        } else {
+            ditContentRule = getDITContentRule(structuralObjectClass);
+            if (ditContentRule != null && ditContentRule.isObsolete()) {
+                ditContentRule = null;
             }
-            if (policy.checkDITContentRules().isReject())
-            {
-              return false;
-            }
-          }
         }
 
-        // Make sure that all of the attributes required by the object class are
-        // present.
-        if (checkObjectClasses)
-        {
-          for (final AttributeType t : objectClass.getDeclaredRequiredAttributes())
-          {
-            final Attribute a = Attributes.emptyAttribute(AttributeDescription
-                .create(t));
-            if (!entry.containsAttribute(a, null))
-            {
-              if (errorMessages != null)
-              {
-                final LocalizableMessage message = ERR_ENTRY_SCHEMA_OC_MISSING_MUST_ATTRIBUTES
-                    .get(entry.getName().toString(), t.getNameOrOID(),
-                        objectClass.getNameOrOID());
-                errorMessages.add(message);
-              }
-              if (policy.checkAttributesAndObjectClasses().isReject())
-              {
-                return false;
-              }
-            }
-          }
-        }
-      }
-
-      // Make sure that all of the attributes required by the content rule are
-      // present.
-      if (checkDITContentRule)
-      {
-        for (final AttributeType t : ditContentRule.getRequiredAttributes())
-        {
-          final Attribute a = Attributes.emptyAttribute(AttributeDescription
-              .create(t));
-          if (!entry.containsAttribute(a, null))
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_DCR_MISSING_MUST_ATTRIBUTES
-                  .get(entry.getName().toString(), t.getNameOrOID(),
-                      ditContentRule.getNameOrOID());
-              errorMessages.add(message);
-            }
-            if (policy.checkDITContentRules().isReject())
-            {
-              return false;
-            }
-          }
+        // Check entry conforms to object classes and optional content rule.
+        if (!checkAttributesAndObjectClasses(entry, policy, errorMessages, objectClasses,
+                ditContentRule)) {
+            return false;
         }
 
-        // Make sure that attributes prohibited by the content rule are not
-        // present.
-        for (final AttributeType t : ditContentRule.getProhibitedAttributes())
-        {
-          final Attribute a = Attributes.emptyAttribute(AttributeDescription
-              .create(t));
-          if (entry.containsAttribute(a, null))
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_DCR_PROHIBITED_ATTRIBUTES
-                  .get(entry.getName().toString(), t.getNameOrOID(),
-                      ditContentRule.getNameOrOID());
-              errorMessages.add(message);
-            }
-            if (policy.checkDITContentRules().isReject())
-            {
-              return false;
-            }
-          }
-        }
-      }
-    }
-
-    // Check attributes.
-    if (checkObjectClasses || checkDITContentRule || checkAttributeValues)
-    {
-      for (final Attribute attribute : entry.getAllAttributes())
-      {
-        final AttributeType t = attribute.getAttributeDescription()
-            .getAttributeType();
-
-        if (!t.isOperational())
-        {
-          if (checkObjectClasses || checkDITContentRule)
-          {
-            boolean isAllowed = false;
-            for (final ObjectClass objectClass : objectClasses)
-            {
-              if (objectClass.isRequiredOrOptional(t))
-              {
-                isAllowed = true;
-                break;
-              }
-            }
-            if (!isAllowed && ditContentRule != null)
-            {
-              if (ditContentRule.isRequiredOrOptional(t))
-              {
-                isAllowed = true;
-              }
-            }
-            if (!isAllowed)
-            {
-              if (errorMessages != null)
-              {
-                final LocalizableMessage message;
-                if (ditContentRule == null)
-                {
-                  message = ERR_ENTRY_SCHEMA_OC_DISALLOWED_ATTRIBUTES.get(entry
-                      .getName().toString(), t.getNameOrOID());
+        // Check that the name of the entry conforms to at least one applicable
+        // name
+        // form.
+        if (policy.checkNameForms().needsChecking() && structuralObjectClass != null) {
+            /**
+             * There may be multiple name forms registered with this structural
+             * object class. However, we need to select only one of the name
+             * forms and its corresponding DIT structure rule(s). We will
+             * iterate over all the name forms and see if at least one is
+             * acceptable before rejecting the entry. DIT structure rules
+             * corresponding to other non-acceptable name forms are not applied.
+             */
+            boolean foundMatchingNameForms = false;
+            NameForm nameForm = null;
+            final List<LocalizableMessage> nameFormWarnings =
+                    (errorMessages != null) ? new LinkedList<LocalizableMessage>() : null;
+            for (final NameForm nf : getNameForms(structuralObjectClass)) {
+                if (nf.isObsolete()) {
+                    continue;
                 }
-                else
-                {
-                  message = ERR_ENTRY_SCHEMA_DCR_DISALLOWED_ATTRIBUTES.get(
-                      entry.getName().toString(), t.getNameOrOID(),
-                      ditContentRule.getNameOrOID());
+
+                // If there are any candidate name forms then at least one
+                // should be
+                // valid.
+                foundMatchingNameForms = true;
+
+                if (checkNameForm(entry, policy, nameFormWarnings, nf)) {
+                    nameForm = nf;
+                    break;
                 }
-                errorMessages.add(message);
-              }
-              if (policy.checkAttributesAndObjectClasses().isReject()
-                  || policy.checkDITContentRules().isReject())
-              {
-                return false;
-              }
             }
-          }
+
+            if (foundMatchingNameForms) {
+                if (nameForm != null) {
+                    ditStructureRules = getDITStructureRules(nameForm);
+                } else {
+                    // We couldn't match this entry against any of the name
+                    // forms, so
+                    // append the reasons why they didn't match and reject if
+                    // required.
+                    if (errorMessages != null) {
+                        errorMessages.addAll(nameFormWarnings);
+                    }
+                    if (policy.checkNameForms().isReject()) {
+                        return false;
+                    }
+                }
+            }
         }
 
-        // Check all attributes contain an appropriate number of values.
-        if (checkAttributeValues)
-        {
-          final int sz = attribute.size();
+        // Check DIT structure rules - this needs the parent entry.
+        if (policy.checkDITStructureRules().needsChecking() && !entry.getName().isRootDN()) {
+            boolean foundMatchingRules = false;
+            boolean foundValidRule = false;
+            final List<LocalizableMessage> ruleWarnings =
+                    (errorMessages != null) ? new LinkedList<LocalizableMessage>() : null;
+            ObjectClass parentStructuralObjectClass = null;
+            boolean parentEntryHasBeenRead = false;
+            for (final DITStructureRule rule : ditStructureRules) {
+                if (rule.isObsolete()) {
+                    continue;
+                }
 
-          if (sz == 0)
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_AT_EMPTY_ATTRIBUTE
-              .get(entry.getName().toString(), t.getNameOrOID());
-              errorMessages.add(message);
+                foundMatchingRules = true;
+
+                // A DIT structure rule with no superiors is automatically
+                // valid, so
+                // avoid reading the parent.
+                if (rule.getSuperiorRules().isEmpty()) {
+                    foundValidRule = true;
+                    break;
+                }
+
+                if (!parentEntryHasBeenRead) {
+                    // Don't drop out immediately on failure because there may
+                    // be some
+                    // applicable rules which do not require the parent entry.
+                    parentStructuralObjectClass =
+                            getParentStructuralObjectClass(entry, policy, ruleWarnings);
+                    parentEntryHasBeenRead = true;
+                }
+
+                if (parentStructuralObjectClass != null) {
+                    if (checkDITStructureRule(entry, policy, ruleWarnings, rule,
+                            structuralObjectClass, parentStructuralObjectClass)) {
+                        foundValidRule = true;
+                        break;
+                    }
+                }
             }
-            if (policy.checkAttributeValues().isReject())
-            {
-              return false;
+
+            if (foundMatchingRules) {
+                if (!foundValidRule) {
+                    // We couldn't match this entry against any of the rules, so
+                    // append the reasons why they didn't match and reject if
+                    // required.
+                    if (errorMessages != null) {
+                        errorMessages.addAll(ruleWarnings);
+                    }
+                    if (policy.checkDITStructureRules().isReject()) {
+                        return false;
+                    }
+                }
+            } else {
+                // There is no DIT structure rule for this entry, but there may
+                // be one for the parent entry. If there is such a rule for the
+                // parent entry, then this entry will not be valid.
+
+                // The parent won't have been read yet.
+                parentStructuralObjectClass =
+                        getParentStructuralObjectClass(entry, policy, ruleWarnings);
+                if (parentStructuralObjectClass == null) {
+                    if (errorMessages != null) {
+                        errorMessages.addAll(ruleWarnings);
+                    }
+                    if (policy.checkDITStructureRules().isReject()) {
+                        return false;
+                    }
+                } else {
+                    for (final NameForm nf : getNameForms(parentStructuralObjectClass)) {
+                        if (!nf.isObsolete()) {
+                            for (final DITStructureRule rule : getDITStructureRules(nf)) {
+                                if (!rule.isObsolete()) {
+                                    if (errorMessages != null) {
+                                        final LocalizableMessage message =
+                                                ERR_ENTRY_SCHEMA_DSR_MISSING_DSR.get(entry
+                                                        .getName().toString(), rule
+                                                        .getNameOrRuleID());
+                                        errorMessages.add(message);
+                                    }
+                                    if (policy.checkDITStructureRules().isReject()) {
+                                        return false;
+                                    }
+
+                                    // We could break out of the loop here in
+                                    // warn mode but
+                                    // continuing allows us to collect all
+                                    // conflicts.
+                                }
+                            }
+                        }
+                    }
+                }
             }
-          }
-          else if (sz > 1 && t.isSingleValue())
-          {
-            if (errorMessages != null)
-            {
-              final LocalizableMessage message = ERR_ENTRY_SCHEMA_AT_SINGLE_VALUED_ATTRIBUTE
-              .get(entry.getName().toString(), t.getNameOrOID());
-              errorMessages.add(message);
-            }
-            if (policy.checkAttributeValues().isReject())
-            {
-              return false;
-            }
-          }
         }
-      }
+
+        // If we've gotten here, then the entry is acceptable.
+        return true;
     }
 
-    // If we've gotten here, then things are OK.
-    return true;
-  }
+    private boolean checkAttributesAndObjectClasses(final Entry entry,
+            final SchemaValidationPolicy policy,
+            final Collection<LocalizableMessage> errorMessages,
+            final List<ObjectClass> objectClasses, final DITContentRule ditContentRule) {
+        // Check object classes.
+        final boolean checkDITContentRule =
+                policy.checkDITContentRules().needsChecking() && ditContentRule != null;
+        final boolean checkObjectClasses = policy.checkAttributesAndObjectClasses().needsChecking();
+        final boolean checkAttributeValues = policy.checkAttributeValues().needsChecking();
 
+        if (checkObjectClasses || checkDITContentRule) {
+            for (final ObjectClass objectClass : objectClasses) {
+                // Make sure that any auxiliary object classes are permitted by
+                // the
+                // content rule.
+                if (checkDITContentRule) {
+                    if (objectClass.getObjectClassType() == ObjectClassType.AUXILIARY
+                            && !ditContentRule.getAuxiliaryClasses().contains(objectClass)) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_DCR_PROHIBITED_AUXILIARY_OC.get(entry
+                                            .getName().toString(), objectClass.getNameOrOID(),
+                                            ditContentRule.getNameOrOID());
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkDITContentRules().isReject()) {
+                            return false;
+                        }
+                    }
+                }
 
+                // Make sure that all of the attributes required by the object
+                // class are
+                // present.
+                if (checkObjectClasses) {
+                    for (final AttributeType t : objectClass.getDeclaredRequiredAttributes()) {
+                        final Attribute a =
+                                Attributes.emptyAttribute(AttributeDescription.create(t));
+                        if (!entry.containsAttribute(a, null)) {
+                            if (errorMessages != null) {
+                                final LocalizableMessage message =
+                                        ERR_ENTRY_SCHEMA_OC_MISSING_MUST_ATTRIBUTES.get(entry
+                                                .getName().toString(), t.getNameOrOID(),
+                                                objectClass.getNameOrOID());
+                                errorMessages.add(message);
+                            }
+                            if (policy.checkAttributesAndObjectClasses().isReject()) {
+                                return false;
+                            }
+                        }
+                    }
+                }
+            }
 
-  private boolean checkDITStructureRule(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final List<LocalizableMessage> ruleWarnings, final DITStructureRule rule,
-      final ObjectClass structuralObjectClass,
-      final ObjectClass parentStructuralObjectClass)
-  {
-    boolean matchFound = false;
-    for (final DITStructureRule parentRule : rule.getSuperiorRules())
-    {
-      if (parentRule.getNameForm().getStructuralClass()
-          .equals(parentStructuralObjectClass))
-      {
-        matchFound = true;
-      }
-    }
+            // Make sure that all of the attributes required by the content rule
+            // are
+            // present.
+            if (checkDITContentRule) {
+                for (final AttributeType t : ditContentRule.getRequiredAttributes()) {
+                    final Attribute a = Attributes.emptyAttribute(AttributeDescription.create(t));
+                    if (!entry.containsAttribute(a, null)) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_DCR_MISSING_MUST_ATTRIBUTES.get(entry
+                                            .getName().toString(), t.getNameOrOID(), ditContentRule
+                                            .getNameOrOID());
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkDITContentRules().isReject()) {
+                            return false;
+                        }
+                    }
+                }
 
-    if (!matchFound)
-    {
-      if (ruleWarnings != null)
-      {
-        final LocalizableMessage message = ERR_ENTRY_SCHEMA_DSR_ILLEGAL_OC.get(
-            entry.getName().toString(), rule.getNameOrRuleID(),
-            structuralObjectClass.getNameOrOID(),
-            parentStructuralObjectClass.getNameOrOID());
-        ruleWarnings.add(message);
-      }
-      return false;
-    }
-
-    return true;
-  }
-
-
-
-  private boolean checkNameForm(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final List<LocalizableMessage> nameFormWarnings, final NameForm nameForm)
-  {
-    final RDN rdn = entry.getName().rdn();
-    if (rdn != null)
-    {
-      // Make sure that all the required AVAs are present.
-      for (final AttributeType t : nameForm.getRequiredAttributes())
-      {
-        if (rdn.getAttributeValue(t) == null)
-        {
-          if (nameFormWarnings != null)
-          {
-            final LocalizableMessage message = ERR_ENTRY_SCHEMA_NF_MISSING_MUST_ATTRIBUTES
-                .get(entry.getName().toString(), t.getNameOrOID(),
-                    nameForm.getNameOrOID());
-            nameFormWarnings.add(message);
-          }
-          return false;
+                // Make sure that attributes prohibited by the content rule are
+                // not
+                // present.
+                for (final AttributeType t : ditContentRule.getProhibitedAttributes()) {
+                    final Attribute a = Attributes.emptyAttribute(AttributeDescription.create(t));
+                    if (entry.containsAttribute(a, null)) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_DCR_PROHIBITED_ATTRIBUTES.get(entry.getName()
+                                            .toString(), t.getNameOrOID(), ditContentRule
+                                            .getNameOrOID());
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkDITContentRules().isReject()) {
+                            return false;
+                        }
+                    }
+                }
+            }
         }
-      }
 
-      // Make sure that all AVAs in the RDN are allowed.
-      for (final AVA ava : rdn)
-      {
-        final AttributeType t = ava.getAttributeType();
-        if (!nameForm.isRequiredOrOptional(t))
-        {
-          if (nameFormWarnings != null)
-          {
-            final LocalizableMessage message = ERR_ENTRY_SCHEMA_NF_DISALLOWED_ATTRIBUTES
-                .get(entry.getName().toString(), t.getNameOrOID(),
-                    nameForm.getNameOrOID());
-            nameFormWarnings.add(message);
-          }
-          return false;
+        // Check attributes.
+        if (checkObjectClasses || checkDITContentRule || checkAttributeValues) {
+            for (final Attribute attribute : entry.getAllAttributes()) {
+                final AttributeType t = attribute.getAttributeDescription().getAttributeType();
+
+                if (!t.isOperational()) {
+                    if (checkObjectClasses || checkDITContentRule) {
+                        boolean isAllowed = false;
+                        for (final ObjectClass objectClass : objectClasses) {
+                            if (objectClass.isRequiredOrOptional(t)) {
+                                isAllowed = true;
+                                break;
+                            }
+                        }
+                        if (!isAllowed && ditContentRule != null) {
+                            if (ditContentRule.isRequiredOrOptional(t)) {
+                                isAllowed = true;
+                            }
+                        }
+                        if (!isAllowed) {
+                            if (errorMessages != null) {
+                                final LocalizableMessage message;
+                                if (ditContentRule == null) {
+                                    message =
+                                            ERR_ENTRY_SCHEMA_OC_DISALLOWED_ATTRIBUTES.get(entry
+                                                    .getName().toString(), t.getNameOrOID());
+                                } else {
+                                    message =
+                                            ERR_ENTRY_SCHEMA_DCR_DISALLOWED_ATTRIBUTES.get(entry
+                                                    .getName().toString(), t.getNameOrOID(),
+                                                    ditContentRule.getNameOrOID());
+                                }
+                                errorMessages.add(message);
+                            }
+                            if (policy.checkAttributesAndObjectClasses().isReject()
+                                    || policy.checkDITContentRules().isReject()) {
+                                return false;
+                            }
+                        }
+                    }
+                }
+
+                // Check all attributes contain an appropriate number of values.
+                if (checkAttributeValues) {
+                    final int sz = attribute.size();
+
+                    if (sz == 0) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_AT_EMPTY_ATTRIBUTE.get(entry.getName()
+                                            .toString(), t.getNameOrOID());
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkAttributeValues().isReject()) {
+                            return false;
+                        }
+                    } else if (sz > 1 && t.isSingleValue()) {
+                        if (errorMessages != null) {
+                            final LocalizableMessage message =
+                                    ERR_ENTRY_SCHEMA_AT_SINGLE_VALUED_ATTRIBUTE.get(entry.getName()
+                                            .toString(), t.getNameOrOID());
+                            errorMessages.add(message);
+                        }
+                        if (policy.checkAttributeValues().isReject()) {
+                            return false;
+                        }
+                    }
+                }
+            }
         }
-      }
+
+        // If we've gotten here, then things are OK.
+        return true;
     }
 
-    // If we've gotten here, then things are OK.
-    return true;
-  }
+    private boolean checkDITStructureRule(final Entry entry, final SchemaValidationPolicy policy,
+            final List<LocalizableMessage> ruleWarnings, final DITStructureRule rule,
+            final ObjectClass structuralObjectClass, final ObjectClass parentStructuralObjectClass) {
+        boolean matchFound = false;
+        for (final DITStructureRule parentRule : rule.getSuperiorRules()) {
+            if (parentRule.getNameForm().getStructuralClass().equals(parentStructuralObjectClass)) {
+                matchFound = true;
+            }
+        }
 
+        if (!matchFound) {
+            if (ruleWarnings != null) {
+                final LocalizableMessage message =
+                        ERR_ENTRY_SCHEMA_DSR_ILLEGAL_OC.get(entry.getName().toString(), rule
+                                .getNameOrRuleID(), structuralObjectClass.getNameOrOID(),
+                                parentStructuralObjectClass.getNameOrOID());
+                ruleWarnings.add(message);
+            }
+            return false;
+        }
 
-
-  private ObjectClass getParentStructuralObjectClass(final Entry entry,
-      final SchemaValidationPolicy policy,
-      final List<LocalizableMessage> ruleWarnings)
-  {
-    final Entry parentEntry;
-    try
-    {
-      parentEntry = policy.checkDITStructureRulesEntryResolver().getEntry(
-          entry.getName().parent());
-    }
-    catch (final ErrorResultException e)
-    {
-      if (ruleWarnings != null)
-      {
-        final LocalizableMessage message = ERR_ENTRY_SCHEMA_DSR_PARENT_NOT_FOUND
-            .get(entry.getName().toString(), e.getResult()
-                .getDiagnosticMessage());
-        ruleWarnings.add(message);
-      }
-      return null;
+        return true;
     }
 
-    final ObjectClass parentStructuralObjectClass = Entries
-        .getStructuralObjectClass(parentEntry, this);
-    if (parentStructuralObjectClass == null)
-    {
-      if (ruleWarnings != null)
-      {
-        final LocalizableMessage message = ERR_ENTRY_SCHEMA_DSR_NO_PARENT_OC
-            .get(entry.getName().toString());
-        ruleWarnings.add(message);
-      }
-      return null;
+    private boolean checkNameForm(final Entry entry, final SchemaValidationPolicy policy,
+            final List<LocalizableMessage> nameFormWarnings, final NameForm nameForm) {
+        final RDN rdn = entry.getName().rdn();
+        if (rdn != null) {
+            // Make sure that all the required AVAs are present.
+            for (final AttributeType t : nameForm.getRequiredAttributes()) {
+                if (rdn.getAttributeValue(t) == null) {
+                    if (nameFormWarnings != null) {
+                        final LocalizableMessage message =
+                                ERR_ENTRY_SCHEMA_NF_MISSING_MUST_ATTRIBUTES.get(entry.getName()
+                                        .toString(), t.getNameOrOID(), nameForm.getNameOrOID());
+                        nameFormWarnings.add(message);
+                    }
+                    return false;
+                }
+            }
+
+            // Make sure that all AVAs in the RDN are allowed.
+            for (final AVA ava : rdn) {
+                final AttributeType t = ava.getAttributeType();
+                if (!nameForm.isRequiredOrOptional(t)) {
+                    if (nameFormWarnings != null) {
+                        final LocalizableMessage message =
+                                ERR_ENTRY_SCHEMA_NF_DISALLOWED_ATTRIBUTES.get(entry.getName()
+                                        .toString(), t.getNameOrOID(), nameForm.getNameOrOID());
+                        nameFormWarnings.add(message);
+                    }
+                    return false;
+                }
+            }
+        }
+
+        // If we've gotten here, then things are OK.
+        return true;
     }
-    return parentStructuralObjectClass;
-  }
+
+    private ObjectClass getParentStructuralObjectClass(final Entry entry,
+            final SchemaValidationPolicy policy, final List<LocalizableMessage> ruleWarnings) {
+        final Entry parentEntry;
+        try {
+            parentEntry =
+                    policy.checkDITStructureRulesEntryResolver().getEntry(entry.getName().parent());
+        } catch (final ErrorResultException e) {
+            if (ruleWarnings != null) {
+                final LocalizableMessage message =
+                        ERR_ENTRY_SCHEMA_DSR_PARENT_NOT_FOUND.get(entry.getName().toString(), e
+                                .getResult().getDiagnosticMessage());
+                ruleWarnings.add(message);
+            }
+            return null;
+        }
+
+        final ObjectClass parentStructuralObjectClass =
+                Entries.getStructuralObjectClass(parentEntry, this);
+        if (parentStructuralObjectClass == null) {
+            if (ruleWarnings != null) {
+                final LocalizableMessage message =
+                        ERR_ENTRY_SCHEMA_DSR_NO_PARENT_OC.get(entry.getName().toString());
+                ruleWarnings.add(message);
+            }
+            return null;
+        }
+        return parentStructuralObjectClass;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
index 45915ba..fc3589a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
@@ -42,3700 +39,3047 @@
 import static org.forgerock.opendj.ldap.schema.SchemaUtils.unmodifiableCopyOfList;
 import static org.forgerock.opendj.ldap.schema.SchemaUtils.unmodifiableCopyOfSet;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.EntryNotFoundException;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
-import com.forgerock.opendj.util.*;
-
-
+import com.forgerock.opendj.util.FutureResultTransformer;
+import com.forgerock.opendj.util.RecursiveFutureResult;
+import com.forgerock.opendj.util.StaticUtils;
+import com.forgerock.opendj.util.SubstringReader;
+import com.forgerock.opendj.util.Validator;
 
 /**
  * Schema builders should be used for incremental construction of new schemas.
  */
-public final class SchemaBuilder
-{
+public final class SchemaBuilder {
 
-  private static final String ATTR_SUBSCHEMA_SUBENTRY = "subschemaSubentry";
+    private static final String ATTR_SUBSCHEMA_SUBENTRY = "subschemaSubentry";
 
-  private static final String[] SUBSCHEMA_ATTRS = new String[] {
-      ATTR_LDAP_SYNTAXES, ATTR_ATTRIBUTE_TYPES, ATTR_DIT_CONTENT_RULES,
-      ATTR_DIT_STRUCTURE_RULES, ATTR_MATCHING_RULE_USE, ATTR_MATCHING_RULES,
-      ATTR_NAME_FORMS, ATTR_OBJECT_CLASSES };
+    private static final String[] SUBSCHEMA_ATTRS = new String[] { ATTR_LDAP_SYNTAXES,
+        ATTR_ATTRIBUTE_TYPES, ATTR_DIT_CONTENT_RULES, ATTR_DIT_STRUCTURE_RULES,
+        ATTR_MATCHING_RULE_USE, ATTR_MATCHING_RULES, ATTR_NAME_FORMS, ATTR_OBJECT_CLASSES };
 
-  private static final Filter SUBSCHEMA_FILTER = Filter
-      .valueOf("(objectClass=subschema)");
+    private static final Filter SUBSCHEMA_FILTER = Filter.valueOf("(objectClass=subschema)");
 
-  private static final String[] SUBSCHEMA_SUBENTRY_ATTRS = new String[] { ATTR_SUBSCHEMA_SUBENTRY };
+    private static final String[] SUBSCHEMA_SUBENTRY_ATTRS =
+            new String[] { ATTR_SUBSCHEMA_SUBENTRY };
 
-
-
-  // Constructs a search request for retrieving the subschemaSubentry
-  // attribute from the named entry.
-  private static SearchRequest getReadSchemaForEntrySearchRequest(final DN dn)
-  {
-    return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT,
-        Filter.getObjectClassPresentFilter(), SUBSCHEMA_SUBENTRY_ATTRS);
-  }
-
-
-
-  // Constructs a search request for retrieving the named subschema
-  // sub-entry.
-  private static SearchRequest getReadSchemaSearchRequest(final DN dn)
-  {
-    return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT,
-        SUBSCHEMA_FILTER, SUBSCHEMA_ATTRS);
-  }
-
-
-
-  private static DN getSubschemaSubentryDN(final DN name, final Entry entry)
-      throws ErrorResultException
-  {
-    final Attribute subentryAttr = entry.getAttribute(ATTR_SUBSCHEMA_SUBENTRY);
-
-    if (subentryAttr == null || subentryAttr.isEmpty())
-    {
-      // Did not get the subschema sub-entry attribute.
-      throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
-          ERR_NO_SUBSCHEMA_SUBENTRY_ATTR.get(name.toString()).toString());
+    // Constructs a search request for retrieving the subschemaSubentry
+    // attribute from the named entry.
+    private static SearchRequest getReadSchemaForEntrySearchRequest(final DN dn) {
+        return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT, Filter
+                .getObjectClassPresentFilter(), SUBSCHEMA_SUBENTRY_ATTRS);
     }
 
-    final String dnString = subentryAttr.iterator().next().toString();
-    DN subschemaDN;
-    try
-    {
-      subschemaDN = DN.valueOf(dnString);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      throw newErrorResult(
-          ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
-          ERR_INVALID_SUBSCHEMA_SUBENTRY_ATTR.get(name.toString(), dnString,
-              e.getMessageObject()).toString());
+    // Constructs a search request for retrieving the named subschema
+    // sub-entry.
+    private static SearchRequest getReadSchemaSearchRequest(final DN dn) {
+        return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT, SUBSCHEMA_FILTER,
+                SUBSCHEMA_ATTRS);
     }
-    return subschemaDN;
-  }
 
+    private static DN getSubschemaSubentryDN(final DN name, final Entry entry)
+            throws ErrorResultException {
+        final Attribute subentryAttr = entry.getAttribute(ATTR_SUBSCHEMA_SUBENTRY);
 
+        if (subentryAttr == null || subentryAttr.isEmpty()) {
+            // Did not get the subschema sub-entry attribute.
+            throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
+                    ERR_NO_SUBSCHEMA_SUBENTRY_ATTR.get(name.toString()).toString());
+        }
 
-  private Map<Integer, DITStructureRule> id2StructureRules;
+        final String dnString = subentryAttr.iterator().next().toString();
+        DN subschemaDN;
+        try {
+            subschemaDN = DN.valueOf(dnString);
+        } catch (final LocalizedIllegalArgumentException e) {
+            throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
+                    ERR_INVALID_SUBSCHEMA_SUBENTRY_ATTR.get(name.toString(), dnString,
+                            e.getMessageObject()).toString());
+        }
+        return subschemaDN;
+    }
 
-  private Map<String, List<AttributeType>> name2AttributeTypes;
+    private Map<Integer, DITStructureRule> id2StructureRules;
 
-  private Map<String, List<DITContentRule>> name2ContentRules;
+    private Map<String, List<AttributeType>> name2AttributeTypes;
 
-  private Map<String, List<MatchingRule>> name2MatchingRules;
+    private Map<String, List<DITContentRule>> name2ContentRules;
 
-  private Map<String, List<MatchingRuleUse>> name2MatchingRuleUses;
+    private Map<String, List<MatchingRule>> name2MatchingRules;
 
-  private Map<String, List<NameForm>> name2NameForms;
+    private Map<String, List<MatchingRuleUse>> name2MatchingRuleUses;
 
-  private Map<String, List<ObjectClass>> name2ObjectClasses;
+    private Map<String, List<NameForm>> name2NameForms;
 
-  private Map<String, List<DITStructureRule>> name2StructureRules;
+    private Map<String, List<ObjectClass>> name2ObjectClasses;
 
-  private Map<String, List<DITStructureRule>> nameForm2StructureRules;
+    private Map<String, List<DITStructureRule>> name2StructureRules;
 
-  private Map<String, AttributeType> numericOID2AttributeTypes;
+    private Map<String, List<DITStructureRule>> nameForm2StructureRules;
 
-  private Map<String, DITContentRule> numericOID2ContentRules;
+    private Map<String, AttributeType> numericOID2AttributeTypes;
 
-  private Map<String, MatchingRule> numericOID2MatchingRules;
+    private Map<String, DITContentRule> numericOID2ContentRules;
 
-  private Map<String, MatchingRuleUse> numericOID2MatchingRuleUses;
+    private Map<String, MatchingRule> numericOID2MatchingRules;
 
-  private Map<String, NameForm> numericOID2NameForms;
+    private Map<String, MatchingRuleUse> numericOID2MatchingRuleUses;
 
-  private Map<String, ObjectClass> numericOID2ObjectClasses;
+    private Map<String, NameForm> numericOID2NameForms;
 
-  private Map<String, Syntax> numericOID2Syntaxes;
+    private Map<String, ObjectClass> numericOID2ObjectClasses;
 
-  private Map<String, List<NameForm>> objectClass2NameForms;
+    private Map<String, Syntax> numericOID2Syntaxes;
 
-  private String schemaName;
+    private Map<String, List<NameForm>> objectClass2NameForms;
 
-  private List<LocalizableMessage> warnings;
+    private String schemaName;
 
-  private boolean allowNonStandardTelephoneNumbers;
+    private List<LocalizableMessage> warnings;
 
-  private boolean allowZeroLengthDirectoryStrings;
+    private boolean allowNonStandardTelephoneNumbers;
 
-  private boolean allowMalformedNamesAndOptions;
+    private boolean allowZeroLengthDirectoryStrings;
 
-  // A schema which should be copied into this builder on any mutation.
-  private Schema copyOnWriteSchema = null;
+    private boolean allowMalformedNamesAndOptions;
 
-  // A unique ID which can be used to uniquely identify schemas
-  // constructed without a name.
-  private static final AtomicInteger NEXT_SCHEMA_ID = new AtomicInteger();
+    // A schema which should be copied into this builder on any mutation.
+    private Schema copyOnWriteSchema = null;
 
+    // A unique ID which can be used to uniquely identify schemas
+    // constructed without a name.
+    private static final AtomicInteger NEXT_SCHEMA_ID = new AtomicInteger();
 
+    /**
+     * Creates a new schema builder with no schema elements and default
+     * compatibility options.
+     */
+    public SchemaBuilder() {
+        preLazyInitBuilder(null, null);
+    }
 
-  /**
-   * Creates a new schema builder with no schema elements and default
-   * compatibility options.
-   */
-  public SchemaBuilder()
-  {
-    preLazyInitBuilder(null, null);
-  }
+    /**
+     * Creates a new schema builder containing all of the schema elements
+     * contained in the provided subschema subentry. Any problems encountered
+     * while parsing the entry can be retrieved using the returned schema's
+     * {@link Schema#getWarnings()} method.
+     *
+     * @param entry
+     *            The subschema subentry to be parsed.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public SchemaBuilder(final Entry entry) {
+        preLazyInitBuilder(entry.getName().toString(), null);
+        addSchema(entry, true);
+    }
 
+    /**
+     * Creates a new schema builder containing all of the schema elements from
+     * the provided schema and its compatibility options.
+     *
+     * @param schema
+     *            The initial contents of the schema builder.
+     * @throws NullPointerException
+     *             If {@code schema} was {@code null}.
+     */
+    public SchemaBuilder(final Schema schema) {
+        preLazyInitBuilder(schema.getSchemaName(), schema);
+    }
 
+    /**
+     * Creates a new schema builder with no schema elements and default
+     * compatibility options.
+     *
+     * @param schemaName
+     *            The user-friendly name of this schema which may be used for
+     *            debugging purposes.
+     */
+    public SchemaBuilder(final String schemaName) {
+        preLazyInitBuilder(schemaName, null);
+    }
 
-  /**
-   * Creates a new schema builder containing all of the schema elements
-   * contained in the provided subschema subentry. Any problems encountered
-   * while parsing the entry can be retrieved using the returned schema's
-   * {@link Schema#getWarnings()} method.
-   *
-   * @param entry
-   *          The subschema subentry to be parsed.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public SchemaBuilder(final Entry entry)
-  {
-    preLazyInitBuilder(entry.getName().toString(), null);
-    addSchema(entry, true);
-  }
+    /**
+     * Adds the provided attribute type definition to this schema builder.
+     *
+     * @param definition
+     *            The attribute type definition.
+     * @param overwrite
+     *            {@code true} if any existing attribute type with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided attribute type definition could not be
+     *             parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addAttributeType(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-  /**
-   * Creates a new schema builder containing all of the schema elements from the
-   * provided schema and its compatibility options.
-   *
-   * @param schema
-   *          The initial contents of the schema builder.
-   * @throws NullPointerException
-   *           If {@code schema} was {@code null}.
-   */
-  public SchemaBuilder(final Schema schema)
-  {
-    preLazyInitBuilder(schema.getSchemaName(), schema);
-  }
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
+            if (reader.remaining() <= 0) {
+                // This means that the definition was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-  /**
-   * Creates a new schema builder with no schema elements and default
-   * compatibility options.
-   *
-   * @param schemaName
-   *          The user-friendly name of this schema which may be used for
-   *          debugging purposes.
-   */
-  public SchemaBuilder(final String schemaName)
-  {
-    preLazyInitBuilder(schemaName, null);
-  }
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            String superiorType = null;
+            String equalityMatchingRule = null;
+            String orderingMatchingRule = null;
+            String substringMatchingRule = null;
+            String approximateMatchingRule = null;
+            String syntax = null;
+            boolean isSingleValue = false;
+            boolean isCollective = false;
+            boolean isNoUserModification = false;
+            AttributeUsage attributeUsage = AttributeUsage.USER_APPLICATIONS;
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-  /**
-   * Adds the provided attribute type definition to this schema builder.
-   *
-   * @param definition
-   *          The attribute type definition.
-   * @param overwrite
-   *          {@code true} if any existing attribute type with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided attribute type definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addAttributeType(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the definition. But before we start, set default
+            // values for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-    lazyInitBuilder();
-
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    // This specifies the name or OID of the superior attribute
+                    // type from which this attribute type should inherit its
+                    // properties.
+                    superiorType = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("equality")) {
+                    // This specifies the name or OID of the equality matching
+                    // rule to use for this attribute type.
+                    equalityMatchingRule =
+                            SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("ordering")) {
+                    // This specifies the name or OID of the ordering matching
+                    // rule to use for this attribute type.
+                    orderingMatchingRule =
+                            SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("substr")) {
+                    // This specifies the name or OID of the substring matching
+                    // rule to use for this attribute type.
+                    substringMatchingRule =
+                            SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("syntax")) {
+                    // This specifies the numeric OID of the syntax for this
+                    // matching rule. It may optionally be immediately followed
+                    // by
+                    // an open curly brace, an integer definition, and a close
+                    // curly brace to suggest the minimum number of characters
+                    // that should be allowed in values of that type. This
+                    // implementation will ignore any such length because it
+                    // does
+                    // not impose any practical limit on the length of attribute
+                    // values.
+                    syntax = SchemaUtils.readOIDLen(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("single-definition")) {
+                    // This indicates that attributes of this type are allowed
+                    // to
+                    // have at most one definition. We do not need any more
+                    // parsing for this token.
+                    isSingleValue = true;
+                } else if (tokenName.equalsIgnoreCase("single-value")) {
+                    // This indicates that attributes of this type are allowed
+                    // to
+                    // have at most one value. We do not need any more parsing
+                    // for
+                    // this token.
+                    isSingleValue = true;
+                } else if (tokenName.equalsIgnoreCase("collective")) {
+                    // This indicates that attributes of this type are
+                    // collective
+                    // (i.e., have their values generated dynamically in some
+                    // way). We do not need any more parsing for this token.
+                    isCollective = true;
+                } else if (tokenName.equalsIgnoreCase("no-user-modification")) {
+                    // This indicates that the values of attributes of this type
+                    // are not to be modified by end users. We do not need any
+                    // more parsing for this token.
+                    isNoUserModification = true;
+                } else if (tokenName.equalsIgnoreCase("usage")) {
+                    // This specifies the usage string for this attribute type.
+                    // It
+                    // should be followed by one of the strings
+                    // "userApplications", "directoryOperation",
+                    // "distributedOperation", or "dSAOperation".
+                    int length = 0;
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+                    reader.skipWhitespaces();
+                    reader.mark();
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the definition was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+                    while (reader.read() != ' ') {
+                        length++;
+                    }
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
+                    reader.reset();
+                    final String usageStr = reader.read(length);
+                    if (usageStr.equalsIgnoreCase("userapplications")) {
+                        attributeUsage = AttributeUsage.USER_APPLICATIONS;
+                    } else if (usageStr.equalsIgnoreCase("directoryoperation")) {
+                        attributeUsage = AttributeUsage.DIRECTORY_OPERATION;
+                    } else if (usageStr.equalsIgnoreCase("distributedoperation")) {
+                        attributeUsage = AttributeUsage.DISTRIBUTED_OPERATION;
+                    } else if (usageStr.equalsIgnoreCase("dsaoperation")) {
+                        attributeUsage = AttributeUsage.DSA_OPERATION;
+                    } else {
+                        final LocalizableMessage message =
+                                WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1.get(definition,
+                                        usageStr);
+                        throw new LocalizedIllegalArgumentException(message);
+                    }
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+            final List<String> approxRules = extraProperties.get(SCHEMA_PROPERTY_APPROX_RULE);
+            if (approxRules != null && !approxRules.isEmpty()) {
+                approximateMatchingRule = approxRules.get(0);
+            }
 
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      String superiorType = null;
-      String equalityMatchingRule = null;
-      String orderingMatchingRule = null;
-      String substringMatchingRule = null;
-      String approximateMatchingRule = null;
-      String syntax = null;
-      boolean isSingleValue = false;
-      boolean isCollective = false;
-      boolean isNoUserModification = false;
-      AttributeUsage attributeUsage = AttributeUsage.USER_APPLICATIONS;
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+            if (superiorType == null && syntax == null) {
+                final LocalizableMessage msg =
+                        WARN_ATTR_SYNTAX_ATTRTYPE_MISSING_SYNTAX_AND_SUPERIOR.get(definition);
+                throw new LocalizedIllegalArgumentException(msg);
+            }
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the definition. But before we start, set default
-      // values for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+            final AttributeType attrType =
+                    new AttributeType(oid, names, description, isObsolete, superiorType,
+                            equalityMatchingRule, orderingMatchingRule, substringMatchingRule,
+                            approximateMatchingRule, syntax, isSingleValue, isCollective,
+                            isNoUserModification, attributeUsage, extraProperties, definition);
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
+            addAttributeType(attrType, overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_ATTRTYPE_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          // This specifies the name or OID of the superior attribute
-          // type from which this attribute type should inherit its
-          // properties.
-          superiorType = SchemaUtils.readOID(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("equality"))
-        {
-          // This specifies the name or OID of the equality matching
-          // rule to use for this attribute type.
-          equalityMatchingRule = SchemaUtils.readOID(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("ordering"))
-        {
-          // This specifies the name or OID of the ordering matching
-          // rule to use for this attribute type.
-          orderingMatchingRule = SchemaUtils.readOID(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("substr"))
-        {
-          // This specifies the name or OID of the substring matching
-          // rule to use for this attribute type.
-          substringMatchingRule = SchemaUtils.readOID(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("syntax"))
-        {
-          // This specifies the numeric OID of the syntax for this
-          // matching rule. It may optionally be immediately followed by
-          // an open curly brace, an integer definition, and a close
-          // curly brace to suggest the minimum number of characters
-          // that should be allowed in values of that type. This
-          // implementation will ignore any such length because it does
-          // not impose any practical limit on the length of attribute
-          // values.
-          syntax = SchemaUtils
-              .readOIDLen(reader, allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("single-definition"))
-        {
-          // This indicates that attributes of this type are allowed to
-          // have at most one definition. We do not need any more
-          // parsing for this token.
-          isSingleValue = true;
-        }
-        else if (tokenName.equalsIgnoreCase("single-value"))
-        {
-          // This indicates that attributes of this type are allowed to
-          // have at most one value. We do not need any more parsing for
-          // this token.
-          isSingleValue = true;
-        }
-        else if (tokenName.equalsIgnoreCase("collective"))
-        {
-          // This indicates that attributes of this type are collective
-          // (i.e., have their values generated dynamically in some
-          // way). We do not need any more parsing for this token.
-          isCollective = true;
-        }
-        else if (tokenName.equalsIgnoreCase("no-user-modification"))
-        {
-          // This indicates that the values of attributes of this type
-          // are not to be modified by end users. We do not need any
-          // more parsing for this token.
-          isNoUserModification = true;
-        }
-        else if (tokenName.equalsIgnoreCase("usage"))
-        {
-          // This specifies the usage string for this attribute type. It
-          // should be followed by one of the strings
-          // "userApplications", "directoryOperation",
-          // "distributedOperation", or "dSAOperation".
-          int length = 0;
+        return this;
+    }
 
-          reader.skipWhitespaces();
-          reader.mark();
+    /**
+     * Adds the provided attribute type definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the attribute type definition.
+     * @param names
+     *            The user-friendly names of the attribute type definition.
+     * @param description
+     *            The description of the attribute type definition.
+     * @param obsolete
+     *            {@code true} if the attribute type definition is obsolete,
+     *            otherwise {@code false}.
+     * @param superiorType
+     *            The OID of the superior attribute type definition.
+     * @param equalityMatchingRule
+     *            The OID of the equality matching rule, which may be
+     *            {@code null} indicating that the superior attribute type's
+     *            matching rule should be used or, if none is defined, the
+     *            default matching rule associated with the syntax.
+     * @param orderingMatchingRule
+     *            The OID of the ordering matching rule, which may be
+     *            {@code null} indicating that the superior attribute type's
+     *            matching rule should be used or, if none is defined, the
+     *            default matching rule associated with the syntax.
+     * @param substringMatchingRule
+     *            The OID of the substring matching rule, which may be
+     *            {@code null} indicating that the superior attribute type's
+     *            matching rule should be used or, if none is defined, the
+     *            default matching rule associated with the syntax.
+     * @param approximateMatchingRule
+     *            The OID of the approximate matching rule, which may be
+     *            {@code null} indicating that the superior attribute type's
+     *            matching rule should be used or, if none is defined, the
+     *            default matching rule associated with the syntax.
+     * @param syntax
+     *            The OID of the syntax definition.
+     * @param singleValue
+     *            {@code true} if the attribute type definition is
+     *            single-valued, otherwise {@code false}.
+     * @param collective
+     *            {@code true} if the attribute type definition is a collective
+     *            attribute, otherwise {@code false}.
+     * @param noUserModification
+     *            {@code true} if the attribute type definition is read-only,
+     *            otherwise {@code false}.
+     * @param attributeUsage
+     *            The intended use of the attribute type definition.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            attribute type definition.
+     * @param overwrite
+     *            {@code true} if any existing attribute type with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addAttributeType(final String oid, final List<String> names,
+            final String description, final boolean obsolete, final String superiorType,
+            final String equalityMatchingRule, final String orderingMatchingRule,
+            final String substringMatchingRule, final String approximateMatchingRule,
+            final String syntax, final boolean singleValue, final boolean collective,
+            final boolean noUserModification, final AttributeUsage attributeUsage,
+            final Map<String, List<String>> extraProperties, final boolean overwrite) {
+        lazyInitBuilder();
 
-          while (reader.read() != ' ')
-          {
-            length++;
-          }
-
-          reader.reset();
-          final String usageStr = reader.read(length);
-          if (usageStr.equalsIgnoreCase("userapplications"))
-          {
-            attributeUsage = AttributeUsage.USER_APPLICATIONS;
-          }
-          else if (usageStr.equalsIgnoreCase("directoryoperation"))
-          {
-            attributeUsage = AttributeUsage.DIRECTORY_OPERATION;
-          }
-          else if (usageStr.equalsIgnoreCase("distributedoperation"))
-          {
-            attributeUsage = AttributeUsage.DISTRIBUTED_OPERATION;
-          }
-          else if (usageStr.equalsIgnoreCase("dsaoperation"))
-          {
-            attributeUsage = AttributeUsage.DSA_OPERATION;
-          }
-          else
-          {
-            final LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1
-                .get(definition, usageStr);
-            throw new LocalizedIllegalArgumentException(message);
-          }
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
-
-      final List<String> approxRules = extraProperties
-          .get(SCHEMA_PROPERTY_APPROX_RULE);
-      if (approxRules != null && !approxRules.isEmpty())
-      {
-        approximateMatchingRule = approxRules.get(0);
-      }
-
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
-
-      if (superiorType == null && syntax == null)
-      {
-        final LocalizableMessage msg = WARN_ATTR_SYNTAX_ATTRTYPE_MISSING_SYNTAX_AND_SUPERIOR
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(msg);
-      }
-
-      final AttributeType attrType = new AttributeType(oid, names, description,
-          isObsolete, superiorType, equalityMatchingRule, orderingMatchingRule,
-          substringMatchingRule, approximateMatchingRule, syntax,
-          isSingleValue, isCollective, isNoUserModification, attributeUsage,
-          extraProperties, definition);
-
-      addAttributeType(attrType, overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_ATTRTYPE_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        final AttributeType attrType =
+                new AttributeType(oid, unmodifiableCopyOfList(names), description, obsolete,
+                        superiorType, equalityMatchingRule, orderingMatchingRule,
+                        substringMatchingRule, approximateMatchingRule, syntax, singleValue,
+                        collective, noUserModification, attributeUsage,
+                        unmodifiableCopyOfExtraProperties(extraProperties), null);
+        addAttributeType(attrType, overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided DIT content rule definition to this schema builder.
+     *
+     * @param definition
+     *            The DIT content rule definition.
+     * @param overwrite
+     *            {@code true} if any existing DIT content rule with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided DIT content rule definition could not be
+     *             parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addDITContentRule(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided attribute type definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the attribute type definition.
-   * @param names
-   *          The user-friendly names of the attribute type definition.
-   * @param description
-   *          The description of the attribute type definition.
-   * @param obsolete
-   *          {@code true} if the attribute type definition is obsolete,
-   *          otherwise {@code false}.
-   * @param superiorType
-   *          The OID of the superior attribute type definition.
-   * @param equalityMatchingRule
-   *          The OID of the equality matching rule, which may be {@code null}
-   *          indicating that the superior attribute type's matching rule should
-   *          be used or, if none is defined, the default matching rule
-   *          associated with the syntax.
-   * @param orderingMatchingRule
-   *          The OID of the ordering matching rule, which may be {@code null}
-   *          indicating that the superior attribute type's matching rule should
-   *          be used or, if none is defined, the default matching rule
-   *          associated with the syntax.
-   * @param substringMatchingRule
-   *          The OID of the substring matching rule, which may be {@code null}
-   *          indicating that the superior attribute type's matching rule should
-   *          be used or, if none is defined, the default matching rule
-   *          associated with the syntax.
-   * @param approximateMatchingRule
-   *          The OID of the approximate matching rule, which may be
-   *          {@code null} indicating that the superior attribute type's
-   *          matching rule should be used or, if none is defined, the default
-   *          matching rule associated with the syntax.
-   * @param syntax
-   *          The OID of the syntax definition.
-   * @param singleValue
-   *          {@code true} if the attribute type definition is single-valued,
-   *          otherwise {@code false}.
-   * @param collective
-   *          {@code true} if the attribute type definition is a collective
-   *          attribute, otherwise {@code false}.
-   * @param noUserModification
-   *          {@code true} if the attribute type definition is read-only,
-   *          otherwise {@code false}.
-   * @param attributeUsage
-   *          The intended use of the attribute type definition.
-   * @param extraProperties
-   *          A map containing additional properties associated with the
-   *          attribute type definition.
-   * @param overwrite
-   *          {@code true} if any existing attribute type with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addAttributeType(final String oid,
-      final List<String> names, final String description,
-      final boolean obsolete, final String superiorType,
-      final String equalityMatchingRule, final String orderingMatchingRule,
-      final String substringMatchingRule, final String approximateMatchingRule,
-      final String syntax, final boolean singleValue, final boolean collective,
-      final boolean noUserModification, final AttributeUsage attributeUsage,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    final AttributeType attrType = new AttributeType(oid,
-        unmodifiableCopyOfList(names), description, obsolete, superiorType,
-        equalityMatchingRule, orderingMatchingRule, substringMatchingRule,
-        approximateMatchingRule, syntax, singleValue, collective,
-        noUserModification, attributeUsage,
-        unmodifiableCopyOfExtraProperties(extraProperties), null);
-    addAttributeType(attrType, overwrite);
-    return this;
-  }
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-  /**
-   * Adds the provided DIT content rule definition to this schema builder.
-   *
-   * @param definition
-   *          The DIT content rule definition.
-   * @param overwrite
-   *          {@code true} if any existing DIT content rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided DIT content rule definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addDITContentRule(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
-    lazyInitBuilder();
+            // The next set of characters must be the OID.
+            final String structuralClass =
+                    SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            Set<String> auxiliaryClasses = Collections.emptySet();
+            Set<String> optionalAttributes = Collections.emptySet();
+            Set<String> prohibitedAttributes = Collections.emptySet();
+            Set<String> requiredAttributes = Collections.emptySet();
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      final String structuralClass = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      Set<String> auxiliaryClasses = Collections.emptySet();
-      Set<String> optionalAttributes = Collections.emptySet();
-      Set<String> prohibitedAttributes = Collections.emptySet();
-      Set<String> requiredAttributes = Collections.emptySet();
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("aux")) {
+                    auxiliaryClasses = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    requiredAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    optionalAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("not")) {
+                    prohibitedAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("aux"))
-        {
-          auxiliaryClasses = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          requiredAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          optionalAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("not"))
-        {
-          prohibitedAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
+            final DITContentRule rule =
+                    new DITContentRule(structuralClass, names, description, isObsolete,
+                            auxiliaryClasses, optionalAttributes, prohibitedAttributes,
+                            requiredAttributes, extraProperties, definition);
+            addDITContentRule(rule, overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_DCR_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-      }
+        return this;
+    }
 
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
+    /**
+     * Adds the provided DIT content rule definition to this schema builder.
+     *
+     * @param structuralClass
+     *            The name of the structural object class to which the DIT
+     *            content rule applies.
+     * @param names
+     *            The user-friendly names of the DIT content rule definition.
+     * @param description
+     *            The description of the DIT content rule definition.
+     * @param obsolete
+     *            {@code true} if the DIT content rule definition is obsolete,
+     *            otherwise {@code false}.
+     * @param auxiliaryClasses
+     *            A list of auxiliary object classes that entries subject to the
+     *            DIT content rule may belong to.
+     * @param optionalAttributes
+     *            A list of attribute types that entries subject to the DIT
+     *            content rule may contain.
+     * @param prohibitedAttributes
+     *            A list of attribute types that entries subject to the DIT
+     *            content rule must not contain.
+     * @param requiredAttributes
+     *            A list of attribute types that entries subject to the DIT
+     *            content rule must contain.
+     * @param extraProperties
+     *            A map containing additional properties associated with the DIT
+     *            content rule definition.
+     * @param overwrite
+     *            {@code true} if any existing DIT content rule with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addDITContentRule(final String structuralClass, final List<String> names,
+            final String description, final boolean obsolete, final Set<String> auxiliaryClasses,
+            final Set<String> optionalAttributes, final Set<String> prohibitedAttributes,
+            final Set<String> requiredAttributes, final Map<String, List<String>> extraProperties,
+            final boolean overwrite) {
+        lazyInitBuilder();
 
-      final DITContentRule rule = new DITContentRule(structuralClass, names,
-          description, isObsolete, auxiliaryClasses, optionalAttributes,
-          prohibitedAttributes, requiredAttributes, extraProperties, definition);
-      addDITContentRule(rule, overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_DCR_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        final DITContentRule rule =
+                new DITContentRule(structuralClass, unmodifiableCopyOfList(names), description,
+                        obsolete, unmodifiableCopyOfSet(auxiliaryClasses),
+                        unmodifiableCopyOfSet(optionalAttributes),
+                        unmodifiableCopyOfSet(prohibitedAttributes),
+                        unmodifiableCopyOfSet(requiredAttributes),
+                        unmodifiableCopyOfExtraProperties(extraProperties), null);
+        addDITContentRule(rule, overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided DIT structure rule definition to this schema builder.
+     *
+     * @param ruleID
+     *            The rule identifier of the DIT structure rule.
+     * @param names
+     *            The user-friendly names of the DIT structure rule definition.
+     * @param description
+     *            The description of the DIT structure rule definition.
+     * @param obsolete
+     *            {@code true} if the DIT structure rule definition is obsolete,
+     *            otherwise {@code false}.
+     * @param nameForm
+     *            The name form associated with the DIT structure rule.
+     * @param superiorRules
+     *            A list of superior rules (by rule id).
+     * @param extraProperties
+     *            A map containing additional properties associated with the DIT
+     *            structure rule definition.
+     * @param overwrite
+     *            {@code true} if any existing DIT structure rule with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addDITStructureRule(final Integer ruleID, final List<String> names,
+            final String description, final boolean obsolete, final String nameForm,
+            final Set<Integer> superiorRules, final Map<String, List<String>> extraProperties,
+            final boolean overwrite) {
+        lazyInitBuilder();
 
+        final DITStructureRule rule =
+                new DITStructureRule(ruleID, unmodifiableCopyOfList(names), description, obsolete,
+                        nameForm, unmodifiableCopyOfSet(superiorRules),
+                        unmodifiableCopyOfExtraProperties(extraProperties), null);
+        addDITStructureRule(rule, overwrite);
+        return this;
+    }
 
-  /**
-   * Adds the provided DIT content rule definition to this schema builder.
-   *
-   * @param structuralClass
-   *          The name of the structural object class to which the DIT content
-   *          rule applies.
-   * @param names
-   *          The user-friendly names of the DIT content rule definition.
-   * @param description
-   *          The description of the DIT content rule definition.
-   * @param obsolete
-   *          {@code true} if the DIT content rule definition is obsolete,
-   *          otherwise {@code false}.
-   * @param auxiliaryClasses
-   *          A list of auxiliary object classes that entries subject to the DIT
-   *          content rule may belong to.
-   * @param optionalAttributes
-   *          A list of attribute types that entries subject to the DIT content
-   *          rule may contain.
-   * @param prohibitedAttributes
-   *          A list of attribute types that entries subject to the DIT content
-   *          rule must not contain.
-   * @param requiredAttributes
-   *          A list of attribute types that entries subject to the DIT content
-   *          rule must contain.
-   * @param extraProperties
-   *          A map containing additional properties associated with the DIT
-   *          content rule definition.
-   * @param overwrite
-   *          {@code true} if any existing DIT content rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addDITContentRule(final String structuralClass,
-      final List<String> names, final String description,
-      final boolean obsolete, final Set<String> auxiliaryClasses,
-      final Set<String> optionalAttributes,
-      final Set<String> prohibitedAttributes,
-      final Set<String> requiredAttributes,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+    /**
+     * Adds the provided DIT structure rule definition to this schema builder.
+     *
+     * @param definition
+     *            The DIT structure rule definition.
+     * @param overwrite
+     *            {@code true} if any existing DIT structure rule with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided DIT structure rule definition could not be
+     *             parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addDITStructureRule(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
-    final DITContentRule rule = new DITContentRule(structuralClass,
-        unmodifiableCopyOfList(names), description, obsolete,
-        unmodifiableCopyOfSet(auxiliaryClasses),
-        unmodifiableCopyOfSet(optionalAttributes),
-        unmodifiableCopyOfSet(prohibitedAttributes),
-        unmodifiableCopyOfSet(requiredAttributes),
-        unmodifiableCopyOfExtraProperties(extraProperties), null);
-    addDITContentRule(rule, overwrite);
-    return this;
-  }
+        lazyInitBuilder();
 
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
-  /**
-   * Adds the provided DIT structure rule definition to this schema builder.
-   *
-   * @param ruleID
-   *          The rule identifier of the DIT structure rule.
-   * @param names
-   *          The user-friendly names of the DIT structure rule definition.
-   * @param description
-   *          The description of the DIT structure rule definition.
-   * @param obsolete
-   *          {@code true} if the DIT structure rule definition is obsolete,
-   *          otherwise {@code false}.
-   * @param nameForm
-   *          The name form associated with the DIT structure rule.
-   * @param superiorRules
-   *          A list of superior rules (by rule id).
-   * @param extraProperties
-   *          A map containing additional properties associated with the DIT
-   *          structure rule definition.
-   * @param overwrite
-   *          {@code true} if any existing DIT structure rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addDITStructureRule(final Integer ruleID,
-      final List<String> names, final String description,
-      final boolean obsolete, final String nameForm,
-      final Set<Integer> superiorRules,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-    final DITStructureRule rule = new DITStructureRule(ruleID,
-        unmodifiableCopyOfList(names), description, obsolete, nameForm,
-        unmodifiableCopyOfSet(superiorRules),
-        unmodifiableCopyOfExtraProperties(extraProperties), null);
-    addDITStructureRule(rule, overwrite);
-    return this;
-  }
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
+            // The next set of characters must be the OID.
+            final Integer ruleID = SchemaUtils.readRuleID(reader);
 
-  /**
-   * Adds the provided DIT structure rule definition to this schema builder.
-   *
-   * @param definition
-   *          The DIT structure rule definition.
-   * @param overwrite
-   *          {@code true} if any existing DIT structure rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided DIT structure rule definition could not be
-   *           parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addDITStructureRule(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            String nameForm = null;
+            Set<Integer> superiorRules = Collections.emptySet();
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-    lazyInitBuilder();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("form")) {
+                    nameForm = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    superiorRules = SchemaUtils.readRuleIDs(reader);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+            if (nameForm == null) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+            final DITStructureRule rule =
+                    new DITStructureRule(ruleID, names, description, isObsolete, nameForm,
+                            superiorRules, extraProperties, definition);
+            addDITStructureRule(rule, overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_DSR_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        }
+        return this;
+    }
 
-      // The next set of characters must be the OID.
-      final Integer ruleID = SchemaUtils.readRuleID(reader);
+    /**
+     * Adds the provided enumeration syntax definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the enumeration syntax definition.
+     * @param description
+     *            The description of the enumeration syntax definition.
+     * @param overwrite
+     *            {@code true} if any existing syntax with the same OID should
+     *            be overwritten.
+     * @param enumerations
+     *            The range of values which attribute values must match in order
+     *            to be valid.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addEnumerationSyntax(final String oid, final String description,
+            final boolean overwrite, final String... enumerations) {
+        Validator.ensureNotNull((Object) enumerations);
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      String nameForm = null;
-      Set<Integer> superiorRules = Collections.emptySet();
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+        lazyInitBuilder();
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+        final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid, Arrays.asList(enumerations));
+        final Syntax enumSyntax =
+                new Syntax(oid, description, Collections.singletonMap("X-ENUM", Arrays
+                        .asList(enumerations)), null, enumImpl);
+        final MatchingRule enumOMR =
+                new MatchingRule(enumImpl.getOrderingMatchingRule(), Collections
+                        .singletonList(OMR_GENERIC_ENUM_NAME + oid), "", false, oid,
+                        CoreSchemaImpl.OPENDS_ORIGIN, null, new EnumOrderingMatchingRule(enumImpl));
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
+        addSyntax(enumSyntax, overwrite);
+        try {
+            addMatchingRule(enumOMR, overwrite);
+        } catch (final ConflictingSchemaElementException e) {
+            removeSyntax(oid);
         }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("form"))
-        {
-          nameForm = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          superiorRules = SchemaUtils.readRuleIDs(reader);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
-
-      if (nameForm == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
-
-      final DITStructureRule rule = new DITStructureRule(ruleID, names,
-          description, isObsolete, nameForm, superiorRules, extraProperties,
-          definition);
-      addDITStructureRule(rule, overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_DSR_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided matching rule definition to this schema builder.
+     *
+     * @param definition
+     *            The matching rule definition.
+     * @param overwrite
+     *            {@code true} if any existing matching rule with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided matching rule definition could not be parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addMatchingRule(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided enumeration syntax definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the enumeration syntax definition.
-   * @param description
-   *          The description of the enumeration syntax definition.
-   * @param overwrite
-   *          {@code true} if any existing syntax with the same OID should be
-   *          overwritten.
-   * @param enumerations
-   *          The range of values which attribute values must match in order to
-   *          be valid.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addEnumerationSyntax(final String oid,
-      final String description, final boolean overwrite,
-      final String... enumerations)
-  {
-    Validator.ensureNotNull((Object) enumerations);
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    lazyInitBuilder();
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
-    final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid,
-        Arrays.asList(enumerations));
-    final Syntax enumSyntax = new Syntax(oid, description,
-        Collections.singletonMap("X-ENUM", Arrays.asList(enumerations)), null,
-        enumImpl);
-    final MatchingRule enumOMR = new MatchingRule(
-        enumImpl.getOrderingMatchingRule(),
-        Collections.singletonList(OMR_GENERIC_ENUM_NAME + oid), "", false, oid,
-        CoreSchemaImpl.OPENDS_ORIGIN, null, new EnumOrderingMatchingRule(
-            enumImpl));
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-    addSyntax(enumSyntax, overwrite);
-    try
-    {
-      addMatchingRule(enumOMR, overwrite);
-    }
-    catch (final ConflictingSchemaElementException e)
-    {
-      removeSyntax(oid);
-    }
-    return this;
-  }
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-  /**
-   * Adds the provided matching rule definition to this schema builder.
-   *
-   * @param definition
-   *          The matching rule definition.
-   * @param overwrite
-   *          {@code true} if any existing matching rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided matching rule definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addMatchingRule(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            String syntax = null;
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-    lazyInitBuilder();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the matching rule. It
+                    // is
+                    // an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the matching rule should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("syntax")) {
+                    syntax = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+            // Make sure that a syntax was specified.
+            if (syntax == null) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
-
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
-
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      String syntax = null;
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
-
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
-
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the matching rule. It is
-          // an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the matching rule should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("syntax"))
-        {
-          syntax = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
+            addMatchingRule(new MatchingRule(oid, names, description, isObsolete, syntax,
+                    extraProperties, definition, null), overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_MR_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-      }
+        return this;
+    }
 
-      // Make sure that a syntax was specified.
-      if (syntax == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+    /**
+     * Adds the provided matching rule definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the matching rule definition.
+     * @param names
+     *            The user-friendly names of the matching rule definition.
+     * @param description
+     *            The description of the matching rule definition.
+     * @param obsolete
+     *            {@code true} if the matching rule definition is obsolete,
+     *            otherwise {@code false}.
+     * @param assertionSyntax
+     *            The OID of the assertion syntax definition.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            matching rule definition.
+     * @param implementation
+     *            The implementation of the matching rule.
+     * @param overwrite
+     *            {@code true} if any existing matching rule with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addMatchingRule(final String oid, final List<String> names,
+            final String description, final boolean obsolete, final String assertionSyntax,
+            final Map<String, List<String>> extraProperties, final MatchingRuleImpl implementation,
+            final boolean overwrite) {
+        Validator.ensureNotNull(implementation);
 
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
+        lazyInitBuilder();
 
-      addMatchingRule(new MatchingRule(oid, names, description, isObsolete,
-          syntax, extraProperties, definition, null), overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_MR_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        final MatchingRule matchingRule =
+                new MatchingRule(oid, unmodifiableCopyOfList(names), description, obsolete,
+                        assertionSyntax, unmodifiableCopyOfExtraProperties(extraProperties), null,
+                        implementation);
+        addMatchingRule(matchingRule, overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided matching rule use definition to this schema builder.
+     *
+     * @param definition
+     *            The matching rule use definition.
+     * @param overwrite
+     *            {@code true} if any existing matching rule use with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided matching rule use definition could not be
+     *             parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addMatchingRuleUse(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided matching rule definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the matching rule definition.
-   * @param names
-   *          The user-friendly names of the matching rule definition.
-   * @param description
-   *          The description of the matching rule definition.
-   * @param obsolete
-   *          {@code true} if the matching rule definition is obsolete,
-   *          otherwise {@code false}.
-   * @param assertionSyntax
-   *          The OID of the assertion syntax definition.
-   * @param extraProperties
-   *          A map containing additional properties associated with the
-   *          matching rule definition.
-   * @param implementation
-   *          The implementation of the matching rule.
-   * @param overwrite
-   *          {@code true} if any existing matching rule with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addMatchingRule(final String oid,
-      final List<String> names, final String description,
-      final boolean obsolete, final String assertionSyntax,
-      final Map<String, List<String>> extraProperties,
-      final MatchingRuleImpl implementation, final boolean overwrite)
-  {
-    Validator.ensureNotNull(implementation);
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    lazyInitBuilder();
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
-    final MatchingRule matchingRule = new MatchingRule(oid,
-        unmodifiableCopyOfList(names), description, obsolete, assertionSyntax,
-        unmodifiableCopyOfExtraProperties(extraProperties), null,
-        implementation);
-    addMatchingRule(matchingRule, overwrite);
-    return this;
-  }
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-
-
-  /**
-   * Adds the provided matching rule use definition to this schema builder.
-   *
-   * @param definition
-   *          The matching rule use definition.
-   * @param overwrite
-   *          {@code true} if any existing matching rule use with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided matching rule use definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addMatchingRuleUse(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
-
-    lazyInitBuilder();
-
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            Set<String> attributes = null;
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("applies")) {
+                    attributes = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      Set<String> attributes = null;
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+            // Make sure that the set of attributes was defined.
+            if (attributes == null || attributes.size() == 0) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
+            final MatchingRuleUse use =
+                    new MatchingRuleUse(oid, names, description, isObsolete, attributes,
+                            extraProperties, definition);
+            addMatchingRuleUse(use, overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_MRUSE_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("applies"))
-        {
-          attributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
-
-      // Make sure that the set of attributes was defined.
-      if (attributes == null || attributes.size() == 0)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+        return this;
+    }
 
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
+    /**
+     * Adds the provided matching rule use definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the matching rule use definition.
+     * @param names
+     *            The user-friendly names of the matching rule use definition.
+     * @param description
+     *            The description of the matching rule use definition.
+     * @param obsolete
+     *            {@code true} if the matching rule use definition is obsolete,
+     *            otherwise {@code false}.
+     * @param attributeOIDs
+     *            The list of attribute types the matching rule applies to.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            matching rule use definition.
+     * @param overwrite
+     *            {@code true} if any existing matching rule use with the same
+     *            OID should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addMatchingRuleUse(final String oid, final List<String> names,
+            final String description, final boolean obsolete, final Set<String> attributeOIDs,
+            final Map<String, List<String>> extraProperties, final boolean overwrite) {
+        lazyInitBuilder();
 
-      final MatchingRuleUse use = new MatchingRuleUse(oid, names, description,
-          isObsolete, attributes, extraProperties, definition);
-      addMatchingRuleUse(use, overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_MRUSE_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        final MatchingRuleUse use =
+                new MatchingRuleUse(oid, unmodifiableCopyOfList(names), description, obsolete,
+                        unmodifiableCopyOfSet(attributeOIDs),
+                        unmodifiableCopyOfExtraProperties(extraProperties), null);
+        addMatchingRuleUse(use, overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided name form definition to this schema builder.
+     *
+     * @param definition
+     *            The name form definition.
+     * @param overwrite
+     *            {@code true} if any existing name form with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided name form definition could not be parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addNameForm(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided matching rule use definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the matching rule use definition.
-   * @param names
-   *          The user-friendly names of the matching rule use definition.
-   * @param description
-   *          The description of the matching rule use definition.
-   * @param obsolete
-   *          {@code true} if the matching rule use definition is obsolete,
-   *          otherwise {@code false}.
-   * @param attributeOIDs
-   *          The list of attribute types the matching rule applies to.
-   * @param extraProperties
-   *          A map containing additional properties associated with the
-   *          matching rule use definition.
-   * @param overwrite
-   *          {@code true} if any existing matching rule use with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addMatchingRuleUse(final String oid,
-      final List<String> names, final String description,
-      final boolean obsolete, final Set<String> attributeOIDs,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    final MatchingRuleUse use = new MatchingRuleUse(oid,
-        unmodifiableCopyOfList(names), description, obsolete,
-        unmodifiableCopyOfSet(attributeOIDs),
-        unmodifiableCopyOfExtraProperties(extraProperties), null);
-    addMatchingRuleUse(use, overwrite);
-    return this;
-  }
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader
+                                .pos() - 1), c);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-  /**
-   * Adds the provided name form definition to this schema builder.
-   *
-   * @param definition
-   *          The name form definition.
-   * @param overwrite
-   *          {@code true} if any existing name form with the same OID should be
-   *          overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided name form definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addNameForm(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
-    lazyInitBuilder();
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            String structuralClass = null;
+            Set<String> optionalAttributes = Collections.emptySet();
+            Set<String> requiredAttributes = null;
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
-
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), c);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("oc")) {
+                    structuralClass = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    requiredAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    optionalAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+            // Make sure that a structural class was specified. If not, then
+            // it cannot be valid.
+            if (structuralClass == null) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      String structuralClass = null;
-      Set<String> optionalAttributes = Collections.emptySet();
-      Set<String> requiredAttributes = null;
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+            if (requiredAttributes == null || requiredAttributes.size() == 0) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
+            final NameForm nameForm =
+                    new NameForm(oid, names, description, isObsolete, structuralClass,
+                            requiredAttributes, optionalAttributes, extraProperties, definition);
+            addNameForm(nameForm, overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_NAME_FORM_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("oc"))
-        {
-          structuralClass = SchemaUtils.readOID(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          requiredAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          optionalAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
+        return this;
+    }
 
-      // Make sure that a structural class was specified. If not, then
-      // it cannot be valid.
-      if (structuralClass == null)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      if (requiredAttributes == null || requiredAttributes.size() == 0)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
+    /**
+     * Adds the provided name form definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the name form definition.
+     * @param names
+     *            The user-friendly names of the name form definition.
+     * @param description
+     *            The description of the name form definition.
+     * @param obsolete
+     *            {@code true} if the name form definition is obsolete,
+     *            otherwise {@code false}.
+     * @param structuralClass
+     *            The structural object class this rule applies to.
+     * @param requiredAttributes
+     *            A list of naming attribute types that entries subject to the
+     *            name form must contain.
+     * @param optionalAttributes
+     *            A list of naming attribute types that entries subject to the
+     *            name form may contain.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            name form definition.
+     * @param overwrite
+     *            {@code true} if any existing name form use with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addNameForm(final String oid, final List<String> names,
+            final String description, final boolean obsolete, final String structuralClass,
+            final Set<String> requiredAttributes, final Set<String> optionalAttributes,
+            final Map<String, List<String>> extraProperties, final boolean overwrite) {
+        lazyInitBuilder();
 
-      final NameForm nameForm = new NameForm(oid, names, description,
-          isObsolete, structuralClass, requiredAttributes, optionalAttributes,
-          extraProperties, definition);
-      addNameForm(nameForm, overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_NAME_FORM_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        final NameForm nameForm =
+                new NameForm(oid, unmodifiableCopyOfList(names), description, obsolete,
+                        structuralClass, unmodifiableCopyOfSet(requiredAttributes),
+                        unmodifiableCopyOfSet(optionalAttributes),
+                        unmodifiableCopyOfExtraProperties(extraProperties), null);
+        addNameForm(nameForm, overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided object class definition to this schema builder.
+     *
+     * @param definition
+     *            The object class definition.
+     * @param overwrite
+     *            {@code true} if any existing object class with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided object class definition could not be parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addObjectClass(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided name form definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the name form definition.
-   * @param names
-   *          The user-friendly names of the name form definition.
-   * @param description
-   *          The description of the name form definition.
-   * @param obsolete
-   *          {@code true} if the name form definition is obsolete, otherwise
-   *          {@code false}.
-   * @param structuralClass
-   *          The structural object class this rule applies to.
-   * @param requiredAttributes
-   *          A list of naming attribute types that entries subject to the name
-   *          form must contain.
-   * @param optionalAttributes
-   *          A list of naming attribute types that entries subject to the name
-   *          form may contain.
-   * @param extraProperties
-   *          A map containing additional properties associated with the name
-   *          form definition.
-   * @param overwrite
-   *          {@code true} if any existing name form use with the same OID
-   *          should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addNameForm(final String oid, final List<String> names,
-      final String description, final boolean obsolete,
-      final String structuralClass, final Set<String> requiredAttributes,
-      final Set<String> optionalAttributes,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    final NameForm nameForm = new NameForm(oid, unmodifiableCopyOfList(names),
-        description, obsolete, structuralClass,
-        unmodifiableCopyOfSet(requiredAttributes),
-        unmodifiableCopyOfSet(optionalAttributes),
-        unmodifiableCopyOfExtraProperties(extraProperties), null);
-    addNameForm(nameForm, overwrite);
-    return this;
-  }
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-  /**
-   * Adds the provided object class definition to this schema builder.
-   *
-   * @param definition
-   *          The object class definition.
-   * @param overwrite
-   *          {@code true} if any existing object class with the same OID should
-   *          be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided object class definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addObjectClass(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
-    lazyInitBuilder();
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+            List<String> names = Collections.emptyList();
+            String description = "".intern();
+            boolean isObsolete = false;
+            Set<String> superiorClasses = Collections.emptySet();
+            Set<String> requiredAttributes = Collections.emptySet();
+            Set<String> optionalAttributes = Collections.emptySet();
+            ObjectClassType objectClassType = ObjectClassType.STRUCTURAL;
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("name")) {
+                    names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the attribute type. It
+                    // is an arbitrary string of characters enclosed in single
+                    // quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.equalsIgnoreCase("obsolete")) {
+                    // This indicates whether the attribute type should be
+                    // considered obsolete. We do not need to do any more
+                    // parsing
+                    // for this token.
+                    isObsolete = true;
+                } else if (tokenName.equalsIgnoreCase("sup")) {
+                    superiorClasses = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("abstract")) {
+                    // This indicates that entries must not include this
+                    // objectclass unless they also include a non-abstract
+                    // objectclass that inherits from this class. We do not need
+                    // any more parsing for this token.
+                    objectClassType = ObjectClassType.ABSTRACT;
+                } else if (tokenName.equalsIgnoreCase("structural")) {
+                    // This indicates that this is a structural objectclass. We
+                    // do
+                    // not need any more parsing for this token.
+                    objectClassType = ObjectClassType.STRUCTURAL;
+                } else if (tokenName.equalsIgnoreCase("auxiliary")) {
+                    // This indicates that this is an auxiliary objectclass. We
+                    // do
+                    // not need any more parsing for this token.
+                    objectClassType = ObjectClassType.AUXILIARY;
+                } else if (tokenName.equalsIgnoreCase("must")) {
+                    requiredAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.equalsIgnoreCase("may")) {
+                    optionalAttributes =
+                            SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID)) {
+                addObjectClass(new ObjectClass(description, extraProperties), overwrite);
+            } else {
+                if (objectClassType == ObjectClassType.STRUCTURAL && superiorClasses.isEmpty()) {
+                    superiorClasses = Collections.singleton(TOP_OBJECTCLASS_NAME);
+                }
 
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+                if (!extraProperties.isEmpty()) {
+                    extraProperties = Collections.unmodifiableMap(extraProperties);
+                }
 
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+                addObjectClass(new ObjectClass(oid, names, description, isObsolete,
+                        superiorClasses, requiredAttributes, optionalAttributes, objectClassType,
+                        extraProperties, definition), overwrite);
+            }
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        }
+        return this;
+    }
 
-      List<String> names = Collections.emptyList();
-      String description = "".intern();
-      boolean isObsolete = false;
-      Set<String> superiorClasses = Collections.emptySet();
-      Set<String> requiredAttributes = Collections.emptySet();
-      Set<String> optionalAttributes = Collections.emptySet();
-      ObjectClassType objectClassType = ObjectClassType.STRUCTURAL;
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+    /**
+     * Adds the provided object class definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the object class definition.
+     * @param names
+     *            The user-friendly names of the object class definition.
+     * @param description
+     *            The description of the object class definition.
+     * @param obsolete
+     *            {@code true} if the object class definition is obsolete,
+     *            otherwise {@code false}.
+     * @param superiorClassOIDs
+     *            A list of direct superclasses of the object class.
+     * @param requiredAttributeOIDs
+     *            A list of attribute types that entries must contain.
+     * @param optionalAttributeOIDs
+     *            A list of attribute types that entries may contain.
+     * @param objectClassType
+     *            The type of the object class.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            object class definition.
+     * @param overwrite
+     *            {@code true} if any existing object class with the same OID
+     *            should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addObjectClass(final String oid, final List<String> names,
+            final String description, final boolean obsolete, Set<String> superiorClassOIDs,
+            final Set<String> requiredAttributeOIDs, final Set<String> optionalAttributeOIDs,
+            final ObjectClassType objectClassType, final Map<String, List<String>> extraProperties,
+            final boolean overwrite) {
+        lazyInitBuilder();
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+        if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID)) {
+            addObjectClass(new ObjectClass(description,
+                    unmodifiableCopyOfExtraProperties(extraProperties)), overwrite);
+        } else {
+            if (objectClassType == ObjectClassType.STRUCTURAL && superiorClassOIDs.isEmpty()) {
+                superiorClassOIDs = Collections.singleton(TOP_OBJECTCLASS_NAME);
+            }
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
+            addObjectClass(new ObjectClass(oid, unmodifiableCopyOfList(names), description,
+                    obsolete, unmodifiableCopyOfSet(superiorClassOIDs),
+                    unmodifiableCopyOfSet(requiredAttributeOIDs),
+                    unmodifiableCopyOfSet(optionalAttributeOIDs), objectClassType,
+                    unmodifiableCopyOfExtraProperties(extraProperties), null), overwrite);
         }
-        else if (tokenName.equalsIgnoreCase("name"))
-        {
-          names = SchemaUtils.readNameDescriptors(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the attribute type. It
-          // is an arbitrary string of characters enclosed in single
-          // quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.equalsIgnoreCase("obsolete"))
-        {
-          // This indicates whether the attribute type should be
-          // considered obsolete. We do not need to do any more parsing
-          // for this token.
-          isObsolete = true;
-        }
-        else if (tokenName.equalsIgnoreCase("sup"))
-        {
-          superiorClasses = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("abstract"))
-        {
-          // This indicates that entries must not include this
-          // objectclass unless they also include a non-abstract
-          // objectclass that inherits from this class. We do not need
-          // any more parsing for this token.
-          objectClassType = ObjectClassType.ABSTRACT;
-        }
-        else if (tokenName.equalsIgnoreCase("structural"))
-        {
-          // This indicates that this is a structural objectclass. We do
-          // not need any more parsing for this token.
-          objectClassType = ObjectClassType.STRUCTURAL;
-        }
-        else if (tokenName.equalsIgnoreCase("auxiliary"))
-        {
-          // This indicates that this is an auxiliary objectclass. We do
-          // not need any more parsing for this token.
-          objectClassType = ObjectClassType.AUXILIARY;
-        }
-        else if (tokenName.equalsIgnoreCase("must"))
-        {
-          requiredAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.equalsIgnoreCase("may"))
-        {
-          optionalAttributes = SchemaUtils.readOIDs(reader,
-              allowMalformedNamesAndOptions);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
+        return this;
+    }
 
-      if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID))
-      {
-        addObjectClass(new ObjectClass(description, extraProperties), overwrite);
-      }
-      else
-      {
-        if (objectClassType == ObjectClassType.STRUCTURAL
-            && superiorClasses.isEmpty())
-        {
-          superiorClasses = Collections.singleton(TOP_OBJECTCLASS_NAME);
-        }
+    /**
+     * Adds the provided pattern syntax definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the pattern syntax definition.
+     * @param description
+     *            The description of the pattern syntax definition.
+     * @param pattern
+     *            The regular expression pattern which attribute values must
+     *            match in order to be valid.
+     * @param overwrite
+     *            {@code true} if any existing syntax with the same OID should
+     *            be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addPatternSyntax(final String oid, final String description,
+            final Pattern pattern, final boolean overwrite) {
+        Validator.ensureNotNull(pattern);
 
-        if (!extraProperties.isEmpty())
-        {
-          extraProperties = Collections.unmodifiableMap(extraProperties);
-        }
+        lazyInitBuilder();
 
-        addObjectClass(new ObjectClass(oid, names, description, isObsolete,
-            superiorClasses, requiredAttributes, optionalAttributes,
-            objectClassType, extraProperties, definition), overwrite);
-      }
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        addSyntax(new Syntax(oid, description, Collections.singletonMap("X-PATTERN", Collections
+                .singletonList(pattern.toString())), null, null), overwrite);
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Asynchronously reads the schema elements contained in the named subschema
+     * sub-entry and adds them to this schema builder.
+     * <p>
+     * If the requested schema is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the subschema sub-entry.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A future representing the updated schema builder.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public FutureResult<SchemaBuilder> addSchemaAsync(final Connection connection, final DN name,
+            final ResultHandler<? super SchemaBuilder> handler, final boolean overwrite) {
+        // The call to addSchema will perform copyOnWrite.
+        final SearchRequest request = getReadSchemaSearchRequest(name);
 
+        final FutureResultTransformer<SearchResultEntry, SchemaBuilder> future =
+                new FutureResultTransformer<SearchResultEntry, SchemaBuilder>(handler) {
 
-  /**
-   * Adds the provided object class definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the object class definition.
-   * @param names
-   *          The user-friendly names of the object class definition.
-   * @param description
-   *          The description of the object class definition.
-   * @param obsolete
-   *          {@code true} if the object class definition is obsolete, otherwise
-   *          {@code false}.
-   * @param superiorClassOIDs
-   *          A list of direct superclasses of the object class.
-   * @param requiredAttributeOIDs
-   *          A list of attribute types that entries must contain.
-   * @param optionalAttributeOIDs
-   *          A list of attribute types that entries may contain.
-   * @param objectClassType
-   *          The type of the object class.
-   * @param extraProperties
-   *          A map containing additional properties associated with the object
-   *          class definition.
-   * @param overwrite
-   *          {@code true} if any existing object class with the same OID should
-   *          be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addObjectClass(final String oid,
-      final List<String> names, final String description,
-      final boolean obsolete, Set<String> superiorClassOIDs,
-      final Set<String> requiredAttributeOIDs,
-      final Set<String> optionalAttributeOIDs,
-      final ObjectClassType objectClassType,
-      final Map<String, List<String>> extraProperties, final boolean overwrite)
-  {
-    lazyInitBuilder();
+                    @Override
+                    protected SchemaBuilder transformResult(final SearchResultEntry result)
+                            throws ErrorResultException {
+                        addSchema(result, overwrite);
+                        return SchemaBuilder.this;
+                    }
+
+                };
 
-    if (oid.equals(EXTENSIBLE_OBJECT_OBJECTCLASS_OID))
-    {
-      addObjectClass(new ObjectClass(description,
-          unmodifiableCopyOfExtraProperties(extraProperties)), overwrite);
+        final FutureResult<SearchResultEntry> innerFuture =
+                connection.searchSingleEntryAsync(request, future);
+        future.setFutureResult(innerFuture);
+        return future;
     }
-    else
-    {
-      if (objectClassType == ObjectClassType.STRUCTURAL
-          && superiorClassOIDs.isEmpty())
-      {
-        superiorClassOIDs = Collections.singleton(TOP_OBJECTCLASS_NAME);
-      }
 
-      addObjectClass(new ObjectClass(oid, unmodifiableCopyOfList(names),
-          description, obsolete, unmodifiableCopyOfSet(superiorClassOIDs),
-          unmodifiableCopyOfSet(requiredAttributeOIDs),
-          unmodifiableCopyOfSet(optionalAttributeOIDs), objectClassType,
-          unmodifiableCopyOfExtraProperties(extraProperties), null), overwrite);
+    /**
+     * Reads the schema elements contained in the named subschema sub-entry and
+     * adds them to this schema builder.
+     * <p>
+     * If the requested schema is not returned by the Directory Server then the
+     * request will fail with an {@link EntryNotFoundException}.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the subschema sub-entry.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public SchemaBuilder addSchema(final Connection connection, final DN name,
+            final boolean overwrite) throws ErrorResultException, InterruptedException {
+        // The call to addSchema will perform copyOnWrite.
+        final SearchRequest request = getReadSchemaSearchRequest(name);
+        final Entry entry = connection.searchSingleEntry(request);
+        return addSchema(entry, overwrite);
     }
-    return this;
-  }
 
+    /**
+     * Adds all of the schema elements contained in the provided subschema
+     * subentry to this schema builder. Any problems encountered while parsing
+     * the entry can be retrieved using the returned schema's
+     * {@link Schema#getWarnings()} method.
+     *
+     * @param entry
+     *            The subschema subentry to be parsed.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public SchemaBuilder addSchema(final Entry entry, final boolean overwrite) {
+        Validator.ensureNotNull(entry);
 
+        lazyInitBuilder();
 
-  /**
-   * Adds the provided pattern syntax definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the pattern syntax definition.
-   * @param description
-   *          The description of the pattern syntax definition.
-   * @param pattern
-   *          The regular expression pattern which attribute values must match
-   *          in order to be valid.
-   * @param overwrite
-   *          {@code true} if any existing syntax with the same OID should be
-   *          overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addPatternSyntax(final String oid,
-      final String description, final Pattern pattern, final boolean overwrite)
-  {
-    Validator.ensureNotNull(pattern);
+        Attribute attr = entry.getAttribute(Schema.ATTR_LDAP_SYNTAXES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addSyntax(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
+        }
 
-    lazyInitBuilder();
-
-    addSyntax(
-        new Syntax(oid, description, Collections.singletonMap("X-PATTERN",
-            Collections.singletonList(pattern.toString())), null, null),
-        overwrite);
-    return this;
-  }
-
-
-
-  /**
-   * Asynchronously reads the schema elements contained in the named subschema
-   * sub-entry and adds them to this schema builder.
-   * <p>
-   * If the requested schema is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the subschema sub-entry.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A future representing the updated schema builder.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public FutureResult<SchemaBuilder> addSchemaAsync(
-      final Connection connection, final DN name,
-      final ResultHandler<? super SchemaBuilder> handler,
-      final boolean overwrite)
-  {
-    // The call to addSchema will perform copyOnWrite.
-    final SearchRequest request = getReadSchemaSearchRequest(name);
-
-    final FutureResultTransformer<SearchResultEntry, SchemaBuilder> future =
-      new FutureResultTransformer<SearchResultEntry, SchemaBuilder>(handler)
-    {
-
-      @Override
-      protected SchemaBuilder transformResult(final SearchResultEntry result)
-          throws ErrorResultException
-      {
-        addSchema(result, overwrite);
-        return SchemaBuilder.this;
-      }
-
-    };
-
-    final FutureResult<SearchResultEntry> innerFuture = connection
-        .searchSingleEntryAsync(request, future);
-    future.setFutureResult(innerFuture);
-    return future;
-  }
-
-
-
-  /**
-   * Reads the schema elements contained in the named subschema sub-entry and
-   * adds them to this schema builder.
-   * <p>
-   * If the requested schema is not returned by the Directory Server then the
-   * request will fail with an {@link EntryNotFoundException}.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the subschema sub-entry.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public SchemaBuilder addSchema(final Connection connection, final DN name,
-      final boolean overwrite) throws ErrorResultException,
-      InterruptedException
-  {
-    // The call to addSchema will perform copyOnWrite.
-    final SearchRequest request = getReadSchemaSearchRequest(name);
-    final Entry entry = connection.searchSingleEntry(request);
-    return addSchema(entry, overwrite);
-  }
-
-
-
-  /**
-   * Adds all of the schema elements contained in the provided subschema
-   * subentry to this schema builder. Any problems encountered while parsing the
-   * entry can be retrieved using the returned schema's
-   * {@link Schema#getWarnings()} method.
-   *
-   * @param entry
-   *          The subschema subentry to be parsed.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public SchemaBuilder addSchema(final Entry entry, final boolean overwrite)
-  {
-    Validator.ensureNotNull(entry);
-
-    lazyInitBuilder();
-
-    Attribute attr = entry.getAttribute(Schema.ATTR_LDAP_SYNTAXES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addSyntax(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_ATTRIBUTE_TYPES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addAttributeType(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_ATTRIBUTE_TYPES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addAttributeType(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_OBJECT_CLASSES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addObjectClass(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_OBJECT_CLASSES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addObjectClass(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_MATCHING_RULE_USE);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addMatchingRuleUse(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_MATCHING_RULE_USE);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addMatchingRuleUse(def.toString(), overwrite);
+        attr = entry.getAttribute(Schema.ATTR_MATCHING_RULES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addMatchingRule(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
-        }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_MATCHING_RULES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addMatchingRule(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_DIT_CONTENT_RULES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addDITContentRule(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_DIT_CONTENT_RULES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addDITContentRule(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_DIT_STRUCTURE_RULES);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addDITStructureRule(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_DIT_STRUCTURE_RULES);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addDITStructureRule(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
+        attr = entry.getAttribute(Schema.ATTR_NAME_FORMS);
+        if (attr != null) {
+            for (final ByteString def : attr) {
+                try {
+                    addNameForm(def.toString(), overwrite);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    warnings.add(e.getMessageObject());
+                }
+            }
         }
-      }
-    }
 
-    attr = entry.getAttribute(Schema.ATTR_NAME_FORMS);
-    if (attr != null)
-    {
-      for (final ByteString def : attr)
-      {
-        try
-        {
-          addNameForm(def.toString(), overwrite);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          warnings.add(e.getMessageObject());
-        }
-      }
+        return this;
     }
 
-    return this;
-  }
+    /**
+     * Adds all of the schema elements in the provided schema to this schema
+     * builder.
+     *
+     * @param schema
+     *            The schema to be copied into this schema builder.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and conflicting schema
+     *             elements were found.
+     * @throws NullPointerException
+     *             If {@code schema} was {@code null}.
+     */
+    public SchemaBuilder addSchema(final Schema schema, final boolean overwrite) {
+        Validator.ensureNotNull(schema);
 
+        lazyInitBuilder();
 
+        addSchema0(schema, overwrite);
+        return this;
+    }
 
-  /**
-   * Adds all of the schema elements in the provided schema to this schema
-   * builder.
-   *
-   * @param schema
-   *          The schema to be copied into this schema builder.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and conflicting schema
-   *           elements were found.
-   * @throws NullPointerException
-   *           If {@code schema} was {@code null}.
-   */
-  public SchemaBuilder addSchema(final Schema schema, final boolean overwrite)
-  {
-    Validator.ensureNotNull(schema);
+    /**
+     * Asynchronously reads the schema elements contained in the subschema
+     * sub-entry which applies to the named entry and adds them to this schema
+     * builder.
+     * <p>
+     * If the requested entry or its associated schema are not returned by the
+     * Directory Server then the request will fail with an
+     * {@link EntryNotFoundException}.
+     * <p>
+     * This implementation first reads the {@code subschemaSubentry} attribute
+     * of the entry in order to identify the schema and then invokes
+     * {@link #addSchemaAsync(Connection, DN, ResultHandler, boolean)} to read
+     * the schema.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the entry whose schema is to be
+     *            located.
+     * @param handler
+     *            A result handler which can be used to asynchronously process
+     *            the operation result when it is received, may be {@code null}.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A future representing the updated schema builder.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public FutureResult<SchemaBuilder> addSchemaForEntryAsync(final Connection connection,
+            final DN name, final ResultHandler<? super SchemaBuilder> handler,
+            final boolean overwrite) {
+        // The call to addSchema will perform copyOnWrite.
+        final RecursiveFutureResult<SearchResultEntry, SchemaBuilder> future =
+                new RecursiveFutureResult<SearchResultEntry, SchemaBuilder>(handler) {
 
-    lazyInitBuilder();
+                    @Override
+                    protected FutureResult<SchemaBuilder> chainResult(
+                            final SearchResultEntry innerResult,
+                            final ResultHandler<? super SchemaBuilder> handler)
+                            throws ErrorResultException {
+                        final DN subschemaDN = getSubschemaSubentryDN(name, innerResult);
+                        return addSchemaAsync(connection, subschemaDN, handler, overwrite);
+                    }
 
-    addSchema0(schema, overwrite);
-    return this;
-  }
+                };
 
+        final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
+        final FutureResult<SearchResultEntry> innerFuture =
+                connection.searchSingleEntryAsync(request, future);
+        future.setFutureResult(innerFuture);
+        return future;
+    }
 
+    /**
+     * Reads the schema elements contained in the subschema sub-entry which
+     * applies to the named entry and adds them to this schema builder.
+     * <p>
+     * If the requested entry or its associated schema are not returned by the
+     * Directory Server then the request will fail with an
+     * {@link EntryNotFoundException}.
+     * <p>
+     * This implementation first reads the {@code subschemaSubentry} attribute
+     * of the entry in order to identify the schema and then invokes
+     * {@link #addSchemaForEntry(Connection, DN, boolean)} to read the schema.
+     *
+     * @param connection
+     *            A connection to the Directory Server whose schema is to be
+     *            read.
+     * @param name
+     *            The distinguished name of the entry whose schema is to be
+     *            located.
+     * @param overwrite
+     *            {@code true} if existing schema elements with the same
+     *            conflicting OIDs should be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ErrorResultException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedException
+     *             If the current thread was interrupted while waiting.
+     * @throws UnsupportedOperationException
+     *             If the connection does not support search operations.
+     * @throws IllegalStateException
+     *             If the connection has already been closed, i.e. if
+     *             {@code connection.isClosed() == true}.
+     * @throws NullPointerException
+     *             If the {@code connection} or {@code name} was {@code null}.
+     */
+    public SchemaBuilder addSchemaForEntry(final Connection connection, final DN name,
+            final boolean overwrite) throws ErrorResultException, InterruptedException {
+        // The call to addSchema will perform copyOnWrite.
+        final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
+        final Entry entry = connection.searchSingleEntry(request);
+        final DN subschemaDN = getSubschemaSubentryDN(name, entry);
+        return addSchema(connection, subschemaDN, overwrite);
+    }
 
-  /**
-   * Asynchronously reads the schema elements contained in the subschema
-   * sub-entry which applies to the named entry and adds them to this schema
-   * builder.
-   * <p>
-   * If the requested entry or its associated schema are not returned by the
-   * Directory Server then the request will fail with an
-   * {@link EntryNotFoundException}.
-   * <p>
-   * This implementation first reads the {@code subschemaSubentry} attribute of
-   * the entry in order to identify the schema and then invokes
-   * {@link #addSchemaAsync(Connection, DN, ResultHandler, boolean)} to
-   * read the schema.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the entry whose schema is to be located.
-   * @param handler
-   *          A result handler which can be used to asynchronously process the
-   *          operation result when it is received, may be {@code null}.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A future representing the updated schema builder.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public FutureResult<SchemaBuilder> addSchemaForEntryAsync(
-      final Connection connection, final DN name,
-      final ResultHandler<? super SchemaBuilder> handler,
-      final boolean overwrite)
-  {
-    // The call to addSchema will perform copyOnWrite.
-    final RecursiveFutureResult<SearchResultEntry, SchemaBuilder> future =
-      new RecursiveFutureResult<SearchResultEntry, SchemaBuilder>(handler)
-    {
-
-      @Override
-      protected FutureResult<SchemaBuilder> chainResult(
-          final SearchResultEntry innerResult,
-          final ResultHandler<? super SchemaBuilder> handler)
-          throws ErrorResultException
-      {
-        final DN subschemaDN = getSubschemaSubentryDN(name, innerResult);
-        return addSchemaAsync(connection, subschemaDN, handler, overwrite);
-      }
-
-    };
-
-    final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
-    final FutureResult<SearchResultEntry> innerFuture = connection
-        .searchSingleEntryAsync(request, future);
-    future.setFutureResult(innerFuture);
-    return future;
-  }
-
-
-
-  /**
-   * Reads the schema elements contained in the subschema sub-entry which
-   * applies to the named entry and adds them to this schema builder.
-   * <p>
-   * If the requested entry or its associated schema are not returned by the
-   * Directory Server then the request will fail with an
-   * {@link EntryNotFoundException}.
-   * <p>
-   * This implementation first reads the {@code subschemaSubentry} attribute of
-   * the entry in order to identify the schema and then invokes
-   * {@link #addSchemaForEntry(Connection, DN, boolean)} to read the schema.
-   *
-   * @param connection
-   *          A connection to the Directory Server whose schema is to be read.
-   * @param name
-   *          The distinguished name of the entry whose schema is to be located.
-   * @param overwrite
-   *          {@code true} if existing schema elements with the same conflicting
-   *          OIDs should be overwritten.
-   * @return A reference to this schema builder.
-   * @throws ErrorResultException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedException
-   *           If the current thread was interrupted while waiting.
-   * @throws UnsupportedOperationException
-   *           If the connection does not support search operations.
-   * @throws IllegalStateException
-   *           If the connection has already been closed, i.e. if
-   *           {@code connection.isClosed() == true}.
-   * @throws NullPointerException
-   *           If the {@code connection} or {@code name} was {@code null}.
-   */
-  public SchemaBuilder addSchemaForEntry(final Connection connection,
-      final DN name, final boolean overwrite) throws ErrorResultException,
-      InterruptedException
-  {
-    // The call to addSchema will perform copyOnWrite.
-    final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
-    final Entry entry = connection.searchSingleEntry(request);
-    final DN subschemaDN = getSubschemaSubentryDN(name, entry);
-    return addSchema(connection, subschemaDN, overwrite);
-  }
-
-
-
-  /**
-   * Adds the provided substitution syntax definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the substitution syntax definition.
-   * @param description
-   *          The description of the substitution syntax definition.
-   * @param substituteSyntax
-   *          The OID of the syntax whose implementation should be substituted.
-   * @param overwrite
-   *          {@code true} if any existing syntax with the same OID should be
-   *          overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   */
-  public SchemaBuilder addSubstitutionSyntax(final String oid,
-      final String description, final String substituteSyntax,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(substituteSyntax);
-
-    lazyInitBuilder();
+    /**
+     * Adds the provided substitution syntax definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the substitution syntax definition.
+     * @param description
+     *            The description of the substitution syntax definition.
+     * @param substituteSyntax
+     *            The OID of the syntax whose implementation should be
+     *            substituted.
+     * @param overwrite
+     *            {@code true} if any existing syntax with the same OID should
+     *            be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     */
+    public SchemaBuilder addSubstitutionSyntax(final String oid, final String description,
+            final String substituteSyntax, final boolean overwrite) {
+        Validator.ensureNotNull(substituteSyntax);
 
-    addSyntax(
-        new Syntax(oid, description, Collections.singletonMap("X-SUBST",
-            Collections.singletonList(substituteSyntax)), null, null),
-        overwrite);
-    return this;
-  }
+        lazyInitBuilder();
 
+        addSyntax(new Syntax(oid, description, Collections.singletonMap("X-SUBST", Collections
+                .singletonList(substituteSyntax)), null, null), overwrite);
+        return this;
+    }
 
+    /**
+     * Adds the provided syntax definition to this schema builder.
+     *
+     * @param definition
+     *            The syntax definition.
+     * @param overwrite
+     *            {@code true} if any existing syntax with the same OID should
+     *            be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws LocalizedIllegalArgumentException
+     *             If the provided syntax definition could not be parsed.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addSyntax(final String definition, final boolean overwrite) {
+        Validator.ensureNotNull(definition);
 
-  /**
-   * Adds the provided syntax definition to this schema builder.
-   *
-   * @param definition
-   *          The syntax definition.
-   * @param overwrite
-   *          {@code true} if any existing syntax with the same OID should be
-   *          overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws LocalizedIllegalArgumentException
-   *           If the provided syntax definition could not be parsed.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addSyntax(final String definition,
-      final boolean overwrite)
-  {
-    Validator.ensureNotNull(definition);
+        lazyInitBuilder();
 
-    lazyInitBuilder();
+        try {
+            final SubstringReader reader = new SubstringReader(definition);
 
-    try
-    {
-      final SubstringReader reader = new SubstringReader(definition);
+            // We'll do this a character at a time. First, skip over any
+            // leading whitespace.
+            reader.skipWhitespaces();
 
-      // We'll do this a character at a time. First, skip over any
-      // leading whitespace.
-      reader.skipWhitespaces();
+            if (reader.remaining() <= 0) {
+                // This means that the value was empty or contained only
+                // whitespace. That is illegal.
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1.get(definition);
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      if (reader.remaining() <= 0)
-      {
-        // This means that the value was empty or contained only
-        // whitespace. That is illegal.
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1
-            .get(definition);
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            // The next character must be an open parenthesis. If it is not,
+            // then that is an error.
+            final char c = reader.read();
+            if (c != '(') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition,
+                                (reader.pos() - 1), String.valueOf(c));
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      // The next character must be an open parenthesis. If it is not,
-      // then that is an error.
-      final char c = reader.read();
-      if (c != '(')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS
-            .get(definition, (reader.pos() - 1), String.valueOf(c));
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            // Skip over any spaces immediately following the opening
+            // parenthesis.
+            reader.skipWhitespaces();
 
-      // Skip over any spaces immediately following the opening
-      // parenthesis.
-      reader.skipWhitespaces();
+            // The next set of characters must be the OID.
+            final String oid = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
 
-      // The next set of characters must be the OID.
-      final String oid = SchemaUtils.readOID(reader,
-          allowMalformedNamesAndOptions);
+            String description = "".intern();
+            Map<String, List<String>> extraProperties = Collections.emptyMap();
 
-      String description = "".intern();
-      Map<String, List<String>> extraProperties = Collections.emptyMap();
+            // At this point, we should have a pretty specific syntax that
+            // describes what may come next, but some of the components are
+            // optional and it would be pretty easy to put something in the
+            // wrong order, so we will be very flexible about what we can
+            // accept. Just look at the next token, figure out what it is and
+            // how to treat what comes after it, then repeat until we get to
+            // the end of the value. But before we start, set default values
+            // for everything else we might need to know.
+            while (true) {
+                final String tokenName = SchemaUtils.readTokenName(reader);
 
-      // At this point, we should have a pretty specific syntax that
-      // describes what may come next, but some of the components are
-      // optional and it would be pretty easy to put something in the
-      // wrong order, so we will be very flexible about what we can
-      // accept. Just look at the next token, figure out what it is and
-      // how to treat what comes after it, then repeat until we get to
-      // the end of the value. But before we start, set default values
-      // for everything else we might need to know.
-      while (true)
-      {
-        final String tokenName = SchemaUtils.readTokenName(reader);
+                if (tokenName == null) {
+                    // No more tokens.
+                    break;
+                } else if (tokenName.equalsIgnoreCase("desc")) {
+                    // This specifies the description for the syntax. It is an
+                    // arbitrary string of characters enclosed in single quotes.
+                    description = SchemaUtils.readQuotedString(reader);
+                } else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
+                    // This must be a non-standard property and it must be
+                    // followed by either a single definition in single quotes
+                    // or
+                    // an open parenthesis followed by one or more values in
+                    // single quotes separated by spaces followed by a close
+                    // parenthesis.
+                    if (extraProperties.isEmpty()) {
+                        extraProperties = new HashMap<String, List<String>>();
+                    }
+                    extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
+                } else {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1.get(definition, tokenName);
+                    throw new LocalizedIllegalArgumentException(message);
+                }
+            }
 
-        if (tokenName == null)
-        {
-          // No more tokens.
-          break;
-        }
-        else if (tokenName.equalsIgnoreCase("desc"))
-        {
-          // This specifies the description for the syntax. It is an
-          // arbitrary string of characters enclosed in single quotes.
-          description = SchemaUtils.readQuotedString(reader);
-        }
-        else if (tokenName.matches("^X-[A-Za-z_-]+$"))
-        {
-          // This must be a non-standard property and it must be
-          // followed by either a single definition in single quotes or
-          // an open parenthesis followed by one or more values in
-          // single quotes separated by spaces followed by a close
-          // parenthesis.
-          if (extraProperties.isEmpty())
-          {
-            extraProperties = new HashMap<String, List<String>>();
-          }
-          extraProperties.put(tokenName, SchemaUtils.readExtensions(reader));
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1
-              .get(definition, tokenName);
-          throw new LocalizedIllegalArgumentException(message);
-        }
-      }
+            if (!extraProperties.isEmpty()) {
+                extraProperties = Collections.unmodifiableMap(extraProperties);
+            }
 
-      if (!extraProperties.isEmpty())
-      {
-        extraProperties = Collections.unmodifiableMap(extraProperties);
-      }
+            // See if it is a enum syntax
+            for (final Map.Entry<String, List<String>> property : extraProperties.entrySet()) {
+                if (property.getKey().equalsIgnoreCase("x-enum")) {
+                    final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid, property.getValue());
+                    final Syntax enumSyntax =
+                            new Syntax(oid, description, extraProperties, definition, enumImpl);
+                    final MatchingRule enumOMR =
+                            new MatchingRule(enumImpl.getOrderingMatchingRule(), Collections
+                                    .singletonList(OMR_GENERIC_ENUM_NAME + oid), "", false, oid,
+                                    CoreSchemaImpl.OPENDS_ORIGIN, null,
+                                    new EnumOrderingMatchingRule(enumImpl));
 
-      // See if it is a enum syntax
-      for (final Map.Entry<String, List<String>> property : extraProperties
-          .entrySet())
-      {
-        if (property.getKey().equalsIgnoreCase("x-enum"))
-        {
-          final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid,
-              property.getValue());
-          final Syntax enumSyntax = new Syntax(oid, description,
-              extraProperties, definition, enumImpl);
-          final MatchingRule enumOMR = new MatchingRule(
-              enumImpl.getOrderingMatchingRule(),
-              Collections.singletonList(OMR_GENERIC_ENUM_NAME + oid), "",
-              false, oid, CoreSchemaImpl.OPENDS_ORIGIN, null,
-              new EnumOrderingMatchingRule(enumImpl));
+                    addSyntax(enumSyntax, overwrite);
+                    addMatchingRule(enumOMR, overwrite);
+                    return this;
+                }
+            }
 
-          addSyntax(enumSyntax, overwrite);
-          addMatchingRule(enumOMR, overwrite);
-          return this;
+            addSyntax(new Syntax(oid, description, extraProperties, definition, null), overwrite);
+        } catch (final DecodeException e) {
+            final LocalizableMessage msg =
+                    ERR_ATTR_SYNTAX_ATTRSYNTAX_INVALID1.get(definition, e.getMessageObject());
+            throw new LocalizedIllegalArgumentException(msg, e.getCause());
         }
-      }
-
-      addSyntax(
-          new Syntax(oid, description, extraProperties, definition, null),
-          overwrite);
-    }
-    catch (final DecodeException e)
-    {
-      final LocalizableMessage msg = ERR_ATTR_SYNTAX_ATTRSYNTAX_INVALID1.get(
-          definition, e.getMessageObject());
-      throw new LocalizedIllegalArgumentException(msg, e.getCause());
+        return this;
     }
-    return this;
-  }
 
+    /**
+     * Adds the provided syntax definition to this schema builder.
+     *
+     * @param oid
+     *            The OID of the syntax definition.
+     * @param description
+     *            The description of the syntax definition.
+     * @param extraProperties
+     *            A map containing additional properties associated with the
+     *            syntax definition.
+     * @param implementation
+     *            The implementation of the syntax.
+     * @param overwrite
+     *            {@code true} if any existing syntax with the same OID should
+     *            be overwritten.
+     * @return A reference to this schema builder.
+     * @throws ConflictingSchemaElementException
+     *             If {@code overwrite} was {@code false} and a conflicting
+     *             schema element was found.
+     * @throws NullPointerException
+     *             If {@code definition} was {@code null}.
+     */
+    public SchemaBuilder addSyntax(final String oid, final String description,
+            final Map<String, List<String>> extraProperties, final SyntaxImpl implementation,
+            final boolean overwrite) {
+        lazyInitBuilder();
 
-
-  /**
-   * Adds the provided syntax definition to this schema builder.
-   *
-   * @param oid
-   *          The OID of the syntax definition.
-   * @param description
-   *          The description of the syntax definition.
-   * @param extraProperties
-   *          A map containing additional properties associated with the syntax
-   *          definition.
-   * @param implementation
-   *          The implementation of the syntax.
-   * @param overwrite
-   *          {@code true} if any existing syntax with the same OID should be
-   *          overwritten.
-   * @return A reference to this schema builder.
-   * @throws ConflictingSchemaElementException
-   *           If {@code overwrite} was {@code false} and a conflicting schema
-   *           element was found.
-   * @throws NullPointerException
-   *           If {@code definition} was {@code null}.
-   */
-  public SchemaBuilder addSyntax(final String oid, final String description,
-      final Map<String, List<String>> extraProperties,
-      final SyntaxImpl implementation, final boolean overwrite)
-  {
-    lazyInitBuilder();
-
-    addSyntax(new Syntax(oid, description,
-        unmodifiableCopyOfExtraProperties(extraProperties), null,
-        implementation), overwrite);
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not the schema should allow certain illegal characters
-   * in OIDs and attribute options. When this compatibility option is set to
-   * {@code true} the following illegal characters will be permitted in addition
-   * to those permitted in section 1.4 of RFC 4512:
-   *
-   * <pre>
-   * USCORE  = %x5F ; underscore ("_")
-   * DOT     = %x2E ; period (".")
-   * </pre>
-   *
-   * By default this compatibility option is set to {@code true} because these
-   * characters are often used for naming purposes (such as collation rules).
-   *
-   * @param allowMalformedNamesAndOptions
-   *          {@code true} if the schema should allow certain illegal characters
-   *          in OIDs and attribute options.
-   * @return A reference to this {@code SchemaBuilder}.
-   * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
-   *      Directory Access Protocol (LDAP): Directory Information Models </a>
-   */
-  public SchemaBuilder allowMalformedNamesAndOptions(
-      final boolean allowMalformedNamesAndOptions)
-  {
-    lazyInitBuilder();
-
-    this.allowMalformedNamesAndOptions = allowMalformedNamesAndOptions;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not the Telephone Number syntax should allow values
-   * which do not conform to the E.123 international telephone number format.
-   * <p>
-   * By default this compatibility option is set to {@code true}.
-   *
-   * @param allowNonStandardTelephoneNumbers
-   *          {@code true} if the Telephone Number syntax should allow values
-   *          which do not conform to the E.123 international telephone number
-   *          format.
-   * @return A reference to this {@code SchemaBuilder}.
-   */
-  public SchemaBuilder allowNonStandardTelephoneNumbers(
-      final boolean allowNonStandardTelephoneNumbers)
-  {
-    lazyInitBuilder();
-
-    this.allowNonStandardTelephoneNumbers = allowNonStandardTelephoneNumbers;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not zero-length values will be allowed by the
-   * Directory String syntax. This is technically forbidden by the LDAP
-   * specification, but it was allowed in earlier versions of the server, and
-   * the discussion of the directory string syntax in RFC 2252 does not
-   * explicitly state that they are not allowed.
-   * <p>
-   * By default this compatibility option is set to {@code false}.
-   *
-   * @param allowZeroLengthDirectoryStrings
-   *          {@code true} if zero-length values will be allowed by the
-   *          Directory String syntax, or {@code false} if not.
-   * @return A reference to this {@code SchemaBuilder}.
-   */
-  public SchemaBuilder allowZeroLengthDirectoryStrings(
-      final boolean allowZeroLengthDirectoryStrings)
-  {
-    lazyInitBuilder();
-
-    this.allowZeroLengthDirectoryStrings = allowZeroLengthDirectoryStrings;
-    return this;
-  }
-
-
-
-  /**
-   * Removes the named attribute type from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the attribute type to be removed.
-   * @return {@code true} if the attribute type was found.
-   */
-  public boolean removeAttributeType(final String name)
-  {
-    lazyInitBuilder();
-
-    final AttributeType element = numericOID2AttributeTypes.get(name);
-    if (element != null)
-    {
-      removeAttributeType(element);
-      return true;
-    }
-    final List<AttributeType> elements = name2AttributeTypes
-        .get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final AttributeType e : elements)
-      {
-        removeAttributeType(e);
-      }
-      return true;
+        addSyntax(new Syntax(oid, description, unmodifiableCopyOfExtraProperties(extraProperties),
+                null, implementation), overwrite);
+        return this;
     }
-    return false;
-  }
 
+    /**
+     * Specifies whether or not the schema should allow certain illegal
+     * characters in OIDs and attribute options. When this compatibility option
+     * is set to {@code true} the following illegal characters will be permitted
+     * in addition to those permitted in section 1.4 of RFC 4512:
+     *
+     * <pre>
+     * USCORE  = %x5F ; underscore ("_")
+     * DOT     = %x2E ; period (".")
+     * </pre>
+     *
+     * By default this compatibility option is set to {@code true} because these
+     * characters are often used for naming purposes (such as collation rules).
+     *
+     * @param allowMalformedNamesAndOptions
+     *            {@code true} if the schema should allow certain illegal
+     *            characters in OIDs and attribute options.
+     * @return A reference to this {@code SchemaBuilder}.
+     * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
+     *      Directory Access Protocol (LDAP): Directory Information Models </a>
+     */
+    public SchemaBuilder allowMalformedNamesAndOptions(final boolean allowMalformedNamesAndOptions) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the named DIT content rule from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the DIT content rule to be removed.
-   * @return {@code true} if the DIT content rule was found.
-   */
-  public boolean removeDITContentRule(final String name)
-  {
-    lazyInitBuilder();
-
-    final DITContentRule element = numericOID2ContentRules.get(name);
-    if (element != null)
-    {
-      removeDITContentRule(element);
-      return true;
-    }
-    final List<DITContentRule> elements = name2ContentRules
-        .get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final DITContentRule e : elements)
-      {
-        removeDITContentRule(e);
-      }
-      return true;
+        this.allowMalformedNamesAndOptions = allowMalformedNamesAndOptions;
+        return this;
     }
-    return false;
-  }
 
+    /**
+     * Specifies whether or not the Telephone Number syntax should allow values
+     * which do not conform to the E.123 international telephone number format.
+     * <p>
+     * By default this compatibility option is set to {@code true}.
+     *
+     * @param allowNonStandardTelephoneNumbers
+     *            {@code true} if the Telephone Number syntax should allow
+     *            values which do not conform to the E.123 international
+     *            telephone number format.
+     * @return A reference to this {@code SchemaBuilder}.
+     */
+    public SchemaBuilder allowNonStandardTelephoneNumbers(
+            final boolean allowNonStandardTelephoneNumbers) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the specified DIT structure rule from this schema builder.
-   *
-   * @param ruleID
-   *          The ID of the DIT structure rule to be removed.
-   * @return {@code true} if the DIT structure rule was found.
-   */
-  public boolean removeDITStructureRule(final int ruleID)
-  {
-    lazyInitBuilder();
-
-    final DITStructureRule element = id2StructureRules.get(ruleID);
-    if (element != null)
-    {
-      removeDITStructureRule(element);
-      return true;
+        this.allowNonStandardTelephoneNumbers = allowNonStandardTelephoneNumbers;
+        return this;
     }
-    return false;
-  }
 
+    /**
+     * Specifies whether or not zero-length values will be allowed by the
+     * Directory String syntax. This is technically forbidden by the LDAP
+     * specification, but it was allowed in earlier versions of the server, and
+     * the discussion of the directory string syntax in RFC 2252 does not
+     * explicitly state that they are not allowed.
+     * <p>
+     * By default this compatibility option is set to {@code false}.
+     *
+     * @param allowZeroLengthDirectoryStrings
+     *            {@code true} if zero-length values will be allowed by the
+     *            Directory String syntax, or {@code false} if not.
+     * @return A reference to this {@code SchemaBuilder}.
+     */
+    public SchemaBuilder allowZeroLengthDirectoryStrings(
+            final boolean allowZeroLengthDirectoryStrings) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the named matching rule from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the matching rule to be removed.
-   * @return {@code true} if the matching rule was found.
-   */
-  public boolean removeMatchingRule(final String name)
-  {
-    lazyInitBuilder();
-
-    final MatchingRule element = numericOID2MatchingRules.get(name);
-    if (element != null)
-    {
-      removeMatchingRule(element);
-      return true;
-    }
-    final List<MatchingRule> elements = name2MatchingRules
-        .get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final MatchingRule e : elements)
-      {
-        removeMatchingRule(e);
-      }
-      return true;
+        this.allowZeroLengthDirectoryStrings = allowZeroLengthDirectoryStrings;
+        return this;
     }
-    return false;
-  }
 
+    /**
+     * Removes the named attribute type from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the attribute type to be removed.
+     * @return {@code true} if the attribute type was found.
+     */
+    public boolean removeAttributeType(final String name) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the named matching rule use from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the matching rule use to be removed.
-   * @return {@code true} if the matching rule use was found.
-   */
-  public boolean removeMatchingRuleUse(final String name)
-  {
-    lazyInitBuilder();
-
-    final MatchingRuleUse element = numericOID2MatchingRuleUses.get(name);
-    if (element != null)
-    {
-      removeMatchingRuleUse(element);
-      return true;
+        final AttributeType element = numericOID2AttributeTypes.get(name);
+        if (element != null) {
+            removeAttributeType(element);
+            return true;
+        }
+        final List<AttributeType> elements = name2AttributeTypes.get(toLowerCase(name));
+        if (elements != null) {
+            for (final AttributeType e : elements) {
+                removeAttributeType(e);
+            }
+            return true;
+        }
+        return false;
     }
-    final List<MatchingRuleUse> elements = name2MatchingRuleUses
-        .get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final MatchingRuleUse e : elements)
-      {
-        removeMatchingRuleUse(e);
-      }
-      return true;
-    }
-    return false;
-  }
-
-
 
-  /**
-   * Removes the named name form from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the name form to be removed.
-   * @return {@code true} if the name form was found.
-   */
-  public boolean removeNameForm(final String name)
-  {
-    lazyInitBuilder();
+    /**
+     * Removes the named DIT content rule from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the DIT content rule to be removed.
+     * @return {@code true} if the DIT content rule was found.
+     */
+    public boolean removeDITContentRule(final String name) {
+        lazyInitBuilder();
 
-    final NameForm element = numericOID2NameForms.get(name);
-    if (element != null)
-    {
-      removeNameForm(element);
-      return true;
-    }
-    final List<NameForm> elements = name2NameForms.get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final NameForm e : elements)
-      {
-        removeNameForm(e);
-      }
-      return true;
+        final DITContentRule element = numericOID2ContentRules.get(name);
+        if (element != null) {
+            removeDITContentRule(element);
+            return true;
+        }
+        final List<DITContentRule> elements = name2ContentRules.get(toLowerCase(name));
+        if (elements != null) {
+            for (final DITContentRule e : elements) {
+                removeDITContentRule(e);
+            }
+            return true;
+        }
+        return false;
     }
-    return false;
-  }
 
+    /**
+     * Removes the specified DIT structure rule from this schema builder.
+     *
+     * @param ruleID
+     *            The ID of the DIT structure rule to be removed.
+     * @return {@code true} if the DIT structure rule was found.
+     */
+    public boolean removeDITStructureRule(final int ruleID) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the named object class from this schema builder.
-   *
-   * @param name
-   *          The name or OID of the object class to be removed.
-   * @return {@code true} if the object class was found.
-   */
-  public boolean removeObjectClass(final String name)
-  {
-    lazyInitBuilder();
-
-    final ObjectClass element = numericOID2ObjectClasses.get(name);
-    if (element != null)
-    {
-      removeObjectClass(element);
-      return true;
-    }
-    final List<ObjectClass> elements = name2ObjectClasses
-        .get(toLowerCase(name));
-    if (elements != null)
-    {
-      for (final ObjectClass e : elements)
-      {
-        removeObjectClass(e);
-      }
-      return true;
+        final DITStructureRule element = id2StructureRules.get(ruleID);
+        if (element != null) {
+            removeDITStructureRule(element);
+            return true;
+        }
+        return false;
     }
-    return false;
-  }
 
+    /**
+     * Removes the named matching rule from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the matching rule to be removed.
+     * @return {@code true} if the matching rule was found.
+     */
+    public boolean removeMatchingRule(final String name) {
+        lazyInitBuilder();
 
-
-  /**
-   * Removes the named syntax from this schema builder.
-   *
-   * @param numericOID
-   *          The name of the syntax to be removed.
-   * @return {@code true} if the syntax was found.
-   */
-  public boolean removeSyntax(final String numericOID)
-  {
-    lazyInitBuilder();
-
-    final Syntax element = numericOID2Syntaxes.get(numericOID);
-    if (element != null)
-    {
-      removeSyntax(element);
-      return true;
+        final MatchingRule element = numericOID2MatchingRules.get(name);
+        if (element != null) {
+            removeMatchingRule(element);
+            return true;
+        }
+        final List<MatchingRule> elements = name2MatchingRules.get(toLowerCase(name));
+        if (elements != null) {
+            for (final MatchingRule e : elements) {
+                removeMatchingRule(e);
+            }
+            return true;
+        }
+        return false;
     }
-    return false;
-  }
 
+    /**
+     * Removes the named matching rule use from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the matching rule use to be removed.
+     * @return {@code true} if the matching rule use was found.
+     */
+    public boolean removeMatchingRuleUse(final String name) {
+        lazyInitBuilder();
 
-
-  /**
-   * Returns a strict {@code Schema} containing all of the schema elements
-   * contained in this schema builder as well as the same set of schema
-   * compatibility options.
-   * <p>
-   * This method does not alter the contents of this schema builder.
-   *
-   * @return A {@code Schema} containing all of the schema elements contained in
-   *         this schema builder as well as the same set of schema compatibility
-   *         options
-   */
-  public Schema toSchema()
-  {
-    // If this schema builder was initialized from another schema and no
-    // modifications have been made since then we can simply return the original
-    // schema.
-    if (copyOnWriteSchema != null)
-    {
-      return copyOnWriteSchema;
+        final MatchingRuleUse element = numericOID2MatchingRuleUses.get(name);
+        if (element != null) {
+            removeMatchingRuleUse(element);
+            return true;
+        }
+        final List<MatchingRuleUse> elements = name2MatchingRuleUses.get(toLowerCase(name));
+        if (elements != null) {
+            for (final MatchingRuleUse e : elements) {
+                removeMatchingRuleUse(e);
+            }
+            return true;
+        }
+        return false;
     }
 
-    // We still need to ensure that this builder has been initialized (otherwise
-    // some fields may still be null).
-    lazyInitBuilder();
+    /**
+     * Removes the named name form from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the name form to be removed.
+     * @return {@code true} if the name form was found.
+     */
+    public boolean removeNameForm(final String name) {
+        lazyInitBuilder();
 
-    final String localSchemaName;
-    if (schemaName != null)
-    {
-      localSchemaName = schemaName;
-    }
-    else
-    {
-      localSchemaName = String.format("Schema#%d",
-          NEXT_SCHEMA_ID.getAndIncrement());
+        final NameForm element = numericOID2NameForms.get(name);
+        if (element != null) {
+            removeNameForm(element);
+            return true;
+        }
+        final List<NameForm> elements = name2NameForms.get(toLowerCase(name));
+        if (elements != null) {
+            for (final NameForm e : elements) {
+                removeNameForm(e);
+            }
+            return true;
+        }
+        return false;
     }
 
-    final Schema schema = new Schema(localSchemaName,
-        allowMalformedNamesAndOptions, allowNonStandardTelephoneNumbers,
-        allowZeroLengthDirectoryStrings, numericOID2Syntaxes,
-        numericOID2MatchingRules, numericOID2MatchingRuleUses,
-        numericOID2AttributeTypes, numericOID2ObjectClasses,
-        numericOID2NameForms, numericOID2ContentRules, id2StructureRules,
-        name2MatchingRules, name2MatchingRuleUses, name2AttributeTypes,
-        name2ObjectClasses, name2NameForms, name2ContentRules,
-        name2StructureRules, objectClass2NameForms, nameForm2StructureRules,
-        warnings);
+    /**
+     * Removes the named object class from this schema builder.
+     *
+     * @param name
+     *            The name or OID of the object class to be removed.
+     * @return {@code true} if the object class was found.
+     */
+    public boolean removeObjectClass(final String name) {
+        lazyInitBuilder();
 
-    validate(schema);
-
-    // Re-init this builder so that it can continue to be used afterwards.
-    preLazyInitBuilder(schemaName, schema);
-
-    return schema;
-  }
-
-
-
-  private void addAttributeType(final AttributeType attribute,
-      final boolean overwrite)
-  {
-    AttributeType conflictingAttribute;
-    if (numericOID2AttributeTypes.containsKey(attribute.getOID()))
-    {
-      conflictingAttribute = numericOID2AttributeTypes.get(attribute.getOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_ATTRIBUTE_OID
-            .get(attribute.getNameOrOID(), attribute.getOID(),
-                conflictingAttribute.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeAttributeType(conflictingAttribute);
-    }
-
-    numericOID2AttributeTypes.put(attribute.getOID(), attribute);
-    for (final String name : attribute.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<AttributeType> attrs;
-      if ((attrs = name2AttributeTypes.get(lowerName)) == null)
-      {
-        name2AttributeTypes
-            .put(lowerName, Collections.singletonList(attribute));
-      }
-      else if (attrs.size() == 1)
-      {
-        attrs = new ArrayList<AttributeType>(attrs);
-        attrs.add(attribute);
-        name2AttributeTypes.put(lowerName, attrs);
-      }
-      else
-      {
-        attrs.add(attribute);
-      }
+        final ObjectClass element = numericOID2ObjectClasses.get(name);
+        if (element != null) {
+            removeObjectClass(element);
+            return true;
+        }
+        final List<ObjectClass> elements = name2ObjectClasses.get(toLowerCase(name));
+        if (elements != null) {
+            for (final ObjectClass e : elements) {
+                removeObjectClass(e);
+            }
+            return true;
+        }
+        return false;
     }
-  }
 
+    /**
+     * Removes the named syntax from this schema builder.
+     *
+     * @param numericOID
+     *            The name of the syntax to be removed.
+     * @return {@code true} if the syntax was found.
+     */
+    public boolean removeSyntax(final String numericOID) {
+        lazyInitBuilder();
 
-
-  private void addDITContentRule(final DITContentRule rule,
-      final boolean overwrite)
-  {
-    DITContentRule conflictingRule;
-    if (numericOID2ContentRules.containsKey(rule.getStructuralClassOID()))
-    {
-      conflictingRule = numericOID2ContentRules.get(rule
-          .getStructuralClassOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE1
-            .get(rule.getNameOrOID(), rule.getStructuralClassOID(),
-                conflictingRule.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeDITContentRule(conflictingRule);
+        final Syntax element = numericOID2Syntaxes.get(numericOID);
+        if (element != null) {
+            removeSyntax(element);
+            return true;
+        }
+        return false;
     }
 
-    numericOID2ContentRules.put(rule.getStructuralClassOID(), rule);
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<DITContentRule> rules;
-      if ((rules = name2ContentRules.get(lowerName)) == null)
-      {
-        name2ContentRules.put(lowerName, Collections.singletonList(rule));
-      }
-      else if (rules.size() == 1)
-      {
-        rules = new ArrayList<DITContentRule>(rules);
-        rules.add(rule);
-        name2ContentRules.put(lowerName, rules);
-      }
-      else
-      {
-        rules.add(rule);
-      }
-    }
-  }
-
-
+    /**
+     * Returns a strict {@code Schema} containing all of the schema elements
+     * contained in this schema builder as well as the same set of schema
+     * compatibility options.
+     * <p>
+     * This method does not alter the contents of this schema builder.
+     *
+     * @return A {@code Schema} containing all of the schema elements contained
+     *         in this schema builder as well as the same set of schema
+     *         compatibility options
+     */
+    public Schema toSchema() {
+        // If this schema builder was initialized from another schema and no
+        // modifications have been made since then we can simply return the
+        // original
+        // schema.
+        if (copyOnWriteSchema != null) {
+            return copyOnWriteSchema;
+        }
 
-  private void addDITStructureRule(final DITStructureRule rule,
-      final boolean overwrite)
-  {
-    DITStructureRule conflictingRule;
-    if (id2StructureRules.containsKey(rule.getRuleID()))
-    {
-      conflictingRule = id2StructureRules.get(rule.getRuleID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_STRUCTURE_RULE_ID
-            .get(rule.getNameOrRuleID(), rule.getRuleID(),
-                conflictingRule.getNameOrRuleID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeDITStructureRule(conflictingRule);
-    }
+        // We still need to ensure that this builder has been initialized
+        // (otherwise
+        // some fields may still be null).
+        lazyInitBuilder();
 
-    id2StructureRules.put(rule.getRuleID(), rule);
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<DITStructureRule> rules;
-      if ((rules = name2StructureRules.get(lowerName)) == null)
-      {
-        name2StructureRules.put(lowerName, Collections.singletonList(rule));
-      }
-      else if (rules.size() == 1)
-      {
-        rules = new ArrayList<DITStructureRule>(rules);
-        rules.add(rule);
-        name2StructureRules.put(lowerName, rules);
-      }
-      else
-      {
-        rules.add(rule);
-      }
-    }
-  }
+        final String localSchemaName;
+        if (schemaName != null) {
+            localSchemaName = schemaName;
+        } else {
+            localSchemaName = String.format("Schema#%d", NEXT_SCHEMA_ID.getAndIncrement());
+        }
 
+        final Schema schema =
+                new Schema(localSchemaName, allowMalformedNamesAndOptions,
+                        allowNonStandardTelephoneNumbers, allowZeroLengthDirectoryStrings,
+                        numericOID2Syntaxes, numericOID2MatchingRules, numericOID2MatchingRuleUses,
+                        numericOID2AttributeTypes, numericOID2ObjectClasses, numericOID2NameForms,
+                        numericOID2ContentRules, id2StructureRules, name2MatchingRules,
+                        name2MatchingRuleUses, name2AttributeTypes, name2ObjectClasses,
+                        name2NameForms, name2ContentRules, name2StructureRules,
+                        objectClass2NameForms, nameForm2StructureRules, warnings);
 
+        validate(schema);
 
-  private void addMatchingRule(final MatchingRule rule, final boolean overwrite)
-  {
-    MatchingRule conflictingRule;
-    if (numericOID2MatchingRules.containsKey(rule.getOID()))
-    {
-      conflictingRule = numericOID2MatchingRules.get(rule.getOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MR_OID.get(
-            rule.getNameOrOID(), rule.getOID(), conflictingRule.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeMatchingRule(conflictingRule);
-    }
+        // Re-init this builder so that it can continue to be used afterwards.
+        preLazyInitBuilder(schemaName, schema);
 
-    numericOID2MatchingRules.put(rule.getOID(), rule);
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<MatchingRule> rules;
-      if ((rules = name2MatchingRules.get(lowerName)) == null)
-      {
-        name2MatchingRules.put(lowerName, Collections.singletonList(rule));
-      }
-      else if (rules.size() == 1)
-      {
-        rules = new ArrayList<MatchingRule>(rules);
-        rules.add(rule);
-        name2MatchingRules.put(lowerName, rules);
-      }
-      else
-      {
-        rules.add(rule);
-      }
+        return schema;
     }
-  }
 
+    private void addAttributeType(final AttributeType attribute, final boolean overwrite) {
+        AttributeType conflictingAttribute;
+        if (numericOID2AttributeTypes.containsKey(attribute.getOID())) {
+            conflictingAttribute = numericOID2AttributeTypes.get(attribute.getOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_ATTRIBUTE_OID.get(attribute.getNameOrOID(),
+                                attribute.getOID(), conflictingAttribute.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeAttributeType(conflictingAttribute);
+        }
 
-
-  private void addMatchingRuleUse(final MatchingRuleUse use,
-      final boolean overwrite)
-  {
-    MatchingRuleUse conflictingUse;
-    if (numericOID2MatchingRuleUses.containsKey(use.getMatchingRuleOID()))
-    {
-      conflictingUse = numericOID2MatchingRuleUses
-          .get(use.getMatchingRuleOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE
-            .get(use.getNameOrOID(), use.getMatchingRuleOID(),
-                conflictingUse.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeMatchingRuleUse(conflictingUse);
+        numericOID2AttributeTypes.put(attribute.getOID(), attribute);
+        for (final String name : attribute.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<AttributeType> attrs;
+            if ((attrs = name2AttributeTypes.get(lowerName)) == null) {
+                name2AttributeTypes.put(lowerName, Collections.singletonList(attribute));
+            } else if (attrs.size() == 1) {
+                attrs = new ArrayList<AttributeType>(attrs);
+                attrs.add(attribute);
+                name2AttributeTypes.put(lowerName, attrs);
+            } else {
+                attrs.add(attribute);
+            }
+        }
     }
 
-    numericOID2MatchingRuleUses.put(use.getMatchingRuleOID(), use);
-    for (final String name : use.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<MatchingRuleUse> uses;
-      if ((uses = name2MatchingRuleUses.get(lowerName)) == null)
-      {
-        name2MatchingRuleUses.put(lowerName, Collections.singletonList(use));
-      }
-      else if (uses.size() == 1)
-      {
-        uses = new ArrayList<MatchingRuleUse>(uses);
-        uses.add(use);
-        name2MatchingRuleUses.put(lowerName, uses);
-      }
-      else
-      {
-        uses.add(use);
-      }
-    }
-  }
+    private void addDITContentRule(final DITContentRule rule, final boolean overwrite) {
+        DITContentRule conflictingRule;
+        if (numericOID2ContentRules.containsKey(rule.getStructuralClassOID())) {
+            conflictingRule = numericOID2ContentRules.get(rule.getStructuralClassOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE1.get(rule.getNameOrOID(), rule
+                                .getStructuralClassOID(), conflictingRule.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeDITContentRule(conflictingRule);
+        }
 
-
-
-  private void addNameForm(final NameForm form, final boolean overwrite)
-  {
-    NameForm conflictingForm;
-    if (numericOID2NameForms.containsKey(form.getOID()))
-    {
-      conflictingForm = numericOID2NameForms.get(form.getOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_NAME_FORM_OID
-            .get(form.getNameOrOID(), form.getOID(),
-                conflictingForm.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeNameForm(conflictingForm);
-    }
-
-    numericOID2NameForms.put(form.getOID(), form);
-    for (final String name : form.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<NameForm> forms;
-      if ((forms = name2NameForms.get(lowerName)) == null)
-      {
-        name2NameForms.put(lowerName, Collections.singletonList(form));
-      }
-      else if (forms.size() == 1)
-      {
-        forms = new ArrayList<NameForm>(forms);
-        forms.add(form);
-        name2NameForms.put(lowerName, forms);
-      }
-      else
-      {
-        forms.add(form);
-      }
+        numericOID2ContentRules.put(rule.getStructuralClassOID(), rule);
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<DITContentRule> rules;
+            if ((rules = name2ContentRules.get(lowerName)) == null) {
+                name2ContentRules.put(lowerName, Collections.singletonList(rule));
+            } else if (rules.size() == 1) {
+                rules = new ArrayList<DITContentRule>(rules);
+                rules.add(rule);
+                name2ContentRules.put(lowerName, rules);
+            } else {
+                rules.add(rule);
+            }
+        }
     }
-  }
 
+    private void addDITStructureRule(final DITStructureRule rule, final boolean overwrite) {
+        DITStructureRule conflictingRule;
+        if (id2StructureRules.containsKey(rule.getRuleID())) {
+            conflictingRule = id2StructureRules.get(rule.getRuleID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_DIT_STRUCTURE_RULE_ID.get(rule.getNameOrRuleID(),
+                                rule.getRuleID(), conflictingRule.getNameOrRuleID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeDITStructureRule(conflictingRule);
+        }
 
-
-  private void addObjectClass(final ObjectClass oc, final boolean overwrite)
-  {
-    ObjectClass conflictingOC;
-    if (numericOID2ObjectClasses.containsKey(oc.getOID()))
-    {
-      conflictingOC = numericOID2ObjectClasses.get(oc.getOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_OBJECTCLASS_OID1
-            .get(oc.getNameOrOID(), oc.getOID(), conflictingOC.getNameOrOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeObjectClass(conflictingOC);
+        id2StructureRules.put(rule.getRuleID(), rule);
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<DITStructureRule> rules;
+            if ((rules = name2StructureRules.get(lowerName)) == null) {
+                name2StructureRules.put(lowerName, Collections.singletonList(rule));
+            } else if (rules.size() == 1) {
+                rules = new ArrayList<DITStructureRule>(rules);
+                rules.add(rule);
+                name2StructureRules.put(lowerName, rules);
+            } else {
+                rules.add(rule);
+            }
+        }
     }
 
-    numericOID2ObjectClasses.put(oc.getOID(), oc);
-    for (final String name : oc.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      List<ObjectClass> classes;
-      if ((classes = name2ObjectClasses.get(lowerName)) == null)
-      {
-        name2ObjectClasses.put(lowerName, Collections.singletonList(oc));
-      }
-      else if (classes.size() == 1)
-      {
-        classes = new ArrayList<ObjectClass>(classes);
-        classes.add(oc);
-        name2ObjectClasses.put(lowerName, classes);
-      }
-      else
-      {
-        classes.add(oc);
-      }
-    }
-  }
-
-
-
-  private void addSchema0(final Schema schema, final boolean overwrite)
-  {
-    // All of the schema elements must be duplicated because validation will
-    // cause them to update all their internal references which, although
-    // unlikely, may be different in the new schema.
+    private void addMatchingRule(final MatchingRule rule, final boolean overwrite) {
+        MatchingRule conflictingRule;
+        if (numericOID2MatchingRules.containsKey(rule.getOID())) {
+            conflictingRule = numericOID2MatchingRules.get(rule.getOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_MR_OID.get(rule.getNameOrOID(), rule.getOID(),
+                                conflictingRule.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeMatchingRule(conflictingRule);
+        }
 
-    for (final Syntax syntax : schema.getSyntaxes())
-    {
-      addSyntax(syntax.duplicate(), overwrite);
+        numericOID2MatchingRules.put(rule.getOID(), rule);
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<MatchingRule> rules;
+            if ((rules = name2MatchingRules.get(lowerName)) == null) {
+                name2MatchingRules.put(lowerName, Collections.singletonList(rule));
+            } else if (rules.size() == 1) {
+                rules = new ArrayList<MatchingRule>(rules);
+                rules.add(rule);
+                name2MatchingRules.put(lowerName, rules);
+            } else {
+                rules.add(rule);
+            }
+        }
     }
 
-    for (final MatchingRule matchingRule : schema.getMatchingRules())
-    {
-      addMatchingRule(matchingRule.duplicate(), overwrite);
-    }
+    private void addMatchingRuleUse(final MatchingRuleUse use, final boolean overwrite) {
+        MatchingRuleUse conflictingUse;
+        if (numericOID2MatchingRuleUses.containsKey(use.getMatchingRuleOID())) {
+            conflictingUse = numericOID2MatchingRuleUses.get(use.getMatchingRuleOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE.get(use.getNameOrOID(), use
+                                .getMatchingRuleOID(), conflictingUse.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeMatchingRuleUse(conflictingUse);
+        }
 
-    for (final MatchingRuleUse matchingRuleUse : schema.getMatchingRuleUses())
-    {
-      addMatchingRuleUse(matchingRuleUse.duplicate(), overwrite);
+        numericOID2MatchingRuleUses.put(use.getMatchingRuleOID(), use);
+        for (final String name : use.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<MatchingRuleUse> uses;
+            if ((uses = name2MatchingRuleUses.get(lowerName)) == null) {
+                name2MatchingRuleUses.put(lowerName, Collections.singletonList(use));
+            } else if (uses.size() == 1) {
+                uses = new ArrayList<MatchingRuleUse>(uses);
+                uses.add(use);
+                name2MatchingRuleUses.put(lowerName, uses);
+            } else {
+                uses.add(use);
+            }
+        }
     }
 
-    for (final AttributeType attributeType : schema.getAttributeTypes())
-    {
-      addAttributeType(attributeType.duplicate(), overwrite);
-    }
-
-    for (final ObjectClass objectClass : schema.getObjectClasses())
-    {
-      addObjectClass(objectClass.duplicate(), overwrite);
-    }
+    private void addNameForm(final NameForm form, final boolean overwrite) {
+        NameForm conflictingForm;
+        if (numericOID2NameForms.containsKey(form.getOID())) {
+            conflictingForm = numericOID2NameForms.get(form.getOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_NAME_FORM_OID.get(form.getNameOrOID(),
+                                form.getOID(), conflictingForm.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeNameForm(conflictingForm);
+        }
 
-    for (final NameForm nameForm : schema.getNameForms())
-    {
-      addNameForm(nameForm.duplicate(), overwrite);
+        numericOID2NameForms.put(form.getOID(), form);
+        for (final String name : form.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<NameForm> forms;
+            if ((forms = name2NameForms.get(lowerName)) == null) {
+                name2NameForms.put(lowerName, Collections.singletonList(form));
+            } else if (forms.size() == 1) {
+                forms = new ArrayList<NameForm>(forms);
+                forms.add(form);
+                name2NameForms.put(lowerName, forms);
+            } else {
+                forms.add(form);
+            }
+        }
     }
 
-    for (final DITContentRule contentRule : schema.getDITContentRules())
-    {
-      addDITContentRule(contentRule.duplicate(), overwrite);
-    }
+    private void addObjectClass(final ObjectClass oc, final boolean overwrite) {
+        ObjectClass conflictingOC;
+        if (numericOID2ObjectClasses.containsKey(oc.getOID())) {
+            conflictingOC = numericOID2ObjectClasses.get(oc.getOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_OBJECTCLASS_OID1.get(oc.getNameOrOID(), oc.getOID(),
+                                conflictingOC.getNameOrOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeObjectClass(conflictingOC);
+        }
 
-    for (final DITStructureRule structureRule : schema.getDITStuctureRules())
-    {
-      addDITStructureRule(structureRule.duplicate(), overwrite);
+        numericOID2ObjectClasses.put(oc.getOID(), oc);
+        for (final String name : oc.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            List<ObjectClass> classes;
+            if ((classes = name2ObjectClasses.get(lowerName)) == null) {
+                name2ObjectClasses.put(lowerName, Collections.singletonList(oc));
+            } else if (classes.size() == 1) {
+                classes = new ArrayList<ObjectClass>(classes);
+                classes.add(oc);
+                name2ObjectClasses.put(lowerName, classes);
+            } else {
+                classes.add(oc);
+            }
+        }
     }
-  }
 
+    private void addSchema0(final Schema schema, final boolean overwrite) {
+        // All of the schema elements must be duplicated because validation will
+        // cause them to update all their internal references which, although
+        // unlikely, may be different in the new schema.
 
+        for (final Syntax syntax : schema.getSyntaxes()) {
+            addSyntax(syntax.duplicate(), overwrite);
+        }
 
-  private void addSyntax(final Syntax syntax, final boolean overwrite)
-  {
-    Syntax conflictingSyntax;
-    if (numericOID2Syntaxes.containsKey(syntax.getOID()))
-    {
-      conflictingSyntax = numericOID2Syntaxes.get(syntax.getOID());
-      if (!overwrite)
-      {
-        final LocalizableMessage message = ERR_SCHEMA_CONFLICTING_SYNTAX_OID
-            .get(syntax.toString(), syntax.getOID(), conflictingSyntax.getOID());
-        throw new ConflictingSchemaElementException(message);
-      }
-      removeSyntax(conflictingSyntax);
-    }
-    numericOID2Syntaxes.put(syntax.getOID(), syntax);
-  }
+        for (final MatchingRule matchingRule : schema.getMatchingRules()) {
+            addMatchingRule(matchingRule.duplicate(), overwrite);
+        }
 
+        for (final MatchingRuleUse matchingRuleUse : schema.getMatchingRuleUses()) {
+            addMatchingRuleUse(matchingRuleUse.duplicate(), overwrite);
+        }
 
+        for (final AttributeType attributeType : schema.getAttributeTypes()) {
+            addAttributeType(attributeType.duplicate(), overwrite);
+        }
 
-  private void lazyInitBuilder()
-  {
-    // Lazy initialization.
-    if (numericOID2Syntaxes == null)
-    {
-      allowMalformedNamesAndOptions = true;
-      allowNonStandardTelephoneNumbers = true;
-      allowZeroLengthDirectoryStrings = false;
+        for (final ObjectClass objectClass : schema.getObjectClasses()) {
+            addObjectClass(objectClass.duplicate(), overwrite);
+        }
 
-      numericOID2Syntaxes = new LinkedHashMap<String, Syntax>();
-      numericOID2MatchingRules = new LinkedHashMap<String, MatchingRule>();
-      numericOID2MatchingRuleUses = new LinkedHashMap<String, MatchingRuleUse>();
-      numericOID2AttributeTypes = new LinkedHashMap<String, AttributeType>();
-      numericOID2ObjectClasses = new LinkedHashMap<String, ObjectClass>();
-      numericOID2NameForms = new LinkedHashMap<String, NameForm>();
-      numericOID2ContentRules = new LinkedHashMap<String, DITContentRule>();
-      id2StructureRules = new LinkedHashMap<Integer, DITStructureRule>();
+        for (final NameForm nameForm : schema.getNameForms()) {
+            addNameForm(nameForm.duplicate(), overwrite);
+        }
 
-      name2MatchingRules = new LinkedHashMap<String, List<MatchingRule>>();
-      name2MatchingRuleUses = new LinkedHashMap<String, List<MatchingRuleUse>>();
-      name2AttributeTypes = new LinkedHashMap<String, List<AttributeType>>();
-      name2ObjectClasses = new LinkedHashMap<String, List<ObjectClass>>();
-      name2NameForms = new LinkedHashMap<String, List<NameForm>>();
-      name2ContentRules = new LinkedHashMap<String, List<DITContentRule>>();
-      name2StructureRules = new LinkedHashMap<String, List<DITStructureRule>>();
+        for (final DITContentRule contentRule : schema.getDITContentRules()) {
+            addDITContentRule(contentRule.duplicate(), overwrite);
+        }
 
-      objectClass2NameForms = new HashMap<String, List<NameForm>>();
-      nameForm2StructureRules = new HashMap<String, List<DITStructureRule>>();
-      warnings = new LinkedList<LocalizableMessage>();
+        for (final DITStructureRule structureRule : schema.getDITStuctureRules()) {
+            addDITStructureRule(structureRule.duplicate(), overwrite);
+        }
     }
 
-    if (copyOnWriteSchema != null)
-    {
-      // Copy the schema.
-      addSchema0(copyOnWriteSchema, true);
-
-      allowMalformedNamesAndOptions = copyOnWriteSchema
-          .allowMalformedNamesAndOptions();
-      allowNonStandardTelephoneNumbers = copyOnWriteSchema
-          .allowNonStandardTelephoneNumbers();
-      allowZeroLengthDirectoryStrings = copyOnWriteSchema
-          .allowZeroLengthDirectoryStrings();
-
-      copyOnWriteSchema = null;
+    private void addSyntax(final Syntax syntax, final boolean overwrite) {
+        Syntax conflictingSyntax;
+        if (numericOID2Syntaxes.containsKey(syntax.getOID())) {
+            conflictingSyntax = numericOID2Syntaxes.get(syntax.getOID());
+            if (!overwrite) {
+                final LocalizableMessage message =
+                        ERR_SCHEMA_CONFLICTING_SYNTAX_OID.get(syntax.toString(), syntax.getOID(),
+                                conflictingSyntax.getOID());
+                throw new ConflictingSchemaElementException(message);
+            }
+            removeSyntax(conflictingSyntax);
+        }
+        numericOID2Syntaxes.put(syntax.getOID(), syntax);
     }
-  }
 
+    private void lazyInitBuilder() {
+        // Lazy initialization.
+        if (numericOID2Syntaxes == null) {
+            allowMalformedNamesAndOptions = true;
+            allowNonStandardTelephoneNumbers = true;
+            allowZeroLengthDirectoryStrings = false;
 
+            numericOID2Syntaxes = new LinkedHashMap<String, Syntax>();
+            numericOID2MatchingRules = new LinkedHashMap<String, MatchingRule>();
+            numericOID2MatchingRuleUses = new LinkedHashMap<String, MatchingRuleUse>();
+            numericOID2AttributeTypes = new LinkedHashMap<String, AttributeType>();
+            numericOID2ObjectClasses = new LinkedHashMap<String, ObjectClass>();
+            numericOID2NameForms = new LinkedHashMap<String, NameForm>();
+            numericOID2ContentRules = new LinkedHashMap<String, DITContentRule>();
+            id2StructureRules = new LinkedHashMap<Integer, DITStructureRule>();
 
-  private void preLazyInitBuilder(final String schemaName,
-      final Schema copyOnWriteSchema)
-  {
-    this.schemaName = schemaName;
-    this.copyOnWriteSchema = copyOnWriteSchema;
-
-    this.allowMalformedNamesAndOptions = true;
-    this.allowNonStandardTelephoneNumbers = true;
-    this.allowZeroLengthDirectoryStrings = false;
-
-    this.numericOID2Syntaxes = null;
-    this.numericOID2MatchingRules = null;
-    this.numericOID2MatchingRuleUses = null;
-    this.numericOID2AttributeTypes = null;
-    this.numericOID2ObjectClasses = null;
-    this.numericOID2NameForms = null;
-    this.numericOID2ContentRules = null;
-    this.id2StructureRules = null;
-
-    this.name2MatchingRules = null;
-    this.name2MatchingRuleUses = null;
-    this.name2AttributeTypes = null;
-    this.name2ObjectClasses = null;
-    this.name2NameForms = null;
-    this.name2ContentRules = null;
-    this.name2StructureRules = null;
+            name2MatchingRules = new LinkedHashMap<String, List<MatchingRule>>();
+            name2MatchingRuleUses = new LinkedHashMap<String, List<MatchingRuleUse>>();
+            name2AttributeTypes = new LinkedHashMap<String, List<AttributeType>>();
+            name2ObjectClasses = new LinkedHashMap<String, List<ObjectClass>>();
+            name2NameForms = new LinkedHashMap<String, List<NameForm>>();
+            name2ContentRules = new LinkedHashMap<String, List<DITContentRule>>();
+            name2StructureRules = new LinkedHashMap<String, List<DITStructureRule>>();
 
-    this.objectClass2NameForms = null;
-    this.nameForm2StructureRules = null;
-    this.warnings = null;
-  }
+            objectClass2NameForms = new HashMap<String, List<NameForm>>();
+            nameForm2StructureRules = new HashMap<String, List<DITStructureRule>>();
+            warnings = new LinkedList<LocalizableMessage>();
+        }
 
+        if (copyOnWriteSchema != null) {
+            // Copy the schema.
+            addSchema0(copyOnWriteSchema, true);
 
+            allowMalformedNamesAndOptions = copyOnWriteSchema.allowMalformedNamesAndOptions();
+            allowNonStandardTelephoneNumbers = copyOnWriteSchema.allowNonStandardTelephoneNumbers();
+            allowZeroLengthDirectoryStrings = copyOnWriteSchema.allowZeroLengthDirectoryStrings();
 
-  private void removeAttributeType(final AttributeType attributeType)
-  {
-    numericOID2AttributeTypes.remove(attributeType.getOID());
-    for (final String name : attributeType.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<AttributeType> attributes = name2AttributeTypes.get(lowerName);
-      if (attributes != null && attributes.contains(attributeType))
-      {
-        if (attributes.size() <= 1)
-        {
-          name2AttributeTypes.remove(lowerName);
-        }
-        else
-        {
-          attributes.remove(attributeType);
+            copyOnWriteSchema = null;
         }
-      }
     }
-  }
 
+    private void preLazyInitBuilder(final String schemaName, final Schema copyOnWriteSchema) {
+        this.schemaName = schemaName;
+        this.copyOnWriteSchema = copyOnWriteSchema;
 
+        this.allowMalformedNamesAndOptions = true;
+        this.allowNonStandardTelephoneNumbers = true;
+        this.allowZeroLengthDirectoryStrings = false;
 
-  private void removeDITContentRule(final DITContentRule rule)
-  {
-    numericOID2ContentRules.remove(rule.getStructuralClassOID());
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<DITContentRule> rules = name2ContentRules.get(lowerName);
-      if (rules != null && rules.contains(rule))
-      {
-        if (rules.size() <= 1)
-        {
-          name2AttributeTypes.remove(lowerName);
-        }
-        else
-        {
-          rules.remove(rule);
-        }
-      }
-    }
-  }
+        this.numericOID2Syntaxes = null;
+        this.numericOID2MatchingRules = null;
+        this.numericOID2MatchingRuleUses = null;
+        this.numericOID2AttributeTypes = null;
+        this.numericOID2ObjectClasses = null;
+        this.numericOID2NameForms = null;
+        this.numericOID2ContentRules = null;
+        this.id2StructureRules = null;
 
+        this.name2MatchingRules = null;
+        this.name2MatchingRuleUses = null;
+        this.name2AttributeTypes = null;
+        this.name2ObjectClasses = null;
+        this.name2NameForms = null;
+        this.name2ContentRules = null;
+        this.name2StructureRules = null;
 
+        this.objectClass2NameForms = null;
+        this.nameForm2StructureRules = null;
+        this.warnings = null;
+    }
 
-  private void removeDITStructureRule(final DITStructureRule rule)
-  {
-    id2StructureRules.remove(rule.getRuleID());
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<DITStructureRule> rules = name2StructureRules.get(lowerName);
-      if (rules != null && rules.contains(rule))
-      {
-        if (rules.size() <= 1)
-        {
-          name2StructureRules.remove(lowerName);
-        }
-        else
-        {
-          rules.remove(rule);
+    private void removeAttributeType(final AttributeType attributeType) {
+        numericOID2AttributeTypes.remove(attributeType.getOID());
+        for (final String name : attributeType.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<AttributeType> attributes = name2AttributeTypes.get(lowerName);
+            if (attributes != null && attributes.contains(attributeType)) {
+                if (attributes.size() <= 1) {
+                    name2AttributeTypes.remove(lowerName);
+                } else {
+                    attributes.remove(attributeType);
+                }
+            }
         }
-      }
     }
-  }
-
-
 
-  private void removeMatchingRule(final MatchingRule rule)
-  {
-    numericOID2MatchingRules.remove(rule.getOID());
-    for (final String name : rule.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<MatchingRule> rules = name2MatchingRules.get(lowerName);
-      if (rules != null && rules.contains(rule))
-      {
-        if (rules.size() <= 1)
-        {
-          name2MatchingRules.remove(lowerName);
-        }
-        else
-        {
-          rules.remove(rule);
+    private void removeDITContentRule(final DITContentRule rule) {
+        numericOID2ContentRules.remove(rule.getStructuralClassOID());
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<DITContentRule> rules = name2ContentRules.get(lowerName);
+            if (rules != null && rules.contains(rule)) {
+                if (rules.size() <= 1) {
+                    name2AttributeTypes.remove(lowerName);
+                } else {
+                    rules.remove(rule);
+                }
+            }
         }
-      }
     }
-  }
 
-
-
-  private void removeMatchingRuleUse(final MatchingRuleUse use)
-  {
-    numericOID2MatchingRuleUses.remove(use.getMatchingRuleOID());
-    for (final String name : use.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<MatchingRuleUse> uses = name2MatchingRuleUses.get(lowerName);
-      if (uses != null && uses.contains(use))
-      {
-        if (uses.size() <= 1)
-        {
-          name2MatchingRuleUses.remove(lowerName);
-        }
-        else
-        {
-          uses.remove(use);
+    private void removeDITStructureRule(final DITStructureRule rule) {
+        id2StructureRules.remove(rule.getRuleID());
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<DITStructureRule> rules = name2StructureRules.get(lowerName);
+            if (rules != null && rules.contains(rule)) {
+                if (rules.size() <= 1) {
+                    name2StructureRules.remove(lowerName);
+                } else {
+                    rules.remove(rule);
+                }
+            }
         }
-      }
     }
-  }
 
-
-
-  private void removeNameForm(final NameForm form)
-  {
-    numericOID2NameForms.remove(form.getOID());
-    name2NameForms.remove(form.getOID());
-    for (final String name : form.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<NameForm> forms = name2NameForms.get(lowerName);
-      if (forms != null && forms.contains(form))
-      {
-        if (forms.size() <= 1)
-        {
-          name2NameForms.remove(lowerName);
-        }
-        else
-        {
-          forms.remove(form);
+    private void removeMatchingRule(final MatchingRule rule) {
+        numericOID2MatchingRules.remove(rule.getOID());
+        for (final String name : rule.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<MatchingRule> rules = name2MatchingRules.get(lowerName);
+            if (rules != null && rules.contains(rule)) {
+                if (rules.size() <= 1) {
+                    name2MatchingRules.remove(lowerName);
+                } else {
+                    rules.remove(rule);
+                }
+            }
         }
-      }
     }
-  }
-
-
 
-  private void removeObjectClass(final ObjectClass oc)
-  {
-    numericOID2ObjectClasses.remove(oc.getOID());
-    name2ObjectClasses.remove(oc.getOID());
-    for (final String name : oc.getNames())
-    {
-      final String lowerName = StaticUtils.toLowerCase(name);
-      final List<ObjectClass> classes = name2ObjectClasses.get(lowerName);
-      if (classes != null && classes.contains(oc))
-      {
-        if (classes.size() <= 1)
-        {
-          name2ObjectClasses.remove(lowerName);
-        }
-        else
-        {
-          classes.remove(oc);
+    private void removeMatchingRuleUse(final MatchingRuleUse use) {
+        numericOID2MatchingRuleUses.remove(use.getMatchingRuleOID());
+        for (final String name : use.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<MatchingRuleUse> uses = name2MatchingRuleUses.get(lowerName);
+            if (uses != null && uses.contains(use)) {
+                if (uses.size() <= 1) {
+                    name2MatchingRuleUses.remove(lowerName);
+                } else {
+                    uses.remove(use);
+                }
+            }
         }
-      }
     }
-  }
 
-
-
-  private void removeSyntax(final Syntax syntax)
-  {
-    numericOID2Syntaxes.remove(syntax.getOID());
-  }
-
-
-
-  private void validate(final Schema schema)
-  {
-    // Verify all references in all elements
-    for (final Syntax syntax : numericOID2Syntaxes.values().toArray(
-        new Syntax[numericOID2Syntaxes.values().size()]))
-    {
-      try
-      {
-        syntax.validate(schema, warnings);
-      }
-      catch (final SchemaException e)
-      {
-        removeSyntax(syntax);
-        warnings.add(ERR_SYNTAX_VALIDATION_FAIL.get(syntax.toString(),
-            e.getMessageObject()));
-      }
+    private void removeNameForm(final NameForm form) {
+        numericOID2NameForms.remove(form.getOID());
+        name2NameForms.remove(form.getOID());
+        for (final String name : form.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<NameForm> forms = name2NameForms.get(lowerName);
+            if (forms != null && forms.contains(form)) {
+                if (forms.size() <= 1) {
+                    name2NameForms.remove(lowerName);
+                } else {
+                    forms.remove(form);
+                }
+            }
+        }
     }
 
-    for (final MatchingRule rule : numericOID2MatchingRules.values().toArray(
-        new MatchingRule[numericOID2MatchingRules.values().size()]))
-    {
-      try
-      {
-        rule.validate(schema, warnings);
-      }
-      catch (final SchemaException e)
-      {
-        removeMatchingRule(rule);
-        warnings.add(ERR_MR_VALIDATION_FAIL.get(rule.toString(),
-            e.getMessageObject()));
-      }
+    private void removeObjectClass(final ObjectClass oc) {
+        numericOID2ObjectClasses.remove(oc.getOID());
+        name2ObjectClasses.remove(oc.getOID());
+        for (final String name : oc.getNames()) {
+            final String lowerName = StaticUtils.toLowerCase(name);
+            final List<ObjectClass> classes = name2ObjectClasses.get(lowerName);
+            if (classes != null && classes.contains(oc)) {
+                if (classes.size() <= 1) {
+                    name2ObjectClasses.remove(lowerName);
+                } else {
+                    classes.remove(oc);
+                }
+            }
+        }
     }
 
-    // Attribute types need special processing because they have hierarchical
-    // dependencies.
-    final List<AttributeType> invalidAttributeTypes = new LinkedList<AttributeType>();
-    for (final AttributeType attributeType : numericOID2AttributeTypes.values())
-    {
-      attributeType.validate(schema, invalidAttributeTypes, warnings);
+    private void removeSyntax(final Syntax syntax) {
+        numericOID2Syntaxes.remove(syntax.getOID());
     }
 
-    for (final AttributeType attributeType : invalidAttributeTypes)
-    {
-      removeAttributeType(attributeType);
-    }
+    private void validate(final Schema schema) {
+        // Verify all references in all elements
+        for (final Syntax syntax : numericOID2Syntaxes.values().toArray(
+                new Syntax[numericOID2Syntaxes.values().size()])) {
+            try {
+                syntax.validate(schema, warnings);
+            } catch (final SchemaException e) {
+                removeSyntax(syntax);
+                warnings.add(ERR_SYNTAX_VALIDATION_FAIL
+                        .get(syntax.toString(), e.getMessageObject()));
+            }
+        }
 
-    // Object classes need special processing because they have hierarchical
-    // dependencies.
-    final List<ObjectClass> invalidObjectClasses = new LinkedList<ObjectClass>();
-    for (final ObjectClass objectClass : numericOID2ObjectClasses.values())
-    {
-      objectClass.validate(schema, invalidObjectClasses, warnings);
-    }
+        for (final MatchingRule rule : numericOID2MatchingRules.values().toArray(
+                new MatchingRule[numericOID2MatchingRules.values().size()])) {
+            try {
+                rule.validate(schema, warnings);
+            } catch (final SchemaException e) {
+                removeMatchingRule(rule);
+                warnings.add(ERR_MR_VALIDATION_FAIL.get(rule.toString(), e.getMessageObject()));
+            }
+        }
 
-    for (final ObjectClass objectClass : invalidObjectClasses)
-    {
-      removeObjectClass(objectClass);
-    }
+        // Attribute types need special processing because they have
+        // hierarchical
+        // dependencies.
+        final List<AttributeType> invalidAttributeTypes = new LinkedList<AttributeType>();
+        for (final AttributeType attributeType : numericOID2AttributeTypes.values()) {
+            attributeType.validate(schema, invalidAttributeTypes, warnings);
+        }
 
-    for (final MatchingRuleUse use : numericOID2MatchingRuleUses.values()
-        .toArray(
-            new MatchingRuleUse[numericOID2MatchingRuleUses.values().size()]))
-    {
-      try
-      {
-        use.validate(schema, warnings);
-      }
-      catch (final SchemaException e)
-      {
-        removeMatchingRuleUse(use);
-        warnings.add(ERR_MRU_VALIDATION_FAIL.get(use.toString(),
-            e.getMessageObject()));
-      }
-    }
+        for (final AttributeType attributeType : invalidAttributeTypes) {
+            removeAttributeType(attributeType);
+        }
 
-    for (final NameForm form : numericOID2NameForms.values().toArray(
-        new NameForm[numericOID2NameForms.values().size()]))
-    {
-      try
-      {
-        form.validate(schema, warnings);
+        // Object classes need special processing because they have hierarchical
+        // dependencies.
+        final List<ObjectClass> invalidObjectClasses = new LinkedList<ObjectClass>();
+        for (final ObjectClass objectClass : numericOID2ObjectClasses.values()) {
+            objectClass.validate(schema, invalidObjectClasses, warnings);
+        }
 
-        // build the objectClass2NameForms map
-        List<NameForm> forms;
-        final String ocOID = form.getStructuralClass().getOID();
-        if ((forms = objectClass2NameForms.get(ocOID)) == null)
-        {
-          objectClass2NameForms.put(ocOID, Collections.singletonList(form));
+        for (final ObjectClass objectClass : invalidObjectClasses) {
+            removeObjectClass(objectClass);
         }
-        else if (forms.size() == 1)
-        {
-          forms = new ArrayList<NameForm>(forms);
-          forms.add(form);
-          objectClass2NameForms.put(ocOID, forms);
+
+        for (final MatchingRuleUse use : numericOID2MatchingRuleUses.values().toArray(
+                new MatchingRuleUse[numericOID2MatchingRuleUses.values().size()])) {
+            try {
+                use.validate(schema, warnings);
+            } catch (final SchemaException e) {
+                removeMatchingRuleUse(use);
+                warnings.add(ERR_MRU_VALIDATION_FAIL.get(use.toString(), e.getMessageObject()));
+            }
         }
-        else
-        {
-          forms.add(form);
+
+        for (final NameForm form : numericOID2NameForms.values().toArray(
+                new NameForm[numericOID2NameForms.values().size()])) {
+            try {
+                form.validate(schema, warnings);
+
+                // build the objectClass2NameForms map
+                List<NameForm> forms;
+                final String ocOID = form.getStructuralClass().getOID();
+                if ((forms = objectClass2NameForms.get(ocOID)) == null) {
+                    objectClass2NameForms.put(ocOID, Collections.singletonList(form));
+                } else if (forms.size() == 1) {
+                    forms = new ArrayList<NameForm>(forms);
+                    forms.add(form);
+                    objectClass2NameForms.put(ocOID, forms);
+                } else {
+                    forms.add(form);
+                }
+            } catch (final SchemaException e) {
+                removeNameForm(form);
+                warnings.add(ERR_NAMEFORM_VALIDATION_FAIL
+                        .get(form.toString(), e.getMessageObject()));
+            }
         }
-      }
-      catch (final SchemaException e)
-      {
-        removeNameForm(form);
-        warnings.add(ERR_NAMEFORM_VALIDATION_FAIL.get(form.toString(),
-            e.getMessageObject()));
-      }
-    }
 
-    for (final DITContentRule rule : numericOID2ContentRules.values().toArray(
-        new DITContentRule[numericOID2ContentRules.values().size()]))
-    {
-      try
-      {
-        rule.validate(schema, warnings);
-      }
-      catch (final SchemaException e)
-      {
-        removeDITContentRule(rule);
-        warnings.add(ERR_DCR_VALIDATION_FAIL.get(rule.toString(),
-            e.getMessageObject()));
-      }
-    }
+        for (final DITContentRule rule : numericOID2ContentRules.values().toArray(
+                new DITContentRule[numericOID2ContentRules.values().size()])) {
+            try {
+                rule.validate(schema, warnings);
+            } catch (final SchemaException e) {
+                removeDITContentRule(rule);
+                warnings.add(ERR_DCR_VALIDATION_FAIL.get(rule.toString(), e.getMessageObject()));
+            }
+        }
 
-    // DIT structure rules need special processing because they have
-    // hierarchical dependencies.
-    final List<DITStructureRule> invalidStructureRules = new LinkedList<DITStructureRule>();
-    for (final DITStructureRule rule : id2StructureRules.values())
-    {
-      rule.validate(schema, invalidStructureRules, warnings);
-    }
+        // DIT structure rules need special processing because they have
+        // hierarchical dependencies.
+        final List<DITStructureRule> invalidStructureRules = new LinkedList<DITStructureRule>();
+        for (final DITStructureRule rule : id2StructureRules.values()) {
+            rule.validate(schema, invalidStructureRules, warnings);
+        }
 
-    for (final DITStructureRule rule : invalidStructureRules)
-    {
-      removeDITStructureRule(rule);
-    }
+        for (final DITStructureRule rule : invalidStructureRules) {
+            removeDITStructureRule(rule);
+        }
 
-    for (final DITStructureRule rule : id2StructureRules.values())
-    {
-      // build the nameForm2StructureRules map
-      List<DITStructureRule> rules;
-      final String ocOID = rule.getNameForm().getOID();
-      if ((rules = nameForm2StructureRules.get(ocOID)) == null)
-      {
-        nameForm2StructureRules.put(ocOID, Collections.singletonList(rule));
-      }
-      else if (rules.size() == 1)
-      {
-        rules = new ArrayList<DITStructureRule>(rules);
-        rules.add(rule);
-        nameForm2StructureRules.put(ocOID, rules);
-      }
-      else
-      {
-        rules.add(rule);
-      }
+        for (final DITStructureRule rule : id2StructureRules.values()) {
+            // build the nameForm2StructureRules map
+            List<DITStructureRule> rules;
+            final String ocOID = rule.getNameForm().getOID();
+            if ((rules = nameForm2StructureRules.get(ocOID)) == null) {
+                nameForm2StructureRules.put(ocOID, Collections.singletonList(rule));
+            } else if (rules.size() == 1) {
+                rules = new ArrayList<DITStructureRule>(rules);
+                rules.add(rule);
+                nameForm2StructureRules.put(ocOID, rules);
+            } else {
+                rules.add(rule);
+            }
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java
index 2d667e5..cd23d79 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,1510 +25,1402 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class defines a number of constants used by Directory Server schema
  * elements, like matching rules, syntaxes, attribute types, and objectclasses.
  */
-final class SchemaConstants
-{
-  /**
-   * The IANA-assigned base OID for all things under the OpenDS umbrella.
-   */
-  public static final String OID_OPENDS_BASE = "1.3.6.1.4.1.26027";
+final class SchemaConstants {
+    /**
+     * The IANA-assigned base OID for all things under the OpenDS umbrella.
+     */
+    public static final String OID_OPENDS_BASE = "1.3.6.1.4.1.26027";
 
-  /**
-   * The base OID that will be used for the OpenDS Directory Server project.
-   */
-  public static final String OID_OPENDS_SERVER_BASE = OID_OPENDS_BASE + ".1";
+    /**
+     * The base OID that will be used for the OpenDS Directory Server project.
+     */
+    public static final String OID_OPENDS_SERVER_BASE = OID_OPENDS_BASE + ".1";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server attribute type
-   * definitions.
-   */
-  public static final String OID_OPENDS_SERVER_ATTRIBUTE_TYPE_BASE =
-    OID_OPENDS_SERVER_BASE + ".1";
+    /**
+     * The base OID that will be used for OpenDS Directory Server attribute type
+     * definitions.
+     */
+    public static final String OID_OPENDS_SERVER_ATTRIBUTE_TYPE_BASE = OID_OPENDS_SERVER_BASE
+            + ".1";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server object class
-   * definitions.
-   */
-  public static final String OID_OPENDS_SERVER_OBJECT_CLASS_BASE =
-    OID_OPENDS_SERVER_BASE + ".2";
+    /**
+     * The base OID that will be used for OpenDS Directory Server object class
+     * definitions.
+     */
+    public static final String OID_OPENDS_SERVER_OBJECT_CLASS_BASE = OID_OPENDS_SERVER_BASE + ".2";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server attribute syntax
-   * definitions.
-   */
-  public static final String OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE =
-    OID_OPENDS_SERVER_BASE + ".3";
+    /**
+     * The base OID that will be used for OpenDS Directory Server attribute
+     * syntax definitions.
+     */
+    public static final String OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE = OID_OPENDS_SERVER_BASE
+            + ".3";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server matching rule
-   * definitions.
-   */
-  public static final String OID_OPENDS_SERVER_MATCHING_RULE_BASE =
-    OID_OPENDS_SERVER_BASE + ".4";
+    /**
+     * The base OID that will be used for OpenDS Directory Server matching rule
+     * definitions.
+     */
+    public static final String OID_OPENDS_SERVER_MATCHING_RULE_BASE = OID_OPENDS_SERVER_BASE + ".4";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server control
-   * definitions.
-   */
-  public static final String OID_OPENDS_SERVER_CONTROL_BASE =
-    OID_OPENDS_SERVER_BASE + ".5";
+    /**
+     * The base OID that will be used for OpenDS Directory Server control
+     * definitions.
+     */
+    public static final String OID_OPENDS_SERVER_CONTROL_BASE = OID_OPENDS_SERVER_BASE + ".5";
 
-  /**
-   * The base OID that will be used for OpenDS Directory Server extended
-   * operation definitions.
-   */
-  public static final String OID_OPENDS_SERVER_EXTENDED_OPERATION_BASE =
-    OID_OPENDS_SERVER_BASE + ".6";
+    /**
+     * The base OID that will be used for OpenDS Directory Server extended
+     * operation definitions.
+     */
+    public static final String OID_OPENDS_SERVER_EXTENDED_OPERATION_BASE = OID_OPENDS_SERVER_BASE
+            + ".6";
 
-  /**
-   * The base OID that will be used for general-purpose (i.e., "other") types of
-   * OIDs that need to be allocated for the OpenDS Directory Server.
-   */
-  public static final String OID_OPENDS_SERVER_GENERAL_USE_BASE =
-    OID_OPENDS_SERVER_BASE + ".9";
+    /**
+     * The base OID that will be used for general-purpose (i.e., "other") types
+     * of OIDs that need to be allocated for the OpenDS Directory Server.
+     */
+    public static final String OID_OPENDS_SERVER_GENERAL_USE_BASE = OID_OPENDS_SERVER_BASE + ".9";
 
-  /**
-   * The base OID that will be used for temporary or experimental OIDs within
-   * the OpenDS Directory Server.
-   */
-  public static final String OID_OPENDS_SERVER_EXPERIMENTAL_BASE =
-    OID_OPENDS_SERVER_BASE + ".999";
+    /**
+     * The base OID that will be used for temporary or experimental OIDs within
+     * the OpenDS Directory Server.
+     */
+    public static final String OID_OPENDS_SERVER_EXPERIMENTAL_BASE = OID_OPENDS_SERVER_BASE
+            + ".999";
 
-  /**
-   * The description for the doubleMetaphoneApproximateMatch approximate
-   * matching rule.
-   */
-  public static final String AMR_DOUBLE_METAPHONE_DESCRIPTION =
-    "Double Metaphone Approximate Match";
+    /**
+     * The description for the doubleMetaphoneApproximateMatch approximate
+     * matching rule.
+     */
+    public static final String AMR_DOUBLE_METAPHONE_DESCRIPTION =
+            "Double Metaphone Approximate Match";
 
-  /**
-   * The name for the doubleMetaphoneApproximateMatch approximate matching rule.
-   */
-  public static final String AMR_DOUBLE_METAPHONE_NAME =
-    "ds-mr-double-metaphone-approx";
+    /**
+     * The name for the doubleMetaphoneApproximateMatch approximate matching
+     * rule.
+     */
+    public static final String AMR_DOUBLE_METAPHONE_NAME = "ds-mr-double-metaphone-approx";
 
-  /**
-   * The OID for the doubleMetaphoneApproximateMatch approximate matching rule.
-   */
-  public static final String AMR_DOUBLE_METAPHONE_OID =
-    OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".1";
+    /**
+     * The OID for the doubleMetaphoneApproximateMatch approximate matching
+     * rule.
+     */
+    public static final String AMR_DOUBLE_METAPHONE_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE
+            + ".1";
 
-  /**
-   * The description for the authPasswordExactMatch matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_EXACT_DESCRIPTION =
-    "authentication password exact matching rule";
+    /**
+     * The description for the authPasswordExactMatch matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_EXACT_DESCRIPTION =
+            "authentication password exact matching rule";
 
-  /**
-   * The name for the authPasswordExactMatch equality matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_EXACT_NAME =
-    "authPasswordExactMatch";
+    /**
+     * The name for the authPasswordExactMatch equality matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_EXACT_NAME = "authPasswordExactMatch";
 
-  /**
-   * The OID for the authPasswordExactMatch equality matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_EXACT_OID =
-    "1.3.6.1.4.1.4203.1.2.2";
+    /**
+     * The OID for the authPasswordExactMatch equality matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_EXACT_OID = "1.3.6.1.4.1.4203.1.2.2";
 
-  /**
-   * The description for the authPasswordMatch matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_DESCRIPTION =
-    "authentication password matching rule";
+    /**
+     * The description for the authPasswordMatch matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_DESCRIPTION =
+            "authentication password matching rule";
 
-  /**
-   * The name for the authPasswordMatch equality matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_NAME = "authPasswordMatch";
+    /**
+     * The name for the authPasswordMatch equality matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_NAME = "authPasswordMatch";
 
-  /**
-   * The OID for the authPasswordMatch equality matching rule.
-   */
-  public static final String EMR_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.2.3";
+    /**
+     * The OID for the authPasswordMatch equality matching rule.
+     */
+    public static final String EMR_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.2.3";
 
-  /**
-   * The name for the bitStringMatch equality matching rule.
-   */
-  public static final String EMR_BIT_STRING_NAME = "bitStringMatch";
+    /**
+     * The name for the bitStringMatch equality matching rule.
+     */
+    public static final String EMR_BIT_STRING_NAME = "bitStringMatch";
 
-  /**
-   * The OID for the bitStringMatch equality matching rule.
-   */
-  public static final String EMR_BIT_STRING_OID = "2.5.13.16";
+    /**
+     * The OID for the bitStringMatch equality matching rule.
+     */
+    public static final String EMR_BIT_STRING_OID = "2.5.13.16";
 
-  /**
-   * The name for the booleanMatch equality matching rule.
-   */
-  public static final String EMR_BOOLEAN_NAME = "booleanMatch";
+    /**
+     * The name for the booleanMatch equality matching rule.
+     */
+    public static final String EMR_BOOLEAN_NAME = "booleanMatch";
 
-  /**
-   * The OID for the booleanMatch equality matching rule.
-   */
-  public static final String EMR_BOOLEAN_OID = "2.5.13.13";
+    /**
+     * The OID for the booleanMatch equality matching rule.
+     */
+    public static final String EMR_BOOLEAN_OID = "2.5.13.13";
 
-  /**
-   * The name for the caseExactMatch equality matching rule.
-   */
-  public static final String EMR_CASE_EXACT_NAME = "caseExactMatch";
+    /**
+     * The name for the caseExactMatch equality matching rule.
+     */
+    public static final String EMR_CASE_EXACT_NAME = "caseExactMatch";
 
-  /**
-   * The OID for the caseExactMatch equality matching rule.
-   */
-  public static final String EMR_CASE_EXACT_OID = "2.5.13.5";
+    /**
+     * The OID for the caseExactMatch equality matching rule.
+     */
+    public static final String EMR_CASE_EXACT_OID = "2.5.13.5";
 
-  /**
-   * The name for the caseExactIA5Match equality matching rule.
-   */
-  public static final String EMR_CASE_EXACT_IA5_NAME = "caseExactIA5Match";
+    /**
+     * The name for the caseExactIA5Match equality matching rule.
+     */
+    public static final String EMR_CASE_EXACT_IA5_NAME = "caseExactIA5Match";
 
-  /**
-   * The OID for the caseExactIA5Match equality matching rule.
-   */
-  public static final String EMR_CASE_EXACT_IA5_OID =
-    "1.3.6.1.4.1.1466.109.114.1";
+    /**
+     * The OID for the caseExactIA5Match equality matching rule.
+     */
+    public static final String EMR_CASE_EXACT_IA5_OID = "1.3.6.1.4.1.1466.109.114.1";
 
-  /**
-   * The name for the caseIgnoreMatch equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_NAME = "caseIgnoreMatch";
+    /**
+     * The name for the caseIgnoreMatch equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_NAME = "caseIgnoreMatch";
 
-  /**
-   * The OID for the caseIgnoreMatch equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_OID = "2.5.13.2";
+    /**
+     * The OID for the caseIgnoreMatch equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_OID = "2.5.13.2";
 
-  /**
-   * The name for the caseIgnoreIA5Match equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_IA5_NAME = "caseIgnoreIA5Match";
+    /**
+     * The name for the caseIgnoreIA5Match equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_IA5_NAME = "caseIgnoreIA5Match";
 
-  /**
-   * The OID for the caseIgnoreIA5Match equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_IA5_OID =
-    "1.3.6.1.4.1.1466.109.114.2";
+    /**
+     * The OID for the caseIgnoreIA5Match equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_IA5_OID = "1.3.6.1.4.1.1466.109.114.2";
 
-  /**
-   * The name for the caseIgnoreListMatch equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_LIST_NAME = "caseIgnoreListMatch";
+    /**
+     * The name for the caseIgnoreListMatch equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_LIST_NAME = "caseIgnoreListMatch";
 
-  /**
-   * The OID for the caseIgnoreListMatch equality matching rule.
-   */
-  public static final String EMR_CASE_IGNORE_LIST_OID = "2.5.13.11";
+    /**
+     * The OID for the caseIgnoreListMatch equality matching rule.
+     */
+    public static final String EMR_CASE_IGNORE_LIST_OID = "2.5.13.11";
 
-  /**
-   * The name for the directoryStringFirstComponentMatch equality matching rule.
-   */
-  public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_NAME =
-    "directoryStringFirstComponentMatch";
+    /**
+     * The name for the directoryStringFirstComponentMatch equality matching
+     * rule.
+     */
+    public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_NAME =
+            "directoryStringFirstComponentMatch";
 
-  /**
-   * The OID for the directoryStringFirstComponentMatch equality matching rule.
-   */
-  public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID =
-    "2.5.13.31";
+    /**
+     * The OID for the directoryStringFirstComponentMatch equality matching
+     * rule.
+     */
+    public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID = "2.5.13.31";
 
-  /**
-   * The name for the distinguishedNameMatch equality matching rule.
-   */
-  public static final String EMR_DN_NAME = "distinguishedNameMatch";
+    /**
+     * The name for the distinguishedNameMatch equality matching rule.
+     */
+    public static final String EMR_DN_NAME = "distinguishedNameMatch";
 
-  /**
-   * The OID for the distinguishedNameMatch equality matching rule.
-   */
-  public static final String EMR_DN_OID = "2.5.13.1";
+    /**
+     * The OID for the distinguishedNameMatch equality matching rule.
+     */
+    public static final String EMR_DN_OID = "2.5.13.1";
 
-  /**
-   * The name for the generalizedTimeMatch equality matching rule.
-   */
-  public static final String EMR_GENERALIZED_TIME_NAME = "generalizedTimeMatch";
+    /**
+     * The name for the generalizedTimeMatch equality matching rule.
+     */
+    public static final String EMR_GENERALIZED_TIME_NAME = "generalizedTimeMatch";
 
-  /**
-   * The OID for the generalizedTimeMatch equality matching rule.
-   */
-  public static final String EMR_GENERALIZED_TIME_OID = "2.5.13.27";
+    /**
+     * The OID for the generalizedTimeMatch equality matching rule.
+     */
+    public static final String EMR_GENERALIZED_TIME_OID = "2.5.13.27";
 
-  /**
-   * The name for the integerMatch equality matching rule.
-   */
-  public static final String EMR_INTEGER_NAME = "integerMatch";
+    /**
+     * The name for the integerMatch equality matching rule.
+     */
+    public static final String EMR_INTEGER_NAME = "integerMatch";
 
-  /**
-   * The OID for the integerMatch equality matching rule.
-   */
-  public static final String EMR_INTEGER_OID = "2.5.13.14";
+    /**
+     * The OID for the integerMatch equality matching rule.
+     */
+    public static final String EMR_INTEGER_OID = "2.5.13.14";
 
-  /**
-   * The name for the integerFirstComponentMatch equality matching rule.
-   */
-  public static final String EMR_INTEGER_FIRST_COMPONENT_NAME =
-    "integerFirstComponentMatch";
+    /**
+     * The name for the integerFirstComponentMatch equality matching rule.
+     */
+    public static final String EMR_INTEGER_FIRST_COMPONENT_NAME = "integerFirstComponentMatch";
 
-  /**
-   * The OID for the integerFirstComponentMatch equality matching rule.
-   */
-  public static final String EMR_INTEGER_FIRST_COMPONENT_OID = "2.5.13.29";
+    /**
+     * The OID for the integerFirstComponentMatch equality matching rule.
+     */
+    public static final String EMR_INTEGER_FIRST_COMPONENT_OID = "2.5.13.29";
 
-  /**
-   * The name for the keywordMatch equality matching rule.
-   */
-  public static final String EMR_KEYWORD_NAME = "keywordMatch";
+    /**
+     * The name for the keywordMatch equality matching rule.
+     */
+    public static final String EMR_KEYWORD_NAME = "keywordMatch";
 
-  /**
-   * The OID for the keywordMatch equality matching rule.
-   */
-  public static final String EMR_KEYWORD_OID = "2.5.13.33";
+    /**
+     * The OID for the keywordMatch equality matching rule.
+     */
+    public static final String EMR_KEYWORD_OID = "2.5.13.33";
 
-  /**
-   * The name for the numericStringMatch equality matching rule.
-   */
-  public static final String EMR_NUMERIC_STRING_NAME = "numericStringMatch";
+    /**
+     * The name for the numericStringMatch equality matching rule.
+     */
+    public static final String EMR_NUMERIC_STRING_NAME = "numericStringMatch";
 
-  /**
-   * The OID for the numericStringMatch equality matching rule.
-   */
-  public static final String EMR_NUMERIC_STRING_OID = "2.5.13.8";
+    /**
+     * The OID for the numericStringMatch equality matching rule.
+     */
+    public static final String EMR_NUMERIC_STRING_OID = "2.5.13.8";
 
-  /**
-   * The name for the octetStringMatch equality matching rule.
-   */
-  public static final String EMR_OCTET_STRING_NAME = "octetStringMatch";
+    /**
+     * The name for the octetStringMatch equality matching rule.
+     */
+    public static final String EMR_OCTET_STRING_NAME = "octetStringMatch";
 
-  /**
-   * The OID for the octetStringMatch equality matching rule.
-   */
-  public static final String EMR_OCTET_STRING_OID = "2.5.13.17";
+    /**
+     * The OID for the octetStringMatch equality matching rule.
+     */
+    public static final String EMR_OCTET_STRING_OID = "2.5.13.17";
 
-  /**
-   * The name for the objectIdentifierMatch equality matching rule.
-   */
-  public static final String EMR_OID_NAME = "objectIdentifierMatch";
+    /**
+     * The name for the objectIdentifierMatch equality matching rule.
+     */
+    public static final String EMR_OID_NAME = "objectIdentifierMatch";
 
-  /**
-   * The OID for the objectIdentifierMatch equality matching rule.
-   */
-  public static final String EMR_OID_OID = "2.5.13.0";
+    /**
+     * The OID for the objectIdentifierMatch equality matching rule.
+     */
+    public static final String EMR_OID_OID = "2.5.13.0";
 
-  /**
-   * The name for the objectIdentifierFirstComponentMatch equality matching
-   * rule.
-   */
-  public static final String EMR_OID_FIRST_COMPONENT_NAME =
-    "objectIdentifierFirstComponentMatch";
+    /**
+     * The name for the objectIdentifierFirstComponentMatch equality matching
+     * rule.
+     */
+    public static final String EMR_OID_FIRST_COMPONENT_NAME = "objectIdentifierFirstComponentMatch";
 
-  /**
-   * The OID for the objectIdentifierFirstComponentMatch equality matching rule.
-   */
-  public static final String EMR_OID_FIRST_COMPONENT_OID = "2.5.13.30";
+    /**
+     * The OID for the objectIdentifierFirstComponentMatch equality matching
+     * rule.
+     */
+    public static final String EMR_OID_FIRST_COMPONENT_OID = "2.5.13.30";
 
-  /**
-   * The name for the presentationAddressMatch equality matching rule.
-   */
-  public static final String EMR_PRESENTATION_ADDRESS_NAME =
-    "presentationAddressMatch";
+    /**
+     * The name for the presentationAddressMatch equality matching rule.
+     */
+    public static final String EMR_PRESENTATION_ADDRESS_NAME = "presentationAddressMatch";
 
-  /**
-   * The OID for the presentationAddressMatch equality matching rule.
-   */
-  public static final String EMR_PRESENTATION_ADDRESS_OID = "2.5.13.22";
+    /**
+     * The OID for the presentationAddressMatch equality matching rule.
+     */
+    public static final String EMR_PRESENTATION_ADDRESS_OID = "2.5.13.22";
 
-  /**
-   * The name for the protocolInformationMatch equality matching rule.
-   */
-  public static final String EMR_PROTOCOL_INFORMATION_NAME =
-    "protocolInformationMatch";
+    /**
+     * The name for the protocolInformationMatch equality matching rule.
+     */
+    public static final String EMR_PROTOCOL_INFORMATION_NAME = "protocolInformationMatch";
 
-  /**
-   * The OID for the protocolInformationMatch equality matching rule.
-   */
-  public static final String EMR_PROTOCOL_INFORMATION_OID = "2.5.13.24";
+    /**
+     * The OID for the protocolInformationMatch equality matching rule.
+     */
+    public static final String EMR_PROTOCOL_INFORMATION_OID = "2.5.13.24";
 
-  /**
-   * The name for the telephoneNumberMatch equality matching rule.
-   */
-  public static final String EMR_TELEPHONE_NAME = "telephoneNumberMatch";
+    /**
+     * The name for the telephoneNumberMatch equality matching rule.
+     */
+    public static final String EMR_TELEPHONE_NAME = "telephoneNumberMatch";
 
-  /**
-   * The OID for the telephoneNumberMatch equality matching rule.
-   */
-  public static final String EMR_TELEPHONE_OID = "2.5.13.20";
+    /**
+     * The OID for the telephoneNumberMatch equality matching rule.
+     */
+    public static final String EMR_TELEPHONE_OID = "2.5.13.20";
 
-  /**
-   * The name for the uniqueMemberMatch equality matching rule.
-   */
-  public static final String EMR_UNIQUE_MEMBER_NAME = "uniqueMemberMatch";
+    /**
+     * The name for the uniqueMemberMatch equality matching rule.
+     */
+    public static final String EMR_UNIQUE_MEMBER_NAME = "uniqueMemberMatch";
 
-  /**
-   * The OID for the uniqueMemberMatch equality matching rule.
-   */
-  public static final String EMR_UNIQUE_MEMBER_OID = "2.5.13.23";
+    /**
+     * The OID for the uniqueMemberMatch equality matching rule.
+     */
+    public static final String EMR_UNIQUE_MEMBER_OID = "2.5.13.23";
 
-  /**
-   * The description for the userPasswordExactMatch matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_EXACT_DESCRIPTION =
-    "user password exact matching rule";
+    /**
+     * The description for the userPasswordExactMatch matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_EXACT_DESCRIPTION =
+            "user password exact matching rule";
 
-  /**
-   * The name for the userPasswordExactMatch equality matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_EXACT_NAME =
-    "ds-mr-user-password-exact";
+    /**
+     * The name for the userPasswordExactMatch equality matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_EXACT_NAME = "ds-mr-user-password-exact";
 
-  /**
-   * The OID for the userPasswordExactMatch equality matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_EXACT_OID =
-    OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".2";
+    /**
+     * The OID for the userPasswordExactMatch equality matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_EXACT_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE
+            + ".2";
 
-  /**
-   * The description for the userPasswordMatch matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_DESCRIPTION =
-    "user password matching rule";
+    /**
+     * The description for the userPasswordMatch matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_DESCRIPTION = "user password matching rule";
 
-  /**
-   * The name for the userPasswordMatch equality matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_NAME =
-    "ds-mr-user-password-equality";
+    /**
+     * The name for the userPasswordMatch equality matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_NAME = "ds-mr-user-password-equality";
 
-  /**
-   * The OID for the userPasswordMatch equality matching rule.
-   */
-  public static final String EMR_USER_PASSWORD_OID =
-    OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".3";
+    /**
+     * The OID for the userPasswordMatch equality matching rule.
+     */
+    public static final String EMR_USER_PASSWORD_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".3";
 
-  /**
-   * The name for the uuidMatch equality matching rule.
-   */
-  public static final String EMR_UUID_NAME = "uuidMatch";
+    /**
+     * The name for the uuidMatch equality matching rule.
+     */
+    public static final String EMR_UUID_NAME = "uuidMatch";
 
-  /**
-   * The OID for the uuidMatch equality matching rule.
-   */
-  public static final String EMR_UUID_OID = "1.3.6.1.1.16.2";
+    /**
+     * The OID for the uuidMatch equality matching rule.
+     */
+    public static final String EMR_UUID_OID = "1.3.6.1.1.16.2";
 
-  /**
-   * The name for the wordMatch equality matching rule.
-   */
-  public static final String EMR_WORD_NAME = "wordMatch";
+    /**
+     * The name for the wordMatch equality matching rule.
+     */
+    public static final String EMR_WORD_NAME = "wordMatch";
 
-  /**
-   * The OID for the wordMatch equality matching rule.
-   */
-  public static final String EMR_WORD_OID = "2.5.13.32";
+    /**
+     * The OID for the wordMatch equality matching rule.
+     */
+    public static final String EMR_WORD_OID = "2.5.13.32";
 
-  /**
-   * The name for the caseExactOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_CASE_EXACT_NAME = "caseExactOrderingMatch";
+    /**
+     * The name for the caseExactOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_CASE_EXACT_NAME = "caseExactOrderingMatch";
 
-  /**
-   * The OID for the caseExactOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_CASE_EXACT_OID = "2.5.13.6";
+    /**
+     * The OID for the caseExactOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_CASE_EXACT_OID = "2.5.13.6";
 
-  /**
-   * The name for the caseIgnoreOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_CASE_IGNORE_NAME = "caseIgnoreOrderingMatch";
+    /**
+     * The name for the caseIgnoreOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_CASE_IGNORE_NAME = "caseIgnoreOrderingMatch";
 
-  /**
-   * The OID for the caseIgnoreOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_CASE_IGNORE_OID = "2.5.13.3";
+    /**
+     * The OID for the caseIgnoreOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_CASE_IGNORE_OID = "2.5.13.3";
 
-  /**
-   * The name for the generalizedTimeOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_GENERALIZED_TIME_NAME =
-    "generalizedTimeOrderingMatch";
+    /**
+     * The name for the generalizedTimeOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_GENERALIZED_TIME_NAME = "generalizedTimeOrderingMatch";
 
-  /**
-   * The OID for the generalizedTimeOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_GENERALIZED_TIME_OID = "2.5.13.28";
+    /**
+     * The OID for the generalizedTimeOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_GENERALIZED_TIME_OID = "2.5.13.28";
 
-  /**
-   * The name for the integerOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_INTEGER_NAME = "integerOrderingMatch";
+    /**
+     * The name for the integerOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_INTEGER_NAME = "integerOrderingMatch";
 
-  /**
-   * The OID for the integerOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_INTEGER_OID = "2.5.13.15";
+    /**
+     * The OID for the integerOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_INTEGER_OID = "2.5.13.15";
 
-  /**
-   * The name for the numericStringOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_NUMERIC_STRING_NAME =
-    "numericStringOrderingMatch";
+    /**
+     * The name for the numericStringOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_NUMERIC_STRING_NAME = "numericStringOrderingMatch";
 
-  /**
-   * The OID for the numericStringOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_NUMERIC_STRING_OID = "2.5.13.9";
+    /**
+     * The OID for the numericStringOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_NUMERIC_STRING_OID = "2.5.13.9";
 
-  /**
-   * The name for the octetStringOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_OCTET_STRING_NAME = "octetStringOrderingMatch";
+    /**
+     * The name for the octetStringOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_OCTET_STRING_NAME = "octetStringOrderingMatch";
 
-  /**
-   * The OID for the octetStringOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_OCTET_STRING_OID = "2.5.13.18";
+    /**
+     * The OID for the octetStringOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_OCTET_STRING_OID = "2.5.13.18";
 
-  /**
-   * The name for the uuidOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_UUID_NAME = "uuidOrderingMatch";
+    /**
+     * The name for the uuidOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_UUID_NAME = "uuidOrderingMatch";
 
-  /**
-   * The OID for the uuidOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_UUID_OID = "1.3.6.1.1.16.3";
+    /**
+     * The OID for the uuidOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_UUID_OID = "1.3.6.1.1.16.3";
 
-  /**
-   * The name for the enumOrderingMatch ordering matching rule.
-   */
-  public static final String OMR_GENERIC_ENUM_NAME = "enumOrderingMatch";
+    /**
+     * The name for the enumOrderingMatch ordering matching rule.
+     */
+    public static final String OMR_GENERIC_ENUM_NAME = "enumOrderingMatch";
 
-  /**
-   * The oid for the generic enum syntax ordering matching rule.
-   */
-  public static final String OMR_OID_GENERIC_ENUM = "1.3.6.1.4.1.26027.1.4.8";
+    /**
+     * The oid for the generic enum syntax ordering matching rule.
+     */
+    public static final String OMR_OID_GENERIC_ENUM = "1.3.6.1.4.1.26027.1.4.8";
 
-  /**
-   * The name for the caseExactSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_EXACT_NAME = "caseExactSubstringsMatch";
+    /**
+     * The name for the caseExactSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_EXACT_NAME = "caseExactSubstringsMatch";
 
-  /**
-   * The OID for the caseExactSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_EXACT_OID = "2.5.13.7";
+    /**
+     * The OID for the caseExactSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_EXACT_OID = "2.5.13.7";
 
-  /**
-   * The name for the caseExactIA5SubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_EXACT_IA5_NAME =
-    "caseExactIA5SubstringsMatch";
+    /**
+     * The name for the caseExactIA5SubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_EXACT_IA5_NAME = "caseExactIA5SubstringsMatch";
 
-  /**
-   * The OID for the caseExactIA5SubstringsMatch substring matching rule. //
-   * FIXME -- This needs to be updated once a real OID is assigned.
-   */
-  public static final String SMR_CASE_EXACT_IA5_OID =
-    OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".902";
+    /**
+     * The OID for the caseExactIA5SubstringsMatch substring matching rule. //
+     * FIXME -- This needs to be updated once a real OID is assigned.
+     */
+    public static final String SMR_CASE_EXACT_IA5_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE
+            + ".902";
 
-  /**
-   * The name for the caseIgnoreSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_NAME = "caseIgnoreSubstringsMatch";
+    /**
+     * The name for the caseIgnoreSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_NAME = "caseIgnoreSubstringsMatch";
 
-  /**
-   * The OID for the caseIgnoreSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_OID = "2.5.13.4";
+    /**
+     * The OID for the caseIgnoreSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_OID = "2.5.13.4";
 
-  /**
-   * The name for the caseIgnoreIA5SubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_IA5_NAME =
-    "caseIgnoreIA5SubstringsMatch";
+    /**
+     * The name for the caseIgnoreIA5SubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_IA5_NAME = "caseIgnoreIA5SubstringsMatch";
 
-  /**
-   * The OID for the caseIgnoreIA5SubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_IA5_OID =
-    "1.3.6.1.4.1.1466.109.114.3";
+    /**
+     * The OID for the caseIgnoreIA5SubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_IA5_OID = "1.3.6.1.4.1.1466.109.114.3";
 
-  /**
-   * The name for the caseIgnoreListSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_LIST_NAME =
-    "caseIgnoreListSubstringsMatch";
+    /**
+     * The name for the caseIgnoreListSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_LIST_NAME = "caseIgnoreListSubstringsMatch";
 
-  /**
-   * The OID for the caseIgnoreListSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_CASE_IGNORE_LIST_OID = "2.5.13.12";
+    /**
+     * The OID for the caseIgnoreListSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_CASE_IGNORE_LIST_OID = "2.5.13.12";
 
-  /**
-   * The name for the numericStringSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_NUMERIC_STRING_NAME =
-    "numericStringSubstringsMatch";
+    /**
+     * The name for the numericStringSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_NUMERIC_STRING_NAME = "numericStringSubstringsMatch";
 
-  /**
-   * The OID for the numericStringSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_NUMERIC_STRING_OID = "2.5.13.10";
+    /**
+     * The OID for the numericStringSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_NUMERIC_STRING_OID = "2.5.13.10";
 
-  /**
-   * The name for the octetStringSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_OCTET_STRING_NAME =
-    "octetStringSubstringsMatch";
+    /**
+     * The name for the octetStringSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_OCTET_STRING_NAME = "octetStringSubstringsMatch";
 
-  /**
-   * The OID for the octetStringSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_OCTET_STRING_OID = "2.5.13.19";
+    /**
+     * The OID for the octetStringSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_OCTET_STRING_OID = "2.5.13.19";
 
-  /**
-   * The name for the telephoneNumberSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_TELEPHONE_NAME =
-    "telephoneNumberSubstringsMatch";
+    /**
+     * The name for the telephoneNumberSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_TELEPHONE_NAME = "telephoneNumberSubstringsMatch";
 
-  /**
-   * The OID for the telephoneNumberSubstringsMatch substring matching rule.
-   */
-  public static final String SMR_TELEPHONE_OID = "2.5.13.21";
+    /**
+     * The OID for the telephoneNumberSubstringsMatch substring matching rule.
+     */
+    public static final String SMR_TELEPHONE_OID = "2.5.13.21";
 
-  /**
-   * The OID for the absolute subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_OID =
-    OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".3";
+    /**
+     * The OID for the absolute subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_OID =
+            OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".3";
 
-  /**
-   * The description for the absolute subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_DESCRIPTION =
-    "Absolute Subtree Specification";
+    /**
+     * The description for the absolute subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_DESCRIPTION =
+            "Absolute Subtree Specification";
 
-  /**
-   * The name for the absolute subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME =
-    "ds-absolute-subtree-specification";
+    /**
+     * The name for the absolute subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME =
+            "ds-absolute-subtree-specification";
 
-  /**
-   * The OID for the aci attribute syntax.
-   */
-  public static final String SYNTAX_ACI_OID =
-    OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".4";
+    /**
+     * The OID for the aci attribute syntax.
+     */
+    public static final String SYNTAX_ACI_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".4";
 
-  /**
-   * The description for aci attribute syntax.
-   */
-  public static final String SYNTAX_ACI_DESCRIPTION =
-    "Sun-defined Access Control Information";
+    /**
+     * The description for aci attribute syntax.
+     */
+    public static final String SYNTAX_ACI_DESCRIPTION = "Sun-defined Access Control Information";
 
-  /**
-   * The name for the aci attribute syntax.
-   */
-  public static final String SYNTAX_ACI_NAME = "ds-syntax-dseecompat-aci";
+    /**
+     * The name for the aci attribute syntax.
+     */
+    public static final String SYNTAX_ACI_NAME = "ds-syntax-dseecompat-aci";
 
-  /**
-   * The description for the attribute type description attribute syntax.
-   */
-  public static final String SYNTAX_ATTRIBUTE_TYPE_DESCRIPTION =
-    "Attribute Type Description";
+    /**
+     * The description for the attribute type description attribute syntax.
+     */
+    public static final String SYNTAX_ATTRIBUTE_TYPE_DESCRIPTION = "Attribute Type Description";
 
-  /**
-   * The name for the attribute type description attribute syntax.
-   */
-  public static final String SYNTAX_ATTRIBUTE_TYPE_NAME =
-    "AttributeTypeDescription";
+    /**
+     * The name for the attribute type description attribute syntax.
+     */
+    public static final String SYNTAX_ATTRIBUTE_TYPE_NAME = "AttributeTypeDescription";
 
-  /**
-   * The OID for the attribute type description attribute syntax.
-   */
-  public static final String SYNTAX_ATTRIBUTE_TYPE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.3";
+    /**
+     * The OID for the attribute type description attribute syntax.
+     */
+    public static final String SYNTAX_ATTRIBUTE_TYPE_OID = "1.3.6.1.4.1.1466.115.121.1.3";
 
-  /**
-   * The description for the auth password attribute syntax.
-   */
-  public static final String SYNTAX_AUTH_PASSWORD_DESCRIPTION =
-    "Authentication Password Syntax";
+    /**
+     * The description for the auth password attribute syntax.
+     */
+    public static final String SYNTAX_AUTH_PASSWORD_DESCRIPTION = "Authentication Password Syntax";
 
-  /**
-   * The name for the auth password attribute syntax.
-   */
-  public static final String SYNTAX_AUTH_PASSWORD_NAME =
-    "AuthenticationPasswordSyntax";
+    /**
+     * The name for the auth password attribute syntax.
+     */
+    public static final String SYNTAX_AUTH_PASSWORD_NAME = "AuthenticationPasswordSyntax";
 
-  /**
-   * The OID for the auth password attribute syntax.
-   */
-  public static final String SYNTAX_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.1.2";
+    /**
+     * The OID for the auth password attribute syntax.
+     */
+    public static final String SYNTAX_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.1.2";
 
-  /**
-   * The description for the binary attribute syntax.
-   */
-  public static final String SYNTAX_BINARY_DESCRIPTION = "Binary";
+    /**
+     * The description for the binary attribute syntax.
+     */
+    public static final String SYNTAX_BINARY_DESCRIPTION = "Binary";
 
-  /**
-   * The name for the binary attribute syntax.
-   */
-  public static final String SYNTAX_BINARY_NAME = "Binary";
+    /**
+     * The name for the binary attribute syntax.
+     */
+    public static final String SYNTAX_BINARY_NAME = "Binary";
 
-  /**
-   * The OID for the binary attribute syntax.
-   */
-  public static final String SYNTAX_BINARY_OID = "1.3.6.1.4.1.1466.115.121.1.5";
+    /**
+     * The OID for the binary attribute syntax.
+     */
+    public static final String SYNTAX_BINARY_OID = "1.3.6.1.4.1.1466.115.121.1.5";
 
-  /**
-   * The description for the bit string attribute syntax.
-   */
-  public static final String SYNTAX_BIT_STRING_DESCRIPTION = "Bit String";
+    /**
+     * The description for the bit string attribute syntax.
+     */
+    public static final String SYNTAX_BIT_STRING_DESCRIPTION = "Bit String";
 
-  /**
-   * The name for the bit string attribute syntax.
-   */
-  public static final String SYNTAX_BIT_STRING_NAME = "BitString";
+    /**
+     * The name for the bit string attribute syntax.
+     */
+    public static final String SYNTAX_BIT_STRING_NAME = "BitString";
 
-  /**
-   * The OID for the bit string attribute syntax.
-   */
-  public static final String SYNTAX_BIT_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.6";
+    /**
+     * The OID for the bit string attribute syntax.
+     */
+    public static final String SYNTAX_BIT_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.6";
 
-  /**
-   * The description for the Boolean attribute syntax.
-   */
-  public static final String SYNTAX_BOOLEAN_DESCRIPTION = "Boolean";
+    /**
+     * The description for the Boolean attribute syntax.
+     */
+    public static final String SYNTAX_BOOLEAN_DESCRIPTION = "Boolean";
 
-  /**
-   * The name for the Boolean attribute syntax.
-   */
-  public static final String SYNTAX_BOOLEAN_NAME = "Boolean";
+    /**
+     * The name for the Boolean attribute syntax.
+     */
+    public static final String SYNTAX_BOOLEAN_NAME = "Boolean";
 
-  /**
-   * The OID for the Boolean attribute syntax.
-   */
-  public static final String SYNTAX_BOOLEAN_OID = "1.3.6.1.4.1.1466.115.121.1.7";
+    /**
+     * The OID for the Boolean attribute syntax.
+     */
+    public static final String SYNTAX_BOOLEAN_OID = "1.3.6.1.4.1.1466.115.121.1.7";
 
-  /**
-   * The description for the certificate attribute syntax.
-   */
-  public static final String SYNTAX_CERTIFICATE_DESCRIPTION = "Certificate";
+    /**
+     * The description for the certificate attribute syntax.
+     */
+    public static final String SYNTAX_CERTIFICATE_DESCRIPTION = "Certificate";
 
-  /**
-   * The name for the certificate attribute syntax.
-   */
-  public static final String SYNTAX_CERTIFICATE_NAME = "Certificate";
+    /**
+     * The name for the certificate attribute syntax.
+     */
+    public static final String SYNTAX_CERTIFICATE_NAME = "Certificate";
 
-  /**
-   * The OID for the certificate attribute syntax.
-   */
-  public static final String SYNTAX_CERTIFICATE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.8";
+    /**
+     * The OID for the certificate attribute syntax.
+     */
+    public static final String SYNTAX_CERTIFICATE_OID = "1.3.6.1.4.1.1466.115.121.1.8";
 
-  /**
-   * The description for the certificate list attribute syntax.
-   */
-  public static final String SYNTAX_CERTLIST_DESCRIPTION = "Certificate List";
+    /**
+     * The description for the certificate list attribute syntax.
+     */
+    public static final String SYNTAX_CERTLIST_DESCRIPTION = "Certificate List";
 
-  /**
-   * The name for the certificate list attribute syntax.
-   */
-  public static final String SYNTAX_CERTLIST_NAME = "CertificateList";
+    /**
+     * The name for the certificate list attribute syntax.
+     */
+    public static final String SYNTAX_CERTLIST_NAME = "CertificateList";
 
-  /**
-   * The OID for the certificate list attribute syntax.
-   */
-  public static final String SYNTAX_CERTLIST_OID =
-    "1.3.6.1.4.1.1466.115.121.1.9";
+    /**
+     * The OID for the certificate list attribute syntax.
+     */
+    public static final String SYNTAX_CERTLIST_OID = "1.3.6.1.4.1.1466.115.121.1.9";
 
-  /**
-   * The description for the certificate pair attribute syntax.
-   */
-  public static final String SYNTAX_CERTPAIR_DESCRIPTION = "Certificate Pair";
+    /**
+     * The description for the certificate pair attribute syntax.
+     */
+    public static final String SYNTAX_CERTPAIR_DESCRIPTION = "Certificate Pair";
 
-  /**
-   * The name for the certificate pair attribute syntax.
-   */
-  public static final String SYNTAX_CERTPAIR_NAME = "CertificatePair";
+    /**
+     * The name for the certificate pair attribute syntax.
+     */
+    public static final String SYNTAX_CERTPAIR_NAME = "CertificatePair";
 
-  /**
-   * The OID for the certificate pair attribute syntax.
-   */
-  public static final String SYNTAX_CERTPAIR_OID =
-    "1.3.6.1.4.1.1466.115.121.1.10";
+    /**
+     * The OID for the certificate pair attribute syntax.
+     */
+    public static final String SYNTAX_CERTPAIR_OID = "1.3.6.1.4.1.1466.115.121.1.10";
 
-  /**
-   * The description for the country string attribute syntax.
-   */
-  public static final String SYNTAX_COUNTRY_STRING_DESCRIPTION =
-    "Country String";
+    /**
+     * The description for the country string attribute syntax.
+     */
+    public static final String SYNTAX_COUNTRY_STRING_DESCRIPTION = "Country String";
 
-  /**
-   * The name for the country string attribute syntax.
-   */
-  public static final String SYNTAX_COUNTRY_STRING_NAME = "CountryString";
-
-  /**
-   * The OID for the country string attribute syntax.
-   */
-  public static final String SYNTAX_COUNTRY_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.11";
-
-  /**
-   * The description for the delivery method attribute syntax.
-   */
-  public static final String SYNTAX_DELIVERY_METHOD_DESCRIPTION =
-    "Delivery Method";
+    /**
+     * The name for the country string attribute syntax.
+     */
+    public static final String SYNTAX_COUNTRY_STRING_NAME = "CountryString";
 
-  /**
-   * The name for the delivery method attribute syntax.
-   */
-  public static final String SYNTAX_DELIVERY_METHOD_NAME = "DeliveryMethod";
+    /**
+     * The OID for the country string attribute syntax.
+     */
+    public static final String SYNTAX_COUNTRY_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.11";
 
-  /**
-   * The OID for the delivery method attribute syntax.
-   */
-  public static final String SYNTAX_DELIVERY_METHOD_OID =
-    "1.3.6.1.4.1.1466.115.121.1.14";
+    /**
+     * The description for the delivery method attribute syntax.
+     */
+    public static final String SYNTAX_DELIVERY_METHOD_DESCRIPTION = "Delivery Method";
 
-  /**
-   * The description for the Directory String attribute syntax.
-   */
-  public static final String SYNTAX_DIRECTORY_STRING_DESCRIPTION =
-    "Directory String";
+    /**
+     * The name for the delivery method attribute syntax.
+     */
+    public static final String SYNTAX_DELIVERY_METHOD_NAME = "DeliveryMethod";
 
-  /**
-   * The name for the Directory String attribute syntax.
-   */
-  public static final String SYNTAX_DIRECTORY_STRING_NAME = "DirectoryString";
+    /**
+     * The OID for the delivery method attribute syntax.
+     */
+    public static final String SYNTAX_DELIVERY_METHOD_OID = "1.3.6.1.4.1.1466.115.121.1.14";
 
-  /**
-   * The OID for the Directory String attribute syntax.
-   */
-  public static final String SYNTAX_DIRECTORY_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.15";
+    /**
+     * The description for the Directory String attribute syntax.
+     */
+    public static final String SYNTAX_DIRECTORY_STRING_DESCRIPTION = "Directory String";
 
-  /**
-   * The description for the DIT content rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_CONTENT_RULE_DESCRIPTION =
-    "DIT Content Rule Description";
+    /**
+     * The name for the Directory String attribute syntax.
+     */
+    public static final String SYNTAX_DIRECTORY_STRING_NAME = "DirectoryString";
 
-  /**
-   * The name for the DIT content rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_CONTENT_RULE_NAME =
-    "DITContentRuleDescription";
+    /**
+     * The OID for the Directory String attribute syntax.
+     */
+    public static final String SYNTAX_DIRECTORY_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.15";
 
-  /**
-   * The OID for the DIT content rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_CONTENT_RULE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.16";
+    /**
+     * The description for the DIT content rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_CONTENT_RULE_DESCRIPTION = "DIT Content Rule Description";
 
-  /**
-   * The description for the DIT structure rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_STRUCTURE_RULE_DESCRIPTION =
-    "DIT Structure Rule Description";
+    /**
+     * The name for the DIT content rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_CONTENT_RULE_NAME = "DITContentRuleDescription";
 
-  /**
-   * The name for the DIT structure rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_STRUCTURE_RULE_NAME =
-    "DITStructureRuleDescription";
+    /**
+     * The OID for the DIT content rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_CONTENT_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.16";
 
-  /**
-   * The OID for the DIT structure rule description attribute syntax.
-   */
-  public static final String SYNTAX_DIT_STRUCTURE_RULE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.17";
+    /**
+     * The description for the DIT structure rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_STRUCTURE_RULE_DESCRIPTION =
+            "DIT Structure Rule Description";
 
-  /**
-   * The description for the distinguished name attribute syntax.
-   */
-  public static final String SYNTAX_DN_DESCRIPTION = "DN";
+    /**
+     * The name for the DIT structure rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_STRUCTURE_RULE_NAME = "DITStructureRuleDescription";
 
-  /**
-   * The name for the distinguished name attribute syntax.
-   */
-  public static final String SYNTAX_DN_NAME = "DN";
+    /**
+     * The OID for the DIT structure rule description attribute syntax.
+     */
+    public static final String SYNTAX_DIT_STRUCTURE_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.17";
 
-  /**
-   * The OID for the distinguished name attribute syntax.
-   */
-  public static final String SYNTAX_DN_OID = "1.3.6.1.4.1.1466.115.121.1.12";
+    /**
+     * The description for the distinguished name attribute syntax.
+     */
+    public static final String SYNTAX_DN_DESCRIPTION = "DN";
 
-  /**
-   * The description for the enhanced guide attribute syntax.
-   */
-  public static final String SYNTAX_ENHANCED_GUIDE_DESCRIPTION =
-    "Enhanced Guide";
+    /**
+     * The name for the distinguished name attribute syntax.
+     */
+    public static final String SYNTAX_DN_NAME = "DN";
 
-  /**
-   * The name for the enhanced guide attribute syntax.
-   */
-  public static final String SYNTAX_ENHANCED_GUIDE_NAME = "EnhancedGuide";
+    /**
+     * The OID for the distinguished name attribute syntax.
+     */
+    public static final String SYNTAX_DN_OID = "1.3.6.1.4.1.1466.115.121.1.12";
 
-  /**
-   * The OID for the enhanced guide attribute syntax.
-   */
-  public static final String SYNTAX_ENHANCED_GUIDE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.21";
+    /**
+     * The description for the enhanced guide attribute syntax.
+     */
+    public static final String SYNTAX_ENHANCED_GUIDE_DESCRIPTION = "Enhanced Guide";
 
-  /**
-   * The description for the facsimile telephone number attribute syntax.
-   */
-  public static final String SYNTAX_FAXNUMBER_DESCRIPTION =
-    "Facsimile Telephone Number";
+    /**
+     * The name for the enhanced guide attribute syntax.
+     */
+    public static final String SYNTAX_ENHANCED_GUIDE_NAME = "EnhancedGuide";
 
-  /**
-   * The name for the facsimile telephone number attribute syntax.
-   */
-  public static final String SYNTAX_FAXNUMBER_NAME = "FacsimileTelephoneNumber";
+    /**
+     * The OID for the enhanced guide attribute syntax.
+     */
+    public static final String SYNTAX_ENHANCED_GUIDE_OID = "1.3.6.1.4.1.1466.115.121.1.21";
 
-  /**
-   * The OID for the facsimile telephone number attribute syntax.
-   */
-  public static final String SYNTAX_FAXNUMBER_OID =
-    "1.3.6.1.4.1.1466.115.121.1.22";
+    /**
+     * The description for the facsimile telephone number attribute syntax.
+     */
+    public static final String SYNTAX_FAXNUMBER_DESCRIPTION = "Facsimile Telephone Number";
 
-  /**
-   * The description for the fax attribute syntax.
-   */
-  public static final String SYNTAX_FAX_DESCRIPTION = "Fax";
+    /**
+     * The name for the facsimile telephone number attribute syntax.
+     */
+    public static final String SYNTAX_FAXNUMBER_NAME = "FacsimileTelephoneNumber";
 
-  /**
-   * The name for the fax attribute syntax.
-   */
-  public static final String SYNTAX_FAX_NAME = "Fax";
+    /**
+     * The OID for the facsimile telephone number attribute syntax.
+     */
+    public static final String SYNTAX_FAXNUMBER_OID = "1.3.6.1.4.1.1466.115.121.1.22";
 
-  /**
-   * The OID for the fax attribute syntax.
-   */
-  public static final String SYNTAX_FAX_OID = "1.3.6.1.4.1.1466.115.121.1.23";
+    /**
+     * The description for the fax attribute syntax.
+     */
+    public static final String SYNTAX_FAX_DESCRIPTION = "Fax";
 
-  /**
-   * The description for the generalized time attribute syntax.
-   */
-  public static final String SYNTAX_GENERALIZED_TIME_DESCRIPTION =
-    "Generalized Time";
+    /**
+     * The name for the fax attribute syntax.
+     */
+    public static final String SYNTAX_FAX_NAME = "Fax";
 
-  /**
-   * The name for the generalized time attribute syntax.
-   */
-  public static final String SYNTAX_GENERALIZED_TIME_NAME = "GeneralizedTime";
+    /**
+     * The OID for the fax attribute syntax.
+     */
+    public static final String SYNTAX_FAX_OID = "1.3.6.1.4.1.1466.115.121.1.23";
 
-  /**
-   * The OID for the generalized time attribute syntax.
-   */
-  public static final String SYNTAX_GENERALIZED_TIME_OID =
-    "1.3.6.1.4.1.1466.115.121.1.24";
+    /**
+     * The description for the generalized time attribute syntax.
+     */
+    public static final String SYNTAX_GENERALIZED_TIME_DESCRIPTION = "Generalized Time";
 
-  /**
-   * The description for the guide attribute syntax.
-   */
-  public static final String SYNTAX_GUIDE_DESCRIPTION = "Guide";
+    /**
+     * The name for the generalized time attribute syntax.
+     */
+    public static final String SYNTAX_GENERALIZED_TIME_NAME = "GeneralizedTime";
 
-  /**
-   * The name for the guide attribute syntax.
-   */
-  public static final String SYNTAX_GUIDE_NAME = "Guide";
+    /**
+     * The OID for the generalized time attribute syntax.
+     */
+    public static final String SYNTAX_GENERALIZED_TIME_OID = "1.3.6.1.4.1.1466.115.121.1.24";
 
-  /**
-   * The OID for the guide attribute syntax.
-   */
-  public static final String SYNTAX_GUIDE_OID = "1.3.6.1.4.1.1466.115.121.1.25";
+    /**
+     * The description for the guide attribute syntax.
+     */
+    public static final String SYNTAX_GUIDE_DESCRIPTION = "Guide";
 
-  /**
-   * The description for the IA5 string attribute syntax.
-   */
-  public static final String SYNTAX_IA5_STRING_DESCRIPTION = "IA5 String";
+    /**
+     * The name for the guide attribute syntax.
+     */
+    public static final String SYNTAX_GUIDE_NAME = "Guide";
 
-  /**
-   * The name for the IA5 string attribute syntax.
-   */
-  public static final String SYNTAX_IA5_STRING_NAME = "IA5String";
+    /**
+     * The OID for the guide attribute syntax.
+     */
+    public static final String SYNTAX_GUIDE_OID = "1.3.6.1.4.1.1466.115.121.1.25";
 
-  /**
-   * The OID for the IA5 string attribute syntax.
-   */
-  public static final String SYNTAX_IA5_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.26";
+    /**
+     * The description for the IA5 string attribute syntax.
+     */
+    public static final String SYNTAX_IA5_STRING_DESCRIPTION = "IA5 String";
 
-  /**
-   * The description for the integer attribute syntax.
-   */
-  public static final String SYNTAX_INTEGER_DESCRIPTION = "Integer";
+    /**
+     * The name for the IA5 string attribute syntax.
+     */
+    public static final String SYNTAX_IA5_STRING_NAME = "IA5String";
 
-  /**
-   * The name for the integer attribute syntax.
-   */
-  public static final String SYNTAX_INTEGER_NAME = "Integer";
+    /**
+     * The OID for the IA5 string attribute syntax.
+     */
+    public static final String SYNTAX_IA5_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.26";
 
-  /**
-   * The OID for the integer attribute syntax.
-   */
-  public static final String SYNTAX_INTEGER_OID =
-    "1.3.6.1.4.1.1466.115.121.1.27";
+    /**
+     * The description for the integer attribute syntax.
+     */
+    public static final String SYNTAX_INTEGER_DESCRIPTION = "Integer";
 
-  /**
-   * The description for the JPEG attribute syntax.
-   */
-  public static final String SYNTAX_JPEG_DESCRIPTION = "JPEG";
+    /**
+     * The name for the integer attribute syntax.
+     */
+    public static final String SYNTAX_INTEGER_NAME = "Integer";
 
-  /**
-   * The name for the JPEG attribute syntax.
-   */
-  public static final String SYNTAX_JPEG_NAME = "JPEG";
+    /**
+     * The OID for the integer attribute syntax.
+     */
+    public static final String SYNTAX_INTEGER_OID = "1.3.6.1.4.1.1466.115.121.1.27";
 
-  /**
-   * The OID for the JPEG attribute syntax.
-   */
-  public static final String SYNTAX_JPEG_OID = "1.3.6.1.4.1.1466.115.121.1.28";
+    /**
+     * The description for the JPEG attribute syntax.
+     */
+    public static final String SYNTAX_JPEG_DESCRIPTION = "JPEG";
 
-  /**
-   * The description for the LDAP syntax description attribute syntax.
-   */
-  public static final String SYNTAX_LDAP_SYNTAX_DESCRIPTION =
-    "LDAP Syntax Description";
+    /**
+     * The name for the JPEG attribute syntax.
+     */
+    public static final String SYNTAX_JPEG_NAME = "JPEG";
 
-  /**
-   * The name for the LDAP syntax description attribute syntax.
-   */
-  public static final String SYNTAX_LDAP_SYNTAX_NAME = "LDAPSyntaxDescription";
+    /**
+     * The OID for the JPEG attribute syntax.
+     */
+    public static final String SYNTAX_JPEG_OID = "1.3.6.1.4.1.1466.115.121.1.28";
 
-  /**
-   * The OID for the LDAP syntax description attribute syntax.
-   */
-  public static final String SYNTAX_LDAP_SYNTAX_OID =
-    "1.3.6.1.4.1.1466.115.121.1.54";
+    /**
+     * The description for the LDAP syntax description attribute syntax.
+     */
+    public static final String SYNTAX_LDAP_SYNTAX_DESCRIPTION = "LDAP Syntax Description";
 
-  /**
-   * The description for the matching rule description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_DESCRIPTION =
-    "Matching Rule Description";
+    /**
+     * The name for the LDAP syntax description attribute syntax.
+     */
+    public static final String SYNTAX_LDAP_SYNTAX_NAME = "LDAPSyntaxDescription";
 
-  /**
-   * The name for the matching rule description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_NAME =
-    "MatchingRuleDescription";
+    /**
+     * The OID for the LDAP syntax description attribute syntax.
+     */
+    public static final String SYNTAX_LDAP_SYNTAX_OID = "1.3.6.1.4.1.1466.115.121.1.54";
 
-  /**
-   * The OID for the matching rule description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.30";
+    /**
+     * The description for the matching rule description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_DESCRIPTION = "Matching Rule Description";
 
-  /**
-   * The description for the matching rule use description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_USE_DESCRIPTION =
-    "Matching Rule Use Description";
+    /**
+     * The name for the matching rule description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_NAME = "MatchingRuleDescription";
 
-  /**
-   * The name for the matching rule use description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_USE_NAME =
-    "MatchingRuleUseDescription";
+    /**
+     * The OID for the matching rule description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.30";
 
-  /**
-   * The OID for the matching rule use description attribute syntax.
-   */
-  public static final String SYNTAX_MATCHING_RULE_USE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.31";
+    /**
+     * The description for the matching rule use description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_USE_DESCRIPTION =
+            "Matching Rule Use Description";
 
-  /**
-   * The description for the name and optional uid attribute syntax.
-   */
-  public static final String SYNTAX_NAME_AND_OPTIONAL_UID_DESCRIPTION =
-    "Name and Optional UID";
+    /**
+     * The name for the matching rule use description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_USE_NAME = "MatchingRuleUseDescription";
 
-  /**
-   * The name for the name and optional uid attribute syntax.
-   */
-  public static final String SYNTAX_NAME_AND_OPTIONAL_UID_NAME =
-    "NameAndOptionalUID";
+    /**
+     * The OID for the matching rule use description attribute syntax.
+     */
+    public static final String SYNTAX_MATCHING_RULE_USE_OID = "1.3.6.1.4.1.1466.115.121.1.31";
 
-  /**
-   * The OID for the name and optional uid attribute syntax.
-   */
-  public static final String SYNTAX_NAME_AND_OPTIONAL_UID_OID =
-    "1.3.6.1.4.1.1466.115.121.1.34";
+    /**
+     * The description for the name and optional uid attribute syntax.
+     */
+    public static final String SYNTAX_NAME_AND_OPTIONAL_UID_DESCRIPTION = "Name and Optional UID";
 
-  /**
-   * The description for the name form description attribute syntax.
-   */
-  public static final String SYNTAX_NAME_FORM_DESCRIPTION =
-    "Name Form Description";
+    /**
+     * The name for the name and optional uid attribute syntax.
+     */
+    public static final String SYNTAX_NAME_AND_OPTIONAL_UID_NAME = "NameAndOptionalUID";
 
-  /**
-   * The name for the name form description attribute syntax.
-   */
-  public static final String SYNTAX_NAME_FORM_NAME = "NameFormDescription";
+    /**
+     * The OID for the name and optional uid attribute syntax.
+     */
+    public static final String SYNTAX_NAME_AND_OPTIONAL_UID_OID = "1.3.6.1.4.1.1466.115.121.1.34";
 
-  /**
-   * The OID for the name form description attribute syntax.
-   */
-  public static final String SYNTAX_NAME_FORM_OID =
-    "1.3.6.1.4.1.1466.115.121.1.35";
+    /**
+     * The description for the name form description attribute syntax.
+     */
+    public static final String SYNTAX_NAME_FORM_DESCRIPTION = "Name Form Description";
 
-  /**
-   * The description for the numeric string attribute syntax.
-   */
-  public static final String SYNTAX_NUMERIC_STRING_DESCRIPTION =
-    "Numeric String";
+    /**
+     * The name for the name form description attribute syntax.
+     */
+    public static final String SYNTAX_NAME_FORM_NAME = "NameFormDescription";
 
-  /**
-   * The name for the numeric string attribute syntax.
-   */
-  public static final String SYNTAX_NUMERIC_STRING_NAME = "NumericString";
+    /**
+     * The OID for the name form description attribute syntax.
+     */
+    public static final String SYNTAX_NAME_FORM_OID = "1.3.6.1.4.1.1466.115.121.1.35";
 
-  /**
-   * The OID for the numeric string attribute syntax.
-   */
-  public static final String SYNTAX_NUMERIC_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.36";
+    /**
+     * The description for the numeric string attribute syntax.
+     */
+    public static final String SYNTAX_NUMERIC_STRING_DESCRIPTION = "Numeric String";
 
-  /**
-   * The description for the object class description attribute syntax.
-   */
-  public static final String SYNTAX_OBJECTCLASS_DESCRIPTION =
-    "Object Class Description";
+    /**
+     * The name for the numeric string attribute syntax.
+     */
+    public static final String SYNTAX_NUMERIC_STRING_NAME = "NumericString";
 
-  /**
-   * The name for the object class description attribute syntax.
-   */
-  public static final String SYNTAX_OBJECTCLASS_NAME = "ObjectClassDescription";
+    /**
+     * The OID for the numeric string attribute syntax.
+     */
+    public static final String SYNTAX_NUMERIC_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.36";
 
-  /**
-   * The OID for the object class description attribute syntax.
-   */
-  public static final String SYNTAX_OBJECTCLASS_OID =
-    "1.3.6.1.4.1.1466.115.121.1.37";
+    /**
+     * The description for the object class description attribute syntax.
+     */
+    public static final String SYNTAX_OBJECTCLASS_DESCRIPTION = "Object Class Description";
 
-  /**
-   * The description for the octet string attribute syntax.
-   */
-  public static final String SYNTAX_OCTET_STRING_DESCRIPTION = "Octet String";
+    /**
+     * The name for the object class description attribute syntax.
+     */
+    public static final String SYNTAX_OBJECTCLASS_NAME = "ObjectClassDescription";
 
-  /**
-   * The name for the octet string attribute syntax.
-   */
-  public static final String SYNTAX_OCTET_STRING_NAME = "OctetString";
+    /**
+     * The OID for the object class description attribute syntax.
+     */
+    public static final String SYNTAX_OBJECTCLASS_OID = "1.3.6.1.4.1.1466.115.121.1.37";
 
-  /**
-   * The OID for the octet string attribute syntax.
-   */
-  public static final String SYNTAX_OCTET_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.40";
+    /**
+     * The description for the octet string attribute syntax.
+     */
+    public static final String SYNTAX_OCTET_STRING_DESCRIPTION = "Octet String";
 
-  /**
-   * The description for the object identifier attribute syntax.
-   */
-  public static final String SYNTAX_OID_DESCRIPTION = "OID";
+    /**
+     * The name for the octet string attribute syntax.
+     */
+    public static final String SYNTAX_OCTET_STRING_NAME = "OctetString";
 
-  /**
-   * The name for the object identifier attribute syntax.
-   */
-  public static final String SYNTAX_OID_NAME = "OID";
+    /**
+     * The OID for the octet string attribute syntax.
+     */
+    public static final String SYNTAX_OCTET_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.40";
 
-  /**
-   * The OID for the object identifier attribute syntax.
-   */
-  public static final String SYNTAX_OID_OID = "1.3.6.1.4.1.1466.115.121.1.38";
+    /**
+     * The description for the object identifier attribute syntax.
+     */
+    public static final String SYNTAX_OID_DESCRIPTION = "OID";
 
-  /**
-   * The description for the other mailbox attribute syntax.
-   */
-  public static final String SYNTAX_OTHER_MAILBOX_DESCRIPTION = "Other Mailbox";
+    /**
+     * The name for the object identifier attribute syntax.
+     */
+    public static final String SYNTAX_OID_NAME = "OID";
 
-  /**
-   * The name for the other mailbox attribute syntax.
-   */
-  public static final String SYNTAX_OTHER_MAILBOX_NAME = "OtherMailbox";
+    /**
+     * The OID for the object identifier attribute syntax.
+     */
+    public static final String SYNTAX_OID_OID = "1.3.6.1.4.1.1466.115.121.1.38";
 
-  /**
-   * The OID for the other mailbox attribute syntax.
-   */
-  public static final String SYNTAX_OTHER_MAILBOX_OID =
-    "1.3.6.1.4.1.1466.115.121.1.39";
+    /**
+     * The description for the other mailbox attribute syntax.
+     */
+    public static final String SYNTAX_OTHER_MAILBOX_DESCRIPTION = "Other Mailbox";
 
-  /**
-   * The description for the postal address attribute syntax.
-   */
-  public static final String SYNTAX_POSTAL_ADDRESS_DESCRIPTION =
-    "Postal Address";
+    /**
+     * The name for the other mailbox attribute syntax.
+     */
+    public static final String SYNTAX_OTHER_MAILBOX_NAME = "OtherMailbox";
 
-  /**
-   * The name for the postal address attribute syntax.
-   */
-  public static final String SYNTAX_POSTAL_ADDRESS_NAME = "PostalAddress";
+    /**
+     * The OID for the other mailbox attribute syntax.
+     */
+    public static final String SYNTAX_OTHER_MAILBOX_OID = "1.3.6.1.4.1.1466.115.121.1.39";
 
-  /**
-   * The OID for the postal address attribute syntax.
-   */
-  public static final String SYNTAX_POSTAL_ADDRESS_OID =
-    "1.3.6.1.4.1.1466.115.121.1.41";
+    /**
+     * The description for the postal address attribute syntax.
+     */
+    public static final String SYNTAX_POSTAL_ADDRESS_DESCRIPTION = "Postal Address";
 
-  /**
-   * The description for the presentation address attribute syntax.
-   */
-  public static final String SYNTAX_PRESENTATION_ADDRESS_DESCRIPTION =
-    "Presentation Address";
+    /**
+     * The name for the postal address attribute syntax.
+     */
+    public static final String SYNTAX_POSTAL_ADDRESS_NAME = "PostalAddress";
 
-  /**
-   * The name for the presentation address attribute syntax.
-   */
-  public static final String SYNTAX_PRESENTATION_ADDRESS_NAME =
-    "PresentationAddress";
+    /**
+     * The OID for the postal address attribute syntax.
+     */
+    public static final String SYNTAX_POSTAL_ADDRESS_OID = "1.3.6.1.4.1.1466.115.121.1.41";
 
-  /**
-   * The OID for the presentation address attribute syntax.
-   */
-  public static final String SYNTAX_PRESENTATION_ADDRESS_OID =
-    "1.3.6.1.4.1.1466.115.121.1.43";
+    /**
+     * The description for the presentation address attribute syntax.
+     */
+    public static final String SYNTAX_PRESENTATION_ADDRESS_DESCRIPTION = "Presentation Address";
 
-  /**
-   * The description for the printable string attribute syntax.
-   */
-  public static final String SYNTAX_PRINTABLE_STRING_DESCRIPTION =
-    "Printable String";
+    /**
+     * The name for the presentation address attribute syntax.
+     */
+    public static final String SYNTAX_PRESENTATION_ADDRESS_NAME = "PresentationAddress";
 
-  /**
-   * The name for the printable string attribute syntax.
-   */
-  public static final String SYNTAX_PRINTABLE_STRING_NAME = "PrintableString";
+    /**
+     * The OID for the presentation address attribute syntax.
+     */
+    public static final String SYNTAX_PRESENTATION_ADDRESS_OID = "1.3.6.1.4.1.1466.115.121.1.43";
 
-  /**
-   * The OID for the printable string attribute syntax.
-   */
-  public static final String SYNTAX_PRINTABLE_STRING_OID =
-    "1.3.6.1.4.1.1466.115.121.1.44";
+    /**
+     * The description for the printable string attribute syntax.
+     */
+    public static final String SYNTAX_PRINTABLE_STRING_DESCRIPTION = "Printable String";
 
-  /**
-   * The description for the protocol information attribute syntax.
-   */
-  public static final String SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION =
-    "Protocol Information";
+    /**
+     * The name for the printable string attribute syntax.
+     */
+    public static final String SYNTAX_PRINTABLE_STRING_NAME = "PrintableString";
 
-  /**
-   * The name for the protocol information attribute syntax.
-   */
-  public static final String SYNTAX_PROTOCOL_INFORMATION_NAME =
-    "ProtocolInformation";
+    /**
+     * The OID for the printable string attribute syntax.
+     */
+    public static final String SYNTAX_PRINTABLE_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.44";
 
-  /**
-   * The OID for the protocol information attribute syntax.
-   */
-  public static final String SYNTAX_PROTOCOL_INFORMATION_OID =
-    "1.3.6.1.4.1.1466.115.121.1.42";
+    /**
+     * The description for the protocol information attribute syntax.
+     */
+    public static final String SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION = "Protocol Information";
 
-  /**
-   * The OID for the relative subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_OID =
-    OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".2";
+    /**
+     * The name for the protocol information attribute syntax.
+     */
+    public static final String SYNTAX_PROTOCOL_INFORMATION_NAME = "ProtocolInformation";
 
-  /**
-   * The description for the relative subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_DESCRIPTION =
-    "Relative Subtree Specification";
+    /**
+     * The OID for the protocol information attribute syntax.
+     */
+    public static final String SYNTAX_PROTOCOL_INFORMATION_OID = "1.3.6.1.4.1.1466.115.121.1.42";
 
-  /**
-   * The name for the relative subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_NAME =
-    "ds-relative-subtree-specification";
+    /**
+     * The OID for the relative subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_OID =
+            OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".2";
 
-  /**
-   * The OID for the RFC3672 subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_OID =
-    "1.3.6.1.4.1.1466.115.121.1.45";
+    /**
+     * The description for the relative subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_DESCRIPTION =
+            "Relative Subtree Specification";
 
-  /**
-   * The description for the RFC3672 subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_DESCRIPTION =
-    "RFC3672 Subtree Specification";
+    /**
+     * The name for the relative subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_NAME =
+            "ds-relative-subtree-specification";
 
-  /**
-   * The name for the RFC3672 subtree specification attribute syntax.
-   */
-  public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_NAME =
-    "SubtreeSpecification";
+    /**
+     * The OID for the RFC3672 subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_OID =
+            "1.3.6.1.4.1.1466.115.121.1.45";
 
-  /**
-   * The description for the substring assertion attribute syntax.
-   */
-  public static final String SYNTAX_SUBSTRING_ASSERTION_DESCRIPTION =
-    "Substring Assertion";
+    /**
+     * The description for the RFC3672 subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_DESCRIPTION =
+            "RFC3672 Subtree Specification";
 
-  /**
-   * The name for the substring assertion attribute syntax.
-   */
-  public static final String SYNTAX_SUBSTRING_ASSERTION_NAME =
-    "SubstringAssertion";
+    /**
+     * The name for the RFC3672 subtree specification attribute syntax.
+     */
+    public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_NAME = "SubtreeSpecification";
 
-  /**
-   * The OID for the Substring Assertion syntax used for assertion values in
-   * extensible match filters.
-   */
-  public static final String SYNTAX_SUBSTRING_ASSERTION_OID =
-    "1.3.6.1.4.1.1466.115.121.1.58";
+    /**
+     * The description for the substring assertion attribute syntax.
+     */
+    public static final String SYNTAX_SUBSTRING_ASSERTION_DESCRIPTION = "Substring Assertion";
 
-  /**
-   * The description for the supported algorithm attribute syntax.
-   */
-  public static final String SYNTAX_SUPPORTED_ALGORITHM_DESCRIPTION =
-    "Supported Algorithm";
+    /**
+     * The name for the substring assertion attribute syntax.
+     */
+    public static final String SYNTAX_SUBSTRING_ASSERTION_NAME = "SubstringAssertion";
 
-  /**
-   * The name for the supported algorithm attribute syntax.
-   */
-  public static final String SYNTAX_SUPPORTED_ALGORITHM_NAME =
-    "SupportedAlgorithm";
+    /**
+     * The OID for the Substring Assertion syntax used for assertion values in
+     * extensible match filters.
+     */
+    public static final String SYNTAX_SUBSTRING_ASSERTION_OID = "1.3.6.1.4.1.1466.115.121.1.58";
 
-  /**
-   * The OID for the Substring Assertion syntax used for assertion values in
-   * extensible match filters.
-   */
-  public static final String SYNTAX_SUPPORTED_ALGORITHM_OID =
-    "1.3.6.1.4.1.1466.115.121.1.49";
+    /**
+     * The description for the supported algorithm attribute syntax.
+     */
+    public static final String SYNTAX_SUPPORTED_ALGORITHM_DESCRIPTION = "Supported Algorithm";
 
-  /**
-   * The description for the telephone number attribute syntax.
-   */
-  public static final String SYNTAX_TELEPHONE_DESCRIPTION = "Telephone Number";
+    /**
+     * The name for the supported algorithm attribute syntax.
+     */
+    public static final String SYNTAX_SUPPORTED_ALGORITHM_NAME = "SupportedAlgorithm";
 
-  /**
-   * The name for the telephone number attribute syntax.
-   */
-  public static final String SYNTAX_TELEPHONE_NAME = "TelephoneNumber";
+    /**
+     * The OID for the Substring Assertion syntax used for assertion values in
+     * extensible match filters.
+     */
+    public static final String SYNTAX_SUPPORTED_ALGORITHM_OID = "1.3.6.1.4.1.1466.115.121.1.49";
 
-  /**
-   * The OID for the telephone number attribute syntax.
-   */
-  public static final String SYNTAX_TELEPHONE_OID =
-    "1.3.6.1.4.1.1466.115.121.1.50";
+    /**
+     * The description for the telephone number attribute syntax.
+     */
+    public static final String SYNTAX_TELEPHONE_DESCRIPTION = "Telephone Number";
 
-  /**
-   * The description for the teletex terminal identifier attribute syntax.
-   */
-  public static final String SYNTAX_TELETEX_TERM_ID_DESCRIPTION =
-    "Teletex Terminal Identifier";
+    /**
+     * The name for the telephone number attribute syntax.
+     */
+    public static final String SYNTAX_TELEPHONE_NAME = "TelephoneNumber";
 
-  /**
-   * The name for the teletex terminal identifier attribute syntax.
-   */
-  public static final String SYNTAX_TELETEX_TERM_ID_NAME =
-    "TeletexTerminalIdentifier";
+    /**
+     * The OID for the telephone number attribute syntax.
+     */
+    public static final String SYNTAX_TELEPHONE_OID = "1.3.6.1.4.1.1466.115.121.1.50";
 
-  /**
-   * The OID for the teletex terminal identifier attribute syntax.
-   */
-  public static final String SYNTAX_TELETEX_TERM_ID_OID =
-    "1.3.6.1.4.1.1466.115.121.1.51";
+    /**
+     * The description for the teletex terminal identifier attribute syntax.
+     */
+    public static final String SYNTAX_TELETEX_TERM_ID_DESCRIPTION = "Teletex Terminal Identifier";
 
-  /**
-   * The description for the telex number attribute syntax.
-   */
-  public static final String SYNTAX_TELEX_DESCRIPTION = "Telex Number";
+    /**
+     * The name for the teletex terminal identifier attribute syntax.
+     */
+    public static final String SYNTAX_TELETEX_TERM_ID_NAME = "TeletexTerminalIdentifier";
 
-  /**
-   * The name for the telex number attribute syntax.
-   */
-  public static final String SYNTAX_TELEX_NAME = "TelexNumber";
+    /**
+     * The OID for the teletex terminal identifier attribute syntax.
+     */
+    public static final String SYNTAX_TELETEX_TERM_ID_OID = "1.3.6.1.4.1.1466.115.121.1.51";
 
-  /**
-   * The OID for the telex number attribute syntax.
-   */
-  public static final String SYNTAX_TELEX_OID = "1.3.6.1.4.1.1466.115.121.1.52";
+    /**
+     * The description for the telex number attribute syntax.
+     */
+    public static final String SYNTAX_TELEX_DESCRIPTION = "Telex Number";
 
-  /**
-   * The description for the user password attribute syntax.
-   */
-  public static final String SYNTAX_USER_PASSWORD_DESCRIPTION = "User Password";
+    /**
+     * The name for the telex number attribute syntax.
+     */
+    public static final String SYNTAX_TELEX_NAME = "TelexNumber";
 
-  /**
-   * The name for the user password attribute syntax.
-   */
-  public static final String SYNTAX_USER_PASSWORD_NAME =
-    "ds-syntax-user-password";
+    /**
+     * The OID for the telex number attribute syntax.
+     */
+    public static final String SYNTAX_TELEX_OID = "1.3.6.1.4.1.1466.115.121.1.52";
 
-  /**
-   * The OID for the user password attribute syntax.
-   */
-  public static final String SYNTAX_USER_PASSWORD_OID =
-    OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".1";
+    /**
+     * The description for the user password attribute syntax.
+     */
+    public static final String SYNTAX_USER_PASSWORD_DESCRIPTION = "User Password";
 
-  /**
-   * The description for the UTC time attribute syntax.
-   */
-  public static final String SYNTAX_UTC_TIME_DESCRIPTION = "UTC Time";
+    /**
+     * The name for the user password attribute syntax.
+     */
+    public static final String SYNTAX_USER_PASSWORD_NAME = "ds-syntax-user-password";
 
-  /**
-   * The name for the UTC time attribute syntax.
-   */
-  public static final String SYNTAX_UTC_TIME_NAME = "UTCTime";
+    /**
+     * The OID for the user password attribute syntax.
+     */
+    public static final String SYNTAX_USER_PASSWORD_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE
+            + ".1";
 
-  /**
-   * The OID for the UTC time attribute syntax.
-   */
-  public static final String SYNTAX_UTC_TIME_OID =
-    "1.3.6.1.4.1.1466.115.121.1.53";
+    /**
+     * The description for the UTC time attribute syntax.
+     */
+    public static final String SYNTAX_UTC_TIME_DESCRIPTION = "UTC Time";
 
-  /**
-   * The description for the UUID attribute syntax.
-   */
-  public static final String SYNTAX_UUID_DESCRIPTION = "UUID";
+    /**
+     * The name for the UTC time attribute syntax.
+     */
+    public static final String SYNTAX_UTC_TIME_NAME = "UTCTime";
 
-  /**
-   * The name for the UUID attribute syntax.
-   */
-  public static final String SYNTAX_UUID_NAME = "UUID";
+    /**
+     * The OID for the UTC time attribute syntax.
+     */
+    public static final String SYNTAX_UTC_TIME_OID = "1.3.6.1.4.1.1466.115.121.1.53";
 
-  /**
-   * The OID for the UUID attribute syntax.
-   */
-  public static final String SYNTAX_UUID_OID = "1.3.6.1.1.16.1";
+    /**
+     * The description for the UUID attribute syntax.
+     */
+    public static final String SYNTAX_UUID_DESCRIPTION = "UUID";
 
-  /**
-   * The description for the "top" objectclass.
-   */
-  public static final String TOP_OBJECTCLASS_DESCRIPTION = "Topmost ObjectClass";
+    /**
+     * The name for the UUID attribute syntax.
+     */
+    public static final String SYNTAX_UUID_NAME = "UUID";
 
-  /**
-   * The name of the "top" objectclass.
-   */
-  public static final String TOP_OBJECTCLASS_NAME = "top";
+    /**
+     * The OID for the UUID attribute syntax.
+     */
+    public static final String SYNTAX_UUID_OID = "1.3.6.1.1.16.1";
 
-  /**
-   * The OID for the "top" objectclass.
-   */
-  public static final String TOP_OBJECTCLASS_OID = "2.5.6.0";
+    /**
+     * The description for the "top" objectclass.
+     */
+    public static final String TOP_OBJECTCLASS_DESCRIPTION = "Topmost ObjectClass";
 
-  /**
-   * The name for the relative time greater-than extensible ordering matching
-   * rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_GT_NAME =
-    "relativeTimeGTOrderingMatch";
+    /**
+     * The name of the "top" objectclass.
+     */
+    public static final String TOP_OBJECTCLASS_NAME = "top";
 
-  /**
-   * The alternative name for the relative time greater-than extensible ordering
-   * matching rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_GT_ALT_NAME =
-    "relativeTimeOrderingMatch.gt";
+    /**
+     * The OID for the "top" objectclass.
+     */
+    public static final String TOP_OBJECTCLASS_OID = "2.5.6.0";
 
-  /**
-   * The OID for the relative time greater-than extensible ordering matching
-   * rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_GT_OID =
-    "1.3.6.1.4.1.26027.1.4.5";
+    /**
+     * The name for the relative time greater-than extensible ordering matching
+     * rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_GT_NAME = "relativeTimeGTOrderingMatch";
 
-  /**
-   * The name for the relative time less-than extensible ordering matching rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_LT_NAME =
-    "relativeTimeLTOrderingMatch";
+    /**
+     * The alternative name for the relative time greater-than extensible
+     * ordering matching rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_GT_ALT_NAME = "relativeTimeOrderingMatch.gt";
 
-  /**
-   * The alternative name for the relative time less-than extensible ordering
-   * matching rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_LT_ALT_NAME =
-    "relativeTimeOrderingMatch.lt";
+    /**
+     * The OID for the relative time greater-than extensible ordering matching
+     * rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_GT_OID = "1.3.6.1.4.1.26027.1.4.5";
 
-  /**
-   * The OID for the relative time less-than extensible ordering matching rule.
-   */
-  public static final String EXT_OMR_RELATIVE_TIME_LT_OID =
-    "1.3.6.1.4.1.26027.1.4.6";
+    /**
+     * The name for the relative time less-than extensible ordering matching
+     * rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_LT_NAME = "relativeTimeLTOrderingMatch";
 
-  /**
-   * The OID for the partial date and time extensible matching rule.
-   */
-  public static final String EXT_PARTIAL_DATE_TIME_OID =
-    "1.3.6.1.4.1.26027.1.4.7";
+    /**
+     * The alternative name for the relative time less-than extensible ordering
+     * matching rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_LT_ALT_NAME = "relativeTimeOrderingMatch.lt";
 
-  /**
-   * The name for the partial date and time extensible rule.
-   */
-  public static final String EXT_PARTIAL_DATE_TIME_NAME =
-    "partialDateAndTimeMatchingRule";
+    /**
+     * The OID for the relative time less-than extensible ordering matching
+     * rule.
+     */
+    public static final String EXT_OMR_RELATIVE_TIME_LT_OID = "1.3.6.1.4.1.26027.1.4.6";
 
-  /**
-   * The name of the schema extension that will be used to specify the
-   * approximate matching rule that should be used for a given attribute type.
-   */
-  public static final String SCHEMA_PROPERTY_APPROX_RULE = "X-APPROX";
+    /**
+     * The OID for the partial date and time extensible matching rule.
+     */
+    public static final String EXT_PARTIAL_DATE_TIME_OID = "1.3.6.1.4.1.26027.1.4.7";
 
-  /**
-   * The name of the schema property that will be used to specify the origin of
-   * a schema element.
-   */
-  public static final String SCHEMA_PROPERTY_ORIGIN = "X-ORIGIN";
+    /**
+     * The name for the partial date and time extensible rule.
+     */
+    public static final String EXT_PARTIAL_DATE_TIME_NAME = "partialDateAndTimeMatchingRule";
 
-  /**
-   * The OID for the extensibleObject objectclass.
-   */
-  public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_OID =
-    "1.3.6.1.4.1.1466.101.120.111";
+    /**
+     * The name of the schema extension that will be used to specify the
+     * approximate matching rule that should be used for a given attribute type.
+     */
+    public static final String SCHEMA_PROPERTY_APPROX_RULE = "X-APPROX";
 
-  /**
-   * The name for the extensibleObject objectclass.
-   */
-  public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_NAME =
-    "extensibleObject";
+    /**
+     * The name of the schema property that will be used to specify the origin
+     * of a schema element.
+     */
+    public static final String SCHEMA_PROPERTY_ORIGIN = "X-ORIGIN";
 
-  /**
-   * The value representing just one space character.
-   */
-  public static final ByteString SINGLE_SPACE_VALUE = ByteString.valueOf(" ");
+    /**
+     * The OID for the extensibleObject objectclass.
+     */
+    public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_OID = "1.3.6.1.4.1.1466.101.120.111";
 
-  /**
-   * The normalized true value.
-   */
-  public static final ByteString TRUE_VALUE = ByteString.valueOf("TRUE");
+    /**
+     * The name for the extensibleObject objectclass.
+     */
+    public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_NAME = "extensibleObject";
 
-  /**
-   * The normalized false value.
-   */
-  public static final ByteString FALSE_VALUE = ByteString.valueOf("FALSE");
+    /**
+     * The value representing just one space character.
+     */
+    public static final ByteString SINGLE_SPACE_VALUE = ByteString.valueOf(" ");
 
-  /**
-   * The name of the time zone for universal coordinated time (UTC).
-   */
-  public static final String TIME_ZONE_UTC = "UTC";
+    /**
+     * The normalized true value.
+     */
+    public static final ByteString TRUE_VALUE = ByteString.valueOf("TRUE");
 
-  /**
-   * The date format string that will be used to construct and parse dates
-   * represented using generalized time with a two-digit year. It is assumed
-   * that the provided date formatter will be set to UTC.
-   */
-  public static final String DATE_FORMAT_UTC_TIME = "yyMMddHHmmss'Z'";
+    /**
+     * The normalized false value.
+     */
+    public static final ByteString FALSE_VALUE = ByteString.valueOf("FALSE");
 
+    /**
+     * The name of the time zone for universal coordinated time (UTC).
+     */
+    public static final String TIME_ZONE_UTC = "UTC";
 
+    /**
+     * The date format string that will be used to construct and parse dates
+     * represented using generalized time with a two-digit year. It is assumed
+     * that the provided date formatter will be set to UTC.
+     */
+    public static final String DATE_FORMAT_UTC_TIME = "yyMMddHHmmss'Z'";
 
-  // Prevent instantiation.
-  private SchemaConstants()
-  {
-    // Nothing to do.
-  }
+    // Prevent instantiation.
+    private SchemaConstants() {
+        // Nothing to do.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
index 09f1340..ca496d6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -37,8 +34,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An abstract base class for LDAP schema definitions which contain an
  * description, and an optional set of extra properties.
@@ -47,137 +42,113 @@
  * schema definitions (e.g. object class definitions, and attribute type
  * definitions).
  */
-abstract class SchemaElement
-{
-  // The description for this definition.
-  final String description;
+abstract class SchemaElement {
+    // The description for this definition.
+    final String description;
 
-  // The set of additional name-value pairs.
-  final Map<String, List<String>> extraProperties;
+    // The set of additional name-value pairs.
+    final Map<String, List<String>> extraProperties;
 
+    SchemaElement(final String description, final Map<String, List<String>> extraProperties) {
+        Validator.ensureNotNull(description, extraProperties);
+        this.description = description;
 
-
-  SchemaElement(final String description,
-      final Map<String, List<String>> extraProperties)
-  {
-    Validator.ensureNotNull(description, extraProperties);
-    this.description = description;
-
-    // Assumes caller has made the map unmodifiable.
-    this.extraProperties = extraProperties;
-  }
-
-
-
-  /**
-   * Returns the description of this schema definition.
-   *
-   * @return The description of this schema definition.
-   */
-  public final String getDescription()
-  {
-
-    return description;
-  }
-
-
-
-  /**
-   * Returns an unmodifiable list containing the values of the named "extra"
-   * property for this schema definition.
-   *
-   * @param name
-   *          The name of the "extra" property whose values are to be returned.
-   * @return Returns an unmodifiable list containing the values of the named
-   *         "extra" property for this schema definition, which may be empty if
-   *         no such property is defined.
-   */
-  public final List<String> getExtraProperty(final String name)
-  {
-
-    final List<String> values = extraProperties.get(name);
-    return values != null ? values : Collections.<String> emptyList();
-  }
-
-
-
-  /**
-   * Returns an unmodifiable set containing the names of the "extra" properties
-   * associated with this schema definition.
-   *
-   * @return Returns an unmodifiable set containing the names of the "extra"
-   *         properties associated with this schema definition.
-   */
-  public final Set<String> getExtraPropertyNames()
-  {
-
-    return extraProperties.keySet();
-  }
-
-
-
-  /**
-   * Builds a string representation of this schema definition in the form
-   * specified in RFC 2252.
-   *
-   * @return The string representation of this schema definition in the form
-   *         specified in RFC 2252.
-   */
-  final String buildDefinition()
-  {
-    final StringBuilder buffer = new StringBuilder();
-
-    buffer.append("( ");
-
-    toStringContent(buffer);
-
-    if (!extraProperties.isEmpty())
-    {
-      for (final Map.Entry<String, List<String>> e : extraProperties.entrySet())
-      {
-
-        final String property = e.getKey();
-
-        final List<String> valueList = e.getValue();
-
-        buffer.append(" ");
-        buffer.append(property);
-
-        if (valueList.size() == 1)
-        {
-          buffer.append(" '");
-          buffer.append(valueList.get(0));
-          buffer.append("'");
-        }
-        else
-        {
-          buffer.append(" ( ");
-
-          for (final String value : valueList)
-          {
-            buffer.append("'");
-            buffer.append(value);
-            buffer.append("' ");
-          }
-
-          buffer.append(")");
-        }
-      }
+        // Assumes caller has made the map unmodifiable.
+        this.extraProperties = extraProperties;
     }
 
-    buffer.append(" )");
+    /**
+     * Returns the description of this schema definition.
+     *
+     * @return The description of this schema definition.
+     */
+    public final String getDescription() {
 
-    return buffer.toString();
-  }
+        return description;
+    }
 
+    /**
+     * Returns an unmodifiable list containing the values of the named "extra"
+     * property for this schema definition.
+     *
+     * @param name
+     *            The name of the "extra" property whose values are to be
+     *            returned.
+     * @return Returns an unmodifiable list containing the values of the named
+     *         "extra" property for this schema definition, which may be empty
+     *         if no such property is defined.
+     */
+    public final List<String> getExtraProperty(final String name) {
 
+        final List<String> values = extraProperties.get(name);
+        return values != null ? values : Collections.<String> emptyList();
+    }
 
-  /**
-   * Appends a string representation of this schema definition's non-generic
-   * properties to the provided buffer.
-   *
-   * @param buffer
-   *          The buffer to which the information should be appended.
-   */
-  abstract void toStringContent(StringBuilder buffer);
+    /**
+     * Returns an unmodifiable set containing the names of the "extra"
+     * properties associated with this schema definition.
+     *
+     * @return Returns an unmodifiable set containing the names of the "extra"
+     *         properties associated with this schema definition.
+     */
+    public final Set<String> getExtraPropertyNames() {
+
+        return extraProperties.keySet();
+    }
+
+    /**
+     * Builds a string representation of this schema definition in the form
+     * specified in RFC 2252.
+     *
+     * @return The string representation of this schema definition in the form
+     *         specified in RFC 2252.
+     */
+    final String buildDefinition() {
+        final StringBuilder buffer = new StringBuilder();
+
+        buffer.append("( ");
+
+        toStringContent(buffer);
+
+        if (!extraProperties.isEmpty()) {
+            for (final Map.Entry<String, List<String>> e : extraProperties.entrySet()) {
+
+                final String property = e.getKey();
+
+                final List<String> valueList = e.getValue();
+
+                buffer.append(" ");
+                buffer.append(property);
+
+                if (valueList.size() == 1) {
+                    buffer.append(" '");
+                    buffer.append(valueList.get(0));
+                    buffer.append("'");
+                } else {
+                    buffer.append(" ( ");
+
+                    for (final String value : valueList) {
+                        buffer.append("'");
+                        buffer.append(value);
+                        buffer.append("' ");
+                    }
+
+                    buffer.append(")");
+                }
+            }
+        }
+
+        buffer.append(" )");
+
+        return buffer.toString();
+    }
+
+    /**
+     * Appends a string representation of this schema definition's non-generic
+     * properties to the provided buffer.
+     *
+     * @param buffer
+     *            The buffer to which the information should be appended.
+     */
+    abstract void toStringContent(StringBuilder buffer);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java
index a99b417..9d45f97 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,61 +26,47 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.i18n.LocalizableException;
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * Thrown when a schema could not be decoded or validated.
  */
 @SuppressWarnings("serial")
-final class SchemaException extends Exception implements LocalizableException
-{
-  // The I18N message associated with this exception.
-  private final LocalizableMessage message;
+final class SchemaException extends Exception implements LocalizableException {
+    // The I18N message associated with this exception.
+    private final LocalizableMessage message;
 
+    /**
+     * Creates a new schema exception with the provided message.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     */
+    public SchemaException(final LocalizableMessage message) {
+        super(String.valueOf(message));
+        this.message = message;
+    }
 
+    /**
+     * Creates a new schema exception with the provided message and cause.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @param cause
+     *            The cause which may be later retrieved by the
+     *            {@link #getCause} method. A {@code null} value is permitted,
+     *            and indicates that the cause is nonexistent or unknown.
+     */
+    public SchemaException(final LocalizableMessage message, final Throwable cause) {
+        super(String.valueOf(message), cause);
+        this.message = message;
+    }
 
-  /**
-   * Creates a new schema exception with the provided message.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   */
-  public SchemaException(final LocalizableMessage message)
-  {
-    super(String.valueOf(message));
-    this.message = message;
-  }
-
-
-
-  /**
-   * Creates a new schema exception with the provided message and cause.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @param cause
-   *          The cause which may be later retrieved by the {@link #getCause}
-   *          method. A {@code null} value is permitted, and indicates that the
-   *          cause is nonexistent or unknown.
-   */
-  public SchemaException(final LocalizableMessage message, final Throwable cause)
-  {
-    super(String.valueOf(message), cause);
-    this.message = message;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LocalizableMessage getMessageObject()
-  {
-    return this.message;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public LocalizableMessage getMessageObject() {
+        return this.message;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java
index 36af8b6..f7ab9f8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,882 +26,713 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.isAlpha;
 import static com.forgerock.opendj.util.StaticUtils.isDigit;
 import static com.forgerock.opendj.util.StaticUtils.isKeyChar;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.DecodeException;
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * Schema utility methods.
  */
-final class SchemaUtils
-{
-  /**
-   * Reads the value for an "extra" parameter. It will handle a single unquoted
-   * word (which is technically illegal, but we'll allow it), a single quoted
-   * string, or an open parenthesis followed by a space-delimited set of quoted
-   * strings or unquoted words followed by a close parenthesis.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @return The "extra" parameter value that was read.
-   * @throws DecodeException
-   *           If a problem occurs while attempting to read the value.
-   */
-  static List<String> readExtensions(final SubstringReader reader)
-      throws DecodeException
-  {
-    int length = 0;
-    List<String> values;
+final class SchemaUtils {
+    /**
+     * Reads the value for an "extra" parameter. It will handle a single
+     * unquoted word (which is technically illegal, but we'll allow it), a
+     * single quoted string, or an open parenthesis followed by a
+     * space-delimited set of quoted strings or unquoted words followed by a
+     * close parenthesis.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @return The "extra" parameter value that was read.
+     * @throws DecodeException
+     *             If a problem occurs while attempting to read the value.
+     */
+    static List<String> readExtensions(final SubstringReader reader) throws DecodeException {
+        int length = 0;
+        List<String> values;
 
-    // Skip over any leading spaces.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      // Look at the next character. If it is a quote, then parse until
-      // the next quote and end. If it is an open parenthesis, then
-      // parse individual values until the close parenthesis and end.
-      // Otherwise, parse until the next space and end.
-      char c = reader.read();
-      if (c == '\'')
-      {
-        reader.mark();
-        // Parse until the closing quote.
-        while (reader.read() != '\'')
-        {
-          length++;
-        }
-
-        reader.reset();
-        values = Collections.singletonList(reader.read(length));
-        reader.read();
-      }
-      else if (c == '(')
-      {
-        // Skip over any leading spaces;
+        // Skip over any leading spaces.
         reader.skipWhitespaces();
         reader.mark();
 
-        c = reader.read();
-        if (c == ')')
-        {
-          values = Collections.emptyList();
+        try {
+            // Look at the next character. If it is a quote, then parse until
+            // the next quote and end. If it is an open parenthesis, then
+            // parse individual values until the close parenthesis and end.
+            // Otherwise, parse until the next space and end.
+            char c = reader.read();
+            if (c == '\'') {
+                reader.mark();
+                // Parse until the closing quote.
+                while (reader.read() != '\'') {
+                    length++;
+                }
+
+                reader.reset();
+                values = Collections.singletonList(reader.read(length));
+                reader.read();
+            } else if (c == '(') {
+                // Skip over any leading spaces;
+                reader.skipWhitespaces();
+                reader.mark();
+
+                c = reader.read();
+                if (c == ')') {
+                    values = Collections.emptyList();
+                } else {
+                    values = new ArrayList<String>();
+                    do {
+                        reader.reset();
+                        values.add(readQuotedString(reader));
+                        reader.skipWhitespaces();
+                        reader.mark();
+                    } while (reader.read() != ')');
+                    values = Collections.unmodifiableList(values);
+                }
+            } else {
+                // Parse until the next space.
+                do {
+                    length++;
+                } while (reader.read() != ' ');
+
+                reader.reset();
+                values = Collections.singletonList(reader.read(length));
+            }
+
+            return values;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
         }
-        else
-        {
-          values = new ArrayList<String>();
-          do
-          {
-            reader.reset();
-            values.add(readQuotedString(reader));
-            reader.skipWhitespaces();
+    }
+
+    static List<String> readNameDescriptors(final SubstringReader reader,
+            final boolean allowCompatChars) throws DecodeException {
+        List<String> values;
+
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
+
+        try {
             reader.mark();
-          }
-          while (reader.read() != ')');
-          values = Collections.unmodifiableList(values);
+            char c = reader.read();
+            if (c == '\'') {
+                reader.reset();
+                values = Collections.singletonList(readQuotedDescriptor(reader, allowCompatChars));
+                reader.read();
+            } else if (c == '(') {
+                // Skip over any leading spaces;
+                reader.skipWhitespaces();
+                reader.mark();
+
+                c = reader.read();
+                if (c == ')') {
+                    values = Collections.emptyList();
+                } else {
+                    values = new LinkedList<String>();
+                    do {
+                        reader.reset();
+                        values.add(readQuotedDescriptor(reader, allowCompatChars));
+                        reader.skipWhitespaces();
+                        reader.mark();
+                    } while (reader.read() != ')');
+                    values = Collections.unmodifiableList(values);
+                }
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c), reader
+                                .pos() - 1);
+                throw DecodeException.error(message);
+            }
+
+            return values;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
         }
-      }
-      else
-      {
-        // Parse until the next space.
-        do
-        {
-          length++;
-        }
-        while (reader.read() != ' ');
-
-        reader.reset();
-        values = Collections.singletonList(reader.read(length));
-      }
-
-      return values;
     }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
 
+    /**
+     * Reads the attribute description or numeric OID, skipping over any leading
+     * or trailing spaces.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @param allowCompatChars
+     *            {@code true} if certain illegal characters should be allowed
+     *            for compatibility reasons.
+     * @return The attribute description or numeric OID read from the
+     *         definition.
+     * @throws DecodeException
+     *             If a problem is encountered while reading the name or OID.
+     */
+    static String readOID(final SubstringReader reader, final boolean allowCompatChars)
+            throws DecodeException {
+        int length = 0;
+        boolean enclosingQuote = false;
 
-
-  static List<String> readNameDescriptors(
-      final SubstringReader reader, final boolean allowCompatChars)
-      throws DecodeException
-  {
-    List<String> values;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-
-    try
-    {
-      reader.mark();
-      char c = reader.read();
-      if (c == '\'')
-      {
-        reader.reset();
-        values = Collections.singletonList(readQuotedDescriptor(
-            reader, allowCompatChars));
-        reader.read();
-      }
-      else if (c == '(')
-      {
-        // Skip over any leading spaces;
+        // Skip over any spaces at the beginning of the value.
         reader.skipWhitespaces();
         reader.mark();
 
-        c = reader.read();
-        if (c == ')')
-        {
-          values = Collections.emptyList();
+        if (reader.remaining() > 0) {
+            // The next character must be either numeric (for an OID) or
+            // alphabetic (for an attribute description).
+            if (reader.read() == '\'') {
+                enclosingQuote = true;
+                reader.mark();
+            } else {
+                reader.reset();
+            }
         }
-        else
-        {
-          values = new LinkedList<String>();
-          do
-          {
+
+        if (reader.remaining() > 0) {
+            char c = reader.read();
+            length++;
+
+            if (isDigit(c)) {
+                // This must be a numeric OID. In that case, we will accept
+                // only digits and periods, but not consecutive periods.
+                boolean lastWasPeriod = false;
+
+                while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
+                        && !(c == '\'' && enclosingQuote)) {
+                    if (c == '.') {
+                        if (lastWasPeriod) {
+                            final LocalizableMessage message =
+                                    ERR_ATTR_SYNTAX_OID_CONSECUTIVE_PERIODS1.get(reader.pos() - 1);
+                            throw DecodeException.error(message);
+                        } else {
+                            lastWasPeriod = true;
+                        }
+                    } else if (!isDigit(c)) {
+                        // This must be an illegal character.
+                        // This must have been an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    } else {
+                        lastWasPeriod = false;
+                    }
+
+                    length++;
+                }
+
+                if (lastWasPeriod) {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_OID_ENDS_WITH_PERIOD1.get(reader.pos() - 1);
+                    throw DecodeException.error(message);
+                }
+            } else if (isAlpha(c)) {
+                // This must be an attribute description. In this case, we will
+                // only accept alphabetic characters, numeric digits, and the
+                // hyphen.
+                while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
+                        && !(c == '\'' && enclosingQuote)) {
+                    if (length == 0 && !isAlpha(c)) {
+                        // This is an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    }
+
+                    if (!isKeyChar(c, allowCompatChars)) {
+                        // This is an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    }
+
+                    length++;
+                }
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c), reader
+                                .pos() - 1);
+                throw DecodeException.error(message);
+            }
+
+            if (enclosingQuote && c != '\'') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1.get(reader.pos() - 1, String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+        }
+
+        if (length == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_NO_VALUE1.get(reader.pos() - 1);
+            throw DecodeException.error(message);
+        }
+
+        reader.reset();
+        final String oid = reader.read(length);
+        if (enclosingQuote) {
+            reader.read();
+        }
+
+        return oid;
+    }
+
+    /**
+     * Reads the next OID from the definition, skipping over any leading spaces.
+     * The OID may be followed by a integer length in brackets.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @param allowCompatChars
+     *            {@code true} if certain illegal characters should be allowed
+     *            for compatibility reasons.
+     * @return The OID read from the definition.
+     * @throws DecodeException
+     *             If a problem is encountered while reading the token name.
+     */
+    static String readOIDLen(final SubstringReader reader, final boolean allowCompatChars)
+            throws DecodeException {
+        int length = 1;
+        boolean enclosingQuote = false;
+
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
+        reader.mark();
+
+        try {
+            // The next character must be either numeric (for an OID) or
+            // alphabetic (for an attribute description).
+            char c = reader.read();
+            if (c == '\'') {
+                enclosingQuote = true;
+                reader.mark();
+                c = reader.read();
+            }
+            if (isDigit(c)) {
+                boolean lastWasPeriod = false;
+                while ((c = reader.read()) != ' ' && c != '{' && !(c == '\'' && enclosingQuote)) {
+                    if (c == '.') {
+                        if (lastWasPeriod) {
+                            final LocalizableMessage message =
+                                    ERR_ATTR_SYNTAX_OID_CONSECUTIVE_PERIODS1.get(reader.pos() - 1);
+                            throw DecodeException.error(message);
+                        } else {
+                            lastWasPeriod = true;
+                        }
+                    } else if (!isDigit(c)) {
+                        // Technically, this must be an illegal character.
+                        // However,
+                        // it is possible that someone just got sloppy and did
+                        // not
+                        // include a space between the name/OID and a closing
+                        // parenthesis. In that case, we'll assume it's the end
+                        // of
+                        // the value.
+                        if (c == ')') {
+                            break;
+                        }
+
+                        // This must have been an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    } else {
+                        lastWasPeriod = false;
+                    }
+                    length++;
+                }
+
+                if (length == 0) {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_OID_NO_VALUE1.get(reader.pos() - 1);
+                    throw DecodeException.error(message);
+                }
+            } else if (isAlpha(c)) {
+                // This must be an attribute description. In this case, we will
+                // only accept alphabetic characters, numeric digits, and the
+                // hyphen.
+                while ((c = reader.read()) != ' ' && c != ')' && c != '{'
+                        && !(c == '\'' && enclosingQuote)) {
+                    if (length == 0 && !isAlpha(c)) {
+                        // This is an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    }
+
+                    if (!isKeyChar(c, allowCompatChars)) {
+                        // This is an illegal character.
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    }
+
+                    length++;
+                }
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c), reader
+                                .pos() - 1);
+                throw DecodeException.error(message);
+            }
+
             reader.reset();
-            values.add(readQuotedDescriptor(reader, allowCompatChars));
-            reader.skipWhitespaces();
+
+            // Return the position of the first non-space character after the
+            // token.
+            final String oid = reader.read(length);
+
             reader.mark();
-          }
-          while (reader.read() != ')');
-          values = Collections.unmodifiableList(values);
+            if ((c = reader.read()) == '{') {
+                reader.mark();
+                // The only thing we'll allow here will be numeric digits and
+                // the closing curly brace.
+                while ((c = reader.read()) != '}') {
+                    if (!isDigit(c)) {
+                        final LocalizableMessage message =
+                                ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1.get(reader.getString(),
+                                        reader.pos() - 1);
+                        throw DecodeException.error(message);
+                    }
+                }
+            } else if (c == '\'') {
+                reader.mark();
+            } else {
+                reader.reset();
+            }
+
+            return oid;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
         }
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-            .get(String.valueOf(c), reader.pos() - 1);
-        throw DecodeException.error(message);
-      }
-
-      return values;
     }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
 
+    static Set<String> readOIDs(final SubstringReader reader, final boolean allowCompatChars)
+            throws DecodeException {
+        Set<String> values;
 
-
-  /**
-   * Reads the attribute description or numeric OID, skipping over any leading
-   * or trailing spaces.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @param allowCompatChars
-   *          {@code true} if certain illegal characters should be allowed for
-   *          compatibility reasons.
-   * @return The attribute description or numeric OID read from the definition.
-   * @throws DecodeException
-   *           If a problem is encountered while reading the name or OID.
-   */
-  static String readOID(final SubstringReader reader,
-      final boolean allowCompatChars) throws DecodeException
-  {
-    int length = 0;
-    boolean enclosingQuote = false;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    if (reader.remaining() > 0)
-    {
-      // The next character must be either numeric (for an OID) or
-      // alphabetic (for an attribute description).
-      if (reader.read() == '\'')
-      {
-        enclosingQuote = true;
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
         reader.mark();
-      }
-      else
-      {
-        reader.reset();
-      }
-    }
 
-    if (reader.remaining() > 0)
-    {
-      char c = reader.read();
-      length++;
+        try {
+            final char c = reader.read();
+            if (c == '(') {
+                values = new LinkedHashSet<String>();
+                do {
+                    values.add(readOID(reader, allowCompatChars));
 
-      if (isDigit(c))
-      {
-        // This must be a numeric OID. In that case, we will accept
-        // only digits and periods, but not consecutive periods.
-        boolean lastWasPeriod = false;
-
-        while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
-            && !(c == '\'' && enclosingQuote))
-        {
-          if (c == '.')
-          {
-            if (lastWasPeriod)
-            {
-              final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_CONSECUTIVE_PERIODS1
-                  .get(reader.pos() - 1);
-              throw DecodeException.error(message);
+                    // Skip over any trailing spaces;
+                    reader.skipWhitespaces();
+                } while (reader.read() != ')');
+                values = Collections.unmodifiableSet(values);
+            } else {
+                reader.reset();
+                values = Collections.singleton(readOID(reader, allowCompatChars));
             }
-            else
-            {
-              lastWasPeriod = true;
+
+            return values;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
+        }
+    }
+
+    /**
+     * Reads the value of a string enclosed in single quotes, skipping over the
+     * quotes and any leading spaces.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @return The string value read from the definition.
+     * @throws DecodeException
+     *             If a problem is encountered while reading the quoted string.
+     */
+    static String readQuotedString(final SubstringReader reader) throws DecodeException {
+        int length = 0;
+
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
+
+        try {
+            // The next character must be a single quote.
+            final char c = reader.read();
+            if (c != '\'') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1.get(reader.pos() - 1, String
+                                .valueOf(c));
+                throw DecodeException.error(message);
             }
-          }
-          else if (!isDigit(c))
-          {
-            // This must be an illegal character.
-            // This must have been an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1
-                .get(String.valueOf(c), reader.pos() - 1);
+
+            // Read until we find the closing quote.
+            reader.mark();
+            while (reader.read() != '\'') {
+                length++;
+            }
+
+            reader.reset();
+
+            final String str = reader.read(length);
+            reader.read();
+            return str;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
             throw DecodeException.error(message);
-          }
-          else
-          {
-            lastWasPeriod = false;
-          }
-
-          length++;
         }
-
-        if (lastWasPeriod)
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_ENDS_WITH_PERIOD1
-              .get(reader.pos() - 1);
-          throw DecodeException.error(message);
-        }
-      }
-      else if (isAlpha(c))
-      {
-        // This must be an attribute description. In this case, we will
-        // only accept alphabetic characters, numeric digits, and the
-        // hyphen.
-        while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
-            && !(c == '\'' && enclosingQuote))
-        {
-          if (length == 0 && !isAlpha(c))
-          {
-            // This is an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-                .get(String.valueOf(c), reader.pos() - 1);
-            throw DecodeException.error(message);
-          }
-
-          if (!isKeyChar(c, allowCompatChars))
-          {
-            // This is an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-                .get(String.valueOf(c), reader.pos() - 1);
-            throw DecodeException.error(message);
-          }
-
-          length++;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-            .get(String.valueOf(c), reader.pos() - 1);
-        throw DecodeException.error(message);
-      }
-
-      if (enclosingQuote && c != '\'')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1
-            .get(reader.pos() - 1, String.valueOf(c));
-        throw DecodeException.error(message);
-      }
     }
 
-    if (length == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_NO_VALUE1
-          .get(reader.pos() - 1);
-      throw DecodeException.error(message);
-    }
+    /**
+     * Reads the next ruleid from the definition, skipping over any leading
+     * spaces.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @return The ruleid read from the definition.
+     * @throws DecodeException
+     *             If a problem is encountered while reading the token name.
+     */
+    static Integer readRuleID(final SubstringReader reader) throws DecodeException {
+        // This must be a ruleid. In that case, we will accept
+        // only digits.
+        int length = 0;
 
-    reader.reset();
-    final String oid = reader.read(length);
-    if (enclosingQuote)
-    {
-      reader.read();
-    }
-
-    return oid;
-  }
-
-
-
-  /**
-   * Reads the next OID from the definition, skipping over any leading spaces.
-   * The OID may be followed by a integer length in brackets.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @param allowCompatChars
-   *          {@code true} if certain illegal characters should be allowed for
-   *          compatibility reasons.
-   * @return The OID read from the definition.
-   * @throws DecodeException
-   *           If a problem is encountered while reading the token name.
-   */
-  static String readOIDLen(final SubstringReader reader,
-      final boolean allowCompatChars) throws DecodeException
-  {
-    int length = 1;
-    boolean enclosingQuote = false;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      // The next character must be either numeric (for an OID) or
-      // alphabetic (for an attribute description).
-      char c = reader.read();
-      if (c == '\'')
-      {
-        enclosingQuote = true;
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
         reader.mark();
-        c = reader.read();
-      }
-      if (isDigit(c))
-      {
-        boolean lastWasPeriod = false;
-        while ((c = reader.read()) != ' ' && c != '{'
-            && !(c == '\'' && enclosingQuote))
-        {
-          if (c == '.')
-          {
-            if (lastWasPeriod)
-            {
-              final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_CONSECUTIVE_PERIODS1
-                  .get(reader.pos() - 1);
-              throw DecodeException.error(message);
-            }
-            else
-            {
-              lastWasPeriod = true;
-            }
-          }
-          else if (!isDigit(c))
-          {
-            // Technically, this must be an illegal character. However,
-            // it is possible that someone just got sloppy and did not
-            // include a space between the name/OID and a closing
-            // parenthesis. In that case, we'll assume it's the end of
-            // the value.
-            if (c == ')')
-            {
-              break;
+
+        try {
+            while (reader.read() != ' ') {
+                length++;
             }
 
-            // This must have been an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1
-                .get(String.valueOf(c), reader.pos() - 1);
+            if (length == 0) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_RULE_ID_NO_VALUE1.get(reader.pos() - 1);
+                throw DecodeException.error(message);
+            }
+
+            reader.reset();
+            final String ruleID = reader.read(length);
+
+            try {
+                return Integer.valueOf(ruleID);
+            } catch (final NumberFormatException e) {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_RULE_ID_INVALID1.get(ruleID);
+                throw DecodeException.error(message);
+            }
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
             throw DecodeException.error(message);
-          }
-          else
-          {
-            lastWasPeriod = false;
-          }
-          length++;
         }
+    }
 
-        if (length == 0)
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_NO_VALUE1.get(reader.pos() - 1);
-          throw DecodeException.error(message);
-        }
-      }
+    static Set<Integer> readRuleIDs(final SubstringReader reader) throws DecodeException {
+        Set<Integer> values;
 
-      else if (isAlpha(c))
-      {
-        // This must be an attribute description. In this case, we will
-        // only accept alphabetic characters, numeric digits, and the
-        // hyphen.
-        while ((c = reader.read()) != ' ' && c != ')' && c != '{'
-            && !(c == '\'' && enclosingQuote))
-        {
-          if (length == 0 && !isAlpha(c))
-          {
-            // This is an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-                .get(String.valueOf(c), reader.pos() - 1);
-            throw DecodeException.error(message);
-          }
-
-          if (!isKeyChar(c, allowCompatChars))
-          {
-            // This is an illegal character.
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-                .get(String.valueOf(c), reader.pos() - 1);
-            throw DecodeException.error(message);
-          }
-
-          length++;
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-            .get(String.valueOf(c), reader.pos() - 1);
-        throw DecodeException.error(message);
-      }
-
-      reader.reset();
-
-      // Return the position of the first non-space character after the
-      // token.
-      final String oid = reader.read(length);
-
-      reader.mark();
-      if ((c = reader.read()) == '{')
-      {
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
         reader.mark();
-        // The only thing we'll allow here will be numeric digits and
-        // the closing curly brace.
-        while ((c = reader.read()) != '}')
-        {
-          if (!isDigit(c))
-          {
-            final LocalizableMessage message = ERR_ATTR_SYNTAX_OID_ILLEGAL_CHARACTER1
-                .get(reader.getString(), reader.pos() - 1);
+
+        try {
+            final char c = reader.read();
+            if (c == '(') {
+                values = new LinkedHashSet<Integer>();
+                do {
+                    values.add(readRuleID(reader));
+
+                    // Skip over any trailing spaces;
+                    reader.skipWhitespaces();
+                } while (reader.read() != ')');
+                values = Collections.unmodifiableSet(values);
+            } else {
+                reader.reset();
+                values = Collections.singleton(readRuleID(reader));
+            }
+
+            return values;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
             throw DecodeException.error(message);
-          }
         }
-      }
-      else if (c == '\'')
-      {
+    }
+
+    /**
+     * Reads the next token name from the definition, skipping over any leading
+     * or trailing spaces or <code>null</code> if there are no more tokens to
+     * read.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @return The token name read from the definition or <code>null</code> .
+     * @throws DecodeException
+     *             If a problem is encountered while reading the token name.
+     */
+    static String readTokenName(final SubstringReader reader) throws DecodeException {
+        String token = null;
+        int length = 0;
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
         reader.mark();
-      }
-      else
-      {
-        reader.reset();
-      }
 
-      return oid;
-    }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
+        try {
+            // Read until we find the next space.
+            char c;
+            while ((c = reader.read()) != ' ' && c != ')') {
+                length++;
+            }
 
+            if (length > 0) {
+                reader.reset();
+                token = reader.read(length);
+            }
 
+            // Skip over any trailing spaces after the value.
+            reader.skipWhitespaces();
 
-  static Set<String> readOIDs(final SubstringReader reader,
-      final boolean allowCompatChars) throws DecodeException
-  {
-    Set<String> values;
+            if (token == null && reader.remaining() > 0) {
+                reader.reset();
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UNEXPECTED_CLOSE_PARENTHESIS1.get(length);
+                throw DecodeException.error(message);
+            }
 
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      final char c = reader.read();
-      if (c == '(')
-      {
-        values = new LinkedHashSet<String>();
-        do
-        {
-          values.add(readOID(reader, allowCompatChars));
-
-          // Skip over any trailing spaces;
-          reader.skipWhitespaces();
+            return token;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
         }
-        while (reader.read() != ')');
-        values = Collections.unmodifiableSet(values);
-      }
-      else
-      {
-        reader.reset();
-        values = Collections.singleton(readOID(reader, allowCompatChars));
-      }
-
-      return values;
     }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
 
-
-
-  /**
-   * Reads the value of a string enclosed in single quotes, skipping over the
-   * quotes and any leading spaces.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @return The string value read from the definition.
-   * @throws DecodeException
-   *           If a problem is encountered while reading the quoted string.
-   */
-  static String readQuotedString(final SubstringReader reader)
-      throws DecodeException
-  {
-    int length = 0;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-
-    try
-    {
-      // The next character must be a single quote.
-      final char c = reader.read();
-      if (c != '\'')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1
-            .get(reader.pos() - 1, String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-
-      // Read until we find the closing quote.
-      reader.mark();
-      while (reader.read() != '\'')
-      {
-        length++;
-      }
-
-      reader.reset();
-
-      final String str = reader.read(length);
-      reader.read();
-      return str;
-    }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
-
-
-
-  /**
-   * Reads the next ruleid from the definition, skipping over any leading
-   * spaces.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @return The ruleid read from the definition.
-   * @throws DecodeException
-   *           If a problem is encountered while reading the token name.
-   */
-  static Integer readRuleID(final SubstringReader reader)
-      throws DecodeException
-  {
-    // This must be a ruleid. In that case, we will accept
-    // only digits.
-    int length = 0;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      while (reader.read() != ' ')
-      {
-        length++;
-      }
-
-      if (length == 0)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_RULE_ID_NO_VALUE1
-            .get(reader.pos() - 1);
-        throw DecodeException.error(message);
-      }
-
-      reader.reset();
-      final String ruleID = reader.read(length);
-
-      try
-      {
-        return Integer.valueOf(ruleID);
-      }
-      catch (final NumberFormatException e)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_RULE_ID_INVALID1
-            .get(ruleID);
-        throw DecodeException.error(message);
-      }
-    }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
-
-
-
-  static Set<Integer> readRuleIDs(final SubstringReader reader)
-      throws DecodeException
-  {
-    Set<Integer> values;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      final char c = reader.read();
-      if (c == '(')
-      {
-        values = new LinkedHashSet<Integer>();
-        do
-        {
-          values.add(readRuleID(reader));
-
-          // Skip over any trailing spaces;
-          reader.skipWhitespaces();
+    /**
+     * Returns an unmodifiable copy of the provided schema element extra
+     * properties.
+     *
+     * @param extraProperties
+     *            The schema element extra properties.
+     * @return An unmodifiable copy of the provided schema element extra
+     *         properties.
+     */
+    static Map<String, List<String>> unmodifiableCopyOfExtraProperties(
+            final Map<String, List<String>> extraProperties) {
+        if (extraProperties == null || extraProperties.isEmpty()) {
+            return Collections.emptyMap();
+        } else {
+            final Map<String, List<String>> tmp =
+                    new LinkedHashMap<String, List<String>>(extraProperties.size());
+            for (final Map.Entry<String, List<String>> e : extraProperties.entrySet()) {
+                tmp.put(e.getKey(), unmodifiableCopyOfList(e.getValue()));
+            }
+            return Collections.unmodifiableMap(tmp);
         }
-        while (reader.read() != ')');
-        values = Collections.unmodifiableSet(values);
-      }
-      else
-      {
-        reader.reset();
-        values = Collections.singleton(readRuleID(reader));
-      }
-
-      return values;
     }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
 
-
-
-  /**
-   * Reads the next token name from the definition, skipping over any leading or
-   * trailing spaces or <code>null</code> if there are no more tokens to read.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @return The token name read from the definition or <code>null</code> .
-   * @throws DecodeException
-   *           If a problem is encountered while reading the token name.
-   */
-  static String readTokenName(final SubstringReader reader)
-      throws DecodeException
-  {
-    String token = null;
-    int length = 0;
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-    reader.mark();
-
-    try
-    {
-      // Read until we find the next space.
-      char c;
-      while ((c = reader.read()) != ' ' && c != ')')
-      {
-        length++;
-      }
-
-      if (length > 0)
-      {
-        reader.reset();
-        token = reader.read(length);
-      }
-
-      // Skip over any trailing spaces after the value.
-      reader.skipWhitespaces();
-
-      if (token == null && reader.remaining() > 0)
-      {
-        reader.reset();
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UNEXPECTED_CLOSE_PARENTHESIS1
-            .get(length);
-        throw DecodeException.error(message);
-      }
-
-      return token;
-    }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
-    }
-  }
-
-
-
-  /**
-   * Returns an unmodifiable copy of the provided schema element extra
-   * properties.
-   *
-   * @param extraProperties
-   *          The schema element extra properties.
-   * @return An unmodifiable copy of the provided schema element extra
-   *         properties.
-   */
-  static Map<String, List<String>> unmodifiableCopyOfExtraProperties(
-      final Map<String, List<String>> extraProperties)
-  {
-    if (extraProperties == null || extraProperties.isEmpty())
-    {
-      return Collections.emptyMap();
-    }
-    else
-    {
-      final Map<String, List<String>> tmp = new LinkedHashMap<String, List<String>>(
-          extraProperties.size());
-      for (final Map.Entry<String, List<String>> e : extraProperties.entrySet())
-      {
-        tmp.put(e.getKey(), unmodifiableCopyOfList(e.getValue()));
-      }
-      return Collections.unmodifiableMap(tmp);
-    }
-  }
-
-
-
-  static <E> List<E> unmodifiableCopyOfList(final List<E> l)
-  {
-    if (l == null || l.isEmpty())
-    {
-      return Collections.emptyList();
-    }
-    else if (l.size() == 1)
-    {
-      return Collections.singletonList(l.get(0));
-    }
-    else
-    {
-      final List<E> copy = new LinkedList<E>(l);
-      return Collections.unmodifiableList(copy);
-    }
-  }
-
-
-
-  static <E> Set<E> unmodifiableCopyOfSet(final Set<E> s)
-  {
-    if (s == null || s.isEmpty())
-    {
-      return Collections.emptySet();
-    }
-    else if (s.size() == 1)
-    {
-      return Collections.singleton(s.iterator().next());
-    }
-    else
-    {
-      final Set<E> copy = new LinkedHashSet<E>(s);
-      return Collections.unmodifiableSet(copy);
-    }
-  }
-
-
-
-  /**
-   * Reads the value of a string enclosed in single quotes, skipping over the
-   * quotes and any leading spaces.
-   *
-   * @param reader
-   *          The string representation of the definition.
-   * @param allowCompatChars
-   *          {@code true} if certain illegal characters should be allowed for
-   *          compatibility reasons.
-   * @return The string value read from the definition.
-   * @throws DecodeException
-   *           If a problem is encountered while reading the quoted string.
-   */
-  private static String readQuotedDescriptor(
-      final SubstringReader reader, final boolean allowCompatChars)
-      throws DecodeException
-  {
-    int length = 0;
-
-    // Skip over any spaces at the beginning of the value.
-    reader.skipWhitespaces();
-
-    try
-    {
-      // The next character must be a single quote.
-      char c = reader.read();
-      if (c != '\'')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1
-            .get(reader.pos() - 1, String.valueOf(c));
-        throw DecodeException.error(message);
-      }
-
-      // Read until we find the closing quote.
-      reader.mark();
-      while ((c = reader.read()) != '\'')
-      {
-        if (length == 0 && !isAlpha(c))
-        {
-          // This is an illegal character.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-              .get(String.valueOf(c), reader.pos() - 1);
-          throw DecodeException.error(message);
+    static <E> List<E> unmodifiableCopyOfList(final List<E> l) {
+        if (l == null || l.isEmpty()) {
+            return Collections.emptyList();
+        } else if (l.size() == 1) {
+            return Collections.singletonList(l.get(0));
+        } else {
+            final List<E> copy = new LinkedList<E>(l);
+            return Collections.unmodifiableList(copy);
         }
+    }
 
-        if (!isKeyChar(c, allowCompatChars))
-        {
-          // This is an illegal character.
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1
-              .get(String.valueOf(c), reader.pos() - 1);
-          throw DecodeException.error(message);
+    static <E> Set<E> unmodifiableCopyOfSet(final Set<E> s) {
+        if (s == null || s.isEmpty()) {
+            return Collections.emptySet();
+        } else if (s.size() == 1) {
+            return Collections.singleton(s.iterator().next());
+        } else {
+            final Set<E> copy = new LinkedHashSet<E>(s);
+            return Collections.unmodifiableSet(copy);
         }
-
-        length++;
-      }
-
-      reader.reset();
-
-      final String descr = reader.read(length);
-      reader.read();
-      return descr;
     }
-    catch (final StringIndexOutOfBoundsException e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
-      throw DecodeException.error(message);
+
+    /**
+     * Reads the value of a string enclosed in single quotes, skipping over the
+     * quotes and any leading spaces.
+     *
+     * @param reader
+     *            The string representation of the definition.
+     * @param allowCompatChars
+     *            {@code true} if certain illegal characters should be allowed
+     *            for compatibility reasons.
+     * @return The string value read from the definition.
+     * @throws DecodeException
+     *             If a problem is encountered while reading the quoted string.
+     */
+    private static String readQuotedDescriptor(final SubstringReader reader,
+            final boolean allowCompatChars) throws DecodeException {
+        int length = 0;
+
+        // Skip over any spaces at the beginning of the value.
+        reader.skipWhitespaces();
+
+        try {
+            // The next character must be a single quote.
+            char c = reader.read();
+            if (c != '\'') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_EXPECTED_QUOTE_AT_POS1.get(reader.pos() - 1, String
+                                .valueOf(c));
+                throw DecodeException.error(message);
+            }
+
+            // Read until we find the closing quote.
+            reader.mark();
+            while ((c = reader.read()) != '\'') {
+                if (length == 0 && !isAlpha(c)) {
+                    // This is an illegal character.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                    reader.pos() - 1);
+                    throw DecodeException.error(message);
+                }
+
+                if (!isKeyChar(c, allowCompatChars)) {
+                    // This is an illegal character.
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(String.valueOf(c),
+                                    reader.pos() - 1);
+                    throw DecodeException.error(message);
+                }
+
+                length++;
+            }
+
+            reader.reset();
+
+            final String descr = reader.read(length);
+            reader.read();
+            return descr;
+        } catch (final StringIndexOutOfBoundsException e) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TRUNCATED_VALUE1.get();
+            throw DecodeException.error(message);
+        }
     }
-  }
 
-
-
-  // Prevent instantiation.
-  private SchemaUtils()
-  {
-    // Nothing to do.
-  }
+    // Prevent instantiation.
+    private SchemaUtils() {
+        // Nothing to do.
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java
index dc35a6e..a00a6d9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,479 +26,400 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.ErrorResultException;
 
-
-
 /**
  * This class provides various schema validation policy options for controlling
  * how entries should be validated against the directory schema.
  */
-public final class SchemaValidationPolicy
-{
-  /**
-   * A call-back which will be called during DIT structure rule schema
-   * validation in order to retrieve the parent of the entry being validated.
-   */
-  public static interface EntryResolver
-  {
+public final class SchemaValidationPolicy {
     /**
-     * Returns the named entry in order to enforce DIT structure rules.
+     * A call-back which will be called during DIT structure rule schema
+     * validation in order to retrieve the parent of the entry being validated.
+     */
+    public static interface EntryResolver {
+        /**
+         * Returns the named entry in order to enforce DIT structure rules.
+         *
+         * @param dn
+         *            The name of the entry to be returned.
+         * @return The named entry.
+         * @throws ErrorResultException
+         *             If the entry could not be retrieved.
+         */
+        Entry getEntry(DN dn) throws ErrorResultException;
+    }
+
+    /**
+     * The schema validation policy.
+     */
+    public static enum Policy {
+        /**
+         * Schema validation will not be performed.
+         */
+        IGNORE,
+
+        /**
+         * Schema validation will be performed, but failures will not cause the
+         * overall validation to fail. Error messages will be returned.
+         */
+        WARN,
+
+        /**
+         * Schema validation will be performed and failures will cause the
+         * overall validation to fail. Error messages will be returned.
+         */
+        REJECT;
+
+        private Policy() {
+            // Nothing to do.
+        }
+
+        /**
+         * Returns {@code true} if this policy is {@code IGNORE}.
+         *
+         * @return {@code true} if this policy is {@code IGNORE}.
+         */
+        public boolean isIgnore() {
+            return this == IGNORE;
+        }
+
+        /**
+         * Returns {@code true} if this policy is {@code REJECT}.
+         *
+         * @return {@code true} if this policy is {@code REJECT}.
+         */
+        public boolean isReject() {
+            return this == REJECT;
+        }
+
+        /**
+         * Returns {@code true} if this policy is {@code WARN}.
+         *
+         * @return {@code true} if this policy is {@code WARN}.
+         */
+        public boolean isWarn() {
+            return this == WARN;
+        }
+
+        /**
+         * Returns {@code true} if this policy is {@code WARN} or {@code REJECT}
+         * .
+         *
+         * @return {@code true} if this policy is {@code WARN} or {@code REJECT}
+         *         .
+         */
+        public boolean needsChecking() {
+            return this != IGNORE;
+        }
+    }
+
+    /**
+     * Creates a copy of the provided schema validation policy.
      *
-     * @param dn
-     *          The name of the entry to be returned.
-     * @return The named entry.
-     * @throws ErrorResultException
-     *           If the entry could not be retrieved.
+     * @param policy
+     *            The policy to be copied.
+     * @return The copy of the provided schema validation policy.
      */
-    Entry getEntry(DN dn) throws ErrorResultException;
-  }
-
-
-
-  /**
-   * The schema validation policy.
-   */
-  public static enum Policy
-  {
-    /**
-     * Schema validation will not be performed.
-     */
-    IGNORE,
-
-    /**
-     * Schema validation will be performed, but failures will not cause the
-     * overall validation to fail. Error messages will be returned.
-     */
-    WARN,
-
-    /**
-     * Schema validation will be performed and failures will cause the overall
-     * validation to fail. Error messages will be returned.
-     */
-    REJECT;
-
-    private Policy()
-    {
-      // Nothing to do.
+    public static SchemaValidationPolicy copyOf(final SchemaValidationPolicy policy) {
+        return defaultPolicy().assign(policy);
     }
 
-
-
     /**
-     * Returns {@code true} if this policy is {@code IGNORE}.
+     * Creates a new schema validation policy with default settings. More
+     * specifically:
+     * <ul>
+     * <li>Entries not having a single structural object class will be rejected
+     * <li>Entries having attributes which are not permitted by its object
+     * classes or DIT content rule (if present) will be rejected
+     * <li>Entries not conforming to name forms will be rejected
+     * <li>DIT structure rules will not be ignored
+     * </ul>
      *
-     * @return {@code true} if this policy is {@code IGNORE}.
+     * @return The new schema validation policy.
      */
-    public boolean isIgnore()
-    {
-      return this == IGNORE;
+    public static SchemaValidationPolicy defaultPolicy() {
+        return new SchemaValidationPolicy();
     }
 
-
-
     /**
-     * Returns {@code true} if this policy is {@code REJECT}.
+     * Creates a new schema validation policy which will not perform any schema
+     * validation.
      *
-     * @return {@code true} if this policy is {@code REJECT}.
+     * @return The new schema validation policy.
      */
-    public boolean isReject()
-    {
-      return this == REJECT;
+    public static SchemaValidationPolicy ignoreAll() {
+        return new SchemaValidationPolicy().checkAttributesAndObjectClasses(Policy.IGNORE)
+                .checkAttributeValues(Policy.IGNORE).checkDITContentRules(Policy.IGNORE)
+                .checkNameForms(Policy.IGNORE).requireSingleStructuralObjectClass(Policy.IGNORE);
     }
 
+    private Policy checkNameForms = Policy.REJECT;
 
+    private Policy checkDITStructureRules = Policy.IGNORE;
+
+    private Policy checkDITContentRules = Policy.REJECT;
+
+    private Policy requireSingleStructuralObjectClass = Policy.REJECT;
+
+    private Policy checkAttributesAndObjectClasses = Policy.REJECT;
+
+    private Policy checkAttributeValues = Policy.REJECT;
+
+    private EntryResolver checkDITStructureRulesEntryResolver = null;
+
+    // Prevent direct instantiation.
+    private SchemaValidationPolicy() {
+        // Nothing to do.
+    }
 
     /**
-     * Returns {@code true} if this policy is {@code WARN}.
+     * Returns the policy for verifying that the user attributes in an entry
+     * conform to its object classes. More specifically, an entry must contain
+     * all required user attributes, and must not contain any user attributes
+     * which are not declared as required or optional by its object classes.
+     * <p>
+     * By default entries which have missing or additional user attributes will
+     * be rejected.
      *
-     * @return {@code true} if this policy is {@code WARN}.
+     * @return The policy for verifying that the user attributes in an entry
+     *         conform to its object classes.
      */
-    public boolean isWarn()
-    {
-      return this == WARN;
+    public Policy checkAttributesAndObjectClasses() {
+        return checkAttributesAndObjectClasses;
     }
 
-
-
     /**
-     * Returns {@code true} if this policy is {@code WARN} or {@code REJECT}.
+     * Specifies the policy for verifying that the user attributes in an entry
+     * conform to its object classes. More specifically, an entry must contain
+     * all required user attributes, and must not contain any user attributes
+     * which are not declared as required or optional by its object classes.
+     * <p>
+     * By default entries which have missing or additional user attributes will
+     * be rejected.
      *
-     * @return {@code true} if this policy is {@code WARN} or {@code REJECT}.
+     * @param policy
+     *            The policy for verifying that the user attributes in an entry
+     *            conform to its object classes.
+     * @return A reference to this {@code SchemaValidationPolicy}.
      */
-    public boolean needsChecking()
-    {
-      return this != IGNORE;
+    public SchemaValidationPolicy checkAttributesAndObjectClasses(final Policy policy) {
+        this.checkAttributesAndObjectClasses = policy;
+        return this;
     }
-  }
 
-
-
-  /**
-   * Creates a copy of the provided schema validation policy.
-   *
-   * @param policy
-   *          The policy to be copied.
-   * @return The copy of the provided schema validation policy.
-   */
-  public static SchemaValidationPolicy copyOf(
-      final SchemaValidationPolicy policy)
-  {
-    return defaultPolicy().assign(policy);
-  }
-
-
-
-  /**
-   * Creates a new schema validation policy with default settings. More
-   * specifically:
-   * <ul>
-   * <li>Entries not having a single structural object class will be rejected
-   * <li>Entries having attributes which are not permitted by its object classes
-   * or DIT content rule (if present) will be rejected
-   * <li>Entries not conforming to name forms will be rejected
-   * <li>DIT structure rules will not be ignored
-   * </ul>
-   *
-   * @return The new schema validation policy.
-   */
-  public static SchemaValidationPolicy defaultPolicy()
-  {
-    return new SchemaValidationPolicy();
-  }
-
-
-
-  /**
-   * Creates a new schema validation policy which will not perform any schema
-   * validation.
-   *
-   * @return The new schema validation policy.
-   */
-  public static SchemaValidationPolicy ignoreAll()
-  {
-    return new SchemaValidationPolicy()
-        .checkAttributesAndObjectClasses(Policy.IGNORE)
-        .checkAttributeValues(Policy.IGNORE)
-        .checkDITContentRules(Policy.IGNORE)
-        .checkNameForms(Policy.IGNORE)
-        .requireSingleStructuralObjectClass(Policy.IGNORE);
-  }
-
-
-
-  private Policy checkNameForms = Policy.REJECT;
-
-  private Policy checkDITStructureRules = Policy.IGNORE;
-
-  private Policy checkDITContentRules = Policy.REJECT;
-
-  private Policy requireSingleStructuralObjectClass = Policy.REJECT;
-
-  private Policy checkAttributesAndObjectClasses = Policy.REJECT;
-
-  private Policy checkAttributeValues = Policy.REJECT;
-
-  private EntryResolver checkDITStructureRulesEntryResolver = null;
-
-
-
-  // Prevent direct instantiation.
-  private SchemaValidationPolicy()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * Returns the policy for verifying that the user attributes in an entry
-   * conform to its object classes. More specifically, an entry must contain all
-   * required user attributes, and must not contain any user attributes which
-   * are not declared as required or optional by its object classes.
-   * <p>
-   * By default entries which have missing or additional user attributes will be
-   * rejected.
-   *
-   * @return The policy for verifying that the user attributes in an entry
-   *         conform to its object classes.
-   */
-  public Policy checkAttributesAndObjectClasses()
-  {
-    return checkAttributesAndObjectClasses;
-  }
-
-
-
-  /**
-   * Specifies the policy for verifying that the user attributes in an entry
-   * conform to its object classes. More specifically, an entry must contain all
-   * required user attributes, and must not contain any user attributes which
-   * are not declared as required or optional by its object classes.
-   * <p>
-   * By default entries which have missing or additional user attributes will be
-   * rejected.
-   *
-   * @param policy
-   *          The policy for verifying that the user attributes in an entry
-   *          conform to its object classes.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   */
-  public SchemaValidationPolicy checkAttributesAndObjectClasses(
-      final Policy policy)
-  {
-    this.checkAttributesAndObjectClasses = policy;
-    return this;
-  }
-
-
-
-  /**
-   * Returns the policy for verifying that the user attributes in an entry
-   * conform to their associated attribute type descriptions. This may include:
-   * <ul>
-   * <li>checking that there is at least one value
-   * <li>checking that single-valued attributes contain only a single value
-   * <li>checking that there are no duplicate values according to the
-   * attribute's default equality matching rule
-   * <li>checking that attributes which require BER encoding specify the
-   * {@code ;binary} attribute option
-   * <li>checking that the values are valid according to the attribute's syntax.
-   * </ul>
-   * Schema validation implementations specify exactly which of the above checks
-   * will be performed.
-   * <p>
-   * By default entries which have invalid attribute values will be rejected.
-   *
-   * @return The policy for verifying that the user attributes in an entry
-   *         conform to their associated attribute type descriptions.
-   */
-  public Policy checkAttributeValues()
-  {
-    return checkAttributeValues;
-  }
-
-
-
-  /**
-   * Specifies the policy for verifying that the user attributes in an entry
-   * conform to their associated attribute type descriptions. This may include:
-   * <ul>
-   * <li>checking that there is at least one value
-   * <li>checking that single-valued attributes contain only a single value
-   * <li>checking that there are no duplicate values according to the
-   * attribute's default equality matching rule
-   * <li>checking that attributes which require BER encoding specify the
-   * {@code ;binary} attribute option
-   * <li>checking that the values are valid according to the attribute's syntax.
-   * </ul>
-   * Schema validation implementations specify exactly which of the above checks
-   * will be performed.
-   * <p>
-   * By default entries which have invalid attribute values will be rejected.
-   *
-   * @param policy
-   *          The policy for verifying that the user attributes in an entry
-   *          conform to their associated attribute type descriptions.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   */
-  public SchemaValidationPolicy checkAttributeValues(final Policy policy)
-  {
-    this.checkAttributeValues = policy;
-    return this;
-  }
-
-
-
-  /**
-   * Returns the policy for validating entries against content rules defined in
-   * the schema.
-   * <p>
-   * By default content rules will be ignored during validation.
-   *
-   * @return The policy for validating entries against content rules defined in
-   *         the schema.
-   */
-  public Policy checkDITContentRules()
-  {
-    return checkDITContentRules;
-  }
-
-
-
-  /**
-   * Specifies the policy for validating entries against content rules defined
-   * in the schema.
-   * <p>
-   * By default content rules will be ignored during validation.
-   *
-   * @param policy
-   *          The policy for validating entries against content rules defined in
-   *          the schema.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   */
-  public SchemaValidationPolicy checkDITContentRules(final Policy policy)
-  {
-    this.checkDITContentRules = policy;
-    return this;
-  }
-
-
-
-  /**
-   * Returns the policy for validating entries against structure rules defined
-   * in the schema.
-   * <p>
-   * By default structure rules will be ignored during validation.
-   *
-   * @return The policy for validating entries against structure rules defined
-   *         in the schema.
-   */
-  public Policy checkDITStructureRules()
-  {
-    return checkDITStructureRules;
-  }
-
-
-
-  /**
-   * Specifies the policy for validating entries against structure rules defined
-   * in the schema.
-   * <p>
-   * By default structure rules will be ignored during validation.
-   *
-   * @param policy
-   *          The policy for validating entries against structure rules defined
-   *          in the schema.
-   * @param resolver
-   *          The parent entry resolver which should be used for retrieving the
-   *          parent entry during DIT structure rule validation.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   * @throws IllegalArgumentException
-   *           If {@code resolver} was {@code null} and
-   *           {@code checkDITStructureRules} is either {@code WARN} or
-   *           {@code REJECT}.
-   */
-  public SchemaValidationPolicy checkDITStructureRules(final Policy policy,
-      final EntryResolver resolver)
-  {
-    if (checkDITStructureRules.needsChecking() && resolver == null)
-    {
-      throw new IllegalArgumentException(
-          "Validation of structure rules enabled by resolver was null");
+    /**
+     * Returns the policy for verifying that the user attributes in an entry
+     * conform to their associated attribute type descriptions. This may
+     * include:
+     * <ul>
+     * <li>checking that there is at least one value
+     * <li>checking that single-valued attributes contain only a single value
+     * <li>checking that there are no duplicate values according to the
+     * attribute's default equality matching rule
+     * <li>checking that attributes which require BER encoding specify the
+     * {@code ;binary} attribute option
+     * <li>checking that the values are valid according to the attribute's
+     * syntax.
+     * </ul>
+     * Schema validation implementations specify exactly which of the above
+     * checks will be performed.
+     * <p>
+     * By default entries which have invalid attribute values will be rejected.
+     *
+     * @return The policy for verifying that the user attributes in an entry
+     *         conform to their associated attribute type descriptions.
+     */
+    public Policy checkAttributeValues() {
+        return checkAttributeValues;
     }
-    this.checkDITStructureRules = policy;
-    this.checkDITStructureRulesEntryResolver = resolver;
-    return this;
-  }
 
+    /**
+     * Specifies the policy for verifying that the user attributes in an entry
+     * conform to their associated attribute type descriptions. This may
+     * include:
+     * <ul>
+     * <li>checking that there is at least one value
+     * <li>checking that single-valued attributes contain only a single value
+     * <li>checking that there are no duplicate values according to the
+     * attribute's default equality matching rule
+     * <li>checking that attributes which require BER encoding specify the
+     * {@code ;binary} attribute option
+     * <li>checking that the values are valid according to the attribute's
+     * syntax.
+     * </ul>
+     * Schema validation implementations specify exactly which of the above
+     * checks will be performed.
+     * <p>
+     * By default entries which have invalid attribute values will be rejected.
+     *
+     * @param policy
+     *            The policy for verifying that the user attributes in an entry
+     *            conform to their associated attribute type descriptions.
+     * @return A reference to this {@code SchemaValidationPolicy}.
+     */
+    public SchemaValidationPolicy checkAttributeValues(final Policy policy) {
+        this.checkAttributeValues = policy;
+        return this;
+    }
 
+    /**
+     * Returns the policy for validating entries against content rules defined
+     * in the schema.
+     * <p>
+     * By default content rules will be ignored during validation.
+     *
+     * @return The policy for validating entries against content rules defined
+     *         in the schema.
+     */
+    public Policy checkDITContentRules() {
+        return checkDITContentRules;
+    }
 
-  /**
-   * Returns parent entry resolver which should be used for retrieving the
-   * parent entry during DIT structure rule validation.
-   * <p>
-   * By default no resolver is defined because structure rules will be ignored
-   * during validation.
-   *
-   * @return The parent entry resolver which should be used for retrieving the
-   *         parent entry during DIT structure rule validation.
-   */
-  public EntryResolver checkDITStructureRulesEntryResolver()
-  {
-    return checkDITStructureRulesEntryResolver;
-  }
+    /**
+     * Specifies the policy for validating entries against content rules defined
+     * in the schema.
+     * <p>
+     * By default content rules will be ignored during validation.
+     *
+     * @param policy
+     *            The policy for validating entries against content rules
+     *            defined in the schema.
+     * @return A reference to this {@code SchemaValidationPolicy}.
+     */
+    public SchemaValidationPolicy checkDITContentRules(final Policy policy) {
+        this.checkDITContentRules = policy;
+        return this;
+    }
 
+    /**
+     * Returns the policy for validating entries against structure rules defined
+     * in the schema.
+     * <p>
+     * By default structure rules will be ignored during validation.
+     *
+     * @return The policy for validating entries against structure rules defined
+     *         in the schema.
+     */
+    public Policy checkDITStructureRules() {
+        return checkDITStructureRules;
+    }
 
+    /**
+     * Specifies the policy for validating entries against structure rules
+     * defined in the schema.
+     * <p>
+     * By default structure rules will be ignored during validation.
+     *
+     * @param policy
+     *            The policy for validating entries against structure rules
+     *            defined in the schema.
+     * @param resolver
+     *            The parent entry resolver which should be used for retrieving
+     *            the parent entry during DIT structure rule validation.
+     * @return A reference to this {@code SchemaValidationPolicy}.
+     * @throws IllegalArgumentException
+     *             If {@code resolver} was {@code null} and
+     *             {@code checkDITStructureRules} is either {@code WARN} or
+     *             {@code REJECT}.
+     */
+    public SchemaValidationPolicy checkDITStructureRules(final Policy policy,
+            final EntryResolver resolver) {
+        if (checkDITStructureRules.needsChecking() && resolver == null) {
+            throw new IllegalArgumentException(
+                    "Validation of structure rules enabled by resolver was null");
+        }
+        this.checkDITStructureRules = policy;
+        this.checkDITStructureRulesEntryResolver = resolver;
+        return this;
+    }
 
-  /**
-   * Returns the policy for validating entries against name forms defined in the
-   * schema.
-   * <p>
-   * By default name forms will be ignored during validation.
-   *
-   * @return The policy for validating entries against name forms defined in the
-   *         schema.
-   */
-  public Policy checkNameForms()
-  {
-    return checkNameForms;
-  }
+    /**
+     * Returns parent entry resolver which should be used for retrieving the
+     * parent entry during DIT structure rule validation.
+     * <p>
+     * By default no resolver is defined because structure rules will be ignored
+     * during validation.
+     *
+     * @return The parent entry resolver which should be used for retrieving the
+     *         parent entry during DIT structure rule validation.
+     */
+    public EntryResolver checkDITStructureRulesEntryResolver() {
+        return checkDITStructureRulesEntryResolver;
+    }
 
+    /**
+     * Returns the policy for validating entries against name forms defined in
+     * the schema.
+     * <p>
+     * By default name forms will be ignored during validation.
+     *
+     * @return The policy for validating entries against name forms defined in
+     *         the schema.
+     */
+    public Policy checkNameForms() {
+        return checkNameForms;
+    }
 
+    /**
+     * Specifies the policy for validating entries against name forms defined in
+     * the schema.
+     * <p>
+     * By default name forms will be ignored during validation.
+     *
+     * @param policy
+     *            The policy for validating entries against name forms defined
+     *            in the schema.
+     * @return A reference to this {@code SchemaValidationPolicy}.
+     */
+    public SchemaValidationPolicy checkNameForms(final Policy policy) {
+        this.checkNameForms = policy;
+        return this;
+    }
 
-  /**
-   * Specifies the policy for validating entries against name forms defined in
-   * the schema.
-   * <p>
-   * By default name forms will be ignored during validation.
-   *
-   * @param policy
-   *          The policy for validating entries against name forms defined in
-   *          the schema.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   */
-  public SchemaValidationPolicy checkNameForms(final Policy policy)
-  {
-    this.checkNameForms = policy;
-    return this;
-  }
+    /**
+     * Returns the policy for verifying that entries have only a single
+     * structural object class.
+     * <p>
+     * By default entries which do not have a structural object class or which
+     * have more than one structural object class will be rejected.
+     *
+     * @return The policy for checking that entries have one and only one
+     *         structural object class.
+     */
+    public Policy requireSingleStructuralObjectClass() {
+        return requireSingleStructuralObjectClass;
+    }
 
+    /**
+     * Specifies the policy for verifying that entries have only a single
+     * structural object class.
+     * <p>
+     * By default entries which do not have a structural object class or which
+     * have more than one structural object class will be rejected.
+     *
+     * @param policy
+     *            The policy for checking that entries have one and only one
+     *            structural object class.
+     * @return A reference to this {@code SchemaValidationPolicy}.
+     */
+    public SchemaValidationPolicy requireSingleStructuralObjectClass(final Policy policy) {
+        this.requireSingleStructuralObjectClass = policy;
+        return this;
+    }
 
-
-  /**
-   * Returns the policy for verifying that entries have only a single structural
-   * object class.
-   * <p>
-   * By default entries which do not have a structural object class or which
-   * have more than one structural object class will be rejected.
-   *
-   * @return The policy for checking that entries have one and only one
-   *         structural object class.
-   */
-  public Policy requireSingleStructuralObjectClass()
-  {
-    return requireSingleStructuralObjectClass;
-  }
-
-
-
-  /**
-   * Specifies the policy for verifying that entries have only a single
-   * structural object class.
-   * <p>
-   * By default entries which do not have a structural object class or which
-   * have more than one structural object class will be rejected.
-   *
-   * @param policy
-   *          The policy for checking that entries have one and only one
-   *          structural object class.
-   * @return A reference to this {@code SchemaValidationPolicy}.
-   */
-  public SchemaValidationPolicy requireSingleStructuralObjectClass(
-      final Policy policy)
-  {
-    this.requireSingleStructuralObjectClass = policy;
-    return this;
-  }
-
-
-
-  // Assigns the provided options to this set of options.
-  SchemaValidationPolicy assign(final SchemaValidationPolicy policy)
-  {
-    this.checkAttributeValues = policy.checkAttributeValues;
-    this.checkNameForms = policy.checkNameForms;
-    this.checkAttributesAndObjectClasses = policy.checkAttributesAndObjectClasses;
-    this.checkDITContentRules = policy.checkDITContentRules;
-    this.checkDITStructureRules = policy.checkDITStructureRules;
-    this.checkDITStructureRulesEntryResolver = policy.checkDITStructureRulesEntryResolver;
-    this.requireSingleStructuralObjectClass = policy.requireSingleStructuralObjectClass;
-    return this;
-  }
+    // Assigns the provided options to this set of options.
+    SchemaValidationPolicy assign(final SchemaValidationPolicy policy) {
+        this.checkAttributeValues = policy.checkAttributeValues;
+        this.checkNameForms = policy.checkNameForms;
+        this.checkAttributesAndObjectClasses = policy.checkAttributesAndObjectClasses;
+        this.checkDITContentRules = policy.checkDITContentRules;
+        this.checkDITStructureRules = policy.checkDITStructureRules;
+        this.checkDITStructureRulesEntryResolver = policy.checkDITStructureRulesEntryResolver;
+        this.requireSingleStructuralObjectClass = policy.requireSingleStructuralObjectClass;
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java
index 15be7bb..3b585ed 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
@@ -38,110 +35,80 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.CoreMessages;
 
-
-
 /**
  * This class defines the substring assertion attribute syntax, which contains
  * one or more substring components, as used in a substring search filter. For
  * the purposes of matching, it will be treated like a Directory String syntax
  * except that approximate matching will not be allowed.
  */
-final class SubstringAssertionSyntaxImpl extends AbstractSyntaxImpl
-{
+final class SubstringAssertionSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_SUBSTRING_ASSERTION_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get the string representation of the value and check its length.
-    // A zero-length value is acceptable. A one-length value is
-    // acceptable as long as it is not an asterisk. For all other
-    // lengths, just ensure that there are no consecutive wildcards.
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-    if (valueLength == 0)
-    {
-      return true;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
-    else if (valueLength == 1)
-    {
-      if (valueString.charAt(0) == '*')
-      {
-        invalidReason.append(CoreMessages.WARN_ATTR_SYNTAX_SUBSTRING_ONLY_WILDCARD
-            .get());
 
-        return false;
-      }
-      else
-      {
+    public String getName() {
+        return SYNTAX_SUBSTRING_ASSERTION_NAME;
+    }
+
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
+
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
         return true;
-      }
     }
-    else
-    {
-      for (int i = 1; i < valueLength; i++)
-      {
-        if (valueString.charAt(i) == '*' && valueString.charAt(i - 1) == '*')
-        {
-          invalidReason
-              .append(CoreMessages.WARN_ATTR_SYNTAX_SUBSTRING_CONSECUTIVE_WILDCARDS
-                  .get(valueString, i));
-          return false;
-        }
-      }
 
-      return true;
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get the string representation of the value and check its length.
+        // A zero-length value is acceptable. A one-length value is
+        // acceptable as long as it is not an asterisk. For all other
+        // lengths, just ensure that there are no consecutive wildcards.
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+        if (valueLength == 0) {
+            return true;
+        } else if (valueLength == 1) {
+            if (valueString.charAt(0) == '*') {
+                invalidReason.append(CoreMessages.WARN_ATTR_SYNTAX_SUBSTRING_ONLY_WILDCARD.get());
+
+                return false;
+            } else {
+                return true;
+            }
+        } else {
+            for (int i = 1; i < valueLength; i++) {
+                if (valueString.charAt(i) == '*' && valueString.charAt(i - 1) == '*') {
+                    invalidReason
+                            .append(CoreMessages.WARN_ATTR_SYNTAX_SUBSTRING_CONSECUTIVE_WILDCARDS
+                                    .get(valueString, i));
+                    return false;
+                }
+            }
+
+            return true;
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java
index 17179a7..dbe0ffc 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_SUPPORTED_ALGORITHM_NAME;
@@ -36,73 +33,54 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the supported algorithm attribute syntax. This should
  * be restricted to holding only X.509 supported algorithms, but we will accept
  * any set of bytes. It will be treated much like the octet string attribute
  * syntax.
  */
-final class SupportedAlgorithmSyntaxImpl extends AbstractSyntaxImpl
-{
+final class SupportedAlgorithmSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_OCTET_STRING_OID;
-  }
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_OCTET_STRING_OID;
+    }
 
+    public String getName() {
+        return SYNTAX_SUPPORTED_ALGORITHM_NAME;
+    }
 
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_OCTET_STRING_OID;
+    }
 
-  public String getName()
-  {
-    return SYNTAX_SUPPORTED_ALGORITHM_NAME;
-  }
+    @Override
+    public boolean isBEREncodingRequired() {
+        return true;
+    }
 
+    public boolean isHumanReadable() {
+        return false;
+    }
 
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_OCTET_STRING_OID;
-  }
-
-
-
-  @Override
-  public boolean isBEREncodingRequired()
-  {
-    return true;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for the supported algorithm syntax.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for the supported algorithm syntax.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
index f200816..103e013 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.util.Collections;
@@ -43,8 +40,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * This class defines a data structure for storing and interacting with an LDAP
  * syntaxes, which constrain the structure of attribute values stored in an LDAP
@@ -58,372 +53,291 @@
  * will be preserved when the associated fields are accessed via their getters
  * or via the {@link #toString()} methods.
  */
-public final class Syntax extends SchemaElement
-{
-  private final String oid;
-  private final String definition;
-  private MatchingRule equalityMatchingRule;
-  private MatchingRule orderingMatchingRule;
-  private MatchingRule substringMatchingRule;
-  private MatchingRule approximateMatchingRule;
-  private Schema schema;
-  private SyntaxImpl impl;
+public final class Syntax extends SchemaElement {
+    private final String oid;
+    private final String definition;
+    private MatchingRule equalityMatchingRule;
+    private MatchingRule orderingMatchingRule;
+    private MatchingRule substringMatchingRule;
+    private MatchingRule approximateMatchingRule;
+    private Schema schema;
+    private SyntaxImpl impl;
 
+    Syntax(final String oid) {
+        super("", Collections.singletonMap("X-SUBST", Collections.singletonList(Schema
+                .getDefaultSyntax().getOID())));
 
-
-  Syntax(final String oid)
-  {
-    super("", Collections.singletonMap("X-SUBST", Collections
-        .singletonList(Schema.getDefaultSyntax().getOID())));
-
-    Validator.ensureNotNull(oid);
-    this.oid = oid;
-    this.definition = buildDefinition();
-    this.impl = Schema.getDefaultSyntax().impl;
-  }
-
-
-
-  Syntax(final String oid, final String description,
-      final Map<String, List<String>> extraProperties, final String definition,
-      final SyntaxImpl implementation)
-  {
-    super(description, extraProperties);
-
-    Validator.ensureNotNull(oid);
-    this.oid = oid;
-
-    if (definition != null)
-    {
-      this.definition = definition;
+        Validator.ensureNotNull(oid);
+        this.oid = oid;
+        this.definition = buildDefinition();
+        this.impl = Schema.getDefaultSyntax().impl;
     }
-    else
-    {
-      this.definition = buildDefinition();
-    }
-    this.impl = implementation;
-  }
 
+    Syntax(final String oid, final String description,
+            final Map<String, List<String>> extraProperties, final String definition,
+            final SyntaxImpl implementation) {
+        super(description, extraProperties);
 
+        Validator.ensureNotNull(oid);
+        this.oid = oid;
 
-  /**
-   * Retrieves the default approximate matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default approximate matching rule that will be used for
-   *         attributes with this syntax, or {@code null} if approximate matches
-   *         will not be allowed for this type by default.
-   */
-  public MatchingRule getApproximateMatchingRule()
-  {
-    return approximateMatchingRule;
-  }
-
-
-
-  /**
-   * Retrieves the default equality matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default equality matching rule that will be used for attributes
-   *         with this syntax, or {@code null} if equality matches will not be
-   *         allowed for this type by default.
-   */
-  public MatchingRule getEqualityMatchingRule()
-  {
-    return equalityMatchingRule;
-  }
-
-
-
-  /**
-   * Retrieves the OID for this attribute syntax.
-   *
-   * @return The OID for this attribute syntax.
-   */
-  public String getOID()
-  {
-    return oid;
-  }
-
-
-
-  /**
-   * Retrieves the default ordering matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default ordering matching rule that will be used for attributes
-   *         with this syntax, or {@code null} if ordering matches will not be
-   *         allowed for this type by default.
-   */
-  public MatchingRule getOrderingMatchingRule()
-  {
-    return orderingMatchingRule;
-  }
-
-
-
-  /**
-   * Retrieves the default substring matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default substring matching rule that will be used for
-   *         attributes with this syntax, or {@code null} if substring matches
-   *         will not be allowed for this type by default.
-   */
-  public MatchingRule getSubstringMatchingRule()
-  {
-    return substringMatchingRule;
-  }
-
-
-
-  /**
-   * Retrieves the hash code for this schema element. It will be calculated as
-   * the sum of the characters in the OID.
-   *
-   * @return The hash code for this attribute syntax.
-   */
-  @Override
-  public int hashCode()
-  {
-    return getOID().hashCode();
-  }
-
-
-
-  /**
-   * Indicates whether this attribute syntax requires that values must be
-   * encoded using the Basic Encoding Rules (BER) used by X.500 directories and
-   * always include the {@code binary} attribute description option.
-   *
-   * @return {@code true} this attribute syntax requires that values must be BER
-   *         encoded and always include the {@code binary} attribute description
-   *         option, or {@code false} if not.
-   * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight
-   *      Directory Access Protocol (LDAP): The Binary Encoding Option </a>
-   */
-  public boolean isBEREncodingRequired()
-  {
-    return impl.isBEREncodingRequired();
-  }
-
-
-
-  /**
-   * Indicates whether this attribute syntax would likely be a human readable
-   * string.
-   *
-   * @return {@code true} if this attribute syntax would likely be a human
-   *         readable string or {@code false} if not.
-   */
-  public boolean isHumanReadable()
-  {
-    return impl.isHumanReadable();
-  }
-
-
-
-  /**
-   * Retrieves a string representation of this attribute syntax in the format
-   * defined in RFC 2252.
-   *
-   * @return A string representation of this attribute syntax in the format
-   *         defined in RFC 2252.
-   */
-  @Override
-  public String toString()
-  {
-    return definition;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return {@code true} if the provided value is acceptable for use with this
-   *         syntax, or {@code false} if not.
-   */
-  public boolean valueIsAcceptable(final ByteSequence value,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    return impl.valueIsAcceptable(schema, value, invalidReason);
-  }
-
-
-
-  Syntax duplicate()
-  {
-    return new Syntax(oid, description, extraProperties, definition, impl);
-  }
-
-
-
-  @Override
-  void toStringContent(final StringBuilder buffer)
-  {
-    buffer.append(oid);
-
-    if (description != null && description.length() > 0)
-    {
-      buffer.append(" DESC '");
-      buffer.append(description);
-      buffer.append("'");
-    }
-  }
-
-
-
-  void validate(final Schema schema, final List<LocalizableMessage> warnings)
-      throws SchemaException
-  {
-    this.schema = schema;
-    if (impl == null)
-    {
-      // See if we need to override the implementation of the syntax
-      for (final Map.Entry<String, List<String>> property : extraProperties
-          .entrySet())
-      {
-        // Enums are handled in the schema builder.
-        if (property.getKey().equalsIgnoreCase("x-subst"))
-        {
-          /**
-           * One unimplemented syntax can be substituted by another defined
-           * syntax. A substitution syntax is an LDAPSyntaxDescriptionSyntax
-           * with X-SUBST extension.
-           */
-          final Iterator<String> values = property.getValue().iterator();
-          if (values.hasNext())
-          {
-            final String value = values.next();
-            if (value.equals(oid))
-            {
-              final LocalizableMessage message = ERR_ATTR_SYNTAX_CYCLIC_SUB_SYNTAX
-                  .get(oid);
-              throw new SchemaException(message);
-            }
-            if (!schema.hasSyntax(value))
-            {
-              final LocalizableMessage message = ERR_ATTR_SYNTAX_UNKNOWN_SUB_SYNTAX
-                  .get(oid, value);
-              throw new SchemaException(message);
-            }
-            final Syntax subSyntax = schema.getSyntax(value);
-            if (subSyntax.impl == null)
-            {
-              // The substitution syntax was never validated.
-              subSyntax.validate(schema, warnings);
-            }
-            impl = subSyntax.impl;
-          }
+        if (definition != null) {
+            this.definition = definition;
+        } else {
+            this.definition = buildDefinition();
         }
-        else if (property.getKey().equalsIgnoreCase("x-pattern"))
-        {
-          final Iterator<String> values = property.getValue().iterator();
-          if (values.hasNext())
-          {
-            final String value = values.next();
-            try
-            {
-              final Pattern pattern = Pattern.compile(value);
-              impl = new RegexSyntaxImpl(pattern);
-            }
-            catch (final Exception e)
-            {
-              final LocalizableMessage message = WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN
-                  .get(oid, value);
-              throw new SchemaException(message);
-            }
-          }
+        this.impl = implementation;
+    }
+
+    /**
+     * Retrieves the default approximate matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default approximate matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if approximate
+     *         matches will not be allowed for this type by default.
+     */
+    public MatchingRule getApproximateMatchingRule() {
+        return approximateMatchingRule;
+    }
+
+    /**
+     * Retrieves the default equality matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default equality matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if equality matches
+     *         will not be allowed for this type by default.
+     */
+    public MatchingRule getEqualityMatchingRule() {
+        return equalityMatchingRule;
+    }
+
+    /**
+     * Retrieves the OID for this attribute syntax.
+     *
+     * @return The OID for this attribute syntax.
+     */
+    public String getOID() {
+        return oid;
+    }
+
+    /**
+     * Retrieves the default ordering matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default ordering matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if ordering matches
+     *         will not be allowed for this type by default.
+     */
+    public MatchingRule getOrderingMatchingRule() {
+        return orderingMatchingRule;
+    }
+
+    /**
+     * Retrieves the default substring matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default substring matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if substring matches
+     *         will not be allowed for this type by default.
+     */
+    public MatchingRule getSubstringMatchingRule() {
+        return substringMatchingRule;
+    }
+
+    /**
+     * Retrieves the hash code for this schema element. It will be calculated as
+     * the sum of the characters in the OID.
+     *
+     * @return The hash code for this attribute syntax.
+     */
+    @Override
+    public int hashCode() {
+        return getOID().hashCode();
+    }
+
+    /**
+     * Indicates whether this attribute syntax requires that values must be
+     * encoded using the Basic Encoding Rules (BER) used by X.500 directories
+     * and always include the {@code binary} attribute description option.
+     *
+     * @return {@code true} this attribute syntax requires that values must be
+     *         BER encoded and always include the {@code binary} attribute
+     *         description option, or {@code false} if not.
+     * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight
+     *      Directory Access Protocol (LDAP): The Binary Encoding Option </a>
+     */
+    public boolean isBEREncodingRequired() {
+        return impl.isBEREncodingRequired();
+    }
+
+    /**
+     * Indicates whether this attribute syntax would likely be a human readable
+     * string.
+     *
+     * @return {@code true} if this attribute syntax would likely be a human
+     *         readable string or {@code false} if not.
+     */
+    public boolean isHumanReadable() {
+        return impl.isHumanReadable();
+    }
+
+    /**
+     * Retrieves a string representation of this attribute syntax in the format
+     * defined in RFC 2252.
+     *
+     * @return A string representation of this attribute syntax in the format
+     *         defined in RFC 2252.
+     */
+    @Override
+    public String toString() {
+        return definition;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return {@code true} if the provided value is acceptable for use with
+     *         this syntax, or {@code false} if not.
+     */
+    public boolean valueIsAcceptable(final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        return impl.valueIsAcceptable(schema, value, invalidReason);
+    }
+
+    Syntax duplicate() {
+        return new Syntax(oid, description, extraProperties, definition, impl);
+    }
+
+    @Override
+    void toStringContent(final StringBuilder buffer) {
+        buffer.append(oid);
+
+        if (description != null && description.length() > 0) {
+            buffer.append(" DESC '");
+            buffer.append(description);
+            buffer.append("'");
         }
-      }
-
-      // Try to find an implementation in the core schema
-      if (impl == null && Schema.getDefaultSchema().hasSyntax(oid))
-      {
-        impl = Schema.getDefaultSchema().getSyntax(oid).impl;
-      }
-      if (impl == null && Schema.getCoreSchema().hasSyntax(oid))
-      {
-        impl = Schema.getCoreSchema().getSyntax(oid).impl;
-      }
-
-      if (impl == null)
-      {
-        impl = Schema.getDefaultSyntax().impl;
-        final LocalizableMessage message = WARN_ATTR_SYNTAX_NOT_IMPLEMENTED1
-            .get(getDescription(), oid, Schema.getDefaultSyntax().getOID());
-        warnings.add(message);
-      }
     }
 
-    // Get references to the default matching rules. It will be ok
-    // if we can't find some. Just warn.
-    if (impl.getEqualityMatchingRule() != null)
-    {
-      if (schema.hasMatchingRule(impl.getEqualityMatchingRule()))
-      {
-        equalityMatchingRule = schema.getMatchingRule(impl
-            .getEqualityMatchingRule());
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UNKNOWN_EQUALITY_MATCHING_RULE
-            .get(impl.getEqualityMatchingRule(), impl.getName());
-        warnings.add(message);
-      }
-    }
+    void validate(final Schema schema, final List<LocalizableMessage> warnings)
+            throws SchemaException {
+        this.schema = schema;
+        if (impl == null) {
+            // See if we need to override the implementation of the syntax
+            for (final Map.Entry<String, List<String>> property : extraProperties.entrySet()) {
+                // Enums are handled in the schema builder.
+                if (property.getKey().equalsIgnoreCase("x-subst")) {
+                    /**
+                     * One unimplemented syntax can be substituted by another
+                     * defined syntax. A substitution syntax is an
+                     * LDAPSyntaxDescriptionSyntax with X-SUBST extension.
+                     */
+                    final Iterator<String> values = property.getValue().iterator();
+                    if (values.hasNext()) {
+                        final String value = values.next();
+                        if (value.equals(oid)) {
+                            final LocalizableMessage message =
+                                    ERR_ATTR_SYNTAX_CYCLIC_SUB_SYNTAX.get(oid);
+                            throw new SchemaException(message);
+                        }
+                        if (!schema.hasSyntax(value)) {
+                            final LocalizableMessage message =
+                                    ERR_ATTR_SYNTAX_UNKNOWN_SUB_SYNTAX.get(oid, value);
+                            throw new SchemaException(message);
+                        }
+                        final Syntax subSyntax = schema.getSyntax(value);
+                        if (subSyntax.impl == null) {
+                            // The substitution syntax was never validated.
+                            subSyntax.validate(schema, warnings);
+                        }
+                        impl = subSyntax.impl;
+                    }
+                } else if (property.getKey().equalsIgnoreCase("x-pattern")) {
+                    final Iterator<String> values = property.getValue().iterator();
+                    if (values.hasNext()) {
+                        final String value = values.next();
+                        try {
+                            final Pattern pattern = Pattern.compile(value);
+                            impl = new RegexSyntaxImpl(pattern);
+                        } catch (final Exception e) {
+                            final LocalizableMessage message =
+                                    WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN.get(oid,
+                                            value);
+                            throw new SchemaException(message);
+                        }
+                    }
+                }
+            }
 
-    if (impl.getOrderingMatchingRule() != null)
-    {
-      if (schema.hasMatchingRule(impl.getOrderingMatchingRule()))
-      {
-        orderingMatchingRule = schema.getMatchingRule(impl
-            .getOrderingMatchingRule());
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UNKNOWN_ORDERING_MATCHING_RULE
-            .get(impl.getOrderingMatchingRule(), impl.getName());
-        warnings.add(message);
-      }
-    }
+            // Try to find an implementation in the core schema
+            if (impl == null && Schema.getDefaultSchema().hasSyntax(oid)) {
+                impl = Schema.getDefaultSchema().getSyntax(oid).impl;
+            }
+            if (impl == null && Schema.getCoreSchema().hasSyntax(oid)) {
+                impl = Schema.getCoreSchema().getSyntax(oid).impl;
+            }
 
-    if (impl.getSubstringMatchingRule() != null)
-    {
-      if (schema.hasMatchingRule(impl.getSubstringMatchingRule()))
-      {
-        substringMatchingRule = schema.getMatchingRule(impl
-            .getSubstringMatchingRule());
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UNKNOWN_SUBSTRING_MATCHING_RULE
-            .get(impl.getSubstringMatchingRule(), impl.getName());
-        warnings.add(message);
-      }
-    }
+            if (impl == null) {
+                impl = Schema.getDefaultSyntax().impl;
+                final LocalizableMessage message =
+                        WARN_ATTR_SYNTAX_NOT_IMPLEMENTED1.get(getDescription(), oid, Schema
+                                .getDefaultSyntax().getOID());
+                warnings.add(message);
+            }
+        }
 
-    if (impl.getApproximateMatchingRule() != null)
-    {
-      if (schema.hasMatchingRule(impl.getApproximateMatchingRule()))
-      {
-        approximateMatchingRule = schema.getMatchingRule(impl
-            .getApproximateMatchingRule());
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UNKNOWN_APPROXIMATE_MATCHING_RULE
-            .get(impl.getApproximateMatchingRule(), impl.getName());
-        warnings.add(message);
-      }
+        // Get references to the default matching rules. It will be ok
+        // if we can't find some. Just warn.
+        if (impl.getEqualityMatchingRule() != null) {
+            if (schema.hasMatchingRule(impl.getEqualityMatchingRule())) {
+                equalityMatchingRule = schema.getMatchingRule(impl.getEqualityMatchingRule());
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UNKNOWN_EQUALITY_MATCHING_RULE.get(impl
+                                .getEqualityMatchingRule(), impl.getName());
+                warnings.add(message);
+            }
+        }
+
+        if (impl.getOrderingMatchingRule() != null) {
+            if (schema.hasMatchingRule(impl.getOrderingMatchingRule())) {
+                orderingMatchingRule = schema.getMatchingRule(impl.getOrderingMatchingRule());
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UNKNOWN_ORDERING_MATCHING_RULE.get(impl
+                                .getOrderingMatchingRule(), impl.getName());
+                warnings.add(message);
+            }
+        }
+
+        if (impl.getSubstringMatchingRule() != null) {
+            if (schema.hasMatchingRule(impl.getSubstringMatchingRule())) {
+                substringMatchingRule = schema.getMatchingRule(impl.getSubstringMatchingRule());
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UNKNOWN_SUBSTRING_MATCHING_RULE.get(impl
+                                .getSubstringMatchingRule(), impl.getName());
+                warnings.add(message);
+            }
+        }
+
+        if (impl.getApproximateMatchingRule() != null) {
+            if (schema.hasMatchingRule(impl.getApproximateMatchingRule())) {
+                approximateMatchingRule = schema.getMatchingRule(impl.getApproximateMatchingRule());
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UNKNOWN_APPROXIMATE_MATCHING_RULE.get(impl
+                                .getApproximateMatchingRule(), impl.getName());
+                warnings.add(message);
+            }
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java
index 956a057..4016e88 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,116 +26,97 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This interface defines the set of methods and structures that must be
  * implemented to define a new attribute syntax.
  */
-public interface SyntaxImpl
-{
-  /**
-   * Retrieves the default approximate matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default approximate matching rule that will be used for
-   *         attributes with this syntax, or {@code null} if approximate matches
-   *         will not be allowed for this type by default.
-   */
-  public String getApproximateMatchingRule();
+public interface SyntaxImpl {
+    /**
+     * Retrieves the default approximate matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default approximate matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if approximate
+     *         matches will not be allowed for this type by default.
+     */
+    public String getApproximateMatchingRule();
 
+    /**
+     * Retrieves the default equality matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default equality matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if equality matches
+     *         will not be allowed for this type by default.
+     */
+    public String getEqualityMatchingRule();
 
+    /**
+     * Retrieves the common name for this attribute syntax.
+     *
+     * @return The common name for this attribute syntax.
+     */
+    public String getName();
 
-  /**
-   * Retrieves the default equality matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default equality matching rule that will be used for attributes
-   *         with this syntax, or {@code null} if equality matches will not be
-   *         allowed for this type by default.
-   */
-  public String getEqualityMatchingRule();
+    /**
+     * Retrieves the default ordering matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default ordering matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if ordering matches
+     *         will not be allowed for this type by default.
+     */
+    public String getOrderingMatchingRule();
 
+    /**
+     * Retrieves the default substring matching rule that will be used for
+     * attributes with this syntax.
+     *
+     * @return The default substring matching rule that will be used for
+     *         attributes with this syntax, or {@code null} if substring matches
+     *         will not be allowed for this type by default.
+     */
+    public String getSubstringMatchingRule();
 
+    /**
+     * Indicates whether this attribute syntax requires that values must be
+     * encoded using the Basic Encoding Rules (BER) used by X.500 directories
+     * and always include the {@code binary} attribute description option.
+     *
+     * @return {@code true} this attribute syntax requires that values must be
+     *         BER encoded and always include the {@code binary} attribute
+     *         description option, or {@code false} if not.
+     * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight
+     *      Directory Access Protocol (LDAP): The Binary Encoding Option </a>
+     */
+    public boolean isBEREncodingRequired();
 
-  /**
-   * Retrieves the common name for this attribute syntax.
-   *
-   * @return The common name for this attribute syntax.
-   */
-  public String getName();
+    /**
+     * Indicates whether this attribute syntax would likely be a human readable
+     * string.
+     *
+     * @return {@code true} if this attribute syntax would likely be a human
+     *         readable string or {@code false} if not.
+     */
+    boolean isHumanReadable();
 
-
-
-  /**
-   * Retrieves the default ordering matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default ordering matching rule that will be used for attributes
-   *         with this syntax, or {@code null} if ordering matches will not be
-   *         allowed for this type by default.
-   */
-  public String getOrderingMatchingRule();
-
-
-
-  /**
-   * Retrieves the default substring matching rule that will be used for
-   * attributes with this syntax.
-   *
-   * @return The default substring matching rule that will be used for
-   *         attributes with this syntax, or {@code null} if substring matches
-   *         will not be allowed for this type by default.
-   */
-  public String getSubstringMatchingRule();
-
-
-
-  /**
-   * Indicates whether this attribute syntax requires that values must be
-   * encoded using the Basic Encoding Rules (BER) used by X.500 directories and
-   * always include the {@code binary} attribute description option.
-   *
-   * @return {@code true} this attribute syntax requires that values must be BER
-   *         encoded and always include the {@code binary} attribute description
-   *         option, or {@code false} if not.
-   * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight
-   *      Directory Access Protocol (LDAP): The Binary Encoding Option </a>
-   */
-  public boolean isBEREncodingRequired();
-
-
-
-  /**
-   * Indicates whether this attribute syntax would likely be a human readable
-   * string.
-   *
-   * @return {@code true} if this attribute syntax would likely be a human
-   *         readable string or {@code false} if not.
-   */
-  boolean isHumanReadable();
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return {@code true} if the provided value is acceptable for use with this
-   *         syntax, or {@code false} if not.
-   */
-  boolean valueIsAcceptable(Schema schema, ByteSequence value,
-      LocalizableMessageBuilder invalidReason);
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return {@code true} if the provided value is acceptable for use with
+     *         this syntax, or {@code false} if not.
+     */
+    boolean valueIsAcceptable(Schema schema, ByteSequence value,
+            LocalizableMessageBuilder invalidReason);
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java
index 427212b..06dbe03 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,42 +25,32 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class implements the telephoneNumberMatch matching rule defined in X.520
  * and referenced in RFC 2252. Note that although the specification calls for a
  * very rigorous format, this is widely ignored so this matching will compare
  * only numeric digits and strip out everything else.
  */
-final class TelephoneNumberEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-    final StringBuilder buffer = new StringBuilder(valueLength);
+final class TelephoneNumberEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+        final StringBuilder buffer = new StringBuilder(valueLength);
 
-    // Iterate through the characters in the value and filter out
-    // everything that isn't a digit.
-    for (int i = 0; i < valueLength; i++)
-    {
-      final char c = valueString.charAt(i);
-      if (StaticUtils.isDigit(c))
-      {
-        buffer.append(c);
-      }
+        // Iterate through the characters in the value and filter out
+        // everything that isn't a digit.
+        for (int i = 0; i < valueLength; i++) {
+            final char c = valueString.charAt(i);
+            if (StaticUtils.isDigit(c)) {
+                buffer.append(c);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
     }
-
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java
index 9da0d37..413eb55 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,42 +25,32 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class implements the telephoneNumberSubstringsMatch matching rule
  * defined in X.520 and referenced in RFC 2252. Note that although the
  * specification calls for a very rigorous format, this is widely ignored so
  * this matching will compare only numeric digits and strip out everything else.
  */
-final class TelephoneNumberSubstringMatchingRuleImpl extends
-    AbstractSubstringMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-    final StringBuilder buffer = new StringBuilder(valueLength);
+final class TelephoneNumberSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+        final StringBuilder buffer = new StringBuilder(valueLength);
 
-    // Iterate through the characters in the value and filter out
-    // everything that isn't a digit.
-    for (int i = 0; i < valueLength; i++)
-    {
-      final char c = valueString.charAt(i);
-      if (StaticUtils.isDigit(c))
-      {
-        buffer.append(c);
-      }
+        // Iterate through the characters in the value and filter out
+        // everything that isn't a digit.
+        for (int i = 0; i < valueLength; i++) {
+            final char c = valueString.charAt(i);
+            if (StaticUtils.isDigit(c)) {
+                buffer.append(c);
+            }
+        }
+
+        return ByteString.valueOf(buffer.toString());
     }
-
-    return ByteString.valueOf(buffer.toString());
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java
index 99c2dbf..cc07d08 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.isDigit;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_TELEPHONE_EMPTY;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_TELEPHONE_ILLEGAL_CHAR;
@@ -43,8 +40,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the telephone number attribute syntax, which is defined
  * in RFC 2252. Note that this can have two modes of operation, depending on its
@@ -53,149 +48,118 @@
  * However, it can also be configured in a "strict" mode, in which case it will
  * only accept values in the E.123 international telephone number format.
  */
-final class TelephoneNumberSyntaxImpl extends AbstractSyntaxImpl
-{
+final class TelephoneNumberSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_TELEPHONE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_TELEPHONE_NAME;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_TELEPHONE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // No matter what, the value can't be empty or null.
-    String valueStr;
-    if (value == null || (valueStr = value.toString().trim()).length() == 0)
-    {
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEPHONE_EMPTY.get());
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_TELEPHONE_OID;
     }
 
-    final int length = valueStr.length();
+    public String getName() {
+        return SYNTAX_TELEPHONE_NAME;
+    }
 
-    if (!schema.allowNonStandardTelephoneNumbers())
-    {
-      // If the value does not start with a plus sign, then that's not
-      // acceptable.
-      if (valueStr.charAt(0) != '+')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_NO_PLUS
-            .get(valueStr);
-        invalidReason.append(message);
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_TELEPHONE_OID;
+    }
+
+    public boolean isHumanReadable() {
         return false;
-      }
-
-      // Iterate through the remaining characters in the value. There
-      // must be at least one digit, and it must contain only valid
-      // digits and separator characters.
-      boolean digitSeen = false;
-      for (int i = 1; i < length; i++)
-      {
-        final char c = valueStr.charAt(i);
-        if (isDigit(c))
-        {
-          digitSeen = true;
-        }
-        else if (!isSeparator(c))
-        {
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_ILLEGAL_CHAR
-              .get(valueStr, String.valueOf(c), i);
-          invalidReason.append(message);
-          return false;
-        }
-      }
-
-      if (!digitSeen)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_NO_DIGITS
-            .get(valueStr);
-        invalidReason.append(message);
-        return false;
-      }
-
-      // If we've gotten here, then we'll consider it acceptable.
-      return true;
     }
-    else
-    {
-      // If we are not in strict mode, then all non-empty values
-      // containing at least one digit will be acceptable.
-      for (int i = 0; i < length; i++)
-      {
-        if (isDigit(valueStr.charAt(i)))
-        {
-          return true;
+
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // No matter what, the value can't be empty or null.
+        String valueStr;
+        if (value == null || (valueStr = value.toString().trim()).length() == 0) {
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEPHONE_EMPTY.get());
+            return false;
         }
-      }
 
-      // If we made it here, then we didn't find any digits.
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_NO_DIGITS
-          .get(valueStr);
-      invalidReason.append(message);
-      return false;
+        final int length = valueStr.length();
+
+        if (!schema.allowNonStandardTelephoneNumbers()) {
+            // If the value does not start with a plus sign, then that's not
+            // acceptable.
+            if (valueStr.charAt(0) != '+') {
+                final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_NO_PLUS.get(valueStr);
+                invalidReason.append(message);
+                return false;
+            }
+
+            // Iterate through the remaining characters in the value. There
+            // must be at least one digit, and it must contain only valid
+            // digits and separator characters.
+            boolean digitSeen = false;
+            for (int i = 1; i < length; i++) {
+                final char c = valueStr.charAt(i);
+                if (isDigit(c)) {
+                    digitSeen = true;
+                } else if (!isSeparator(c)) {
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_TELEPHONE_ILLEGAL_CHAR.get(valueStr, String.valueOf(c),
+                                    i);
+                    invalidReason.append(message);
+                    return false;
+                }
+            }
+
+            if (!digitSeen) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_TELEPHONE_NO_DIGITS.get(valueStr);
+                invalidReason.append(message);
+                return false;
+            }
+
+            // If we've gotten here, then we'll consider it acceptable.
+            return true;
+        } else {
+            // If we are not in strict mode, then all non-empty values
+            // containing at least one digit will be acceptable.
+            for (int i = 0; i < length; i++) {
+                if (isDigit(valueStr.charAt(i))) {
+                    return true;
+                }
+            }
+
+            // If we made it here, then we didn't find any digits.
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_TELEPHONE_NO_DIGITS.get(valueStr);
+            invalidReason.append(message);
+            return false;
+        }
     }
-  }
 
-
-
-  /**
-   * Indicates whether the provided character is a valid separator for telephone
-   * number components when operating in strict mode.
-   *
-   * @param c
-   *          The character for which to make the determination.
-   * @return <CODE>true</CODE> if the provided character is a valid separator,
-   *         or <CODE>false</CODE> if it is not.
-   */
-  private boolean isSeparator(final char c)
-  {
-    switch (c)
-    {
-    case ' ':
-    case '-':
-      return true;
-    default:
-      return false;
+    /**
+     * Indicates whether the provided character is a valid separator for
+     * telephone number components when operating in strict mode.
+     *
+     * @param c
+     *            The character for which to make the determination.
+     * @return <CODE>true</CODE> if the provided character is a valid separator,
+     *         or <CODE>false</CODE> if it is not.
+     */
+    private boolean isSeparator(final char c) {
+        switch (c) {
+        case ' ':
+        case '-':
+            return true;
+        default:
+            return false;
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java
index 0772409..3cc58ce 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_IGNORE_OID;
@@ -40,8 +37,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the teletex terminal identifier attribute syntax, which
  * contains a printable string (the terminal identifier) followed by zero or
@@ -58,211 +53,167 @@
  * <LI>private</LI>
  * </UL>
  */
-final class TeletexTerminalIdentifierSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * The set of allowed fax parameter values, formatted entirely in lowercase
-   * characters.
-   */
-  private static final HashSet<String> ALLOWED_TTX_PARAMETERS = new HashSet<String>(
-      5);
+final class TeletexTerminalIdentifierSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * The set of allowed fax parameter values, formatted entirely in lowercase
+     * characters.
+     */
+    private static final HashSet<String> ALLOWED_TTX_PARAMETERS = new HashSet<String>(5);
 
-  static
-  {
-    ALLOWED_TTX_PARAMETERS.add("graphic");
-    ALLOWED_TTX_PARAMETERS.add("control");
-    ALLOWED_TTX_PARAMETERS.add("misc");
-    ALLOWED_TTX_PARAMETERS.add("page");
-    ALLOWED_TTX_PARAMETERS.add("private");
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_TELETEX_TERM_ID_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get a lowercase string representation of the value and find its
-    // length.
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-
-    // The value must contain at least one character.
-    if (valueLength == 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_EMPTY.get());
-      return false;
+    static {
+        ALLOWED_TTX_PARAMETERS.add("graphic");
+        ALLOWED_TTX_PARAMETERS.add("control");
+        ALLOWED_TTX_PARAMETERS.add("misc");
+        ALLOWED_TTX_PARAMETERS.add("page");
+        ALLOWED_TTX_PARAMETERS.add("private");
     }
 
-    // The first character must be a printable string character.
-    char c = valueString.charAt(0);
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_NOT_PRINTABLE.get(
-          valueString, String.valueOf(c), 0));
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
 
-    // Continue reading until we find a dollar sign or the end of the
-    // string. Every intermediate character must be a printable string
-    // character.
-    int pos = 1;
-    for (; pos < valueLength; pos++)
-    {
-      c = valueString.charAt(pos);
-      if (c == '$')
-      {
-        pos++;
-        break;
-      }
-      else
-      {
-        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-        {
-
-          invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_NOT_PRINTABLE.get(
-              valueString, String.valueOf(c), pos));
-        }
-      }
+    public String getName() {
+        return SYNTAX_TELETEX_TERM_ID_NAME;
     }
 
-    if (pos >= valueLength)
-    {
-      // We're at the end of the value, so it must be valid unless the
-      // last character was a dollar sign.
-      if (c == '$')
-      {
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
+    }
 
-        invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_END_WITH_DOLLAR
-            .get(valueString));
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
+    }
+
+    public boolean isHumanReadable() {
         return false;
-      }
-      else
-      {
-        return true;
-      }
     }
 
-    // Continue reading until we find the end of the string. Each
-    // substring must be a valid teletex terminal identifier parameter
-    // followed by a colon and the value. Dollar signs must be escaped
-    int paramStartPos = pos;
-    boolean escaped = false;
-    while (pos < valueLength)
-    {
-      if (escaped)
-      {
-        pos++;
-        continue;
-      }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get a lowercase string representation of the value and find its
+        // length.
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
 
-      c = valueString.charAt(pos++);
-      if (c == '\\')
-      {
-        escaped = true;
-        continue;
-      }
-      else if (c == '$')
-      {
-        final String paramStr = valueString.substring(paramStartPos, pos);
+        // The value must contain at least one character.
+        if (valueLength == 0) {
 
+            invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_EMPTY.get());
+            return false;
+        }
+
+        // The first character must be a printable string character.
+        char c = valueString.charAt(0);
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_NOT_PRINTABLE.get(valueString, String
+                    .valueOf(c), 0));
+            return false;
+        }
+
+        // Continue reading until we find a dollar sign or the end of the
+        // string. Every intermediate character must be a printable string
+        // character.
+        int pos = 1;
+        for (; pos < valueLength; pos++) {
+            c = valueString.charAt(pos);
+            if (c == '$') {
+                pos++;
+                break;
+            } else {
+                if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_NOT_PRINTABLE.get(valueString,
+                            String.valueOf(c), pos));
+                }
+            }
+        }
+
+        if (pos >= valueLength) {
+            // We're at the end of the value, so it must be valid unless the
+            // last character was a dollar sign.
+            if (c == '$') {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_END_WITH_DOLLAR.get(valueString));
+                return false;
+            } else {
+                return true;
+            }
+        }
+
+        // Continue reading until we find the end of the string. Each
+        // substring must be a valid teletex terminal identifier parameter
+        // followed by a colon and the value. Dollar signs must be escaped
+        int paramStartPos = pos;
+        boolean escaped = false;
+        while (pos < valueLength) {
+            if (escaped) {
+                pos++;
+                continue;
+            }
+
+            c = valueString.charAt(pos++);
+            if (c == '\\') {
+                escaped = true;
+                continue;
+            } else if (c == '$') {
+                final String paramStr = valueString.substring(paramStartPos, pos);
+
+                final int colonPos = paramStr.indexOf(':');
+                if (colonPos < 0) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_PARAM_NO_COLON.get(valueString));
+                    return false;
+                }
+
+                final String paramName = paramStr.substring(0, colonPos);
+                if (!ALLOWED_TTX_PARAMETERS.contains(paramName)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_ILLEGAL_PARAMETER.get(
+                            valueString, paramName));
+                    return false;
+                }
+
+                paramStartPos = pos;
+            }
+        }
+
+        // We must be at the end of the value. Read the last parameter and
+        // make sure it is valid.
+        final String paramStr = valueString.substring(paramStartPos);
         final int colonPos = paramStr.indexOf(':');
-        if (colonPos < 0)
-        {
+        if (colonPos < 0) {
 
-          invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_PARAM_NO_COLON
-              .get(valueString));
-          return false;
+            invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_PARAM_NO_COLON.get(valueString));
+            return false;
         }
 
         final String paramName = paramStr.substring(0, colonPos);
-        if (!ALLOWED_TTX_PARAMETERS.contains(paramName))
-        {
+        if (!ALLOWED_TTX_PARAMETERS.contains(paramName)) {
 
-          invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_ILLEGAL_PARAMETER.get(
-              valueString, paramName));
-          return false;
+            invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_ILLEGAL_PARAMETER.get(valueString,
+                    paramName));
+            return false;
         }
 
-        paramStartPos = pos;
-      }
+        // If we've gotten here, then the value must be valid.
+        return true;
     }
-
-    // We must be at the end of the value. Read the last parameter and
-    // make sure it is valid.
-    final String paramStr = valueString.substring(paramStartPos);
-    final int colonPos = paramStr.indexOf(':');
-    if (colonPos < 0)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_PARAM_NO_COLON
-          .get(valueString));
-      return false;
-    }
-
-    final String paramName = paramStr.substring(0, colonPos);
-    if (!ALLOWED_TTX_PARAMETERS.contains(paramName))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELETEXID_ILLEGAL_PARAMETER.get(
-          valueString, paramName));
-      return false;
-    }
-
-    // If we've gotten here, then the value must be valid.
-    return true;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java
index 868b6a1..aa25767 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_TELEX_TOO_SHORT;
@@ -41,186 +38,149 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the telex number attribute syntax, which contains three
  * printable strings separated by dollar sign characters. Equality, ordering,
  * and substring matching will be allowed by default.
  */
-final class TelexNumberSyntaxImpl extends AbstractSyntaxImpl
-{
+final class TelexNumberSyntaxImpl extends AbstractSyntaxImpl {
 
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_TELEX_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_CASE_IGNORE_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get a string representation of the value and find its length.
-    final String valueString = value.toString();
-    final int valueLength = valueString.length();
-
-    if (valueLength < 5)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TOO_SHORT.get(valueString));
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_CASE_IGNORE_OID;
     }
 
-    // The first character must be a printable string character.
-    char c = valueString.charAt(0);
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString,
-          String.valueOf(c), 0));
-      return false;
+    public String getName() {
+        return SYNTAX_TELEX_NAME;
     }
 
-    // Continue reading until we find a dollar sign. Every intermediate
-    // character must be a printable string character.
-    int pos = 1;
-    for (; pos < valueLength; pos++)
-    {
-      c = valueString.charAt(pos);
-      if (c == '$')
-      {
-        pos++;
-        break;
-      }
-      else
-      {
-        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-        {
-
-          invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(
-              valueString, String.valueOf(c), pos));
-        }
-      }
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_CASE_IGNORE_OID;
     }
 
-    if (pos >= valueLength)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TRUNCATED.get(valueString));
-      return false;
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
     }
 
-    // The next character must be a printable string character.
-    c = valueString.charAt(pos++);
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString,
-          String.valueOf(c), (pos - 1)));
-      return false;
-    }
-
-    // Continue reading until we find another dollar sign. Every
-    // intermediate character must be a printable string character.
-    for (; pos < valueLength; pos++)
-    {
-      c = valueString.charAt(pos);
-      if (c == '$')
-      {
-        pos++;
-        break;
-      }
-      else
-      {
-        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-        {
-
-          invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(
-              valueString, String.valueOf(c), pos));
-          return false;
-        }
-      }
-    }
-
-    if (pos >= valueLength)
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TRUNCATED.get(valueString));
-      return false;
-    }
-
-    // The next character must be a printable string character.
-    c = valueString.charAt(pos++);
-    if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-    {
-
-      invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString,
-          String.valueOf(c), (pos - 1)));
-      return false;
-    }
-
-    // Continue reading until the end of the value. Every intermediate
-    // character must be a printable string character.
-    for (; pos < valueLength; pos++)
-    {
-      c = valueString.charAt(pos);
-      if (!PrintableStringSyntaxImpl.isPrintableCharacter(c))
-      {
-
-        invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(
-            valueString, String.valueOf(c), pos));
+    public boolean isHumanReadable() {
         return false;
-      }
     }
 
-    // If we've gotten here, then we're at the end of the value and it
-    // is acceptable.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get a string representation of the value and find its length.
+        final String valueString = value.toString();
+        final int valueLength = valueString.length();
+
+        if (valueLength < 5) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TOO_SHORT.get(valueString));
+            return false;
+        }
+
+        // The first character must be a printable string character.
+        char c = valueString.charAt(0);
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString, String
+                    .valueOf(c), 0));
+            return false;
+        }
+
+        // Continue reading until we find a dollar sign. Every intermediate
+        // character must be a printable string character.
+        int pos = 1;
+        for (; pos < valueLength; pos++) {
+            c = valueString.charAt(pos);
+            if (c == '$') {
+                pos++;
+                break;
+            } else {
+                if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(valueString, String
+                            .valueOf(c), pos));
+                }
+            }
+        }
+
+        if (pos >= valueLength) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TRUNCATED.get(valueString));
+            return false;
+        }
+
+        // The next character must be a printable string character.
+        c = valueString.charAt(pos++);
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString, String
+                    .valueOf(c), (pos - 1)));
+            return false;
+        }
+
+        // Continue reading until we find another dollar sign. Every
+        // intermediate character must be a printable string character.
+        for (; pos < valueLength; pos++) {
+            c = valueString.charAt(pos);
+            if (c == '$') {
+                pos++;
+                break;
+            } else {
+                if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                    invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(valueString, String
+                            .valueOf(c), pos));
+                    return false;
+                }
+            }
+        }
+
+        if (pos >= valueLength) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_TRUNCATED.get(valueString));
+            return false;
+        }
+
+        // The next character must be a printable string character.
+        c = valueString.charAt(pos++);
+        if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+            invalidReason.append(ERR_ATTR_SYNTAX_TELEX_NOT_PRINTABLE.get(valueString, String
+                    .valueOf(c), (pos - 1)));
+            return false;
+        }
+
+        // Continue reading until the end of the value. Every intermediate
+        // character must be a printable string character.
+        for (; pos < valueLength; pos++) {
+            c = valueString.charAt(pos);
+            if (!PrintableStringSyntaxImpl.isPrintableCharacter(c)) {
+
+                invalidReason.append(ERR_ATTR_SYNTAX_TELEX_ILLEGAL_CHAR.get(valueString, String
+                        .valueOf(c), pos));
+                return false;
+            }
+        }
+
+        // If we've gotten here, then we're at the end of the value and it
+        // is acceptable.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java
index 8c5beca..3f7c0d4 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
@@ -43,8 +40,6 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class implements the UTC time attribute syntax. This is very similar to
  * the generalized time syntax (and actually has been deprecated in favor of
@@ -53,682 +48,631 @@
  * matching rules, and equality, ordering, and substring matching will be
  * allowed.
  */
-final class UTCTimeSyntaxImpl extends AbstractSyntaxImpl
-{
+final class UTCTimeSyntaxImpl extends AbstractSyntaxImpl {
 
-  /**
-   * The lock that will be used to provide threadsafe access to the date
-   * formatter.
-   */
-  private final static Object DATE_FORMAT_LOCK;
+    /**
+     * The lock that will be used to provide threadsafe access to the date
+     * formatter.
+     */
+    private final static Object DATE_FORMAT_LOCK;
 
-  /**
-   * The date formatter that will be used to convert dates into UTC time values.
-   * Note that all interaction with it must be synchronized.
-   */
-  private final static SimpleDateFormat DATE_FORMAT;
+    /**
+     * The date formatter that will be used to convert dates into UTC time
+     * values. Note that all interaction with it must be synchronized.
+     */
+    private final static SimpleDateFormat DATE_FORMAT;
 
-  /*
-   * Create the date formatter that will be used to construct and parse
-   * normalized UTC time values.
-   */
-  static
-  {
-    DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
-    DATE_FORMAT.setLenient(false);
-    DATE_FORMAT.setTimeZone(TimeZone.getTimeZone(TIME_ZONE_UTC));
+    /*
+     * Create the date formatter that will be used to construct and parse
+     * normalized UTC time values.
+     */
+    static {
+        DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_UTC_TIME);
+        DATE_FORMAT.setLenient(false);
+        DATE_FORMAT.setTimeZone(TimeZone.getTimeZone(TIME_ZONE_UTC));
 
-    DATE_FORMAT_LOCK = new Object();
-  }
-
-
-
-  /**
-   * Retrieves an string containing a UTC time representation of the provided
-   * date.
-   *
-   * @param d
-   *          The date for which to retrieve the UTC time value.
-   * @return The attribute value created from the date.
-   */
-  static String createUTCTimeValue(final Date d)
-  {
-    synchronized (DATE_FORMAT_LOCK)
-    {
-      return DATE_FORMAT.format(d);
-    }
-  }
-
-
-
-  /**
-   * Decodes the provided normalized value as a UTC time value and retrieves a
-   * Java <CODE>Date</CODE> object containing its representation.
-   *
-   * @param valueString
-   *          The normalized UTC time value to decode to a Java
-   *          <CODE>Date</CODE>.
-   * @return The Java <CODE>Date</CODE> created from the provided UTC time
-   *         value.
-   * @throws DecodeException
-   *           If the provided value cannot be parsed as a valid UTC time
-   *           string.
-   */
-  static Date decodeUTCTimeValue(final String valueString)
-      throws DecodeException
-  {
-    try
-    {
-      synchronized (DATE_FORMAT_LOCK)
-      {
-        return DATE_FORMAT.parse(valueString);
-      }
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE
-          .get(valueString, String.valueOf(e));
-      final DecodeException de = DecodeException.error(message, e);
-      StaticUtils.DEBUG_LOG.throwing("UTCTimeSyntax", "decodeUTCTimeValue", de);
-      throw de;
-    }
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_GENERALIZED_TIME_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_UTC_TIME_NAME;
-  }
-
-
-
-  @Override
-  public String getOrderingMatchingRule()
-  {
-    return OMR_GENERALIZED_TIME_OID;
-  }
-
-
-
-  @Override
-  public String getSubstringMatchingRule()
-  {
-    return SMR_CASE_IGNORE_OID;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // Get the value as a string and verify that it is at least long
-    // enough for "YYYYMMDDhhmmZ", which is the shortest allowed value.
-    final String valueString = value.toString().toUpperCase();
-    final int length = valueString.length();
-    if (length < 11)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_TOO_SHORT
-          .get(valueString);
-      invalidReason.append(message);
-      return false;
+        DATE_FORMAT_LOCK = new Object();
     }
 
-    // The first two characters are the year, and they must be numeric
-    // digits between 0 and 9.
-    for (int i = 0; i < 2; i++)
-    {
-      switch (valueString.charAt(i))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_YEAR
-            .get(valueString, String.valueOf(valueString.charAt(i)));
-        invalidReason.append(message);
-        return false;
-      }
+    /**
+     * Retrieves an string containing a UTC time representation of the provided
+     * date.
+     *
+     * @param d
+     *            The date for which to retrieve the UTC time value.
+     * @return The attribute value created from the date.
+     */
+    static String createUTCTimeValue(final Date d) {
+        synchronized (DATE_FORMAT_LOCK) {
+            return DATE_FORMAT.format(d);
+        }
     }
 
-    // The next two characters are the month, and they must form the
-    // string representation of an integer between 01 and 12.
-    char m1 = valueString.charAt(2);
-    final char m2 = valueString.charAt(3);
-    switch (m1)
-    {
-    case '0':
-      // m2 must be a digit between 1 and 9.
-      switch (m2)
-      {
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH
-            .get(valueString, valueString.substring(2, 4));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    case '1':
-      // m2 must be a digit between 0 and 2.
-      switch (m2)
-      {
-      case '0':
-      case '1':
-      case '2':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH
-            .get(valueString, valueString.substring(2, 4));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH
-          .get(valueString, valueString.substring(2, 4));
-      invalidReason.append(message);
-      return false;
+    /**
+     * Decodes the provided normalized value as a UTC time value and retrieves a
+     * Java <CODE>Date</CODE> object containing its representation.
+     *
+     * @param valueString
+     *            The normalized UTC time value to decode to a Java
+     *            <CODE>Date</CODE>.
+     * @return The Java <CODE>Date</CODE> created from the provided UTC time
+     *         value.
+     * @throws DecodeException
+     *             If the provided value cannot be parsed as a valid UTC time
+     *             string.
+     */
+    static Date decodeUTCTimeValue(final String valueString) throws DecodeException {
+        try {
+            synchronized (DATE_FORMAT_LOCK) {
+                return DATE_FORMAT.parse(valueString);
+            }
+        } catch (final Exception e) {
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, String.valueOf(e));
+            final DecodeException de = DecodeException.error(message, e);
+            StaticUtils.DEBUG_LOG.throwing("UTCTimeSyntax", "decodeUTCTimeValue", de);
+            throw de;
+        }
     }
 
-    // The next two characters should be the day of the month, and they
-    // must form the string representation of an integer between 01 and
-    // 31. This doesn't do any validation against the year or month, so
-    // it will allow dates like April 31, or February 29 in a non-leap
-    // year, but we'll let those slide.
-    final char d1 = valueString.charAt(4);
-    final char d2 = valueString.charAt(5);
-    switch (d1)
-    {
-    case '0':
-      // d2 must be a digit between 1 and 9.
-      switch (d2)
-      {
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(4, 6));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    case '1':
-      // Treated the same as '2'.
-    case '2':
-      // d2 must be a digit between 0 and 9.
-      switch (d2)
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(4, 6));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    case '3':
-      // d2 must be either 0 or 1.
-      switch (d2)
-      {
-      case '0':
-      case '1':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY
-            .get(valueString, valueString.substring(4, 6));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY
-          .get(valueString, valueString.substring(4, 6));
-      invalidReason.append(message);
-      return false;
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_GENERALIZED_TIME_OID;
     }
 
-    // The next two characters must be the hour, and they must form the
-    // string representation of an integer between 00 and 23.
-    final char h1 = valueString.charAt(6);
-    final char h2 = valueString.charAt(7);
-    switch (h1)
-    {
-    case '0':
-      // This is treated the same as '1'.
-    case '1':
-      switch (h2)
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR
-            .get(valueString, valueString.substring(6, 8));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    case '2':
-      // This must be a digit between 0 and 3.
-      switch (h2)
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR
-            .get(valueString, valueString.substring(6, 8));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR
-          .get(valueString, valueString.substring(6, 8));
-      invalidReason.append(message);
-      return false;
+    public String getName() {
+        return SYNTAX_UTC_TIME_NAME;
     }
 
-    // Next, there should be two digits comprising an integer between 00
-    // and 59 for the minute.
-    m1 = valueString.charAt(8);
-    switch (m1)
-    {
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-      // There must be at least two more characters, and the next one
-      // must be a digit between 0 and 9.
-      if (length < 11)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(m1), 8);
-        invalidReason.append(message);
-        return false;
-      }
-
-      switch (valueString.charAt(9))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MINUTE
-            .get(valueString, valueString.substring(8, 10));
-        invalidReason.append(message);
-        return false;
-      }
-
-      break;
-
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(m1), 8);
-      invalidReason.append(message);
-      return false;
+    @Override
+    public String getOrderingMatchingRule() {
+        return OMR_GENERALIZED_TIME_OID;
     }
 
-    // Next, there should be either two digits comprising an integer
-    // between 00 and 60 (for the second, including a possible leap
-    // second), a letter 'Z' (for the UTC specifier), or a plus or minus
-    // sign followed by four digits (for the UTC offset).
-    final char s1 = valueString.charAt(10);
-    switch (s1)
-    {
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-      // There must be at least two more characters, and the next one
-      // must be a digit between 0 and 9.
-      if (length < 13)
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 10);
-        invalidReason.append(message);
-        return false;
-      }
-
-      switch (valueString.charAt(11))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND
-            .get(valueString, valueString.substring(10, 12));
-        invalidReason.append(message);
-        return false;
-      }
-
-      break;
-    case '6':
-      // There must be at least two more characters and the next one
-      // must be a 0.
-      if (length < 13)
-      {
-
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 10);
-        invalidReason.append(message);
-        return false;
-      }
-
-      if (valueString.charAt(11) != '0')
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND
-            .get(valueString, valueString.substring(10, 12));
-        invalidReason.append(message);
-        return false;
-      }
-
-      break;
-    case 'Z':
-      // This is fine only if we are at the end of the value.
-      if (length == 11)
-      {
-        return true;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 10);
-        invalidReason.append(message);
-        return false;
-      }
-
-    case '+':
-    case '-':
-      // These are fine only if there are exactly four more digits that
-      // specify a valid offset.
-      if (length == 15)
-      {
-        return hasValidOffset(valueString, 11, invalidReason);
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(s1), 10);
-        invalidReason.append(message);
-        return false;
-      }
-
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(s1), 10);
-      invalidReason.append(message);
-      return false;
+    @Override
+    public String getSubstringMatchingRule() {
+        return SMR_CASE_IGNORE_OID;
     }
 
-    // The last element should be either a letter 'Z' (for the UTC
-    // specifier), or a plus or minus sign followed by four digits (for
-    // the UTC offset).
-    switch (valueString.charAt(12))
-    {
-    case 'Z':
-      // This is fine only if we are at the end of the value.
-      if (length == 13)
-      {
-        return true;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(valueString.charAt(12)), 12);
-        invalidReason.append(message);
+    public boolean isHumanReadable() {
         return false;
-      }
-
-    case '+':
-    case '-':
-      // These are fine only if there are four or two more digits that
-      // specify a valid offset.
-      if (length == 17 || length == 15)
-      {
-        return hasValidOffset(valueString, 13, invalidReason);
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-            .get(valueString, String.valueOf(valueString.charAt(12)), 12);
-        invalidReason.append(message);
-        return false;
-      }
-
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR
-          .get(valueString, String.valueOf(valueString.charAt(12)), 12);
-      invalidReason.append(message);
-      return false;
-    }
-  }
-
-
-
-  /**
-   * Indicates whether the provided string contains a valid set of two or four
-   * UTC offset digits. The provided string must have either two or four
-   * characters from the provided start position to the end of the value.
-   *
-   * @param value
-   *          The whole value, including the offset.
-   * @param startPos
-   *          The position of the first character that is contained in the
-   *          offset.
-   * @param invalidReason
-   *          The buffer to which the invalid reason may be appended if the
-   *          string does not contain a valid set of UTC offset digits.
-   * @return <CODE>true</CODE> if the provided offset string is valid, or
-   *         <CODE>false</CODE> if it is not.
-   */
-  private boolean hasValidOffset(final String value, final int startPos,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    final int offsetLength = value.length() - startPos;
-    if (offsetLength < 2)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_TOO_SHORT
-          .get(value);
-      invalidReason.append(message);
-      return false;
     }
 
-    // The first two characters must be an integer between 00 and 23.
-    switch (value.charAt(startPos))
-    {
-    case '0':
-    case '1':
-      switch (value.charAt(startPos + 1))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET
-            .get(value, value.substring(startPos, startPos + offsetLength));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    case '2':
-      switch (value.charAt(startPos + 1))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-        // These are all fine.
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET
-            .get(value, value.substring(startPos, startPos + offsetLength));
-        invalidReason.append(message);
-        return false;
-      }
-      break;
-    default:
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET
-          .get(value, value.substring(startPos, startPos + offsetLength));
-      invalidReason.append(message);
-      return false;
-    }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // Get the value as a string and verify that it is at least long
+        // enough for "YYYYMMDDhhmmZ", which is the shortest allowed value.
+        final String valueString = value.toString().toUpperCase();
+        final int length = valueString.length();
+        if (length < 11) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_TOO_SHORT.get(valueString);
+            invalidReason.append(message);
+            return false;
+        }
 
-    // If there are two more characters, then they must be an integer
-    // between 00 and 59.
-    if (offsetLength == 4)
-    {
-      switch (value.charAt(startPos + 2))
-      {
-      case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-        switch (value.charAt(startPos + 3))
-        {
+        // The first two characters are the year, and they must be numeric
+        // digits between 0 and 9.
+        for (int i = 0; i < 2; i++) {
+            switch (valueString.charAt(i)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_YEAR.get(valueString, String
+                                .valueOf(valueString.charAt(i)));
+                invalidReason.append(message);
+                return false;
+            }
+        }
+
+        // The next two characters are the month, and they must form the
+        // string representation of an integer between 01 and 12.
+        char m1 = valueString.charAt(2);
+        final char m2 = valueString.charAt(3);
+        switch (m1) {
+        case '0':
+            // m2 must be a digit between 1 and 9.
+            switch (m2) {
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH.get(valueString, valueString
+                                .substring(2, 4));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        case '1':
+            // m2 must be a digit between 0 and 2.
+            switch (m2) {
+            case '0':
+            case '1':
+            case '2':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH.get(valueString, valueString
+                                .substring(2, 4));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MONTH.get(valueString, valueString.substring(
+                            2, 4));
+            invalidReason.append(message);
+            return false;
+        }
+
+        // The next two characters should be the day of the month, and they
+        // must form the string representation of an integer between 01 and
+        // 31. This doesn't do any validation against the year or month, so
+        // it will allow dates like April 31, or February 29 in a non-leap
+        // year, but we'll let those slide.
+        final char d1 = valueString.charAt(4);
+        final char d2 = valueString.charAt(5);
+        switch (d1) {
+        case '0':
+            // d2 must be a digit between 1 and 9.
+            switch (d2) {
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(4, 6));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        case '1':
+            // Treated the same as '2'.
+        case '2':
+            // d2 must be a digit between 0 and 9.
+            switch (d2) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(4, 6));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        case '3':
+            // d2 must be either 0 or 1.
+            switch (d2) {
+            case '0':
+            case '1':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY.get(valueString, valueString
+                                .substring(4, 6));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_DAY.get(valueString, valueString.substring(4,
+                            6));
+            invalidReason.append(message);
+            return false;
+        }
+
+        // The next two characters must be the hour, and they must form the
+        // string representation of an integer between 00 and 23.
+        final char h1 = valueString.charAt(6);
+        final char h2 = valueString.charAt(7);
+        switch (h1) {
+        case '0':
+            // This is treated the same as '1'.
+        case '1':
+            switch (h2) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR.get(valueString, valueString
+                                .substring(6, 8));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        case '2':
+            // This must be a digit between 0 and 3.
+            switch (h2) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR.get(valueString, valueString
+                                .substring(6, 8));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_HOUR.get(valueString, valueString.substring(6,
+                            8));
+            invalidReason.append(message);
+            return false;
+        }
+
+        // Next, there should be two digits comprising an integer between 00
+        // and 59 for the minute.
+        m1 = valueString.charAt(8);
+        switch (m1) {
         case '0':
         case '1':
         case '2':
         case '3':
         case '4':
         case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-          // These are all fine.
-          break;
+            // There must be at least two more characters, and the next one
+            // must be a digit between 0 and 9.
+            if (length < 11) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(m1),
+                                8);
+                invalidReason.append(message);
+                return false;
+            }
+
+            switch (valueString.charAt(9)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_MINUTE.get(valueString, valueString
+                                .substring(8, 10));
+                invalidReason.append(message);
+                return false;
+            }
+
+            break;
+
         default:
-          final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET
-              .get(value, value.substring(startPos, startPos + offsetLength));
-          invalidReason.append(message);
-          return false;
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(m1), 8);
+            invalidReason.append(message);
+            return false;
         }
-        break;
-      default:
-        final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET
-            .get(value, value.substring(startPos, startPos + offsetLength));
-        invalidReason.append(message);
-        return false;
-      }
+
+        // Next, there should be either two digits comprising an integer
+        // between 00 and 60 (for the second, including a possible leap
+        // second), a letter 'Z' (for the UTC specifier), or a plus or minus
+        // sign followed by four digits (for the UTC offset).
+        final char s1 = valueString.charAt(10);
+        switch (s1) {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+            // There must be at least two more characters, and the next one
+            // must be a digit between 0 and 9.
+            if (length < 13) {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(s1),
+                                10);
+                invalidReason.append(message);
+                return false;
+            }
+
+            switch (valueString.charAt(11)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND.get(valueString, valueString
+                                .substring(10, 12));
+                invalidReason.append(message);
+                return false;
+            }
+
+            break;
+        case '6':
+            // There must be at least two more characters and the next one
+            // must be a 0.
+            if (length < 13) {
+
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(s1),
+                                10);
+                invalidReason.append(message);
+                return false;
+            }
+
+            if (valueString.charAt(11) != '0') {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_SECOND.get(valueString, valueString
+                                .substring(10, 12));
+                invalidReason.append(message);
+                return false;
+            }
+
+            break;
+        case 'Z':
+            // This is fine only if we are at the end of the value.
+            if (length == 11) {
+                return true;
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(s1),
+                                10);
+                invalidReason.append(message);
+                return false;
+            }
+
+        case '+':
+        case '-':
+            // These are fine only if there are exactly four more digits that
+            // specify a valid offset.
+            if (length == 15) {
+                return hasValidOffset(valueString, 11, invalidReason);
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(s1),
+                                10);
+                invalidReason.append(message);
+                return false;
+            }
+
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String.valueOf(s1), 10);
+            invalidReason.append(message);
+            return false;
+        }
+
+        // The last element should be either a letter 'Z' (for the UTC
+        // specifier), or a plus or minus sign followed by four digits (for
+        // the UTC offset).
+        switch (valueString.charAt(12)) {
+        case 'Z':
+            // This is fine only if we are at the end of the value.
+            if (length == 13) {
+                return true;
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(valueString.charAt(12)), 12);
+                invalidReason.append(message);
+                return false;
+            }
+
+        case '+':
+        case '-':
+            // These are fine only if there are four or two more digits that
+            // specify a valid offset.
+            if (length == 17 || length == 15) {
+                return hasValidOffset(valueString, 13, invalidReason);
+            } else {
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String
+                                .valueOf(valueString.charAt(12)), 12);
+                invalidReason.append(message);
+                return false;
+            }
+
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_CHAR.get(valueString, String
+                            .valueOf(valueString.charAt(12)), 12);
+            invalidReason.append(message);
+            return false;
+        }
     }
 
-    return true;
-  }
+    /**
+     * Indicates whether the provided string contains a valid set of two or four
+     * UTC offset digits. The provided string must have either two or four
+     * characters from the provided start position to the end of the value.
+     *
+     * @param value
+     *            The whole value, including the offset.
+     * @param startPos
+     *            The position of the first character that is contained in the
+     *            offset.
+     * @param invalidReason
+     *            The buffer to which the invalid reason may be appended if the
+     *            string does not contain a valid set of UTC offset digits.
+     * @return <CODE>true</CODE> if the provided offset string is valid, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    private boolean hasValidOffset(final String value, final int startPos,
+            final LocalizableMessageBuilder invalidReason) {
+        final int offsetLength = value.length() - startPos;
+        if (offsetLength < 2) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_UTC_TIME_TOO_SHORT.get(value);
+            invalidReason.append(message);
+            return false;
+        }
+
+        // The first two characters must be an integer between 00 and 23.
+        switch (value.charAt(startPos)) {
+        case '0':
+        case '1':
+            switch (value.charAt(startPos + 1)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET.get(value, value.substring(
+                                startPos, startPos + offsetLength));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        case '2':
+            switch (value.charAt(startPos + 1)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+                // These are all fine.
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET.get(value, value.substring(
+                                startPos, startPos + offsetLength));
+                invalidReason.append(message);
+                return false;
+            }
+            break;
+        default:
+            final LocalizableMessage message =
+                    ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET.get(value, value.substring(startPos,
+                            startPos + offsetLength));
+            invalidReason.append(message);
+            return false;
+        }
+
+        // If there are two more characters, then they must be an integer
+        // between 00 and 59.
+        if (offsetLength == 4) {
+            switch (value.charAt(startPos + 2)) {
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+                switch (value.charAt(startPos + 3)) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                    // These are all fine.
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET.get(value, value.substring(
+                                    startPos, startPos + offsetLength));
+                    invalidReason.append(message);
+                    return false;
+                }
+                break;
+            default:
+                final LocalizableMessage message =
+                        ERR_ATTR_SYNTAX_UTC_TIME_INVALID_OFFSET.get(value, value.substring(
+                                startPos, startPos + offsetLength));
+                invalidReason.append(message);
+                return false;
+            }
+        }
+
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java
index 5722d75..7b14206 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH;
@@ -37,94 +34,87 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the uuidMatch matching rule defined in RFC 4530. It will
  * be used as the default equality matching rule for the UUID syntax.
  */
-final class UUIDEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    if (value.length() != 36)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH
-          .get(value.toString(), value.length());
-      throw DecodeException.error(message);
-    }
-
-    final StringBuilder builder = new StringBuilder(36);
-    char c;
-    for (int i = 0; i < 36; i++)
-    {
-      // The 9th, 14th, 19th, and 24th characters must be dashes. All
-      // others must be hex. Convert all uppercase hex characters to
-      // lowercase.
-      c = (char) value.byteAt(i);
-      switch (i)
-      {
-      case 8:
-      case 13:
-      case 18:
-      case 23:
-        if (c != '-')
-        {
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH
-              .get(value.toString(), i, String.valueOf(c));
-          throw DecodeException.error(message);
+final class UUIDEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        if (value.length() != 36) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH.get(value.toString(), value.length());
+            throw DecodeException.error(message);
         }
-        builder.append(c);
-        break;
-      default:
-        switch (c)
-        {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-        case 'a':
-        case 'b':
-        case 'c':
-        case 'd':
-        case 'e':
-        case 'f':
-          // These are all fine.
-          builder.append(c);
-          break;
-        case 'A':
-          builder.append('a');
-          break;
-        case 'B':
-          builder.append('b');
-          break;
-        case 'C':
-          builder.append('c');
-          break;
-        case 'D':
-          builder.append('d');
-          break;
-        case 'E':
-          builder.append('e');
-          break;
-        case 'F':
-          builder.append('f');
-          break;
-        default:
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX
-              .get(value.toString(), i, String.valueOf(value.byteAt(i)));
-          throw DecodeException.error(message);
-        }
-      }
-    }
 
-    return ByteString.valueOf(builder.toString());
-  }
+        final StringBuilder builder = new StringBuilder(36);
+        char c;
+        for (int i = 0; i < 36; i++) {
+            // The 9th, 14th, 19th, and 24th characters must be dashes. All
+            // others must be hex. Convert all uppercase hex characters to
+            // lowercase.
+            c = (char) value.byteAt(i);
+            switch (i) {
+            case 8:
+            case 13:
+            case 18:
+            case 23:
+                if (c != '-') {
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH.get(value.toString(), i, String
+                                    .valueOf(c));
+                    throw DecodeException.error(message);
+                }
+                builder.append(c);
+                break;
+            default:
+                switch (c) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                    // These are all fine.
+                    builder.append(c);
+                    break;
+                case 'A':
+                    builder.append('a');
+                    break;
+                case 'B':
+                    builder.append('b');
+                    break;
+                case 'C':
+                    builder.append('c');
+                    break;
+                case 'D':
+                    builder.append('d');
+                    break;
+                case 'E':
+                    builder.append('e');
+                    break;
+                case 'F':
+                    builder.append('f');
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX.get(value.toString(), i, String
+                                    .valueOf(value.byteAt(i)));
+                    throw DecodeException.error(message);
+                }
+            }
+        }
+
+        return ByteString.valueOf(builder.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java
index 8865a7e..31d2526 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH;
@@ -37,95 +34,87 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines the uuidOrderingMatch matching rule defined in RFC 4530.
  * This will be the default ordering matching rule for the UUID syntax.
  */
-final class UUIDOrderingMatchingRuleImpl extends
-    AbstractOrderingMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    if (value.length() != 36)
-    {
-      final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH
-          .get(value.toString(), value.length());
-      throw DecodeException.error(message);
-    }
-
-    final StringBuilder builder = new StringBuilder(36);
-    char c;
-    for (int i = 0; i < 36; i++)
-    {
-      // The 9th, 14th, 19th, and 24th characters must be dashes. All
-      // others must be hex. Convert all uppercase hex characters to
-      // lowercase.
-      c = (char) value.byteAt(i);
-      switch (i)
-      {
-      case 8:
-      case 13:
-      case 18:
-      case 23:
-        if (c != '-')
-        {
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH
-              .get(value.toString(), i, String.valueOf(c));
-          throw DecodeException.error(message);
+final class UUIDOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        if (value.length() != 36) {
+            final LocalizableMessage message =
+                    WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH.get(value.toString(), value.length());
+            throw DecodeException.error(message);
         }
-        builder.append(c);
-        break;
-      default:
-        switch (c)
-        {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-        case 'a':
-        case 'b':
-        case 'c':
-        case 'd':
-        case 'e':
-        case 'f':
-          // These are all fine.
-          builder.append(c);
-          break;
-        case 'A':
-          builder.append('a');
-          break;
-        case 'B':
-          builder.append('b');
-          break;
-        case 'C':
-          builder.append('c');
-          break;
-        case 'D':
-          builder.append('d');
-          break;
-        case 'E':
-          builder.append('e');
-          break;
-        case 'F':
-          builder.append('f');
-          break;
-        default:
-          final LocalizableMessage message = WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX
-              .get(value.toString(), i, String.valueOf(value.byteAt(i)));
-          throw DecodeException.error(message);
-        }
-      }
-    }
 
-    return ByteString.valueOf(builder.toString());
-  }
+        final StringBuilder builder = new StringBuilder(36);
+        char c;
+        for (int i = 0; i < 36; i++) {
+            // The 9th, 14th, 19th, and 24th characters must be dashes. All
+            // others must be hex. Convert all uppercase hex characters to
+            // lowercase.
+            c = (char) value.byteAt(i);
+            switch (i) {
+            case 8:
+            case 13:
+            case 18:
+            case 23:
+                if (c != '-') {
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH.get(value.toString(), i, String
+                                    .valueOf(c));
+                    throw DecodeException.error(message);
+                }
+                builder.append(c);
+                break;
+            default:
+                switch (c) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                    // These are all fine.
+                    builder.append(c);
+                    break;
+                case 'A':
+                    builder.append('a');
+                    break;
+                case 'B':
+                    builder.append('b');
+                    break;
+                case 'C':
+                    builder.append('c');
+                    break;
+                case 'D':
+                    builder.append('d');
+                    break;
+                case 'E':
+                    builder.append('e');
+                    break;
+                case 'F':
+                    builder.append('f');
+                    break;
+                default:
+                    final LocalizableMessage message =
+                            WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX.get(value.toString(), i, String
+                                    .valueOf(value.byteAt(i)));
+                    throw DecodeException.error(message);
+                }
+            }
+        }
+
+        return ByteString.valueOf(builder.toString());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java
index 01b9619..02e14c8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX;
 import static org.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH;
@@ -37,114 +34,99 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteSequence;
 
-
-
 /**
  * This class implements the UUID syntax, which is defined in RFC 4530. Equality
  * and ordering matching will be allowed by default.
  */
-final class UUIDSyntaxImpl extends AbstractSyntaxImpl
-{
-  public String getName()
-  {
-    return SYNTAX_UUID_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in an attribute
-   * with this syntax. If it is not, then the reason may be appended to the
-   * provided buffer.
-   *
-   * @param schema
-   *          The schema in which this syntax is defined.
-   * @param value
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          The buffer to which the invalid reason should be appended.
-   * @return <CODE>true</CODE> if the provided value is acceptable for use with
-   *         this syntax, or <CODE>false</CODE> if not.
-   */
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We will only accept values that look like valid UUIDs. This means
-    // that all values must be in the form
-    // HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH, where "H" represents a
-    // hexadecimal digit. First, make sure that the value is exactly 36
-    // bytes long.
-    final String valueString = value.toString();
-    if (valueString.length() != 36)
-    {
-
-      invalidReason.append(WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH.get(
-          valueString, valueString.length()));
-      return false;
+final class UUIDSyntaxImpl extends AbstractSyntaxImpl {
+    public String getName() {
+        return SYNTAX_UUID_NAME;
     }
 
-    // Next, iterate through each character. Make sure that the 9th,
-    // 14th, 19th, and 24th characters are dashes and the rest are hex
-    // digits.
-    for (int i = 0; i < 36; i++)
-    {
-      switch (i)
-      {
-      case 8:
-      case 13:
-      case 18:
-      case 23:
-        if (valueString.charAt(i) != '-')
-        {
-
-          invalidReason.append(WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH.get(
-              valueString, i, String.valueOf(valueString.charAt(i))));
-          return false;
-        }
-        break;
-      default:
-        switch (valueString.charAt(i))
-        {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-        case 'a':
-        case 'b':
-        case 'c':
-        case 'd':
-        case 'e':
-        case 'f':
-        case 'A':
-        case 'B':
-        case 'C':
-        case 'D':
-        case 'E':
-        case 'F':
-          break;
-        default:
-
-          invalidReason.append(WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX.get(
-              valueString, i, String.valueOf(valueString.charAt(i))));
-          return false;
-        }
-      }
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    // If we've gotten here, then the value is acceptable.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in an
+     * attribute with this syntax. If it is not, then the reason may be appended
+     * to the provided buffer.
+     *
+     * @param schema
+     *            The schema in which this syntax is defined.
+     * @param value
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            The buffer to which the invalid reason should be appended.
+     * @return <CODE>true</CODE> if the provided value is acceptable for use
+     *         with this syntax, or <CODE>false</CODE> if not.
+     */
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We will only accept values that look like valid UUIDs. This means
+        // that all values must be in the form
+        // HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH, where "H" represents a
+        // hexadecimal digit. First, make sure that the value is exactly 36
+        // bytes long.
+        final String valueString = value.toString();
+        if (valueString.length() != 36) {
+
+            invalidReason.append(WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH.get(valueString, valueString
+                    .length()));
+            return false;
+        }
+
+        // Next, iterate through each character. Make sure that the 9th,
+        // 14th, 19th, and 24th characters are dashes and the rest are hex
+        // digits.
+        for (int i = 0; i < 36; i++) {
+            switch (i) {
+            case 8:
+            case 13:
+            case 18:
+            case 23:
+                if (valueString.charAt(i) != '-') {
+
+                    invalidReason.append(WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH.get(valueString, i,
+                            String.valueOf(valueString.charAt(i))));
+                    return false;
+                }
+                break;
+            default:
+                switch (valueString.charAt(i)) {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                case 'a':
+                case 'b':
+                case 'c':
+                case 'd':
+                case 'e':
+                case 'f':
+                case 'A':
+                case 'B':
+                case 'C':
+                case 'D':
+                case 'E':
+                case 'F':
+                    break;
+                default:
+
+                    invalidReason.append(WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX.get(valueString, i,
+                            String.valueOf(valueString.charAt(i))));
+                    return false;
+                }
+            }
+        }
+
+        // If we've gotten here, then the value is acceptable.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java
index 59dce71..85a255a 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,25 +25,17 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * This class implements the uniqueMemberMatch matching rule defined in X.520
  * and referenced in RFC 2252. It is based on the name and optional UID syntax,
  * and will compare values with a distinguished name and optional bit string
  * suffix.
  */
-final class UniqueMemberEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return value.toByteString();
-  }
+final class UniqueMemberEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return value.toByteString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java
index 3843435..fd9ee38 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,29 +26,22 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 
-
-
 /**
  * Thrown when a schema query fails because the requested schema element could
  * not be found or is ambiguous.
  */
 @SuppressWarnings("serial")
-public class UnknownSchemaElementException extends
-    LocalizedIllegalArgumentException
-{
-  /**
-   * Creates a new unknown schema element exception with the provided message.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   */
-  public UnknownSchemaElementException(final LocalizableMessage message)
-  {
-    super(message);
-  }
+public class UnknownSchemaElementException extends LocalizedIllegalArgumentException {
+    /**
+     * Creates a new unknown schema element exception with the provided message.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     */
+    public UnknownSchemaElementException(final LocalizableMessage message) {
+        super(message);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java
index aa54906..c41dea3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,53 +25,40 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class implements the userPasswordExactMatch matching rule, which will
  * simply compare encoded hashed password values to see if they are exactly
  * equal to each other.
  */
-final class UserPasswordExactEqualityMatchingRuleImpl extends
-    AbstractMatchingRuleImpl
-{
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value) throws DecodeException
-  {
-    // The normalized form of this matching rule is exactly equal to the
-    // non-normalized form, except that the scheme needs to be converted
-    // to lowercase (if there is one).
+final class UserPasswordExactEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        // The normalized form of this matching rule is exactly equal to the
+        // non-normalized form, except that the scheme needs to be converted
+        // to lowercase (if there is one).
 
-    if (UserPasswordSyntaxImpl.isEncoded(value))
-    {
-      final StringBuilder builder = new StringBuilder(value.length());
-      int closingBracePos = -1;
-      for (int i = 1; i < value.length(); i++)
-      {
-        if (value.byteAt(i) == '}')
-        {
-          closingBracePos = i;
-          break;
+        if (UserPasswordSyntaxImpl.isEncoded(value)) {
+            final StringBuilder builder = new StringBuilder(value.length());
+            int closingBracePos = -1;
+            for (int i = 1; i < value.length(); i++) {
+                if (value.byteAt(i) == '}') {
+                    closingBracePos = i;
+                    break;
+                }
+            }
+            final ByteSequence seq1 = value.subSequence(0, closingBracePos + 1);
+            final ByteSequence seq2 = value.subSequence(closingBracePos + 1, value.length());
+            StaticUtils.toLowerCase(seq1, builder);
+            builder.append(seq2);
+            return ByteString.valueOf(builder.toString());
+        } else {
+            return value.toByteString();
         }
-      }
-      final ByteSequence seq1 = value.subSequence(0, closingBracePos + 1);
-      final ByteSequence seq2 = value.subSequence(closingBracePos + 1, value
-          .length());
-      StaticUtils.toLowerCase(seq1, builder);
-      builder.append(seq2);
-      return ByteString.valueOf(builder.toString());
     }
-    else
-    {
-      return value.toByteString();
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java
index 4657822..f5d8f5c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_USERPW_NO_CLOSING_BRACE;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_USERPW_NO_OPENING_BRACE;
@@ -42,8 +39,6 @@
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * This class defines an attribute syntax used for storing values that have been
  * encoded using a password storage scheme. The format for attribute values with
@@ -56,145 +51,116 @@
  * <LI>The encoded value.</LI>
  * </UL>
  */
-final class UserPasswordSyntaxImpl extends AbstractSyntaxImpl
-{
-  /**
-   * Decodes the provided user password value into its component parts.
-   *
-   * @param userPasswordValue
-   *          The user password value to be decoded.
-   * @return A two-element string array whose elements are the storage scheme
-   *         name (in all lowercase characters) and the encoded value, in that
-   *         order.
-   * @throws DecodeException
-   *           If a problem is encountered while attempting to decode the value.
-   */
-  static String[] decodeUserPassword(final String userPasswordValue)
-      throws DecodeException
-  {
-    // Make sure that there actually is a value to decode.
-    if (userPasswordValue == null || userPasswordValue.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_VALUE.get();
-      throw DecodeException.error(message);
+final class UserPasswordSyntaxImpl extends AbstractSyntaxImpl {
+    /**
+     * Decodes the provided user password value into its component parts.
+     *
+     * @param userPasswordValue
+     *            The user password value to be decoded.
+     * @return A two-element string array whose elements are the storage scheme
+     *         name (in all lowercase characters) and the encoded value, in that
+     *         order.
+     * @throws DecodeException
+     *             If a problem is encountered while attempting to decode the
+     *             value.
+     */
+    static String[] decodeUserPassword(final String userPasswordValue) throws DecodeException {
+        // Make sure that there actually is a value to decode.
+        if (userPasswordValue == null || userPasswordValue.length() == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_VALUE.get();
+            throw DecodeException.error(message);
+        }
+
+        // The first character of an encoded value must be an opening curly
+        // brace.
+        if (userPasswordValue.charAt(0) != '{') {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_OPENING_BRACE.get();
+            throw DecodeException.error(message);
+        }
+
+        // There must be a corresponding closing brace.
+        final int closePos = userPasswordValue.indexOf('}');
+        if (closePos < 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_CLOSING_BRACE.get();
+            throw DecodeException.error(message);
+        }
+
+        // Get the storage scheme name and encoded value.
+        final String schemeName = userPasswordValue.substring(1, closePos);
+        final String encodedValue = userPasswordValue.substring(closePos + 1);
+
+        if (schemeName.length() == 0) {
+            final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_SCHEME.get();
+            throw DecodeException.error(message);
+        }
+
+        return new String[] { toLowerCase(schemeName), encodedValue };
     }
 
-    // The first character of an encoded value must be an opening curly
-    // brace.
-    if (userPasswordValue.charAt(0) != '{')
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_OPENING_BRACE
-          .get();
-      throw DecodeException.error(message);
+    /**
+     * Indicates whether the provided value is encoded using the user password
+     * syntax.
+     *
+     * @param value
+     *            The value for which to make the determination.
+     * @return <CODE>true</CODE> if the value appears to be encoded using the
+     *         user password syntax, or <CODE>false</CODE> if not.
+     */
+    static boolean isEncoded(final ByteSequence value) {
+        // If the value is null or empty, then it's not.
+        if (value == null || value.length() == 0) {
+            return false;
+        }
+
+        // If the value doesn't start with an opening curly brace, then it's
+        // not.
+        if (value.byteAt(0) != '{') {
+            return false;
+        }
+
+        // There must be a corresponding closing curly brace, and there must
+        // be at least one character inside the brace.
+        int closingBracePos = -1;
+        for (int i = 1; i < value.length(); i++) {
+            if (value.byteAt(i) == '}') {
+                closingBracePos = i;
+                break;
+            }
+        }
+
+        if (closingBracePos < 0 || closingBracePos == 1) {
+            return false;
+        }
+
+        // The closing curly brace must not be the last character of the
+        // password.
+        if (closingBracePos == value.length() - 1) {
+            return false;
+        }
+
+        // If we've gotten here, then it looks to be encoded.
+        return true;
     }
 
-    // There must be a corresponding closing brace.
-    final int closePos = userPasswordValue.indexOf('}');
-    if (closePos < 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_CLOSING_BRACE
-          .get();
-      throw DecodeException.error(message);
+    @Override
+    public String getEqualityMatchingRule() {
+        return EMR_USER_PASSWORD_EXACT_OID;
     }
 
-    // Get the storage scheme name and encoded value.
-    final String schemeName = userPasswordValue.substring(1, closePos);
-    final String encodedValue = userPasswordValue.substring(closePos + 1);
-
-    if (schemeName.length() == 0)
-    {
-      final LocalizableMessage message = ERR_ATTR_SYNTAX_USERPW_NO_SCHEME.get();
-      throw DecodeException.error(message);
+    public String getName() {
+        return SYNTAX_USER_PASSWORD_NAME;
     }
 
-    return new String[] { toLowerCase(schemeName), encodedValue };
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is encoded using the user password
-   * syntax.
-   *
-   * @param value
-   *          The value for which to make the determination.
-   * @return <CODE>true</CODE> if the value appears to be encoded using the user
-   *         password syntax, or <CODE>false</CODE> if not.
-   */
-  static boolean isEncoded(final ByteSequence value)
-  {
-    // If the value is null or empty, then it's not.
-    if (value == null || value.length() == 0)
-    {
-      return false;
+    public boolean isHumanReadable() {
+        return true;
     }
 
-    // If the value doesn't start with an opening curly brace, then it's
-    // not.
-    if (value.byteAt(0) != '{')
-    {
-      return false;
+    public boolean valueIsAcceptable(final Schema schema, final ByteSequence value,
+            final LocalizableMessageBuilder invalidReason) {
+        // We have to accept any value here because in many cases the value
+        // will not have been encoded by the time this method is called.
+        // TODO: Is this correct for client-side use?
+        return true;
     }
 
-    // There must be a corresponding closing curly brace, and there must
-    // be at least one character inside the brace.
-    int closingBracePos = -1;
-    for (int i = 1; i < value.length(); i++)
-    {
-      if (value.byteAt(i) == '}')
-      {
-        closingBracePos = i;
-        break;
-      }
-    }
-
-    if (closingBracePos < 0 || closingBracePos == 1)
-    {
-      return false;
-    }
-
-    // The closing curly brace must not be the last character of the
-    // password.
-    if (closingBracePos == value.length() - 1)
-    {
-      return false;
-    }
-
-    // If we've gotten here, then it looks to be encoded.
-    return true;
-  }
-
-
-
-  @Override
-  public String getEqualityMatchingRule()
-  {
-    return EMR_USER_PASSWORD_EXACT_OID;
-  }
-
-
-
-  public String getName()
-  {
-    return SYNTAX_USER_PASSWORD_NAME;
-  }
-
-
-
-  public boolean isHumanReadable()
-  {
-    return true;
-  }
-
-
-
-  public boolean valueIsAcceptable(final Schema schema,
-      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
-  {
-    // We have to accept any value here because in many cases the value
-    // will not have been encoded by the time this method is called.
-    // TODO: Is this correct for client-side use?
-    return true;
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleImpl.java
index efcf01e..99144ae 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleImpl.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,15 +25,15 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD;
 import static com.forgerock.opendj.util.StringPrepProfile.TRIM;
 import static com.forgerock.opendj.util.StringPrepProfile.prepareUnicode;
 
-import org.forgerock.opendj.ldap.*;
-
-
+import org.forgerock.opendj.ldap.Assertion;
+import org.forgerock.opendj.ldap.ByteSequence;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DecodeException;
 
 /**
  * This class implements the wordMatch matching rule defined in X.520. That
@@ -55,125 +54,102 @@
  * <LI>An equal sign</LI>
  * </UL>
  */
-final class WordEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl
-{
-  @Override
-  public Assertion getAssertion(final Schema schema, final ByteSequence value)
-      throws DecodeException
-  {
-    final String normalStr = normalize(value);
+final class WordEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl {
+    @Override
+    public Assertion getAssertion(final Schema schema, final ByteSequence value)
+            throws DecodeException {
+        final String normalStr = normalize(value);
 
-    return new Assertion()
-    {
-      public ConditionResult matches(final ByteSequence attributeValue)
-      {
-        // See if the assertion value is contained in the attribute
-        // value. If not, then it isn't a match.
-        final String valueStr1 = attributeValue.toString();
+        return new Assertion() {
+            public ConditionResult matches(final ByteSequence attributeValue) {
+                // See if the assertion value is contained in the attribute
+                // value. If not, then it isn't a match.
+                final String valueStr1 = attributeValue.toString();
 
-        final int pos = valueStr1.indexOf(normalStr);
-        if (pos < 0)
-        {
-          return ConditionResult.FALSE;
-        }
+                final int pos = valueStr1.indexOf(normalStr);
+                if (pos < 0) {
+                    return ConditionResult.FALSE;
+                }
 
-        if (pos > 0)
-        {
-          final char c = valueStr1.charAt(pos - 1);
-          switch (c)
-          {
-          case ' ':
-          case '.':
-          case ',':
-          case '/':
-          case '$':
-          case '+':
-          case '-':
-          case '_':
-          case '#':
-          case '=':
-            // These are all acceptable.
-            break;
+                if (pos > 0) {
+                    final char c = valueStr1.charAt(pos - 1);
+                    switch (c) {
+                    case ' ':
+                    case '.':
+                    case ',':
+                    case '/':
+                    case '$':
+                    case '+':
+                    case '-':
+                    case '_':
+                    case '#':
+                    case '=':
+                        // These are all acceptable.
+                        break;
 
-          default:
-            // Anything else is not.
-            return ConditionResult.FALSE;
-          }
-        }
+                    default:
+                        // Anything else is not.
+                        return ConditionResult.FALSE;
+                    }
+                }
 
-        if (valueStr1.length() > pos + normalStr.length())
-        {
-          final char c = valueStr1.charAt(pos + normalStr.length());
-          switch (c)
-          {
-          case ' ':
-          case '.':
-          case ',':
-          case '/':
-          case '$':
-          case '+':
-          case '-':
-          case '_':
-          case '#':
-          case '=':
-            // These are all acceptable.
-            break;
+                if (valueStr1.length() > pos + normalStr.length()) {
+                    final char c = valueStr1.charAt(pos + normalStr.length());
+                    switch (c) {
+                    case ' ':
+                    case '.':
+                    case ',':
+                    case '/':
+                    case '$':
+                    case '+':
+                    case '-':
+                    case '_':
+                    case '#':
+                    case '=':
+                        // These are all acceptable.
+                        break;
 
-          default:
-            // Anything else is not.
-            return ConditionResult.FALSE;
-          }
-        }
+                    default:
+                        // Anything else is not.
+                        return ConditionResult.FALSE;
+                    }
+                }
 
-        // If we've gotten here, then we can assume it is a match.
-        return ConditionResult.TRUE;
-      }
-    };
-  }
-
-
-
-  public ByteString normalizeAttributeValue(final Schema schema,
-      final ByteSequence value)
-  {
-    return ByteString.valueOf(normalize(value));
-  }
-
-
-
-  private String normalize(final ByteSequence value)
-  {
-    final StringBuilder buffer = new StringBuilder();
-    prepareUnicode(buffer, value, TRIM, CASE_FOLD);
-
-    final int bufferLength = buffer.length();
-    if (bufferLength == 0)
-    {
-      if (value.length() > 0)
-      {
-        // This should only happen if the value is composed entirely of
-        // spaces. In that case, the normalized value is a single space.
-        return " ".intern();
-      }
-      else
-      {
-        // The value is empty, so it is already normalized.
-        return "".intern();
-      }
+                // If we've gotten here, then we can assume it is a match.
+                return ConditionResult.TRUE;
+            }
+        };
     }
 
-    // Replace any consecutive spaces with a single space.
-    for (int pos = bufferLength - 1; pos > 0; pos--)
-    {
-      if (buffer.charAt(pos) == ' ')
-      {
-        if (buffer.charAt(pos - 1) == ' ')
-        {
-          buffer.delete(pos, pos + 1);
-        }
-      }
+    public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) {
+        return ByteString.valueOf(normalize(value));
     }
 
-    return buffer.toString();
-  }
+    private String normalize(final ByteSequence value) {
+        final StringBuilder buffer = new StringBuilder();
+        prepareUnicode(buffer, value, TRIM, CASE_FOLD);
+
+        final int bufferLength = buffer.length();
+        if (bufferLength == 0) {
+            if (value.length() > 0) {
+                // This should only happen if the value is composed entirely of
+                // spaces. In that case, the normalized value is a single space.
+                return " ".intern();
+            } else {
+                // The value is empty, so it is already normalized.
+                return "".intern();
+            }
+        }
+
+        // Replace any consecutive spaces with a single space.
+        for (int pos = bufferLength - 1; pos > 0; pos--) {
+            if (buffer.charAt(pos) == ' ') {
+                if (buffer.charAt(pos - 1) == ' ') {
+                    buffer.delete(pos, pos + 1);
+                }
+            }
+        }
+
+        return buffer.toString();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java
index 70780cd..9c42343 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java
index 36e2270..27c4178 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
@@ -45,7 +42,14 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedAttribute;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy;
 import org.forgerock.opendj.ldap.schema.Syntax;
@@ -54,893 +58,668 @@
 import com.forgerock.opendj.util.Base64;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Common LDIF reader functionality.
  */
-abstract class AbstractLDIFReader extends AbstractLDIFStream
-{
-  static final class KeyValuePair
-  {
-    String key;
+abstract class AbstractLDIFReader extends AbstractLDIFStream {
+    static final class KeyValuePair {
+        String key;
 
-    String value;
-  }
-
-
-
-  /**
-   * LDIF reader implementation interface.
-   */
-  interface LDIFReaderImpl
-  {
-
-    /**
-     * Closes any resources associated with this LDIF reader implementation.
-     *
-     * @throws IOException
-     *           If an error occurs while closing.
-     */
-    void close() throws IOException;
-
-
-
-    /**
-     * Reads the next line of LDIF from the underlying LDIF source.
-     * Implementations must remove trailing line delimiters.
-     *
-     * @return The next line of LDIF, or {@code null} if the end of the LDIF
-     *         source has been reached.
-     * @throws IOException
-     *           If an error occurs while reading from the LDIF source.
-     */
-    String readLine() throws IOException;
-  }
-
-
-
-  static final class LDIFRecord
-  {
-    final Iterator<String> iterator;
-
-    final LinkedList<String> ldifLines;
-
-    final long lineNumber;
-
-
-
-    private LDIFRecord(final long lineNumber, final LinkedList<String> ldifLines)
-    {
-      this.lineNumber = lineNumber;
-      this.ldifLines = ldifLines;
-      this.iterator = ldifLines.iterator();
+        String value;
     }
-  }
-
-
-
-  /**
-   * LDIF output stream writer implementation.
-   */
-  private static final class LDIFReaderInputStreamImpl implements
-      LDIFReaderImpl
-  {
-
-    private BufferedReader reader;
-
-
 
     /**
-     * Creates a new LDIF input stream reader implementation.
+     * LDIF reader implementation interface.
+     */
+    interface LDIFReaderImpl {
+
+        /**
+         * Closes any resources associated with this LDIF reader implementation.
+         *
+         * @throws IOException
+         *             If an error occurs while closing.
+         */
+        void close() throws IOException;
+
+        /**
+         * Reads the next line of LDIF from the underlying LDIF source.
+         * Implementations must remove trailing line delimiters.
+         *
+         * @return The next line of LDIF, or {@code null} if the end of the LDIF
+         *         source has been reached.
+         * @throws IOException
+         *             If an error occurs while reading from the LDIF source.
+         */
+        String readLine() throws IOException;
+    }
+
+    static final class LDIFRecord {
+        final Iterator<String> iterator;
+
+        final LinkedList<String> ldifLines;
+
+        final long lineNumber;
+
+        private LDIFRecord(final long lineNumber, final LinkedList<String> ldifLines) {
+            this.lineNumber = lineNumber;
+            this.ldifLines = ldifLines;
+            this.iterator = ldifLines.iterator();
+        }
+    }
+
+    /**
+     * LDIF output stream writer implementation.
+     */
+    private static final class LDIFReaderInputStreamImpl implements LDIFReaderImpl {
+
+        private BufferedReader reader;
+
+        /**
+         * Creates a new LDIF input stream reader implementation.
+         *
+         * @param in
+         *            The input stream to use.
+         */
+        LDIFReaderInputStreamImpl(final InputStream in) {
+            this.reader = new BufferedReader(new InputStreamReader(in));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() throws IOException {
+            if (reader != null) {
+                reader.close();
+                reader = null;
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String readLine() throws IOException {
+            String line = null;
+            if (reader != null) {
+                line = reader.readLine();
+                if (line == null) {
+                    // Automatically close.
+                    close();
+                }
+            }
+            return line;
+        }
+    }
+
+    /**
+     * LDIF output stream writer implementation.
+     */
+    private static final class LDIFReaderListImpl implements LDIFReaderImpl {
+
+        private final Iterator<String> iterator;
+
+        /**
+         * Creates a new LDIF list reader.
+         *
+         * @param ldifLines
+         *            The string list.
+         */
+        LDIFReaderListImpl(final List<String> ldifLines) {
+            this.iterator = ldifLines.iterator();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() throws IOException {
+            // Nothing to do.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String readLine() throws IOException {
+            if (iterator.hasNext()) {
+                return iterator.next();
+            } else {
+                return null;
+            }
+        }
+    }
+
+    RejectedLDIFListener rejectedRecordListener = RejectedLDIFListener.FAIL_FAST;
+
+    Schema schema = Schema.getDefaultSchema().asNonStrictSchema();
+
+    SchemaValidationPolicy schemaValidationPolicy = SchemaValidationPolicy.ignoreAll();
+
+    private final LDIFReaderImpl impl;
+
+    private long lineNumber = 0;
+
+    /**
+     * Creates a new LDIF entry reader whose source is the provided input
+     * stream.
      *
      * @param in
-     *          The input stream to use.
+     *            The input stream to use.
      */
-    LDIFReaderInputStreamImpl(final InputStream in)
-    {
-      this.reader = new BufferedReader(new InputStreamReader(in));
+    AbstractLDIFReader(final InputStream in) {
+        Validator.ensureNotNull(in);
+        this.impl = new LDIFReaderInputStreamImpl(in);
     }
 
-
-
     /**
-     * {@inheritDoc}
-     */
-    public void close() throws IOException
-    {
-      if (reader != null)
-      {
-        reader.close();
-        reader = null;
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String readLine() throws IOException
-    {
-      String line = null;
-      if (reader != null)
-      {
-        line = reader.readLine();
-        if (line == null)
-        {
-          // Automatically close.
-          close();
-        }
-      }
-      return line;
-    }
-  }
-
-
-
-  /**
-   * LDIF output stream writer implementation.
-   */
-  private static final class LDIFReaderListImpl implements LDIFReaderImpl
-  {
-
-    private final Iterator<String> iterator;
-
-
-
-    /**
-     * Creates a new LDIF list reader.
+     * Creates a new LDIF entry reader which will read lines of LDIF from the
+     * provided list.
      *
      * @param ldifLines
-     *          The string list.
+     *            The list from which lines of LDIF should be read.
      */
-    LDIFReaderListImpl(final List<String> ldifLines)
-    {
-      this.iterator = ldifLines.iterator();
+    AbstractLDIFReader(final List<String> ldifLines) {
+        Validator.ensureNotNull(ldifLines);
+        this.impl = new LDIFReaderListImpl(ldifLines);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close() throws IOException
-    {
-      // Nothing to do.
+    final void close0() throws IOException {
+        impl.close();
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String readLine() throws IOException
-    {
-      if (iterator.hasNext())
-      {
-        return iterator.next();
-      }
-      else
-      {
-        return null;
-      }
+    final int parseColonPosition(final LDIFRecord record, final String ldifLine)
+            throws DecodeException {
+        final int colonPos = ldifLine.indexOf(":");
+        if (colonPos <= 0) {
+            final LocalizableMessage message =
+                    ERR_LDIF_NO_ATTR_NAME.get(record.lineNumber, ldifLine);
+            throw DecodeException.error(message);
+        }
+        return colonPos;
     }
-  }
 
+    final ByteString parseSingleValue(final LDIFRecord record, final String ldifLine,
+            final DN entryDN, final int colonPos, final String attrName) throws DecodeException {
 
+        // Look at the character immediately after the colon. If there is
+        // none, then assume an attribute with an empty value. If it is
+        // another colon, then the value must be base64-encoded. If it is a
+        // less-than sign, then assume that it is a URL. Otherwise, it is a
+        // regular value.
+        final int length = ldifLine.length();
+        ByteString value;
+        if (colonPos == length - 1) {
+            value = ByteString.empty();
+        } else {
+            final char c = ldifLine.charAt(colonPos + 1);
+            if (c == ':') {
+                // The value is base64-encoded. Find the first non-blank
+                // character, take the rest of the line, and base64-decode it.
+                int pos = colonPos + 2;
+                while (pos < length && ldifLine.charAt(pos) == ' ') {
+                    pos++;
+                }
 
-  RejectedLDIFListener rejectedRecordListener = RejectedLDIFListener.FAIL_FAST;
+                try {
+                    value = Base64.decode(ldifLine.substring(pos));
+                } catch (final LocalizedIllegalArgumentException e) {
+                    // The value did not have a valid base64-encoding.
+                    final LocalizableMessage message =
+                            ERR_LDIF_COULD_NOT_BASE64_DECODE_ATTR.get(entryDN.toString(),
+                                    record.lineNumber, ldifLine, e.getMessageObject());
+                    throw DecodeException.error(message);
+                }
+            } else if (c == '<') {
+                // Find the first non-blank character, decode the rest of the
+                // line as a URL, and read its contents.
+                int pos = colonPos + 2;
+                while (pos < length && ldifLine.charAt(pos) == ' ') {
+                    pos++;
+                }
 
-  Schema schema = Schema.getDefaultSchema().asNonStrictSchema();
+                URL contentURL;
+                try {
+                    contentURL = new URL(ldifLine.substring(pos));
+                } catch (final Exception e) {
+                    // The URL was malformed or had an invalid protocol.
+                    final LocalizableMessage message =
+                            ERR_LDIF_INVALID_URL.get(entryDN.toString(), record.lineNumber,
+                                    attrName, String.valueOf(e));
+                    throw DecodeException.error(message);
+                }
 
-  SchemaValidationPolicy schemaValidationPolicy = SchemaValidationPolicy.ignoreAll();
+                InputStream inputStream = null;
+                ByteStringBuilder builder = null;
+                try {
+                    builder = new ByteStringBuilder();
+                    inputStream = contentURL.openConnection().getInputStream();
 
-  private final LDIFReaderImpl impl;
+                    int bytesRead;
+                    final byte[] buffer = new byte[4096];
+                    while ((bytesRead = inputStream.read(buffer)) > 0) {
+                        builder.append(buffer, 0, bytesRead);
+                    }
 
-  private long lineNumber = 0;
+                    value = builder.toByteString();
+                } catch (final Exception e) {
+                    // We were unable to read the contents of that URL for some
+                    // reason.
+                    final LocalizableMessage message =
+                            ERR_LDIF_URL_IO_ERROR.get(entryDN.toString(), record.lineNumber,
+                                    attrName, String.valueOf(contentURL), String.valueOf(e));
+                    throw DecodeException.error(message);
+                } finally {
+                    if (inputStream != null) {
+                        try {
+                            inputStream.close();
+                        } catch (final Exception e) {
+                            // Ignore.
+                        }
+                    }
+                }
+            } else {
+                // The rest of the line should be the value. Skip over any
+                // spaces and take the rest of the line as the value.
+                int pos = colonPos + 1;
+                while (pos < length && ldifLine.charAt(pos) == ' ') {
+                    pos++;
+                }
 
-
-
-  /**
-   * Creates a new LDIF entry reader whose source is the provided input stream.
-   *
-   * @param in
-   *          The input stream to use.
-   */
-  AbstractLDIFReader(final InputStream in)
-  {
-    Validator.ensureNotNull(in);
-    this.impl = new LDIFReaderInputStreamImpl(in);
-  }
-
-
-
-  /**
-   * Creates a new LDIF entry reader which will read lines of LDIF from the
-   * provided list.
-   *
-   * @param ldifLines
-   *          The list from which lines of LDIF should be read.
-   */
-  AbstractLDIFReader(final List<String> ldifLines)
-  {
-    Validator.ensureNotNull(ldifLines);
-    this.impl = new LDIFReaderListImpl(ldifLines);
-  }
-
-
-
-  final void close0() throws IOException
-  {
-    impl.close();
-  }
-
-
-
-  final int parseColonPosition(final LDIFRecord record, final String ldifLine)
-      throws DecodeException
-  {
-    final int colonPos = ldifLine.indexOf(":");
-    if (colonPos <= 0)
-    {
-      final LocalizableMessage message = ERR_LDIF_NO_ATTR_NAME.get(
-          record.lineNumber, ldifLine);
-      throw DecodeException.error(message);
-    }
-    return colonPos;
-  }
-
-
-
-  final ByteString parseSingleValue(final LDIFRecord record,
-      final String ldifLine, final DN entryDN, final int colonPos,
-      final String attrName) throws DecodeException
-  {
-
-    // Look at the character immediately after the colon. If there is
-    // none, then assume an attribute with an empty value. If it is
-    // another colon, then the value must be base64-encoded. If it is a
-    // less-than sign, then assume that it is a URL. Otherwise, it is a
-    // regular value.
-    final int length = ldifLine.length();
-    ByteString value;
-    if (colonPos == length - 1)
-    {
-      value = ByteString.empty();
-    }
-    else
-    {
-      final char c = ldifLine.charAt(colonPos + 1);
-      if (c == ':')
-      {
-        // The value is base64-encoded. Find the first non-blank
-        // character, take the rest of the line, and base64-decode it.
-        int pos = colonPos + 2;
-        while (pos < length && ldifLine.charAt(pos) == ' ')
-        {
-          pos++;
-        }
-
-        try
-        {
-          value = Base64.decode(ldifLine.substring(pos));
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          // The value did not have a valid base64-encoding.
-          final LocalizableMessage message = ERR_LDIF_COULD_NOT_BASE64_DECODE_ATTR
-              .get(entryDN.toString(), record.lineNumber, ldifLine,
-                  e.getMessageObject());
-          throw DecodeException.error(message);
-        }
-      }
-      else if (c == '<')
-      {
-        // Find the first non-blank character, decode the rest of the
-        // line as a URL, and read its contents.
-        int pos = colonPos + 2;
-        while (pos < length && ldifLine.charAt(pos) == ' ')
-        {
-          pos++;
-        }
-
-        URL contentURL;
-        try
-        {
-          contentURL = new URL(ldifLine.substring(pos));
-        }
-        catch (final Exception e)
-        {
-          // The URL was malformed or had an invalid protocol.
-          final LocalizableMessage message = ERR_LDIF_INVALID_URL.get(
-              entryDN.toString(), record.lineNumber, attrName,
-              String.valueOf(e));
-          throw DecodeException.error(message);
-        }
-
-        InputStream inputStream = null;
-        ByteStringBuilder builder = null;
-        try
-        {
-          builder = new ByteStringBuilder();
-          inputStream = contentURL.openConnection().getInputStream();
-
-          int bytesRead;
-          final byte[] buffer = new byte[4096];
-          while ((bytesRead = inputStream.read(buffer)) > 0)
-          {
-            builder.append(buffer, 0, bytesRead);
-          }
-
-          value = builder.toByteString();
-        }
-        catch (final Exception e)
-        {
-          // We were unable to read the contents of that URL for some
-          // reason.
-          final LocalizableMessage message = ERR_LDIF_URL_IO_ERROR.get(
-              entryDN.toString(), record.lineNumber, attrName,
-              String.valueOf(contentURL), String.valueOf(e));
-          throw DecodeException.error(message);
-        }
-        finally
-        {
-          if (inputStream != null)
-          {
-            try
-            {
-              inputStream.close();
+                value = ByteString.valueOf(ldifLine.substring(pos));
             }
-            catch (final Exception e)
-            {
-              // Ignore.
+        }
+        return value;
+    }
+
+    final LDIFRecord readLDIFRecord() throws IOException {
+        // Read the entry lines into a buffer.
+        final StringBuilder lastLineBuilder = new StringBuilder();
+        final LinkedList<String> ldifLines = new LinkedList<String>();
+        long recordLineNumber = 0;
+
+        final int stateStart = 0;
+        final int stateStartCommentLine = 1;
+        final int stateGotLDIFLine = 2;
+        final int stateGotCommentLine = 3;
+        final int appendingLDIFLine = 4;
+
+        int state = stateStart;
+
+        while (true) {
+            final String line = readLine();
+
+            switch (state) {
+            case stateStart:
+                if (line == null) {
+                    // We have reached the end of the LDIF source.
+                    return null;
+                } else if (line.length() == 0) {
+                    // Skip leading blank lines.
+                } else if (line.charAt(0) == '#') {
+                    // This is a comment at the start of the LDIF record.
+                    state = stateStartCommentLine;
+                } else if (isContinuationLine(line)) {
+                    // Fatal: got a continuation line at the start of the
+                    // record.
+                    final LocalizableMessage message =
+                            ERR_LDIF_INVALID_LEADING_SPACE.get(lineNumber, line);
+                    throw DecodeException.fatalError(message);
+                } else {
+                    // Got the first line of LDIF.
+                    ldifLines.add(line);
+                    recordLineNumber = lineNumber;
+                    state = stateGotLDIFLine;
+                }
+                break;
+            case stateStartCommentLine:
+                if (line == null) {
+                    // We have reached the end of the LDIF source.
+                    return null;
+                } else if (line.length() == 0) {
+                    // Skip leading blank lines and comments.
+                    state = stateStart;
+                } else if (line.charAt(0) == '#') {
+                    // This is another comment at the start of the LDIF record.
+                } else if (isContinuationLine(line)) {
+                    // Skip comment continuation lines.
+                } else {
+                    // Got the first line of LDIF.
+                    ldifLines.add(line);
+                    recordLineNumber = lineNumber;
+                    state = stateGotLDIFLine;
+                }
+                break;
+            case stateGotLDIFLine:
+                if (line == null) {
+                    // We have reached the end of the LDIF source.
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.length() == 0) {
+                    // We have reached the end of the LDIF record.
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.charAt(0) == '#') {
+                    // This is a comment.
+                    state = stateGotCommentLine;
+                } else if (isContinuationLine(line)) {
+                    // Got a continuation line for the previous line.
+                    lastLineBuilder.setLength(0);
+                    lastLineBuilder.append(ldifLines.removeLast());
+                    lastLineBuilder.append(line.substring(1));
+                    state = appendingLDIFLine;
+                } else {
+                    // Got the next line of LDIF.
+                    ldifLines.add(line);
+                    state = stateGotLDIFLine;
+                }
+                break;
+            case stateGotCommentLine:
+                if (line == null) {
+                    // We have reached the end of the LDIF source.
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.length() == 0) {
+                    // We have reached the end of the LDIF record.
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.charAt(0) == '#') {
+                    // This is another comment.
+                    state = stateGotCommentLine;
+                } else if (isContinuationLine(line)) {
+                    // Skip comment continuation lines.
+                } else {
+                    // Got the next line of LDIF.
+                    ldifLines.add(line);
+                    state = stateGotLDIFLine;
+                }
+                break;
+            case appendingLDIFLine:
+                if (line == null) {
+                    // We have reached the end of the LDIF source.
+                    ldifLines.add(lastLineBuilder.toString());
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.length() == 0) {
+                    // We have reached the end of the LDIF record.
+                    ldifLines.add(lastLineBuilder.toString());
+                    return new LDIFRecord(recordLineNumber, ldifLines);
+                } else if (line.charAt(0) == '#') {
+                    // This is a comment.
+                    ldifLines.add(lastLineBuilder.toString());
+                    state = stateGotCommentLine;
+                } else if (isContinuationLine(line)) {
+                    // Got another continuation line for the previous line.
+                    lastLineBuilder.append(line.substring(1));
+                } else {
+                    // Got the next line of LDIF.
+                    ldifLines.add(lastLineBuilder.toString());
+                    ldifLines.add(line);
+                    state = stateGotLDIFLine;
+                }
+                break;
             }
-          }
         }
-      }
-      else
-      {
-        // The rest of the line should be the value. Skip over any
-        // spaces and take the rest of the line as the value.
-        int pos = colonPos + 1;
-        while (pos < length && ldifLine.charAt(pos) == ' ')
-        {
-          pos++;
-        }
-
-        value = ByteString.valueOf(ldifLine.substring(pos));
-      }
     }
-    return value;
-  }
 
+    final boolean readLDIFRecordAttributeValue(final LDIFRecord record, final String ldifLine,
+            final Entry entry, final List<LocalizableMessage> schemaErrors) throws DecodeException {
+        // Parse the attribute description.
+        final int colonPos = parseColonPosition(record, ldifLine);
+        final String attrDescr = ldifLine.substring(0, colonPos);
 
+        AttributeDescription attributeDescription;
+        try {
+            attributeDescription = AttributeDescription.valueOf(attrDescr, schema);
+        } catch (final UnknownSchemaElementException e) {
+            final LocalizableMessage message =
+                    ERR_LDIF_UNKNOWN_ATTRIBUTE_TYPE.get(record.lineNumber, entry.getName()
+                            .toString(), attrDescr);
+            switch (schemaValidationPolicy.checkAttributesAndObjectClasses()) {
+            case REJECT:
+                schemaErrors.add(message);
+                return false;
+            case WARN:
+                schemaErrors.add(message);
+                return true;
+            default: // Ignore
+                // This should not happen: we should be using a non-strict
+                // schema for
+                // this policy.
+                throw new IllegalStateException("Schema is not consistent with policy", e);
+            }
+        } catch (final LocalizedIllegalArgumentException e) {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_ATTRIBUTE_NAME.get(record.lineNumber, entry.getName()
+                            .toString(), attrDescr);
+            throw DecodeException.error(message);
+        }
 
-  final LDIFRecord readLDIFRecord() throws IOException
-  {
-    // Read the entry lines into a buffer.
-    final StringBuilder lastLineBuilder = new StringBuilder();
-    final LinkedList<String> ldifLines = new LinkedList<String>();
-    long recordLineNumber = 0;
+        // Now parse the attribute value.
+        final ByteString value =
+                parseSingleValue(record, ldifLine, entry.getName(), colonPos, attrDescr);
 
-    final int stateStart = 0;
-    final int stateStartCommentLine = 1;
-    final int stateGotLDIFLine = 2;
-    final int stateGotCommentLine = 3;
-    final int appendingLDIFLine = 4;
+        // Skip the attribute if requested before performing any schema
+        // checking: the attribute may have been excluded because it is
+        // known to violate the schema.
+        if (isAttributeExcluded(attributeDescription)) {
+            return true;
+        }
 
-    int state = stateStart;
+        final Syntax syntax = attributeDescription.getAttributeType().getSyntax();
 
-    while (true)
-    {
-      final String line = readLine();
+        // Ensure that the binary option is present if required.
+        if (!syntax.isBEREncodingRequired()) {
+            if (schemaValidationPolicy.checkAttributeValues().needsChecking()
+                    && attributeDescription.containsOption("binary")) {
+                final LocalizableMessage message =
+                        ERR_LDIF_UNEXPECTED_BINARY_OPTION.get(record.lineNumber, entry.getName()
+                                .toString(), attrDescr);
+                schemaErrors.add(message);
+                return !schemaValidationPolicy.checkAttributeValues().isReject();
+            }
+        } else {
+            attributeDescription = attributeDescription.withOption("binary");
+        }
 
-      switch (state)
-      {
-      case stateStart:
-        if (line == null)
-        {
-          // We have reached the end of the LDIF source.
-          return null;
+        final boolean checkAttributeValues =
+                schemaValidationPolicy.checkAttributeValues().needsChecking();
+        if (checkAttributeValues) {
+            LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
+            if (!syntax.valueIsAcceptable(value, builder)) {
+                schemaErrors.add(builder.toMessage());
+                if (schemaValidationPolicy.checkAttributeValues().isReject()) {
+                    return false;
+                }
+            }
         }
-        else if (line.length() == 0)
-        {
-          // Skip leading blank lines.
-        }
-        else if (line.charAt(0) == '#')
-        {
-          // This is a comment at the start of the LDIF record.
-          state = stateStartCommentLine;
-        }
-        else if (isContinuationLine(line))
-        {
-          // Fatal: got a continuation line at the start of the record.
-          final LocalizableMessage message = ERR_LDIF_INVALID_LEADING_SPACE
-              .get(lineNumber, line);
-          throw DecodeException.fatalError(message);
-        }
-        else
-        {
-          // Got the first line of LDIF.
-          ldifLines.add(line);
-          recordLineNumber = lineNumber;
-          state = stateGotLDIFLine;
-        }
-        break;
-      case stateStartCommentLine:
-        if (line == null)
-        {
-          // We have reached the end of the LDIF source.
-          return null;
-        }
-        else if (line.length() == 0)
-        {
-          // Skip leading blank lines and comments.
-          state = stateStart;
-        }
-        else if (line.charAt(0) == '#')
-        {
-          // This is another comment at the start of the LDIF record.
-        }
-        else if (isContinuationLine(line))
-        {
-          // Skip comment continuation lines.
-        }
-        else
-        {
-          // Got the first line of LDIF.
-          ldifLines.add(line);
-          recordLineNumber = lineNumber;
-          state = stateGotLDIFLine;
-        }
-        break;
-      case stateGotLDIFLine:
-        if (line == null)
-        {
-          // We have reached the end of the LDIF source.
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.length() == 0)
-        {
-          // We have reached the end of the LDIF record.
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.charAt(0) == '#')
-        {
-          // This is a comment.
-          state = stateGotCommentLine;
-        }
-        else if (isContinuationLine(line))
-        {
-          // Got a continuation line for the previous line.
-          lastLineBuilder.setLength(0);
-          lastLineBuilder.append(ldifLines.removeLast());
-          lastLineBuilder.append(line.substring(1));
-          state = appendingLDIFLine;
-        }
-        else
-        {
-          // Got the next line of LDIF.
-          ldifLines.add(line);
-          state = stateGotLDIFLine;
-        }
-        break;
-      case stateGotCommentLine:
-        if (line == null)
-        {
-          // We have reached the end of the LDIF source.
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.length() == 0)
-        {
-          // We have reached the end of the LDIF record.
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.charAt(0) == '#')
-        {
-          // This is another comment.
-          state = stateGotCommentLine;
-        }
-        else if (isContinuationLine(line))
-        {
-          // Skip comment continuation lines.
-        }
-        else
-        {
-          // Got the next line of LDIF.
-          ldifLines.add(line);
-          state = stateGotLDIFLine;
-        }
-        break;
-      case appendingLDIFLine:
-        if (line == null)
-        {
-          // We have reached the end of the LDIF source.
-          ldifLines.add(lastLineBuilder.toString());
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.length() == 0)
-        {
-          // We have reached the end of the LDIF record.
-          ldifLines.add(lastLineBuilder.toString());
-          return new LDIFRecord(recordLineNumber, ldifLines);
-        }
-        else if (line.charAt(0) == '#')
-        {
-          // This is a comment.
-          ldifLines.add(lastLineBuilder.toString());
-          state = stateGotCommentLine;
-        }
-        else if (isContinuationLine(line))
-        {
-          // Got another continuation line for the previous line.
-          lastLineBuilder.append(line.substring(1));
-        }
-        else
-        {
-          // Got the next line of LDIF.
-          ldifLines.add(lastLineBuilder.toString());
-          ldifLines.add(line);
-          state = stateGotLDIFLine;
-        }
-        break;
-      }
-    }
-  }
 
+        Attribute attribute = entry.getAttribute(attributeDescription);
+        if (attribute == null) {
+            attribute = new LinkedAttribute(attributeDescription, value);
+            entry.addAttribute(attribute);
+        } else if (checkAttributeValues) {
+            if (!attribute.add(value)) {
+                final LocalizableMessage message =
+                        WARN_LDIF_DUPLICATE_ATTRIBUTE_VALUE.get(record.lineNumber, entry.getName()
+                                .toString(), attrDescr, value.toString());
+                schemaErrors.add(message);
+                if (schemaValidationPolicy.checkAttributeValues().isReject()) {
+                    return false;
+                }
+            } else if (attributeDescription.getAttributeType().isSingleValue()) {
+                final LocalizableMessage message =
+                        ERR_LDIF_MULTI_VALUED_SINGLE_VALUED_ATTRIBUTE.get(record.lineNumber, entry
+                                .getName().toString(), attrDescr);
+                schemaErrors.add(message);
+                if (schemaValidationPolicy.checkAttributeValues().isReject()) {
+                    return false;
+                }
+            }
+        } else {
+            attribute.add(value);
+        }
 
-
-  final boolean readLDIFRecordAttributeValue(final LDIFRecord record,
-      final String ldifLine, final Entry entry,
-      final List<LocalizableMessage> schemaErrors) throws DecodeException
-  {
-    // Parse the attribute description.
-    final int colonPos = parseColonPosition(record, ldifLine);
-    final String attrDescr = ldifLine.substring(0, colonPos);
-
-    AttributeDescription attributeDescription;
-    try
-    {
-      attributeDescription = AttributeDescription.valueOf(attrDescr, schema);
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      final LocalizableMessage message = ERR_LDIF_UNKNOWN_ATTRIBUTE_TYPE.get(
-          record.lineNumber, entry.getName().toString(), attrDescr);
-      switch (schemaValidationPolicy.checkAttributesAndObjectClasses())
-      {
-      case REJECT:
-        schemaErrors.add(message);
-        return false;
-      case WARN:
-        schemaErrors.add(message);
         return true;
-      default: // Ignore
-        // This should not happen: we should be using a non-strict schema for
-        // this policy.
-        throw new IllegalStateException("Schema is not consistent with policy",
-            e);
-      }
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_ATTRIBUTE_NAME.get(
-          record.lineNumber, entry.getName().toString(), attrDescr);
-      throw DecodeException.error(message);
     }
 
-    // Now parse the attribute value.
-    final ByteString value = parseSingleValue(record, ldifLine,
-        entry.getName(), colonPos, attrDescr);
-
-    // Skip the attribute if requested before performing any schema
-    // checking: the attribute may have been excluded because it is
-    // known to violate the schema.
-    if (isAttributeExcluded(attributeDescription))
-    {
-      return true;
-    }
-
-    final Syntax syntax = attributeDescription.getAttributeType().getSyntax();
-
-    // Ensure that the binary option is present if required.
-    if (!syntax.isBEREncodingRequired())
-    {
-      if (schemaValidationPolicy.checkAttributeValues().needsChecking()
-          && attributeDescription.containsOption("binary"))
-      {
-        final LocalizableMessage message = ERR_LDIF_UNEXPECTED_BINARY_OPTION
-            .get(record.lineNumber, entry.getName().toString(), attrDescr);
-        schemaErrors.add(message);
-        if (schemaValidationPolicy.checkAttributeValues().isReject())
-        {
-          return false;
+    final DN readLDIFRecordDN(final LDIFRecord record) throws DecodeException {
+        String ldifLine = record.iterator.next();
+        int colonPos = ldifLine.indexOf(":");
+        if (colonPos <= 0) {
+            final LocalizableMessage message =
+                    ERR_LDIF_NO_ATTR_NAME.get(record.lineNumber, ldifLine.toString());
+            throw DecodeException.error(message);
         }
-        else
-        {
-          // Skip to next attribute value.
-          return true;
+
+        String attrName = toLowerCase(ldifLine.substring(0, colonPos));
+        if (attrName.equals("version")) {
+            // This is the version line, try the next line if there is one.
+            if (!record.iterator.hasNext()) {
+                return null;
+            }
+
+            ldifLine = record.iterator.next();
+            colonPos = ldifLine.indexOf(":");
+            if (colonPos <= 0) {
+                final LocalizableMessage message =
+                        ERR_LDIF_NO_ATTR_NAME.get(record.lineNumber, ldifLine.toString());
+                throw DecodeException.error(message);
+            }
+
+            attrName = toLowerCase(ldifLine.substring(0, colonPos));
         }
-      }
-    }
-    else
-    {
-      attributeDescription = attributeDescription.withOption("binary");
-    }
 
-    final boolean checkAttributeValues = schemaValidationPolicy
-        .checkAttributeValues().needsChecking();
-    if (checkAttributeValues)
-    {
-      LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
-      if (!syntax.valueIsAcceptable(value, builder))
-      {
-        schemaErrors.add(builder.toMessage());
-        if (schemaValidationPolicy.checkAttributeValues().isReject())
-        {
-          return false;
+        if (!attrName.equals("dn")) {
+            final LocalizableMessage message =
+                    ERR_LDIF_NO_DN.get(record.lineNumber, ldifLine.toString());
+            throw DecodeException.error(message);
         }
-      }
-    }
 
-    Attribute attribute = entry.getAttribute(attributeDescription);
-    if (attribute == null)
-    {
-      attribute = new LinkedAttribute(attributeDescription, value);
-      entry.addAttribute(attribute);
-    }
-    else if (checkAttributeValues)
-    {
-      if (!attribute.add(value))
-      {
-        final LocalizableMessage message = WARN_LDIF_DUPLICATE_ATTRIBUTE_VALUE
-            .get(record.lineNumber, entry.getName().toString(), attrDescr,
-                value.toString());
-        schemaErrors.add(message);
-        if (schemaValidationPolicy.checkAttributeValues().isReject())
-        {
-          return false;
+        // Look at the character immediately after the colon. If there is
+        // none, then assume the null DN. If it is another colon, then the
+        // DN must be base64-encoded. Otherwise, it may be one or more
+        // spaces.
+        final int length = ldifLine.length();
+        if (colonPos == length - 1) {
+            return DN.rootDN();
         }
-      }
-      else if (attributeDescription.getAttributeType().isSingleValue())
-      {
-        final LocalizableMessage message = ERR_LDIF_MULTI_VALUED_SINGLE_VALUED_ATTRIBUTE
-            .get(record.lineNumber, entry.getName().toString(), attrDescr);
-        schemaErrors.add(message);
-        if (schemaValidationPolicy.checkAttributeValues().isReject())
-        {
-          return false;
+
+        String dnString = null;
+
+        if (ldifLine.charAt(colonPos + 1) == ':') {
+            // The DN is base64-encoded. Find the first non-blank character
+            // and take the rest of the line and base64-decode it.
+            int pos = colonPos + 2;
+            while (pos < length && ldifLine.charAt(pos) == ' ') {
+                pos++;
+            }
+
+            final String base64DN = ldifLine.substring(pos);
+            try {
+                dnString = Base64.decode(base64DN).toString();
+            } catch (final LocalizedIllegalArgumentException e) {
+                // The value did not have a valid base64-encoding.
+                final LocalizableMessage message =
+                        ERR_LDIF_COULD_NOT_BASE64_DECODE_DN.get(record.lineNumber, ldifLine, e
+                                .getMessageObject());
+                throw DecodeException.error(message);
+            }
+        } 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.
+            int pos = colonPos + 1;
+            while (pos < length && ldifLine.charAt(pos) == ' ') {
+                pos++;
+            }
+
+            dnString = ldifLine.substring(pos);
         }
-      }
-    }
-    else
-    {
-      attribute.add(value);
+
+        try {
+            return DN.valueOf(dnString, schema);
+        } catch (final LocalizedIllegalArgumentException e) {
+            final LocalizableMessage message =
+                    ERR_LDIF_INVALID_DN.get(record.lineNumber, ldifLine, e.getMessageObject());
+            throw DecodeException.error(message);
+        }
     }
 
-    return true;
-  }
+    final String readLDIFRecordKeyValuePair(final LDIFRecord record, final KeyValuePair pair,
+            final boolean allowBase64) {
+        final String ldifLine = record.iterator.next();
+        final int colonPos = ldifLine.indexOf(":");
+        if (colonPos <= 0) {
+            pair.key = null;
+            return ldifLine;
+        }
+        pair.key = ldifLine.substring(0, colonPos);
 
+        // Look at the character immediately after the colon. If there is
+        // none, then no value was specified. Throw an exception
+        final int length = ldifLine.length();
+        if (colonPos == length - 1) {
+            pair.key = null;
+            return ldifLine;
+        }
 
+        if (allowBase64 && ldifLine.charAt(colonPos + 1) == ':') {
+            // The value is base64-encoded. Find the first non-blank
+            // character, take the rest of the line, and base64-decode it.
+            int pos = colonPos + 2;
+            while (pos < length && ldifLine.charAt(pos) == ' ') {
+                pos++;
+            }
 
-  final DN readLDIFRecordDN(final LDIFRecord record) throws DecodeException
-  {
-    String ldifLine = record.iterator.next();
-    int colonPos = ldifLine.indexOf(":");
-    if (colonPos <= 0)
-    {
-      final LocalizableMessage message = ERR_LDIF_NO_ATTR_NAME.get(
-          record.lineNumber, ldifLine.toString());
-      throw DecodeException.error(message);
-    }
+            try {
+                pair.value = Base64.decode(ldifLine.substring(pos)).toString();
+            } catch (final LocalizedIllegalArgumentException e) {
+                pair.key = null;
+                return ldifLine;
+            }
+        } 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 = colonPos + 1;
+            while (pos < length && ldifLine.charAt(pos) == ' ') {
+                pos++;
+            }
 
-    String attrName = toLowerCase(ldifLine.substring(0, colonPos));
-    if (attrName.equals("version"))
-    {
-      // This is the version line, try the next line if there is one.
-      if (!record.iterator.hasNext())
-      {
-        return null;
-      }
+            pair.value = ldifLine.substring(pos);
+        }
 
-      ldifLine = record.iterator.next();
-      colonPos = ldifLine.indexOf(":");
-      if (colonPos <= 0)
-      {
-        final LocalizableMessage message = ERR_LDIF_NO_ATTR_NAME.get(
-            record.lineNumber, ldifLine.toString());
-        throw DecodeException.error(message);
-      }
-
-      attrName = toLowerCase(ldifLine.substring(0, colonPos));
-    }
-
-    if (!attrName.equals("dn"))
-    {
-      final LocalizableMessage message = ERR_LDIF_NO_DN.get(record.lineNumber,
-          ldifLine.toString());
-      throw DecodeException.error(message);
-    }
-
-    // Look at the character immediately after the colon. If there is
-    // none, then assume the null DN. If it is another colon, then the
-    // DN must be base64-encoded. Otherwise, it may be one or more
-    // spaces.
-    final int length = ldifLine.length();
-    if (colonPos == length - 1)
-    {
-      return DN.rootDN();
-    }
-
-    String dnString = null;
-
-    if (ldifLine.charAt(colonPos + 1) == ':')
-    {
-      // The DN is base64-encoded. Find the first non-blank character
-      // and take the rest of the line and base64-decode it.
-      int pos = colonPos + 2;
-      while (pos < length && ldifLine.charAt(pos) == ' ')
-      {
-        pos++;
-      }
-
-      final String base64DN = ldifLine.substring(pos);
-      try
-      {
-        dnString = Base64.decode(base64DN).toString();
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        // The value did not have a valid base64-encoding.
-        final LocalizableMessage message = ERR_LDIF_COULD_NOT_BASE64_DECODE_DN
-            .get(record.lineNumber, ldifLine, e.getMessageObject());
-        throw DecodeException.error(message);
-      }
-    }
-    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.
-      int pos = colonPos + 1;
-      while (pos < length && ldifLine.charAt(pos) == ' ')
-      {
-        pos++;
-      }
-
-      dnString = ldifLine.substring(pos);
-    }
-
-    try
-    {
-      return DN.valueOf(dnString, schema);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      final LocalizableMessage message = ERR_LDIF_INVALID_DN.get(
-          record.lineNumber, ldifLine, e.getMessageObject());
-      throw DecodeException.error(message);
-    }
-  }
-
-
-
-  final String readLDIFRecordKeyValuePair(final LDIFRecord record,
-      final KeyValuePair pair, final boolean allowBase64)
-  {
-    final String ldifLine = record.iterator.next();
-    final int colonPos = ldifLine.indexOf(":");
-    if (colonPos <= 0)
-    {
-      pair.key = null;
-      return ldifLine;
-    }
-    pair.key = ldifLine.substring(0, colonPos);
-
-    // Look at the character immediately after the colon. If there is
-    // none, then no value was specified. Throw an exception
-    final int length = ldifLine.length();
-    if (colonPos == length - 1)
-    {
-      pair.key = null;
-      return ldifLine;
-    }
-
-    if (allowBase64 && ldifLine.charAt(colonPos + 1) == ':')
-    {
-      // The value is base64-encoded. Find the first non-blank
-      // character, take the rest of the line, and base64-decode it.
-      int pos = colonPos + 2;
-      while (pos < length && ldifLine.charAt(pos) == ' ')
-      {
-        pos++;
-      }
-
-      try
-      {
-        pair.value = Base64.decode(ldifLine.substring(pos)).toString();
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        pair.key = null;
         return ldifLine;
-      }
-    }
-    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 = colonPos + 1;
-      while (pos < length && ldifLine.charAt(pos) == ' ')
-      {
-        pos++;
-      }
-
-      pair.value = ldifLine.substring(pos);
     }
 
-    return ldifLine;
-  }
-
-
-
-  final void handleMalformedRecord(final LDIFRecord record,
-      final LocalizableMessage message) throws DecodeException
-  {
-    rejectedRecordListener.handleMalformedRecord(record.lineNumber,
-        record.ldifLines, message);
-  }
-
-
-
-  final void handleSchemaValidationFailure(final LDIFRecord record,
-      final List<LocalizableMessage> messages) throws DecodeException
-  {
-    rejectedRecordListener.handleSchemaValidationFailure(record.lineNumber,
-        record.ldifLines, messages);
-  }
-
-
-
-  final void handleSchemaValidationWarning(final LDIFRecord record,
-      final List<LocalizableMessage> messages) throws DecodeException
-  {
-    rejectedRecordListener.handleSchemaValidationWarning(record.lineNumber,
-        record.ldifLines, messages);
-  }
-
-
-
-  final void handleSkippedRecord(final LDIFRecord record,
-      final LocalizableMessage message) throws DecodeException
-  {
-    rejectedRecordListener.handleSkippedRecord(record.lineNumber,
-        record.ldifLines, message);
-  }
-
-
-
-  // Determine whether the provided line is a continuation line. Note
-  // that while RFC 2849 technically only allows a space in this
-  // position, both OpenLDAP and the Sun Java System Directory Server
-  // allow a tab as well, so we will too for compatibility reasons. See
-  // issue #852 for details.
-  private boolean isContinuationLine(final String line)
-  {
-    return line.charAt(0) == ' ' || line.charAt(0) == '\t';
-  }
-
-
-
-  private String readLine() throws IOException
-  {
-    final String line = impl.readLine();
-    if (line != null)
-    {
-      lineNumber++;
+    final void handleMalformedRecord(final LDIFRecord record, final LocalizableMessage message)
+            throws DecodeException {
+        rejectedRecordListener.handleMalformedRecord(record.lineNumber, record.ldifLines, message);
     }
-    return line;
-  }
+
+    final void handleSchemaValidationFailure(final LDIFRecord record,
+            final List<LocalizableMessage> messages) throws DecodeException {
+        rejectedRecordListener.handleSchemaValidationFailure(record.lineNumber, record.ldifLines,
+                messages);
+    }
+
+    final void handleSchemaValidationWarning(final LDIFRecord record,
+            final List<LocalizableMessage> messages) throws DecodeException {
+        rejectedRecordListener.handleSchemaValidationWarning(record.lineNumber, record.ldifLines,
+                messages);
+    }
+
+    final void handleSkippedRecord(final LDIFRecord record, final LocalizableMessage message)
+            throws DecodeException {
+        rejectedRecordListener.handleSkippedRecord(record.lineNumber, record.ldifLines, message);
+    }
+
+    // Determine whether the provided line is a continuation line. Note
+    // that while RFC 2849 technically only allows a space in this
+    // position, both OpenLDAP and the Sun Java System Directory Server
+    // allow a tab as well, so we will too for compatibility reasons. See
+    // issue #852 for details.
+    private boolean isContinuationLine(final String line) {
+        return line.charAt(0) == ' ' || line.charAt(0) == '\t';
+    }
+
+    private String readLine() throws IOException {
+        final String line = impl.readLine();
+        if (line != null) {
+            lineNumber++;
+        }
+        return line;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFStream.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFStream.java
index 6c7abe9..15498a7 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFStream.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFStream.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -41,130 +38,97 @@
 import org.forgerock.opendj.ldap.Matcher;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 
-
-
 /**
  * Common LDIF reader/writer functionality.
  */
-abstract class AbstractLDIFStream
-{
+abstract class AbstractLDIFStream {
 
-  final Set<AttributeDescription> excludeAttributes = new HashSet<AttributeDescription>();
+    final Set<AttributeDescription> excludeAttributes = new HashSet<AttributeDescription>();
 
-  boolean excludeOperationalAttributes = false;
+    boolean excludeOperationalAttributes = false;
 
-  boolean excludeUserAttributes = false;
+    boolean excludeUserAttributes = false;
 
-  final Set<AttributeDescription> includeAttributes = new HashSet<AttributeDescription>();
+    final Set<AttributeDescription> includeAttributes = new HashSet<AttributeDescription>();
 
-  final Set<DN> includeBranches = new HashSet<DN>();
+    final Set<DN> includeBranches = new HashSet<DN>();
 
-  final Set<DN> excludeBranches = new HashSet<DN>();
+    final Set<DN> excludeBranches = new HashSet<DN>();
 
-  final List<Matcher> includeFilters = new LinkedList<Matcher>();
+    final List<Matcher> includeFilters = new LinkedList<Matcher>();
 
-  final List<Matcher> excludeFilters = new LinkedList<Matcher>();
+    final List<Matcher> excludeFilters = new LinkedList<Matcher>();
 
-
-
-  /**
-   * Creates a new abstract LDIF stream.
-   */
-  AbstractLDIFStream()
-  {
-    // Nothing to do.
-  }
-
-
-
-  final boolean isAttributeExcluded(
-      final AttributeDescription attributeDescription)
-  {
-    if (!excludeAttributes.isEmpty()
-        && excludeAttributes.contains(attributeDescription))
-    {
-      return true;
+    /**
+     * Creates a new abstract LDIF stream.
+     */
+    AbstractLDIFStream() {
+        // Nothing to do.
     }
 
-    // Let explicit include override more general exclude.
-    if (!includeAttributes.isEmpty())
-    {
-      return !includeAttributes.contains(attributeDescription);
-    }
-
-    final AttributeType type = attributeDescription.getAttributeType();
-
-    if (excludeOperationalAttributes && type.isOperational())
-    {
-      return true;
-    }
-
-    if (excludeUserAttributes && !type.isOperational())
-    {
-      return true;
-    }
-
-    return false;
-  }
-
-
-
-  final boolean isBranchExcluded(final DN dn)
-  {
-    if (!excludeBranches.isEmpty())
-    {
-      for (final DN excludeBranch : excludeBranches)
-      {
-        if (excludeBranch.isSuperiorOrEqualTo(dn))
-        {
-          return true;
+    final boolean isAttributeExcluded(final AttributeDescription attributeDescription) {
+        if (!excludeAttributes.isEmpty() && excludeAttributes.contains(attributeDescription)) {
+            return true;
         }
-      }
-    }
 
-    if (!includeBranches.isEmpty())
-    {
-      for (final DN includeBranch : includeBranches)
-      {
-        if (includeBranch.isSuperiorOrEqualTo(dn))
-        {
-          return false;
+        // Let explicit include override more general exclude.
+        if (!includeAttributes.isEmpty()) {
+            return !includeAttributes.contains(attributeDescription);
         }
-      }
-      return true;
-    }
 
-    return false;
-  }
+        final AttributeType type = attributeDescription.getAttributeType();
 
-
-
-  final boolean isEntryExcluded(final Entry entry)
-  {
-    if (!excludeFilters.isEmpty())
-    {
-      for (final Matcher excludeFilter : excludeFilters)
-      {
-        if (excludeFilter.matches(entry).toBoolean())
-        {
-          return true;
+        if (excludeOperationalAttributes && type.isOperational()) {
+            return true;
         }
-      }
-    }
 
-    if (!includeFilters.isEmpty())
-    {
-      for (final Matcher includeFilter : includeFilters)
-      {
-        if (includeFilter.matches(entry).toBoolean())
-        {
-          return false;
+        if (excludeUserAttributes && !type.isOperational()) {
+            return true;
         }
-      }
-      return true;
+
+        return false;
     }
 
-    return false;
-  }
+    final boolean isBranchExcluded(final DN dn) {
+        if (!excludeBranches.isEmpty()) {
+            for (final DN excludeBranch : excludeBranches) {
+                if (excludeBranch.isSuperiorOrEqualTo(dn)) {
+                    return true;
+                }
+            }
+        }
+
+        if (!includeBranches.isEmpty()) {
+            for (final DN includeBranch : includeBranches) {
+                if (includeBranch.isSuperiorOrEqualTo(dn)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        return false;
+    }
+
+    final boolean isEntryExcluded(final Entry entry) {
+        if (!excludeFilters.isEmpty()) {
+            for (final Matcher excludeFilter : excludeFilters) {
+                if (excludeFilter.matches(entry).toBoolean()) {
+                    return true;
+                }
+            }
+        }
+
+        if (!includeFilters.isEmpty()) {
+            for (final Matcher includeFilter : includeFilters) {
+                if (includeFilter.matches(entry).toBoolean()) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        return false;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java
index 3201b7e..be8d3a9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/AbstractLDIFWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -45,503 +42,388 @@
 import com.forgerock.opendj.util.Base64;
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * Common LDIF writer functionality.
  */
-abstract class AbstractLDIFWriter extends AbstractLDIFStream
-{
-
-  /**
-   * LDIF writer implementation interface.
-   */
-  interface LDIFWriterImpl
-  {
+abstract class AbstractLDIFWriter extends AbstractLDIFStream {
 
     /**
-     * Closes any resources associated with this LDIF writer implementation.
-     *
-     * @throws IOException
-     *           If an error occurs while closing.
+     * LDIF writer implementation interface.
      */
-    void close() throws IOException;
+    interface LDIFWriterImpl {
 
+        /**
+         * Closes any resources associated with this LDIF writer implementation.
+         *
+         * @throws IOException
+         *             If an error occurs while closing.
+         */
+        void close() throws IOException;
 
+        /**
+         * Flushes this LDIF writer implementation so that any buffered data is
+         * written immediately to underlying stream, flushing the stream if it
+         * is also {@code Flushable}.
+         * <p>
+         * If the intended destination of this stream is an abstraction provided
+         * by the underlying operating system, for example a file, then flushing
+         * the stream guarantees only that bytes previously written to the
+         * stream are passed to the operating system for writing; it does not
+         * guarantee that they are actually written to a physical device such as
+         * a disk drive.
+         *
+         * @throws IOException
+         *             If an error occurs while flushing.
+         */
+        void flush() throws IOException;
+
+        /**
+         * Prints the provided {@code CharSequence}. Implementations must not
+         * add a new-line character sequence.
+         *
+         * @param s
+         *            The {@code CharSequence} to be printed.
+         * @throws IOException
+         *             If an error occurs while printing {@code s}.
+         */
+        void print(CharSequence s) throws IOException;
+
+        /**
+         * Prints a new-line character sequence.
+         *
+         * @throws IOException
+         *             If an error occurs while printing the new-line character
+         *             sequence.
+         */
+        void println() throws IOException;
+    }
 
     /**
-     * Flushes this LDIF writer implementation so that any buffered data is
-     * written immediately to underlying stream, flushing the stream if it is
-     * also {@code Flushable}.
-     * <p>
-     * If the intended destination of this stream is an abstraction provided by
-     * the underlying operating system, for example a file, then flushing the
-     * stream guarantees only that bytes previously written to the stream are
-     * passed to the operating system for writing; it does not guarantee that
-     * they are actually written to a physical device such as a disk drive.
-     *
-     * @throws IOException
-     *           If an error occurs while flushing.
+     * LDIF string list writer implementation.
      */
-    void flush() throws IOException;
+    private static final class LDIFWriterListImpl implements LDIFWriterImpl {
 
+        private final StringBuilder builder = new StringBuilder();
 
+        private final List<String> ldifLines;
+
+        /**
+         * Creates a new LDIF list writer.
+         *
+         * @param ldifLines
+         *            The string list.
+         */
+        LDIFWriterListImpl(final List<String> ldifLines) {
+            this.ldifLines = ldifLines;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() throws IOException {
+            // Nothing to do.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void flush() throws IOException {
+            // Nothing to do.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void print(final CharSequence s) throws IOException {
+            builder.append(s);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void println() throws IOException {
+            ldifLines.add(builder.toString());
+            builder.setLength(0);
+        }
+    }
 
     /**
-     * Prints the provided {@code CharSequence}. Implementations must not add a
-     * new-line character sequence.
-     *
-     * @param s
-     *          The {@code CharSequence} to be printed.
-     * @throws IOException
-     *           If an error occurs while printing {@code s}.
+     * LDIF output stream writer implementation.
      */
-    void print(CharSequence s) throws IOException;
+    private static final class LDIFWriterOutputStreamImpl implements LDIFWriterImpl {
 
+        private final BufferedWriter writer;
 
+        /**
+         * Creates a new LDIF output stream writer.
+         *
+         * @param out
+         *            The output stream.
+         */
+        LDIFWriterOutputStreamImpl(final OutputStream out) {
+            this.writer = new BufferedWriter(new OutputStreamWriter(out));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() throws IOException {
+            writer.close();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void flush() throws IOException {
+            writer.flush();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void print(final CharSequence s) throws IOException {
+            writer.append(s);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void println() throws IOException {
+            writer.newLine();
+        }
+    }
+
+    // Regular expression used for splitting comments on line-breaks.
+    private static final Pattern SPLIT_NEWLINE = Pattern.compile("\\r?\\n");
+
+    boolean addUserFriendlyComments = false;
+
+    final LDIFWriterImpl impl;
+
+    int wrapColumn = 0;
+
+    private final StringBuilder builder = new StringBuilder(80);
+
+    Schema schema = Schema.getDefaultSchema();
 
     /**
-     * Prints a new-line character sequence.
-     *
-     * @throws IOException
-     *           If an error occurs while printing the new-line character
-     *           sequence.
-     */
-    void println() throws IOException;
-  }
-
-
-
-  /**
-   * LDIF string list writer implementation.
-   */
-  private static final class LDIFWriterListImpl implements LDIFWriterImpl
-  {
-
-    private final StringBuilder builder = new StringBuilder();
-
-    private final List<String> ldifLines;
-
-
-
-    /**
-     * Creates a new LDIF list writer.
+     * Creates a new LDIF entry writer which will append lines of LDIF to the
+     * provided list.
      *
      * @param ldifLines
-     *          The string list.
+     *            The list to which lines of LDIF should be appended.
      */
-    LDIFWriterListImpl(final List<String> ldifLines)
-    {
-      this.ldifLines = ldifLines;
+    public AbstractLDIFWriter(final List<String> ldifLines) {
+        Validator.ensureNotNull(ldifLines);
+        this.impl = new LDIFWriterListImpl(ldifLines);
     }
 
-
-
     /**
-     * {@inheritDoc}
-     */
-    public void close() throws IOException
-    {
-      // Nothing to do.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void flush() throws IOException
-    {
-      // Nothing to do.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void print(final CharSequence s) throws IOException
-    {
-      builder.append(s);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void println() throws IOException
-    {
-      ldifLines.add(builder.toString());
-      builder.setLength(0);
-    }
-  }
-
-
-
-  /**
-   * LDIF output stream writer implementation.
-   */
-  private static final class LDIFWriterOutputStreamImpl implements
-      LDIFWriterImpl
-  {
-
-    private final BufferedWriter writer;
-
-
-
-    /**
-     * Creates a new LDIF output stream writer.
+     * Creates a new LDIF entry writer whose destination is the provided output
+     * stream.
      *
      * @param out
-     *          The output stream.
+     *            The output stream to use.
      */
-    LDIFWriterOutputStreamImpl(final OutputStream out)
-    {
-      this.writer = new BufferedWriter(new OutputStreamWriter(out));
+    public AbstractLDIFWriter(final OutputStream out) {
+        Validator.ensureNotNull(out);
+        this.impl = new LDIFWriterOutputStreamImpl(out);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close() throws IOException
-    {
-      writer.close();
+    final void close0() throws IOException {
+        flush0();
+        impl.close();
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void flush() throws IOException
-    {
-      writer.flush();
+    final void flush0() throws IOException {
+        impl.flush();
     }
 
+    final void writeComment0(final CharSequence comment) throws IOException {
+        Validator.ensureNotNull(comment);
 
+        // First, break up the comment into multiple lines to preserve the
+        // original spacing that it contained.
+        final String[] lines = SPLIT_NEWLINE.split(comment);
 
-    /**
-     * {@inheritDoc}
-     */
-    public void print(final CharSequence s) throws IOException
-    {
-      writer.append(s);
-    }
+        // Now iterate through the lines and write them out, prefixing and
+        // wrapping them as necessary.
+        for (final String line : lines) {
+            if (!shouldWrap()) {
+                impl.print("# ");
+                impl.print(line);
+                impl.println();
+            } else {
+                final int breakColumn = wrapColumn - 2;
 
+                if (line.length() <= breakColumn) {
+                    impl.print("# ");
+                    impl.print(line);
+                    impl.println();
+                } else {
+                    int startPos = 0;
+                outerLoop:
+                    while (startPos < line.length()) {
+                        if (startPos + breakColumn >= line.length()) {
+                            impl.print("# ");
+                            impl.print(line.substring(startPos));
+                            impl.println();
+                            startPos = line.length();
+                        } else {
+                            final int endPos = startPos + breakColumn;
 
+                            int i = endPos - 1;
+                            while (i > startPos) {
+                                if (line.charAt(i) == ' ') {
+                                    impl.print("# ");
+                                    impl.print(line.substring(startPos, i));
+                                    impl.println();
 
-    /**
-     * {@inheritDoc}
-     */
-    public void println() throws IOException
-    {
-      writer.newLine();
-    }
-  }
+                                    startPos = i + 1;
+                                    continue outerLoop;
+                                }
 
+                                i--;
+                            }
 
+                            // If we've gotten here, then there are no spaces on
+                            // the
+                            // entire line. If that happens, then we'll have to
+                            // break
+                            // in the middle of a word.
+                            impl.print("# ");
+                            impl.print(line.substring(startPos, endPos));
+                            impl.println();
 
-  // Regular expression used for splitting comments on line-breaks.
-  private static final Pattern SPLIT_NEWLINE = Pattern.compile("\\r?\\n");
-
-  boolean addUserFriendlyComments = false;
-
-  final LDIFWriterImpl impl;
-
-  int wrapColumn = 0;
-
-  private final StringBuilder builder = new StringBuilder(80);
-
-  Schema schema = Schema.getDefaultSchema();
-
-
-
-  /**
-   * Creates a new LDIF entry writer which will append lines of LDIF to the
-   * provided list.
-   *
-   * @param ldifLines
-   *          The list to which lines of LDIF should be appended.
-   */
-  public AbstractLDIFWriter(final List<String> ldifLines)
-  {
-    Validator.ensureNotNull(ldifLines);
-    this.impl = new LDIFWriterListImpl(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new LDIF entry writer whose destination is the provided output
-   * stream.
-   *
-   * @param out
-   *          The output stream to use.
-   */
-  public AbstractLDIFWriter(final OutputStream out)
-  {
-    Validator.ensureNotNull(out);
-    this.impl = new LDIFWriterOutputStreamImpl(out);
-  }
-
-
-
-  final void close0() throws IOException
-  {
-    flush0();
-    impl.close();
-  }
-
-
-
-  final void flush0() throws IOException
-  {
-    impl.flush();
-  }
-
-
-
-  final void writeComment0(final CharSequence comment) throws IOException
-  {
-    Validator.ensureNotNull(comment);
-
-    // First, break up the comment into multiple lines to preserve the
-    // original spacing that it contained.
-    final String[] lines = SPLIT_NEWLINE.split(comment);
-
-    // Now iterate through the lines and write them out, prefixing and
-    // wrapping them as necessary.
-    for (final String line : lines)
-    {
-      if (!shouldWrap())
-      {
-        impl.print("# ");
-        impl.print(line);
-        impl.println();
-      }
-      else
-      {
-        final int breakColumn = wrapColumn - 2;
-
-        if (line.length() <= breakColumn)
-        {
-          impl.print("# ");
-          impl.print(line);
-          impl.println();
-        }
-        else
-        {
-          int startPos = 0;
-          outerLoop: while (startPos < line.length())
-          {
-            if (startPos + breakColumn >= line.length())
-            {
-              impl.print("# ");
-              impl.print(line.substring(startPos));
-              impl.println();
-              startPos = line.length();
-            }
-            else
-            {
-              final int endPos = startPos + breakColumn;
-
-              int i = endPos - 1;
-              while (i > startPos)
-              {
-                if (line.charAt(i) == ' ')
-                {
-                  impl.print("# ");
-                  impl.print(line.substring(startPos, i));
-                  impl.println();
-
-                  startPos = i + 1;
-                  continue outerLoop;
+                            startPos = endPos;
+                        }
+                    }
                 }
-
-                i--;
-              }
-
-              // If we've gotten here, then there are no spaces on the
-              // entire line. If that happens, then we'll have to break
-              // in the middle of a word.
-              impl.print("# ");
-              impl.print(line.substring(startPos, endPos));
-              impl.println();
-
-              startPos = endPos;
             }
-          }
         }
-      }
-    }
-  }
-
-
-
-  final void writeControls(final List<Control> controls) throws IOException
-  {
-    for (final Control control : controls)
-    {
-      final StringBuilder key = new StringBuilder("control: ");
-      key.append(control.getOID());
-      key.append(control.isCritical() ? " true" : " false");
-
-      if (control.hasValue())
-      {
-        writeKeyAndValue(key, control.getValue());
-      }
-      else
-      {
-        writeLine(key);
-      }
-    }
-  }
-
-
-
-  final void writeKeyAndValue(final CharSequence key, final ByteSequence value)
-      throws IOException
-  {
-    builder.setLength(0);
-
-    // If the value is empty, then just append a single colon and a
-    // single space.
-    if (value.length() == 0)
-    {
-      builder.append(key);
-      builder.append(": ");
-    }
-    else if (needsBase64Encoding(value))
-    {
-      if (addUserFriendlyComments)
-      {
-        // TODO: Only display comments for valid UTF-8 values, not
-        // binary values.
-      }
-
-      builder.setLength(0);
-      builder.append(key);
-      builder.append(":: ");
-      builder.append(Base64.encode(value));
-    }
-    else
-    {
-      builder.append(key);
-      builder.append(": ");
-      builder.append(value.toString());
     }
 
-    writeLine(builder);
-  }
+    final void writeControls(final List<Control> controls) throws IOException {
+        for (final Control control : controls) {
+            final StringBuilder key = new StringBuilder("control: ");
+            key.append(control.getOID());
+            key.append(control.isCritical() ? " true" : " false");
 
-
-
-  final void writeKeyAndValue(final CharSequence key, final CharSequence value)
-      throws IOException
-  {
-    // FIXME: We should optimize this at some point.
-    writeKeyAndValue(key, ByteString.valueOf(value.toString()));
-  }
-
-
-
-  final void writeLine(final CharSequence line) throws IOException
-  {
-    final int length = line.length();
-    if (shouldWrap() && length > wrapColumn)
-    {
-      impl.print(line.subSequence(0, wrapColumn));
-      impl.println();
-      int pos = wrapColumn;
-      while (pos < length)
-      {
-        final int writeLength = Math.min(wrapColumn - 1, length - pos);
-        impl.print(" ");
-        impl.print(line.subSequence(pos, pos + writeLength));
-        impl.println();
-        pos += wrapColumn - 1;
-      }
-    }
-    else
-    {
-      impl.print(line);
-      impl.println();
-    }
-  }
-
-
-
-  private boolean needsBase64Encoding(final ByteSequence bytes)
-  {
-    final int length = bytes.length();
-    if (length == 0)
-    {
-      return false;
+            if (control.hasValue()) {
+                writeKeyAndValue(key, control.getValue());
+            } else {
+                writeLine(key);
+            }
+        }
     }
 
-    // If the value starts with a space, colon, or less than, then it
-    // needs to be base64 encoded.
-    switch (bytes.byteAt(0))
-    {
-    case 0x20: // Space
-    case 0x3A: // Colon
-    case 0x3C: // Less-than
-      return true;
+    final void writeKeyAndValue(final CharSequence key, final ByteSequence value)
+            throws IOException {
+        builder.setLength(0);
+
+        // If the value is empty, then just append a single colon and a
+        // single space.
+        if (value.length() == 0) {
+            builder.append(key);
+            builder.append(": ");
+        } else if (needsBase64Encoding(value)) {
+            if (addUserFriendlyComments) {
+                // TODO: Only display comments for valid UTF-8 values, not
+                // binary values.
+            }
+
+            builder.setLength(0);
+            builder.append(key);
+            builder.append(":: ");
+            builder.append(Base64.encode(value));
+        } else {
+            builder.append(key);
+            builder.append(": ");
+            builder.append(value.toString());
+        }
+
+        writeLine(builder);
     }
 
-    // If the value ends with a space, then it needs to be
-    // base64 encoded.
-    if (length > 1 && bytes.byteAt(length - 1) == 0x20)
-    {
-      return true;
+    final void writeKeyAndValue(final CharSequence key, final CharSequence value)
+            throws IOException {
+        // FIXME: We should optimize this at some point.
+        writeKeyAndValue(key, ByteString.valueOf(value.toString()));
     }
 
-    // If the value contains a null, newline, or return character, then
-    // it needs to be base64 encoded.
-    byte b;
-    for (int i = 0; i < bytes.length(); i++)
-    {
-      b = bytes.byteAt(i);
-      if (b > 127 || b < 0)
-      {
-        return true;
-      }
-
-      switch (b)
-      {
-      case 0x00: // Null
-      case 0x0A: // New line
-      case 0x0D: // Carriage return
-        return true;
-      }
+    final void writeLine(final CharSequence line) throws IOException {
+        final int length = line.length();
+        if (shouldWrap() && length > wrapColumn) {
+            impl.print(line.subSequence(0, wrapColumn));
+            impl.println();
+            int pos = wrapColumn;
+            while (pos < length) {
+                final int writeLength = Math.min(wrapColumn - 1, length - pos);
+                impl.print(" ");
+                impl.print(line.subSequence(pos, pos + writeLength));
+                impl.println();
+                pos += wrapColumn - 1;
+            }
+        } else {
+            impl.print(line);
+            impl.println();
+        }
     }
 
-    // If we've made it here, then there's no reason to base64 encode.
-    return false;
-  }
+    private boolean needsBase64Encoding(final ByteSequence bytes) {
+        final int length = bytes.length();
+        if (length == 0) {
+            return false;
+        }
 
+        // If the value starts with a space, colon, or less than, then it
+        // needs to be base64 encoded.
+        switch (bytes.byteAt(0)) {
+        case 0x20: // Space
+        case 0x3A: // Colon
+        case 0x3C: // Less-than
+            return true;
+        }
 
+        // If the value ends with a space, then it needs to be
+        // base64 encoded.
+        if (length > 1 && bytes.byteAt(length - 1) == 0x20) {
+            return true;
+        }
 
-  private boolean shouldWrap()
-  {
-    return wrapColumn > 1;
-  }
+        // If the value contains a null, newline, or return character, then
+        // it needs to be base64 encoded.
+        byte b;
+        for (int i = 0; i < bytes.length(); i++) {
+            b = bytes.byteAt(i);
+            if (b > 127 || b < 0) {
+                return true;
+            }
 
+            switch (b) {
+            case 0x00: // Null
+            case 0x0A: // New line
+            case 0x0D: // Carriage return
+                return true;
+            }
+        }
 
+        // If we've made it here, then there's no reason to base64 encode.
+        return false;
+    }
 
-  @SuppressWarnings("unused")
-  private void writeKeyAndURL(final CharSequence key, final CharSequence url)
-      throws IOException
-  {
-    builder.setLength(0);
+    private boolean shouldWrap() {
+        return wrapColumn > 1;
+    }
 
-    builder.append(key);
-    builder.append(":: ");
-    builder.append(url);
+    @SuppressWarnings("unused")
+    private void writeKeyAndURL(final CharSequence key, final CharSequence url) throws IOException {
+        builder.setLength(0);
 
-    writeLine(builder);
-  }
+        builder.append(key);
+        builder.append(":: ");
+        builder.append(url);
+
+        writeLine(builder);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecord.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecord.java
index f50a196..47272e3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecord.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecord.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,12 +26,8 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 
-
-
 /**
  * A request to modify the content of the Directory in some way. A change record
  * represents one of the following operations:
@@ -43,30 +38,28 @@
  * <li>An {@code ModifyDN} operation.
  * </ul>
  */
-public interface ChangeRecord
-{
-  /**
-   * Applies a {@code ChangeRecordVisitor} to this {@code ChangeRecord}.
-   *
-   * @param <R>
-   *          The return type of the visitor's methods.
-   * @param <P>
-   *          The type of the additional parameters to the visitor's methods.
-   * @param v
-   *          The change record visitor.
-   * @param p
-   *          Optional additional visitor parameter.
-   * @return A result as specified by the visitor.
-   */
-  <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
+public interface ChangeRecord {
+    /**
+     * Applies a {@code ChangeRecordVisitor} to this {@code ChangeRecord}.
+     *
+     * @param <R>
+     *            The return type of the visitor's methods.
+     * @param <P>
+     *            The type of the additional parameters to the visitor's
+     *            methods.
+     * @param v
+     *            The change record visitor.
+     * @param p
+     *            Optional additional visitor parameter.
+     * @return A result as specified by the visitor.
+     */
+    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
 
-
-
-  /**
-   * Returns the distinguished name of the entry being modified by this {@code
-   * ChangeRecord}.
-   *
-   * @return The distinguished name of the entry being modified.
-   */
-  DN getName();
+    /**
+     * Returns the distinguished name of the entry being modified by this
+     * {@code ChangeRecord}.
+     *
+     * @return The distinguished name of the entry being modified.
+     */
+    DN getName();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java
index 3173766..908fb7d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.Closeable;
 import java.io.IOException;
-import java.util.*;
-
-
+import java.util.NoSuchElementException;
 
 /**
  * An interface for reading change records from a data source, typically an LDIF
@@ -47,46 +42,41 @@
  * <li>Any synchronization limitations.
  * </ul>
  */
-public interface ChangeRecordReader extends Closeable
-{
+public interface ChangeRecordReader extends Closeable {
 
-  /**
-   * Closes this change record reader if it not already closed. Note that this
-   * method does not need to be called if a previous call of
-   * {@link #readChangeRecord()} has returned {@code null}.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while closing.
-   */
-  @Override
-  void close() throws IOException;
+    /**
+     * Closes this change record reader if it not already closed. Note that this
+     * method does not need to be called if a previous call of
+     * {@link #readChangeRecord()} has returned {@code null}.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while closing.
+     */
+    @Override
+    void close() throws IOException;
 
+    /**
+     * Returns {@code true} if this reader contains another change record,
+     * blocking if necessary until either the next change record is available or
+     * the end of the stream is reached.
+     *
+     * @return {@code true} if this reader contains another change record.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean hasNext() throws IOException;
 
-
-  /**
-   * Returns {@code true} if this reader contains another change record,
-   * blocking if necessary until either the next change record is available or
-   * the end of the stream is reached.
-   *
-   * @return {@code true} if this reader contains another change record.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean hasNext() throws IOException;
-
-
-
-  /**
-   * Reads the next change record, blocking if necessary until a change record
-   * is available. If the next change record does not contain a change type then
-   * it will be treated as an {@code Add} change record.
-   *
-   * @return The next change record.
-   * @throws IOException
-   *           If an unexpected IO error occurred while reading the change
-   *           record.
-   * @throws NoSuchElementException
-   *           If this reader does not contain any more change records.
-   */
-  ChangeRecord readChangeRecord() throws IOException;
+    /**
+     * Reads the next change record, blocking if necessary until a change record
+     * is available. If the next change record does not contain a change type
+     * then it will be treated as an {@code Add} change record.
+     *
+     * @return The next change record.
+     * @throws IOException
+     *             If an unexpected IO error occurred while reading the change
+     *             record.
+     * @throws NoSuchElementException
+     *             If this reader does not contain any more change records.
+     */
+    ChangeRecord readChangeRecord() throws IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java
index 00f73b4..4d957b2 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,15 +26,11 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import org.forgerock.opendj.ldap.requests.AddRequest;
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 
-
-
 /**
  * A visitor of {@code ChangeRecord}s, in the style of the visitor design
  * pattern.
@@ -45,65 +40,58 @@
  * corresponding visit method most applicable to that change record is invoked.
  *
  * @param <R>
- *          The return type of this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need to return
- *          results.
+ *            The return type of this visitor's methods. Use
+ *            {@link java.lang.Void} for visitors that do not need to return
+ *            results.
  * @param <P>
- *          The type of the additional parameter to this visitor's methods. Use
- *          {@link java.lang.Void} for visitors that do not need an additional
- *          parameter.
+ *            The type of the additional parameter to this visitor's methods.
+ *            Use {@link java.lang.Void} for visitors that do not need an
+ *            additional parameter.
  */
-public interface ChangeRecordVisitor<R, P>
-{
+public interface ChangeRecordVisitor<R, P> {
 
-  /**
-   * Visits an {@code Add} change record.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param change
-   *          The {@code Add} change record.
-   * @return Returns a visitor specified result.
-   */
-  R visitChangeRecord(P p, AddRequest change);
+    /**
+     * Visits an {@code Add} change record.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param change
+     *            The {@code Add} change record.
+     * @return Returns a visitor specified result.
+     */
+    R visitChangeRecord(P p, AddRequest change);
 
+    /**
+     * Visits an {@code Delete} change record.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param change
+     *            The {@code Delete} change record.
+     * @return Returns a visitor specified result.
+     */
+    R visitChangeRecord(P p, DeleteRequest change);
 
+    /**
+     * Visits an {@code ModifyDN} change record.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param change
+     *            The {@code ModifyDN} change record.
+     * @return Returns a visitor specified result.
+     */
+    R visitChangeRecord(P p, ModifyDNRequest change);
 
-  /**
-   * Visits an {@code Delete} change record.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param change
-   *          The {@code Delete} change record.
-   * @return Returns a visitor specified result.
-   */
-  R visitChangeRecord(P p, DeleteRequest change);
-
-
-
-  /**
-   * Visits an {@code ModifyDN} change record.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param change
-   *          The {@code ModifyDN} change record.
-   * @return Returns a visitor specified result.
-   */
-  R visitChangeRecord(P p, ModifyDNRequest change);
-
-
-
-  /**
-   * Visits an {@code Modify} change record.
-   *
-   * @param p
-   *          A visitor specified parameter.
-   * @param change
-   *          The {@code Modify} change record.
-   * @return Returns a visitor specified result.
-   */
-  R visitChangeRecord(P p, ModifyRequest change);
+    /**
+     * Visits an {@code Modify} change record.
+     *
+     * @param p
+     *            A visitor specified parameter.
+     * @param change
+     *            The {@code Modify} change record.
+     * @return Returns a visitor specified result.
+     */
+    R visitChangeRecord(P p, ModifyRequest change);
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java
index 3219137..26a96ce 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.requests.AddRequest;
@@ -36,97 +33,60 @@
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 
-
-
 /**
  * A visitor which can be used to write generic change records.
  */
 final class ChangeRecordVisitorWriter implements
-    ChangeRecordVisitor<IOException, ChangeRecordWriter>
-{
-  // Visitor used for writing generic change records.
-  private static final ChangeRecordVisitorWriter VISITOR = new ChangeRecordVisitorWriter();
+        ChangeRecordVisitor<IOException, ChangeRecordWriter> {
+    // Visitor used for writing generic change records.
+    private static final ChangeRecordVisitorWriter VISITOR = new ChangeRecordVisitorWriter();
 
-
-
-  /**
-   * Returns the singleton instance.
-   *
-   * @return The instance.
-   */
-  static ChangeRecordVisitorWriter getInstance()
-  {
-    return VISITOR;
-  }
-
-
-
-  private ChangeRecordVisitorWriter()
-  {
-    // Nothing to do.
-  }
-
-
-
-  public IOException visitChangeRecord(final ChangeRecordWriter p,
-      final AddRequest change)
-  {
-    try
-    {
-      p.writeChangeRecord(change);
-      return null;
+    /**
+     * Returns the singleton instance.
+     *
+     * @return The instance.
+     */
+    static ChangeRecordVisitorWriter getInstance() {
+        return VISITOR;
     }
-    catch (final IOException e)
-    {
-      return e;
+
+    private ChangeRecordVisitorWriter() {
+        // Nothing to do.
     }
-  }
 
-
-
-  public IOException visitChangeRecord(final ChangeRecordWriter p,
-      final DeleteRequest change)
-  {
-    try
-    {
-      p.writeChangeRecord(change);
-      return null;
+    public IOException visitChangeRecord(final ChangeRecordWriter p, final AddRequest change) {
+        try {
+            p.writeChangeRecord(change);
+            return null;
+        } catch (final IOException e) {
+            return e;
+        }
     }
-    catch (final IOException e)
-    {
-      return e;
+
+    public IOException visitChangeRecord(final ChangeRecordWriter p, final DeleteRequest change) {
+        try {
+            p.writeChangeRecord(change);
+            return null;
+        } catch (final IOException e) {
+            return e;
+        }
     }
-  }
 
-
-
-  public IOException visitChangeRecord(final ChangeRecordWriter p,
-      final ModifyDNRequest change)
-  {
-    try
-    {
-      p.writeChangeRecord(change);
-      return null;
+    public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyDNRequest change) {
+        try {
+            p.writeChangeRecord(change);
+            return null;
+        } catch (final IOException e) {
+            return e;
+        }
     }
-    catch (final IOException e)
-    {
-      return e;
-    }
-  }
 
-
-
-  public IOException visitChangeRecord(final ChangeRecordWriter p,
-      final ModifyRequest change)
-  {
-    try
-    {
-      p.writeChangeRecord(change);
-      return null;
+    public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyRequest change) {
+        try {
+            p.writeChangeRecord(change);
+            return null;
+        } catch (final IOException e) {
+            return e;
+        }
     }
-    catch (final IOException e)
-    {
-      return e;
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java
index e98557d..ca8efb8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.Closeable;
 import java.io.Flushable;
 import java.io.IOException;
@@ -39,141 +36,121 @@
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 
-
-
 /**
  * An interface for writing change records to a data source, typically an LDIF
  * file.
  */
-public interface ChangeRecordWriter extends Closeable, Flushable
-{
-  /**
-   * Closes this change record writer, flushing it first. Closing a previously
-   * closed change record writer has no effect.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while closing.
-   */
-  void close() throws IOException;
+public interface ChangeRecordWriter extends Closeable, Flushable {
+    /**
+     * Closes this change record writer, flushing it first. Closing a previously
+     * closed change record writer has no effect.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while closing.
+     */
+    void close() throws IOException;
 
+    /**
+     * Flushes this change record writer so that any buffered data is written
+     * immediately to underlying stream, flushing the stream if it is also
+     * {@code Flushable}.
+     * <p>
+     * If the intended destination of this stream is an abstraction provided by
+     * the underlying operating system, for example a file, then flushing the
+     * stream guarantees only that bytes previously written to the stream are
+     * passed to the operating system for writing; it does not guarantee that
+     * they are actually written to a physical device such as a disk drive.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while flushing.
+     */
+    void flush() throws IOException;
 
+    /**
+     * Writes an {@code Add} change record.
+     *
+     * @param change
+     *            The {@code AddRequest} to be written as an {@code Add} change
+     *            record.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the change
+     *             record.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    ChangeRecordWriter writeChangeRecord(AddRequest change) throws IOException;
 
-  /**
-   * Flushes this change record writer so that any buffered data is written
-   * immediately to underlying stream, flushing the stream if it is also {@code
-   * Flushable}.
-   * <p>
-   * If the intended destination of this stream is an abstraction provided by
-   * the underlying operating system, for example a file, then flushing the
-   * stream guarantees only that bytes previously written to the stream are
-   * passed to the operating system for writing; it does not guarantee that they
-   * are actually written to a physical device such as a disk drive.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while flushing.
-   */
-  void flush() throws IOException;
+    /**
+     * Writes a change record.
+     *
+     * @param change
+     *            The {@code ChangeRecord} to be written.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the change
+     *             record.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    ChangeRecordWriter writeChangeRecord(ChangeRecord change) throws IOException;
 
+    /**
+     * Writes a {@code Delete} change record.
+     *
+     * @param change
+     *            The {@code DeleteRequest} to be written as an {@code Delete}
+     *            change record.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the change
+     *             record.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    ChangeRecordWriter writeChangeRecord(DeleteRequest change) throws IOException;
 
+    /**
+     * Writes a {@code ModifyDN} change record.
+     *
+     * @param change
+     *            The {@code ModifyDNRequest} to be written as an
+     *            {@code ModifyDN} change record.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the change
+     *             record.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    ChangeRecordWriter writeChangeRecord(ModifyDNRequest change) throws IOException;
 
-  /**
-   * Writes an {@code Add} change record.
-   *
-   * @param change
-   *          The {@code AddRequest} to be written as an {@code Add} change
-   *          record.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the change
-   *           record.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  ChangeRecordWriter writeChangeRecord(AddRequest change) throws IOException;
+    /**
+     * Writes a {@code Modify} change record.
+     *
+     * @param change
+     *            The {@code ModifyRequest} to be written as an {@code Modify}
+     *            change record.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the change
+     *             record.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    ChangeRecordWriter writeChangeRecord(ModifyRequest change) throws IOException;
 
-
-
-  /**
-   * Writes a change record.
-   *
-   * @param change
-   *          The {@code ChangeRecord} to be written.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the change
-   *           record.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  ChangeRecordWriter writeChangeRecord(ChangeRecord change) throws IOException;
-
-
-
-  /**
-   * Writes a {@code Delete} change record.
-   *
-   * @param change
-   *          The {@code DeleteRequest} to be written as an {@code Delete}
-   *          change record.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the change
-   *           record.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  ChangeRecordWriter writeChangeRecord(DeleteRequest change)
-      throws IOException;
-
-
-
-  /**
-   * Writes a {@code ModifyDN} change record.
-   *
-   * @param change
-   *          The {@code ModifyDNRequest} to be written as an {@code ModifyDN}
-   *          change record.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the change
-   *           record.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  ChangeRecordWriter writeChangeRecord(ModifyDNRequest change)
-      throws IOException;
-
-
-
-  /**
-   * Writes a {@code Modify} change record.
-   *
-   * @param change
-   *          The {@code ModifyRequest} to be written as an {@code Modify}
-   *          change record.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the change
-   *           record.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  ChangeRecordWriter writeChangeRecord(ModifyRequest change)
-      throws IOException;
-
-
-
-  /**
-   * Writes a comment.
-   *
-   * @param comment
-   *          The {@code CharSequence} to be written as a comment.
-   * @return A reference to this change record writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the comment.
-   * @throws NullPointerException
-   *           If {@code comment} was {@code null}.
-   */
-  ChangeRecordWriter writeComment(CharSequence comment) throws IOException;
+    /**
+     * Writes a comment.
+     *
+     * @param comment
+     *            The {@code CharSequence} to be written as a comment.
+     * @return A reference to this change record writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the comment.
+     * @throws NullPointerException
+     *             If {@code comment} was {@code null}.
+     */
+    ChangeRecordWriter writeComment(CharSequence comment) throws IOException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java
index 086cead..b6432de 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.IOException;
 import java.io.InterruptedIOException;
 
@@ -43,8 +40,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A {@code ConnectionChangeRecordWriter} is a bridge from {@code Connection}s
  * to {@code ChangeRecordWriter}s. A connection change record writer writes
@@ -59,262 +54,202 @@
  * <b>Note:</b> comments are not supported by connection change record writers.
  * Attempts to write comments will be ignored.
  */
-public final class ConnectionChangeRecordWriter implements ChangeRecordWriter
-{
-  private final Connection connection;
+public final class ConnectionChangeRecordWriter implements ChangeRecordWriter {
+    private final Connection connection;
 
-
-
-  /**
-   * Creates a new connection change record writer whose destination is the
-   * provided connection.
-   *
-   * @param connection
-   *          The connection to use.
-   * @throws NullPointerException
-   *           If {@code connection} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter(final Connection connection)
-  {
-    Validator.ensureNotNull(connection);
-    this.connection = connection;
-  }
-
-
-
-  /**
-   * Closes this connection change record writer, including the underlying
-   * connection. Closing a previously closed change record writer has no effect.
-   */
-  public void close()
-  {
-    connection.close();
-  }
-
-
-
-  /**
-   * Connection change record writers do not require flushing, so this method
-   * has no effect.
-   */
-  public void flush()
-  {
-    // Do nothing.
-  }
-
-
-
-  /**
-   * Writes the provided Add request to the underlying connection, blocking
-   * until the request completes.
-   *
-   * @param change
-   *          The {@code AddRequest} to be written.
-   * @return A reference to this connection change record writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change)
-      throws ErrorResultIOException, InterruptedIOException
-  {
-    Validator.ensureNotNull(change);
-    try
-    {
-      connection.add(change);
+    /**
+     * Creates a new connection change record writer whose destination is the
+     * provided connection.
+     *
+     * @param connection
+     *            The connection to use.
+     * @throws NullPointerException
+     *             If {@code connection} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter(final Connection connection) {
+        Validator.ensureNotNull(connection);
+        this.connection = connection;
     }
-    catch (final ErrorResultException e)
-    {
-      throw new ErrorResultIOException(e);
+
+    /**
+     * Closes this connection change record writer, including the underlying
+     * connection. Closing a previously closed change record writer has no
+     * effect.
+     */
+    public void close() {
+        connection.close();
     }
-    catch (final InterruptedException e)
-    {
-      throw new InterruptedIOException(e.getMessage());
+
+    /**
+     * Connection change record writers do not require flushing, so this method
+     * has no effect.
+     */
+    public void flush() {
+        // Do nothing.
     }
-    return this;
-  }
 
-
-
-  /**
-   * Writes the provided change record to the underlying connection, blocking
-   * until the request completes.
-   *
-   * @param change
-   *          The change record to be written.
-   * @return A reference to this connection change record writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeChangeRecord(
-      final ChangeRecord change) throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    Validator.ensureNotNull(change);
-
-    final IOException e = change.accept(
-        ChangeRecordVisitorWriter.getInstance(), this);
-    try
-    {
-      if (e != null)
-      {
-        throw e;
-      }
+    /**
+     * Writes the provided Add request to the underlying connection, blocking
+     * until the request completes.
+     *
+     * @param change
+     *            The {@code AddRequest} to be written.
+     * @return A reference to this connection change record writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change)
+            throws ErrorResultIOException, InterruptedIOException {
+        Validator.ensureNotNull(change);
+        try {
+            connection.add(change);
+        } catch (final ErrorResultException e) {
+            throw new ErrorResultIOException(e);
+        } catch (final InterruptedException e) {
+            throw new InterruptedIOException(e.getMessage());
+        }
+        return this;
     }
-    catch (final ErrorResultIOException e1)
-    {
-      throw e1;
+
+    /**
+     * Writes the provided change record to the underlying connection, blocking
+     * until the request completes.
+     *
+     * @param change
+     *            The change record to be written.
+     * @return A reference to this connection change record writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change)
+            throws ErrorResultIOException, InterruptedIOException {
+        Validator.ensureNotNull(change);
+
+        final IOException e = change.accept(ChangeRecordVisitorWriter.getInstance(), this);
+        try {
+            if (e != null) {
+                throw e;
+            }
+        } catch (final ErrorResultIOException e1) {
+            throw e1;
+        } catch (final InterruptedIOException e1) {
+            throw e1;
+        } catch (final IOException e1) {
+            // Should not happen.
+            throw new RuntimeException(e1);
+        }
+        return this;
     }
-    catch (final InterruptedIOException e1)
-    {
-      throw e1;
+
+    /**
+     * Writes the provided Delete request to the underlying connection, blocking
+     * until the request completes.
+     *
+     * @param change
+     *            The {@code DeleteRequest} to be written.
+     * @return A reference to this connection change record writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change)
+            throws ErrorResultIOException, InterruptedIOException {
+        Validator.ensureNotNull(change);
+        try {
+            connection.delete(change);
+        } catch (final ErrorResultException e) {
+            throw new ErrorResultIOException(e);
+        } catch (final InterruptedException e) {
+            throw new InterruptedIOException(e.getMessage());
+        }
+        return this;
     }
-    catch (final IOException e1)
-    {
-      // Should not happen.
-      throw new RuntimeException(e1);
+
+    /**
+     * Writes the provided ModifyDN request to the underlying connection,
+     * blocking until the request completes.
+     *
+     * @param change
+     *            The {@code ModifyDNRequest} to be written.
+     * @return A reference to this connection change record writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest change)
+            throws ErrorResultIOException, InterruptedIOException {
+        Validator.ensureNotNull(change);
+        try {
+            connection.modifyDN(change);
+        } catch (final ErrorResultException e) {
+            throw new ErrorResultIOException(e);
+        } catch (final InterruptedException e) {
+            throw new InterruptedIOException(e.getMessage());
+        }
+        return this;
     }
-    return this;
-  }
 
-
-
-  /**
-   * Writes the provided Delete request to the underlying connection, blocking
-   * until the request completes.
-   *
-   * @param change
-   *          The {@code DeleteRequest} to be written.
-   * @return A reference to this connection change record writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeChangeRecord(
-      final DeleteRequest change) throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    Validator.ensureNotNull(change);
-    try
-    {
-      connection.delete(change);
+    /**
+     * Writes the provided Modify request to the underlying connection, blocking
+     * until the request completes.
+     *
+     * @param change
+     *            The {@code ModifyRequest} to be written.
+     * @return A reference to this connection change record writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code change} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change)
+            throws ErrorResultIOException, InterruptedIOException {
+        Validator.ensureNotNull(change);
+        try {
+            connection.modify(change);
+        } catch (final ErrorResultException e) {
+            throw new ErrorResultIOException(e);
+        } catch (final InterruptedException e) {
+            throw new InterruptedIOException(e.getMessage());
+        }
+        return this;
     }
-    catch (final ErrorResultException e)
-    {
-      throw new ErrorResultIOException(e);
+
+    /**
+     * Connection change record writers do not support comments, so the provided
+     * comment will be ignored.
+     *
+     * @param comment
+     *            The {@code CharSequence} to be written as a comment.
+     * @return A reference to this connection change record writer.
+     * @throws NullPointerException
+     *             If {@code comment} was {@code null}.
+     */
+    public ConnectionChangeRecordWriter writeComment(final CharSequence comment) {
+        Validator.ensureNotNull(comment);
+
+        // Do nothing.
+        return this;
     }
-    catch (final InterruptedException e)
-    {
-      throw new InterruptedIOException(e.getMessage());
-    }
-    return this;
-  }
-
-
-
-  /**
-   * Writes the provided ModifyDN request to the underlying connection, blocking
-   * until the request completes.
-   *
-   * @param change
-   *          The {@code ModifyDNRequest} to be written.
-   * @return A reference to this connection change record writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeChangeRecord(
-      final ModifyDNRequest change) throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    Validator.ensureNotNull(change);
-    try
-    {
-      connection.modifyDN(change);
-    }
-    catch (final ErrorResultException e)
-    {
-      throw new ErrorResultIOException(e);
-    }
-    catch (final InterruptedException e)
-    {
-      throw new InterruptedIOException(e.getMessage());
-    }
-    return this;
-  }
-
-
-
-  /**
-   * Writes the provided Modify request to the underlying connection, blocking
-   * until the request completes.
-   *
-   * @param change
-   *          The {@code ModifyRequest} to be written.
-   * @return A reference to this connection change record writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code change} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeChangeRecord(
-      final ModifyRequest change) throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    Validator.ensureNotNull(change);
-    try
-    {
-      connection.modify(change);
-    }
-    catch (final ErrorResultException e)
-    {
-      throw new ErrorResultIOException(e);
-    }
-    catch (final InterruptedException e)
-    {
-      throw new InterruptedIOException(e.getMessage());
-    }
-    return this;
-  }
-
-
-
-  /**
-   * Connection change record writers do not support comments, so the provided
-   * comment will be ignored.
-   *
-   * @param comment
-   *          The {@code CharSequence} to be written as a comment.
-   * @return A reference to this connection change record writer.
-   * @throws NullPointerException
-   *           If {@code comment} was {@code null}.
-   */
-  public ConnectionChangeRecordWriter writeComment(final CharSequence comment)
-  {
-    Validator.ensureNotNull(comment);
-
-    // Do nothing.
-    return this;
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java
index bc8b622..265467c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.io.InterruptedIOException;
@@ -38,14 +35,22 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.ErrorResultIOException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchResultReferenceIOException;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.responses.Response;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A {@code ConnectionEntryReader} is a bridge from {@code Connection}s to
  * {@code EntryReader}s. A connection entry reader allows applications to
@@ -94,362 +99,288 @@
  * }
  * </pre>
  */
-public final class ConnectionEntryReader implements EntryReader
-{
+public final class ConnectionEntryReader implements EntryReader {
 
-  /**
-   * Result handler that places all responses in a queue.
-   */
-  private final static class BufferHandler implements SearchResultHandler
-  {
-    private final BlockingQueue<Response> responses;
-    private volatile boolean isInterrupted = false;
+    /**
+     * Result handler that places all responses in a queue.
+     */
+    private final static class BufferHandler implements SearchResultHandler {
+        private final BlockingQueue<Response> responses;
+        private volatile boolean isInterrupted = false;
 
+        private BufferHandler(final BlockingQueue<Response> responses) {
+            this.responses = responses;
+        }
 
+        @Override
+        public boolean handleEntry(final SearchResultEntry entry) {
+            try {
+                responses.put(entry);
+                return true;
+            } catch (final InterruptedException e) {
+                // Prevent the reader from waiting for a result that will never
+                // arrive.
+                isInterrupted = true;
 
-    private BufferHandler(final BlockingQueue<Response> responses)
-    {
-      this.responses = responses;
+                Thread.currentThread().interrupt();
+                return false;
+            }
+        }
+
+        @Override
+        public void handleErrorResult(final ErrorResultException error) {
+            try {
+                responses.put(error.getResult());
+            } catch (final InterruptedException e) {
+                // Prevent the reader from waiting for a result that will never
+                // arrive.
+                isInterrupted = true;
+
+                Thread.currentThread().interrupt();
+            }
+        }
+
+        @Override
+        public boolean handleReference(final SearchResultReference reference) {
+            try {
+                responses.put(reference);
+                return true;
+            } catch (final InterruptedException e) {
+                // Prevent the reader from waiting for a result that will never
+                // arrive.
+                isInterrupted = true;
+
+                Thread.currentThread().interrupt();
+                return false;
+            }
+        }
+
+        @Override
+        public void handleResult(final Result result) {
+            try {
+                responses.put(result);
+            } catch (final InterruptedException e) {
+                // Prevent the reader from waiting for a result that will never
+                // arrive.
+                isInterrupted = true;
+
+                Thread.currentThread().interrupt();
+            }
+        }
     }
 
+    private final BufferHandler buffer;
+    private final FutureResult<Result> future;
+    private Response nextResponse = null;
 
+    /**
+     * Creates a new connection entry reader whose destination is the provided
+     * connection using an unbounded {@code LinkedBlockingQueue}.
+     *
+     * @param connection
+     *            The connection to use.
+     * @param searchRequest
+     *            The search request to retrieve entries with.
+     * @throws NullPointerException
+     *             If {@code connection} was {@code null}.
+     */
+    public ConnectionEntryReader(final Connection connection, final SearchRequest searchRequest) {
+        this(connection, searchRequest, new LinkedBlockingQueue<Response>());
+    }
 
+    /**
+     * Creates a new connection entry reader whose destination is the provided
+     * connection.
+     *
+     * @param connection
+     *            The connection to use.
+     * @param searchRequest
+     *            The search request to retrieve entries with.
+     * @param entries
+     *            The {@code BlockingQueue} implementation to use when queuing
+     *            the returned entries.
+     * @throws NullPointerException
+     *             If {@code connection} was {@code null}.
+     */
+    public ConnectionEntryReader(final Connection connection, final SearchRequest searchRequest,
+            final BlockingQueue<Response> entries) {
+        Validator.ensureNotNull(connection);
+        buffer = new BufferHandler(entries);
+        future = connection.searchAsync(searchRequest, null, buffer);
+    }
+
+    /**
+     * Closes this connection entry reader, cancelling the search request if it
+     * is still active.
+     */
     @Override
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      try
-      {
-        responses.put(entry);
-        return true;
-      }
-      catch (final InterruptedException e)
-      {
-        // Prevent the reader from waiting for a result that will never arrive.
-        isInterrupted = true;
-
-        Thread.currentThread().interrupt();
-        return false;
-      }
+    public void close() {
+        // Cancel the search if it is still running.
+        future.cancel(true);
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      try
-      {
-        responses.put(error.getResult());
-      }
-      catch (final InterruptedException e)
-      {
-        // Prevent the reader from waiting for a result that will never arrive.
-        isInterrupted = true;
+    public boolean hasNext() throws ErrorResultIOException, InterruptedIOException {
+        // Poll for the next response if needed.
+        final Response r = getNextResponse();
+        if (!(r instanceof Result)) {
+            // Entry or reference.
+            return true;
+        }
 
-        Thread.currentThread().interrupt();
-      }
+        // Final result.
+        final Result result = (Result) r;
+        if (result.isSuccess()) {
+            return false;
+        }
+
+        throw new ErrorResultIOException(newErrorResult(result));
     }
 
+    /**
+     * Waits for the next search result entry or reference to become available
+     * and returns {@code true} if it is an entry, or {@code false} if it is a
+     * reference.
+     *
+     * @return {@code true} if the next search result is an entry, or
+     *         {@code false} if it is a reference.
+     * @throws ErrorResultIOException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             failed for some reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NoSuchElementException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             succeeded.
+     */
+    public boolean isEntry() throws ErrorResultIOException, InterruptedIOException {
+        // Throws ErrorResultIOException if search returned error.
+        if (!hasNext()) {
+            // Search has completed successfully.
+            throw new NoSuchElementException();
+        }
 
+        // Entry or reference?
+        final Response r = nextResponse;
+        if (r instanceof SearchResultEntry) {
+            return true;
+        } else if (r instanceof SearchResultReference) {
+            return false;
+        } else {
+            throw new RuntimeException("Unexpected response type: " + r.getClass().toString());
+        }
+    }
 
+    /**
+     * Waits for the next search result entry or reference to become available
+     * and returns {@code true} if it is a reference, or {@code false} if it is
+     * an entry.
+     *
+     * @return {@code true} if the next search result is a reference, or
+     *         {@code false} if it is an entry.
+     * @throws ErrorResultIOException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             failed for some reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NoSuchElementException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             succeeded.
+     */
+    public boolean isReference() throws ErrorResultIOException, InterruptedIOException {
+        return !isEntry();
+    }
+
+    /**
+     * Waits for the next search result entry or reference to become available
+     * and, if it is an entry, returns it as a {@code SearchResultEntry}. If the
+     * next search response is a reference then this method will throw a
+     * {@code SearchResultReferenceIOException}.
+     *
+     * @return The next search result entry.
+     * @throws SearchResultReferenceIOException
+     *             If the next search response was a search result reference.
+     *             This connection entry reader may still contain remaining
+     *             search results and references which can be retrieved using
+     *             additional calls to this method.
+     * @throws ErrorResultIOException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             failed for some reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NoSuchElementException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             succeeded.
+     */
     @Override
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      try
-      {
-        responses.put(reference);
-        return true;
-      }
-      catch (final InterruptedException e)
-      {
-        // Prevent the reader from waiting for a result that will never arrive.
-        isInterrupted = true;
-
-        Thread.currentThread().interrupt();
-        return false;
-      }
+    public SearchResultEntry readEntry() throws SearchResultReferenceIOException,
+            ErrorResultIOException, InterruptedIOException {
+        if (isEntry()) {
+            final SearchResultEntry entry = (SearchResultEntry) nextResponse;
+            nextResponse = null;
+            return entry;
+        } else {
+            final SearchResultReference reference = (SearchResultReference) nextResponse;
+            nextResponse = null;
+            throw new SearchResultReferenceIOException(reference);
+        }
     }
 
-
-
-    @Override
-    public void handleResult(final Result result)
-    {
-      try
-      {
-        responses.put(result);
-      }
-      catch (final InterruptedException e)
-      {
-        // Prevent the reader from waiting for a result that will never arrive.
-        isInterrupted = true;
-
-        Thread.currentThread().interrupt();
-      }
-    }
-  }
-
-
-
-  private final BufferHandler buffer;
-  private final FutureResult<Result> future;
-  private Response nextResponse = null;
-
-
-
-  /**
-   * Creates a new connection entry reader whose destination is the provided
-   * connection using an unbounded {@code LinkedBlockingQueue}.
-   *
-   * @param connection
-   *          The connection to use.
-   * @param searchRequest
-   *          The search request to retrieve entries with.
-   * @throws NullPointerException
-   *           If {@code connection} was {@code null}.
-   */
-  public ConnectionEntryReader(final Connection connection,
-      final SearchRequest searchRequest)
-  {
-    this(connection, searchRequest, new LinkedBlockingQueue<Response>());
-  }
-
-
-
-  /**
-   * Creates a new connection entry reader whose destination is the provided
-   * connection.
-   *
-   * @param connection
-   *          The connection to use.
-   * @param searchRequest
-   *          The search request to retrieve entries with.
-   * @param entries
-   *          The {@code BlockingQueue} implementation to use when queuing the
-   *          returned entries.
-   * @throws NullPointerException
-   *           If {@code connection} was {@code null}.
-   */
-  public ConnectionEntryReader(final Connection connection,
-      final SearchRequest searchRequest, final BlockingQueue<Response> entries)
-  {
-    Validator.ensureNotNull(connection);
-    buffer = new BufferHandler(entries);
-    future = connection.searchAsync(searchRequest, null, buffer);
-  }
-
-
-
-  /**
-   * Closes this connection entry reader, cancelling the search request if it is
-   * still active.
-   */
-  @Override
-  public void close()
-  {
-    // Cancel the search if it is still running.
-    future.cancel(true);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean hasNext() throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    // Poll for the next response if needed.
-    final Response r = getNextResponse();
-    if (!(r instanceof Result))
-    {
-      // Entry or reference.
-      return true;
+    /**
+     * Waits for the next search result entry or reference to become available
+     * and, if it is a reference, returns it as a {@code SearchResultReference}.
+     * If the next search response is an entry then this method will return
+     * {@code null}.
+     *
+     * @return The next search result reference, or {@code null} if the next
+     *         response was a search result entry.
+     * @throws ErrorResultIOException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             failed for some reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NoSuchElementException
+     *             If there are no more search result entries or references and
+     *             the search result code indicates that the search operation
+     *             succeeded.
+     */
+    public SearchResultReference readReference() throws ErrorResultIOException,
+            InterruptedIOException {
+        if (isReference()) {
+            final SearchResultReference reference = (SearchResultReference) nextResponse;
+            nextResponse = null;
+            return reference;
+        } else {
+            return null;
+        }
     }
 
-    // Final result.
-    final Result result = (Result) r;
-    if (result.isSuccess())
-    {
-      return false;
+    private Response getNextResponse() throws InterruptedIOException {
+        while (nextResponse == null) {
+            try {
+                nextResponse = buffer.responses.poll(50, TimeUnit.MILLISECONDS);
+            } catch (final InterruptedException e) {
+                throw new InterruptedIOException(e.getMessage());
+            }
+
+            if (nextResponse == null && buffer.isInterrupted) {
+                // The worker thread processing the result was interrupted so no
+                // result will ever arrive. We don't want to hang this thread
+                // forever while we wait, so terminate now.
+                nextResponse = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR);
+                break;
+            }
+        }
+        return nextResponse;
     }
-
-    throw new ErrorResultIOException(newErrorResult(result));
-  }
-
-
-
-  /**
-   * Waits for the next search result entry or reference to become available and
-   * returns {@code true} if it is an entry, or {@code false} if it is a
-   * reference.
-   *
-   * @return {@code true} if the next search result is an entry, or
-   *         {@code false} if it is a reference.
-   * @throws ErrorResultIOException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation failed for
-   *           some reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NoSuchElementException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation succeeded.
-   */
-  public boolean isEntry() throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    // Throws ErrorResultIOException if search returned error.
-    if (!hasNext())
-    {
-      // Search has completed successfully.
-      throw new NoSuchElementException();
-    }
-
-    // Entry or reference?
-    final Response r = nextResponse;
-    if (r instanceof SearchResultEntry)
-    {
-      return true;
-    }
-    else if (r instanceof SearchResultReference)
-    {
-      return false;
-    }
-    else
-    {
-      throw new RuntimeException("Unexpected response type: "
-          + r.getClass().toString());
-    }
-  }
-
-
-
-  /**
-   * Waits for the next search result entry or reference to become available and
-   * returns {@code true} if it is a reference, or {@code false} if it is an
-   * entry.
-   *
-   * @return {@code true} if the next search result is a reference, or
-   *         {@code false} if it is an entry.
-   * @throws ErrorResultIOException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation failed for
-   *           some reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NoSuchElementException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation succeeded.
-   */
-  public boolean isReference() throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    return !isEntry();
-  }
-
-
-
-  /**
-   * Waits for the next search result entry or reference to become available
-   * and, if it is an entry, returns it as a {@code SearchResultEntry}. If the
-   * next search response is a reference then this method will throw a
-   * {@code SearchResultReferenceIOException}.
-   *
-   * @return The next search result entry.
-   * @throws SearchResultReferenceIOException
-   *           If the next search response was a search result reference. This
-   *           connection entry reader may still contain remaining search
-   *           results and references which can be retrieved using additional
-   *           calls to this method.
-   * @throws ErrorResultIOException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation failed for
-   *           some reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NoSuchElementException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation succeeded.
-   */
-  @Override
-  public SearchResultEntry readEntry() throws SearchResultReferenceIOException,
-      ErrorResultIOException, InterruptedIOException
-  {
-    if (isEntry())
-    {
-      final SearchResultEntry entry = (SearchResultEntry) nextResponse;
-      nextResponse = null;
-      return entry;
-    }
-    else
-    {
-      final SearchResultReference reference = (SearchResultReference) nextResponse;
-      nextResponse = null;
-      throw new SearchResultReferenceIOException(reference);
-    }
-  }
-
-
-
-  /**
-   * Waits for the next search result entry or reference to become available
-   * and, if it is a reference, returns it as a {@code SearchResultReference}.
-   * If the next search response is an entry then this method will return
-   * {@code null}.
-   *
-   * @return The next search result reference, or {@code null} if the next
-   *         response was a search result entry.
-   * @throws ErrorResultIOException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation failed for
-   *           some reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NoSuchElementException
-   *           If there are no more search result entries or references and the
-   *           search result code indicates that the search operation succeeded.
-   */
-  public SearchResultReference readReference() throws ErrorResultIOException,
-      InterruptedIOException
-  {
-    if (isReference())
-    {
-      final SearchResultReference reference = (SearchResultReference) nextResponse;
-      nextResponse = null;
-      return reference;
-    }
-    else
-    {
-      return null;
-    }
-  }
-
-
-
-  private Response getNextResponse() throws InterruptedIOException
-  {
-    while (nextResponse == null)
-    {
-      try
-      {
-        nextResponse = buffer.responses.poll(50, TimeUnit.MILLISECONDS);
-      }
-      catch (final InterruptedException e)
-      {
-        throw new InterruptedIOException(e.getMessage());
-      }
-
-      if (nextResponse == null && buffer.isInterrupted)
-      {
-        // The worker thread processing the result was interrupted so no
-        // result will ever arrive. We don't want to hang this thread
-        // forever while we wait, so terminate now.
-        nextResponse = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR);
-        break;
-      }
-    }
-    return nextResponse;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java
index 121fd7e..7960a5d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.InterruptedIOException;
 
 import org.forgerock.opendj.ldap.Connection;
@@ -39,8 +36,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A {@code ConnectionEntryWriter} is a bridge from {@code Connection}s to
  * {@code EntryWriter}s. A connection entry writer writes entries by sending Add
@@ -48,109 +43,88 @@
  * <p>
  * All Add requests are performed synchronously, blocking until an Add result is
  * received. If an Add result indicates that an Add request has failed for some
- * reason then the error result is propagated to the caller using an {@code
- * ErrorResultIOException}.
+ * reason then the error result is propagated to the caller using an
+ * {@code ErrorResultIOException}.
  * <p>
  * <b>Note:</b> comments are not supported by connection change record writers.
  * Attempts to write comments will be ignored.
  */
-public final class ConnectionEntryWriter implements EntryWriter
-{
-  private final Connection connection;
+public final class ConnectionEntryWriter implements EntryWriter {
+    private final Connection connection;
 
-
-
-  /**
-   * Creates a new connection entry writer whose destination is the provided
-   * connection.
-   *
-   * @param connection
-   *          The connection to use.
-   * @throws NullPointerException
-   *           If {@code connection} was {@code null}.
-   */
-  public ConnectionEntryWriter(final Connection connection)
-  {
-    Validator.ensureNotNull(connection);
-    this.connection = connection;
-  }
-
-
-
-  /**
-   * Closes this connection entry writer, including the underlying connection.
-   * Closing a previously closed entry writer has no effect.
-   */
-  public void close()
-  {
-    connection.close();
-  }
-
-
-
-  /**
-   * Connection entry writers do not require flushing, so this method has no
-   * effect.
-   */
-  public void flush()
-  {
-    // Do nothing.
-  }
-
-
-
-  /**
-   * Connection entry writers do not support comments, so the provided comment
-   * will be ignored.
-   *
-   * @param comment
-   *          The {@code CharSequence} to be written as a comment.
-   * @return A reference to this connection entry writer.
-   * @throws NullPointerException
-   *           If {@code comment} was {@code null}.
-   */
-  public ConnectionEntryWriter writeComment(final CharSequence comment)
-  {
-    Validator.ensureNotNull(comment);
-
-    // Do nothing.
-    return this;
-  }
-
-
-
-  /**
-   * Writes an entry to the underlying connection using an Add request, blocking
-   * until the request completes.
-   *
-   * @param entry
-   *          The {@code Entry} to be written.
-   * @return A reference to this connection entry writer.
-   * @throws ErrorResultIOException
-   *           If the result code indicates that the request failed for some
-   *           reason.
-   * @throws InterruptedIOException
-   *           If the current thread was interrupted while waiting.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  public ConnectionEntryWriter writeEntry(final Entry entry)
-      throws ErrorResultIOException, InterruptedIOException
-  {
-    Validator.ensureNotNull(entry);
-    try
-    {
-      connection.add(entry);
+    /**
+     * Creates a new connection entry writer whose destination is the provided
+     * connection.
+     *
+     * @param connection
+     *            The connection to use.
+     * @throws NullPointerException
+     *             If {@code connection} was {@code null}.
+     */
+    public ConnectionEntryWriter(final Connection connection) {
+        Validator.ensureNotNull(connection);
+        this.connection = connection;
     }
-    catch (final ErrorResultException e)
-    {
-      throw new ErrorResultIOException(e);
+
+    /**
+     * Closes this connection entry writer, including the underlying connection.
+     * Closing a previously closed entry writer has no effect.
+     */
+    public void close() {
+        connection.close();
     }
-    catch (final InterruptedException e)
-    {
-      throw new InterruptedIOException(e.getMessage());
+
+    /**
+     * Connection entry writers do not require flushing, so this method has no
+     * effect.
+     */
+    public void flush() {
+        // Do nothing.
     }
-    return this;
-  }
+
+    /**
+     * Connection entry writers do not support comments, so the provided comment
+     * will be ignored.
+     *
+     * @param comment
+     *            The {@code CharSequence} to be written as a comment.
+     * @return A reference to this connection entry writer.
+     * @throws NullPointerException
+     *             If {@code comment} was {@code null}.
+     */
+    public ConnectionEntryWriter writeComment(final CharSequence comment) {
+        Validator.ensureNotNull(comment);
+
+        // Do nothing.
+        return this;
+    }
+
+    /**
+     * Writes an entry to the underlying connection using an Add request,
+     * blocking until the request completes.
+     *
+     * @param entry
+     *            The {@code Entry} to be written.
+     * @return A reference to this connection entry writer.
+     * @throws ErrorResultIOException
+     *             If the result code indicates that the request failed for some
+     *             reason.
+     * @throws InterruptedIOException
+     *             If the current thread was interrupted while waiting.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    public ConnectionEntryWriter writeEntry(final Entry entry) throws ErrorResultIOException,
+            InterruptedIOException {
+        Validator.ensureNotNull(entry);
+        try {
+            connection.add(entry);
+        } catch (final ErrorResultException e) {
+            throw new ErrorResultIOException(e);
+        } catch (final InterruptedException e) {
+            throw new InterruptedIOException(e.getMessage());
+        }
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryReader.java
index 0efffc1..2d4cd47 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,16 +27,12 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.Closeable;
 import java.io.IOException;
-import java.util.*;
+import java.util.NoSuchElementException;
 
 import org.forgerock.opendj.ldap.Entry;
 
-
-
 /**
  * An interface for reading entries from a data source, typically an LDIF file.
  * <p>
@@ -48,43 +43,38 @@
  * <li>Any synchronization limitations.
  * </ul>
  */
-public interface EntryReader extends Closeable
-{
+public interface EntryReader extends Closeable {
 
-  /**
-   * Closes this entry reader if it is not already closed. Note that this method
-   * does not need to be called if a previous call of {@link #readEntry()} has
-   * returned {@code null}.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while closing.
-   */
-  @Override
-  void close() throws IOException;
+    /**
+     * Closes this entry reader if it is not already closed. Note that this
+     * method does not need to be called if a previous call of
+     * {@link #readEntry()} has returned {@code null}.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while closing.
+     */
+    @Override
+    void close() throws IOException;
 
+    /**
+     * Returns {@code true} if this reader contains another entry, blocking if
+     * necessary until either the next entry is available or the end of the
+     * stream is reached.
+     *
+     * @return {@code true} if this reader contains another entry.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    boolean hasNext() throws IOException;
 
-
-  /**
-   * Returns {@code true} if this reader contains another entry, blocking if
-   * necessary until either the next entry is available or the end of the stream
-   * is reached.
-   *
-   * @return {@code true} if this reader contains another entry.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  boolean hasNext() throws IOException;
-
-
-
-  /**
-   * Reads the next entry, blocking if necessary until an entry is available.
-   *
-   * @return The next entry.
-   * @throws IOException
-   *           If an unexpected IO error occurred while reading the entry.
-   * @throws NoSuchElementException
-   *           If this reader does not contain any more entries.
-   */
-  Entry readEntry() throws IOException;
+    /**
+     * Reads the next entry, blocking if necessary until an entry is available.
+     *
+     * @return The next entry.
+     * @throws IOException
+     *             If an unexpected IO error occurred while reading the entry.
+     * @throws NoSuchElementException
+     *             If this reader does not contain any more entries.
+     */
+    Entry readEntry() throws IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java
index 122a168..e2c345d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,75 +27,65 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.Closeable;
 import java.io.Flushable;
 import java.io.IOException;
 
 import org.forgerock.opendj.ldap.Entry;
 
-
-
 /**
  * An interface for writing entries to a data source, typically an LDIF file.
  */
-public interface EntryWriter extends Closeable, Flushable
-{
-  /**
-   * Closes this entry writer, flushing it first. Closing a previously closed
-   * entry writer has no effect.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while closing.
-   */
-  void close() throws IOException;
+public interface EntryWriter extends Closeable, Flushable {
+    /**
+     * Closes this entry writer, flushing it first. Closing a previously closed
+     * entry writer has no effect.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while closing.
+     */
+    void close() throws IOException;
 
+    /**
+     * Flushes this entry writer so that any buffered data is written
+     * immediately to underlying stream, flushing the stream if it is also
+     * {@code Flushable}.
+     * <p>
+     * If the intended destination of this stream is an abstraction provided by
+     * the underlying operating system, for example a file, then flushing the
+     * stream guarantees only that bytes previously written to the stream are
+     * passed to the operating system for writing; it does not guarantee that
+     * they are actually written to a physical device such as a disk drive.
+     *
+     * @throws IOException
+     *             If an unexpected IO error occurred while flushing.
+     */
+    void flush() throws IOException;
 
+    /**
+     * Writes a comment.
+     *
+     * @param comment
+     *            The {@code CharSequence} to be written as a comment.
+     * @return A reference to this entry writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the comment.
+     * @throws NullPointerException
+     *             If {@code comment} was {@code null}.
+     */
+    EntryWriter writeComment(CharSequence comment) throws IOException;
 
-  /**
-   * Flushes this entry writer so that any buffered data is written immediately
-   * to underlying stream, flushing the stream if it is also {@code Flushable}.
-   * <p>
-   * If the intended destination of this stream is an abstraction provided by
-   * the underlying operating system, for example a file, then flushing the
-   * stream guarantees only that bytes previously written to the stream are
-   * passed to the operating system for writing; it does not guarantee that they
-   * are actually written to a physical device such as a disk drive.
-   *
-   * @throws IOException
-   *           If an unexpected IO error occurred while flushing.
-   */
-  void flush() throws IOException;
-
-
-
-  /**
-   * Writes a comment.
-   *
-   * @param comment
-   *          The {@code CharSequence} to be written as a comment.
-   * @return A reference to this entry writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the comment.
-   * @throws NullPointerException
-   *           If {@code comment} was {@code null}.
-   */
-  EntryWriter writeComment(CharSequence comment) throws IOException;
-
-
-
-  /**
-   * Writes an entry.
-   *
-   * @param entry
-   *          The {@code Entry} to be written.
-   * @return A reference to this entry writer.
-   * @throws IOException
-   *           If an unexpected IO error occurred while writing the entry.
-   * @throws NullPointerException
-   *           If {@code entry} was {@code null}.
-   */
-  EntryWriter writeEntry(Entry entry) throws IOException;
+    /**
+     * Writes an entry.
+     *
+     * @param entry
+     *            The {@code Entry} to be written.
+     * @return A reference to this entry writer.
+     * @throws IOException
+     *             If an unexpected IO error occurred while writing the entry.
+     * @throws NullPointerException
+     *             If {@code entry} was {@code null}.
+     */
+    EntryWriter writeEntry(Entry entry) throws IOException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIF.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIF.java
index 575ab20..d6276db 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIF.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIF.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,774 +25,604 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.REJECTED_CHANGE_FAIL_DELETE;
 import static org.forgerock.opendj.ldap.CoreMessages.REJECTED_CHANGE_FAIL_MODIFY;
 import static org.forgerock.opendj.ldap.CoreMessages.REJECTED_CHANGE_FAIL_MODIFYDN;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.Attributes;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.Matcher;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RDN;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.controls.SubtreeDeleteRequestControl;
-import org.forgerock.opendj.ldap.requests.*;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.schema.AttributeUsage;
 import org.forgerock.opendj.ldap.schema.Schema;
 
-
-
 /**
  * This class contains common utility methods for creating and manipulating
  * readers and writers.
  */
-public final class LDIF
-{
-  // @formatter:off
-  private static final class EntryIteratorReader implements EntryReader
-  {
-    private final Iterator<Entry> iterator;
-    private EntryIteratorReader(final Iterator<Entry> iterator)
-                             { this.iterator = iterator; }
-    public void close()      { }
-    public boolean hasNext() { return iterator.hasNext(); }
-    public Entry readEntry() { return iterator.next(); }
-  }
-  // @formatter:on
-
-  /**
-   * Copies the content of {@code input} to {@code output}. This method does not
-   * close {@code input} or {@code output}.
-   *
-   * @param input
-   *          The input change record reader.
-   * @param output
-   *          The output change record reader.
-   * @return The output change record reader.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  public static ChangeRecordWriter copyTo(final ChangeRecordReader input,
-      final ChangeRecordWriter output) throws IOException
-  {
-    while (input.hasNext())
-    {
-      output.writeChangeRecord(input.readChangeRecord());
+public final class LDIF {
+    // @formatter:off
+    private static final class EntryIteratorReader implements EntryReader {
+        private final Iterator<Entry> iterator;
+        private EntryIteratorReader(final Iterator<Entry> iterator) { this.iterator = iterator; }
+        public void close()      { }
+        public boolean hasNext() { return iterator.hasNext(); }
+        public Entry readEntry() { return iterator.next(); }
     }
-    return output;
-  }
+    // @formatter:on
 
-
-
-  /**
-   * Copies the content of {@code input} to {@code output}. This method does not
-   * close {@code input} or {@code output}.
-   *
-   * @param input
-   *          The input entry reader.
-   * @param output
-   *          The output entry reader.
-   * @return The output entry reader.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  public static EntryWriter copyTo(final EntryReader input,
-      final EntryWriter output) throws IOException
-  {
-    while (input.hasNext())
-    {
-      output.writeEntry(input.readEntry());
+    /**
+     * Copies the content of {@code input} to {@code output}. This method does
+     * not close {@code input} or {@code output}.
+     *
+     * @param input
+     *            The input change record reader.
+     * @param output
+     *            The output change record reader.
+     * @return The output change record reader.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    public static ChangeRecordWriter copyTo(final ChangeRecordReader input,
+            final ChangeRecordWriter output) throws IOException {
+        while (input.hasNext()) {
+            output.writeChangeRecord(input.readChangeRecord());
+        }
+        return output;
     }
-    return output;
-  }
 
-
-
-  /**
-   * Compares the content of {@code source} to the content of {@code target} and
-   * returns the differences in a change record reader. Closing the returned
-   * reader will cause {@code source} and {@code target} to be closed as well.
-   * <p>
-   * <b>NOTE:</b> this method reads the content of {@code source} and
-   * {@code target} into memory before calculating the differences, and is
-   * therefore not suited for use in cases where a very large number of entries
-   * are to be compared.
-   *
-   * @param source
-   *          The entry reader containing the source entries to be compared.
-   * @param target
-   *          The entry reader containing the target entries to be compared.
-   * @return A change record reader containing the differences.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  public static ChangeRecordReader diff(final EntryReader source,
-      final EntryReader target) throws IOException
-  {
-    final SortedMap<DN, Entry> sourceEntries = readEntries(source);
-    final SortedMap<DN, Entry> targetEntries = readEntries(target);
-    final Iterator<Entry> sourceIterator = sourceEntries.values().iterator();
-    final Iterator<Entry> targetIterator = targetEntries.values().iterator();
-
-    return new ChangeRecordReader()
-    {
-      private Entry sourceEntry = nextEntry(sourceIterator);
-      private Entry targetEntry = nextEntry(targetIterator);
-
-
-
-      @Override
-      public void close() throws IOException
-      {
-        try
-        {
-          source.close();
+    /**
+     * Copies the content of {@code input} to {@code output}. This method does
+     * not close {@code input} or {@code output}.
+     *
+     * @param input
+     *            The input entry reader.
+     * @param output
+     *            The output entry reader.
+     * @return The output entry reader.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    public static EntryWriter copyTo(final EntryReader input, final EntryWriter output)
+            throws IOException {
+        while (input.hasNext()) {
+            output.writeEntry(input.readEntry());
         }
-        finally
-        {
-          target.close();
-        }
-      }
+        return output;
+    }
 
+    /**
+     * Compares the content of {@code source} to the content of {@code target}
+     * and returns the differences in a change record reader. Closing the
+     * returned reader will cause {@code source} and {@code target} to be closed
+     * as well.
+     * <p>
+     * <b>NOTE:</b> this method reads the content of {@code source} and
+     * {@code target} into memory before calculating the differences, and is
+     * therefore not suited for use in cases where a very large number of
+     * entries are to be compared.
+     *
+     * @param source
+     *            The entry reader containing the source entries to be compared.
+     * @param target
+     *            The entry reader containing the target entries to be compared.
+     * @return A change record reader containing the differences.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    public static ChangeRecordReader diff(final EntryReader source, final EntryReader target)
+            throws IOException {
+        final SortedMap<DN, Entry> sourceEntries = readEntries(source);
+        final SortedMap<DN, Entry> targetEntries = readEntries(target);
+        final Iterator<Entry> sourceIterator = sourceEntries.values().iterator();
+        final Iterator<Entry> targetIterator = targetEntries.values().iterator();
 
-
-      @Override
-      public boolean hasNext()
-      {
-        return (sourceEntry != null || targetEntry != null);
-      }
-
-
-
-      @Override
-      public ChangeRecord readChangeRecord() throws IOException
-      {
-        if (sourceEntry != null && targetEntry != null)
-        {
-          final DN sourceDN = sourceEntry.getName();
-          final DN targetDN = targetEntry.getName();
-          final int cmp = sourceDN.compareTo(targetDN);
-
-          if (cmp == 0)
-          {
-            // Modify record: entry in both source and target.
-            final ModifyRequest request = Requests.newModifyRequest(
-                sourceEntry, targetEntry);
-            sourceEntry = nextEntry(sourceIterator);
-            targetEntry = nextEntry(targetIterator);
-            return request;
-          }
-          else if (cmp < 0)
-          {
-            // Delete record: entry in source but not in target.
-            final DeleteRequest request = Requests.newDeleteRequest(sourceEntry
-                .getName());
-            sourceEntry = nextEntry(sourceIterator);
-            return request;
-          }
-          else
-          {
-            // Add record: entry in target but not in source.
-            final AddRequest request = Requests.newAddRequest(targetEntry);
-            targetEntry = nextEntry(targetIterator);
-            return request;
-          }
-        }
-        else if (sourceEntry != null)
-        {
-          // Delete remaining source records.
-          final DeleteRequest request = Requests.newDeleteRequest(sourceEntry
-              .getName());
-          sourceEntry = nextEntry(sourceIterator);
-          return request;
-        }
-        else if (targetEntry != null)
-        {
-          // Add remaining target records.
-          final AddRequest request = Requests.newAddRequest(targetEntry);
-          targetEntry = nextEntry(targetIterator);
-          return request;
-        }
-        else
-        {
-          throw new NoSuchElementException();
-        }
-      }
-
-
-
-      private Entry nextEntry(final Iterator<Entry> i)
-      {
-        return i.hasNext() ? i.next() : null;
-      }
-    };
-
-  }
-
-
-
-  /**
-   * Returns an entry reader over the provided entry collection.
-   *
-   * @param entries
-   *          The entry collection.
-   * @return An entry reader over the provided entry collection.
-   */
-  public static EntryReader newEntryCollectionReader(
-      final Collection<Entry> entries)
-  {
-    return new EntryIteratorReader(entries.iterator());
-  }
-
-
-
-  /**
-   * Returns an entry reader over the provided entry iterator.
-   *
-   * @param entries
-   *          The entry iterator.
-   * @return An entry reader over the provided entry iterator.
-   */
-  public static EntryReader newEntryIteratorReader(final Iterator<Entry> entries)
-  {
-    return new EntryIteratorReader(entries);
-  }
-
-
-
-  /**
-   * Applies the set of changes contained in {@code patch} to the content of
-   * {@code input} and returns the result in an entry reader. This method
-   * ignores missing entries, and overwrites existing entries. Closing the
-   * returned reader will cause {@code input} and {@code patch} to be closed as
-   * well.
-   * <p>
-   * <b>NOTE:</b> this method reads the content of {@code input} into memory
-   * before applying the changes, and is therefore not suited for use in cases
-   * where a very large number of entries are to be patched.
-   *
-   * @param input
-   *          The entry reader containing the set of entries to be patched.
-   * @param patch
-   *          The change record reader containing the set of changes to be
-   *          applied.
-   * @return An entry reader containing the patched entries.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  public static EntryReader patch(final EntryReader input,
-      final ChangeRecordReader patch) throws IOException
-  {
-    return patch(input, patch, RejectedChangeRecordListener.OVERWRITE);
-  }
-
-
-
-  /**
-   * Applies the set of changes contained in {@code patch} to the content of
-   * {@code input} and returns the result in an entry reader. Closing the
-   * returned reader will cause {@code input} and {@code patch} to be closed as
-   * well.
-   * <p>
-   * <b>NOTE:</b> this method reads the content of {@code input} into memory
-   * before applying the changes, and is therefore not suited for use in cases
-   * where a very large number of entries are to be patched.
-   *
-   * @param input
-   *          The entry reader containing the set of entries to be patched.
-   * @param patch
-   *          The change record reader containing the set of changes to be
-   *          applied.
-   * @param listener
-   *          The rejected change listener.
-   * @return An entry reader containing the patched entries.
-   * @throws IOException
-   *           If an unexpected IO error occurred.
-   */
-  public static EntryReader patch(final EntryReader input,
-      final ChangeRecordReader patch,
-      final RejectedChangeRecordListener listener) throws IOException
-  {
-    final SortedMap<DN, Entry> entries = readEntries(input);
-
-    while (patch.hasNext())
-    {
-      final ChangeRecord change = patch.readChangeRecord();
-
-      final DecodeException de = change.accept(
-          new ChangeRecordVisitor<DecodeException, Void>()
-          {
+        return new ChangeRecordReader() {
+            private Entry sourceEntry = nextEntry(sourceIterator);
+            private Entry targetEntry = nextEntry(targetIterator);
 
             @Override
-            public DecodeException visitChangeRecord(final Void p,
-                final AddRequest change)
-            {
-              final Entry existingEntry = entries.get(change.getName());
-              if (existingEntry != null)
-              {
-                try
-                {
-                  final Entry entry = listener.handleDuplicateEntry(change,
-                      existingEntry);
-                  entries.put(entry.getName(), entry);
+            public void close() throws IOException {
+                try {
+                    source.close();
+                } finally {
+                    target.close();
                 }
-                catch (final DecodeException e)
-                {
-                  return e;
-                }
-              }
-              else
-              {
-                entries.put(change.getName(), change);
-              }
-              return null;
             }
 
-
-
             @Override
-            public DecodeException visitChangeRecord(final Void p,
-                final DeleteRequest change)
-            {
-              if (!entries.containsKey(change.getName()))
-              {
-                try
-                {
-                  listener.handleRejectedChangeRecord(change,
-                      REJECTED_CHANGE_FAIL_DELETE.get(change.getName()
-                          .toString()));
-                }
-                catch (final DecodeException e)
-                {
-                  return e;
-                }
-              }
-              else
-              {
-                try
-                {
-                  if (change.getControl(SubtreeDeleteRequestControl.DECODER,
-                      new DecodeOptions()) != null)
-                  {
-                    entries.subMap(change.getName(),
-                        change.getName().child(RDN.maxValue())).clear();
-                  }
-                  else
-                  {
-                    entries.remove(change.getName());
-                  }
-                }
-                catch (final DecodeException e)
-                {
-                  return e;
-                }
-
-              }
-              return null;
+            public boolean hasNext() {
+                return (sourceEntry != null || targetEntry != null);
             }
 
-
-
             @Override
-            public DecodeException visitChangeRecord(final Void p,
-                final ModifyDNRequest change)
-            {
-              if (!entries.containsKey(change.getName()))
-              {
-                try
-                {
-                  listener.handleRejectedChangeRecord(change,
-                      REJECTED_CHANGE_FAIL_MODIFYDN.get(change.getName()
-                          .toString()));
-                }
-                catch (final DecodeException e)
-                {
-                  return e;
-                }
-              }
-              else
-              {
-                // Calculate the old and new DN.
-                final DN oldDN = change.getName();
+            public ChangeRecord readChangeRecord() throws IOException {
+                if (sourceEntry != null && targetEntry != null) {
+                    final DN sourceDN = sourceEntry.getName();
+                    final DN targetDN = targetEntry.getName();
+                    final int cmp = sourceDN.compareTo(targetDN);
 
-                DN newSuperior = change.getNewSuperior();
-                if (newSuperior == null)
-                {
-                  newSuperior = change.getName().parent();
-                  if (newSuperior == null)
-                  {
-                    newSuperior = DN.rootDN();
-                  }
-                }
-                final DN newDN = newSuperior.child(change.getNewRDN());
-
-                // Move the renamed entries into a separate map in order to
-                // avoid cases where the renamed subtree overlaps.
-                final SortedMap<DN, Entry> renamedEntries = new TreeMap<DN, Entry>();
-                final Iterator<Map.Entry<DN, Entry>> i = entries
-                    .subMap(change.getName(),
-                        change.getName().child(RDN.maxValue())).entrySet()
-                    .iterator();
-                while (i.hasNext())
-                {
-                  final Map.Entry<DN, Entry> e = i.next();
-                  i.remove();
-
-                  final DN renamedDN = e.getKey().rename(oldDN, newDN);
-                  final Entry entry = e.getValue().setName(renamedDN);
-                  renamedEntries.put(renamedDN, entry);
-                }
-
-                // Modify the target entry.
-                final Entry entry = entries.values().iterator().next();
-                if (change.isDeleteOldRDN())
-                {
-                  for (final AVA ava : oldDN.rdn())
-                  {
-                    entry.removeAttribute(ava.toAttribute(), null);
-                  }
-                }
-                for (final AVA ava : newDN.rdn())
-                {
-                  entry.addAttribute(ava.toAttribute());
-                }
-
-                // Add the renamed entries.
-                for (final Entry renamedEntry : renamedEntries.values())
-                {
-                  final Entry existingEntry = entries.get(renamedEntry
-                      .getName());
-                  if (existingEntry != null)
-                  {
-                    try
-                    {
-                      final Entry tmp = listener.handleDuplicateEntry(change,
-                          existingEntry, renamedEntry);
-                      entries.put(tmp.getName(), tmp);
+                    if (cmp == 0) {
+                        // Modify record: entry in both source and target.
+                        final ModifyRequest request =
+                                Requests.newModifyRequest(sourceEntry, targetEntry);
+                        sourceEntry = nextEntry(sourceIterator);
+                        targetEntry = nextEntry(targetIterator);
+                        return request;
+                    } else if (cmp < 0) {
+                        // Delete record: entry in source but not in target.
+                        final DeleteRequest request =
+                                Requests.newDeleteRequest(sourceEntry.getName());
+                        sourceEntry = nextEntry(sourceIterator);
+                        return request;
+                    } else {
+                        // Add record: entry in target but not in source.
+                        final AddRequest request = Requests.newAddRequest(targetEntry);
+                        targetEntry = nextEntry(targetIterator);
+                        return request;
                     }
-                    catch (final DecodeException e)
-                    {
-                      return e;
-                    }
-                  }
-                  else
-                  {
-                    entries.put(renamedEntry.getName(), renamedEntry);
-                  }
+                } else if (sourceEntry != null) {
+                    // Delete remaining source records.
+                    final DeleteRequest request = Requests.newDeleteRequest(sourceEntry.getName());
+                    sourceEntry = nextEntry(sourceIterator);
+                    return request;
+                } else if (targetEntry != null) {
+                    // Add remaining target records.
+                    final AddRequest request = Requests.newAddRequest(targetEntry);
+                    targetEntry = nextEntry(targetIterator);
+                    return request;
+                } else {
+                    throw new NoSuchElementException();
                 }
-              }
-              return null;
             }
 
+            private Entry nextEntry(final Iterator<Entry> i) {
+                return i.hasNext() ? i.next() : null;
+            }
+        };
 
+    }
+
+    /**
+     * Returns an entry reader over the provided entry collection.
+     *
+     * @param entries
+     *            The entry collection.
+     * @return An entry reader over the provided entry collection.
+     */
+    public static EntryReader newEntryCollectionReader(final Collection<Entry> entries) {
+        return new EntryIteratorReader(entries.iterator());
+    }
+
+    /**
+     * Returns an entry reader over the provided entry iterator.
+     *
+     * @param entries
+     *            The entry iterator.
+     * @return An entry reader over the provided entry iterator.
+     */
+    public static EntryReader newEntryIteratorReader(final Iterator<Entry> entries) {
+        return new EntryIteratorReader(entries);
+    }
+
+    /**
+     * Applies the set of changes contained in {@code patch} to the content of
+     * {@code input} and returns the result in an entry reader. This method
+     * ignores missing entries, and overwrites existing entries. Closing the
+     * returned reader will cause {@code input} and {@code patch} to be closed
+     * as well.
+     * <p>
+     * <b>NOTE:</b> this method reads the content of {@code input} into memory
+     * before applying the changes, and is therefore not suited for use in cases
+     * where a very large number of entries are to be patched.
+     *
+     * @param input
+     *            The entry reader containing the set of entries to be patched.
+     * @param patch
+     *            The change record reader containing the set of changes to be
+     *            applied.
+     * @return An entry reader containing the patched entries.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    public static EntryReader patch(final EntryReader input, final ChangeRecordReader patch)
+            throws IOException {
+        return patch(input, patch, RejectedChangeRecordListener.OVERWRITE);
+    }
+
+    /**
+     * Applies the set of changes contained in {@code patch} to the content of
+     * {@code input} and returns the result in an entry reader. Closing the
+     * returned reader will cause {@code input} and {@code patch} to be closed
+     * as well.
+     * <p>
+     * <b>NOTE:</b> this method reads the content of {@code input} into memory
+     * before applying the changes, and is therefore not suited for use in cases
+     * where a very large number of entries are to be patched.
+     *
+     * @param input
+     *            The entry reader containing the set of entries to be patched.
+     * @param patch
+     *            The change record reader containing the set of changes to be
+     *            applied.
+     * @param listener
+     *            The rejected change listener.
+     * @return An entry reader containing the patched entries.
+     * @throws IOException
+     *             If an unexpected IO error occurred.
+     */
+    public static EntryReader patch(final EntryReader input, final ChangeRecordReader patch,
+            final RejectedChangeRecordListener listener) throws IOException {
+        final SortedMap<DN, Entry> entries = readEntries(input);
+
+        while (patch.hasNext()) {
+            final ChangeRecord change = patch.readChangeRecord();
+
+            final DecodeException de =
+                    change.accept(new ChangeRecordVisitor<DecodeException, Void>() {
+
+                        @Override
+                        public DecodeException visitChangeRecord(final Void p,
+                                final AddRequest change) {
+                            final Entry existingEntry = entries.get(change.getName());
+                            if (existingEntry != null) {
+                                try {
+                                    final Entry entry =
+                                            listener.handleDuplicateEntry(change, existingEntry);
+                                    entries.put(entry.getName(), entry);
+                                } catch (final DecodeException e) {
+                                    return e;
+                                }
+                            } else {
+                                entries.put(change.getName(), change);
+                            }
+                            return null;
+                        }
+
+                        @Override
+                        public DecodeException visitChangeRecord(final Void p,
+                                final DeleteRequest change) {
+                            if (!entries.containsKey(change.getName())) {
+                                try {
+                                    listener.handleRejectedChangeRecord(change,
+                                            REJECTED_CHANGE_FAIL_DELETE.get(change.getName()
+                                                    .toString()));
+                                } catch (final DecodeException e) {
+                                    return e;
+                                }
+                            } else {
+                                try {
+                                    if (change.getControl(SubtreeDeleteRequestControl.DECODER,
+                                            new DecodeOptions()) != null) {
+                                        entries.subMap(change.getName(),
+                                                change.getName().child(RDN.maxValue())).clear();
+                                    } else {
+                                        entries.remove(change.getName());
+                                    }
+                                } catch (final DecodeException e) {
+                                    return e;
+                                }
+
+                            }
+                            return null;
+                        }
+
+                        @Override
+                        public DecodeException visitChangeRecord(final Void p,
+                                final ModifyDNRequest change) {
+                            if (!entries.containsKey(change.getName())) {
+                                try {
+                                    listener.handleRejectedChangeRecord(change,
+                                            REJECTED_CHANGE_FAIL_MODIFYDN.get(change.getName()
+                                                    .toString()));
+                                } catch (final DecodeException e) {
+                                    return e;
+                                }
+                            } else {
+                                // Calculate the old and new DN.
+                                final DN oldDN = change.getName();
+
+                                DN newSuperior = change.getNewSuperior();
+                                if (newSuperior == null) {
+                                    newSuperior = change.getName().parent();
+                                    if (newSuperior == null) {
+                                        newSuperior = DN.rootDN();
+                                    }
+                                }
+                                final DN newDN = newSuperior.child(change.getNewRDN());
+
+                                // Move the renamed entries into a separate map
+                                // in order to
+                                // avoid cases where the renamed subtree
+                                // overlaps.
+                                final SortedMap<DN, Entry> renamedEntries =
+                                        new TreeMap<DN, Entry>();
+                                final Iterator<Map.Entry<DN, Entry>> i =
+                                        entries.subMap(change.getName(),
+                                                change.getName().child(RDN.maxValue())).entrySet()
+                                                .iterator();
+                                while (i.hasNext()) {
+                                    final Map.Entry<DN, Entry> e = i.next();
+                                    i.remove();
+
+                                    final DN renamedDN = e.getKey().rename(oldDN, newDN);
+                                    final Entry entry = e.getValue().setName(renamedDN);
+                                    renamedEntries.put(renamedDN, entry);
+                                }
+
+                                // Modify the target entry.
+                                final Entry entry = entries.values().iterator().next();
+                                if (change.isDeleteOldRDN()) {
+                                    for (final AVA ava : oldDN.rdn()) {
+                                        entry.removeAttribute(ava.toAttribute(), null);
+                                    }
+                                }
+                                for (final AVA ava : newDN.rdn()) {
+                                    entry.addAttribute(ava.toAttribute());
+                                }
+
+                                // Add the renamed entries.
+                                for (final Entry renamedEntry : renamedEntries.values()) {
+                                    final Entry existingEntry = entries.get(renamedEntry.getName());
+                                    if (existingEntry != null) {
+                                        try {
+                                            final Entry tmp =
+                                                    listener.handleDuplicateEntry(change,
+                                                            existingEntry, renamedEntry);
+                                            entries.put(tmp.getName(), tmp);
+                                        } catch (final DecodeException e) {
+                                            return e;
+                                        }
+                                    } else {
+                                        entries.put(renamedEntry.getName(), renamedEntry);
+                                    }
+                                }
+                            }
+                            return null;
+                        }
+
+                        @Override
+                        public DecodeException visitChangeRecord(final Void p,
+                                final ModifyRequest change) {
+                            if (!entries.containsKey(change.getName())) {
+                                try {
+                                    listener.handleRejectedChangeRecord(change,
+                                            REJECTED_CHANGE_FAIL_MODIFY.get(change.getName()
+                                                    .toString()));
+                                } catch (final DecodeException e) {
+                                    return e;
+                                }
+                            } else {
+                                final Entry entry = entries.get(change.getName());
+                                for (final Modification modification : change.getModifications()) {
+                                    final ModificationType modType =
+                                            modification.getModificationType();
+                                    if (modType.equals(ModificationType.ADD)) {
+                                        entry.addAttribute(modification.getAttribute(), null);
+                                    } else if (modType.equals(ModificationType.DELETE)) {
+                                        entry.removeAttribute(modification.getAttribute(), null);
+                                    } else if (modType.equals(ModificationType.REPLACE)) {
+                                        entry.replaceAttribute(modification.getAttribute());
+                                    } else {
+                                        System.err.println("Unable to apply \"" + modType
+                                                + "\" modification to entry \"" + change.getName()
+                                                + "\": modification type not supported");
+                                    }
+                                }
+                            }
+                            return null;
+                        }
+
+                    }, null);
+
+            if (de != null) {
+                throw de;
+            }
+        }
+
+        return new EntryReader() {
+            private final Iterator<Entry> iterator = entries.values().iterator();
 
             @Override
-            public DecodeException visitChangeRecord(final Void p,
-                final ModifyRequest change)
-            {
-              if (!entries.containsKey(change.getName()))
-              {
-                try
-                {
-                  listener.handleRejectedChangeRecord(change,
-                      REJECTED_CHANGE_FAIL_MODIFY.get(change.getName()
-                          .toString()));
+            public void close() throws IOException {
+                try {
+                    input.close();
+                } finally {
+                    patch.close();
                 }
-                catch (final DecodeException e)
-                {
-                  return e;
-                }
-              }
-              else
-              {
-                final Entry entry = entries.get(change.getName());
-                for (final Modification modification : change
-                    .getModifications())
-                {
-                  final ModificationType modType = modification
-                      .getModificationType();
-                  if (modType.equals(ModificationType.ADD))
-                  {
-                    entry.addAttribute(modification.getAttribute(), null);
-                  }
-                  else if (modType.equals(ModificationType.DELETE))
-                  {
-                    entry.removeAttribute(modification.getAttribute(), null);
-                  }
-                  else if (modType.equals(ModificationType.REPLACE))
-                  {
-                    entry.replaceAttribute(modification.getAttribute());
-                  }
-                  else
-                  {
-                    System.err.println("Unable to apply \"" + modType
-                        + "\" modification to entry \"" + change.getName()
-                        + "\": modification type not supported");
-                  }
-                }
-              }
-              return null;
             }
 
-          }, null);
+            @Override
+            public boolean hasNext() throws IOException {
+                return iterator.hasNext();
+            }
 
-      if (de != null)
-      {
-        throw de;
-      }
+            @Override
+            public Entry readEntry() throws IOException {
+                return iterator.next();
+            }
+        };
     }
 
-    return new EntryReader()
-    {
-      private final Iterator<Entry> iterator = entries.values().iterator();
-
-
-
-      @Override
-      public void close() throws IOException
-      {
-        try
-        {
-          input.close();
-        }
-        finally
-        {
-          patch.close();
-        }
-      }
-
-
-
-      @Override
-      public boolean hasNext() throws IOException
-      {
-        return iterator.hasNext();
-      }
-
-
-
-      @Override
-      public Entry readEntry() throws IOException
-      {
-        return iterator.next();
-      }
-    };
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code input} containing only those entries
-   * which match the search base DN, scope, and filtered defined in
-   * {@code search}. In addition, returned entries will be filtered according to
-   * any attribute filtering criteria defined in the search request.
-   * <p>
-   * The filter and attribute descriptions will be decoded using the default
-   * schema.
-   *
-   * @param input
-   *          The entry reader containing the set of entries to be filtered.
-   * @param search
-   *          The search request defining the filtering criteria.
-   * @return A filtered view of {@code input} containing only those entries
-   *         which match the provided search request.
-   */
-  public static EntryReader search(final EntryReader input,
-      final SearchRequest search)
-  {
-    return search(input, search, Schema.getDefaultSchema());
-  }
-
-
-
-  /**
-   * Returns a filtered view of {@code input} containing only those entries
-   * which match the search base DN, scope, and filtered defined in
-   * {@code search}. In addition, returned entries will be filtered according to
-   * any attribute filtering criteria defined in the search request.
-   * <p>
-   * The filter and attribute descriptions will be decoded using the provided
-   * schema.
-   *
-   * @param input
-   *          The entry reader containing the set of entries to be filtered.
-   * @param search
-   *          The search request defining the filtering criteria.
-   * @param schema
-   *          The schema which should be used to decode the search filter and
-   *          attribute descriptions.
-   * @return A filtered view of {@code input} containing only those entries
-   *         which match the provided search request.
-   */
-  public static EntryReader search(final EntryReader input,
-      final SearchRequest search, final Schema schema)
-  {
-    final Matcher matcher = search.getFilter().matcher(schema);
-
-    return new EntryReader()
-    {
-      private Entry nextEntry = null;
-      private int entryCount = 0;
-
-
-
-      public void close() throws IOException
-      {
-        input.close();
-      }
-
-
-
-      public boolean hasNext() throws IOException
-      {
-        if (nextEntry == null)
-        {
-          final int sizeLimit = search.getSizeLimit();
-          if (sizeLimit == 0 || entryCount < sizeLimit)
-          {
-            final DN baseDN = search.getName();
-            final SearchScope scope = search.getScope();
-            while (input.hasNext())
-            {
-              final Entry entry = input.readEntry();
-              if (entry.getName().isInScopeOf(baseDN, scope)
-                  && matcher.matches(entry).toBoolean())
-              {
-                nextEntry = filterEntry(entry);
-                break;
-              }
-            }
-          }
-        }
-        return nextEntry != null;
-      }
-
-
-
-      public Entry readEntry() throws IOException
-      {
-        if (hasNext())
-        {
-          final Entry entry = nextEntry;
-          nextEntry = null;
-          entryCount++;
-          return entry;
-        }
-        else
-        {
-          throw new NoSuchElementException();
-        }
-      }
-
-
-
-      private Entry filterEntry(final Entry entry)
-      {
-        // TODO: rename attributes; move functionality to Entries.
-        if (search.getAttributes().isEmpty())
-        {
-          if (search.isTypesOnly())
-          {
-            final Entry filteredEntry = new LinkedHashMapEntry(entry.getName());
-            for (final Attribute attribute : entry.getAllAttributes())
-            {
-              filteredEntry.addAttribute(Attributes.emptyAttribute(attribute
-                  .getAttributeDescription()));
-            }
-            return filteredEntry;
-          }
-          else
-          {
-            return entry;
-          }
-        }
-        else
-        {
-          final Entry filteredEntry = new LinkedHashMapEntry(entry.getName());
-          for (final String atd : search.getAttributes())
-          {
-            if (atd.equals("*"))
-            {
-              for (final Attribute attribute : entry.getAllAttributes())
-              {
-                if (attribute.getAttributeDescription().getAttributeType()
-                    .getUsage() == AttributeUsage.USER_APPLICATIONS)
-                {
-                  if (search.isTypesOnly())
-                  {
-                    filteredEntry.addAttribute(Attributes
-                        .emptyAttribute(attribute.getAttributeDescription()));
-                  }
-                  else
-                  {
-                    filteredEntry.addAttribute(attribute);
-                  }
-                }
-              }
-            }
-            else if (atd.equals("+"))
-            {
-              for (final Attribute attribute : entry.getAllAttributes())
-              {
-                if (attribute.getAttributeDescription().getAttributeType()
-                    .getUsage() != AttributeUsage.USER_APPLICATIONS)
-                {
-                  if (search.isTypesOnly())
-                  {
-                    filteredEntry.addAttribute(Attributes
-                        .emptyAttribute(attribute.getAttributeDescription()));
-                  }
-                  else
-                  {
-                    filteredEntry.addAttribute(attribute);
-                  }
-                }
-              }
-            }
-            else
-            {
-              final AttributeDescription ad = AttributeDescription.valueOf(atd,
-                  schema);
-              for (final Attribute attribute : entry.getAllAttributes(ad))
-              {
-                if (search.isTypesOnly())
-                {
-                  filteredEntry.addAttribute(Attributes
-                      .emptyAttribute(attribute.getAttributeDescription()));
-                }
-                else
-                {
-                  filteredEntry.addAttribute(attribute);
-                }
-              }
-            }
-          }
-          return filteredEntry;
-        }
-      }
-
-    };
-  }
-
-
-
-  private static SortedMap<DN, Entry> readEntries(final EntryReader reader)
-      throws IOException
-  {
-    final SortedMap<DN, Entry> entries = new TreeMap<DN, Entry>();
-    while (reader.hasNext())
-    {
-      final Entry entry = reader.readEntry();
-      entries.put(entry.getName(), entry);
+    /**
+     * Returns a filtered view of {@code input} containing only those entries
+     * which match the search base DN, scope, and filtered defined in
+     * {@code search}. In addition, returned entries will be filtered according
+     * to any attribute filtering criteria defined in the search request.
+     * <p>
+     * The filter and attribute descriptions will be decoded using the default
+     * schema.
+     *
+     * @param input
+     *            The entry reader containing the set of entries to be filtered.
+     * @param search
+     *            The search request defining the filtering criteria.
+     * @return A filtered view of {@code input} containing only those entries
+     *         which match the provided search request.
+     */
+    public static EntryReader search(final EntryReader input, final SearchRequest search) {
+        return search(input, search, Schema.getDefaultSchema());
     }
-    return entries;
-  }
 
+    /**
+     * Returns a filtered view of {@code input} containing only those entries
+     * which match the search base DN, scope, and filtered defined in
+     * {@code search}. In addition, returned entries will be filtered according
+     * to any attribute filtering criteria defined in the search request.
+     * <p>
+     * The filter and attribute descriptions will be decoded using the provided
+     * schema.
+     *
+     * @param input
+     *            The entry reader containing the set of entries to be filtered.
+     * @param search
+     *            The search request defining the filtering criteria.
+     * @param schema
+     *            The schema which should be used to decode the search filter
+     *            and attribute descriptions.
+     * @return A filtered view of {@code input} containing only those entries
+     *         which match the provided search request.
+     */
+    public static EntryReader search(final EntryReader input, final SearchRequest search,
+            final Schema schema) {
+        final Matcher matcher = search.getFilter().matcher(schema);
 
+        return new EntryReader() {
+            private Entry nextEntry = null;
+            private int entryCount = 0;
 
-  // Prevent instantiation.
-  private LDIF()
-  {
-    // Do nothing.
-  }
+            public void close() throws IOException {
+                input.close();
+            }
+
+            public boolean hasNext() throws IOException {
+                if (nextEntry == null) {
+                    final int sizeLimit = search.getSizeLimit();
+                    if (sizeLimit == 0 || entryCount < sizeLimit) {
+                        final DN baseDN = search.getName();
+                        final SearchScope scope = search.getScope();
+                        while (input.hasNext()) {
+                            final Entry entry = input.readEntry();
+                            if (entry.getName().isInScopeOf(baseDN, scope)
+                                    && matcher.matches(entry).toBoolean()) {
+                                nextEntry = filterEntry(entry);
+                                break;
+                            }
+                        }
+                    }
+                }
+                return nextEntry != null;
+            }
+
+            public Entry readEntry() throws IOException {
+                if (hasNext()) {
+                    final Entry entry = nextEntry;
+                    nextEntry = null;
+                    entryCount++;
+                    return entry;
+                } else {
+                    throw new NoSuchElementException();
+                }
+            }
+
+            private Entry filterEntry(final Entry entry) {
+                // TODO: rename attributes; move functionality to Entries.
+                if (search.getAttributes().isEmpty()) {
+                    if (search.isTypesOnly()) {
+                        final Entry filteredEntry = new LinkedHashMapEntry(entry.getName());
+                        for (final Attribute attribute : entry.getAllAttributes()) {
+                            filteredEntry.addAttribute(Attributes.emptyAttribute(attribute
+                                    .getAttributeDescription()));
+                        }
+                        return filteredEntry;
+                    } else {
+                        return entry;
+                    }
+                } else {
+                    final Entry filteredEntry = new LinkedHashMapEntry(entry.getName());
+                    for (final String atd : search.getAttributes()) {
+                        if (atd.equals("*")) {
+                            for (final Attribute attribute : entry.getAllAttributes()) {
+                                if (attribute.getAttributeDescription().getAttributeType()
+                                        .getUsage() == AttributeUsage.USER_APPLICATIONS) {
+                                    if (search.isTypesOnly()) {
+                                        filteredEntry
+                                                .addAttribute(Attributes.emptyAttribute(attribute
+                                                        .getAttributeDescription()));
+                                    } else {
+                                        filteredEntry.addAttribute(attribute);
+                                    }
+                                }
+                            }
+                        } else if (atd.equals("+")) {
+                            for (final Attribute attribute : entry.getAllAttributes()) {
+                                if (attribute.getAttributeDescription().getAttributeType()
+                                        .getUsage() != AttributeUsage.USER_APPLICATIONS) {
+                                    if (search.isTypesOnly()) {
+                                        filteredEntry
+                                                .addAttribute(Attributes.emptyAttribute(attribute
+                                                        .getAttributeDescription()));
+                                    } else {
+                                        filteredEntry.addAttribute(attribute);
+                                    }
+                                }
+                            }
+                        } else {
+                            final AttributeDescription ad =
+                                    AttributeDescription.valueOf(atd, schema);
+                            for (final Attribute attribute : entry.getAllAttributes(ad)) {
+                                if (search.isTypesOnly()) {
+                                    filteredEntry.addAttribute(Attributes.emptyAttribute(attribute
+                                            .getAttributeDescription()));
+                                } else {
+                                    filteredEntry.addAttribute(attribute);
+                                }
+                            }
+                        }
+                    }
+                    return filteredEntry;
+                }
+            }
+
+        };
+    }
+
+    private static SortedMap<DN, Entry> readEntries(final EntryReader reader) throws IOException {
+        final SortedMap<DN, Entry> entries = new TreeMap<DN, Entry>();
+        while (reader.hasNext()) {
+            final Entry entry = reader.readEntry();
+            entries.put(entry.getName(), entry);
+        }
+        return entries;
+    }
+
+    // Prevent instantiation.
+    private LDIF() {
+        // Do nothing.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
index b1713be..57af7f8 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,30 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NoSuchElementException;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedAttribute;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RDN;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
@@ -51,8 +61,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDIF change record reader reads change records using the LDAP Data
  * Interchange Format (LDIF) from a user defined source.
@@ -60,793 +68,649 @@
  * @see <a href="http://tools.ietf.org/html/rfc2849">RFC 2849 - The LDAP Data
  *      Interchange Format (LDIF) - Technical Specification </a>
  */
-public final class LDIFChangeRecordReader extends AbstractLDIFReader implements
-    ChangeRecordReader
-{
-  /**
-   * Parses the provided array of LDIF lines as a single LDIF change record.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be parsed.
-   * @return The parsed LDIF change record.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} did not contain an LDIF change record, if it
-   *           contained multiple change records, if contained malformed LDIF,
-   *           or if the change record could not be decoded using the default
-   *           schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public static ChangeRecord valueOfLDIFChangeRecord(final String... ldifLines)
-  {
-    // LDIF change record reader is tolerant to missing change types.
-    final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldifLines);
-    try
-    {
-      if (!reader.hasNext())
-      {
-        // No change record found.
-        final LocalizableMessage message = WARN_READ_LDIF_RECORD_NO_CHANGE_RECORD_FOUND
-            .get();
-        throw new LocalizedIllegalArgumentException(message);
-      }
+public final class LDIFChangeRecordReader extends AbstractLDIFReader implements ChangeRecordReader {
+    /**
+     * Parses the provided array of LDIF lines as a single LDIF change record.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be parsed.
+     * @return The parsed LDIF change record.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} did not contain an LDIF change record,
+     *             if it contained multiple change records, if contained
+     *             malformed LDIF, or if the change record could not be decoded
+     *             using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public static ChangeRecord valueOfLDIFChangeRecord(final String... ldifLines) {
+        // LDIF change record reader is tolerant to missing change types.
+        final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldifLines);
+        try {
+            if (!reader.hasNext()) {
+                // No change record found.
+                final LocalizableMessage message =
+                        WARN_READ_LDIF_RECORD_NO_CHANGE_RECORD_FOUND.get();
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      final ChangeRecord record = reader.readChangeRecord();
+            final ChangeRecord record = reader.readChangeRecord();
 
-      if (reader.hasNext())
-      {
-        // Multiple change records found.
-        final LocalizableMessage message = WARN_READ_LDIF_RECORD_MULTIPLE_CHANGE_RECORDS_FOUND
-            .get();
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (reader.hasNext()) {
+                // Multiple change records found.
+                final LocalizableMessage message =
+                        WARN_READ_LDIF_RECORD_MULTIPLE_CHANGE_RECORDS_FOUND.get();
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      return record;
-    }
-    catch (final DecodeException e)
-    {
-      // Badly formed LDIF.
-      throw new LocalizedIllegalArgumentException(e.getMessageObject());
-    }
-    catch (final IOException e)
-    {
-      // This should never happen for a String based reader.
-      final LocalizableMessage message = WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR
-          .get(e.getMessage());
-      throw new LocalizedIllegalArgumentException(message);
-    }
-  }
-
-
-
-  private ChangeRecord nextChangeRecord = null;
-
-  // Poison used to indicate end of LDIF.
-  private static final ChangeRecord EOF = Requests.newAddRequest(DN.rootDN());
-
-
-
-  /**
-   * Creates a new LDIF change record reader whose source is the provided input
-   * stream.
-   *
-   * @param in
-   *          The input stream to use.
-   * @throws NullPointerException
-   *           If {@code in} was {@code null}.
-   */
-  public LDIFChangeRecordReader(final InputStream in)
-  {
-    super(in);
-  }
-
-
-
-  /**
-   * Creates a new LDIF change record reader which will read lines of LDIF from
-   * the provided list of LDIF lines.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be read.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public LDIFChangeRecordReader(final List<String> ldifLines)
-  {
-    super(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new LDIF change record reader which will read lines of LDIF from
-   * the provided array of LDIF lines.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be read.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public LDIFChangeRecordReader(final String... ldifLines)
-  {
-    super(Arrays.asList(ldifLines));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close() throws IOException
-  {
-    close0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   *
-   * @throws DecodeException
-   *           If the change record could not be decoded because it was
-   *           malformed.
-   */
-  @Override
-  public boolean hasNext() throws DecodeException, IOException
-  {
-    return getNextChangeRecord() != EOF;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   *
-   * @throws DecodeException
-   *           If the entry could not be decoded because it was malformed.
-   */
-  @Override
-  public ChangeRecord readChangeRecord() throws DecodeException, IOException
-  {
-    if (!hasNext())
-    {
-      // LDIF reader has completed successfully.
-      throw new NoSuchElementException();
+            return record;
+        } catch (final DecodeException e) {
+            // Badly formed LDIF.
+            throw new LocalizedIllegalArgumentException(e.getMessageObject());
+        } catch (final IOException e) {
+            // This should never happen for a String based reader.
+            final LocalizableMessage message =
+                    WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage());
+            throw new LocalizedIllegalArgumentException(message);
+        }
     }
 
-    final ChangeRecord changeRecord = nextChangeRecord;
-    nextChangeRecord = null;
-    return changeRecord;
-  }
+    private ChangeRecord nextChangeRecord = null;
 
+    // Poison used to indicate end of LDIF.
+    private static final ChangeRecord EOF = Requests.newAddRequest(DN.rootDN());
 
+    /**
+     * Creates a new LDIF change record reader whose source is the provided
+     * input stream.
+     *
+     * @param in
+     *            The input stream to use.
+     * @throws NullPointerException
+     *             If {@code in} was {@code null}.
+     */
+    public LDIFChangeRecordReader(final InputStream in) {
+        super(in);
+    }
 
-  /**
-   * Specifies whether or not all operational attributes should be excluded from
-   * any change records that are read from LDIF. The default is {@code false}.
-   *
-   * @param excludeOperationalAttributes
-   *          {@code true} if all operational attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setExcludeAllOperationalAttributes(
-      final boolean excludeOperationalAttributes)
-  {
-    this.excludeOperationalAttributes = excludeOperationalAttributes;
-    return this;
-  }
+    /**
+     * Creates a new LDIF change record reader which will read lines of LDIF
+     * from the provided list of LDIF lines.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be read.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public LDIFChangeRecordReader(final List<String> ldifLines) {
+        super(ldifLines);
+    }
 
+    /**
+     * Creates a new LDIF change record reader which will read lines of LDIF
+     * from the provided array of LDIF lines.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be read.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public LDIFChangeRecordReader(final String... ldifLines) {
+        super(Arrays.asList(ldifLines));
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() throws IOException {
+        close0();
+    }
 
-  /**
-   * Specifies whether or not all user attributes should be excluded from any
-   * change records that are read from LDIF. The default is {@code false}.
-   *
-   * @param excludeUserAttributes
-   *          {@code true} if all user attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setExcludeAllUserAttributes(
-      final boolean excludeUserAttributes)
-  {
-    this.excludeUserAttributes = excludeUserAttributes;
-    return this;
-  }
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DecodeException
+     *             If the change record could not be decoded because it was
+     *             malformed.
+     */
+    @Override
+    public boolean hasNext() throws DecodeException, IOException {
+        return getNextChangeRecord() != EOF;
+    }
 
-
-
-  /**
-   * Excludes the named attribute from any change records that are read from
-   * LDIF. By default all attributes are included unless explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be excluded.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setExcludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    excludeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all change records which target entries beneath the named entry
-   * (inclusive) from being read from LDIF. By default all change records are
-   * read unless explicitly excluded or included.
-   *
-   * @param excludeBranch
-   *          The distinguished name of the branch to be excluded.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setExcludeBranch(final DN excludeBranch)
-  {
-    Validator.ensureNotNull(excludeBranch);
-    excludeBranches.add(excludeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that the named attribute is not excluded from any change records
-   * that are read from LDIF. By default all attributes are included unless
-   * explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be included.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setIncludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    includeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all change records which target entries beneath the named
-   * entry (inclusive) are read from LDIF. By default all change records are
-   * read unless explicitly excluded or included.
-   *
-   * @param includeBranch
-   *          The distinguished name of the branch to be included.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setIncludeBranch(final DN includeBranch)
-  {
-    Validator.ensureNotNull(includeBranch);
-    includeBranches.add(includeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Sets the rejected record listener which should be notified whenever an LDIF
-   * record is skipped, malformed, or fails schema validation.
-   * <p>
-   * By default the {@link RejectedLDIFListener#FAIL_FAST} listener is used.
-   *
-   * @param listener
-   *          The rejected record listener.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setRejectedLDIFListener(
-      final RejectedLDIFListener listener)
-  {
-    this.rejectedRecordListener = listener;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the schema which should be used for decoding change records that are
-   * read from LDIF. The default schema is used if no other is specified.
-   *
-   * @param schema
-   *          The schema which should be used for decoding change records that
-   *          are read from LDIF.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    this.schema = schemaValidationPolicy.checkAttributesAndObjectClasses()
-        .needsChecking() ? schema.asStrictSchema() : schema.asNonStrictSchema();
-    return this;
-  }
-
-
-
-  /**
-   * Specifies the schema validation which should be used when reading LDIF
-   * change records. If attribute value validation is enabled then all checks
-   * will be performed.
-   * <p>
-   * Schema validation is disabled by default.
-   * <p>
-   * <b>NOTE:</b> this method copies the provided policy so changes made to it
-   * after this method has been called will have no effect.
-   *
-   * @param policy
-   *          The schema validation which should be used when reading LDIF
-   *          change records.
-   * @return A reference to this {@code LDIFChangeRecordReader}.
-   */
-  public LDIFChangeRecordReader setSchemaValidationPolicy(
-      final SchemaValidationPolicy policy)
-  {
-    this.schemaValidationPolicy = SchemaValidationPolicy.copyOf(policy);
-    this.schema = schemaValidationPolicy.checkAttributesAndObjectClasses()
-        .needsChecking() ? schema.asStrictSchema() : schema.asNonStrictSchema();
-    return this;
-  }
-
-
-
-  private ChangeRecord getNextChangeRecord() throws DecodeException,
-      IOException
-  {
-    while (nextChangeRecord == null)
-    {
-      // Read the set of lines that make up the next entry.
-      final LDIFRecord record = readLDIFRecord();
-      if (record == null)
-      {
-        nextChangeRecord = EOF;
-        break;
-      }
-
-      try
-      {
-        // Read the DN of the entry and see if it is one that should be
-        // included in the import.
-        final DN entryDN = readLDIFRecordDN(record);
-        if (entryDN == null)
-        {
-          // Skip version record.
-          continue;
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DecodeException
+     *             If the entry could not be decoded because it was malformed.
+     */
+    @Override
+    public ChangeRecord readChangeRecord() throws DecodeException, IOException {
+        if (!hasNext()) {
+            // LDIF reader has completed successfully.
+            throw new NoSuchElementException();
         }
 
-        // Skip if branch containing the entry DN is excluded.
-        if (isBranchExcluded(entryDN))
-        {
-          final LocalizableMessage message = ERR_LDIF_CHANGE_EXCLUDED_BY_DN
-              .get(record.lineNumber, entryDN.toString());
-          handleSkippedRecord(record, message);
-          continue;
+        final ChangeRecord changeRecord = nextChangeRecord;
+        nextChangeRecord = null;
+        return changeRecord;
+    }
+
+    /**
+     * Specifies whether or not all operational attributes should be excluded
+     * from any change records that are read from LDIF. The default is
+     * {@code false}.
+     *
+     * @param excludeOperationalAttributes
+     *            {@code true} if all operational attributes should be excluded,
+     *            or {@code false} otherwise.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setExcludeAllOperationalAttributes(
+            final boolean excludeOperationalAttributes) {
+        this.excludeOperationalAttributes = excludeOperationalAttributes;
+        return this;
+    }
+
+    /**
+     * Specifies whether or not all user attributes should be excluded from any
+     * change records that are read from LDIF. The default is {@code false}.
+     *
+     * @param excludeUserAttributes
+     *            {@code true} if all user attributes should be excluded, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setExcludeAllUserAttributes(final boolean excludeUserAttributes) {
+        this.excludeUserAttributes = excludeUserAttributes;
+        return this;
+    }
+
+    /**
+     * Excludes the named attribute from any change records that are read from
+     * LDIF. By default all attributes are included unless explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be excluded.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setExcludeAttribute(
+            final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        excludeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Excludes all change records which target entries beneath the named entry
+     * (inclusive) from being read from LDIF. By default all change records are
+     * read unless explicitly excluded or included.
+     *
+     * @param excludeBranch
+     *            The distinguished name of the branch to be excluded.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setExcludeBranch(final DN excludeBranch) {
+        Validator.ensureNotNull(excludeBranch);
+        excludeBranches.add(excludeBranch);
+        return this;
+    }
+
+    /**
+     * Ensures that the named attribute is not excluded from any change records
+     * that are read from LDIF. By default all attributes are included unless
+     * explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be included.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setIncludeAttribute(
+            final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        includeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Ensures that all change records which target entries beneath the named
+     * entry (inclusive) are read from LDIF. By default all change records are
+     * read unless explicitly excluded or included.
+     *
+     * @param includeBranch
+     *            The distinguished name of the branch to be included.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setIncludeBranch(final DN includeBranch) {
+        Validator.ensureNotNull(includeBranch);
+        includeBranches.add(includeBranch);
+        return this;
+    }
+
+    /**
+     * Sets the rejected record listener which should be notified whenever an
+     * LDIF record is skipped, malformed, or fails schema validation.
+     * <p>
+     * By default the {@link RejectedLDIFListener#FAIL_FAST} listener is used.
+     *
+     * @param listener
+     *            The rejected record listener.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setRejectedLDIFListener(final RejectedLDIFListener listener) {
+        this.rejectedRecordListener = listener;
+        return this;
+    }
+
+    /**
+     * Sets the schema which should be used for decoding change records that are
+     * read from LDIF. The default schema is used if no other is specified.
+     *
+     * @param schema
+     *            The schema which should be used for decoding change records
+     *            that are read from LDIF.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        this.schema =
+                schemaValidationPolicy.checkAttributesAndObjectClasses().needsChecking() ? schema
+                        .asStrictSchema() : schema.asNonStrictSchema();
+        return this;
+    }
+
+    /**
+     * Specifies the schema validation which should be used when reading LDIF
+     * change records. If attribute value validation is enabled then all checks
+     * will be performed.
+     * <p>
+     * Schema validation is disabled by default.
+     * <p>
+     * <b>NOTE:</b> this method copies the provided policy so changes made to it
+     * after this method has been called will have no effect.
+     *
+     * @param policy
+     *            The schema validation which should be used when reading LDIF
+     *            change records.
+     * @return A reference to this {@code LDIFChangeRecordReader}.
+     */
+    public LDIFChangeRecordReader setSchemaValidationPolicy(final SchemaValidationPolicy policy) {
+        this.schemaValidationPolicy = SchemaValidationPolicy.copyOf(policy);
+        this.schema =
+                schemaValidationPolicy.checkAttributesAndObjectClasses().needsChecking() ? schema
+                        .asStrictSchema() : schema.asNonStrictSchema();
+        return this;
+    }
+
+    private ChangeRecord getNextChangeRecord() throws DecodeException, IOException {
+        while (nextChangeRecord == null) {
+            // Read the set of lines that make up the next entry.
+            final LDIFRecord record = readLDIFRecord();
+            if (record == null) {
+                nextChangeRecord = EOF;
+                break;
+            }
+
+            try {
+                // Read the DN of the entry and see if it is one that should be
+                // included in the import.
+                final DN entryDN = readLDIFRecordDN(record);
+                if (entryDN == null) {
+                    // Skip version record.
+                    continue;
+                }
+
+                // Skip if branch containing the entry DN is excluded.
+                if (isBranchExcluded(entryDN)) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_CHANGE_EXCLUDED_BY_DN.get(record.lineNumber, entryDN
+                                    .toString());
+                    handleSkippedRecord(record, message);
+                    continue;
+                }
+
+                if (!record.iterator.hasNext()) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_NO_CHANGE_TYPE.get(record.lineNumber, entryDN.toString());
+                    throw DecodeException.error(message);
+                }
+
+                final KeyValuePair pair = new KeyValuePair();
+                final String ldifLine = readLDIFRecordKeyValuePair(record, pair, false);
+                if (pair.key == null) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_MALFORMED_CHANGE_TYPE.get(record.lineNumber, entryDN
+                                    .toString(), ldifLine);
+                    throw DecodeException.error(message);
+                }
+
+                if (!toLowerCase(pair.key).equals("changetype")) {
+                    // Default to add change record.
+                    nextChangeRecord = parseAddChangeRecordEntry(entryDN, ldifLine, record);
+                } else {
+                    final String changeType = toLowerCase(pair.value);
+                    if (changeType.equals("add")) {
+                        nextChangeRecord = parseAddChangeRecordEntry(entryDN, null, record);
+                    } else if (changeType.equals("delete")) {
+                        nextChangeRecord = parseDeleteChangeRecordEntry(entryDN, record);
+                    } else if (changeType.equals("modify")) {
+                        nextChangeRecord = parseModifyChangeRecordEntry(entryDN, record);
+                    } else if (changeType.equals("modrdn")) {
+                        nextChangeRecord = parseModifyDNChangeRecordEntry(entryDN, record);
+                    } else if (changeType.equals("moddn")) {
+                        nextChangeRecord = parseModifyDNChangeRecordEntry(entryDN, record);
+                    } else {
+                        final LocalizableMessage message =
+                                ERR_LDIF_BAD_CHANGE_TYPE.get(record.lineNumber, entryDN.toString(),
+                                        pair.value);
+                        throw DecodeException.error(message);
+                    }
+                }
+            } catch (final DecodeException e) {
+                handleMalformedRecord(record, e.getMessageObject());
+                continue;
+            }
+        }
+        return nextChangeRecord;
+    }
+
+    private ChangeRecord parseAddChangeRecordEntry(final DN entryDN, final String lastLDIFLine,
+            final LDIFRecord record) throws DecodeException {
+        // Use an Entry for the AttributeSequence.
+        final Entry entry = new LinkedHashMapEntry(entryDN);
+        boolean schemaValidationFailure = false;
+        final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
+
+        if (lastLDIFLine != null) {
+            // This line was read when looking for the change type.
+            if (!readLDIFRecordAttributeValue(record, lastLDIFLine, entry, schemaErrors)) {
+                schemaValidationFailure = true;
+            }
         }
 
-        if (!record.iterator.hasNext())
-        {
-          final LocalizableMessage message = ERR_LDIF_NO_CHANGE_TYPE.get(
-              record.lineNumber, entryDN.toString());
-          throw DecodeException.error(message);
+        while (record.iterator.hasNext()) {
+            final String ldifLine = record.iterator.next();
+            if (!readLDIFRecordAttributeValue(record, ldifLine, entry, schemaErrors)) {
+                schemaValidationFailure = true;
+            }
+        }
+
+        if (!schema.validateEntry(entry, schemaValidationPolicy, schemaErrors)) {
+            schemaValidationFailure = true;
+        }
+
+        if (schemaValidationFailure) {
+            handleSchemaValidationFailure(record, schemaErrors);
+            return null;
+        }
+
+        if (!schemaErrors.isEmpty()) {
+            handleSchemaValidationWarning(record, schemaErrors);
+        }
+
+        return Requests.newAddRequest(entry);
+    }
+
+    private ChangeRecord parseDeleteChangeRecordEntry(final DN entryDN, final LDIFRecord record)
+            throws DecodeException {
+        if (record.iterator.hasNext()) {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_DELETE.get(record.lineNumber, entryDN.toString());
+            throw DecodeException.error(message);
+        }
+
+        return Requests.newDeleteRequest(entryDN);
+    }
+
+    private ChangeRecord parseModifyChangeRecordEntry(final DN entryDN, final LDIFRecord record)
+            throws DecodeException {
+        final ModifyRequest modifyRequest = Requests.newModifyRequest(entryDN);
+        final KeyValuePair pair = new KeyValuePair();
+        final List<ByteString> attributeValues = new ArrayList<ByteString>();
+        boolean schemaValidationFailure = false;
+        final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
+
+        while (record.iterator.hasNext()) {
+            String ldifLine = readLDIFRecordKeyValuePair(record, pair, false);
+            if (pair.key == null) {
+                final LocalizableMessage message =
+                        ERR_LDIF_MALFORMED_MODIFICATION_TYPE.get(record.lineNumber, entryDN
+                                .toString(), ldifLine);
+                throw DecodeException.error(message);
+            }
+
+            final String changeType = toLowerCase(pair.key);
+
+            ModificationType modType;
+            if (changeType.equals("add")) {
+                modType = ModificationType.ADD;
+            } else if (changeType.equals("delete")) {
+                modType = ModificationType.DELETE;
+            } else if (changeType.equals("replace")) {
+                modType = ModificationType.REPLACE;
+            } else if (changeType.equals("increment")) {
+                modType = ModificationType.INCREMENT;
+            } else {
+                final LocalizableMessage message =
+                        ERR_LDIF_BAD_MODIFICATION_TYPE.get(record.lineNumber, entryDN.toString(),
+                                pair.key);
+                throw DecodeException.error(message);
+            }
+
+            AttributeDescription attributeDescription;
+            try {
+                attributeDescription = AttributeDescription.valueOf(pair.value, schema);
+            } catch (final UnknownSchemaElementException e) {
+                final LocalizableMessage message =
+                        ERR_LDIF_UNKNOWN_ATTRIBUTE_TYPE.get(record.lineNumber, entryDN.toString(),
+                                pair.value);
+                switch (schemaValidationPolicy.checkAttributesAndObjectClasses()) {
+                case REJECT:
+                    schemaValidationFailure = true;
+                    schemaErrors.add(message);
+                    continue;
+                case WARN:
+                    schemaErrors.add(message);
+                    continue;
+                default: // Ignore
+                    // This should not happen: we should be using a non-strict
+                    // schema for
+                    // this policy.
+                    throw new IllegalStateException("Schema is not consistent with policy", e);
+                }
+            } catch (final LocalizedIllegalArgumentException e) {
+                final LocalizableMessage message =
+                        ERR_LDIF_MALFORMED_ATTRIBUTE_NAME.get(record.lineNumber,
+                                entryDN.toString(), pair.value);
+                throw DecodeException.error(message);
+            }
+
+            // Skip the attribute if requested before performing any schema
+            // checking: the attribute may have been excluded because it is
+            // known to violate the schema.
+            if (isAttributeExcluded(attributeDescription)) {
+                continue;
+            }
+
+            final Syntax syntax = attributeDescription.getAttributeType().getSyntax();
+
+            // Ensure that the binary option is present if required.
+            if (!syntax.isBEREncodingRequired()) {
+                if (schemaValidationPolicy.checkAttributeValues().needsChecking()
+                        && attributeDescription.containsOption("binary")) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_UNEXPECTED_BINARY_OPTION.get(record.lineNumber, entryDN
+                                    .toString(), pair.value);
+                    if (schemaValidationPolicy.checkAttributeValues().isReject()) {
+                        schemaValidationFailure = true;
+                    }
+                    schemaErrors.add(message);
+                    continue;
+                }
+            } else {
+                attributeDescription = attributeDescription.withOption("binary");
+            }
+
+            // Now go through the rest of the attributes until the "-" line is
+            // reached.
+            attributeValues.clear();
+            while (record.iterator.hasNext()) {
+                ldifLine = record.iterator.next();
+                if (ldifLine.equals("-")) {
+                    break;
+                }
+
+                // Parse the attribute description.
+                final int colonPos = parseColonPosition(record, ldifLine);
+                final String attrDescr = ldifLine.substring(0, colonPos);
+
+                AttributeDescription attributeDescription2;
+                try {
+                    attributeDescription2 = AttributeDescription.valueOf(attrDescr, schema);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    // No need to catch schema exception here because it implies
+                    // that the
+                    // attribute name is wrong and the record is malformed.
+                    final LocalizableMessage message =
+                            ERR_LDIF_MALFORMED_ATTRIBUTE_NAME.get(record.lineNumber, entryDN
+                                    .toString(), attrDescr);
+                    throw DecodeException.error(message);
+                }
+
+                // Ensure that the binary option is present if required.
+                if (attributeDescription.getAttributeType().getSyntax().isBEREncodingRequired()) {
+                    attributeDescription2 = attributeDescription2.withOption("binary");
+                }
+
+                if (!attributeDescription2.equals(attributeDescription)) {
+                    // Malformed record.
+                    final LocalizableMessage message =
+                            ERR_LDIF_ATTRIBUTE_NAME_MISMATCH.get(record.lineNumber, entryDN
+                                    .toString(), attributeDescription2.toString(),
+                                    attributeDescription.toString());
+                    throw DecodeException.error(message);
+                }
+
+                // Parse the attribute value and check it if needed.
+                final ByteString value =
+                        parseSingleValue(record, ldifLine, entryDN, colonPos, attrDescr);
+                if (schemaValidationPolicy.checkAttributeValues().needsChecking()) {
+                    LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
+                    if (!syntax.valueIsAcceptable(value, builder)) {
+                        // Just log a message, but don't skip the value since
+                        // this could
+                        // change the semantics of the modification (e.g. if all
+                        // values in a
+                        // delete are skipped then this implies that the whole
+                        // attribute
+                        // should be removed).
+                        if (schemaValidationPolicy.checkAttributeValues().isReject()) {
+                            schemaValidationFailure = true;
+                        }
+                        schemaErrors.add(builder.toMessage());
+                    }
+                }
+                attributeValues.add(value);
+            }
+
+            final Modification change =
+                    new Modification(modType, new LinkedAttribute(attributeDescription,
+                            attributeValues));
+            modifyRequest.addModification(change);
+        }
+
+        if (schemaValidationFailure) {
+            handleSchemaValidationFailure(record, schemaErrors);
+            return null;
+        }
+
+        if (!schemaErrors.isEmpty()) {
+            handleSchemaValidationWarning(record, schemaErrors);
+        }
+
+        return modifyRequest;
+    }
+
+    private ChangeRecord parseModifyDNChangeRecordEntry(final DN entryDN, final LDIFRecord record)
+            throws DecodeException {
+        ModifyDNRequest modifyDNRequest;
+
+        // Parse the newrdn.
+        if (!record.iterator.hasNext()) {
+            final LocalizableMessage message =
+                    ERR_LDIF_NO_NEW_RDN.get(record.lineNumber, entryDN.toString());
+            throw DecodeException.error(message);
         }
 
         final KeyValuePair pair = new KeyValuePair();
-        final String ldifLine = readLDIFRecordKeyValuePair(record, pair, false);
-        if (pair.key == null)
-        {
-          final LocalizableMessage message = ERR_LDIF_MALFORMED_CHANGE_TYPE
-              .get(record.lineNumber, entryDN.toString(), ldifLine);
-          throw DecodeException.error(message);
-        }
+        String ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
 
-        if (!toLowerCase(pair.key).equals("changetype"))
-        {
-          // Default to add change record.
-          nextChangeRecord = parseAddChangeRecordEntry(entryDN, ldifLine,
-              record);
-        }
-        else
-        {
-          final String changeType = toLowerCase(pair.value);
-          if (changeType.equals("add"))
-          {
-            nextChangeRecord = parseAddChangeRecordEntry(entryDN, null, record);
-          }
-          else if (changeType.equals("delete"))
-          {
-            nextChangeRecord = parseDeleteChangeRecordEntry(entryDN, record);
-          }
-          else if (changeType.equals("modify"))
-          {
-            nextChangeRecord = parseModifyChangeRecordEntry(entryDN, record);
-          }
-          else if (changeType.equals("modrdn"))
-          {
-            nextChangeRecord = parseModifyDNChangeRecordEntry(entryDN, record);
-          }
-          else if (changeType.equals("moddn"))
-          {
-            nextChangeRecord = parseModifyDNChangeRecordEntry(entryDN, record);
-          }
-          else
-          {
-            final LocalizableMessage message = ERR_LDIF_BAD_CHANGE_TYPE.get(
-                record.lineNumber, entryDN.toString(), pair.value);
+        if (pair.key == null || !toLowerCase(pair.key).equals("newrdn")) {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_NEW_RDN.get(record.lineNumber, entryDN.toString(), ldifLine);
             throw DecodeException.error(message);
-          }
-        }
-      }
-      catch (final DecodeException e)
-      {
-        handleMalformedRecord(record, e.getMessageObject());
-        continue;
-      }
-    }
-    return nextChangeRecord;
-  }
-
-
-
-  private ChangeRecord parseAddChangeRecordEntry(final DN entryDN,
-      final String lastLDIFLine, final LDIFRecord record)
-      throws DecodeException
-  {
-    // Use an Entry for the AttributeSequence.
-    final Entry entry = new LinkedHashMapEntry(entryDN);
-    boolean schemaValidationFailure = false;
-    final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
-
-    if (lastLDIFLine != null)
-    {
-      // This line was read when looking for the change type.
-      if (!readLDIFRecordAttributeValue(record, lastLDIFLine, entry,
-          schemaErrors))
-      {
-        schemaValidationFailure = true;
-      }
-    }
-
-    while (record.iterator.hasNext())
-    {
-      final String ldifLine = record.iterator.next();
-      if (!readLDIFRecordAttributeValue(record, ldifLine, entry, schemaErrors))
-      {
-        schemaValidationFailure = true;
-      }
-    }
-
-    if (!schema.validateEntry(entry, schemaValidationPolicy, schemaErrors))
-    {
-      schemaValidationFailure = true;
-    }
-
-    if (schemaValidationFailure)
-    {
-      handleSchemaValidationFailure(record, schemaErrors);
-      return null;
-    }
-
-    if (!schemaErrors.isEmpty())
-    {
-      handleSchemaValidationWarning(record, schemaErrors);
-    }
-
-    return Requests.newAddRequest(entry);
-  }
-
-
-
-  private ChangeRecord parseDeleteChangeRecordEntry(final DN entryDN,
-      final LDIFRecord record) throws DecodeException
-  {
-    if (record.iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_DELETE.get(
-          record.lineNumber, entryDN.toString());
-      throw DecodeException.error(message);
-    }
-
-    return Requests.newDeleteRequest(entryDN);
-  }
-
-
-
-  private ChangeRecord parseModifyChangeRecordEntry(final DN entryDN,
-      final LDIFRecord record) throws DecodeException
-  {
-    final ModifyRequest modifyRequest = Requests.newModifyRequest(entryDN);
-    final KeyValuePair pair = new KeyValuePair();
-    final List<ByteString> attributeValues = new ArrayList<ByteString>();
-    boolean schemaValidationFailure = false;
-    final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
-
-    while (record.iterator.hasNext())
-    {
-      String ldifLine = readLDIFRecordKeyValuePair(record, pair, false);
-      if (pair.key == null)
-      {
-        final LocalizableMessage message = ERR_LDIF_MALFORMED_MODIFICATION_TYPE
-            .get(record.lineNumber, entryDN.toString(), ldifLine);
-        throw DecodeException.error(message);
-      }
-
-      final String changeType = toLowerCase(pair.key);
-
-      ModificationType modType;
-      if (changeType.equals("add"))
-      {
-        modType = ModificationType.ADD;
-      }
-      else if (changeType.equals("delete"))
-      {
-        modType = ModificationType.DELETE;
-      }
-      else if (changeType.equals("replace"))
-      {
-        modType = ModificationType.REPLACE;
-      }
-      else if (changeType.equals("increment"))
-      {
-        modType = ModificationType.INCREMENT;
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_LDIF_BAD_MODIFICATION_TYPE.get(
-            record.lineNumber, entryDN.toString(), pair.key);
-        throw DecodeException.error(message);
-      }
-
-      AttributeDescription attributeDescription;
-      try
-      {
-        attributeDescription = AttributeDescription.valueOf(pair.value, schema);
-      }
-      catch (final UnknownSchemaElementException e)
-      {
-        final LocalizableMessage message = ERR_LDIF_UNKNOWN_ATTRIBUTE_TYPE.get(
-            record.lineNumber, entryDN.toString(), pair.value);
-        switch (schemaValidationPolicy.checkAttributesAndObjectClasses())
-        {
-        case REJECT:
-          schemaValidationFailure = true;
-          schemaErrors.add(message);
-          continue;
-        case WARN:
-          schemaErrors.add(message);
-          continue;
-        default: // Ignore
-          // This should not happen: we should be using a non-strict schema for
-          // this policy.
-          throw new IllegalStateException(
-              "Schema is not consistent with policy", e);
-        }
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage message = ERR_LDIF_MALFORMED_ATTRIBUTE_NAME
-            .get(record.lineNumber, entryDN.toString(), pair.value);
-        throw DecodeException.error(message);
-      }
-
-      // Skip the attribute if requested before performing any schema
-      // checking: the attribute may have been excluded because it is
-      // known to violate the schema.
-      if (isAttributeExcluded(attributeDescription))
-      {
-        continue;
-      }
-
-      final Syntax syntax = attributeDescription.getAttributeType().getSyntax();
-
-      // Ensure that the binary option is present if required.
-      if (!syntax.isBEREncodingRequired())
-      {
-        if (schemaValidationPolicy.checkAttributeValues().needsChecking()
-            && attributeDescription.containsOption("binary"))
-        {
-          final LocalizableMessage message = ERR_LDIF_UNEXPECTED_BINARY_OPTION
-              .get(record.lineNumber, entryDN.toString(), pair.value);
-          if (schemaValidationPolicy.checkAttributeValues().isReject())
-          {
-            schemaValidationFailure = true;
-          }
-          schemaErrors.add(message);
-          continue;
-        }
-      }
-      else
-      {
-        attributeDescription = attributeDescription.withOption("binary");
-      }
-
-      // Now go through the rest of the attributes until the "-" line is
-      // reached.
-      attributeValues.clear();
-      while (record.iterator.hasNext())
-      {
-        ldifLine = record.iterator.next();
-        if (ldifLine.equals("-"))
-        {
-          break;
         }
 
-        // Parse the attribute description.
-        final int colonPos = parseColonPosition(record, ldifLine);
-        final String attrDescr = ldifLine.substring(0, colonPos);
-
-        AttributeDescription attributeDescription2;
-        try
-        {
-          attributeDescription2 = AttributeDescription.valueOf(attrDescr,
-              schema);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          // No need to catch schema exception here because it implies that the
-          // attribute name is wrong and the record is malformed.
-          final LocalizableMessage message = ERR_LDIF_MALFORMED_ATTRIBUTE_NAME
-              .get(record.lineNumber, entryDN.toString(), attrDescr);
-          throw DecodeException.error(message);
+        try {
+            final RDN newRDN = RDN.valueOf(pair.value, schema);
+            modifyDNRequest = Requests.newModifyDNRequest(entryDN, newRDN);
+        } catch (final LocalizedIllegalArgumentException e) {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_NEW_RDN.get(record.lineNumber, entryDN.toString(),
+                            pair.value);
+            throw DecodeException.error(message);
         }
 
-        // Ensure that the binary option is present if required.
-        if (attributeDescription.getAttributeType().getSyntax()
-            .isBEREncodingRequired())
-        {
-          attributeDescription2 = attributeDescription2.withOption("binary");
+        // Parse the deleteoldrdn.
+        if (!record.iterator.hasNext()) {
+            final LocalizableMessage message =
+                    ERR_LDIF_NO_DELETE_OLD_RDN.get(record.lineNumber, entryDN.toString());
+            throw DecodeException.error(message);
         }
 
-        if (!attributeDescription2.equals(attributeDescription))
-        {
-          // Malformed record.
-          final LocalizableMessage message = ERR_LDIF_ATTRIBUTE_NAME_MISMATCH
-              .get(record.lineNumber, entryDN.toString(),
-                  attributeDescription2.toString(),
-                  attributeDescription.toString());
-          throw DecodeException.error(message);
+        ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
+        if (pair.key == null || !toLowerCase(pair.key).equals("deleteoldrdn")) {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_DELETE_OLD_RDN.get(record.lineNumber, entryDN.toString(),
+                            ldifLine);
+            throw DecodeException.error(message);
         }
 
-        // Parse the attribute value and check it if needed.
-        final ByteString value = parseSingleValue(record, ldifLine, entryDN,
-            colonPos, attrDescr);
-        if (schemaValidationPolicy.checkAttributeValues().needsChecking())
-        {
-          LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
-          if (!syntax.valueIsAcceptable(value, builder))
-          {
-            // Just log a message, but don't skip the value since this could
-            // change the semantics of the modification (e.g. if all values in a
-            // delete are skipped then this implies that the whole attribute
-            // should be removed).
-            if (schemaValidationPolicy.checkAttributeValues().isReject())
-            {
-              schemaValidationFailure = true;
+        final String delStr = toLowerCase(pair.value);
+        if (delStr.equals("false") || delStr.equals("no") || delStr.equals("0")) {
+            modifyDNRequest.setDeleteOldRDN(false);
+        } else if (delStr.equals("true") || delStr.equals("yes") || delStr.equals("1")) {
+            modifyDNRequest.setDeleteOldRDN(true);
+        } else {
+            final LocalizableMessage message =
+                    ERR_LDIF_MALFORMED_DELETE_OLD_RDN.get(record.lineNumber, entryDN.toString(),
+                            pair.value);
+            throw DecodeException.error(message);
+        }
+
+        // Parse the newsuperior if present.
+        if (record.iterator.hasNext()) {
+            ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
+            if (pair.key == null || !toLowerCase(pair.key).equals("newsuperior")) {
+                final LocalizableMessage message =
+                        ERR_LDIF_MALFORMED_NEW_SUPERIOR.get(record.lineNumber, entryDN.toString(),
+                                ldifLine);
+                throw DecodeException.error(message);
             }
-            schemaErrors.add(builder.toMessage());
-          }
+
+            try {
+                final DN newSuperiorDN = DN.valueOf(pair.value, schema);
+                modifyDNRequest.setNewSuperior(newSuperiorDN.toString());
+            } catch (final LocalizedIllegalArgumentException e) {
+                final LocalizableMessage message =
+                        ERR_LDIF_MALFORMED_NEW_SUPERIOR.get(record.lineNumber, entryDN.toString(),
+                                pair.value);
+                throw DecodeException.error(message);
+            }
         }
-        attributeValues.add(value);
-      }
 
-      final Modification change = new Modification(modType,
-          new LinkedAttribute(attributeDescription, attributeValues));
-      modifyRequest.addModification(change);
+        return modifyDNRequest;
     }
 
-    if (schemaValidationFailure)
-    {
-      handleSchemaValidationFailure(record, schemaErrors);
-      return null;
-    }
-
-    if (!schemaErrors.isEmpty())
-    {
-      handleSchemaValidationWarning(record, schemaErrors);
-    }
-
-    return modifyRequest;
-  }
-
-
-
-  private ChangeRecord parseModifyDNChangeRecordEntry(final DN entryDN,
-      final LDIFRecord record) throws DecodeException
-  {
-    ModifyDNRequest modifyDNRequest;
-
-    // Parse the newrdn.
-    if (!record.iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_LDIF_NO_NEW_RDN.get(
-          record.lineNumber, entryDN.toString());
-      throw DecodeException.error(message);
-    }
-
-    final KeyValuePair pair = new KeyValuePair();
-    String ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
-
-    if (pair.key == null || !toLowerCase(pair.key).equals("newrdn"))
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_NEW_RDN.get(
-          record.lineNumber, entryDN.toString(), ldifLine);
-      throw DecodeException.error(message);
-    }
-
-    try
-    {
-      final RDN newRDN = RDN.valueOf(pair.value, schema);
-      modifyDNRequest = Requests.newModifyDNRequest(entryDN, newRDN);
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_NEW_RDN.get(
-          record.lineNumber, entryDN.toString(), pair.value);
-      throw DecodeException.error(message);
-    }
-
-    // Parse the deleteoldrdn.
-    if (!record.iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_LDIF_NO_DELETE_OLD_RDN.get(
-          record.lineNumber, entryDN.toString());
-      throw DecodeException.error(message);
-    }
-
-    ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
-    if (pair.key == null || !toLowerCase(pair.key).equals("deleteoldrdn"))
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_DELETE_OLD_RDN.get(
-          record.lineNumber, entryDN.toString(), ldifLine);
-      throw DecodeException.error(message);
-    }
-
-    final String delStr = toLowerCase(pair.value);
-    if (delStr.equals("false") || delStr.equals("no") || delStr.equals("0"))
-    {
-      modifyDNRequest.setDeleteOldRDN(false);
-    }
-    else if (delStr.equals("true") || delStr.equals("yes")
-        || delStr.equals("1"))
-    {
-      modifyDNRequest.setDeleteOldRDN(true);
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_LDIF_MALFORMED_DELETE_OLD_RDN.get(
-          record.lineNumber, entryDN.toString(), pair.value);
-      throw DecodeException.error(message);
-    }
-
-    // Parse the newsuperior if present.
-    if (record.iterator.hasNext())
-    {
-      ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
-      if (pair.key == null || !toLowerCase(pair.key).equals("newsuperior"))
-      {
-        final LocalizableMessage message = ERR_LDIF_MALFORMED_NEW_SUPERIOR.get(
-            record.lineNumber, entryDN.toString(), ldifLine);
-        throw DecodeException.error(message);
-      }
-
-      try
-      {
-        final DN newSuperiorDN = DN.valueOf(pair.value, schema);
-        modifyDNRequest.setNewSuperior(newSuperiorDN.toString());
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        final LocalizableMessage message = ERR_LDIF_MALFORMED_NEW_SUPERIOR.get(
-            record.lineNumber, entryDN.toString(), pair.value);
-        throw DecodeException.error(message);
-      }
-    }
-
-    return modifyDNRequest;
-  }
-
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java
index 9ec0bca..79195f3 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,16 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.requests.AddRequest;
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
@@ -43,8 +45,6 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDIF change record writer writes change records using the LDAP Data
  * Interchange Format (LDIF) to a user defined destination.
@@ -52,421 +52,336 @@
  * @see <a href="http://tools.ietf.org/html/rfc2849">RFC 2849 - The LDAP Data
  *      Interchange Format (LDIF) - Technical Specification </a>
  */
-public final class LDIFChangeRecordWriter extends AbstractLDIFWriter implements
-    ChangeRecordWriter
-{
+public final class LDIFChangeRecordWriter extends AbstractLDIFWriter implements ChangeRecordWriter {
 
-  /**
-   * Creates a new LDIF change record writer which will append lines of LDIF to
-   * the provided list.
-   *
-   * @param ldifLines
-   *          The list to which lines of LDIF should be appended.
-   */
-  public LDIFChangeRecordWriter(final List<String> ldifLines)
-  {
-    super(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new LDIF change record writer whose destination is the provided
-   * output stream.
-   *
-   * @param out
-   *          The output stream to use.
-   */
-  public LDIFChangeRecordWriter(final OutputStream out)
-  {
-    super(out);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close() throws IOException
-  {
-    close0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void flush() throws IOException
-  {
-    flush0();
-  }
-
-
-
-  /**
-   * Specifies whether or not user-friendly comments should be added whenever
-   * distinguished names or UTF-8 attribute values are encountered which
-   * contained non-ASCII characters. The default is {@code false}.
-   *
-   * @param addUserFriendlyComments
-   *          {@code true} if user-friendly comments should be added, or {@code
-   *          false} otherwise.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFChangeRecordWriter setAddUserFriendlyComments(
-      final boolean addUserFriendlyComments)
-  {
-    this.addUserFriendlyComments = addUserFriendlyComments;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not all operational attributes should be excluded from
-   * any change records that are written to LDIF. The default is {@code false}.
-   *
-   * @param excludeOperationalAttributes
-   *          {@code true} if all operational attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setExcludeAllOperationalAttributes(
-      final boolean excludeOperationalAttributes)
-  {
-    this.excludeOperationalAttributes = excludeOperationalAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not all user attributes should be excluded from any
-   * change records that are written to LDIF. The default is {@code false}.
-   *
-   * @param excludeUserAttributes
-   *          {@code true} if all user attributes should be excluded, or {@code
-   *          false} otherwise.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setExcludeAllUserAttributes(
-      final boolean excludeUserAttributes)
-  {
-    this.excludeUserAttributes = excludeUserAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Excludes the named attribute from any change records that are written to
-   * LDIF. By default all attributes are included unless explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be excluded.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setExcludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    excludeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all change records which target entries beneath the named entry
-   * (inclusive) from being written to LDIF. By default all change records are
-   * written unless explicitly excluded or included.
-   *
-   * @param excludeBranch
-   *          The distinguished name of the branch to be excluded.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setExcludeBranch(final DN excludeBranch)
-  {
-    Validator.ensureNotNull(excludeBranch);
-    excludeBranches.add(excludeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that the named attribute is not excluded from any change records
-   * that are written to LDIF. By default all attributes are included unless
-   * explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be included.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setIncludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    includeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all change records which target entries beneath the named
-   * entry (inclusive) are written to LDIF. By default all change records are
-   * written unless explicitly excluded or included.
-   *
-   * @param includeBranch
-   *          The distinguished name of the branch to be included.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setIncludeBranch(final DN includeBranch)
-  {
-    Validator.ensureNotNull(includeBranch);
-    includeBranches.add(includeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Sets the schema which should be used when filtering change records (not
-   * required if no filtering is to be performed). The default schema is used if
-   * no other is specified.
-   *
-   * @param schema
-   *          The schema which should be used when filtering change records.
-   * @return A reference to this {@code LDIFChangeRecordWriter}.
-   */
-  public LDIFChangeRecordWriter setSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    this.schema = schema;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies the column at which long lines should be wrapped. A value less
-   * than or equal to zero (the default) indicates that no wrapping should be
-   * performed.
-   *
-   * @param wrapColumn
-   *          The column at which long lines should be wrapped.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFChangeRecordWriter setWrapColumn(final int wrapColumn)
-  {
-    this.wrapColumn = wrapColumn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeChangeRecord(final AddRequest change)
-      throws IOException
-  {
-    Validator.ensureNotNull(change);
-
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(change.getName()))
-    {
-      return this;
+    /**
+     * Creates a new LDIF change record writer which will append lines of LDIF
+     * to the provided list.
+     *
+     * @param ldifLines
+     *            The list to which lines of LDIF should be appended.
+     */
+    public LDIFChangeRecordWriter(final List<String> ldifLines) {
+        super(ldifLines);
     }
 
-    writeKeyAndValue("dn", change.getName().toString());
-    writeControls(change.getControls());
-    writeLine("changetype: add");
-    for (final Attribute attribute : change.getAllAttributes())
-    {
-      // Filter the attribute if required.
-      if (isAttributeExcluded(attribute.getAttributeDescription()))
-      {
-        continue;
-      }
-
-      final String attributeDescription = attribute
-          .getAttributeDescriptionAsString();
-      for (final ByteString value : attribute)
-      {
-        writeKeyAndValue(attributeDescription, value);
-      }
+    /**
+     * Creates a new LDIF change record writer whose destination is the provided
+     * output stream.
+     *
+     * @param out
+     *            The output stream to use.
+     */
+    public LDIFChangeRecordWriter(final OutputStream out) {
+        super(out);
     }
 
-    // Make sure there is a blank line after the entry.
-    impl.println();
-
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeChangeRecord(final ChangeRecord change)
-      throws IOException
-  {
-    Validator.ensureNotNull(change);
-
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(change.getName()))
-    {
-      return this;
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        close0();
     }
 
-    final IOException e = change.accept(
-        ChangeRecordVisitorWriter.getInstance(), this);
-    if (e != null)
-    {
-      throw e;
-    }
-    else
-    {
-      return this;
-    }
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeChangeRecord(final DeleteRequest change)
-      throws IOException
-  {
-    Validator.ensureNotNull(change);
-
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(change.getName()))
-    {
-      return this;
+    /**
+     * {@inheritDoc}
+     */
+    public void flush() throws IOException {
+        flush0();
     }
 
-    writeKeyAndValue("dn", change.getName().toString());
-    writeControls(change.getControls());
-    writeLine("changetype: delete");
-
-    // Make sure there is a blank line after the entry.
-    impl.println();
-
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeChangeRecord(final ModifyDNRequest change)
-      throws IOException
-  {
-    Validator.ensureNotNull(change);
-
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(change.getName()))
-    {
-      return this;
+    /**
+     * Specifies whether or not user-friendly comments should be added whenever
+     * distinguished names or UTF-8 attribute values are encountered which
+     * contained non-ASCII characters. The default is {@code false}.
+     *
+     * @param addUserFriendlyComments
+     *            {@code true} if user-friendly comments should be added, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFChangeRecordWriter setAddUserFriendlyComments(final boolean addUserFriendlyComments) {
+        this.addUserFriendlyComments = addUserFriendlyComments;
+        return this;
     }
 
-    writeKeyAndValue("dn", change.getName().toString());
-    writeControls(change.getControls());
-
-    // Write the changetype. Some older tools may not support the
-    // "moddn" changetype, so only use it if a newSuperior element has
-    // been provided, but use modrdn elsewhere.
-    if (change.getNewSuperior() == null)
-    {
-      writeLine("changetype: modrdn");
-    }
-    else
-    {
-      writeLine("changetype: moddn");
+    /**
+     * Specifies whether or not all operational attributes should be excluded
+     * from any change records that are written to LDIF. The default is
+     * {@code false}.
+     *
+     * @param excludeOperationalAttributes
+     *            {@code true} if all operational attributes should be excluded,
+     *            or {@code false} otherwise.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setExcludeAllOperationalAttributes(
+            final boolean excludeOperationalAttributes) {
+        this.excludeOperationalAttributes = excludeOperationalAttributes;
+        return this;
     }
 
-    writeKeyAndValue("newrdn", change.getNewRDN().toString());
-    writeKeyAndValue("deleteoldrdn", change.isDeleteOldRDN() ? "1" : "0");
-    if (change.getNewSuperior() != null)
-    {
-      writeKeyAndValue("newsuperior", change.getNewSuperior().toString());
+    /**
+     * Specifies whether or not all user attributes should be excluded from any
+     * change records that are written to LDIF. The default is {@code false}.
+     *
+     * @param excludeUserAttributes
+     *            {@code true} if all user attributes should be excluded, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setExcludeAllUserAttributes(final boolean excludeUserAttributes) {
+        this.excludeUserAttributes = excludeUserAttributes;
+        return this;
     }
 
-    // Make sure there is a blank line after the entry.
-    impl.println();
-
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeChangeRecord(final ModifyRequest change)
-      throws IOException
-  {
-    Validator.ensureNotNull(change);
-
-    // If there aren't any modifications, then there's nothing to do.
-    if (change.getModifications().isEmpty())
-    {
-      return this;
+    /**
+     * Excludes the named attribute from any change records that are written to
+     * LDIF. By default all attributes are included unless explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be excluded.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setExcludeAttribute(
+            final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        excludeAttributes.add(attributeDescription);
+        return this;
     }
 
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(change.getName()))
-    {
-      return this;
+    /**
+     * Excludes all change records which target entries beneath the named entry
+     * (inclusive) from being written to LDIF. By default all change records are
+     * written unless explicitly excluded or included.
+     *
+     * @param excludeBranch
+     *            The distinguished name of the branch to be excluded.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setExcludeBranch(final DN excludeBranch) {
+        Validator.ensureNotNull(excludeBranch);
+        excludeBranches.add(excludeBranch);
+        return this;
     }
 
-    writeKeyAndValue("dn", change.getName().toString());
-    writeControls(change.getControls());
-    writeLine("changetype: modify");
-
-    for (final Modification modification : change.getModifications())
-    {
-      final ModificationType type = modification.getModificationType();
-      final Attribute attribute = modification.getAttribute();
-      final String attributeDescription = attribute
-          .getAttributeDescriptionAsString();
-
-      // Filter the attribute if required.
-      if (isAttributeExcluded(attribute.getAttributeDescription()))
-      {
-        continue;
-      }
-
-      writeKeyAndValue(type.toString(), attributeDescription);
-      for (final ByteString value : attribute)
-      {
-        writeKeyAndValue(attributeDescription, value);
-      }
-      writeLine("-");
+    /**
+     * Ensures that the named attribute is not excluded from any change records
+     * that are written to LDIF. By default all attributes are included unless
+     * explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be included.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setIncludeAttribute(
+            final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        includeAttributes.add(attributeDescription);
+        return this;
     }
 
-    // Make sure there is a blank line after the entry.
-    impl.println();
+    /**
+     * Ensures that all change records which target entries beneath the named
+     * entry (inclusive) are written to LDIF. By default all change records are
+     * written unless explicitly excluded or included.
+     *
+     * @param includeBranch
+     *            The distinguished name of the branch to be included.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setIncludeBranch(final DN includeBranch) {
+        Validator.ensureNotNull(includeBranch);
+        includeBranches.add(includeBranch);
+        return this;
+    }
 
-    return this;
-  }
+    /**
+     * Sets the schema which should be used when filtering change records (not
+     * required if no filtering is to be performed). The default schema is used
+     * if no other is specified.
+     *
+     * @param schema
+     *            The schema which should be used when filtering change records.
+     * @return A reference to this {@code LDIFChangeRecordWriter}.
+     */
+    public LDIFChangeRecordWriter setSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        this.schema = schema;
+        return this;
+    }
 
+    /**
+     * Specifies the column at which long lines should be wrapped. A value less
+     * than or equal to zero (the default) indicates that no wrapping should be
+     * performed.
+     *
+     * @param wrapColumn
+     *            The column at which long lines should be wrapped.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFChangeRecordWriter setWrapColumn(final int wrapColumn) {
+        this.wrapColumn = wrapColumn;
+        return this;
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeChangeRecord(final AddRequest change) throws IOException {
+        Validator.ensureNotNull(change);
 
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFChangeRecordWriter writeComment(final CharSequence comment)
-      throws IOException
-  {
-    writeComment0(comment);
-    return this;
-  }
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(change.getName())) {
+            return this;
+        }
+
+        writeKeyAndValue("dn", change.getName().toString());
+        writeControls(change.getControls());
+        writeLine("changetype: add");
+        for (final Attribute attribute : change.getAllAttributes()) {
+            // Filter the attribute if required.
+            if (isAttributeExcluded(attribute.getAttributeDescription())) {
+                continue;
+            }
+
+            final String attributeDescription = attribute.getAttributeDescriptionAsString();
+            for (final ByteString value : attribute) {
+                writeKeyAndValue(attributeDescription, value);
+            }
+        }
+
+        // Make sure there is a blank line after the entry.
+        impl.println();
+
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeChangeRecord(final ChangeRecord change) throws IOException {
+        Validator.ensureNotNull(change);
+
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(change.getName())) {
+            return this;
+        }
+
+        final IOException e = change.accept(ChangeRecordVisitorWriter.getInstance(), this);
+        if (e != null) {
+            throw e;
+        } else {
+            return this;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeChangeRecord(final DeleteRequest change) throws IOException {
+        Validator.ensureNotNull(change);
+
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(change.getName())) {
+            return this;
+        }
+
+        writeKeyAndValue("dn", change.getName().toString());
+        writeControls(change.getControls());
+        writeLine("changetype: delete");
+
+        // Make sure there is a blank line after the entry.
+        impl.println();
+
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeChangeRecord(final ModifyDNRequest change)
+            throws IOException {
+        Validator.ensureNotNull(change);
+
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(change.getName())) {
+            return this;
+        }
+
+        writeKeyAndValue("dn", change.getName().toString());
+        writeControls(change.getControls());
+
+        // Write the changetype. Some older tools may not support the
+        // "moddn" changetype, so only use it if a newSuperior element has
+        // been provided, but use modrdn elsewhere.
+        if (change.getNewSuperior() == null) {
+            writeLine("changetype: modrdn");
+        } else {
+            writeLine("changetype: moddn");
+        }
+
+        writeKeyAndValue("newrdn", change.getNewRDN().toString());
+        writeKeyAndValue("deleteoldrdn", change.isDeleteOldRDN() ? "1" : "0");
+        if (change.getNewSuperior() != null) {
+            writeKeyAndValue("newsuperior", change.getNewSuperior().toString());
+        }
+
+        // Make sure there is a blank line after the entry.
+        impl.println();
+
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeChangeRecord(final ModifyRequest change) throws IOException {
+        Validator.ensureNotNull(change);
+
+        // If there aren't any modifications, then there's nothing to do.
+        if (change.getModifications().isEmpty()) {
+            return this;
+        }
+
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(change.getName())) {
+            return this;
+        }
+
+        writeKeyAndValue("dn", change.getName().toString());
+        writeControls(change.getControls());
+        writeLine("changetype: modify");
+
+        for (final Modification modification : change.getModifications()) {
+            final ModificationType type = modification.getModificationType();
+            final Attribute attribute = modification.getAttribute();
+            final String attributeDescription = attribute.getAttributeDescriptionAsString();
+
+            // Filter the attribute if required.
+            if (isAttributeExcluded(attribute.getAttributeDescription())) {
+                continue;
+            }
+
+            writeKeyAndValue(type.toString(), attributeDescription);
+            for (final ByteString value : attribute) {
+                writeKeyAndValue(attributeDescription, value);
+            }
+            writeLine("-");
+        }
+
+        // Make sure there is a blank line after the entry.
+        impl.println();
+
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFChangeRecordWriter writeComment(final CharSequence comment) throws IOException {
+        writeComment0(comment);
+        return this;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java
index 00fd04a..3cd1a7d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static org.forgerock.opendj.ldap.CoreMessages.*;
 
 import java.io.IOException;
@@ -41,14 +38,17 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.Matcher;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDIF entry reader reads attribute value records (entries) using the LDAP
  * Data Interchange Format (LDIF) from a user defined source.
@@ -56,456 +56,373 @@
  * @see <a href="http://tools.ietf.org/html/rfc2849">RFC 2849 - The LDAP Data
  *      Interchange Format (LDIF) - Technical Specification </a>
  */
-public final class LDIFEntryReader extends AbstractLDIFReader implements
-    EntryReader
-{
-  // Poison used to indicate end of LDIF.
-  private static final Entry EOF = new LinkedHashMapEntry();
+public final class LDIFEntryReader extends AbstractLDIFReader implements EntryReader {
+    // Poison used to indicate end of LDIF.
+    private static final Entry EOF = new LinkedHashMapEntry();
 
+    /**
+     * Parses the provided array of LDIF lines as a single LDIF entry.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be parsed.
+     * @return The parsed LDIF entry.
+     * @throws LocalizedIllegalArgumentException
+     *             If {@code ldifLines} did not contain an LDIF entry, if it
+     *             contained multiple entries, if contained malformed LDIF, or
+     *             if the entry could not be decoded using the default schema.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public static Entry valueOfLDIFEntry(final String... ldifLines) {
+        final LDIFEntryReader reader = new LDIFEntryReader(ldifLines);
+        try {
+            if (!reader.hasNext()) {
+                // No change record found.
+                final LocalizableMessage message =
+                        WARN_READ_LDIF_RECORD_NO_CHANGE_RECORD_FOUND.get();
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
+            final Entry entry = reader.readEntry();
 
-  /**
-   * Parses the provided array of LDIF lines as a single LDIF entry.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be parsed.
-   * @return The parsed LDIF entry.
-   * @throws LocalizedIllegalArgumentException
-   *           If {@code ldifLines} did not contain an LDIF entry, if it
-   *           contained multiple entries, if contained malformed LDIF, or if
-   *           the entry could not be decoded using the default schema.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public static Entry valueOfLDIFEntry(final String... ldifLines)
-  {
-    final LDIFEntryReader reader = new LDIFEntryReader(ldifLines);
-    try
-    {
-      if (!reader.hasNext())
-      {
-        // No change record found.
-        final LocalizableMessage message = WARN_READ_LDIF_RECORD_NO_CHANGE_RECORD_FOUND
-            .get();
-        throw new LocalizedIllegalArgumentException(message);
-      }
+            if (reader.hasNext()) {
+                // Multiple change records found.
+                final LocalizableMessage message =
+                        WARN_READ_LDIF_RECORD_MULTIPLE_CHANGE_RECORDS_FOUND.get();
+                throw new LocalizedIllegalArgumentException(message);
+            }
 
-      final Entry entry = reader.readEntry();
-
-      if (reader.hasNext())
-      {
-        // Multiple change records found.
-        final LocalizableMessage message = WARN_READ_LDIF_RECORD_MULTIPLE_CHANGE_RECORDS_FOUND
-            .get();
-        throw new LocalizedIllegalArgumentException(message);
-      }
-
-      return entry;
-    }
-    catch (final DecodeException e)
-    {
-      // Badly formed LDIF.
-      throw new LocalizedIllegalArgumentException(e.getMessageObject());
-    }
-    catch (final IOException e)
-    {
-      // This should never happen for a String based reader.
-      final LocalizableMessage message = WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR
-          .get(e.getMessage());
-      throw new LocalizedIllegalArgumentException(message);
-    }
-  }
-
-
-
-  private Entry nextEntry = null;
-
-
-
-  /**
-   * Creates a new LDIF entry reader whose source is the provided input stream.
-   *
-   * @param in
-   *          The input stream to use.
-   * @throws NullPointerException
-   *           If {@code in} was {@code null}.
-   */
-  public LDIFEntryReader(final InputStream in)
-  {
-    super(in);
-  }
-
-
-
-  /**
-   * Creates a new LDIF entry reader which will read lines of LDIF from the
-   * provided list of LDIF lines.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be read.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public LDIFEntryReader(final List<String> ldifLines)
-  {
-    super(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new LDIF entry reader which will read lines of LDIF from the
-   * provided array of LDIF lines.
-   *
-   * @param ldifLines
-   *          The lines of LDIF to be read.
-   * @throws NullPointerException
-   *           If {@code ldifLines} was {@code null}.
-   */
-  public LDIFEntryReader(final String... ldifLines)
-  {
-    super(Arrays.asList(ldifLines));
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void close() throws IOException
-  {
-    close0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   *
-   * @throws DecodeException
-   *           If the entry could not be decoded because it was malformed.
-   */
-  @Override
-  public boolean hasNext() throws DecodeException, IOException
-  {
-    return getNextEntry() != EOF;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   *
-   * @throws DecodeException
-   *           If the entry could not be decoded because it was malformed.
-   */
-  @Override
-  public Entry readEntry() throws DecodeException, IOException
-  {
-    if (!hasNext())
-    {
-      // LDIF reader has completed successfully.
-      throw new NoSuchElementException();
+            return entry;
+        } catch (final DecodeException e) {
+            // Badly formed LDIF.
+            throw new LocalizedIllegalArgumentException(e.getMessageObject());
+        } catch (final IOException e) {
+            // This should never happen for a String based reader.
+            final LocalizableMessage message =
+                    WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage());
+            throw new LocalizedIllegalArgumentException(message);
+        }
     }
 
-    final Entry entry = nextEntry;
-    nextEntry = null;
-    return entry;
-  }
+    private Entry nextEntry = null;
 
-
-
-  /**
-   * Specifies whether or not all operational attributes should be excluded from
-   * any entries that are read from LDIF. The default is {@code false}.
-   *
-   * @param excludeOperationalAttributes
-   *          {@code true} if all operational attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setExcludeAllOperationalAttributes(
-      final boolean excludeOperationalAttributes)
-  {
-    this.excludeOperationalAttributes = excludeOperationalAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not all user attributes should be excluded from any
-   * entries that are read from LDIF. The default is {@code false}.
-   *
-   * @param excludeUserAttributes
-   *          {@code true} if all user attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setExcludeAllUserAttributes(
-      final boolean excludeUserAttributes)
-  {
-    this.excludeUserAttributes = excludeUserAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Excludes the named attribute from any entries that are read from LDIF. By
-   * default all attributes are included unless explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be excluded.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setExcludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    excludeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all entries beneath the named entry (inclusive) from being read
-   * from LDIF. By default all entries are written unless explicitly excluded or
-   * included by branches or filters.
-   *
-   * @param excludeBranch
-   *          The distinguished name of the branch to be excluded.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setExcludeBranch(final DN excludeBranch)
-  {
-    Validator.ensureNotNull(excludeBranch);
-    excludeBranches.add(excludeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all entries which match the provided filter matcher from being
-   * read from LDIF. By default all entries are read unless explicitly excluded
-   * or included by branches or filters.
-   *
-   * @param excludeFilter
-   *          The filter matcher.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setExcludeFilter(final Matcher excludeFilter)
-  {
-    Validator.ensureNotNull(excludeFilter);
-    excludeFilters.add(excludeFilter);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that the named attribute is not excluded from any entries that are
-   * read from LDIF. By default all attributes are included unless explicitly
-   * excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be included.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setIncludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    includeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all entries beneath the named entry (inclusive) are read from
-   * LDIF. By default all entries are written unless explicitly excluded or
-   * included by branches or filters.
-   *
-   * @param includeBranch
-   *          The distinguished name of the branch to be included.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setIncludeBranch(final DN includeBranch)
-  {
-    Validator.ensureNotNull(includeBranch);
-    includeBranches.add(includeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all entries which match the provided filter matcher are read
-   * from LDIF. By default all entries are read unless explicitly excluded or
-   * included by branches or filters.
-   *
-   * @param includeFilter
-   *          The filter matcher.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setIncludeFilter(final Matcher includeFilter)
-  {
-    Validator.ensureNotNull(includeFilter);
-    includeFilters.add(includeFilter);
-    return this;
-  }
-
-
-
-  /**
-   * Sets the rejected record listener which should be notified whenever an LDIF
-   * record is skipped, malformed, or fails schema validation.
-   * <p>
-   * By default the {@link RejectedLDIFListener#FAIL_FAST} listener is used.
-   *
-   * @param listener
-   *          The rejected record listener.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setRejectedLDIFListener(
-      final RejectedLDIFListener listener)
-  {
-    this.rejectedRecordListener = listener;
-    return this;
-  }
-
-
-
-  /**
-   * Sets the schema which should be used for decoding entries that are read
-   * from LDIF. The default schema is used if no other is specified.
-   *
-   * @param schema
-   *          The schema which should be used for decoding entries that are read
-   *          from LDIF.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    this.schema = schemaValidationPolicy.checkAttributesAndObjectClasses()
-        .needsChecking() ? schema.asStrictSchema() : schema.asNonStrictSchema();
-    return this;
-  }
-
-
-
-  /**
-   * Specifies the schema validation which should be used when reading LDIF
-   * entry records. If attribute value validation is enabled then all checks
-   * will be performed.
-   * <p>
-   * Schema validation is disabled by default.
-   * <p>
-   * <b>NOTE:</b> this method copies the provided policy so changes made to it
-   * after this method has been called will have no effect.
-   *
-   * @param policy
-   *          The schema validation which should be used when reading LDIF entry
-   *          records.
-   * @return A reference to this {@code LDIFEntryReader}.
-   */
-  public LDIFEntryReader setSchemaValidationPolicy(
-      final SchemaValidationPolicy policy)
-  {
-    this.schemaValidationPolicy = SchemaValidationPolicy.copyOf(policy);
-    this.schema = schemaValidationPolicy.checkAttributesAndObjectClasses()
-        .needsChecking() ? schema.asStrictSchema() : schema.asNonStrictSchema();
-    return this;
-  }
-
-
-
-  private Entry getNextEntry() throws DecodeException, IOException
-  {
-    while (nextEntry == null)
-    {
-      // Read the set of lines that make up the next entry.
-      final LDIFRecord record = readLDIFRecord();
-      if (record == null)
-      {
-        nextEntry = EOF;
-        break;
-      }
-
-      try
-      {
-        // Read the DN of the entry and see if it is one that should be
-        // included in the import.
-        final DN entryDN = readLDIFRecordDN(record);
-        if (entryDN == null)
-        {
-          // Skip version record.
-          continue;
-        }
-
-        // Skip if branch containing the entry DN is excluded.
-        if (isBranchExcluded(entryDN))
-        {
-          final LocalizableMessage message = ERR_LDIF_ENTRY_EXCLUDED_BY_DN.get(
-              record.lineNumber, entryDN.toString());
-          handleSkippedRecord(record, message);
-          continue;
-        }
-
-        // Use an Entry for the AttributeSequence.
-        final Entry entry = new LinkedHashMapEntry(entryDN);
-        boolean schemaValidationFailure = false;
-        final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
-        while (record.iterator.hasNext())
-        {
-          final String ldifLine = record.iterator.next();
-          if (!readLDIFRecordAttributeValue(record, ldifLine, entry,
-              schemaErrors))
-          {
-            schemaValidationFailure = true;
-          }
-        }
-
-        // Skip if the entry is excluded by any filters.
-        if (isEntryExcluded(entry))
-        {
-          final LocalizableMessage message = ERR_LDIF_ENTRY_EXCLUDED_BY_FILTER
-              .get(record.lineNumber, entryDN.toString());
-          handleSkippedRecord(record, message);
-          continue;
-        }
-
-        if (!schema.validateEntry(entry, schemaValidationPolicy, schemaErrors))
-        {
-          schemaValidationFailure = true;
-        }
-
-        if (schemaValidationFailure)
-        {
-          handleSchemaValidationFailure(record, schemaErrors);
-          continue;
-        }
-
-        if (!schemaErrors.isEmpty())
-        {
-          handleSchemaValidationWarning(record, schemaErrors);
-        }
-
-        nextEntry = entry;
-      }
-      catch (final DecodeException e)
-      {
-        handleMalformedRecord(record, e.getMessageObject());
-        continue;
-      }
+    /**
+     * Creates a new LDIF entry reader whose source is the provided input
+     * stream.
+     *
+     * @param in
+     *            The input stream to use.
+     * @throws NullPointerException
+     *             If {@code in} was {@code null}.
+     */
+    public LDIFEntryReader(final InputStream in) {
+        super(in);
     }
 
-    return nextEntry;
-  }
+    /**
+     * Creates a new LDIF entry reader which will read lines of LDIF from the
+     * provided list of LDIF lines.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be read.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public LDIFEntryReader(final List<String> ldifLines) {
+        super(ldifLines);
+    }
+
+    /**
+     * Creates a new LDIF entry reader which will read lines of LDIF from the
+     * provided array of LDIF lines.
+     *
+     * @param ldifLines
+     *            The lines of LDIF to be read.
+     * @throws NullPointerException
+     *             If {@code ldifLines} was {@code null}.
+     */
+    public LDIFEntryReader(final String... ldifLines) {
+        super(Arrays.asList(ldifLines));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() throws IOException {
+        close0();
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DecodeException
+     *             If the entry could not be decoded because it was malformed.
+     */
+    @Override
+    public boolean hasNext() throws DecodeException, IOException {
+        return getNextEntry() != EOF;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DecodeException
+     *             If the entry could not be decoded because it was malformed.
+     */
+    @Override
+    public Entry readEntry() throws DecodeException, IOException {
+        if (!hasNext()) {
+            // LDIF reader has completed successfully.
+            throw new NoSuchElementException();
+        }
+
+        final Entry entry = nextEntry;
+        nextEntry = null;
+        return entry;
+    }
+
+    /**
+     * Specifies whether or not all operational attributes should be excluded
+     * from any entries that are read from LDIF. The default is {@code false}.
+     *
+     * @param excludeOperationalAttributes
+     *            {@code true} if all operational attributes should be excluded,
+     *            or {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setExcludeAllOperationalAttributes(
+            final boolean excludeOperationalAttributes) {
+        this.excludeOperationalAttributes = excludeOperationalAttributes;
+        return this;
+    }
+
+    /**
+     * Specifies whether or not all user attributes should be excluded from any
+     * entries that are read from LDIF. The default is {@code false}.
+     *
+     * @param excludeUserAttributes
+     *            {@code true} if all user attributes should be excluded, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setExcludeAllUserAttributes(final boolean excludeUserAttributes) {
+        this.excludeUserAttributes = excludeUserAttributes;
+        return this;
+    }
+
+    /**
+     * Excludes the named attribute from any entries that are read from LDIF. By
+     * default all attributes are included unless explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be excluded.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setExcludeAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        excludeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Excludes all entries beneath the named entry (inclusive) from being read
+     * from LDIF. By default all entries are written unless explicitly excluded
+     * or included by branches or filters.
+     *
+     * @param excludeBranch
+     *            The distinguished name of the branch to be excluded.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setExcludeBranch(final DN excludeBranch) {
+        Validator.ensureNotNull(excludeBranch);
+        excludeBranches.add(excludeBranch);
+        return this;
+    }
+
+    /**
+     * Excludes all entries which match the provided filter matcher from being
+     * read from LDIF. By default all entries are read unless explicitly
+     * excluded or included by branches or filters.
+     *
+     * @param excludeFilter
+     *            The filter matcher.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setExcludeFilter(final Matcher excludeFilter) {
+        Validator.ensureNotNull(excludeFilter);
+        excludeFilters.add(excludeFilter);
+        return this;
+    }
+
+    /**
+     * Ensures that the named attribute is not excluded from any entries that
+     * are read from LDIF. By default all attributes are included unless
+     * explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be included.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setIncludeAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        includeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Ensures that all entries beneath the named entry (inclusive) are read
+     * from LDIF. By default all entries are written unless explicitly excluded
+     * or included by branches or filters.
+     *
+     * @param includeBranch
+     *            The distinguished name of the branch to be included.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setIncludeBranch(final DN includeBranch) {
+        Validator.ensureNotNull(includeBranch);
+        includeBranches.add(includeBranch);
+        return this;
+    }
+
+    /**
+     * Ensures that all entries which match the provided filter matcher are read
+     * from LDIF. By default all entries are read unless explicitly excluded or
+     * included by branches or filters.
+     *
+     * @param includeFilter
+     *            The filter matcher.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setIncludeFilter(final Matcher includeFilter) {
+        Validator.ensureNotNull(includeFilter);
+        includeFilters.add(includeFilter);
+        return this;
+    }
+
+    /**
+     * Sets the rejected record listener which should be notified whenever an
+     * LDIF record is skipped, malformed, or fails schema validation.
+     * <p>
+     * By default the {@link RejectedLDIFListener#FAIL_FAST} listener is used.
+     *
+     * @param listener
+     *            The rejected record listener.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setRejectedLDIFListener(final RejectedLDIFListener listener) {
+        this.rejectedRecordListener = listener;
+        return this;
+    }
+
+    /**
+     * Sets the schema which should be used for decoding entries that are read
+     * from LDIF. The default schema is used if no other is specified.
+     *
+     * @param schema
+     *            The schema which should be used for decoding entries that are
+     *            read from LDIF.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        this.schema =
+                schemaValidationPolicy.checkAttributesAndObjectClasses().needsChecking() ? schema
+                        .asStrictSchema() : schema.asNonStrictSchema();
+        return this;
+    }
+
+    /**
+     * Specifies the schema validation which should be used when reading LDIF
+     * entry records. If attribute value validation is enabled then all checks
+     * will be performed.
+     * <p>
+     * Schema validation is disabled by default.
+     * <p>
+     * <b>NOTE:</b> this method copies the provided policy so changes made to it
+     * after this method has been called will have no effect.
+     *
+     * @param policy
+     *            The schema validation which should be used when reading LDIF
+     *            entry records.
+     * @return A reference to this {@code LDIFEntryReader}.
+     */
+    public LDIFEntryReader setSchemaValidationPolicy(final SchemaValidationPolicy policy) {
+        this.schemaValidationPolicy = SchemaValidationPolicy.copyOf(policy);
+        this.schema =
+                schemaValidationPolicy.checkAttributesAndObjectClasses().needsChecking() ? schema
+                        .asStrictSchema() : schema.asNonStrictSchema();
+        return this;
+    }
+
+    private Entry getNextEntry() throws DecodeException, IOException {
+        while (nextEntry == null) {
+            // Read the set of lines that make up the next entry.
+            final LDIFRecord record = readLDIFRecord();
+            if (record == null) {
+                nextEntry = EOF;
+                break;
+            }
+
+            try {
+                // Read the DN of the entry and see if it is one that should be
+                // included in the import.
+                final DN entryDN = readLDIFRecordDN(record);
+                if (entryDN == null) {
+                    // Skip version record.
+                    continue;
+                }
+
+                // Skip if branch containing the entry DN is excluded.
+                if (isBranchExcluded(entryDN)) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_ENTRY_EXCLUDED_BY_DN
+                                    .get(record.lineNumber, entryDN.toString());
+                    handleSkippedRecord(record, message);
+                    continue;
+                }
+
+                // Use an Entry for the AttributeSequence.
+                final Entry entry = new LinkedHashMapEntry(entryDN);
+                boolean schemaValidationFailure = false;
+                final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
+                while (record.iterator.hasNext()) {
+                    final String ldifLine = record.iterator.next();
+                    if (!readLDIFRecordAttributeValue(record, ldifLine, entry, schemaErrors)) {
+                        schemaValidationFailure = true;
+                    }
+                }
+
+                // Skip if the entry is excluded by any filters.
+                if (isEntryExcluded(entry)) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_ENTRY_EXCLUDED_BY_FILTER.get(record.lineNumber, entryDN
+                                    .toString());
+                    handleSkippedRecord(record, message);
+                    continue;
+                }
+
+                if (!schema.validateEntry(entry, schemaValidationPolicy, schemaErrors)) {
+                    schemaValidationFailure = true;
+                }
+
+                if (schemaValidationFailure) {
+                    handleSchemaValidationFailure(record, schemaErrors);
+                    continue;
+                }
+
+                if (!schemaErrors.isEmpty()) {
+                    handleSchemaValidationWarning(record, schemaErrors);
+                }
+
+                nextEntry = entry;
+            } catch (final DecodeException e) {
+                handleMalformedRecord(record, e.getMessageObject());
+                continue;
+            }
+        }
+
+        return nextEntry;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java
index 91c261f..7e3a60c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,20 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.Matcher;
 import org.forgerock.opendj.ldap.schema.Schema;
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * An LDIF entry writer writes attribute value records (entries) using the LDAP
  * Data Interchange Format (LDIF) to a user defined destination.
@@ -48,315 +48,250 @@
  * @see <a href="http://tools.ietf.org/html/rfc2849">RFC 2849 - The LDAP Data
  *      Interchange Format (LDIF) - Technical Specification </a>
  */
-public final class LDIFEntryWriter extends AbstractLDIFWriter implements
-    EntryWriter
-{
+public final class LDIFEntryWriter extends AbstractLDIFWriter implements EntryWriter {
 
-  /**
-   * Creates a new LDIF entry writer which will append lines of LDIF to the
-   * provided list.
-   *
-   * @param ldifLines
-   *          The list to which lines of LDIF should be appended.
-   */
-  public LDIFEntryWriter(final List<String> ldifLines)
-  {
-    super(ldifLines);
-  }
-
-
-
-  /**
-   * Creates a new LDIF entry writer whose destination is the provided output
-   * stream.
-   *
-   * @param out
-   *          The output stream to use.
-   */
-  public LDIFEntryWriter(final OutputStream out)
-  {
-    super(out);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void close() throws IOException
-  {
-    close0();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void flush() throws IOException
-  {
-    flush0();
-  }
-
-
-
-  /**
-   * Specifies whether or not user-friendly comments should be added whenever
-   * distinguished names or UTF-8 attribute values are encountered which
-   * contained non-ASCII characters. The default is {@code false}.
-   *
-   * @param addUserFriendlyComments
-   *          {@code true} if user-friendly comments should be added, or {@code
-   *          false} otherwise.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setAddUserFriendlyComments(
-      final boolean addUserFriendlyComments)
-  {
-    this.addUserFriendlyComments = addUserFriendlyComments;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not all operational attributes should be excluded from
-   * any entries that are written to LDIF. The default is {@code false}.
-   *
-   * @param excludeOperationalAttributes
-   *          {@code true} if all operational attributes should be excluded, or
-   *          {@code false} otherwise.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setExcludeAllOperationalAttributes(
-      final boolean excludeOperationalAttributes)
-  {
-    this.excludeOperationalAttributes = excludeOperationalAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies whether or not all user attributes should be excluded from any
-   * entries that are written to LDIF. The default is {@code false}.
-   *
-   * @param excludeUserAttributes
-   *          {@code true} if all user attributes should be excluded, or {@code
-   *          false} otherwise.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setExcludeAllUserAttributes(
-      final boolean excludeUserAttributes)
-  {
-    this.excludeUserAttributes = excludeUserAttributes;
-    return this;
-  }
-
-
-
-  /**
-   * Excludes the named attribute from any entries that are written to LDIF. By
-   * default all attributes are included unless explicitly excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be excluded.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setExcludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    excludeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all entries beneath the named entry (inclusive) from being written
-   * to LDIF. By default all entries are written unless explicitly excluded or
-   * included by branches or filters.
-   *
-   * @param excludeBranch
-   *          The distinguished name of the branch to be excluded.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setExcludeBranch(final DN excludeBranch)
-  {
-    Validator.ensureNotNull(excludeBranch);
-    excludeBranches.add(excludeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Excludes all entries which match the provided filter matcher from being
-   * written to LDIF. By default all entries are written unless explicitly
-   * excluded or included by branches or filters.
-   *
-   * @param excludeFilter
-   *          The filter matcher.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setExcludeFilter(final Matcher excludeFilter)
-  {
-    Validator.ensureNotNull(excludeFilter);
-    excludeFilters.add(excludeFilter);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that the named attribute is not excluded from any entries that are
-   * written to LDIF. By default all attributes are included unless explicitly
-   * excluded.
-   *
-   * @param attributeDescription
-   *          The name of the attribute to be included.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setIncludeAttribute(
-      final AttributeDescription attributeDescription)
-  {
-    Validator.ensureNotNull(attributeDescription);
-    includeAttributes.add(attributeDescription);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all entries beneath the named entry (inclusive) are written to
-   * LDIF. By default all entries are written unless explicitly excluded or
-   * included by branches or filters.
-   *
-   * @param includeBranch
-   *          The distinguished name of the branch to be included.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setIncludeBranch(final DN includeBranch)
-  {
-    Validator.ensureNotNull(includeBranch);
-    includeBranches.add(includeBranch);
-    return this;
-  }
-
-
-
-  /**
-   * Ensures that all entries which match the provided filter matcher are
-   * written to LDIF. By default all entries are written unless explicitly
-   * excluded or included by branches or filters.
-   *
-   * @param includeFilter
-   *          The filter matcher.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setIncludeFilter(final Matcher includeFilter)
-  {
-    Validator.ensureNotNull(includeFilter);
-    includeFilters.add(includeFilter);
-    return this;
-  }
-
-
-
-  /**
-   * Sets the schema which should be used when filtering entries (not required
-   * if no filtering is to be performed). The default schema is used if no other
-   * is specified.
-   *
-   * @param schema
-   *          The schema which should be used when filtering entries.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setSchema(final Schema schema)
-  {
-    Validator.ensureNotNull(schema);
-    this.schema = schema;
-    return this;
-  }
-
-
-
-  /**
-   * Specifies the column at which long lines should be wrapped. A value less
-   * than or equal to zero (the default) indicates that no wrapping should be
-   * performed.
-   *
-   * @param wrapColumn
-   *          The column at which long lines should be wrapped.
-   * @return A reference to this {@code LDIFEntryWriter}.
-   */
-  public LDIFEntryWriter setWrapColumn(final int wrapColumn)
-  {
-    this.wrapColumn = wrapColumn;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFEntryWriter writeComment(final CharSequence comment)
-      throws IOException
-  {
-    writeComment0(comment);
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LDIFEntryWriter writeEntry(final Entry entry) throws IOException
-  {
-    Validator.ensureNotNull(entry);
-
-    // Skip if branch containing the entry is excluded.
-    if (isBranchExcluded(entry.getName()))
-    {
-      return this;
+    /**
+     * Creates a new LDIF entry writer which will append lines of LDIF to the
+     * provided list.
+     *
+     * @param ldifLines
+     *            The list to which lines of LDIF should be appended.
+     */
+    public LDIFEntryWriter(final List<String> ldifLines) {
+        super(ldifLines);
     }
 
-    // Skip if the entry is excluded by any filters.
-    if (isEntryExcluded(entry))
-    {
-      return this;
+    /**
+     * Creates a new LDIF entry writer whose destination is the provided output
+     * stream.
+     *
+     * @param out
+     *            The output stream to use.
+     */
+    public LDIFEntryWriter(final OutputStream out) {
+        super(out);
     }
 
-    writeKeyAndValue("dn", entry.getName().toString());
-    for (final Attribute attribute : entry.getAllAttributes())
-    {
-      // Filter the attribute if required.
-      if (isAttributeExcluded(attribute.getAttributeDescription()))
-      {
-        continue;
-      }
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        close0();
+    }
 
-      final String attributeDescription = attribute
-          .getAttributeDescriptionAsString();
-      if (attribute.isEmpty())
-      {
-        writeKeyAndValue(attributeDescription, ByteString.empty());
-      }
-      else
-      {
-        for (final ByteString value : attribute)
-        {
-          writeKeyAndValue(attributeDescription, value);
+    /**
+     * {@inheritDoc}
+     */
+    public void flush() throws IOException {
+        flush0();
+    }
+
+    /**
+     * Specifies whether or not user-friendly comments should be added whenever
+     * distinguished names or UTF-8 attribute values are encountered which
+     * contained non-ASCII characters. The default is {@code false}.
+     *
+     * @param addUserFriendlyComments
+     *            {@code true} if user-friendly comments should be added, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setAddUserFriendlyComments(final boolean addUserFriendlyComments) {
+        this.addUserFriendlyComments = addUserFriendlyComments;
+        return this;
+    }
+
+    /**
+     * Specifies whether or not all operational attributes should be excluded
+     * from any entries that are written to LDIF. The default is {@code false}.
+     *
+     * @param excludeOperationalAttributes
+     *            {@code true} if all operational attributes should be excluded,
+     *            or {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setExcludeAllOperationalAttributes(
+            final boolean excludeOperationalAttributes) {
+        this.excludeOperationalAttributes = excludeOperationalAttributes;
+        return this;
+    }
+
+    /**
+     * Specifies whether or not all user attributes should be excluded from any
+     * entries that are written to LDIF. The default is {@code false}.
+     *
+     * @param excludeUserAttributes
+     *            {@code true} if all user attributes should be excluded, or
+     *            {@code false} otherwise.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setExcludeAllUserAttributes(final boolean excludeUserAttributes) {
+        this.excludeUserAttributes = excludeUserAttributes;
+        return this;
+    }
+
+    /**
+     * Excludes the named attribute from any entries that are written to LDIF.
+     * By default all attributes are included unless explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be excluded.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setExcludeAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        excludeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Excludes all entries beneath the named entry (inclusive) from being
+     * written to LDIF. By default all entries are written unless explicitly
+     * excluded or included by branches or filters.
+     *
+     * @param excludeBranch
+     *            The distinguished name of the branch to be excluded.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setExcludeBranch(final DN excludeBranch) {
+        Validator.ensureNotNull(excludeBranch);
+        excludeBranches.add(excludeBranch);
+        return this;
+    }
+
+    /**
+     * Excludes all entries which match the provided filter matcher from being
+     * written to LDIF. By default all entries are written unless explicitly
+     * excluded or included by branches or filters.
+     *
+     * @param excludeFilter
+     *            The filter matcher.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setExcludeFilter(final Matcher excludeFilter) {
+        Validator.ensureNotNull(excludeFilter);
+        excludeFilters.add(excludeFilter);
+        return this;
+    }
+
+    /**
+     * Ensures that the named attribute is not excluded from any entries that
+     * are written to LDIF. By default all attributes are included unless
+     * explicitly excluded.
+     *
+     * @param attributeDescription
+     *            The name of the attribute to be included.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setIncludeAttribute(final AttributeDescription attributeDescription) {
+        Validator.ensureNotNull(attributeDescription);
+        includeAttributes.add(attributeDescription);
+        return this;
+    }
+
+    /**
+     * Ensures that all entries beneath the named entry (inclusive) are written
+     * to LDIF. By default all entries are written unless explicitly excluded or
+     * included by branches or filters.
+     *
+     * @param includeBranch
+     *            The distinguished name of the branch to be included.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setIncludeBranch(final DN includeBranch) {
+        Validator.ensureNotNull(includeBranch);
+        includeBranches.add(includeBranch);
+        return this;
+    }
+
+    /**
+     * Ensures that all entries which match the provided filter matcher are
+     * written to LDIF. By default all entries are written unless explicitly
+     * excluded or included by branches or filters.
+     *
+     * @param includeFilter
+     *            The filter matcher.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setIncludeFilter(final Matcher includeFilter) {
+        Validator.ensureNotNull(includeFilter);
+        includeFilters.add(includeFilter);
+        return this;
+    }
+
+    /**
+     * Sets the schema which should be used when filtering entries (not required
+     * if no filtering is to be performed). The default schema is used if no
+     * other is specified.
+     *
+     * @param schema
+     *            The schema which should be used when filtering entries.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setSchema(final Schema schema) {
+        Validator.ensureNotNull(schema);
+        this.schema = schema;
+        return this;
+    }
+
+    /**
+     * Specifies the column at which long lines should be wrapped. A value less
+     * than or equal to zero (the default) indicates that no wrapping should be
+     * performed.
+     *
+     * @param wrapColumn
+     *            The column at which long lines should be wrapped.
+     * @return A reference to this {@code LDIFEntryWriter}.
+     */
+    public LDIFEntryWriter setWrapColumn(final int wrapColumn) {
+        this.wrapColumn = wrapColumn;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFEntryWriter writeComment(final CharSequence comment) throws IOException {
+        writeComment0(comment);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LDIFEntryWriter writeEntry(final Entry entry) throws IOException {
+        Validator.ensureNotNull(entry);
+
+        // Skip if branch containing the entry is excluded.
+        if (isBranchExcluded(entry.getName())) {
+            return this;
         }
-      }
+
+        // Skip if the entry is excluded by any filters.
+        if (isEntryExcluded(entry)) {
+            return this;
+        }
+
+        writeKeyAndValue("dn", entry.getName().toString());
+        for (final Attribute attribute : entry.getAllAttributes()) {
+            // Filter the attribute if required.
+            if (isAttributeExcluded(attribute.getAttributeDescription())) {
+                continue;
+            }
+
+            final String attributeDescription = attribute.getAttributeDescriptionAsString();
+            if (attribute.isEmpty()) {
+                writeKeyAndValue(attributeDescription, ByteString.empty());
+            } else {
+                for (final ByteString value : attribute) {
+                    writeKeyAndValue(attributeDescription, value);
+                }
+            }
+        }
+
+        // Make sure there is a blank line after the entry.
+        impl.println();
+
+        return this;
     }
-
-    // Make sure there is a blank line after the entry.
-    impl.println();
-
-    return this;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java
index 62d9b2a..25f793c 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,9 +25,8 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
-import static org.forgerock.opendj.ldap.CoreMessages.*;
+import static org.forgerock.opendj.ldap.CoreMessages.REJECTED_CHANGE_FAIL_ADD_DUPE;
+import static org.forgerock.opendj.ldap.CoreMessages.REJECTED_CHANGE_FAIL_MODIFYDN_DUPE;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,8 +36,6 @@
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 
-
-
 /**
  * A listener interface which is notified whenever a change record cannot be
  * applied to an entry. This may occur when an attempt is made to update a
@@ -47,229 +43,181 @@
  * <p>
  * By default the {@link #FAIL_FAST} listener is used.
  */
-public interface RejectedChangeRecordListener
-{
-  /**
-   * A handler which terminates processing by throwing a {@code DecodeException}
-   * as soon as a change is rejected.
-   */
-  public final static RejectedChangeRecordListener FAIL_FAST = new RejectedChangeRecordListener()
-  {
+public interface RejectedChangeRecordListener {
+    /**
+     * A handler which terminates processing by throwing a
+     * {@code DecodeException} as soon as a change is rejected.
+     */
+    public final static RejectedChangeRecordListener FAIL_FAST =
+            new RejectedChangeRecordListener() {
 
-    public Entry handleDuplicateEntry(final AddRequest change,
-        final Entry existingEntry) throws DecodeException
-    {
-      throw DecodeException.error(REJECTED_CHANGE_FAIL_ADD_DUPE.get(change
-          .getName().toString()));
-    }
+                public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry)
+                        throws DecodeException {
+                    throw DecodeException.error(REJECTED_CHANGE_FAIL_ADD_DUPE.get(change.getName()
+                            .toString()));
+                }
 
+                public Entry handleDuplicateEntry(final ModifyDNRequest change,
+                        final Entry existingEntry, final Entry renamedEntry) throws DecodeException {
+                    throw DecodeException.error(REJECTED_CHANGE_FAIL_MODIFYDN_DUPE.get(renamedEntry
+                            .getName().toString()));
+                }
 
+                public void handleRejectedChangeRecord(final AddRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    throw DecodeException.error(reason);
+                }
 
-    public Entry handleDuplicateEntry(final ModifyDNRequest change,
-        final Entry existingEntry, final Entry renamedEntry)
-        throws DecodeException
-    {
-      throw DecodeException.error(REJECTED_CHANGE_FAIL_MODIFYDN_DUPE
-          .get(renamedEntry.getName().toString()));
-    }
+                public void handleRejectedChangeRecord(final DeleteRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    throw DecodeException.error(reason);
+                }
 
+                public void handleRejectedChangeRecord(final ModifyRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    throw DecodeException.error(reason);
+                }
 
+                public void handleRejectedChangeRecord(final ModifyDNRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    throw DecodeException.error(reason);
+                }
 
-    public void handleRejectedChangeRecord(final AddRequest change,
-        final LocalizableMessage reason) throws DecodeException
-    {
-      throw DecodeException.error(reason);
-    }
+            };
 
+    /**
+     * The default handler which ignores changes applied to missing entries and
+     * tolerates duplicate entries by overwriting the existing entry with the
+     * new entry.
+     */
+    public final static RejectedChangeRecordListener OVERWRITE =
+            new RejectedChangeRecordListener() {
 
+                public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry)
+                        throws DecodeException {
+                    // Overwrite existing entries.
+                    return change;
+                }
 
-    public void handleRejectedChangeRecord(final DeleteRequest change,
-        final LocalizableMessage reason) throws DecodeException
-    {
-      throw DecodeException.error(reason);
-    }
+                public Entry handleDuplicateEntry(final ModifyDNRequest change,
+                        final Entry existingEntry, final Entry renamedEntry) throws DecodeException {
+                    // Overwrite existing entries.
+                    return renamedEntry;
+                }
 
+                public void handleRejectedChangeRecord(AddRequest change, LocalizableMessage reason)
+                        throws DecodeException {
+                    // Ignore.
+                }
 
+                public void handleRejectedChangeRecord(DeleteRequest change,
+                        LocalizableMessage reason) throws DecodeException {
+                    // Ignore.
+                }
 
-    public void handleRejectedChangeRecord(final ModifyRequest change,
-        final LocalizableMessage reason) throws DecodeException
-    {
-      throw DecodeException.error(reason);
-    }
+                public void handleRejectedChangeRecord(ModifyRequest change,
+                        LocalizableMessage reason) throws DecodeException {
+                    // Ignore.
+                }
 
+                public void handleRejectedChangeRecord(ModifyDNRequest change,
+                        LocalizableMessage reason) throws DecodeException {
+                    // Ignore.
+                }
 
+            };
 
-    public void handleRejectedChangeRecord(final ModifyDNRequest change,
-        final LocalizableMessage reason) throws DecodeException
-    {
-      throw DecodeException.error(reason);
-    }
+    /**
+     * Invoked when an attempt was made to add an entry which already exists.
+     *
+     * @param change
+     *            The conflicting add request.
+     * @param existingEntry
+     *            The pre-existing entry.
+     * @return The entry which should be kept.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    Entry handleDuplicateEntry(AddRequest change, Entry existingEntry) throws DecodeException;
 
-  };
+    /**
+     * Invoked when an attempt was made to rename an entry which already exists.
+     *
+     * @param change
+     *            The conflicting add request.
+     * @param existingEntry
+     *            The pre-existing entry.
+     * @param renamedEntry
+     *            The renamed entry.
+     * @return The entry which should be kept.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    Entry handleDuplicateEntry(ModifyDNRequest change, Entry existingEntry, Entry renamedEntry)
+            throws DecodeException;
 
-  /**
-   * The default handler which ignores changes applied to missing entries and
-   * tolerates duplicate entries by overwriting the existing entry with the new
-   * entry.
-   */
-  public final static RejectedChangeRecordListener OVERWRITE = new RejectedChangeRecordListener()
-  {
+    /**
+     * Invoked when an attempt to add an entry was rejected. This may be because
+     * the target parent entry was not found, or controls provided with the
+     * request are not supported. This method will not be called when the entry
+     * to be added already exists, since this is handled by
+     * {@link #handleDuplicateEntry(AddRequest, Entry)}.
+     *
+     * @param change
+     *            The rejected add request.
+     * @param reason
+     *            The reason why the record was rejected.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleRejectedChangeRecord(AddRequest change, LocalizableMessage reason)
+            throws DecodeException;
 
-    public Entry handleDuplicateEntry(final AddRequest change,
-        final Entry existingEntry) throws DecodeException
-    {
-      // Overwrite existing entries.
-      return change;
-    }
+    /**
+     * Invoked when an attempt to delete an entry was rejected. This may be
+     * because the target entry was not found, or controls provided with the
+     * request are not supported.
+     *
+     * @param change
+     *            The rejected delete request.
+     * @param reason
+     *            The reason why the record was rejected.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleRejectedChangeRecord(DeleteRequest change, LocalizableMessage reason)
+            throws DecodeException;
 
+    /**
+     * Invoked when an attempt to modify an entry was rejected. This may be
+     * because the target entry was not found, or controls provided with the
+     * request are not supported.
+     *
+     * @param change
+     *            The rejected modify request.
+     * @param reason
+     *            The reason why the record was rejected.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleRejectedChangeRecord(ModifyRequest change, LocalizableMessage reason)
+            throws DecodeException;
 
-
-    public Entry handleDuplicateEntry(final ModifyDNRequest change,
-        final Entry existingEntry, final Entry renamedEntry)
-        throws DecodeException
-    {
-      // Overwrite existing entries.
-      return renamedEntry;
-    }
-
-
-
-    public void handleRejectedChangeRecord(AddRequest change,
-        LocalizableMessage reason) throws DecodeException
-    {
-      // Ignore.
-    }
-
-
-
-    public void handleRejectedChangeRecord(DeleteRequest change,
-        LocalizableMessage reason) throws DecodeException
-    {
-      // Ignore.
-    }
-
-
-
-    public void handleRejectedChangeRecord(ModifyRequest change,
-        LocalizableMessage reason) throws DecodeException
-    {
-      // Ignore.
-    }
-
-
-
-    public void handleRejectedChangeRecord(ModifyDNRequest change,
-        LocalizableMessage reason) throws DecodeException
-    {
-      // Ignore.
-    }
-
-  };
-
-
-
-  /**
-   * Invoked when an attempt was made to add an entry which already exists.
-   *
-   * @param change
-   *          The conflicting add request.
-   * @param existingEntry
-   *          The pre-existing entry.
-   * @return The entry which should be kept.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  Entry handleDuplicateEntry(AddRequest change, Entry existingEntry)
-      throws DecodeException;
-
-
-
-  /**
-   * Invoked when an attempt was made to rename an entry which already exists.
-   *
-   * @param change
-   *          The conflicting add request.
-   * @param existingEntry
-   *          The pre-existing entry.
-   * @param renamedEntry
-   *          The renamed entry.
-   * @return The entry which should be kept.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  Entry handleDuplicateEntry(ModifyDNRequest change, Entry existingEntry,
-      Entry renamedEntry) throws DecodeException;
-
-
-
-  /**
-   * Invoked when an attempt to add an entry was rejected. This may be because
-   * the target parent entry was not found, or controls provided with the
-   * request are not supported. This method will not be called when the entry to
-   * be added already exists, since this is handled by
-   * {@link #handleDuplicateEntry(AddRequest, Entry)}.
-   *
-   * @param change
-   *          The rejected add request.
-   * @param reason
-   *          The reason why the record was rejected.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleRejectedChangeRecord(AddRequest change, LocalizableMessage reason)
-      throws DecodeException;
-
-
-
-  /**
-   * Invoked when an attempt to delete an entry was rejected. This may be
-   * because the target entry was not found, or controls provided with the
-   * request are not supported.
-   *
-   * @param change
-   *          The rejected delete request.
-   * @param reason
-   *          The reason why the record was rejected.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleRejectedChangeRecord(DeleteRequest change,
-      LocalizableMessage reason) throws DecodeException;
-
-
-
-  /**
-   * Invoked when an attempt to modify an entry was rejected. This may be
-   * because the target entry was not found, or controls provided with the
-   * request are not supported.
-   *
-   * @param change
-   *          The rejected modify request.
-   * @param reason
-   *          The reason why the record was rejected.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleRejectedChangeRecord(ModifyRequest change,
-      LocalizableMessage reason) throws DecodeException;
-
-
-
-  /**
-   * Invoked when an attempt to rename an entry was rejected. This may be
-   * because the target entry was not found, or controls provided with the
-   * request are not supported. This method will not be called when a renamed
-   * entry already exists, since this is handled by
-   * {@link #handleDuplicateEntry(ModifyDNRequest, Entry, Entry)}.
-   *
-   * @param change
-   *          The rejected modify DN request.
-   * @param reason
-   *          The reason why the record was rejected.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleRejectedChangeRecord(ModifyDNRequest change,
-      LocalizableMessage reason) throws DecodeException;
+    /**
+     * Invoked when an attempt to rename an entry was rejected. This may be
+     * because the target entry was not found, or controls provided with the
+     * request are not supported. This method will not be called when a renamed
+     * entry already exists, since this is handled by
+     * {@link #handleDuplicateEntry(ModifyDNRequest, Entry, Entry)}.
+     *
+     * @param change
+     *            The rejected modify DN request.
+     * @param reason
+     *            The reason why the record was rejected.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleRejectedChangeRecord(ModifyDNRequest change, LocalizableMessage reason)
+            throws DecodeException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java
index 0be1187..49524e6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,192 +25,149 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.DecodeException;
 
-
-
 /**
  * A listener interface which is notified whenever LDIF records are skipped,
  * malformed, or fail schema validation.
  * <p>
  * By default the {@link #FAIL_FAST} listener is used.
  */
-public interface RejectedLDIFListener
-{
-  /**
-   * The default handler which ignores skipped records but which terminates
-   * processing by throwing a {@code DecodeException} as soon as a record is
-   * found to be malformed or rejected due to a schema validation failure.
-   */
-  public static final RejectedLDIFListener FAIL_FAST = new RejectedLDIFListener()
-  {
+public interface RejectedLDIFListener {
+    /**
+     * The default handler which ignores skipped records but which terminates
+     * processing by throwing a {@code DecodeException} as soon as a record is
+     * found to be malformed or rejected due to a schema validation failure.
+     */
+    public static final RejectedLDIFListener FAIL_FAST = new RejectedLDIFListener() {
 
-    @Override
-    public void handleMalformedRecord(final long lineNumber,
-        final List<String> lines, final LocalizableMessage reason)
-        throws DecodeException
-    {
-      // Fail fast.
-      throw DecodeException.error(reason);
-    }
+        @Override
+        public void handleMalformedRecord(final long lineNumber, final List<String> lines,
+                final LocalizableMessage reason) throws DecodeException {
+            // Fail fast.
+            throw DecodeException.error(reason);
+        }
 
+        @Override
+        public void handleSchemaValidationFailure(final long lineNumber, final List<String> lines,
+                final List<LocalizableMessage> reasons) throws DecodeException {
+            // Fail fast - just use first message.
+            throw DecodeException.error(reasons.get(0));
+        }
 
+        @Override
+        public void handleSchemaValidationWarning(final long lineNumber, final List<String> lines,
+                final List<LocalizableMessage> reasons) throws DecodeException {
+            // Ignore schema validation warnings.
+        }
 
-    @Override
-    public void handleSchemaValidationFailure(final long lineNumber,
-        final List<String> lines, final List<LocalizableMessage> reasons)
-        throws DecodeException
-    {
-      // Fail fast - just use first message.
-      throw DecodeException.error(reasons.get(0));
-    }
+        @Override
+        public void handleSkippedRecord(final long lineNumber, final List<String> lines,
+                final LocalizableMessage reason) throws DecodeException {
+            // Ignore skipped records.
+        }
+    };
 
+    /**
+     * A handler which ignores all rejected record notifications.
+     */
+    public static final RejectedLDIFListener IGNORE_ALL = new RejectedLDIFListener() {
 
+        @Override
+        public void handleMalformedRecord(final long lineNumber, final List<String> lines,
+                final LocalizableMessage reason) throws DecodeException {
+            // Ignore malformed records.
+        }
 
-    @Override
-    public void handleSchemaValidationWarning(final long lineNumber,
-        final List<String> lines, final List<LocalizableMessage> reasons)
-        throws DecodeException
-    {
-      // Ignore schema validation warnings.
-    }
+        @Override
+        public void handleSchemaValidationFailure(final long lineNumber, final List<String> lines,
+                final List<LocalizableMessage> reasons) throws DecodeException {
+            // Ignore schema validation failures.
+        }
 
+        @Override
+        public void handleSchemaValidationWarning(final long lineNumber, final List<String> lines,
+                final List<LocalizableMessage> reasons) throws DecodeException {
+            // Ignore schema validation warnings.
+        }
 
+        @Override
+        public void handleSkippedRecord(final long lineNumber, final List<String> lines,
+                final LocalizableMessage reason) throws DecodeException {
+            // Ignore skipped records.
+        }
+    };
 
-    @Override
-    public void handleSkippedRecord(final long lineNumber,
-        final List<String> lines, final LocalizableMessage reason)
-        throws DecodeException
-    {
-      // Ignore skipped records.
-    }
-  };
+    /**
+     * Invoked when a record was rejected because it was malformed in some way
+     * and could not be decoded.
+     *
+     * @param lineNumber
+     *            The line number within the source location in which the
+     *            malformed record is located, if known, otherwise {@code -1}.
+     * @param lines
+     *            The content of the malformed record.
+     * @param reason
+     *            The reason why the record is malformed.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleMalformedRecord(long lineNumber, List<String> lines, LocalizableMessage reason)
+            throws DecodeException;
 
-  /**
-   * A handler which ignores all rejected record notifications.
-   */
-  public static final RejectedLDIFListener IGNORE_ALL = new RejectedLDIFListener()
-  {
+    /**
+     * Invoked when a record was rejected because it does not conform to the
+     * schema and schema validation is enabled.
+     *
+     * @param lineNumber
+     *            The line number within the source location in which the
+     *            rejected record is located, if known, otherwise {@code -1}.
+     * @param lines
+     *            The content of the record which failed schema validation.
+     * @param reasons
+     *            The reasons why the record failed schema validation.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleSchemaValidationFailure(long lineNumber, List<String> lines,
+            List<LocalizableMessage> reasons) throws DecodeException;
 
-    @Override
-    public void handleMalformedRecord(final long lineNumber,
-        final List<String> lines, final LocalizableMessage reason)
-        throws DecodeException
-    {
-      // Ignore malformed records.
-    }
+    /**
+     * Invoked when a record was not rejected but contained one or more schema
+     * validation warnings.
+     *
+     * @param lineNumber
+     *            The line number within the source location in which the record
+     *            is located, if known, otherwise {@code -1}.
+     * @param lines
+     *            The content of the record which contained schema validation
+     *            warnings.
+     * @param reasons
+     *            The schema validation warnings.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleSchemaValidationWarning(long lineNumber, List<String> lines,
+            List<LocalizableMessage> reasons) throws DecodeException;
 
-
-
-    @Override
-    public void handleSchemaValidationFailure(final long lineNumber,
-        final List<String> lines, final List<LocalizableMessage> reasons)
-        throws DecodeException
-    {
-      // Ignore schema validation failures.
-    }
-
-
-
-    @Override
-    public void handleSchemaValidationWarning(final long lineNumber,
-        final List<String> lines, final List<LocalizableMessage> reasons)
-        throws DecodeException
-    {
-      // Ignore schema validation warnings.
-    }
-
-
-
-    @Override
-    public void handleSkippedRecord(final long lineNumber,
-        final List<String> lines, final LocalizableMessage reason)
-        throws DecodeException
-    {
-      // Ignore skipped records.
-    }
-  };
-
-
-
-  /**
-   * Invoked when a record was rejected because it was malformed in some way and
-   * could not be decoded.
-   *
-   * @param lineNumber
-   *          The line number within the source location in which the malformed
-   *          record is located, if known, otherwise {@code -1}.
-   * @param lines
-   *          The content of the malformed record.
-   * @param reason
-   *          The reason why the record is malformed.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleMalformedRecord(long lineNumber, List<String> lines,
-      LocalizableMessage reason) throws DecodeException;
-
-
-
-  /**
-   * Invoked when a record was rejected because it does not conform to the
-   * schema and schema validation is enabled.
-   *
-   * @param lineNumber
-   *          The line number within the source location in which the rejected
-   *          record is located, if known, otherwise {@code -1}.
-   * @param lines
-   *          The content of the record which failed schema validation.
-   * @param reasons
-   *          The reasons why the record failed schema validation.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleSchemaValidationFailure(long lineNumber, List<String> lines,
-      List<LocalizableMessage> reasons) throws DecodeException;
-
-
-
-  /**
-   * Invoked when a record was not rejected but contained one or more schema
-   * validation warnings.
-   *
-   * @param lineNumber
-   *          The line number within the source location in which the record is
-   *          located, if known, otherwise {@code -1}.
-   * @param lines
-   *          The content of the record which contained schema validation
-   *          warnings.
-   * @param reasons
-   *          The schema validation warnings.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleSchemaValidationWarning(long lineNumber, List<String> lines,
-      List<LocalizableMessage> reasons) throws DecodeException;
-
-
-
-  /**
-   * Invoked when a record was skipped because it did not match filter criteria
-   * defined by the reader.
-   *
-   * @param lineNumber
-   *          The line number within the source location in which the skipped
-   *          record is located, if known, otherwise {@code -1}.
-   * @param lines
-   *          The content of the record which was skipped.
-   * @param reason
-   *          The reason why the record was skipped.
-   * @throws DecodeException
-   *           If processing should terminate.
-   */
-  void handleSkippedRecord(long lineNumber, List<String> lines,
-      LocalizableMessage reason) throws DecodeException;
+    /**
+     * Invoked when a record was skipped because it did not match filter
+     * criteria defined by the reader.
+     *
+     * @param lineNumber
+     *            The line number within the source location in which the
+     *            skipped record is located, if known, otherwise {@code -1}.
+     * @param lines
+     *            The content of the record which was skipped.
+     * @param reason
+     *            The reason why the record was skipped.
+     * @throws DecodeException
+     *             If processing should terminate.
+     */
+    void handleSkippedRecord(long lineNumber, List<String> lines, LocalizableMessage reason)
+            throws DecodeException;
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/package-info.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/package-info.java
index 27eba12..82f3c53 100755
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/package-info.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package org.forgerock.opendj.ldif;
 
-
-
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core.properties
index 8bdca6e..de8ee7b 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core.properties
@@ -6,17 +6,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_de.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_de.properties
index 5aea58f..fe10c0b 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_de.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_de.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_es.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_es.properties
index 1a53e8b..80f236a 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_es.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_es.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_fr.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_fr.properties
index 1a59b9f..da5c366 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_fr.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_fr.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ja.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ja.properties
index db55a28..5d0ecb3 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ja.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ja.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ko.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ko.properties
index 14596bb..8d47bc2 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ko.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_ko.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_CN.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_CN.properties
index dc6bb31..d3e1ed5 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_CN.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_CN.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_TW.properties b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_TW.properties
index 3eba9aa..5aa9f3a 100755
--- a/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_TW.properties
+++ b/opendj3/opendj-ldap-sdk/src/main/resources/org/forgerock/opendj/ldap/core_zh_TW.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferReaderTestCase.java
index b538a7d..58bf6b5 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -38,21 +35,16 @@
 import org.glassfish.grizzly.memory.ByteBufferWrapper;
 import org.glassfish.grizzly.memory.MemoryManager;
 
-
-
 /**
  * This class provides test cases for ASN1BufferReader.
  */
-public class ASN1BufferReaderTestCase extends ASN1ReaderTestCase
-{
-  @Override
-  protected ASN1Reader getReader(final byte[] b, final int maxElementSize)
-      throws IOException
-  {
-    final ByteBufferWrapper buffer = new ByteBufferWrapper(ByteBuffer.wrap(b));
-    final ASN1BufferReader reader = new ASN1BufferReader(maxElementSize,
-        MemoryManager.DEFAULT_MEMORY_MANAGER);
-    reader.appendBytesRead(buffer);
-    return reader;
-  }
+public class ASN1BufferReaderTestCase extends ASN1ReaderTestCase {
+    @Override
+    protected ASN1Reader getReader(final byte[] b, final int maxElementSize) throws IOException {
+        final ByteBufferWrapper buffer = new ByteBufferWrapper(ByteBuffer.wrap(b));
+        final ASN1BufferReader reader =
+                new ASN1BufferReader(maxElementSize, MemoryManager.DEFAULT_MEMORY_MANAGER);
+        reader.appendBytesRead(buffer);
+        return reader;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferWriterTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferWriterTestCase.java
index 2f2d80d..27e2835 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferWriterTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/ASN1BufferWriterTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -41,48 +38,34 @@
 import org.glassfish.grizzly.memory.ByteBufferWrapper;
 import org.glassfish.grizzly.memory.MemoryManager;
 
-
-
 /**
  * This class provides testcases for ASN1BufferWriter.
  */
-public class ASN1BufferWriterTestCase extends ASN1WriterTestCase
-{
+public class ASN1BufferWriterTestCase extends ASN1WriterTestCase {
 
-  private final ASN1BufferWriter writer = ASN1BufferWriter.getWriter();
+    private final ASN1BufferWriter writer = ASN1BufferWriter.getWriter();
 
+    @Override
+    protected byte[] getEncodedBytes() throws IOException, DecodeException {
+        final Buffer buffer = writer.getBuffer();
+        final byte[] byteArray = new byte[buffer.remaining()];
+        buffer.get(byteArray);
+        return byteArray;
+    }
 
+    @Override
+    protected ASN1Reader getReader(final byte[] encodedBytes) throws DecodeException, IOException {
+        final ByteBufferWrapper buffer = new ByteBufferWrapper(ByteBuffer.wrap(encodedBytes));
+        final ASN1BufferReader reader =
+                new ASN1BufferReader(0, MemoryManager.DEFAULT_MEMORY_MANAGER);
+        reader.appendBytesRead(buffer);
+        return reader;
+    }
 
-  @Override
-  protected byte[] getEncodedBytes() throws IOException, DecodeException
-  {
-    final Buffer buffer = writer.getBuffer();
-    final byte[] byteArray = new byte[buffer.remaining()];
-    buffer.get(byteArray);
-    return byteArray;
-  }
-
-
-
-  @Override
-  protected ASN1Reader getReader(final byte[] encodedBytes)
-      throws DecodeException, IOException
-  {
-    final ByteBufferWrapper buffer = new ByteBufferWrapper(
-        ByteBuffer.wrap(encodedBytes));
-    final ASN1BufferReader reader = new ASN1BufferReader(0,
-        MemoryManager.DEFAULT_MEMORY_MANAGER);
-    reader.appendBytesRead(buffer);
-    return reader;
-  }
-
-
-
-  @Override
-  protected ASN1Writer getWriter() throws IOException
-  {
-    writer.flush();
-    writer.recycle();
-    return writer;
-  }
+    @Override
+    protected ASN1Writer getWriter() throws IOException {
+        writer.flush();
+        writer.recycle();
+        return writer;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransportTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransportTestCase.java
index 87662b5..f207bbc 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransportTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/DefaultTCPNIOTransportTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertTrue;
 
 import java.net.Socket;
@@ -37,33 +34,27 @@
 import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.ldap.DefaultTCPNIOTransport;
-
-
-
 /**
  * Tests DefaultTCPNIOTransport class.
  */
-public class DefaultTCPNIOTransportTestCase extends LDAPTestCase
-{
-  /**
-   * Tests the default transport.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test()
-  public void testGetInstance() throws Exception
-  {
-    // Create a transport.
-    final TCPNIOTransport transport = DefaultTCPNIOTransport.getInstance();
-    final int port = TestCaseUtils.findFreePort();
+public class DefaultTCPNIOTransportTestCase extends LDAPTestCase {
+    /**
+     * Tests the default transport.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test()
+    public void testGetInstance() throws Exception {
+        // Create a transport.
+        final TCPNIOTransport transport = DefaultTCPNIOTransport.getInstance();
+        final int port = TestCaseUtils.findFreePort();
 
-    transport.bind(port);
-    // Establish a socket connection to see if the transport factory works.
-    final Socket socket = new Socket("localhost", port);
-    // Successfully connected if there is no exception.
-    assertTrue(socket.isConnected());
-    // Don't stop the transport because it is shared with the ldap server.
-  }
+        transport.bind(port);
+        // Establish a socket connection to see if the transport factory works.
+        final Socket socket = new Socket("localhost", port);
+        // Successfully connected if there is no exception.
+        assertTrue(socket.isConnected());
+        // Don't stop the transport because it is shared with the ldap server.
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/LDAPTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/LDAPTestCase.java
index 4d8d415..5ee888c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/LDAPTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/LDAPTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,14 @@
 
 package com.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all ldap unit tests should extend. Ldap represents the
  * classes found directly under the package com.forgerock.opendj.ldap.ldap.
  */
 
 @Test(groups = { "precommit", "ldap", "sdk" })
-public abstract class LDAPTestCase extends ForgeRockTestCase
-{
+public abstract class LDAPTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java
index f0d2ba5..f8b4668 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,14 +26,16 @@
 
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static org.testng.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.TestCaseUtils;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlsTestCase;
 import org.forgerock.opendj.ldap.requests.Requests;
@@ -42,36 +43,29 @@
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.ldap.controls.AccountUsabilityRequestControl;
-
-
-
 /**
  * Tests the account usability request control.
  */
 @SuppressWarnings("javadoc")
-public class AccountUsabilityRequestControlTestCase extends ControlsTestCase
-{
-  @Test()
-  public void testControl() throws Exception
-  {
-    // Send this control with a search request and see that you get
-    // a valid response.
-    final SearchRequest req = Requests.newSearchRequest(DN
-        .valueOf("uid=user.1,ou=people,o=test"), SearchScope.BASE_OBJECT,
-        Filter.getObjectClassPresentFilter());
-    final AccountUsabilityRequestControl control = AccountUsabilityRequestControl
-        .newControl(false);
-    req.addControl(control);
-    final Connection con = TestCaseUtils.getInternalConnection();
-    final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
-    con.search(req, entries);
-    assertTrue(entries.size() > 0);
-    final SearchResultEntry entry = entries.get(0);
-    final Control ctrl = entry.getControls().get(0);
-    if (!ctrl.getOID().equals("1.3.6.1.4.1.42.2.27.9.5.8"))
-    {
-      throw new Exception("expected control response 1.3.6.1.4.1.42.2.27.9.5.8");
+public class AccountUsabilityRequestControlTestCase extends ControlsTestCase {
+    @Test()
+    public void testControl() throws Exception {
+        // Send this control with a search request and see that you get
+        // a valid response.
+        final SearchRequest req =
+                Requests.newSearchRequest(DN.valueOf("uid=user.1,ou=people,o=test"),
+                        SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter());
+        final AccountUsabilityRequestControl control =
+                AccountUsabilityRequestControl.newControl(false);
+        req.addControl(control);
+        final Connection con = TestCaseUtils.getInternalConnection();
+        final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
+        con.search(req, entries);
+        assertTrue(entries.size() > 0);
+        final SearchResultEntry entry = entries.get(0);
+        final Control ctrl = entry.getControls().get(0);
+        if (!ctrl.getOID().equals("1.3.6.1.4.1.42.2.27.9.5.8")) {
+            throw new Exception("expected control response 1.3.6.1.4.1.42.2.27.9.5.8");
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java
index f6dad02..57e2301 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.controls;
 
-
-
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
@@ -36,64 +33,59 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.TestCaseUtils;
 import org.forgerock.opendj.ldap.controls.ControlsTestCase;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.ldap.controls.AccountUsabilityRequestControl;
-import com.forgerock.opendj.ldap.controls.AccountUsabilityResponseControl;
-
-
-
 /**
  * Tests the account usability response control.
  */
 @SuppressWarnings("javadoc")
-public class AccountUsabilityResponseControlTestCase extends ControlsTestCase
-{
-  @Test()
-  public void testInvalidResponseControl() throws Exception
-  {
-    // Don't send the request control and hence there
-    // shouldn't be response.
-    final SearchRequest req = Requests.newSearchRequest(DN
-        .valueOf("uid=user.1,ou=people,o=test"), SearchScope.BASE_OBJECT,
-        Filter.getObjectClassPresentFilter());
-    final Connection con = TestCaseUtils.getInternalConnection();
-    final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
-    con.search(req, entries);
-    assertTrue(entries.size() > 0);
-    final SearchResultEntry entry = entries.get(0);
-    final AccountUsabilityResponseControl aurctrl = entry.getControl(
-        AccountUsabilityResponseControl.DECODER, new DecodeOptions());
-    assertNull(aurctrl);
-  }
+public class AccountUsabilityResponseControlTestCase extends ControlsTestCase {
+    @Test()
+    public void testInvalidResponseControl() throws Exception {
+        // Don't send the request control and hence there
+        // shouldn't be response.
+        final SearchRequest req =
+                Requests.newSearchRequest(DN.valueOf("uid=user.1,ou=people,o=test"),
+                        SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter());
+        final Connection con = TestCaseUtils.getInternalConnection();
+        final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
+        con.search(req, entries);
+        assertTrue(entries.size() > 0);
+        final SearchResultEntry entry = entries.get(0);
+        final AccountUsabilityResponseControl aurctrl =
+                entry.getControl(AccountUsabilityResponseControl.DECODER, new DecodeOptions());
+        assertNull(aurctrl);
+    }
 
-
-
-  @Test()
-  public void testValidResponseControl() throws Exception
-  {
-    // Send this control with a search request and see that you get
-    // a valid response.
-    final SearchRequest req = Requests.newSearchRequest(DN
-        .valueOf("uid=user.1,ou=people,o=test"), SearchScope.BASE_OBJECT,
-        Filter.getObjectClassPresentFilter());
-    final AccountUsabilityRequestControl control = AccountUsabilityRequestControl
-        .newControl(false);
-    req.addControl(control);
-    final Connection con = TestCaseUtils.getInternalConnection();
-    final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
-    con.search(req, entries);
-    assertTrue(entries.size() > 0);
-    final SearchResultEntry entry = entries.get(0);
-    final AccountUsabilityResponseControl aurctrl = entry.getControl(
-        AccountUsabilityResponseControl.DECODER, new DecodeOptions());
-    assertFalse(aurctrl.isExpired());
-    assertFalse(aurctrl.isLocked());
-    assertFalse(aurctrl.isInactive());
-  }
+    @Test()
+    public void testValidResponseControl() throws Exception {
+        // Send this control with a search request and see that you get
+        // a valid response.
+        final SearchRequest req =
+                Requests.newSearchRequest(DN.valueOf("uid=user.1,ou=people,o=test"),
+                        SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter());
+        final AccountUsabilityRequestControl control =
+                AccountUsabilityRequestControl.newControl(false);
+        req.addControl(control);
+        final Connection con = TestCaseUtils.getInternalConnection();
+        final List<SearchResultEntry> entries = new ArrayList<SearchResultEntry>();
+        con.search(req, entries);
+        assertTrue(entries.size() > 0);
+        final SearchResultEntry entry = entries.get(0);
+        final AccountUsabilityResponseControl aurctrl =
+                entry.getControl(AccountUsabilityResponseControl.DECODER, new DecodeOptions());
+        assertFalse(aurctrl.isExpired());
+        assertFalse(aurctrl.isLocked());
+        assertFalse(aurctrl.isInactive());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java
index d1a59c8..04545bb 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,253 +27,231 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import static org.testng.Assert.assertEquals;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.util.ASCIICharProp;
-
-
-
 /**
  * Tests various methods of ASCIICharProp class.
  */
-public class ASCIICharPropTestCase extends UtilTestCase
-{
-  /**
-   * Invalid Ascii char data provider.
-   *
-   * @return Returns an array of data.
-   */
-  @DataProvider(name = "invalidasciidata")
-  public Object[][] createInValidASCIIData()
-  {
-    return new Object[][] {
-    // {null,/* uppercase*/ false,/*hex value*/0,/*decimal value*/0,/* is
-    // letter*/false,/*is digit*/false,/*is keychar*/false},
-    { '\u200A' } };
-  }
+public class ASCIICharPropTestCase extends UtilTestCase {
+    /**
+     * Invalid Ascii char data provider.
+     *
+     * @return Returns an array of data.
+     */
+    @DataProvider(name = "invalidasciidata")
+    public Object[][] createInValidASCIIData() {
+        return new Object[][] { { '\u200A' } };
+    }
 
+    /**
+     * Valid Ascii char data provider.
+     *
+     * @return Returns an array of data.
+     */
+    @DataProvider(name = "validasciidata")
+    public Object[][] createValidASCIIData() {
+        // @formatter:off
+        return new Object[][] {
+            {
+                (char) 1,
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                false, // is letter
+                false, // is digit
+                false, // is key char
+                false  // is compat key char
+            },
+            {
+                '-',
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                false, // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                '_',
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                false, // is letter
+                false, // is digit
+                false, // is key char
+                true   // is compat key char
+            },
+            {
+                '.',
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                false, // is letter
+                false, // is digit
+                false, // is key char
+                true   // is compat key char
+            },
+            {
+                '+',
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                false, // is letter
+                false, // is digit
+                false, // is key char
+                false  // is compat key char
+            },
+            {
+                'a',
+                false, // uppercase
+                10,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                'A',
+                true,  // uppercase
+                10,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                'f',
+                false, // uppercase
+                15,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                'F',
+                true,  // uppercase
+                15,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                'z',
+                false, // uppercase
+                -1,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                'Z',
+                true,  // uppercase
+                -1,    // hex
+                -1,    // decimal
+                true,  // is letter
+                false, // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                '0',
+                false, // uppercase
+                0,     // hex
+                0,     // decimal
+                false, // is letter
+                true,  // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+            {
+                '9',
+                false, // uppercase
+                9,     // hex
+                9,     // decimal
+                false, // is letter
+                true,  // is digit
+                true,  // is key char
+                true   // is compat key char
+            },
+        };
+        // @formatter:on
+    }
 
+    /**
+     * Tests whether a character is an invalid ascii character or not.
+     *
+     * @param myChar
+     *            The character that needs to be verified.
+     * @throws Exception
+     *             In case of any errors.
+     */
+    @Test(dataProvider = "invalidasciidata")
+    public void testValueOf(final char myChar) throws Exception {
+        assertEquals(ASCIICharProp.valueOf(myChar), null);
+    }
 
-  /**
-   * Valid Ascii char data provider.
-   *
-   * @return Returns an array of data.
-   */
-  @DataProvider(name = "validasciidata")
-  public Object[][] createValidASCIIData()
-  {
-    // @formatter:off
-    return new Object[][] {
-        {
-          (char) 1,
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          false, // is letter
-          false, // is digit
-          false, // is key char
-          false  // is compat key char
-        },
-        {
-          '-',
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          false, // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          '_',
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          false, // is letter
-          false, // is digit
-          false, // is key char
-          true   // is compat key char
-        },
-        {
-          '.',
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          false, // is letter
-          false, // is digit
-          false, // is key char
-          true   // is compat key char
-        },
-        {
-          '+',
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          false, // is letter
-          false, // is digit
-          false, // is key char
-          false  // is compat key char
-        },
-        {
-          'a',
-          false, // uppercase
-          10,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          'A',
-          true,  // uppercase
-          10,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          'f',
-          false, // uppercase
-          15,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          'F',
-          true,  // uppercase
-          15,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          'z',
-          false, // uppercase
-          -1,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          'Z',
-          true,  // uppercase
-          -1,    // hex
-          -1,    // decimal
-          true,  // is letter
-          false, // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          '0',
-          false, // uppercase
-          0,     // hex
-          0,     // decimal
-          false, // is letter
-          true,  // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-        {
-          '9',
-          false, // uppercase
-          9,     // hex
-          9,     // decimal
-          false, // is letter
-          true,  // is digit
-          true,  // is key char
-          true   // is compat key char
-        },
-    };
-    // @formatter:on
-  }
+    /**
+     * Tests whether a character is a valid ascii character or not.
+     *
+     * @param myChar
+     *            The character that needs to be verified.
+     * @param isUpper
+     *            Whether it is uppercase
+     * @param hexValue
+     *            The hexadecimal value
+     * @param decimalValue
+     *            The decimal value
+     * @param isLetter
+     *            Whether the character is a letter
+     * @param isDigit
+     *            Whether the character is a digit
+     * @param isKeyChar
+     *            Whether the character is a key char.
+     * @param isCompatKeyChar
+     *            Whether the character is a compat key char.
+     * @throws Exception
+     *             In case of any errors.
+     */
+    @Test(dataProvider = "validasciidata")
+    public void testValueOf(final char myChar, final boolean isUpper, final int hexValue,
+            final int decimalValue, final boolean isLetter, final boolean isDigit,
+            final boolean isKeyChar, final boolean isCompatKeyChar) throws Exception {
+        final ASCIICharProp myProp = ASCIICharProp.valueOf(myChar);
 
+        // check letter.
+        assertEquals(isLetter, myProp.isLetter());
 
+        // Check case.
+        assertEquals(isLetter & isUpper, myProp.isUpperCase());
+        assertEquals(isLetter & !isUpper, myProp.isLowerCase());
 
-  /**
-   * Tests whether a character is an invalid ascii character or not.
-   *
-   * @param myChar
-   *          The character that needs to be verified.
-   * @throws Exception
-   *           In case of any errors.
-   */
-  @Test(dataProvider = "invalidasciidata")
-  public void testValueOf(final char myChar) throws Exception
-  {
-    assertEquals(ASCIICharProp.valueOf(myChar), null);
-  }
+        // check digit.
+        assertEquals(isDigit, myProp.isDigit());
 
+        // Check hex.
+        assertEquals(myProp.hexValue(), hexValue);
 
+        // Decimal value.
+        assertEquals(myProp.decimalValue(), decimalValue);
 
-  /**
-   * Tests whether a character is a valid ascii character or not.
-   *
-   * @param myChar
-   *          The character that needs to be verified.
-   * @param isUpper
-   *          Whether it is uppercase
-   * @param hexValue
-   *          The hexadecimal value
-   * @param decimalValue
-   *          The decimal value
-   * @param isLetter
-   *          Whether the character is a letter
-   * @param isDigit
-   *          Whether the character is a digit
-   * @param isKeyChar
-   *          Whether the character is a key char.
-   * @param isCompatKeyChar
-   *          Whether the character is a compat key char.
-   * @throws Exception
-   *           In case of any errors.
-   */
-  @Test(dataProvider = "validasciidata")
-  public void testValueOf(final char myChar, final boolean isUpper,
-      final int hexValue, final int decimalValue,
-      final boolean isLetter, final boolean isDigit,
-      final boolean isKeyChar, final boolean isCompatKeyChar)
-      throws Exception
-  {
-    final ASCIICharProp myProp = ASCIICharProp.valueOf(myChar);
+        // Check if it is equal to itself.
+        assertEquals(myProp.charValue(), myChar);
+        assertEquals(myProp.compareTo(ASCIICharProp.valueOf(myChar)), 0);
 
-    // check letter.
-    assertEquals(isLetter, myProp.isLetter());
-
-    // Check case.
-    assertEquals(isLetter & isUpper, myProp.isUpperCase());
-    assertEquals(isLetter & !isUpper, myProp.isLowerCase());
-
-    // check digit.
-    assertEquals(isDigit, myProp.isDigit());
-
-    // Check hex.
-    assertEquals(myProp.hexValue(), hexValue);
-
-    // Decimal value.
-    assertEquals(myProp.decimalValue(), decimalValue);
-
-    // Check if it is equal to itself.
-    assertEquals(myProp.charValue(), myChar);
-    assertEquals(myProp.compareTo(ASCIICharProp.valueOf(myChar)), 0);
-
-    // keychar.
-    assertEquals(isKeyChar, myProp.isKeyChar(false));
-    assertEquals(isCompatKeyChar, myProp.isKeyChar(true));
-  }
+        // keychar.
+        assertEquals(isKeyChar, myProp.isKeyChar(false));
+        assertEquals(isCompatKeyChar, myProp.isKeyChar(true));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/Base64TestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/Base64TestCase.java
index b6e1c86..9b13da3 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/Base64TestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/Base64TestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.Arrays;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -37,203 +34,163 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.util.Base64;
-
-
-
 /**
  * This class defines a set of tests for the {@link Base64} class.
  */
-public final class Base64TestCase extends UtilTestCase
-{
-  // Look up table for converting hex chars to byte values.
-  private static final byte[] hexToByte = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
-      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-      -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10,
-      11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14,
-      15, -1, -1, -1, -1, -1, -1, -1, -1, -1 - 1, -1, -1, -1, -1, -1, -1, -1,
-      -1, -1, -1, -1, -1, -1, -1, -1 };
+public final class Base64TestCase extends UtilTestCase {
+    // Look up table for converting hex chars to byte values.
+    private static final byte[] HEX_TO_BYTE = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
+        -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1,
+        -1, -1, -1, -1, -1 - 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
 
+    /**
+     * Base 64 invalid test data provider.
+     *
+     * @return Returns an array of invalid encoded base64 data.
+     */
+    @DataProvider(name = "invalidData")
+    public Object[][] createInvalidData() {
+        // FIXME: fix cases ==== and ==x=
 
-
-  /**
-   * Base 64 invalid test data provider.
-   *
-   * @return Returns an array of invalid encoded base64 data.
-   */
-  @DataProvider(name = "invalidData")
-  public Object[][] createInvalidData()
-  {
-    // FIXME: fix cases ==== and ==x=
-
-    return new Object[][] { { "=" }, { "==" }, { "===" }, { "A" }, { "AA" },
-        { "AAA" }, { "AA`=" }, { "AA~=" }, { "AA!=" }, { "AA@=" }, { "AA#=" },
-        { "AA$=" }, { "AA%=" }, { "AA^=" }, { "AA*=" }, { "AA(=" }, { "AA)=" },
-        { "AA_=" }, { "AA-=" }, { "AA{=" }, { "AA}=" }, { "AA|=" }, { "AA[=" },
-        { "AA]=" }, { "AA\\=" }, { "AA;=" }, { "AA'=" }, { "AA\"=" },
-        { "AA:=" }, { "AA,=" }, { "AA.=" }, { "AA<=" }, { "AA>=" }, { "AA?=" },
-        { "AA;=" } };
-  }
-
-
-
-  /**
-   * Base 64 valid test data provider.
-   *
-   * @return Returns an array of decoded and valid encoded base64 data.
-   */
-  @DataProvider(name = "validData")
-  public Object[][] createValidData()
-  {
-    return new Object[][] {
-        { "", "" },
-        { "00", "AA==" },
-        { "01", "AQ==" },
-        { "02", "Ag==" },
-        { "03", "Aw==" },
-        { "04", "BA==" },
-        { "05", "BQ==" },
-        { "06", "Bg==" },
-        { "07", "Bw==" },
-        { "0000", "AAA=" },
-        { "000000", "AAAA" },
-        { "00000000", "AAAAAA==" },
-        {
-            "000102030405060708090a0b0c0d0e0f"
-                + "101112131415161718191a1b1c1d1e1f"
-                + "202122232425262728292a2b2c2d2e2f"
-                + "303132333435363738393a3b3c3d3e3f"
-                + "404142434445464748494a4b4c4d4e4f"
-                + "505152535455565758595a5b5c5d5e5f"
-                + "606162636465666768696a6b6c6d6e6f"
-                + "707172737475767778797a7b7c7d7e7f"
-                + "808182838485868788898a8b8c8d8e8f"
-                + "909192939495969798999a9b9c9d9e9f"
-                + "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
-                + "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
-                + "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
-                + "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
-                + "e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
-                + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
-            "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4v"
-                + "MDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5f"
-                + "YGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6P"
-                + "kJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/"
-                + "wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v"
-                + "8PHy8/T19vf4+fr7/P3+/w==" }, };
-  }
-
-
-
-  /**
-   * Tests the decode method against invalid data.
-   *
-   * @param encodedData
-   *          The invalid encoded data.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "invalidData", expectedExceptions = { LocalizedIllegalArgumentException.class })
-  public void testDecodeInvalidData(final String encodedData) throws Exception
-  {
-    Assert.fail("Expected exception but got result: "
-        + Arrays.toString(new ByteString[] { Base64.decode(encodedData) }));
-  }
-
-
-
-  /**
-   * Tests the decode method against valid data.
-   *
-   * @param hexData
-   *          The decoded hex data.
-   * @param encodedData
-   *          The encoded data.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "validData")
-  public void testDecodeValidData(final String hexData, final String encodedData)
-      throws Exception
-  {
-    final byte[] data = getBytes(hexData);
-    final byte[] decodedData = Base64.decode(encodedData).toByteArray();
-    Assert.assertEquals(decodedData, data);
-  }
-
-
-
-  /**
-   * Tests the encode method.
-   *
-   * @param hexData
-   *          The decoded hex data.
-   * @param encodedData
-   *          The encoded data.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "validData")
-  public void testEncode(final String hexData, final String encodedData)
-      throws Exception
-  {
-    final byte[] data = getBytes(hexData);
-    final String base64 = Base64.encode(ByteString.wrap(data));
-    Assert.assertEquals(base64, encodedData);
-  }
-
-
-
-  /**
-   * Decode a hex string to a byte-array.
-   *
-   * @param hexData
-   *          The string of hex.
-   * @return Returns the decoded byte array.
-   */
-  private byte[] getBytes(final String hexData)
-  {
-    final int sz = hexData.length();
-
-    if ((sz % 2) != 0)
-    {
-      throw new IllegalArgumentException(
-          "Hex string does not contain an even number of hex digits");
+        return new Object[][] { { "=" }, { "==" }, { "===" }, { "A" }, { "AA" }, { "AAA" },
+            { "AA`=" }, { "AA~=" }, { "AA!=" }, { "AA@=" }, { "AA#=" }, { "AA$=" }, { "AA%=" },
+            { "AA^=" }, { "AA*=" }, { "AA(=" }, { "AA)=" }, { "AA_=" }, { "AA-=" }, { "AA{=" },
+            { "AA}=" }, { "AA|=" }, { "AA[=" }, { "AA]=" }, { "AA\\=" }, { "AA;=" }, { "AA'=" },
+            { "AA\"=" }, { "AA:=" }, { "AA,=" }, { "AA.=" }, { "AA<=" }, { "AA>=" }, { "AA?=" },
+            { "AA;=" } };
     }
 
-    final byte[] bytes = new byte[sz / 2];
-
-    for (int i = 0, j = 0; i < sz; i += 2, j++)
-    {
-      int c = hexData.codePointAt(i);
-      if ((c & 0x7f) != c)
-      {
-        throw new IllegalArgumentException("Hex string contains non-hex digits");
-      }
-
-      final byte b1 = hexToByte[c];
-      if (b1 < 0)
-      {
-        throw new IllegalArgumentException("Hex string contains non-hex digits");
-      }
-
-      c = hexData.codePointAt(i + 1);
-      if ((c & 0x7f) != c)
-      {
-        throw new IllegalArgumentException("Hex string contains non-hex digits");
-      }
-
-      final byte b2 = hexToByte[c];
-      if (b2 < 0)
-      {
-        throw new IllegalArgumentException("Hex string contains non-hex digits");
-      }
-
-      bytes[j] = (byte) ((b1 << 4) | b2);
+    /**
+     * Base 64 valid test data provider.
+     *
+     * @return Returns an array of decoded and valid encoded base64 data.
+     */
+    @DataProvider(name = "validData")
+    public Object[][] createValidData() {
+        return new Object[][] {
+            { "", "" },
+            { "00", "AA==" },
+            { "01", "AQ==" },
+            { "02", "Ag==" },
+            { "03", "Aw==" },
+            { "04", "BA==" },
+            { "05", "BQ==" },
+            { "06", "Bg==" },
+            { "07", "Bw==" },
+            { "0000", "AAA=" },
+            { "000000", "AAAA" },
+            { "00000000", "AAAAAA==" },
+            {
+                "000102030405060708090a0b0c0d0e0f" + "101112131415161718191a1b1c1d1e1f"
+                        + "202122232425262728292a2b2c2d2e2f" + "303132333435363738393a3b3c3d3e3f"
+                        + "404142434445464748494a4b4c4d4e4f" + "505152535455565758595a5b5c5d5e5f"
+                        + "606162636465666768696a6b6c6d6e6f" + "707172737475767778797a7b7c7d7e7f"
+                        + "808182838485868788898a8b8c8d8e8f" + "909192939495969798999a9b9c9d9e9f"
+                        + "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf" + "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
+                        + "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf" + "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
+                        + "e0e1e2e3e4e5e6e7e8e9eaebecedeeef" + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
+                "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4v"
+                        + "MDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5f"
+                        + "YGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6P"
+                        + "kJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/"
+                        + "wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v"
+                        + "8PHy8/T19vf4+fr7/P3+/w==" }, };
     }
 
-    return bytes;
-  }
+    /**
+     * Tests the decode method against invalid data.
+     *
+     * @param encodedData
+     *            The invalid encoded data.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "invalidData",
+            expectedExceptions = { LocalizedIllegalArgumentException.class })
+    public void testDecodeInvalidData(final String encodedData) throws Exception {
+        Assert.fail("Expected exception but got result: "
+                + Arrays.toString(new ByteString[] { Base64.decode(encodedData) }));
+    }
+
+    /**
+     * Tests the decode method against valid data.
+     *
+     * @param hexData
+     *            The decoded hex data.
+     * @param encodedData
+     *            The encoded data.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "validData")
+    public void testDecodeValidData(final String hexData, final String encodedData)
+            throws Exception {
+        final byte[] data = getBytes(hexData);
+        final byte[] decodedData = Base64.decode(encodedData).toByteArray();
+        Assert.assertEquals(decodedData, data);
+    }
+
+    /**
+     * Tests the encode method.
+     *
+     * @param hexData
+     *            The decoded hex data.
+     * @param encodedData
+     *            The encoded data.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "validData")
+    public void testEncode(final String hexData, final String encodedData) throws Exception {
+        final byte[] data = getBytes(hexData);
+        final String base64 = Base64.encode(ByteString.wrap(data));
+        Assert.assertEquals(base64, encodedData);
+    }
+
+    /**
+     * Decode a hex string to a byte-array.
+     *
+     * @param hexData
+     *            The string of hex.
+     * @return Returns the decoded byte array.
+     */
+    private byte[] getBytes(final String hexData) {
+        final int sz = hexData.length();
+
+        if ((sz % 2) != 0) {
+            throw new IllegalArgumentException(
+                    "Hex string does not contain an even number of hex digits");
+        }
+
+        final byte[] bytes = new byte[sz / 2];
+
+        for (int i = 0, j = 0; i < sz; i += 2, j++) {
+            int c = hexData.codePointAt(i);
+            if ((c & 0x7f) != c) {
+                throw new IllegalArgumentException("Hex string contains non-hex digits");
+            }
+
+            final byte b1 = HEX_TO_BYTE[c];
+            if (b1 < 0) {
+                throw new IllegalArgumentException("Hex string contains non-hex digits");
+            }
+
+            c = hexData.codePointAt(i + 1);
+            if ((c & 0x7f) != c) {
+                throw new IllegalArgumentException("Hex string contains non-hex digits");
+            }
+
+            final byte b2 = HEX_TO_BYTE[c];
+            if (b2 < 0) {
+                throw new IllegalArgumentException("Hex string contains non-hex digits");
+            }
+
+            bytes[j] = (byte) ((b1 << 4) | b2);
+        }
+
+        return bytes;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java
index f7496e8..1df6270 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -38,193 +35,160 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.forgerock.opendj.util.StaticUtils;
-
-
-
 /**
  * Test {@code StaticUtils}.
  */
 @SuppressWarnings("javadoc")
-public final class StaticUtilsTestCase extends UtilTestCase
-{
-  /**
-   * Create data for format(...) tests.
-   *
-   * @return Returns test data.
-   */
-  @DataProvider(name = "createFormatData")
-  public Object[][] createFormatData()
-  {
-    return new Object[][] {
-        // Note that Calendar months run from 0-11,
-        // and that there was no such year as year 0 (1 BC -> 1 AD).
-        { 1, 0, 1, 0, 0, 0, 0, "00010101000000.000Z" },
-        { 9, 0, 1, 0, 0, 0, 0, "00090101000000.000Z" },
-        { 10, 0, 1, 0, 0, 0, 0, "00100101000000.000Z" },
-        { 99, 0, 1, 0, 0, 0, 0, "00990101000000.000Z" },
-        { 100, 0, 1, 0, 0, 0, 0, "01000101000000.000Z" },
-        { 999, 0, 1, 0, 0, 0, 0, "09990101000000.000Z" },
-        { 1000, 0, 1, 0, 0, 0, 0, "10000101000000.000Z" },
-        { 2000, 0, 1, 0, 0, 0, 0, "20000101000000.000Z" },
-        { 2099, 0, 1, 0, 0, 0, 0, "20990101000000.000Z" },
-        { 2000, 8, 1, 0, 0, 0, 0, "20000901000000.000Z" },
-        { 2000, 9, 1, 0, 0, 0, 0, "20001001000000.000Z" },
-        { 2000, 10, 1, 0, 0, 0, 0, "20001101000000.000Z" },
-        { 2000, 11, 1, 0, 0, 0, 0, "20001201000000.000Z" },
-        { 2000, 0, 9, 0, 0, 0, 0, "20000109000000.000Z" },
-        { 2000, 0, 10, 0, 0, 0, 0, "20000110000000.000Z" },
-        { 2000, 0, 19, 0, 0, 0, 0, "20000119000000.000Z" },
-        { 2000, 0, 20, 0, 0, 0, 0, "20000120000000.000Z" },
-        { 2000, 0, 29, 0, 0, 0, 0, "20000129000000.000Z" },
-        { 2000, 0, 30, 0, 0, 0, 0, "20000130000000.000Z" },
-        { 2000, 0, 31, 0, 0, 0, 0, "20000131000000.000Z" },
-        { 2000, 0, 1, 9, 0, 0, 0, "20000101090000.000Z" },
-        { 2000, 0, 1, 10, 0, 0, 0, "20000101100000.000Z" },
-        { 2000, 0, 1, 19, 0, 0, 0, "20000101190000.000Z" },
-        { 2000, 0, 1, 20, 0, 0, 0, "20000101200000.000Z" },
-        { 2000, 0, 1, 23, 0, 0, 0, "20000101230000.000Z" },
-        { 2000, 0, 1, 0, 9, 0, 0, "20000101000900.000Z" },
-        { 2000, 0, 1, 0, 10, 0, 0, "20000101001000.000Z" },
-        { 2000, 0, 1, 0, 59, 0, 0, "20000101005900.000Z" },
-        { 2000, 0, 1, 0, 0, 9, 0, "20000101000009.000Z" },
-        { 2000, 0, 1, 0, 0, 10, 0, "20000101000010.000Z" },
-        { 2000, 0, 1, 0, 0, 59, 0, "20000101000059.000Z" },
-        { 2000, 0, 1, 0, 0, 0, 9, "20000101000000.009Z" },
-        { 2000, 0, 1, 0, 0, 0, 10, "20000101000000.010Z" },
-        { 2000, 0, 1, 0, 0, 0, 99, "20000101000000.099Z" },
-        { 2000, 0, 1, 0, 0, 0, 100, "20000101000000.100Z" },
-        { 2000, 0, 1, 0, 0, 0, 999, "20000101000000.999Z" }, };
-  }
-
-
-
-  @DataProvider(name = "dataForToLowerCase")
-  public Object[][] dataForToLowerCase()
-  {
-    // Value, toLowerCase or null if identity
-    return new Object[][] {
-        { "", null },
-        { " ", null },
-        { "   ", null },
-        { "12345", null },
-        {
-            "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
-            null },
-        {
-            "Aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
-            "aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./" },
-        {
-            "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./A",
-            "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./a" },
-        { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" },
-        { "\u00c7edilla", "\u00e7edilla" }, { "ced\u00cdlla", "ced\u00edlla" }, };
-  }
-
-
-
-  /**
-   * Tests {@link GeneralizedTimeSyntax#format(java.util.Date)}.
-   *
-   * @param yyyy
-   *          The year.
-   * @param MM
-   *          The month.
-   * @param dd
-   *          The day.
-   * @param HH
-   *          The hour.
-   * @param mm
-   *          The minute.
-   * @param ss
-   *          The second.
-   * @param SSS
-   *          The milli-seconds.
-   * @param expected
-   *          The expected generalized time formatted string.
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test(dataProvider = "createFormatData")
-  public void testFormatDate(final int yyyy, final int MM, final int dd,
-      final int HH, final int mm, final int ss, final int SSS,
-      final String expected) throws Exception
-  {
-    final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
-    calendar.set(yyyy, MM, dd, HH, mm, ss);
-    calendar.set(Calendar.MILLISECOND, SSS);
-    final Date time = new Date(calendar.getTimeInMillis());
-    final String actual = StaticUtils.formatAsGeneralizedTime(time);
-    Assert.assertEquals(actual, expected);
-  }
-
-
-
-  /**
-   * Tests {@link StaticUtils#formatAsGeneralizedTime(long)} .
-   *
-   * @param yyyy
-   *          The year.
-   * @param MM
-   *          The month.
-   * @param dd
-   *          The day.
-   * @param HH
-   *          The hour.
-   * @param mm
-   *          The minute.
-   * @param ss
-   *          The second.
-   * @param SSS
-   *          The milli-seconds.
-   * @param expected
-   *          The expected generalized time formatted string.
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test(dataProvider = "createFormatData")
-  public void testFormatLong(final int yyyy, final int MM, final int dd,
-      final int HH, final int mm, final int ss, final int SSS,
-      final String expected) throws Exception
-  {
-    final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
-    calendar.set(yyyy, MM, dd, HH, mm, ss);
-    calendar.set(Calendar.MILLISECOND, SSS);
-    final long time = calendar.getTimeInMillis();
-    final String actual = StaticUtils.formatAsGeneralizedTime(time);
-    Assert.assertEquals(actual, expected);
-  }
-
-
-
-  @Test(dataProvider = "dataForToLowerCase")
-  public void testToLowerCaseString(final String s, final String expected)
-  {
-    final String actual = StaticUtils.toLowerCase(s);
-    if (expected == null)
-    {
-      Assert.assertSame(actual, s);
+public final class StaticUtilsTestCase extends UtilTestCase {
+    /**
+     * Create data for format(...) tests.
+     *
+     * @return Returns test data.
+     */
+    @DataProvider(name = "createFormatData")
+    public Object[][] createFormatData() {
+        return new Object[][] {
+            // Note that Calendar months run from 0-11,
+            // and that there was no such year as year 0 (1 BC -> 1 AD).
+            { 1, 0, 1, 0, 0, 0, 0, "00010101000000.000Z" },
+            { 9, 0, 1, 0, 0, 0, 0, "00090101000000.000Z" },
+            { 10, 0, 1, 0, 0, 0, 0, "00100101000000.000Z" },
+            { 99, 0, 1, 0, 0, 0, 0, "00990101000000.000Z" },
+            { 100, 0, 1, 0, 0, 0, 0, "01000101000000.000Z" },
+            { 999, 0, 1, 0, 0, 0, 0, "09990101000000.000Z" },
+            { 1000, 0, 1, 0, 0, 0, 0, "10000101000000.000Z" },
+            { 2000, 0, 1, 0, 0, 0, 0, "20000101000000.000Z" },
+            { 2099, 0, 1, 0, 0, 0, 0, "20990101000000.000Z" },
+            { 2000, 8, 1, 0, 0, 0, 0, "20000901000000.000Z" },
+            { 2000, 9, 1, 0, 0, 0, 0, "20001001000000.000Z" },
+            { 2000, 10, 1, 0, 0, 0, 0, "20001101000000.000Z" },
+            { 2000, 11, 1, 0, 0, 0, 0, "20001201000000.000Z" },
+            { 2000, 0, 9, 0, 0, 0, 0, "20000109000000.000Z" },
+            { 2000, 0, 10, 0, 0, 0, 0, "20000110000000.000Z" },
+            { 2000, 0, 19, 0, 0, 0, 0, "20000119000000.000Z" },
+            { 2000, 0, 20, 0, 0, 0, 0, "20000120000000.000Z" },
+            { 2000, 0, 29, 0, 0, 0, 0, "20000129000000.000Z" },
+            { 2000, 0, 30, 0, 0, 0, 0, "20000130000000.000Z" },
+            { 2000, 0, 31, 0, 0, 0, 0, "20000131000000.000Z" },
+            { 2000, 0, 1, 9, 0, 0, 0, "20000101090000.000Z" },
+            { 2000, 0, 1, 10, 0, 0, 0, "20000101100000.000Z" },
+            { 2000, 0, 1, 19, 0, 0, 0, "20000101190000.000Z" },
+            { 2000, 0, 1, 20, 0, 0, 0, "20000101200000.000Z" },
+            { 2000, 0, 1, 23, 0, 0, 0, "20000101230000.000Z" },
+            { 2000, 0, 1, 0, 9, 0, 0, "20000101000900.000Z" },
+            { 2000, 0, 1, 0, 10, 0, 0, "20000101001000.000Z" },
+            { 2000, 0, 1, 0, 59, 0, 0, "20000101005900.000Z" },
+            { 2000, 0, 1, 0, 0, 9, 0, "20000101000009.000Z" },
+            { 2000, 0, 1, 0, 0, 10, 0, "20000101000010.000Z" },
+            { 2000, 0, 1, 0, 0, 59, 0, "20000101000059.000Z" },
+            { 2000, 0, 1, 0, 0, 0, 9, "20000101000000.009Z" },
+            { 2000, 0, 1, 0, 0, 0, 10, "20000101000000.010Z" },
+            { 2000, 0, 1, 0, 0, 0, 99, "20000101000000.099Z" },
+            { 2000, 0, 1, 0, 0, 0, 100, "20000101000000.100Z" },
+            { 2000, 0, 1, 0, 0, 0, 999, "20000101000000.999Z" }, };
     }
-    else
-    {
-      Assert.assertEquals(actual, expected);
-    }
-  }
 
-
-
-  @Test(dataProvider = "dataForToLowerCase")
-  public void testToLowerCaseStringBuilder(final String s, final String expected)
-  {
-    final StringBuilder builder = new StringBuilder();
-    final String actual = StaticUtils.toLowerCase(s, builder).toString();
-    if (expected == null)
-    {
-      Assert.assertEquals(actual, s);
+    @DataProvider(name = "dataForToLowerCase")
+    public Object[][] dataForToLowerCase() {
+        // Value, toLowerCase or null if identity
+        return new Object[][] {
+            { "", null },
+            { " ", null },
+            { "   ", null },
+            { "12345", null },
+            { "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./", null },
+            { "Aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
+                "aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./" },
+            { "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./A",
+                "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./a" },
+            { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" },
+            { "\u00c7edilla", "\u00e7edilla" }, { "ced\u00cdlla", "ced\u00edlla" }, };
     }
-    else
-    {
-      Assert.assertEquals(actual, expected);
+
+    /**
+     * Tests {@link GeneralizedTimeSyntax#format(java.util.Date)}.
+     *
+     * @param yyyy
+     *            The year.
+     * @param months
+     *            The month.
+     * @param dd
+     *            The day.
+     * @param hours
+     *            The hour.
+     * @param mm
+     *            The minute.
+     * @param ss
+     *            The second.
+     * @param ms
+     *            The milli-seconds.
+     * @param expected
+     *            The expected generalized time formatted string.
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test(dataProvider = "createFormatData")
+    public void testFormatDate(final int yyyy, final int months, final int dd, final int hours,
+            final int mm, final int ss, final int ms, final String expected) throws Exception {
+        final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+        calendar.set(yyyy, months, dd, hours, mm, ss);
+        calendar.set(Calendar.MILLISECOND, ms);
+        final Date time = new Date(calendar.getTimeInMillis());
+        final String actual = StaticUtils.formatAsGeneralizedTime(time);
+        Assert.assertEquals(actual, expected);
     }
-  }
+
+    /**
+     * Tests {@link StaticUtils#formatAsGeneralizedTime(long)} .
+     *
+     * @param yyyy
+     *            The year.
+     * @param months
+     *            The month.
+     * @param dd
+     *            The day.
+     * @param hours
+     *            The hour.
+     * @param mm
+     *            The minute.
+     * @param ss
+     *            The second.
+     * @param ms
+     *            The milli-seconds.
+     * @param expected
+     *            The expected generalized time formatted string.
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test(dataProvider = "createFormatData")
+    public void testFormatLong(final int yyyy, final int months, final int dd, final int hours,
+            final int mm, final int ss, final int ms, final String expected) throws Exception {
+        final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+        calendar.set(yyyy, months, dd, hours, mm, ss);
+        calendar.set(Calendar.MILLISECOND, ms);
+        final long time = calendar.getTimeInMillis();
+        final String actual = StaticUtils.formatAsGeneralizedTime(time);
+        Assert.assertEquals(actual, expected);
+    }
+
+    @Test(dataProvider = "dataForToLowerCase")
+    public void testToLowerCaseString(final String s, final String expected) {
+        final String actual = StaticUtils.toLowerCase(s);
+        if (expected == null) {
+            Assert.assertSame(actual, s);
+        } else {
+            Assert.assertEquals(actual, expected);
+        }
+    }
+
+    @Test(dataProvider = "dataForToLowerCase")
+    public void testToLowerCaseStringBuilder(final String s, final String expected) {
+        final StringBuilder builder = new StringBuilder();
+        final String actual = StaticUtils.toLowerCase(s, builder).toString();
+        if (expected == null) {
+            Assert.assertEquals(actual, s);
+        } else {
+            Assert.assertEquals(actual, expected);
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java
index cb8affa..4123969 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import static org.testng.Assert.assertEquals;
 
 import org.forgerock.opendj.ldap.Assertion;
@@ -39,82 +36,67 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This Test Class tests various matching rules for their compability against
  * RFC 4517,4518 and 3454.
  */
 @SuppressWarnings("javadoc")
-public class StringPrepProfileTestCase extends UtilTestCase
-{
-  /**
-   * Tests the stringprep preparation sans any case folding. This is applicable
-   * to case exact matching rules only.
-   */
-  @Test(dataProvider = "exactRuleData")
-  public void testStringPrepNoCaseFold(final String value1,
-      final String value2, final ConditionResult result) throws Exception
-  {
-    // Take any caseExact matching rule.
-    final MatchingRule rule = Schema.getCoreSchema()
-        .getMatchingRule("2.5.13.5");
-    final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
-    final ByteString normalizedValue2 = rule.normalizeAttributeValue(ByteString
-        .valueOf(value2));
-    final ConditionResult liveResult = assertion.matches(normalizedValue2);
-    assertEquals(result, liveResult);
-  }
+public class StringPrepProfileTestCase extends UtilTestCase {
+    /**
+     * Tests the stringprep preparation sans any case folding. This is
+     * applicable to case exact matching rules only.
+     */
+    @Test(dataProvider = "exactRuleData")
+    public void testStringPrepNoCaseFold(final String value1, final String value2,
+            final ConditionResult result) throws Exception {
+        // Take any caseExact matching rule.
+        final MatchingRule rule = Schema.getCoreSchema().getMatchingRule("2.5.13.5");
+        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
+        final ByteString normalizedValue2 =
+                rule.normalizeAttributeValue(ByteString.valueOf(value2));
+        final ConditionResult liveResult = assertion.matches(normalizedValue2);
+        assertEquals(result, liveResult);
+    }
 
+    /**
+     * Tests the stringprep preparation with case folding. This is applicable to
+     * case ignore matching rules only.
+     */
+    @Test(dataProvider = "caseFoldRuleData")
+    public void testStringPrepWithCaseFold(final String value1, final String value2,
+            final ConditionResult result) throws Exception {
+        // Take any caseExact matching rule.
+        final MatchingRule rule = Schema.getCoreSchema().getMatchingRule("2.5.13.2");
+        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
+        final ByteString normalizedValue2 =
+                rule.normalizeAttributeValue(ByteString.valueOf(value2));
+        final ConditionResult liveResult = assertion.matches(normalizedValue2);
+        assertEquals(result, liveResult);
+    }
 
+    // Generates data for case exact matching rules.
+    @DataProvider(name = "exactRuleData")
+    public Object[][] createExactRuleData() {
+        return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+            { "ABC45678", "ABC45678", ConditionResult.TRUE },
+            { "ABC45678", "abc45678", ConditionResult.FALSE },
+            { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
+            { "test\u00AD\u200D", "test", ConditionResult.TRUE },
+            { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
+            { "foo\u070Fbar", "foobar", ConditionResult.TRUE }, };
+    }
 
-  /**
-   * Tests the stringprep preparation with case folding. This is applicable to
-   * case ignore matching rules only.
-   */
-  @Test(dataProvider = "caseFoldRuleData")
-  public void testStringPrepWithCaseFold(final String value1,
-      final String value2, final ConditionResult result) throws Exception
-  {
-    // Take any caseExact matching rule.
-    final MatchingRule rule = Schema.getCoreSchema()
-        .getMatchingRule("2.5.13.2");
-    final Assertion assertion = rule.getAssertion(ByteString.valueOf(value1));
-    final ByteString normalizedValue2 = rule.normalizeAttributeValue(ByteString
-        .valueOf(value2));
-    final ConditionResult liveResult = assertion.matches(normalizedValue2);
-    assertEquals(result, liveResult);
-  }
-
-
-
-  // Generates data for case exact matching rules.
-  @DataProvider(name = "exactRuleData")
-  public Object[][] createExactRuleData()
-  {
-    return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
-        { "ABC45678", "ABC45678", ConditionResult.TRUE },
-        { "ABC45678", "abc45678", ConditionResult.FALSE },
-        { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
-        { "test\u00AD\u200D", "test", ConditionResult.TRUE },
-        { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
-        { "foo\u070Fbar", "foobar", ConditionResult.TRUE }, };
-  }
-
-
-
-  // Generates data for case ignore matching rules.
-  @DataProvider(name = "caseFoldRuleData")
-  public Object[][] createIgnoreRuleData()
-  {
-    return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
-        { "ABC45678", "abc45678", ConditionResult.TRUE },
-        { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
-        { "test\u00AD\u200D", "test", ConditionResult.TRUE },
-        { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
-        { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
-        { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE },
-        { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE },
-        { "foo\u017BBAR", "foo\u017Cbar", ConditionResult.TRUE }, };
-  }
+    // Generates data for case ignore matching rules.
+    @DataProvider(name = "caseFoldRuleData")
+    public Object[][] createIgnoreRuleData() {
+        return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+            { "ABC45678", "abc45678", ConditionResult.TRUE },
+            { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
+            { "test\u00AD\u200D", "test", ConditionResult.TRUE },
+            { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
+            { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
+            { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE },
+            { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE },
+            { "foo\u017BBAR", "foo\u017Cbar", ConditionResult.TRUE }, };
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/UtilTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/UtilTestCase.java
index 44886bc..3cb63ed 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/UtilTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/com/forgerock/opendj/util/UtilTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,18 +27,13 @@
 
 package com.forgerock.opendj.util;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all util unit tests should extend. Util represents the
  * classes found directly under the package org.forgerock.opendj.ldap.util.
  */
 @Test(groups = { "precommit", "util", "sdk" })
-public abstract class UtilTestCase extends ForgeRockTestCase
-{
+public abstract class UtilTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReaderTestCase.java
index 1efedcf..65fb26e 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ByteSequenceReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,24 +26,16 @@
 
 package org.forgerock.opendj.asn1;
 
-
-
-import org.forgerock.opendj.asn1.ASN1;
-import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.ldap.ByteSequenceReader;
 import org.forgerock.opendj.ldap.ByteString;
 
-
-
 /**
  * Test class for ASN1ByteSequenceReaderTestCase
  */
-public class ASN1ByteSequenceReaderTestCase extends ASN1ReaderTestCase
-{
-  @Override
-  protected ASN1Reader getReader(final byte[] b, final int maxElementSize)
-  {
-    final ByteSequenceReader reader = ByteString.wrap(b).asReader();
-    return ASN1.getReader(reader, maxElementSize);
-  }
+public class ASN1ByteSequenceReaderTestCase extends ASN1ReaderTestCase {
+    @Override
+    protected ASN1Reader getReader(final byte[] b, final int maxElementSize) {
+        final ByteSequenceReader reader = ByteString.wrap(b).asReader();
+        return ASN1.getReader(reader, maxElementSize);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1InputStreamReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1InputStreamReaderTestCase.java
index 607d8ff..328b5b9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1InputStreamReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1InputStreamReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,24 +25,15 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import java.io.ByteArrayInputStream;
 
-import org.forgerock.opendj.asn1.ASN1InputStreamReader;
-import org.forgerock.opendj.asn1.ASN1Reader;
-
-
-
 /**
  * Test class for ASN1InputStreamReader
  */
-public class ASN1InputStreamReaderTestCase extends ASN1ReaderTestCase
-{
-  @Override
-  protected ASN1Reader getReader(final byte[] b, final int maxElementSize)
-  {
-    final ByteArrayInputStream inStream = new ByteArrayInputStream(b);
-    return new ASN1InputStreamReader(inStream, maxElementSize);
-  }
+public class ASN1InputStreamReaderTestCase extends ASN1ReaderTestCase {
+    @Override
+    protected ASN1Reader getReader(final byte[] b, final int maxElementSize) {
+        final ByteArrayInputStream inStream = new ByteArrayInputStream(b);
+        return new ASN1InputStreamReader(inStream, maxElementSize);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriterTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriterTestCase.java
index 2346951..f9f09a9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriterTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1OutputStreamWriterTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,49 +25,30 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
-import org.forgerock.opendj.asn1.ASN1InputStreamReader;
-import org.forgerock.opendj.asn1.ASN1OutputStreamWriter;
-import org.forgerock.opendj.asn1.ASN1Reader;
-import org.forgerock.opendj.asn1.ASN1Writer;
-
-
-
 /**
  * Test class for ASN1OutputStreamWriter
  */
-public class ASN1OutputStreamWriterTestCase extends ASN1WriterTestCase
-{
-  private final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-  private final ASN1Writer writer = new ASN1OutputStreamWriter(outStream);
+public class ASN1OutputStreamWriterTestCase extends ASN1WriterTestCase {
+    private final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+    private final ASN1Writer writer = new ASN1OutputStreamWriter(outStream);
 
+    @Override
+    protected byte[] getEncodedBytes() {
+        return outStream.toByteArray();
+    }
 
+    @Override
+    protected ASN1Reader getReader(final byte[] encodedBytes) {
+        final ByteArrayInputStream inStream = new ByteArrayInputStream(encodedBytes);
+        return new ASN1InputStreamReader(inStream, 0);
+    }
 
-  @Override
-  protected byte[] getEncodedBytes()
-  {
-    return outStream.toByteArray();
-  }
-
-
-
-  @Override
-  protected ASN1Reader getReader(final byte[] encodedBytes)
-  {
-    final ByteArrayInputStream inStream = new ByteArrayInputStream(encodedBytes);
-    return new ASN1InputStreamReader(inStream, 0);
-  }
-
-
-
-  @Override
-  protected ASN1Writer getWriter()
-  {
-    outStream.reset();
-    return writer;
-  }
+    @Override
+    protected ASN1Writer getWriter() {
+        outStream.reset();
+        return writer;
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ReaderTestCase.java
index 7ea5b6b..2cbfdcb 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1ReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,16 +26,12 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
 import java.io.IOException;
 
-import org.forgerock.opendj.asn1.ASN1Constants;
-import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.DecodeException;
@@ -44,882 +39,731 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract base class for all ASN1Reader test cases.
  */
 @Test(groups = { "precommit", "asn1", "sdk" })
-public abstract class ASN1ReaderTestCase extends ForgeRockTestCase
-{
+public abstract class ASN1ReaderTestCase extends ForgeRockTestCase {
 
-  /**
-   * Retrieves the set of byte array values that may be used for testing.
-   *
-   * @return The set of byte array values that may be used for testing.
-   */
-  @DataProvider(name = "byteValues")
-  public Object[][] getByteValues()
-  {
-    final Object[][] array = new Object[256][1];
-    for (int i = 0; i < 256; i++)
-    {
-      array[i] = new Object[] { new byte[] { (byte) (i & 0xFF) } };
+    /**
+     * Retrieves the set of byte array values that may be used for testing.
+     *
+     * @return The set of byte array values that may be used for testing.
+     */
+    @DataProvider(name = "byteValues")
+    public Object[][] getByteValues() {
+        final Object[][] array = new Object[256][1];
+        for (int i = 0; i < 256; i++) {
+            array[i] = new Object[] { new byte[] { (byte) (i & 0xFF) } };
+        }
+
+        return array;
     }
 
-    return array;
-  }
-
-
-
-  /**
-   * Create byte arrays with encoded ASN.1 elements to test decoding them as
-   * octet strings.
-   *
-   * @return A list of byte arrays with encoded ASN.1 elements that can be
-   *         decoded as octet strings.
-   */
-  @DataProvider(name = "elementArrays")
-  public Object[][] getElementArrays()
-  {
-    return new Object[][] {
-        new Object[] { new byte[] { 0x04, 0x00 } },
-        new Object[] { new byte[] { (byte) 0x50, 0x00 } },
-        new Object[] { new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F } },
-        new Object[] { new byte[] { 0x01, 0x01, 0x00 } },
-        new Object[] { new byte[] { 0x01, 0x01, (byte) 0xFF } },
-        new Object[] { new byte[] { 0x0A, 0x01, 0x00 } },
-        new Object[] { new byte[] { 0x0A, 0x01, 0x01 } },
-        new Object[] { new byte[] { 0x0A, 0x01, 0x7F } },
-        new Object[] { new byte[] { 0x0A, 0x01, (byte) 0x80 } },
-        new Object[] { new byte[] { 0x0A, 0x01, (byte) 0xFF } },
-        new Object[] { new byte[] { 0x0A, 0x02, 0x01, 0x00 } },
-        new Object[] { new byte[] { 0x02, 0x01, 0x00 } },
-        new Object[] { new byte[] { 0x02, 0x01, 0x01 } },
-        new Object[] { new byte[] { 0x02, 0x01, 0x7F } },
-        new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0x80 } },
-        new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0xFF } },
-        new Object[] { new byte[] { 0x02, 0x02, 0x01, 0x00 } },
-        new Object[] { new byte[] { 0x05, 0x00 } },
-        new Object[] { new byte[] { 0x30, 0x00 } },
-        new Object[] { new byte[] { 0x31, 0x00 } },
-        new Object[] { new byte[] { 0x05, (byte) 0x81, 0x00 } },
-        new Object[] { new byte[] { 0x05, (byte) 0x82, 0x00, 0x00 } },
-        new Object[] { new byte[] { 0x05, (byte) 0x83, 0x00, 0x00, 0x00 } },
-        new Object[] { new byte[] { 0x05, (byte) 0x84, 0x00, 0x00, 0x00, 0x00 } }, };
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with an arry with a zero length that takes multiple bytes to encode.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test()
-  public void testDecodeExtendedZeroLengthArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[] { 0x05, (byte) 0x81, 0x00 };
-    getReader(b, 0).readNull();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with an array that has less bytes than indicated by the length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLengthMismatchArrayAsBoolean() throws Exception
-  {
-    final byte[] b = { 0x01, 0x01 };
-    getReader(b, 0).readBoolean();
-  }
-
-
-
-  /**
-   * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with a
-   * length mismatch.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLengthMismatchArrayAsEnumerated() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x81, 0x01 };
-    getReader(b, 0).readEnumerated();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with
-   * a length mismatch.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLengthMismatchArrayAsInteger() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x81, 0x01 };
-    getReader(b, 0).readInteger();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
-   * using an array whose actual length doesn't match with the decoded length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLengthMismatchArrayAsOctetString() throws Exception
-  {
-    final byte[] b = { 0x04, 0x02, 0x00 };
-    getReader(b, 0).readOctetString();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with an array that takes too many bytes to expressthe length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsBoolean() throws Exception
-  {
-    final byte[] b = { 0x01, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
-    getReader(b, 0).readBoolean();
-  }
-
-
-
-  /**
-   * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with a
-   * long length array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsEnumerated() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
-    getReader(b, 0).readEnumerated();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with
-   * a long length array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsInteger() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
-    getReader(b, 0).readInteger();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with an array with a long length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[] { 0x05, (byte) 0x85, 0x00, 0x00, 0x00, 0x00,
-        0x00 };
-    getReader(b, 0).readNull();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
-   * using an array that indicates it takes more than four bytes to encode the
-   * length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsOctetString() throws Exception
-  {
-    final byte[] b = { 0x04, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    getReader(b, 0).readOctetString();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
-   * argument with an array that takes too many bytes to encode the length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongLengthArrayAsSequence() throws Exception
-  {
-    final byte[] b = { 0x30, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    getReader(b, 0).readStartSequence();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with an array that has an invalid number of bytes in the value.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeLongValueArrayAsBoolean() throws Exception
-  {
-    final byte[] b = { 0x01, 0x02, 0x00, 0x00 };
-    getReader(b, 0).readBoolean();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with an arry with a nonzero length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeNonZeroLengthArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[] { 0x05, 0x01, 0x00 };
-    getReader(b, 0).readNull();
-  }
-
-
-
-  /**
-   * Tests the <CODE>readOctetString</CODE> method when the max element size is
-   * exceeded.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeOctetStringExceedMaxSize() throws Exception
-  {
-    final byte[] b = new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
-    getReader(b, 3).readOctetString();
-  }
-
-
-
-  /**
-   * Tests the <CODE>readOctetString</CODE> method when the max element size is
-   * exceeded.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeSequenceExceedMaxSize() throws Exception
-  {
-    final byte[] b = new byte[] { 0x30, 0x07, 0x04, 0x05, 0x48, 0x65, 0x6C,
-        0x6C, 0x6F };
-    getReader(b, 3).readOctetString();
-  }
-
-
-
-  /**
-   * Tests to make sure trailing components are ignored if not used.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDecodeSequenceIncompleteRead() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    final byte[] b = new byte[] { 0x30, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01,
-        0x01, 0x01, 0x01, 0x00 };
-    final ASN1Reader reader = getReader(b, 0);
-    reader.readStartSequence();
-    reader.readEndSequence();
-    assertFalse(reader.readBoolean());
-  }
-
-
-
-  /**
-   * Tests to make sure a premature EOF while reading a sub sequence can be
-   * detected.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeSequencePrematureEof() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    final byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x01,
-        0x00 };
-    final ASN1Reader reader = getReader(b, 0);
-    reader.readStartSequence();
-    while (reader.hasNextElement())
-    {
-      reader.readBoolean();
+    /**
+     * Create byte arrays with encoded ASN.1 elements to test decoding them as
+     * octet strings.
+     *
+     * @return A list of byte arrays with encoded ASN.1 elements that can be
+     *         decoded as octet strings.
+     */
+    @DataProvider(name = "elementArrays")
+    public Object[][] getElementArrays() {
+        return new Object[][] { new Object[] { new byte[] { 0x04, 0x00 } },
+            new Object[] { new byte[] { (byte) 0x50, 0x00 } },
+            new Object[] { new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F } },
+            new Object[] { new byte[] { 0x01, 0x01, 0x00 } },
+            new Object[] { new byte[] { 0x01, 0x01, (byte) 0xFF } },
+            new Object[] { new byte[] { 0x0A, 0x01, 0x00 } },
+            new Object[] { new byte[] { 0x0A, 0x01, 0x01 } },
+            new Object[] { new byte[] { 0x0A, 0x01, 0x7F } },
+            new Object[] { new byte[] { 0x0A, 0x01, (byte) 0x80 } },
+            new Object[] { new byte[] { 0x0A, 0x01, (byte) 0xFF } },
+            new Object[] { new byte[] { 0x0A, 0x02, 0x01, 0x00 } },
+            new Object[] { new byte[] { 0x02, 0x01, 0x00 } },
+            new Object[] { new byte[] { 0x02, 0x01, 0x01 } },
+            new Object[] { new byte[] { 0x02, 0x01, 0x7F } },
+            new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0x80 } },
+            new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0xFF } },
+            new Object[] { new byte[] { 0x02, 0x02, 0x01, 0x00 } },
+            new Object[] { new byte[] { 0x05, 0x00 } }, new Object[] { new byte[] { 0x30, 0x00 } },
+            new Object[] { new byte[] { 0x31, 0x00 } },
+            new Object[] { new byte[] { 0x05, (byte) 0x81, 0x00 } },
+            new Object[] { new byte[] { 0x05, (byte) 0x82, 0x00, 0x00 } },
+            new Object[] { new byte[] { 0x05, (byte) 0x83, 0x00, 0x00, 0x00 } },
+            new Object[] { new byte[] { 0x05, (byte) 0x84, 0x00, 0x00, 0x00, 0x00 } }, };
     }
-    reader.readEndSequence();
-  }
 
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with an arry with a zero length that takes multiple bytes to
+     * encode.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test()
+    public void testDecodeExtendedZeroLengthArrayAsNull() throws Exception {
+        final byte[] b = new byte[] { 0x05, (byte) 0x81, 0x00 };
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with an array that has less bytes than indicated by the length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLengthMismatchArrayAsBoolean() throws Exception {
+        final byte[] b = { 0x01, 0x01 };
+        getReader(b, 0).readBoolean();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with a short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsBoolean() throws Exception
-  {
-    final byte[] b = new byte[1];
-    getReader(b, 0).readBoolean();
-  }
+    /**
+     * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with
+     * a length mismatch.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLengthMismatchArrayAsEnumerated() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x81, 0x01 };
+        getReader(b, 0).readEnumerated();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array
+     * with a length mismatch.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLengthMismatchArrayAsInteger() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x81, 0x01 };
+        getReader(b, 0).readInteger();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
+     * using an array whose actual length doesn't match with the decoded length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLengthMismatchArrayAsOctetString() throws Exception {
+        final byte[] b = { 0x04, 0x02, 0x00 };
+        getReader(b, 0).readOctetString();
+    }
 
-  /**
-   * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with a
-   * short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsEnumerated() throws Exception
-  {
-    final byte[] b = new byte[0];
-    getReader(b, 0).readEnumerated();
-  }
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with an array that takes too many bytes to expressthe length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsBoolean() throws Exception {
+        final byte[] b = { 0x01, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
+        getReader(b, 0).readBoolean();
+    }
 
+    /**
+     * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with
+     * a long length array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsEnumerated() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
+        getReader(b, 0).readEnumerated();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array
+     * with a long length array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsInteger() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 };
+        getReader(b, 0).readInteger();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with
-   * a short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsInteger() throws Exception
-  {
-    final byte[] b = new byte[0];
-    getReader(b, 0).readInteger();
-  }
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with an array with a long length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsNull() throws Exception {
+        final byte[] b = new byte[] { 0x05, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 };
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
+     * using an array that indicates it takes more than four bytes to encode the
+     * length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsOctetString() throws Exception {
+        final byte[] b = { 0x04, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 };
+        getReader(b, 0).readOctetString();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
+     * argument with an array that takes too many bytes to encode the length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongLengthArrayAsSequence() throws Exception {
+        final byte[] b = { 0x30, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 };
+        getReader(b, 0).readStartSequence();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with a short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[1];
-    getReader(b, 0).readNull();
-  }
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with an array that has an invalid number of bytes in the value.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeLongValueArrayAsBoolean() throws Exception {
+        final byte[] b = { 0x01, 0x02, 0x00, 0x00 };
+        getReader(b, 0).readBoolean();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with an arry with a nonzero length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeNonZeroLengthArrayAsNull() throws Exception {
+        final byte[] b = new byte[] { 0x05, 0x01, 0x00 };
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>readOctetString</CODE> method when the max element size
+     * is exceeded.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeOctetStringExceedMaxSize() throws Exception {
+        final byte[] b = new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
+        getReader(b, 3).readOctetString();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
-   * using a short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsOctetString() throws Exception
-  {
-    final byte[] b = new byte[1];
-    getReader(b, 0).readOctetString();
-  }
+    /**
+     * Tests the <CODE>readOctetString</CODE> method when the max element size
+     * is exceeded.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeSequenceExceedMaxSize() throws Exception {
+        final byte[] b = new byte[] { 0x30, 0x07, 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
+        getReader(b, 3).readOctetString();
+    }
 
+    /**
+     * Tests to make sure trailing components are ignored if not used.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDecodeSequenceIncompleteRead() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        final byte[] b =
+                new byte[] { 0x30, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 };
+        final ASN1Reader reader = getReader(b, 0);
+        reader.readStartSequence();
+        reader.readEndSequence();
+        assertFalse(reader.readBoolean());
+    }
 
+    /**
+     * Tests to make sure a premature EOF while reading a sub sequence can be
+     * detected.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeSequencePrematureEof() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        final byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00 };
+        final ASN1Reader reader = getReader(b, 0);
+        reader.readStartSequence();
+        while (reader.hasNextElement()) {
+            reader.readBoolean();
+        }
+        reader.readEndSequence();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
-   * argument with a short array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortArrayAsSequence() throws Exception
-  {
-    final byte[] b = new byte[1];
-    getReader(b, 0).readStartSequence();
-  }
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsBoolean() throws Exception {
+        final byte[] b = new byte[1];
+        getReader(b, 0).readBoolean();
+    }
 
+    /**
+     * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with
+     * a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsEnumerated() throws Exception {
+        final byte[] b = new byte[0];
+        getReader(b, 0).readEnumerated();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array
+     * with a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsInteger() throws Exception {
+        final byte[] b = new byte[0];
+        getReader(b, 0).readInteger();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with an array that has an invalid number of bytes in the value.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeShortValueArrayAsBoolean() throws Exception
-  {
-    final byte[] b = { 0x01, 0x00, 0x00, 0x00 };
-    getReader(b, 0).readBoolean();
-  }
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsNull() throws Exception {
+        final byte[] b = new byte[1];
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
+     * using a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsOctetString() throws Exception {
+        final byte[] b = new byte[1];
+        getReader(b, 0).readOctetString();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
+     * argument with a short array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortArrayAsSequence() throws Exception {
+        final byte[] b = new byte[1];
+        getReader(b, 0).readStartSequence();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with an array that doesn't contain a full length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsBoolean() throws Exception
-  {
-    final byte[] b = { 0x01, (byte) 0x82, 0x00 };
-    getReader(b, 0).readBoolean();
-  }
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with an array that has an invalid number of bytes in the value.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeShortValueArrayAsBoolean() throws Exception {
+        final byte[] b = { 0x01, 0x00, 0x00, 0x00 };
+        getReader(b, 0).readBoolean();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with an array that doesn't contain a full length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsBoolean() throws Exception {
+        final byte[] b = { 0x01, (byte) 0x82, 0x00 };
+        getReader(b, 0).readBoolean();
+    }
 
+    /**
+     * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with
+     * a truncated length array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsEnumerated() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x82, 0x00 };
+        getReader(b, 0).readEnumerated();
+    }
 
-  /**
-   * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with a
-   * truncated length array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsEnumerated() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x82, 0x00 };
-    getReader(b, 0).readEnumerated();
-  }
+    /**
+     * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array
+     * with a truncated length array.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsInteger() throws Exception {
+        final byte[] b = { 0x02, (byte) 0x82, 0x00 };
+        getReader(b, 0).readInteger();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with an array with a truncated length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsNull() throws Exception {
+        final byte[] b = new byte[] { 0x05, (byte) 0x82, 0x00 };
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
+     * using an array that doesn't fully contain the length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsOctetString() throws Exception {
+        final byte[] b = { 0x04, (byte) 0x82, 0x00 };
+        getReader(b, 0).readOctetString();
+    }
 
-  /**
-   * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with
-   * a truncated length array.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsInteger() throws Exception
-  {
-    final byte[] b = { 0x02, (byte) 0x82, 0x00 };
-    getReader(b, 0).readInteger();
-  }
+    /**
+     * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
+     * argument with an array that doesn't fully describe the length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testDecodeTruncatedLengthArrayAsSequence() throws Exception {
+        final byte[] b = { 0x30, (byte) 0x82, 0x00 };
+        getReader(b, 0).readStartSequence();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with valid arrays.
+     *
+     * @param b
+     *            The byte array to use for the element values.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "byteValues")
+    public void testDecodeValidArrayAsBoolean(final byte[] b) throws Exception {
+        // First, test with the standard Boolean type.
+        final byte[] elementArray = new byte[] { 0x01, 0x01, b[0] };
+        assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
 
+        // Next, test with a nonstandard Boolean type.
+        elementArray[0] = (byte) 0x50;
+        assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
+    }
 
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with an array with a truncated length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[] { 0x05, (byte) 0x82, 0x00 };
-    getReader(b, 0).readNull();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
-   * using an array that doesn't fully contain the length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsOctetString() throws Exception
-  {
-    final byte[] b = { 0x04, (byte) 0x82, 0x00 };
-    getReader(b, 0).readOctetString();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
-   * argument with an array that doesn't fully describe the length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testDecodeTruncatedLengthArrayAsSequence() throws Exception
-  {
-    final byte[] b = { 0x30, (byte) 0x82, 0x00 };
-    getReader(b, 0).readStartSequence();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with valid arrays.
-   *
-   * @param b
-   *          The byte array to use for the element values.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "byteValues")
-  public void testDecodeValidArrayAsBoolean(final byte[] b) throws Exception
-  {
-    // First, test with the standard Boolean type.
-    final byte[] elementArray = new byte[] { 0x01, 0x01, b[0] };
-    assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
-
-    // Next, test with a nonstandard Boolean type.
-    elementArray[0] = (byte) 0x50;
-    assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
-   * using a valid array.
-   *
-   * @param b
-   *          The byte array to decode.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "elementArrays")
-  public void testDecodeValidArrayAsOctetString(final byte[] b)
-      throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    bsb.appendBERLength(b.length);
-    bsb.append(b);
-
-    assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(), ByteString
-        .wrap(b));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a byte
-   * array using a valid array.
-   *
-   * @param b
-   *          The byte array to decode.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "elementArrays")
-  public void testDecodeValidArrayAsOctetStringAsString(final byte[] b)
-      throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    bsb.appendBERLength(b.length);
-    bsb.append(b);
-
-    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
-        new String(b, "UTF-8"));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a byte
-   * array using a valid array.
-   *
-   * @param b
-   *          The byte array to decode.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "elementArrays")
-  public void testDecodeValidArrayAsOctetStringAsStringCharSet(final byte[] b)
-      throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    bsb.appendBERLength(b.length);
-    bsb.append(b);
-
-    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
-        new String(b, "UTF-8"));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsOctetStringBuilder</CODE> method that takes a byte
-   * array using a valid array.
-   *
-   * @param b
-   *          The byte array to decode.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "elementArrays")
-  public void testDecodeValidArrayAsOctetStringBuilder(final byte[] b)
-      throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    bsb.appendBERLength(b.length);
-    bsb.append(b);
-
-    final ByteStringBuilder bsb2 = new ByteStringBuilder();
-    getReader(bsb.toByteArray(), 0).readOctetString(bsb2);
-    assertEquals(bsb2.toByteString(), ByteString.wrap(b));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
-   * argument with valid arrays.
-   *
-   * @param encodedElements
-   *          Byte arrays that may be used as valid values for encoded elements.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "elementArrays")
-  public void testDecodeValidArrayAsSequence(final byte[] encodedElements)
-      throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(ASN1Constants.UNIVERSAL_SEQUENCE_TYPE);
-    bsb.appendBERLength(encodedElements.length + 2);
-    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    bsb.appendBERLength(encodedElements.length);
-    bsb.append(encodedElements);
-
-    final ASN1Reader reader = getReader(bsb.toByteArray(), 0);
-    assertEquals(reader.peekLength(), encodedElements.length + 2);
-    reader.readStartSequence();
-    assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
-    assertEquals(reader.peekLength(), encodedElements.length);
-    reader.readOctetString().equals(ByteString.wrap(encodedElements));
-    reader.readEndSequence();
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
-   * argument with valid arrays using extended lengths.
-   *
-   * @param b
-   *          The byte array to use for the element values.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "byteValues")
-  public void testDecodeValidExtendedArrayAsBoolean(final byte[] b)
-      throws Exception
-  {
-    // First, test with the standard Boolean type.
-    final byte[] elementArray = new byte[] { 0x01, (byte) 0x81, 0x01, b[0] };
-    assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
-
-    // Next, test with a nonstandard Boolean type.
-    elementArray[0] = (byte) 0x50;
-    assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
-  }
-
-
-
-  /**
-   * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument
-   * with an arry with a zero length.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test()
-  public void testDecodeZeroLengthArrayAsNull() throws Exception
-  {
-    final byte[] b = new byte[] { 0x05, 0x00 };
-    getReader(b, 0).readNull();
-  }
+    /**
+     * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array
+     * using a valid array.
+     *
+     * @param b
+     *            The byte array to decode.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "elementArrays")
+    public void testDecodeValidArrayAsOctetString(final byte[] b) throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        bsb.appendBERLength(b.length);
+        bsb.append(b);
 
+        assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(), ByteString.wrap(b));
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a
+     * byte array using a valid array.
+     *
+     * @param b
+     *            The byte array to decode.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "elementArrays")
+    public void testDecodeValidArrayAsOctetStringAsString(final byte[] b) throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        bsb.appendBERLength(b.length);
+        bsb.append(b);
 
-  /**
-   * Tests the <CODE>elementAvailable</CODE> method.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testElementAvailable() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02 };
-    ASN1Reader reader = getReader(b, 0);
-    assertFalse(reader.elementAvailable());
+        assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(), new String(b,
+                "UTF-8"));
+    }
 
-    b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 };
-    reader = getReader(b, 0);
-    assertTrue(reader.elementAvailable());
-    reader.readStartSequence();
-    assertTrue(reader.elementAvailable());
-    reader.readInteger();
-    assertFalse(reader.elementAvailable());
-  }
+    /**
+     * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a
+     * byte array using a valid array.
+     *
+     * @param b
+     *            The byte array to decode.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "elementArrays")
+    public void testDecodeValidArrayAsOctetStringAsStringCharSet(final byte[] b) throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        bsb.appendBERLength(b.length);
+        bsb.append(b);
 
+        assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(), new String(b,
+                "UTF-8"));
+    }
 
+    /**
+     * Tests the <CODE>decodeAsOctetStringBuilder</CODE> method that takes a
+     * byte array using a valid array.
+     *
+     * @param b
+     *            The byte array to decode.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "elementArrays")
+    public void testDecodeValidArrayAsOctetStringBuilder(final byte[] b) throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        bsb.appendBERLength(b.length);
+        bsb.append(b);
 
-  /**
-   * Tests the <CODE>hasNextElement</CODE> method.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testHasNextElement() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02, 0x00, 0x03 };
-    ASN1Reader reader = getReader(b, 0);
-    assertTrue(reader.hasNextElement());
-    reader.readStartSequence();
-    assertTrue(reader.hasNextElement());
-    reader.readInteger();
-    assertTrue(reader.hasNextElement());
+        final ByteStringBuilder bsb2 = new ByteStringBuilder();
+        getReader(bsb.toByteArray(), 0).readOctetString(bsb2);
+        assertEquals(bsb2.toByteString(), ByteString.wrap(b));
+    }
 
-    b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 };
-    reader = getReader(b, 0);
-    assertTrue(reader.hasNextElement());
-    reader.readStartSequence();
-    assertTrue(reader.hasNextElement());
-    reader.readInteger();
-    assertFalse(reader.hasNextElement());
-  }
+    /**
+     * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array
+     * argument with valid arrays.
+     *
+     * @param encodedElements
+     *            Byte arrays that may be used as valid values for encoded
+     *            elements.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "elementArrays")
+    public void testDecodeValidArrayAsSequence(final byte[] encodedElements) throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(ASN1Constants.UNIVERSAL_SEQUENCE_TYPE);
+        bsb.appendBERLength(encodedElements.length + 2);
+        bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        bsb.appendBERLength(encodedElements.length);
+        bsb.append(encodedElements);
 
+        final ASN1Reader reader = getReader(bsb.toByteArray(), 0);
+        assertEquals(reader.peekLength(), encodedElements.length + 2);
+        reader.readStartSequence();
+        assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
+        assertEquals(reader.peekLength(), encodedElements.length);
+        reader.readOctetString().equals(ByteString.wrap(encodedElements));
+        reader.readEndSequence();
+    }
 
+    /**
+     * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array
+     * argument with valid arrays using extended lengths.
+     *
+     * @param b
+     *            The byte array to use for the element values.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(dataProvider = "byteValues")
+    public void testDecodeValidExtendedArrayAsBoolean(final byte[] b) throws Exception {
+        // First, test with the standard Boolean type.
+        final byte[] elementArray = new byte[] { 0x01, (byte) 0x81, 0x01, b[0] };
+        assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
 
-  /**
-   * Tests the <CODE>readEndSequence</CODE> method without first calling
-   * readStartSequence.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { IllegalStateException.class, IOException.class })
-  public void testReadEndSequenceNoStartSequence() throws Exception
-  {
-    final byte[] b = { 0x30, 0x01, 0x00 };
-    getReader(b, 0).readEndSequence();
-  }
+        // Next, test with a nonstandard Boolean type.
+        elementArray[0] = (byte) 0x50;
+        assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00));
+    }
 
+    /**
+     * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array
+     * argument with an arry with a zero length.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test()
+    public void testDecodeZeroLengthArrayAsNull() throws Exception {
+        final byte[] b = new byte[] { 0x05, 0x00 };
+        getReader(b, 0).readNull();
+    }
 
+    /**
+     * Tests the <CODE>elementAvailable</CODE> method.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testElementAvailable() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02 };
+        ASN1Reader reader = getReader(b, 0);
+        assertFalse(reader.elementAvailable());
 
-  /**
-   * Tests the <CODE>skipElement</CODE> method.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testSkipElement() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    final byte[] b = new byte[] { 0x30, 0x09, 0x02, 0x01, 0x00, 0x02, 0x01,
-        0x01, 0x02, 0x01, 0x02 };
-    final ASN1Reader reader = getReader(b, 0);
-    reader.readStartSequence();
-    reader.readInteger();
-    reader.skipElement();
-    assertEquals(reader.readInteger(), 2);
-    reader.readEndSequence();
-  }
+        b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 };
+        reader = getReader(b, 0);
+        assertTrue(reader.elementAvailable());
+        reader.readStartSequence();
+        assertTrue(reader.elementAvailable());
+        reader.readInteger();
+        assertFalse(reader.elementAvailable());
+    }
 
+    /**
+     * Tests the <CODE>hasNextElement</CODE> method.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testHasNextElement() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02, 0x00, 0x03 };
+        ASN1Reader reader = getReader(b, 0);
+        assertTrue(reader.hasNextElement());
+        reader.readStartSequence();
+        assertTrue(reader.hasNextElement());
+        reader.readInteger();
+        assertTrue(reader.hasNextElement());
 
+        b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 };
+        reader = getReader(b, 0);
+        assertTrue(reader.hasNextElement());
+        reader.readStartSequence();
+        assertTrue(reader.hasNextElement());
+        reader.readInteger();
+        assertFalse(reader.hasNextElement());
+    }
 
-  /**
-   * Tests the <CODE>skipElement</CODE> method.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test(expectedExceptions = { DecodeException.class, IOException.class })
-  public void testSkipElementIncompleteRead() throws Exception
-  {
-    // An ASN.1 sequence of booleans missing one boolean element at the end
-    final byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x02 };
-    final ASN1Reader reader = getReader(b, 0);
-    reader.readStartSequence();
-    reader.readBoolean();
-    reader.skipElement();
-    reader.readEndSequence();
-  }
+    /**
+     * Tests the <CODE>readEndSequence</CODE> method without first calling
+     * readStartSequence.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { IllegalStateException.class, IOException.class })
+    public void testReadEndSequenceNoStartSequence() throws Exception {
+        final byte[] b = { 0x30, 0x01, 0x00 };
+        getReader(b, 0).readEndSequence();
+    }
 
+    /**
+     * Tests the <CODE>skipElement</CODE> method.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testSkipElement() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        final byte[] b =
+                new byte[] { 0x30, 0x09, 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02 };
+        final ASN1Reader reader = getReader(b, 0);
+        reader.readStartSequence();
+        reader.readInteger();
+        reader.skipElement();
+        assertEquals(reader.readInteger(), 2);
+        reader.readEndSequence();
+    }
 
+    /**
+     * Tests the <CODE>skipElement</CODE> method.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test(expectedExceptions = { DecodeException.class, IOException.class })
+    public void testSkipElementIncompleteRead() throws Exception {
+        // An ASN.1 sequence of booleans missing one boolean element at the end
+        final byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x02 };
+        final ASN1Reader reader = getReader(b, 0);
+        reader.readStartSequence();
+        reader.readBoolean();
+        reader.skipElement();
+        reader.readEndSequence();
+    }
 
-  /**
-   * Gets the reader to be use for the unit tests.
-   *
-   * @param b
-   *          The array of bytes to be read.
-   * @param maxElementSize
-   *          The max element size.
-   * @return The reader to be use for the unit tests.
-   * @throws IOException
-   *           In an unexpected IO exception occurred.
-   */
-  protected abstract ASN1Reader getReader(byte[] b, int maxElementSize)
-      throws IOException;
+    /**
+     * Gets the reader to be use for the unit tests.
+     *
+     * @param b
+     *            The array of bytes to be read.
+     * @param maxElementSize
+     *            The max element size.
+     * @return The reader to be use for the unit tests.
+     * @throws IOException
+     *             In an unexpected IO exception occurred.
+     */
+    protected abstract ASN1Reader getReader(byte[] b, int maxElementSize) throws IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1WriterTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1WriterTestCase.java
index 30310da..07cddf9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1WriterTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/asn1/ASN1WriterTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
  */
 package org.forgerock.opendj.asn1;
 
-
-
 import static org.forgerock.opendj.asn1.ASN1Constants.*;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
@@ -36,8 +33,6 @@
 
 import java.io.IOException;
 
-import org.forgerock.opendj.asn1.ASN1Reader;
-import org.forgerock.opendj.asn1.ASN1Writer;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.DecodeException;
@@ -47,700 +42,584 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * An abstract base class for all ASN1Writer test cases.
  */
 @Test(groups = { "precommit", "asn1", "sdk" })
 @SuppressWarnings("javadoc")
-public abstract class ASN1WriterTestCase extends ForgeRockTestCase
-{
+public abstract class ASN1WriterTestCase extends ForgeRockTestCase {
 
-  // Create an array with all of the valid single-byte types. We don't
-  // support multi-byte types, so this should be a comprehensive data set.
-  private final byte[] testTypes = new byte[0xFF];
-  {
-    for (int i = 0x00; i < 0xFF; i++)
+    // Create an array with all of the valid single-byte types. We don't
+    // support multi-byte types, so this should be a comprehensive data set.
+    private final byte[] testTypes = new byte[0xFF];
     {
-      testTypes[i] = (byte) (i & 0xFF);
+        for (int i = 0x00; i < 0xFF; i++) {
+            testTypes[i] = (byte) (i & 0xFF);
+        }
     }
-  }
 
-
-
-  /**
-   * Create byte arrays to use for element values.
-   *
-   * @return A list of byte arrays that can be used as element values.
-   */
-  @DataProvider(name = "binaryValues")
-  public Object[][] getBinaryValues()
-  {
-    // NOTE -- Don't make these arrays too big since they consume memory.
-    return new Object[][] { new Object[] { new byte[0x00] }, // The zero-byte
-        // value
-        new Object[] { new byte[0x01] }, // The single-byte value
-        new Object[] { new byte[0x7F] }, // The largest 1-byte length encoding
-        new Object[] { new byte[0x80] }, // The smallest 2-byte length encoding
-        new Object[] { new byte[0xFF] }, // The largest 2-byte length encoding
-        new Object[] { new byte[0x0100] }, // The smallest 3-byte length
+    /**
+     * Create byte arrays to use for element values.
+     *
+     * @return A list of byte arrays that can be used as element values.
+     */
+    @DataProvider(name = "binaryValues")
+    public Object[][] getBinaryValues() {
+        // NOTE -- Don't make these arrays too big since they consume memory.
+        return new Object[][] { new Object[] { new byte[0x00] }, // The
+                                                                 // zero-byte
+            // value
+            new Object[] { new byte[0x01] }, // The single-byte value
+            new Object[] { new byte[0x7F] }, // The largest 1-byte length
+                                             // encoding
+            new Object[] { new byte[0x80] }, // The smallest 2-byte length
+                                             // encoding
+            new Object[] { new byte[0xFF] }, // The largest 2-byte length
+                                             // encoding
+            new Object[] { new byte[0x0100] }, // The smallest 3-byte length
+            // encoding
+            new Object[] { new byte[0xFFFF] }, // The largest 3-byte length
+                                               // encoding
+            new Object[] { new byte[0x010000] } // The smallest 4-byte length
         // encoding
-        new Object[] { new byte[0xFFFF] }, // The largest 3-byte length encoding
-        new Object[] { new byte[0x010000] } // The smallest 4-byte length
-    // encoding
-    };
-  }
-
-
-
-  /**
-   * Retrieves the set of boolean values that may be used for testing.
-   *
-   * @return The set of boolean values that may be used for testing.
-   */
-  @DataProvider(name = "booleanValues")
-  public Object[][] getBooleanValues()
-  {
-    return new Object[][] { new Object[] { false }, new Object[] { true } };
-  }
-
-
-
-  /**
-   * Retrieves the set of int values that should be used for testing.
-   *
-   * @return The set of int values that should be used for testing.
-   */
-  @DataProvider(name = "intValues")
-  public Object[][] getIntValues()
-  {
-    return new Object[][] { new Object[] { 0x00000000, 1 },
-        new Object[] { 0x00000001, 1 }, new Object[] { 0x0000000F, 1 },
-        new Object[] { 0x00000010, 1 }, new Object[] { 0x0000007F, 1 },
-        new Object[] { 0x00000080, 2 }, new Object[] { 0x000000FF, 2 },
-        new Object[] { 0x00000100, 2 }, new Object[] { 0x00000FFF, 2 },
-        new Object[] { 0x00001000, 2 }, new Object[] { 0x0000FFFF, 3 },
-        new Object[] { 0x00010000, 3 }, new Object[] { 0x000FFFFF, 3 },
-        new Object[] { 0x00100000, 3 }, new Object[] { 0x00FFFFFF, 4 },
-        new Object[] { 0x01000000, 4 }, new Object[] { 0x0FFFFFFF, 4 },
-        new Object[] { 0x10000000, 4 }, new Object[] { 0x7FFFFFFF, 4 },
-        new Object[] { -0x00000001, 1 }, new Object[] { -0x0000000F, 1 },
-        new Object[] { -0x00000010, 1 }, new Object[] { -0x0000007F, 1 },
-        new Object[] { -0x00000080, 1 }, new Object[] { -0x000000FF, 2 },
-        new Object[] { -0x00000100, 2 }, new Object[] { -0x00000FFF, 2 },
-        new Object[] { -0x00001000, 2 }, new Object[] { -0x0000FFFF, 3 },
-        new Object[] { -0x00010000, 3 }, new Object[] { -0x000FFFFF, 3 },
-        new Object[] { -0x00100000, 3 }, new Object[] { -0x00FFFFFF, 4 },
-        new Object[] { -0x01000000, 4 }, new Object[] { -0x0FFFFFFF, 4 },
-        new Object[] { -0x10000000, 4 }, new Object[] { -0x7FFFFFFF, 4 },
-        new Object[] { 0x80000000, 4 } };
-  }
-
-
-
-  /**
-   * Retrieves the set of long values that should be used for testing.
-   *
-   * @return The set of long values that should be used for testing.
-   */
-  @DataProvider(name = "longValues")
-  public Object[][] getLongValues()
-  {
-    return new Object[][] { new Object[] { 0x0000000000000000L, 1 },
-        new Object[] { 0x0000000000000001L, 1 },
-        new Object[] { 0x000000000000007FL, 1 },
-        new Object[] { 0x0000000000000080L, 2 },
-        new Object[] { 0x00000000000000FFL, 2 },
-        new Object[] { 0x0000000000000100L, 2 },
-        new Object[] { 0x000000000000FFFFL, 3 },
-        new Object[] { 0x0000000000010000L, 3 },
-        new Object[] { 0x0000000000FFFFFFL, 4 },
-        new Object[] { 0x0000000001000000L, 4 },
-        new Object[] { 0x00000000FFFFFFFFL, 5 },
-        new Object[] { 0x0000000100000000L, 5 },
-        new Object[] { 0x000000FFFFFFFFFFL, 6 },
-        new Object[] { 0x0000010000000000L, 6 },
-        new Object[] { 0x0000FFFFFFFFFFFFL, 7 },
-        new Object[] { 0x0001000000000000L, 7 },
-        new Object[] { 0x00FFFFFFFFFFFFFFL, 8 },
-        new Object[] { 0x0100000000000000L, 8 },
-        new Object[] { 0x7FFFFFFFFFFFFFFFL, 8 },
-        new Object[] { -0x0000000000000001L, 1 },
-        new Object[] { -0x000000000000007FL, 1 },
-        new Object[] { -0x0000000000000080L, 1 },
-        new Object[] { -0x00000000000000FFL, 2 },
-        new Object[] { -0x0000000000000100L, 2 },
-        new Object[] { -0x000000000000FFFFL, 3 },
-        new Object[] { -0x0000000000010000L, 3 },
-        new Object[] { -0x0000000000FFFFFFL, 4 },
-        new Object[] { -0x0000000001000000L, 4 },
-        new Object[] { -0x00000000FFFFFFFFL, 5 },
-        new Object[] { -0x0000000100000000L, 5 },
-        new Object[] { -0x000000FFFFFFFFFFL, 6 },
-        new Object[] { -0x0000010000000000L, 6 },
-        new Object[] { -0x0000FFFFFFFFFFFFL, 7 },
-        new Object[] { -0x0001000000000000L, 7 },
-        new Object[] { -0x00FFFFFFFFFFFFFFL, 8 },
-        new Object[] { -0x0100000000000000L, 8 },
-        new Object[] { -0x7FFFFFFFFFFFFFFFL, 8 },
-        new Object[] { 0x8000000000000000L, 8 } };
-  }
-
-
-
-  /**
-   * Create strings to use for element values.
-   *
-   * @return A list of strings that can be used as element values.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @DataProvider(name = "stringValues")
-  public Object[][] getStringValues() throws Exception
-  {
-    return new Object[][] { new Object[] { null }, new Object[] { "" },
-        new Object[] { "\u0000" }, new Object[] { "\t" },
-        new Object[] { "\n" }, new Object[] { "\r\n" }, new Object[] { " " },
-        new Object[] { "a" }, new Object[] { "Test1\tTest2\tTest3" },
-        new Object[] { "Test1\nTest2\nTest3" },
-        new Object[] { "Test1\r\nTest2\r\nTest3" },
-        new Object[] { "The Quick Brown Fox Jumps Over The Lazy Dog" },
-        new Object[] { "\u00BFD\u00F3nde est\u00E1 el ba\u00F1o?" } };
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readBoolean</CODE> methods.
-   *
-   * @param b
-   *          The boolean value to use in the test.
-   */
-  @Test(dataProvider = "booleanValues")
-  public void testEncodeDecodeBoolean(final boolean b) throws Exception
-  {
-    getWriter().writeBoolean(b);
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), 1);
-    assertEquals(r.peekType(), UNIVERSAL_BOOLEAN_TYPE);
-    assertEquals(r.readBoolean(), b);
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readBoolean</CODE> methods.
-   *
-   * @param b
-   *          The boolean value to use in the test.
-   */
-  @Test(dataProvider = "booleanValues")
-  public void testEncodeDecodeBooleanType(final boolean b) throws Exception
-  {
-    for (final byte type : testTypes)
-    {
-      getWriter().writeBoolean(type, b);
-
-      final ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), 1);
-      assertEquals(r.peekType(), type);
-      assertEquals(r.readBoolean(), b);
+        };
     }
-  }
 
-
-
-  /**
-   * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
-   *
-   * @param i
-   *          The integer value to use for the test.
-   */
-  @Test(dataProvider = "intValues")
-  public void testEncodeDecodeEnuerated(final int i, final int length)
-      throws Exception
-  {
-    getWriter().writeEnumerated(i);
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), length);
-    assertEquals(r.peekType(), UNIVERSAL_ENUMERATED_TYPE);
-    assertEquals(r.readInteger(), i);
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
-   *
-   * @param i
-   *          The integer value to use for the test.
-   */
-  @Test(dataProvider = "intValues")
-  public void testEncodeDecodeInteger(final int i, final int length)
-      throws Exception
-  {
-    getWriter().writeInteger(i);
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), length);
-    assertEquals(r.peekType(), UNIVERSAL_INTEGER_TYPE);
-    assertEquals(r.readInteger(), i);
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readInteger</CODE> methods with Java longs.
-   *
-   * @param l
-   *          The long value to use for the test.
-   */
-  @Test(dataProvider = "longValues")
-  public void testEncodeDecodeInteger(final long l, final int length)
-      throws Exception
-  {
-    getWriter().writeInteger(l);
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), length);
-    assertEquals(r.peekType(), UNIVERSAL_INTEGER_TYPE);
-    assertEquals(r.readInteger(), l);
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
-   *
-   * @param i
-   *          The integer value to use for the test.
-   */
-  @Test(dataProvider = "intValues")
-  public void testEncodeDecodeIntegerType(final int i, final int length)
-      throws Exception
-  {
-    for (final byte type : testTypes)
-    {
-      getWriter().writeInteger(type, i);
-
-      final ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), length);
-      assertEquals(r.peekType(), type);
-      assertEquals(r.readInteger(), i);
+    /**
+     * Retrieves the set of boolean values that may be used for testing.
+     *
+     * @return The set of boolean values that may be used for testing.
+     */
+    @DataProvider(name = "booleanValues")
+    public Object[][] getBooleanValues() {
+        return new Object[][] { new Object[] { false }, new Object[] { true } };
     }
-  }
 
-
-
-  /**
-   * Tests the <CODE>write/readInteger</CODE> methods wiht JavaLongs.
-   *
-   * @param l
-   *          The long value to use for the test.
-   */
-  @Test(dataProvider = "longValues")
-  public void testEncodeDecodeIntegerType(final long l, final int length)
-      throws Exception
-  {
-    for (final byte type : testTypes)
-    {
-      getWriter().writeInteger(type, l);
-
-      final ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), length);
-      assertEquals(r.peekType(), type);
-      assertEquals(r.readInteger(), l);
+    /**
+     * Retrieves the set of int values that should be used for testing.
+     *
+     * @return The set of int values that should be used for testing.
+     */
+    @DataProvider(name = "intValues")
+    public Object[][] getIntValues() {
+        return new Object[][] { new Object[] { 0x00000000, 1 }, new Object[] { 0x00000001, 1 },
+            new Object[] { 0x0000000F, 1 }, new Object[] { 0x00000010, 1 },
+            new Object[] { 0x0000007F, 1 }, new Object[] { 0x00000080, 2 },
+            new Object[] { 0x000000FF, 2 }, new Object[] { 0x00000100, 2 },
+            new Object[] { 0x00000FFF, 2 }, new Object[] { 0x00001000, 2 },
+            new Object[] { 0x0000FFFF, 3 }, new Object[] { 0x00010000, 3 },
+            new Object[] { 0x000FFFFF, 3 }, new Object[] { 0x00100000, 3 },
+            new Object[] { 0x00FFFFFF, 4 }, new Object[] { 0x01000000, 4 },
+            new Object[] { 0x0FFFFFFF, 4 }, new Object[] { 0x10000000, 4 },
+            new Object[] { 0x7FFFFFFF, 4 }, new Object[] { -0x00000001, 1 },
+            new Object[] { -0x0000000F, 1 }, new Object[] { -0x00000010, 1 },
+            new Object[] { -0x0000007F, 1 }, new Object[] { -0x00000080, 1 },
+            new Object[] { -0x000000FF, 2 }, new Object[] { -0x00000100, 2 },
+            new Object[] { -0x00000FFF, 2 }, new Object[] { -0x00001000, 2 },
+            new Object[] { -0x0000FFFF, 3 }, new Object[] { -0x00010000, 3 },
+            new Object[] { -0x000FFFFF, 3 }, new Object[] { -0x00100000, 3 },
+            new Object[] { -0x00FFFFFF, 4 }, new Object[] { -0x01000000, 4 },
+            new Object[] { -0x0FFFFFFF, 4 }, new Object[] { -0x10000000, 4 },
+            new Object[] { -0x7FFFFFFF, 4 }, new Object[] { 0x80000000, 4 } };
     }
-  }
 
-
-
-  /**
-   * Tests the <CODE>write/readNull</CODE> methods.
-   */
-  @Test
-  public void testEncodeDecodeNull() throws Exception
-  {
-    getWriter().writeNull();
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), 0);
-    assertEquals(r.peekType(), UNIVERSAL_NULL_TYPE);
-    r.readNull();
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readNull</CODE> methods.
-   */
-  @Test
-  public void testEncodeDecodeNullType() throws Exception
-  {
-    for (final byte type : testTypes)
-    {
-      getWriter().writeNull(type);
-
-      final ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), 0);
-      assertEquals(r.peekType(), type);
-      r.readNull();
+    /**
+     * Retrieves the set of long values that should be used for testing.
+     *
+     * @return The set of long values that should be used for testing.
+     */
+    @DataProvider(name = "longValues")
+    public Object[][] getLongValues() {
+        return new Object[][] { new Object[] { 0x0000000000000000L, 1 },
+            new Object[] { 0x0000000000000001L, 1 }, new Object[] { 0x000000000000007FL, 1 },
+            new Object[] { 0x0000000000000080L, 2 }, new Object[] { 0x00000000000000FFL, 2 },
+            new Object[] { 0x0000000000000100L, 2 }, new Object[] { 0x000000000000FFFFL, 3 },
+            new Object[] { 0x0000000000010000L, 3 }, new Object[] { 0x0000000000FFFFFFL, 4 },
+            new Object[] { 0x0000000001000000L, 4 }, new Object[] { 0x00000000FFFFFFFFL, 5 },
+            new Object[] { 0x0000000100000000L, 5 }, new Object[] { 0x000000FFFFFFFFFFL, 6 },
+            new Object[] { 0x0000010000000000L, 6 }, new Object[] { 0x0000FFFFFFFFFFFFL, 7 },
+            new Object[] { 0x0001000000000000L, 7 }, new Object[] { 0x00FFFFFFFFFFFFFFL, 8 },
+            new Object[] { 0x0100000000000000L, 8 }, new Object[] { 0x7FFFFFFFFFFFFFFFL, 8 },
+            new Object[] { -0x0000000000000001L, 1 }, new Object[] { -0x000000000000007FL, 1 },
+            new Object[] { -0x0000000000000080L, 1 }, new Object[] { -0x00000000000000FFL, 2 },
+            new Object[] { -0x0000000000000100L, 2 }, new Object[] { -0x000000000000FFFFL, 3 },
+            new Object[] { -0x0000000000010000L, 3 }, new Object[] { -0x0000000000FFFFFFL, 4 },
+            new Object[] { -0x0000000001000000L, 4 }, new Object[] { -0x00000000FFFFFFFFL, 5 },
+            new Object[] { -0x0000000100000000L, 5 }, new Object[] { -0x000000FFFFFFFFFFL, 6 },
+            new Object[] { -0x0000010000000000L, 6 }, new Object[] { -0x0000FFFFFFFFFFFFL, 7 },
+            new Object[] { -0x0001000000000000L, 7 }, new Object[] { -0x00FFFFFFFFFFFFFFL, 8 },
+            new Object[] { -0x0100000000000000L, 8 }, new Object[] { -0x7FFFFFFFFFFFFFFFL, 8 },
+            new Object[] { 0x8000000000000000L, 8 } };
     }
-  }
 
-
-
-  /**
-   * Tests the <CODE>write/readOctetString</CODE> methods.
-   */
-  @Test(dataProvider = "binaryValues")
-  public void testEncodeDecodeOctetString(final byte[] b) throws Exception
-  {
-    final ByteString bs = ByteString.wrap(b);
-
-    getWriter().writeOctetString(bs);
-
-    ASN1Reader r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), b.length);
-    assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
-    assertTrue(bs.equals(r.readOctetString()));
-
-    getWriter().writeOctetString(b, 0, b.length);
-
-    r = getReader(getEncodedBytes());
-    assertEquals(r.peekLength(), b.length);
-    assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
-    assertTrue(bs.equals(r.readOctetString()));
-  }
-
-
-
-  /**
-   * Tests the <CODE>write/readOctetString</CODE> methods.
-   */
-  @Test(dataProvider = "stringValues")
-  public void testEncodeDecodeOctetString(final String s) throws Exception
-  {
-    getWriter().writeOctetString(s);
-
-    final ASN1Reader r = getReader(getEncodedBytes());
-    if (s == null)
-    {
-      assertEquals(r.peekLength(), 0);
+    /**
+     * Create strings to use for element values.
+     *
+     * @return A list of strings that can be used as element values.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @DataProvider(name = "stringValues")
+    public Object[][] getStringValues() throws Exception {
+        return new Object[][] { new Object[] { null }, new Object[] { "" },
+            new Object[] { "\u0000" }, new Object[] { "\t" }, new Object[] { "\n" },
+            new Object[] { "\r\n" }, new Object[] { " " }, new Object[] { "a" },
+            new Object[] { "Test1\tTest2\tTest3" }, new Object[] { "Test1\nTest2\nTest3" },
+            new Object[] { "Test1\r\nTest2\r\nTest3" },
+            new Object[] { "The Quick Brown Fox Jumps Over The Lazy Dog" },
+            new Object[] { "\u00BFD\u00F3nde est\u00E1 el ba\u00F1o?" } };
     }
-    else
-    {
-      assertEquals(r.peekLength(), StaticUtils.getBytes(s).length);
+
+    /**
+     * Tests the <CODE>write/readBoolean</CODE> methods.
+     *
+     * @param b
+     *            The boolean value to use in the test.
+     */
+    @Test(dataProvider = "booleanValues")
+    public void testEncodeDecodeBoolean(final boolean b) throws Exception {
+        getWriter().writeBoolean(b);
+
+        final ASN1Reader r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), 1);
+        assertEquals(r.peekType(), UNIVERSAL_BOOLEAN_TYPE);
+        assertEquals(r.readBoolean(), b);
     }
-    assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
-    if (s == null)
-    {
-      assertTrue(r.readOctetStringAsString().equals(""));
+
+    /**
+     * Tests the <CODE>write/readBoolean</CODE> methods.
+     *
+     * @param b
+     *            The boolean value to use in the test.
+     */
+    @Test(dataProvider = "booleanValues")
+    public void testEncodeDecodeBooleanType(final boolean b) throws Exception {
+        for (final byte type : testTypes) {
+            getWriter().writeBoolean(type, b);
+
+            final ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), 1);
+            assertEquals(r.peekType(), type);
+            assertEquals(r.readBoolean(), b);
+        }
     }
-    else
-    {
-      assertTrue(s.equals(r.readOctetStringAsString()));
+
+    /**
+     * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
+     *
+     * @param i
+     *            The integer value to use for the test.
+     */
+    @Test(dataProvider = "intValues")
+    public void testEncodeDecodeEnuerated(final int i, final int length) throws Exception {
+        getWriter().writeEnumerated(i);
+
+        final ASN1Reader r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), length);
+        assertEquals(r.peekType(), UNIVERSAL_ENUMERATED_TYPE);
+        assertEquals(r.readInteger(), i);
     }
-  }
 
+    /**
+     * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
+     *
+     * @param i
+     *            The integer value to use for the test.
+     */
+    @Test(dataProvider = "intValues")
+    public void testEncodeDecodeInteger(final int i, final int length) throws Exception {
+        getWriter().writeInteger(i);
 
-
-  /**
-   * Tests the <CODE>write/readOctetString</CODE> methods.
-   */
-  @Test
-  public void testEncodeDecodeOctetStringOffLen() throws Exception
-  {
-    final byte[] b = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
-
-    for (int i = 0; i < 5; i += 2)
-    {
-      final byte[] bsb = new byte[3];
-      System.arraycopy(b, i, bsb, 0, 3);
-      final ByteString bs = ByteString.wrap(bsb);
-      getWriter().writeOctetString(b, i, 3);
-
-      final ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), 3);
-      assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
-      assertTrue(bs.equals(r.readOctetString()));
+        final ASN1Reader r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), length);
+        assertEquals(r.peekType(), UNIVERSAL_INTEGER_TYPE);
+        assertEquals(r.readInteger(), i);
     }
-  }
 
+    /**
+     * Tests the <CODE>write/readInteger</CODE> methods with Java longs.
+     *
+     * @param l
+     *            The long value to use for the test.
+     */
+    @Test(dataProvider = "longValues")
+    public void testEncodeDecodeInteger(final long l, final int length) throws Exception {
+        getWriter().writeInteger(l);
 
-
-  /**
-   * Tests the <CODE>write/readOctetString</CODE> methods.
-   */
-  @Test(dataProvider = "binaryValues")
-  public void testEncodeDecodeOctetStringType(final byte[] b) throws Exception
-  {
-    final ByteString bs = ByteString.wrap(b);
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-
-    for (final byte type : testTypes)
-    {
-      bsb.clear();
-      getWriter().writeOctetString(type, bs);
-
-      ASN1Reader r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), b.length);
-      assertEquals(r.peekType(), type);
-      r.readOctetString(bsb);
-      assertTrue(bs.equals(bsb));
-
-      bsb.clear();
-      getWriter().writeOctetString(type, b, 0, b.length);
-
-      r = getReader(getEncodedBytes());
-      assertEquals(r.peekLength(), b.length);
-      assertEquals(r.peekType(), type);
-      r.readOctetString(bsb);
-      assertTrue(bs.equals(bsb));
+        final ASN1Reader r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), length);
+        assertEquals(r.peekType(), UNIVERSAL_INTEGER_TYPE);
+        assertEquals(r.readInteger(), l);
     }
-  }
 
+    /**
+     * Tests the <CODE>write/readInteger</CODE> methods with Java ints.
+     *
+     * @param i
+     *            The integer value to use for the test.
+     */
+    @Test(dataProvider = "intValues")
+    public void testEncodeDecodeIntegerType(final int i, final int length) throws Exception {
+        for (final byte type : testTypes) {
+            getWriter().writeInteger(type, i);
 
+            final ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), length);
+            assertEquals(r.peekType(), type);
+            assertEquals(r.readInteger(), i);
+        }
+    }
 
-  /**
-   * Tests the <CODE>write/readOctetString</CODE> methods.
-   */
-  @Test(dataProvider = "stringValues")
-  public void testEncodeDecodeOctetStringType(final String s) throws Exception
-  {
-    for (final byte type : testTypes)
-    {
-      getWriter().writeOctetString(type, s);
+    /**
+     * Tests the <CODE>write/readInteger</CODE> methods wiht JavaLongs.
+     *
+     * @param l
+     *            The long value to use for the test.
+     */
+    @Test(dataProvider = "longValues")
+    public void testEncodeDecodeIntegerType(final long l, final int length) throws Exception {
+        for (final byte type : testTypes) {
+            getWriter().writeInteger(type, l);
 
-      final ASN1Reader r = getReader(getEncodedBytes());
-      if (s == null)
-      {
+            final ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), length);
+            assertEquals(r.peekType(), type);
+            assertEquals(r.readInteger(), l);
+        }
+    }
+
+    /**
+     * Tests the <CODE>write/readNull</CODE> methods.
+     */
+    @Test
+    public void testEncodeDecodeNull() throws Exception {
+        getWriter().writeNull();
+
+        final ASN1Reader r = getReader(getEncodedBytes());
         assertEquals(r.peekLength(), 0);
-      }
-      else
-      {
-        assertEquals(r.peekLength(), StaticUtils.getBytes(s).length);
-      }
-      assertEquals(r.peekType(), type);
-      if (s == null)
-      {
-        assertTrue(r.readOctetStringAsString().equals(""));
-      }
-      else
-      {
-        assertTrue(s.equals(r.readOctetStringAsString()));
-      }
+        assertEquals(r.peekType(), UNIVERSAL_NULL_TYPE);
+        r.readNull();
     }
-  }
 
+    /**
+     * Tests the <CODE>write/readNull</CODE> methods.
+     */
+    @Test
+    public void testEncodeDecodeNullType() throws Exception {
+        for (final byte type : testTypes) {
+            getWriter().writeNull(type);
 
+            final ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), 0);
+            assertEquals(r.peekType(), type);
+            r.readNull();
+        }
+    }
 
-  @Test
-  public void testEncodeDecodeSequence() throws Exception
-  {
-    final ASN1Writer writer = getWriter();
+    /**
+     * Tests the <CODE>write/readOctetString</CODE> methods.
+     */
+    @Test(dataProvider = "binaryValues")
+    public void testEncodeDecodeOctetString(final byte[] b) throws Exception {
+        final ByteString bs = ByteString.wrap(b);
 
-    writer.writeStartSequence();
+        getWriter().writeOctetString(bs);
 
-    writer.writeBoolean(true);
-    writer.writeBoolean(false);
-    writer.writeInteger(0);
-    writer.writeInteger(10L);
-    writer.writeNull();
-    writer.writeOctetString("test value");
-    writer.writeOctetString("skip value");
+        ASN1Reader r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), b.length);
+        assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
+        assertTrue(bs.equals(r.readOctetString()));
 
-    writer.writeStartSequence();
-    writer.writeOctetString("nested sequence");
-    writer.writeEndSequence();
+        getWriter().writeOctetString(b, 0, b.length);
 
-    writer.writeStartSet();
-    writer.writeOctetString("nested set");
-    writer.writeEndSet();
+        r = getReader(getEncodedBytes());
+        assertEquals(r.peekLength(), b.length);
+        assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
+        assertTrue(bs.equals(r.readOctetString()));
+    }
 
-    writer.writeEndSequence();
+    /**
+     * Tests the <CODE>write/readOctetString</CODE> methods.
+     */
+    @Test(dataProvider = "stringValues")
+    public void testEncodeDecodeOctetString(final String s) throws Exception {
+        getWriter().writeOctetString(s);
 
-    final ASN1Reader reader = getReader(getEncodedBytes());
-    assertEquals(reader.peekType(), UNIVERSAL_SEQUENCE_TYPE);
-    assertEquals(reader.peekLength(), 71);
+        final ASN1Reader r = getReader(getEncodedBytes());
+        if (s == null) {
+            assertEquals(r.peekLength(), 0);
+        } else {
+            assertEquals(r.peekLength(), StaticUtils.getBytes(s).length);
+        }
+        assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
+        if (s == null) {
+            assertTrue(r.readOctetStringAsString().equals(""));
+        } else {
+            assertTrue(s.equals(r.readOctetStringAsString()));
+        }
+    }
 
-    assertTrue(reader.hasNextElement());
-    reader.readStartSequence();
-    assertTrue(reader.hasNextElement());
+    /**
+     * Tests the <CODE>write/readOctetString</CODE> methods.
+     */
+    @Test
+    public void testEncodeDecodeOctetStringOffLen() throws Exception {
+        final byte[] b = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
 
-    assertEquals(true, reader.readBoolean());
-    assertEquals(false, reader.readBoolean());
-    assertEquals(0, reader.readInteger());
-    assertEquals(10, reader.readInteger());
-    reader.readNull();
-    assertEquals("test value", reader.readOctetStringAsString());
-    reader.skipElement();
+        for (int i = 0; i < 5; i += 2) {
+            final byte[] bsb = new byte[3];
+            System.arraycopy(b, i, bsb, 0, 3);
+            final ByteString bs = ByteString.wrap(bsb);
+            getWriter().writeOctetString(b, i, 3);
 
-    assertEquals(reader.peekLength(), 17);
-    assertEquals(reader.peekType(), UNIVERSAL_SEQUENCE_TYPE);
-    reader.readStartSequence();
-    assertEquals("nested sequence", reader.readOctetStringAsString());
-    reader.readEndSequence();
+            final ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), 3);
+            assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
+            assertTrue(bs.equals(r.readOctetString()));
+        }
+    }
 
-    assertEquals(reader.peekLength(), 12);
-    assertEquals(reader.peekType(), UNIVERSAL_SET_TYPE);
-    reader.readStartSequence();
-    assertEquals("nested set", reader.readOctetStringAsString());
-    reader.readEndSequence();
+    /**
+     * Tests the <CODE>write/readOctetString</CODE> methods.
+     */
+    @Test(dataProvider = "binaryValues")
+    public void testEncodeDecodeOctetStringType(final byte[] b) throws Exception {
+        final ByteString bs = ByteString.wrap(b);
+        final ByteStringBuilder bsb = new ByteStringBuilder();
 
-    assertFalse(reader.hasNextElement());
-    reader.readEndSequence();
-    assertFalse(reader.elementAvailable());
-  }
+        for (final byte type : testTypes) {
+            bsb.clear();
+            getWriter().writeOctetString(type, bs);
 
+            ASN1Reader r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), b.length);
+            assertEquals(r.peekType(), type);
+            r.readOctetString(bsb);
+            assertTrue(bs.equals(bsb));
 
+            bsb.clear();
+            getWriter().writeOctetString(type, b, 0, b.length);
 
-  /**
-   * Tests that negative integers are encoded according to ASN.1 BER
-   * specification.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test()
-  public void testNegativeIntEncoding() throws Exception
-  {
-    // Some negative integers of interest
-    // to test specific ranges/boundaries.
-    getWriter().writeInteger(-1);
-    byte[] value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
+            r = getReader(getEncodedBytes());
+            assertEquals(r.peekLength(), b.length);
+            assertEquals(r.peekType(), type);
+            r.readOctetString(bsb);
+            assertTrue(bs.equals(bsb));
+        }
+    }
 
-    getWriter().writeInteger(-2);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFE);
+    /**
+     * Tests the <CODE>write/readOctetString</CODE> methods.
+     */
+    @Test(dataProvider = "stringValues")
+    public void testEncodeDecodeOctetStringType(final String s) throws Exception {
+        for (final byte type : testTypes) {
+            getWriter().writeOctetString(type, s);
 
-    getWriter().writeInteger(-127);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x81);
+            final ASN1Reader r = getReader(getEncodedBytes());
+            if (s == null) {
+                assertEquals(r.peekLength(), 0);
+            } else {
+                assertEquals(r.peekLength(), StaticUtils.getBytes(s).length);
+            }
+            assertEquals(r.peekType(), type);
+            if (s == null) {
+                assertTrue(r.readOctetStringAsString().equals(""));
+            } else {
+                assertTrue(s.equals(r.readOctetStringAsString()));
+            }
+        }
+    }
 
-    getWriter().writeInteger(-128);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
+    @Test
+    public void testEncodeDecodeSequence() throws Exception {
+        final ASN1Writer writer = getWriter();
 
-    getWriter().writeInteger(-255);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x01);
+        writer.writeStartSequence();
 
-    getWriter().writeInteger(-256);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
+        writer.writeBoolean(true);
+        writer.writeBoolean(false);
+        writer.writeInteger(0);
+        writer.writeInteger(10L);
+        writer.writeNull();
+        writer.writeOctetString("test value");
+        writer.writeOctetString("skip value");
 
-    getWriter().writeInteger(-65535);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x01);
+        writer.writeStartSequence();
+        writer.writeOctetString("nested sequence");
+        writer.writeEndSequence();
 
-    getWriter().writeInteger(-65536);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
+        writer.writeStartSet();
+        writer.writeOctetString("nested set");
+        writer.writeEndSet();
 
-    getWriter().writeInteger(-2147483647);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
-    assertEquals(value[5], (byte) 0x01);
+        writer.writeEndSequence();
 
-    getWriter().writeInteger(-2147483648);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
-    assertEquals(value[5], (byte) 0x00);
-  }
+        final ASN1Reader reader = getReader(getEncodedBytes());
+        assertEquals(reader.peekType(), UNIVERSAL_SEQUENCE_TYPE);
+        assertEquals(reader.peekLength(), 71);
 
+        assertTrue(reader.hasNextElement());
+        reader.readStartSequence();
+        assertTrue(reader.hasNextElement());
 
+        assertEquals(true, reader.readBoolean());
+        assertEquals(false, reader.readBoolean());
+        assertEquals(0, reader.readInteger());
+        assertEquals(10, reader.readInteger());
+        reader.readNull();
+        assertEquals("test value", reader.readOctetStringAsString());
+        reader.skipElement();
 
-  /**
-   * Tests that negative integers are encoded according to ASN.1 BER
-   * specification.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test()
-  public void testNegativeLongEncoding() throws Exception
-  {
-    // Some negative integers of interest
-    // to test specific ranges/boundaries.
-    getWriter().writeInteger(-1L);
-    byte[] value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
+        assertEquals(reader.peekLength(), 17);
+        assertEquals(reader.peekType(), UNIVERSAL_SEQUENCE_TYPE);
+        reader.readStartSequence();
+        assertEquals("nested sequence", reader.readOctetStringAsString());
+        reader.readEndSequence();
 
-    getWriter().writeInteger(-2L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFE);
+        assertEquals(reader.peekLength(), 12);
+        assertEquals(reader.peekType(), UNIVERSAL_SET_TYPE);
+        reader.readStartSequence();
+        assertEquals("nested set", reader.readOctetStringAsString());
+        reader.readEndSequence();
 
-    getWriter().writeInteger(-127L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x81);
+        assertFalse(reader.hasNextElement());
+        reader.readEndSequence();
+        assertFalse(reader.elementAvailable());
+    }
 
-    getWriter().writeInteger(-128L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
+    /**
+     * Tests that negative integers are encoded according to ASN.1 BER
+     * specification.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test()
+    public void testNegativeIntEncoding() throws Exception {
+        // Some negative integers of interest
+        // to test specific ranges/boundaries.
+        getWriter().writeInteger(-1);
+        byte[] value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
 
-    getWriter().writeInteger(-255L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x01);
+        getWriter().writeInteger(-2);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFE);
 
-    getWriter().writeInteger(-256L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
+        getWriter().writeInteger(-127);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x81);
 
-    getWriter().writeInteger(-65535L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x01);
+        getWriter().writeInteger(-128);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
 
-    getWriter().writeInteger(-65536L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0xFF);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
+        getWriter().writeInteger(-255);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x01);
 
-    getWriter().writeInteger(-2147483647L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
-    assertEquals(value[5], (byte) 0x01);
+        getWriter().writeInteger(-256);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
 
-    getWriter().writeInteger(-2147483648L);
-    value = getEncodedBytes();
-    assertEquals(value[2], (byte) 0x80);
-    assertEquals(value[3], (byte) 0x00);
-    assertEquals(value[4], (byte) 0x00);
-    assertEquals(value[5], (byte) 0x00);
-  }
+        getWriter().writeInteger(-65535);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x01);
 
+        getWriter().writeInteger(-65536);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
 
+        getWriter().writeInteger(-2147483647);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
+        assertEquals(value[5], (byte) 0x01);
 
-  protected abstract byte[] getEncodedBytes() throws IOException,
-      DecodeException;
+        getWriter().writeInteger(-2147483648);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
+        assertEquals(value[5], (byte) 0x00);
+    }
 
+    /**
+     * Tests that negative integers are encoded according to ASN.1 BER
+     * specification.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test()
+    public void testNegativeLongEncoding() throws Exception {
+        // Some negative integers of interest
+        // to test specific ranges/boundaries.
+        getWriter().writeInteger(-1L);
+        byte[] value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
 
+        getWriter().writeInteger(-2L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFE);
 
-  protected abstract ASN1Reader getReader(byte[] encodedBytes)
-      throws DecodeException, IOException;
+        getWriter().writeInteger(-127L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x81);
 
+        getWriter().writeInteger(-128L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
 
+        getWriter().writeInteger(-255L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x01);
 
-  protected abstract ASN1Writer getWriter() throws IOException;
+        getWriter().writeInteger(-256L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
+
+        getWriter().writeInteger(-65535L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x01);
+
+        getWriter().writeInteger(-65536L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0xFF);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
+
+        getWriter().writeInteger(-2147483647L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
+        assertEquals(value[5], (byte) 0x01);
+
+        getWriter().writeInteger(-2147483648L);
+        value = getEncodedBytes();
+        assertEquals(value[2], (byte) 0x80);
+        assertEquals(value[3], (byte) 0x00);
+        assertEquals(value[4], (byte) 0x00);
+        assertEquals(value[5], (byte) 0x00);
+    }
+
+    protected abstract byte[] getEncodedBytes() throws IOException, DecodeException;
+
+    protected abstract ASN1Reader getReader(byte[] encodedBytes) throws DecodeException,
+            IOException;
+
+    protected abstract ASN1Writer getWriter() throws IOException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java
index 7d01307..538b7ca 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.fest.assertions.Assertions.assertThat;
 import static org.fest.assertions.Fail.fail;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
@@ -37,548 +34,377 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.testng.annotations.Test;
 
 import com.forgerock.opendj.util.CompletedFutureResult;
 
-
-
 /**
  * Unit test for AbstractAsynchronousConnection. The tests verify that all
  * synchronous operation methods delegate to the equivalent asynchronous method.
  */
 @SuppressWarnings("javadoc")
-public class AbstractAsynchronousConnectionTestCase extends SdkTestCase
-{
+public class AbstractAsynchronousConnectionTestCase extends SdkTestCase {
 
-  private final class MockConnection extends AbstractAsynchronousConnection
-  {
-    private final ResultCode resultCode;
-    private final SearchResultEntry entry;
+    private final class MockConnection extends AbstractAsynchronousConnection {
+        private final ResultCode resultCode;
+        private final SearchResultEntry entry;
 
+        private MockConnection(ResultCode resultCode) {
+            this(resultCode, null);
+        }
 
+        private MockConnection(ResultCode resultCode, SearchResultEntry entry) {
+            this.resultCode = resultCode;
+            this.entry = entry;
+        }
 
-    private MockConnection(ResultCode resultCode)
-    {
-      this(resultCode, null);
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Void> abandonAsync(AbandonRequest request) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Void>((Void) null);
+            } else {
+                return new CompletedFutureResult<Void>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Result> addAsync(AddRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super Result> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Result>(Responses.newResult(resultCode));
+            } else {
+                return new CompletedFutureResult<Result>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void addConnectionEventListener(ConnectionEventListener listener) {
+            // Do nothing.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<BindResult> bindAsync(BindRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super BindResult> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<BindResult>(Responses.newBindResult(resultCode));
+            } else {
+                return new CompletedFutureResult<BindResult>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close(UnbindRequest request, String reason) {
+            // Do nothing.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<CompareResult> compareAsync(CompareRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super CompareResult> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<CompareResult>(Responses
+                        .newCompareResult(resultCode));
+            } else {
+                return new CompletedFutureResult<CompareResult>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Result> deleteAsync(DeleteRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super Result> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Result>(Responses.newResult(resultCode));
+            } else {
+                return new CompletedFutureResult<Result>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
+                ExtendedRequest<R> request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super R> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<R>(request.getResultDecoder()
+                        .newExtendedErrorResult(resultCode, "", ""));
+            } else {
+                return new CompletedFutureResult<R>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean isClosed() {
+            return false;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean isValid() {
+            return true;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Result> modifyAsync(ModifyRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super Result> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Result>(Responses.newResult(resultCode));
+            } else {
+                return new CompletedFutureResult<Result>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Result> modifyDNAsync(ModifyDNRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super Result> resultHandler) {
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Result>(Responses.newResult(resultCode));
+            } else {
+                return new CompletedFutureResult<Result>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void removeConnectionEventListener(ConnectionEventListener listener) {
+            // Do nothing.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<Result> searchAsync(SearchRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                SearchResultHandler resultHandler) {
+            if (entry != null) {
+                resultHandler.handleEntry(entry);
+            }
+
+            if (!resultCode.isExceptional()) {
+                return new CompletedFutureResult<Result>(Responses.newResult(resultCode));
+            } else {
+                return new CompletedFutureResult<Result>(newErrorResult(resultCode));
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String toString() {
+            return "MockConnection";
+        }
+
     }
 
-
-
-    private MockConnection(ResultCode resultCode, SearchResultEntry entry)
-    {
-      this.resultCode = resultCode;
-      this.entry = entry;
+    @Test()
+    public void testAddRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final AddRequest addRequest = Requests.newAddRequest("cn=test");
+        assertThat(mockConnection.add(addRequest).getResultCode()).isEqualTo(ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Void> abandonAsync(AbandonRequest request)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Void>((Void) null);
-      }
-      else
-      {
-        return new CompletedFutureResult<Void>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testAddRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final AddRequest addRequest = Requests.newAddRequest("cn=test");
+        try {
+            mockConnection.add(addRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Result> addAsync(AddRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super Result> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Result>(
-            Responses.newResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<Result>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testBindRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final BindRequest bindRequest = Requests.newSimpleBindRequest();
+        assertThat(mockConnection.bind(bindRequest).getResultCode()).isEqualTo(ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void addConnectionEventListener(ConnectionEventListener listener)
-    {
-      // Do nothing.
+    @Test()
+    public void testBindRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final BindRequest bindRequest = Requests.newSimpleBindRequest();
+        try {
+            mockConnection.bind(bindRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<BindResult> bindAsync(BindRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super BindResult> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<BindResult>(
-            Responses.newBindResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<BindResult>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testCompareRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final CompareRequest compareRequest = Requests.newCompareRequest("cn=test", "cn", "test");
+        assertThat(mockConnection.compare(compareRequest).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close(UnbindRequest request, String reason)
-    {
-      // Do nothing.
+    @Test()
+    public void testCompareRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final CompareRequest compareRequest = Requests.newCompareRequest("cn=test", "cn", "test");
+        try {
+            mockConnection.compare(compareRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<CompareResult> compareAsync(CompareRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super CompareResult> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<CompareResult>(
-            Responses.newCompareResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<CompareResult>(
-            newErrorResult(resultCode));
-      }
+    @Test()
+    public void testDeleteRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
+        assertThat(mockConnection.delete(deleteRequest).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Result> deleteAsync(DeleteRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super Result> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Result>(
-            Responses.newResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<Result>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testDeleteRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
+        try {
+            mockConnection.delete(deleteRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public <R extends ExtendedResult> FutureResult<R> extendedRequestAsync(
-        ExtendedRequest<R> request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super R> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<R>(request.getResultDecoder()
-            .newExtendedErrorResult(resultCode, "", ""));
-      }
-      else
-      {
-        return new CompletedFutureResult<R>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testExtendedRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final GenericExtendedRequest extendedRequest = Requests.newGenericExtendedRequest("test");
+        assertThat(mockConnection.extendedRequest(extendedRequest).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isClosed()
-    {
-      return false;
+    @Test()
+    public void testExtendedRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final GenericExtendedRequest extendedRequest = Requests.newGenericExtendedRequest("test");
+        try {
+            mockConnection.extendedRequest(extendedRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isValid()
-    {
-      return true;
+    @Test()
+    public void testModifyRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final ModifyRequest modifyRequest = Requests.newModifyRequest("cn=test");
+        assertThat(mockConnection.modify(modifyRequest).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Result> modifyAsync(ModifyRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super Result> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Result>(
-            Responses.newResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<Result>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testModifyRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final ModifyRequest modifyRequest = Requests.newModifyRequest("cn=test");
+        try {
+            mockConnection.modify(modifyRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Result> modifyDNAsync(ModifyDNRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super Result> resultHandler)
-    {
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Result>(
-            Responses.newResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<Result>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testModifyDNRequestSuccess() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
+        final ModifyDNRequest modifyDNRequest = Requests.newModifyDNRequest("cn=test", "cn=newrdn");
+        assertThat(mockConnection.modifyDN(modifyDNRequest).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void removeConnectionEventListener(ConnectionEventListener listener)
-    {
-      // Do nothing.
+    @Test()
+    public void testModifyDNRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final ModifyDNRequest modifyDNRequest = Requests.newModifyDNRequest("cn=test", "cn=newrdn");
+        try {
+            mockConnection.modifyDN(modifyDNRequest);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+        }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<Result> searchAsync(SearchRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        SearchResultHandler resultHandler)
-    {
-      if (entry != null)
-      {
-        resultHandler.handleEntry(entry);
-      }
-
-      if (!resultCode.isExceptional())
-      {
-        return new CompletedFutureResult<Result>(
-            Responses.newResult(resultCode));
-      }
-      else
-      {
-        return new CompletedFutureResult<Result>(newErrorResult(resultCode));
-      }
+    @Test()
+    public void testSearchRequestSuccess() throws Exception {
+        final SearchResultEntry entry = Responses.newSearchResultEntry("cn=test");
+        final Connection mockConnection = new MockConnection(ResultCode.SUCCESS, entry);
+        final SearchRequest searchRequest =
+                Requests.newSearchRequest("cn=test", SearchScope.BASE_OBJECT, "(objectClass=*)");
+        List<SearchResultEntry> entries = new LinkedList<SearchResultEntry>();
+        assertThat(mockConnection.search(searchRequest, entries).getResultCode()).isEqualTo(
+                ResultCode.SUCCESS);
+        assertThat(entries.size()).isEqualTo(1);
+        assertThat(entries.iterator().next()).isSameAs(entry);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString()
-    {
-      return "MockConnection";
+    @Test()
+    public void testSearchRequestFail() throws Exception {
+        final Connection mockConnection = new MockConnection(ResultCode.UNWILLING_TO_PERFORM);
+        final SearchRequest searchRequest =
+                Requests.newSearchRequest("cn=test", SearchScope.BASE_OBJECT, "(objectClass=*)");
+        List<SearchResultEntry> entries = new LinkedList<SearchResultEntry>();
+        try {
+            mockConnection.search(searchRequest, entries);
+            fail();
+        } catch (ErrorResultException e) {
+            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
+            assertThat(entries.isEmpty());
+        }
     }
-
-  }
-
-
-
-  @Test()
-  public void testAddRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final AddRequest addRequest = Requests.newAddRequest("cn=test");
-    assertThat(mockConnection.add(addRequest).getResultCode()).isEqualTo(
-        ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testAddRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final AddRequest addRequest = Requests.newAddRequest("cn=test");
-    try
-    {
-      mockConnection.add(addRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testBindRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final BindRequest bindRequest = Requests.newSimpleBindRequest();
-    assertThat(mockConnection.bind(bindRequest).getResultCode()).isEqualTo(
-        ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testBindRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final BindRequest bindRequest = Requests.newSimpleBindRequest();
-    try
-    {
-      mockConnection.bind(bindRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testCompareRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final CompareRequest compareRequest = Requests.newCompareRequest("cn=test",
-        "cn", "test");
-    assertThat(mockConnection.compare(compareRequest).getResultCode())
-        .isEqualTo(ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testCompareRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final CompareRequest compareRequest = Requests.newCompareRequest("cn=test",
-        "cn", "test");
-    try
-    {
-      mockConnection.compare(compareRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testDeleteRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
-    assertThat(mockConnection.delete(deleteRequest).getResultCode()).isEqualTo(
-        ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testDeleteRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
-    try
-    {
-      mockConnection.delete(deleteRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testExtendedRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final GenericExtendedRequest extendedRequest = Requests
-        .newGenericExtendedRequest("test");
-    assertThat(mockConnection.extendedRequest(extendedRequest).getResultCode())
-        .isEqualTo(ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testExtendedRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final GenericExtendedRequest extendedRequest = Requests
-        .newGenericExtendedRequest("test");
-    try
-    {
-      mockConnection.extendedRequest(extendedRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testModifyRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final ModifyRequest modifyRequest = Requests.newModifyRequest("cn=test");
-    assertThat(mockConnection.modify(modifyRequest).getResultCode()).isEqualTo(
-        ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testModifyRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final ModifyRequest modifyRequest = Requests.newModifyRequest("cn=test");
-    try
-    {
-      mockConnection.modify(modifyRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testModifyDNRequestSuccess() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS);
-    final ModifyDNRequest modifyDNRequest = Requests.newModifyDNRequest(
-        "cn=test", "cn=newrdn");
-    assertThat(mockConnection.modifyDN(modifyDNRequest).getResultCode())
-        .isEqualTo(ResultCode.SUCCESS);
-  }
-
-
-
-  @Test()
-  public void testModifyDNRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final ModifyDNRequest modifyDNRequest = Requests.newModifyDNRequest(
-        "cn=test", "cn=newrdn");
-    try
-    {
-      mockConnection.modifyDN(modifyDNRequest);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-    }
-  }
-
-
-
-  @Test()
-  public void testSearchRequestSuccess() throws Exception
-  {
-    final SearchResultEntry entry = Responses.newSearchResultEntry("cn=test");
-    final Connection mockConnection = new MockConnection(ResultCode.SUCCESS,
-        entry);
-    final SearchRequest searchRequest = Requests.newSearchRequest("cn=test",
-        SearchScope.BASE_OBJECT, "(objectClass=*)");
-    List<SearchResultEntry> entries = new LinkedList<SearchResultEntry>();
-    assertThat(mockConnection.search(searchRequest, entries).getResultCode())
-        .isEqualTo(ResultCode.SUCCESS);
-    assertThat(entries.size()).isEqualTo(1);
-    assertThat(entries.iterator().next()).isSameAs(entry);
-  }
-
-
-
-  @Test()
-  public void testSearchRequestFail() throws Exception
-  {
-    final Connection mockConnection = new MockConnection(
-        ResultCode.UNWILLING_TO_PERFORM);
-    final SearchRequest searchRequest = Requests.newSearchRequest("cn=test",
-        SearchScope.BASE_OBJECT, "(objectClass=*)");
-    List<SearchResultEntry> entries = new LinkedList<SearchResultEntry>();
-    try
-    {
-      mockConnection.search(searchRequest, entries);
-      fail();
-    }
-    catch (ErrorResultException e)
-    {
-      assertThat(e.getResult().getResultCode()).isEqualTo(
-          ResultCode.UNWILLING_TO_PERFORM);
-      assertThat(entries.isEmpty());
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
index 4f7d834..83657c2 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,350 +27,247 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Iterator;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test {@code AttributeDescription}.
  */
 @SuppressWarnings("javadoc")
-public final class AttributeDescriptionTestCase extends SdkTestCase
-{
-  @DataProvider(name = "dataForCompareCoreSchema")
-  public Object[][] dataForCompareCoreSchema()
-  {
-    // AD1, AD2, compare result, isSubtype, isSuperType
-    return new Object[][] { { "cn", "cn", 0, true, true },
-        { "cn", "commonName", 0, true, true },
-        { " cn", "commonName ", 0, true, true },
-        { "commonName", "cn", 0, true, true },
-        { "commonName", "commonName", 0, true, true },
-        { "cn", "objectClass", 1, false, false },
-        { "objectClass", "cn", -1, false, false },
-        { "name", "cn", 1, false, true }, { "cn", "name", -1, true, false },
-        { "name;foo", "cn", 1, false, false },
-        { "cn;foo", "name", -1, true, false },
-        { "name", "cn;foo", 1, false, true },
-        { "cn", "name;foo", -1, false, false }, };
-  }
-
-
-
-  @DataProvider(name = "dataForCompareNoSchema")
-  public Object[][] dataForCompareNoSchema()
-  {
-    // AD1, AD2, compare result, isSubtype, isSuperType
-    return new Object[][] { { "cn", "cn", 0, true, true },
-        { "cn", "CN", 0, true, true }, { "CN", "cn", 0, true, true },
-        { "CN", "CN", 0, true, true },
-        { "cn", "commonName", -1, false, false },
-        { "commonName", "cn", 1, false, false },
-        { "commonName", "commonName", 0, true, true },
-        { "cn", "cn;foo", -1, false, true },
-        { "cn;foo", "cn", 1, true, false },
-        { "cn;foo", "cn;foo", 0, true, true },
-        { "CN;FOO", "cn;foo", 0, true, true },
-        { "cn;foo", "CN;FOO", 0, true, true },
-        { "CN;FOO", "CN;FOO", 0, true, true },
-        { "cn;foo", "cn;bar", 1, false, false },
-        { "cn;bar", "cn;foo", -1, false, false },
-
-        { "cn;xxx;yyy", "cn", 1, true, false },
-        { "cn;xxx;yyy", "cn;yyy", 1, true, false },
-        { "cn;xxx;yyy", "cn;xxx", 1, true, false },
-        { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true },
-        { "cn;xxx;yyy", "cn;yyy;xxx", 0, true, true },
-
-        { "cn", "cn;xxx;yyy", -1, false, true },
-        { "cn;yyy", "cn;xxx;yyy", -1, false, true },
-        { "cn;xxx", "cn;xxx;yyy", -1, false, true },
-        { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true },
-        { "cn;yyy;xxx", "cn;xxx;yyy", 0, true, true }, };
-  }
-
-
-
-  @DataProvider(name = "dataForValueOfCoreSchema")
-  public Object[][] dataForValueOfCoreSchema()
-  {
-    // Value, type, isObjectClass
-    return new Object[][] { { "cn", "cn", false }, { "CN", "cn", false },
-        { "commonName", "cn", false }, { "objectclass", "objectClass", true }, };
-  }
-
-
-
-  @DataProvider(name = "dataForValueOfInvalidAttributeDescriptions")
-  public Object[][] dataForValueOfInvalidAttributeDescriptions()
-  {
-    return new Object[][] { { "" }, { " " }, { ";" }, { " ; " }, { "0cn" },
-        { "cn+" }, { "cn;foo+bar" }, { "cn;foo;foo+bar" }, { ";foo" },
-        { "cn;" }, { "cn;;foo" }, { "cn; ;foo" }, { "cn;foo;" },
-        { "cn;foo; " }, { "cn;foo;;bar" }, { "cn;foo; ;bar" },
-        { "cn;foo;bar;;" }, { "1a" }, { "1.a" }, { "1-" }, { "1.1a" },
-        { "1.1.a" }, };
-  }
-
-
-
-  @DataProvider(name = "dataForValueOfNoSchema")
-  public Object[][] dataForValueOfNoSchema()
-  {
-    // Value, type, options, containsOptions("foo")
-    return new Object[][] {
-        { "cn", "cn", new String[0], false },
-        { " cn ", "cn", new String[0], false },
-        { "  cn  ", "cn", new String[0], false },
-        { "CN", "CN", new String[0], false },
-        { "1", "1", new String[0], false },
-        { "1.2", "1.2", new String[0], false },
-        { "1.2.3", "1.2.3", new String[0], false },
-        { "111.222.333", "111.222.333", new String[0], false },
-        { "objectClass", "objectClass", new String[0], false },
-        { "cn;foo", "cn", new String[] { "foo" }, true },
-        { "cn;FOO", "cn", new String[] { "FOO" }, true },
-        { "cn;bar", "cn", new String[] { "bar" }, false },
-        { "cn;BAR", "cn", new String[] { "BAR" }, false },
-        { "cn;foo;bar", "cn", new String[] { "foo", "bar" }, true },
-        { "cn;FOO;bar", "cn", new String[] { "FOO", "bar" }, true },
-        { "cn;foo;BAR", "cn", new String[] { "foo", "BAR" }, true },
-        { "cn;FOO;BAR", "cn", new String[] { "FOO", "BAR" }, true },
-        { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true },
-        { "cn;BAR;foo", "cn", new String[] { "BAR", "foo" }, true },
-        { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true },
-        { "cn;BAR;FOO", "cn", new String[] { "BAR", "FOO" }, true },
-        { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true },
-        { "  cn;BAR;FOO  ", "cn", new String[] { "BAR", "FOO" }, true },
-        { "cn;xxx;yyy;zzz", "cn", new String[] { "xxx", "yyy", "zzz" }, false },
-        { "cn;zzz;YYY;xxx", "cn", new String[] { "zzz", "YYY", "xxx" }, false }, };
-  }
-
-
-
-  @Test(dataProvider = "dataForCompareCoreSchema")
-  public void testCompareCoreSchema(final String ad1, final String ad2,
-      final int compare, final boolean isSubType, final boolean isSuperType)
-  {
-    final AttributeDescription attributeDescription1 = AttributeDescription
-        .valueOf(ad1, Schema.getCoreSchema());
-
-    final AttributeDescription attributeDescription2 = AttributeDescription
-        .valueOf(ad2, Schema.getCoreSchema());
-
-    // Identity.
-    Assert.assertTrue(attributeDescription1.equals(attributeDescription1));
-    Assert
-        .assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0);
-    Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1));
-    Assert.assertTrue(attributeDescription1
-        .isSuperTypeOf(attributeDescription1));
-
-    if (compare == 0)
-    {
-      Assert.assertTrue(attributeDescription1.equals(attributeDescription2));
-      Assert.assertTrue(attributeDescription2.equals(attributeDescription1));
-      Assert
-          .assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0);
-      Assert
-          .assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0);
-
-      Assert.assertTrue(attributeDescription1
-          .isSubTypeOf(attributeDescription2));
-      Assert.assertTrue(attributeDescription1
-          .isSuperTypeOf(attributeDescription2));
-      Assert.assertTrue(attributeDescription2
-          .isSubTypeOf(attributeDescription1));
-      Assert.assertTrue(attributeDescription2
-          .isSuperTypeOf(attributeDescription1));
-    }
-    else
-    {
-      Assert.assertFalse(attributeDescription1.equals(attributeDescription2));
-      Assert.assertFalse(attributeDescription2.equals(attributeDescription1));
-
-      if (compare < 0)
-      {
-        Assert.assertTrue(attributeDescription1
-            .compareTo(attributeDescription2) < 0);
-        Assert.assertTrue(attributeDescription2
-            .compareTo(attributeDescription1) > 0);
-      }
-      else
-      {
-        Assert.assertTrue(attributeDescription1
-            .compareTo(attributeDescription2) > 0);
-        Assert.assertTrue(attributeDescription2
-            .compareTo(attributeDescription1) < 0);
-      }
-
-      Assert.assertEquals(attributeDescription1
-          .isSubTypeOf(attributeDescription2), isSubType);
-
-      Assert.assertEquals(attributeDescription1
-          .isSuperTypeOf(attributeDescription2), isSuperType);
-    }
-  }
-
-
-
-  @Test(dataProvider = "dataForCompareNoSchema")
-  public void testCompareNoSchema(final String ad1, final String ad2,
-      final int compare, final boolean isSubType, final boolean isSuperType)
-  {
-    final AttributeDescription attributeDescription1 = AttributeDescription
-        .valueOf(ad1, Schema.getEmptySchema());
-
-    final AttributeDescription attributeDescription2 = AttributeDescription
-        .valueOf(ad2, Schema.getEmptySchema());
-
-    // Identity.
-    Assert.assertTrue(attributeDescription1.equals(attributeDescription1));
-    Assert
-        .assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0);
-    Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1));
-    Assert.assertTrue(attributeDescription1
-        .isSuperTypeOf(attributeDescription1));
-
-    if (compare == 0)
-    {
-      Assert.assertTrue(attributeDescription1.equals(attributeDescription2));
-      Assert.assertTrue(attributeDescription2.equals(attributeDescription1));
-      Assert
-          .assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0);
-      Assert
-          .assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0);
-
-      Assert.assertTrue(attributeDescription1
-          .isSubTypeOf(attributeDescription2));
-      Assert.assertTrue(attributeDescription1
-          .isSuperTypeOf(attributeDescription2));
-      Assert.assertTrue(attributeDescription2
-          .isSubTypeOf(attributeDescription1));
-      Assert.assertTrue(attributeDescription2
-          .isSuperTypeOf(attributeDescription1));
-    }
-    else
-    {
-      Assert.assertFalse(attributeDescription1.equals(attributeDescription2));
-      Assert.assertFalse(attributeDescription2.equals(attributeDescription1));
-
-      if (compare < 0)
-      {
-        Assert.assertTrue(attributeDescription1
-            .compareTo(attributeDescription2) < 0);
-        Assert.assertTrue(attributeDescription2
-            .compareTo(attributeDescription1) > 0);
-      }
-      else
-      {
-        Assert.assertTrue(attributeDescription1
-            .compareTo(attributeDescription2) > 0);
-        Assert.assertTrue(attributeDescription2
-            .compareTo(attributeDescription1) < 0);
-      }
-
-      Assert.assertEquals(attributeDescription1
-          .isSubTypeOf(attributeDescription2), isSubType);
-
-      Assert.assertEquals(attributeDescription1
-          .isSuperTypeOf(attributeDescription2), isSuperType);
-    }
-  }
-
-
-
-  @Test(dataProvider = "dataForValueOfCoreSchema")
-  public void testValueOfCoreSchema(final String ad, final String at,
-      final boolean isObjectClass)
-  {
-    final AttributeDescription attributeDescription = AttributeDescription
-        .valueOf(ad, Schema.getCoreSchema());
-
-    Assert.assertEquals(attributeDescription.toString(), ad);
-
-    Assert.assertEquals(attributeDescription.getAttributeType().getNameOrOID(),
-        at);
-
-    Assert.assertEquals(attributeDescription.isObjectClass(), isObjectClass);
-
-    Assert.assertFalse(attributeDescription.hasOptions());
-    Assert.assertFalse(attributeDescription.containsOption("dummy"));
-
-    final Iterator<String> iterator = attributeDescription.getOptions()
-        .iterator();
-    Assert.assertFalse(iterator.hasNext());
-  }
-
-
-
-  // FIXME: none of these pass! The valueOf method is far to lenient.
-  @Test(dataProvider = "dataForValueOfInvalidAttributeDescriptions", expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testValueOfInvalidAttributeDescriptions(final String ad)
-  {
-    AttributeDescription.valueOf(ad, Schema.getEmptySchema());
-  }
-
-
-
-  @Test(dataProvider = "dataForValueOfNoSchema")
-  public void testValueOfNoSchema(final String ad, final String at,
-      final String[] options, final boolean containsFoo)
-  {
-    final AttributeDescription attributeDescription = AttributeDescription
-        .valueOf(ad, Schema.getEmptySchema());
-
-    Assert.assertEquals(attributeDescription.toString(), ad);
-
-    Assert.assertEquals(attributeDescription.getAttributeType().getNameOrOID(),
-        at);
-
-    Assert.assertFalse(attributeDescription.isObjectClass());
-
-    if (options.length == 0)
-    {
-      Assert.assertFalse(attributeDescription.hasOptions());
-    }
-    else
-    {
-      Assert.assertTrue(attributeDescription.hasOptions());
+public final class AttributeDescriptionTestCase extends SdkTestCase {
+    @DataProvider(name = "dataForCompareCoreSchema")
+    public Object[][] dataForCompareCoreSchema() {
+        // AD1, AD2, compare result, isSubtype, isSuperType
+        return new Object[][] { { "cn", "cn", 0, true, true },
+            { "cn", "commonName", 0, true, true }, { " cn", "commonName ", 0, true, true },
+            { "commonName", "cn", 0, true, true }, { "commonName", "commonName", 0, true, true },
+            { "cn", "objectClass", 1, false, false }, { "objectClass", "cn", -1, false, false },
+            { "name", "cn", 1, false, true }, { "cn", "name", -1, true, false },
+            { "name;foo", "cn", 1, false, false }, { "cn;foo", "name", -1, true, false },
+            { "name", "cn;foo", 1, false, true }, { "cn", "name;foo", -1, false, false }, };
     }
 
-    Assert.assertFalse(attributeDescription.containsOption("dummy"));
-    if (containsFoo)
-    {
-      Assert.assertTrue(attributeDescription.containsOption("foo"));
-      Assert.assertTrue(attributeDescription.containsOption("FOO"));
-      Assert.assertTrue(attributeDescription.containsOption("FoO"));
-    }
-    else
-    {
-      Assert.assertFalse(attributeDescription.containsOption("foo"));
-      Assert.assertFalse(attributeDescription.containsOption("FOO"));
-      Assert.assertFalse(attributeDescription.containsOption("FoO"));
+    @DataProvider(name = "dataForCompareNoSchema")
+    public Object[][] dataForCompareNoSchema() {
+        // AD1, AD2, compare result, isSubtype, isSuperType
+        return new Object[][] { { "cn", "cn", 0, true, true }, { "cn", "CN", 0, true, true },
+            { "CN", "cn", 0, true, true }, { "CN", "CN", 0, true, true },
+            { "cn", "commonName", -1, false, false }, { "commonName", "cn", 1, false, false },
+            { "commonName", "commonName", 0, true, true }, { "cn", "cn;foo", -1, false, true },
+            { "cn;foo", "cn", 1, true, false }, { "cn;foo", "cn;foo", 0, true, true },
+            { "CN;FOO", "cn;foo", 0, true, true }, { "cn;foo", "CN;FOO", 0, true, true },
+            { "CN;FOO", "CN;FOO", 0, true, true }, { "cn;foo", "cn;bar", 1, false, false },
+            { "cn;bar", "cn;foo", -1, false, false },
+
+            { "cn;xxx;yyy", "cn", 1, true, false }, { "cn;xxx;yyy", "cn;yyy", 1, true, false },
+            { "cn;xxx;yyy", "cn;xxx", 1, true, false },
+            { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true },
+            { "cn;xxx;yyy", "cn;yyy;xxx", 0, true, true },
+
+            { "cn", "cn;xxx;yyy", -1, false, true }, { "cn;yyy", "cn;xxx;yyy", -1, false, true },
+            { "cn;xxx", "cn;xxx;yyy", -1, false, true },
+            { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true },
+            { "cn;yyy;xxx", "cn;xxx;yyy", 0, true, true }, };
     }
 
-    for (final String option : options)
-    {
-      Assert.assertTrue(attributeDescription.containsOption(option));
+    @DataProvider(name = "dataForValueOfCoreSchema")
+    public Object[][] dataForValueOfCoreSchema() {
+        // Value, type, isObjectClass
+        return new Object[][] { { "cn", "cn", false }, { "CN", "cn", false },
+            { "commonName", "cn", false }, { "objectclass", "objectClass", true }, };
     }
 
-    final Iterator<String> iterator = attributeDescription.getOptions()
-        .iterator();
-    for (final String option : options)
-    {
-      Assert.assertTrue(iterator.hasNext());
-      Assert.assertEquals(iterator.next(), option);
+    @DataProvider(name = "dataForValueOfInvalidAttributeDescriptions")
+    public Object[][] dataForValueOfInvalidAttributeDescriptions() {
+        return new Object[][] { { "" }, { " " }, { ";" }, { " ; " }, { "0cn" }, { "cn+" },
+            { "cn;foo+bar" }, { "cn;foo;foo+bar" }, { ";foo" }, { "cn;" }, { "cn;;foo" },
+            { "cn; ;foo" }, { "cn;foo;" }, { "cn;foo; " }, { "cn;foo;;bar" }, { "cn;foo; ;bar" },
+            { "cn;foo;bar;;" }, { "1a" }, { "1.a" }, { "1-" }, { "1.1a" }, { "1.1.a" }, };
     }
-    Assert.assertFalse(iterator.hasNext());
-  }
+
+    @DataProvider(name = "dataForValueOfNoSchema")
+    public Object[][] dataForValueOfNoSchema() {
+        // Value, type, options, containsOptions("foo")
+        return new Object[][] { { "cn", "cn", new String[0], false },
+            { " cn ", "cn", new String[0], false }, { "  cn  ", "cn", new String[0], false },
+            { "CN", "CN", new String[0], false }, { "1", "1", new String[0], false },
+            { "1.2", "1.2", new String[0], false }, { "1.2.3", "1.2.3", new String[0], false },
+            { "111.222.333", "111.222.333", new String[0], false },
+            { "objectClass", "objectClass", new String[0], false },
+            { "cn;foo", "cn", new String[] { "foo" }, true },
+            { "cn;FOO", "cn", new String[] { "FOO" }, true },
+            { "cn;bar", "cn", new String[] { "bar" }, false },
+            { "cn;BAR", "cn", new String[] { "BAR" }, false },
+            { "cn;foo;bar", "cn", new String[] { "foo", "bar" }, true },
+            { "cn;FOO;bar", "cn", new String[] { "FOO", "bar" }, true },
+            { "cn;foo;BAR", "cn", new String[] { "foo", "BAR" }, true },
+            { "cn;FOO;BAR", "cn", new String[] { "FOO", "BAR" }, true },
+            { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true },
+            { "cn;BAR;foo", "cn", new String[] { "BAR", "foo" }, true },
+            { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true },
+            { "cn;BAR;FOO", "cn", new String[] { "BAR", "FOO" }, true },
+            { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true },
+            { "  cn;BAR;FOO  ", "cn", new String[] { "BAR", "FOO" }, true },
+            { "cn;xxx;yyy;zzz", "cn", new String[] { "xxx", "yyy", "zzz" }, false },
+            { "cn;zzz;YYY;xxx", "cn", new String[] { "zzz", "YYY", "xxx" }, false }, };
+    }
+
+    @Test(dataProvider = "dataForCompareCoreSchema")
+    public void testCompareCoreSchema(final String ad1, final String ad2, final int compare,
+            final boolean isSubType, final boolean isSuperType) {
+        final AttributeDescription attributeDescription1 =
+                AttributeDescription.valueOf(ad1, Schema.getCoreSchema());
+
+        final AttributeDescription attributeDescription2 =
+                AttributeDescription.valueOf(ad2, Schema.getCoreSchema());
+
+        // Identity.
+        Assert.assertTrue(attributeDescription1.equals(attributeDescription1));
+        Assert.assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0);
+        Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1));
+        Assert.assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription1));
+
+        if (compare == 0) {
+            Assert.assertTrue(attributeDescription1.equals(attributeDescription2));
+            Assert.assertTrue(attributeDescription2.equals(attributeDescription1));
+            Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0);
+            Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0);
+
+            Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription2));
+            Assert.assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription2));
+            Assert.assertTrue(attributeDescription2.isSubTypeOf(attributeDescription1));
+            Assert.assertTrue(attributeDescription2.isSuperTypeOf(attributeDescription1));
+        } else {
+            Assert.assertFalse(attributeDescription1.equals(attributeDescription2));
+            Assert.assertFalse(attributeDescription2.equals(attributeDescription1));
+
+            if (compare < 0) {
+                Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) < 0);
+                Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) > 0);
+            } else {
+                Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) > 0);
+                Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) < 0);
+            }
+
+            Assert.assertEquals(attributeDescription1.isSubTypeOf(attributeDescription2), isSubType);
+
+            Assert.assertEquals(attributeDescription1.isSuperTypeOf(attributeDescription2),
+                    isSuperType);
+        }
+    }
+
+    @Test(dataProvider = "dataForCompareNoSchema")
+    public void testCompareNoSchema(final String ad1, final String ad2, final int compare,
+            final boolean isSubType, final boolean isSuperType) {
+        final AttributeDescription attributeDescription1 =
+                AttributeDescription.valueOf(ad1, Schema.getEmptySchema());
+
+        final AttributeDescription attributeDescription2 =
+                AttributeDescription.valueOf(ad2, Schema.getEmptySchema());
+
+        // Identity.
+        Assert.assertTrue(attributeDescription1.equals(attributeDescription1));
+        Assert.assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0);
+        Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1));
+        Assert.assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription1));
+
+        if (compare == 0) {
+            Assert.assertTrue(attributeDescription1.equals(attributeDescription2));
+            Assert.assertTrue(attributeDescription2.equals(attributeDescription1));
+            Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0);
+            Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0);
+
+            Assert.assertTrue(attributeDescription1.isSubTypeOf(attributeDescription2));
+            Assert.assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription2));
+            Assert.assertTrue(attributeDescription2.isSubTypeOf(attributeDescription1));
+            Assert.assertTrue(attributeDescription2.isSuperTypeOf(attributeDescription1));
+        } else {
+            Assert.assertFalse(attributeDescription1.equals(attributeDescription2));
+            Assert.assertFalse(attributeDescription2.equals(attributeDescription1));
+
+            if (compare < 0) {
+                Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) < 0);
+                Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) > 0);
+            } else {
+                Assert.assertTrue(attributeDescription1.compareTo(attributeDescription2) > 0);
+                Assert.assertTrue(attributeDescription2.compareTo(attributeDescription1) < 0);
+            }
+
+            Assert.assertEquals(attributeDescription1.isSubTypeOf(attributeDescription2), isSubType);
+
+            Assert.assertEquals(attributeDescription1.isSuperTypeOf(attributeDescription2),
+                    isSuperType);
+        }
+    }
+
+    @Test(dataProvider = "dataForValueOfCoreSchema")
+    public void testValueOfCoreSchema(final String ad, final String at, final boolean isObjectClass) {
+        final AttributeDescription attributeDescription =
+                AttributeDescription.valueOf(ad, Schema.getCoreSchema());
+
+        Assert.assertEquals(attributeDescription.toString(), ad);
+
+        Assert.assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at);
+
+        Assert.assertEquals(attributeDescription.isObjectClass(), isObjectClass);
+
+        Assert.assertFalse(attributeDescription.hasOptions());
+        Assert.assertFalse(attributeDescription.containsOption("dummy"));
+
+        final Iterator<String> iterator = attributeDescription.getOptions().iterator();
+        Assert.assertFalse(iterator.hasNext());
+    }
+
+    // FIXME: none of these pass! The valueOf method is far to lenient.
+    @Test(dataProvider = "dataForValueOfInvalidAttributeDescriptions",
+            expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testValueOfInvalidAttributeDescriptions(final String ad) {
+        AttributeDescription.valueOf(ad, Schema.getEmptySchema());
+    }
+
+    @Test(dataProvider = "dataForValueOfNoSchema")
+    public void testValueOfNoSchema(final String ad, final String at, final String[] options,
+            final boolean containsFoo) {
+        final AttributeDescription attributeDescription =
+                AttributeDescription.valueOf(ad, Schema.getEmptySchema());
+
+        Assert.assertEquals(attributeDescription.toString(), ad);
+
+        Assert.assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at);
+
+        Assert.assertFalse(attributeDescription.isObjectClass());
+
+        if (options.length == 0) {
+            Assert.assertFalse(attributeDescription.hasOptions());
+        } else {
+            Assert.assertTrue(attributeDescription.hasOptions());
+        }
+
+        Assert.assertFalse(attributeDescription.containsOption("dummy"));
+        if (containsFoo) {
+            Assert.assertTrue(attributeDescription.containsOption("foo"));
+            Assert.assertTrue(attributeDescription.containsOption("FOO"));
+            Assert.assertTrue(attributeDescription.containsOption("FoO"));
+        } else {
+            Assert.assertFalse(attributeDescription.containsOption("foo"));
+            Assert.assertFalse(attributeDescription.containsOption("FOO"));
+            Assert.assertFalse(attributeDescription.containsOption("FoO"));
+        }
+
+        for (final String option : options) {
+            Assert.assertTrue(attributeDescription.containsOption(option));
+        }
+
+        final Iterator<String> iterator = attributeDescription.getOptions().iterator();
+        for (final String option : options) {
+            Assert.assertTrue(iterator.hasNext());
+            Assert.assertEquals(iterator.next(), option);
+        }
+        Assert.assertFalse(iterator.hasNext());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
index f711114..125c05c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,206 +26,145 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.ByteSequence;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Abstract test case for the ByteSequence interface.
  */
 @SuppressWarnings("javadoc")
-public abstract class ByteSequenceTestCase extends SdkTestCase
-{
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testByteAt(final ByteSequence bs, final byte[] ba)
-  {
-    for (int i = 0; i < ba.length; i++)
-    {
-      Assert.assertEquals(bs.byteAt(i), ba[i]);
-    }
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testByteAtBadIndex1(final ByteSequence bs, final byte[] ba)
-  {
-    bs.byteAt(ba.length);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testByteAtBadIndex2(final ByteSequence bs, final byte[] ba)
-  {
-    bs.byteAt(-1);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testCopyTo(final ByteSequence bs, final byte[] ba)
-  {
-    final byte[] newBa = new byte[ba.length];
-    bs.copyTo(newBa);
-    Assert.assertTrue(Arrays.equals(newBa, ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testCopyToByteSequenceBuilder(final ByteSequence bs,
-      final byte[] ba)
-  {
-    final ByteStringBuilder builder = new ByteStringBuilder();
-    bs.copyTo(builder);
-    Assert.assertTrue(Arrays.equals(builder.toByteArray(), ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testCopyToOutputStream(final ByteSequence bs, final byte[] ba)
-      throws Exception
-  {
-    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
-    bs.copyTo(stream);
-    Assert.assertTrue(Arrays.equals(stream.toByteArray(), ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testCopyToWithBadOffset(final ByteSequence bs, final byte[] ba)
-  {
-    bs.copyTo(new byte[0], -1);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testCopyToWithOffset(final ByteSequence bs, final byte[] ba)
-  {
-    for (int i = 0; i < ba.length * 2; i++)
-    {
-      final byte[] newBa = new byte[ba.length * 2];
-      bs.copyTo(newBa, i);
-
-      final byte[] resultBa = new byte[ba.length * 2];
-      System.arraycopy(ba, 0, resultBa, i, Math.min(ba.length, ba.length * 2
-          - i));
-      Assert.assertTrue(Arrays.equals(newBa, resultBa));
-    }
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testEquals(final ByteSequence bs, final byte[] ba)
-      throws Exception
-  {
-    Assert.assertTrue(bs.equals(ByteString.wrap(ba)));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testLength(final ByteSequence bs, final byte[] ba)
-      throws Exception
-  {
-    Assert.assertEquals(bs.length(), ba.length);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testSubSequence(final ByteSequence bs, final byte[] ba)
-  {
-    ByteSequence bsSub = bs.subSequence(0, bs.length() / 2);
-    byte[] baSub = new byte[ba.length / 2];
-    System.arraycopy(ba, 0, baSub, 0, baSub.length);
-    Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
-
-    bsSub = bs.subSequence(ba.length / 4, (bs.length() / 4) * 3);
-    baSub = new byte[(bs.length() / 4) * 3 - ba.length / 4];
-    System.arraycopy(ba, ba.length / 4, baSub, 0, baSub.length);
-    Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
-
-    bsSub = bs.subSequence(ba.length / 2, bs.length());
-    baSub = new byte[bs.length() - ba.length / 2];
-    System.arraycopy(ba, ba.length / 2, baSub, 0, baSub.length);
-    Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
-
-    bsSub = bs.subSequence(0, bs.length());
-    Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testSubSequenceBadStartEnd1(final ByteSequence bs, final byte[] ba)
-  {
-    bs.subSequence(-1, bs.length());
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testSubSequenceBadStartEnd2(final ByteSequence bs, final byte[] ba)
-  {
-    bs.subSequence(0, bs.length() + 1);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testSubSequenceBadStartEnd3(final ByteSequence bs, final byte[] ba)
-  {
-    bs.subSequence(-1, bs.length() + 1);
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testToByteArray(final ByteSequence bs, final byte[] ba)
-  {
-    Assert.assertTrue(Arrays.equals(bs.toByteArray(), ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testToByteSequence(final ByteSequence bs, final byte[] ba)
-  {
-    Assert.assertTrue(Arrays.equals(bs.toByteString().toByteArray(), ba));
-  }
-
-
-
-  @Test(dataProvider = "byteSequenceProvider")
-  public void testToString(final ByteSequence bs, final byte[] ba)
-  {
-    String str;
-    try
-    {
-      str = new String(ba, "UTF-8");
-    }
-    catch (final UnsupportedEncodingException uee)
-    {
-      str = new String(ba);
+public abstract class ByteSequenceTestCase extends SdkTestCase {
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testByteAt(final ByteSequence bs, final byte[] ba) {
+        for (int i = 0; i < ba.length; i++) {
+            Assert.assertEquals(bs.byteAt(i), ba[i]);
+        }
     }
 
-    Assert.assertTrue(bs.toString().equals(str));
-  }
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testByteAtBadIndex1(final ByteSequence bs, final byte[] ba) {
+        bs.byteAt(ba.length);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testByteAtBadIndex2(final ByteSequence bs, final byte[] ba) {
+        bs.byteAt(-1);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testCopyTo(final ByteSequence bs, final byte[] ba) {
+        final byte[] newBa = new byte[ba.length];
+        bs.copyTo(newBa);
+        Assert.assertTrue(Arrays.equals(newBa, ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testCopyToByteSequenceBuilder(final ByteSequence bs, final byte[] ba) {
+        final ByteStringBuilder builder = new ByteStringBuilder();
+        bs.copyTo(builder);
+        Assert.assertTrue(Arrays.equals(builder.toByteArray(), ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testCopyToOutputStream(final ByteSequence bs, final byte[] ba) throws Exception {
+        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
+        bs.copyTo(stream);
+        Assert.assertTrue(Arrays.equals(stream.toByteArray(), ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testCopyToWithBadOffset(final ByteSequence bs, final byte[] ba) {
+        bs.copyTo(new byte[0], -1);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testCopyToWithOffset(final ByteSequence bs, final byte[] ba) {
+        for (int i = 0; i < ba.length * 2; i++) {
+            final byte[] newBa = new byte[ba.length * 2];
+            bs.copyTo(newBa, i);
+
+            final byte[] resultBa = new byte[ba.length * 2];
+            System.arraycopy(ba, 0, resultBa, i, Math.min(ba.length, ba.length * 2 - i));
+            Assert.assertTrue(Arrays.equals(newBa, resultBa));
+        }
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testEquals(final ByteSequence bs, final byte[] ba) throws Exception {
+        Assert.assertTrue(bs.equals(ByteString.wrap(ba)));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testLength(final ByteSequence bs, final byte[] ba) throws Exception {
+        Assert.assertEquals(bs.length(), ba.length);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testSubSequence(final ByteSequence bs, final byte[] ba) {
+        ByteSequence bsSub = bs.subSequence(0, bs.length() / 2);
+        byte[] baSub = new byte[ba.length / 2];
+        System.arraycopy(ba, 0, baSub, 0, baSub.length);
+        Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
+
+        bsSub = bs.subSequence(ba.length / 4, (bs.length() / 4) * 3);
+        baSub = new byte[(bs.length() / 4) * 3 - ba.length / 4];
+        System.arraycopy(ba, ba.length / 4, baSub, 0, baSub.length);
+        Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
+
+        bsSub = bs.subSequence(ba.length / 2, bs.length());
+        baSub = new byte[bs.length() - ba.length / 2];
+        System.arraycopy(ba, ba.length / 2, baSub, 0, baSub.length);
+        Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), baSub));
+
+        bsSub = bs.subSequence(0, bs.length());
+        Assert.assertTrue(Arrays.equals(bsSub.toByteArray(), ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testSubSequenceBadStartEnd1(final ByteSequence bs, final byte[] ba) {
+        bs.subSequence(-1, bs.length());
+    }
+
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testSubSequenceBadStartEnd2(final ByteSequence bs, final byte[] ba) {
+        bs.subSequence(0, bs.length() + 1);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider",
+            expectedExceptions = IndexOutOfBoundsException.class)
+    public void testSubSequenceBadStartEnd3(final ByteSequence bs, final byte[] ba) {
+        bs.subSequence(-1, bs.length() + 1);
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testToByteArray(final ByteSequence bs, final byte[] ba) {
+        Assert.assertTrue(Arrays.equals(bs.toByteArray(), ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testToByteSequence(final ByteSequence bs, final byte[] ba) {
+        Assert.assertTrue(Arrays.equals(bs.toByteString().toByteArray(), ba));
+    }
+
+    @Test(dataProvider = "byteSequenceProvider")
+    public void testToString(final ByteSequence bs, final byte[] ba) {
+        String str;
+        try {
+            str = new String(ba, "UTF-8");
+        } catch (final UnsupportedEncodingException uee) {
+            str = new String(ba);
+        }
+
+        Assert.assertTrue(bs.toString().equals(str));
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
index e17a376..3f66d61 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,290 +27,198 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.ByteSequenceReader;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test case for ByteStringBuilder.
  */
 @SuppressWarnings("javadoc")
-public class ByteStringBuilderTestCase extends ByteSequenceTestCase
-{
-  private static final byte[] eightBytes = new byte[] { (byte) 0x01,
-      (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
-      (byte) 0x07, (byte) 0x08 };
+public class ByteStringBuilderTestCase extends ByteSequenceTestCase {
+    private static final byte[] EIGHT_BYTES = new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
+        (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 };
 
+    /**
+     * ByteSequence data provider.
+     *
+     * @return The array of ByteStrings and the bytes it should contain.
+     */
+    @DataProvider(name = "byteSequenceProvider")
+    public Object[][] byteSequenceProvider() throws Exception {
+        final Object[][] builders = byteStringBuilderProvider();
+        final Object[][] addlSequences = new Object[builders.length + 1][];
+        System.arraycopy(builders, 0, addlSequences, 0, builders.length);
+        addlSequences[builders.length] =
+                new Object[] { new ByteStringBuilder().append(EIGHT_BYTES).subSequence(2, 6),
+                    new byte[] { (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06 } };
 
+        return addlSequences;
+    }
 
-  /**
-   * ByteSequence data provider.
-   *
-   * @return The array of ByteStrings and the bytes it should contain.
-   */
-  @DataProvider(name = "byteSequenceProvider")
-  public Object[][] byteSequenceProvider() throws Exception
-  {
-    final Object[][] builders = byteStringBuilderProvider();
-    final Object[][] addlSequences = new Object[builders.length + 1][];
-    System.arraycopy(builders, 0, addlSequences, 0, builders.length);
-    addlSequences[builders.length] = new Object[] {
-        new ByteStringBuilder().append(eightBytes).subSequence(2, 6),
-        new byte[] { (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06 } };
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadByteBufferLength1() {
+        new ByteStringBuilder().append(ByteBuffer.wrap(new byte[5]), -1);
+    }
 
-    return addlSequences;
-  }
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadByteBufferLength2() {
+        new ByteStringBuilder().append(ByteBuffer.wrap(new byte[5]), 6);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadByteSequenceReaderLength1() {
+        new ByteStringBuilder().append(ByteString.wrap(new byte[5]).asReader(), -1);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadByteSequenceReaderLength2() {
+        new ByteStringBuilder().append(ByteString.wrap(new byte[5]).asReader(), 6);
+    }
 
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadByteBufferLength1()
-  {
-    new ByteStringBuilder().append(ByteBuffer.wrap(new byte[5]), -1);
-  }
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadInputStreamLength() throws Exception {
+        final ByteArrayInputStream stream = new ByteArrayInputStream(new byte[5]);
+        new ByteStringBuilder().append(stream, -1);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadLength1() {
+        new ByteStringBuilder().append(new byte[5], 0, 6);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadLength2() {
+        new ByteStringBuilder().append(new byte[5], 0, -1);
+    }
 
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadByteBufferLength2()
-  {
-    new ByteStringBuilder().append(ByteBuffer.wrap(new byte[5]), 6);
-  }
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadOffset1() {
+        new ByteStringBuilder().append(new byte[5], -1, 3);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testAppendBadOffset2() {
+        new ByteStringBuilder().append(new byte[5], 6, 0);
+    }
 
+    @Test
+    public void testAppendInputStream() throws Exception {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        final ByteArrayInputStream stream = new ByteArrayInputStream(new byte[5]);
+        Assert.assertEquals(bsb.append(stream, 10), 5);
+    }
 
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadByteSequenceReaderLength1()
-  {
-    new ByteStringBuilder().append(ByteString.wrap(new byte[5]).asReader(), -1);
-  }
+    @Test(dataProvider = "builderProvider", expectedExceptions = IndexOutOfBoundsException.class)
+    public void testClear(final ByteStringBuilder bs, final byte[] ba) {
+        bs.clear();
+        Assert.assertEquals(bs.length(), 0);
+        bs.byteAt(0);
+    }
 
+    @Test
+    public void testEnsureAdditionalCapacity() {
+        final ByteStringBuilder bsb = new ByteStringBuilder(8);
+        Assert.assertEquals(bsb.getBackingArray().length, 8);
+        bsb.ensureAdditionalCapacity(43);
+        bsb.ensureAdditionalCapacity(2);
+        Assert.assertTrue(bsb.getBackingArray().length >= 43);
+    }
 
+    @Test(dataProvider = "builderProvider")
+    public void testGetBackingArray(final ByteStringBuilder bs, final byte[] ba) {
+        final byte[] trimmedArray = new byte[bs.length()];
+        System.arraycopy(bs.getBackingArray(), 0, trimmedArray, 0, bs.length());
+        Assert.assertTrue(Arrays.equals(trimmedArray, ba));
+    }
 
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadByteSequenceReaderLength2()
-  {
-    new ByteStringBuilder().append(ByteString.wrap(new byte[5]).asReader(), 6);
-  }
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalidCapacity() {
+        new ByteStringBuilder(-1);
+    }
 
+    @Test
+    public void testTrimToSize() {
+        final ByteStringBuilder bsb = new ByteStringBuilder();
+        bsb.append(EIGHT_BYTES);
+        Assert.assertTrue(bsb.getBackingArray().length > 8);
+        bsb.trimToSize();
+        Assert.assertEquals(bsb.getBackingArray().length, 8);
+    }
 
+    @DataProvider(name = "builderProvider")
+    private Object[][] byteStringBuilderProvider() throws Exception {
+        final ByteBuffer testBuffer = ByteBuffer.wrap(EIGHT_BYTES);
+        final ByteString testByteString = ByteString.wrap(EIGHT_BYTES);
+        final ByteSequenceReader testByteReader = testByteString.asReader();
+        final InputStream testStream = new ByteArrayInputStream(EIGHT_BYTES);
+        final ByteStringBuilder testBuilderFromStream = new ByteStringBuilder(8);
+        testBuilderFromStream.append(testStream, 8);
 
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadInputStreamLength() throws Exception
-  {
-    final ByteArrayInputStream stream = new ByteArrayInputStream(new byte[5]);
-    new ByteStringBuilder().append(stream, -1);
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadLength1()
-  {
-    new ByteStringBuilder().append(new byte[5], 0, 6);
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadLength2()
-  {
-    new ByteStringBuilder().append(new byte[5], 0, -1);
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadOffset1()
-  {
-    new ByteStringBuilder().append(new byte[5], -1, 3);
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testAppendBadOffset2()
-  {
-    new ByteStringBuilder().append(new byte[5], 6, 0);
-  }
-
-
-
-  @Test
-  public void testAppendInputStream() throws Exception
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    final ByteArrayInputStream stream = new ByteArrayInputStream(new byte[5]);
-    Assert.assertEquals(bsb.append(stream, 10), 5);
-  }
-
-
-
-  @Test(dataProvider = "builderProvider", expectedExceptions = IndexOutOfBoundsException.class)
-  public void testClear(final ByteStringBuilder bs, final byte[] ba)
-  {
-    bs.clear();
-    Assert.assertEquals(bs.length(), 0);
-    bs.byteAt(0);
-  }
-
-
-
-  @Test
-  public void testEnsureAdditionalCapacity()
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder(8);
-    Assert.assertEquals(bsb.getBackingArray().length, 8);
-    bsb.ensureAdditionalCapacity(43);
-    bsb.ensureAdditionalCapacity(2);
-    Assert.assertTrue(bsb.getBackingArray().length >= 43);
-  }
-
-
-
-  @Test(dataProvider = "builderProvider")
-  public void testGetBackingArray(final ByteStringBuilder bs, final byte[] ba)
-  {
-    final byte[] trimmedArray = new byte[bs.length()];
-    System.arraycopy(bs.getBackingArray(), 0, trimmedArray, 0, bs.length());
-    Assert.assertTrue(Arrays.equals(trimmedArray, ba));
-  }
-
-
-
-  @Test(expectedExceptions = IllegalArgumentException.class)
-  public void testInvalidCapacity()
-  {
-    new ByteStringBuilder(-1);
-  }
-
-
-
-  @Test
-  public void testTrimToSize()
-  {
-    final ByteStringBuilder bsb = new ByteStringBuilder();
-    bsb.append(eightBytes);
-    Assert.assertTrue(bsb.getBackingArray().length > 8);
-    bsb.trimToSize();
-    Assert.assertEquals(bsb.getBackingArray().length, 8);
-  }
-
-
-
-  @DataProvider(name = "builderProvider")
-  private Object[][] byteStringBuilderProvider() throws Exception
-  {
-    final ByteBuffer testBuffer = ByteBuffer.wrap(eightBytes);
-    final ByteString testByteString = ByteString.wrap(eightBytes);
-    final ByteSequenceReader testByteReader = testByteString.asReader();
-    final InputStream testStream = new ByteArrayInputStream(eightBytes);
-    final ByteStringBuilder testBuilderFromStream = new ByteStringBuilder(8);
-    testBuilderFromStream.append(testStream, 8);
-
-    return new Object[][] {
-        { new ByteStringBuilder().append((byte) 0x00).append((byte) 0x01),
-            new byte[] { (byte) 0x00, (byte) 0x01 } },
-        {
-            new ByteStringBuilder(5)
-                .append(
-                    new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                        (byte) 0x04 }).append(
-                    new byte[] { (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                        (byte) 0x08 }), eightBytes },
-        {
-            new ByteStringBuilder(3).append(eightBytes, 0, 3).append(
-                eightBytes, 3, 5), eightBytes },
-        { new ByteStringBuilder().append(testBuffer, 3).append(testBuffer, 5),
-            eightBytes },
-        { new ByteStringBuilder(2).append(testByteString), eightBytes },
-        {
-            new ByteStringBuilder().append(testByteReader, 5).append(
-                testByteReader, 3), eightBytes },
-        { testBuilderFromStream, eightBytes },
-        {
-            new ByteStringBuilder().append(Short.MIN_VALUE).append(
-                Short.MAX_VALUE),
-            new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x7F, (byte) 0xFF } },
-        {
-            new ByteStringBuilder(5).append(Integer.MIN_VALUE).append(
-                Integer.MAX_VALUE),
-            new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
-        {
-            new ByteStringBuilder().append(Long.MIN_VALUE).append(
-                Long.MAX_VALUE),
-            new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
-        { new ByteStringBuilder(11).append("this is a").append(" test"),
-            "this is a test".getBytes("UTF-8") },
-        {
-            new ByteStringBuilder().append((Object) "this is a").append(
-                (Object) " test"), "this is a test".getBytes("UTF-8") },
-        {
-            new ByteStringBuilder().append("this is a".toCharArray()).append(
-                " test".toCharArray()), "this is a test".getBytes("UTF-8") },
-        {
-            new ByteStringBuilder().append((Object) "this is a".toCharArray())
-                .append((Object) " test".toCharArray()),
-            "this is a test".getBytes("UTF-8") },
-        {
-            new ByteStringBuilder().append((Object) eightBytes).append(
-                (Object) eightBytes),
-            new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
-                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08,
-                (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
-                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
-        {
-            new ByteStringBuilder().appendBERLength(0x00000000)
-                .appendBERLength(0x00000001).appendBERLength(0x0000000F)
-                .appendBERLength(0x00000010).appendBERLength(0x0000007F).
-
-                appendBERLength(0x000000FF).
-
-                appendBERLength(0x00000100).appendBERLength(0x00000FFF)
-                .appendBERLength(0x00001000).appendBERLength(0x0000FFFF).
-
-                appendBERLength(0x00010000).appendBERLength(0x000FFFFF)
-                .appendBERLength(0x00100000).appendBERLength(0x00FFFFFF).
-
-                appendBERLength(0x01000000).appendBERLength(0x0FFFFFFF)
-                .appendBERLength(0x10000000).appendBERLength(0xFFFFFFFF),
-
-            new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x0F, (byte) 0x10,
-                (byte) 0x7F,
-
-                (byte) 0x81, (byte) 0xFF,
-
-                (byte) 0x82, (byte) 0x01, (byte) 0x00, (byte) 0x82,
-                (byte) 0x0F, (byte) 0xFF, (byte) 0x82, (byte) 0x10,
-                (byte) 0x00, (byte) 0x82, (byte) 0xFF, (byte) 0xFF,
-
-                (byte) 0x83, (byte) 0x01, (byte) 0x00, (byte) 0x00,
-                (byte) 0x83, (byte) 0x0F, (byte) 0xFF, (byte) 0xFF,
-                (byte) 0x83, (byte) 0x10, (byte) 0x00, (byte) 0x00,
-                (byte) 0x83, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-
-                (byte) 0x84, (byte) 0x01, (byte) 0x00, (byte) 0x00,
-                (byte) 0x00, (byte) 0x84, (byte) 0x0F, (byte) 0xFF,
-                (byte) 0xFF, (byte) 0xFF, (byte) 0x84, (byte) 0x10,
-                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x84,
-                (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
-
-    };
-  }
+        return new Object[][] {
+            { new ByteStringBuilder().append((byte) 0x00).append((byte) 0x01),
+                new byte[] { (byte) 0x00, (byte) 0x01 } },
+            {
+                new ByteStringBuilder(5).append(
+                        new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04 }).append(
+                        new byte[] { (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 }),
+                EIGHT_BYTES },
+            { new ByteStringBuilder(3).append(EIGHT_BYTES, 0, 3).append(EIGHT_BYTES, 3, 5),
+                EIGHT_BYTES },
+            { new ByteStringBuilder().append(testBuffer, 3).append(testBuffer, 5), EIGHT_BYTES },
+            { new ByteStringBuilder(2).append(testByteString), EIGHT_BYTES },
+            { new ByteStringBuilder().append(testByteReader, 5).append(testByteReader, 3),
+                EIGHT_BYTES },
+            { testBuilderFromStream, EIGHT_BYTES },
+            { new ByteStringBuilder().append(Short.MIN_VALUE).append(Short.MAX_VALUE),
+                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x7F, (byte) 0xFF } },
+            {
+                new ByteStringBuilder(5).append(Integer.MIN_VALUE).append(Integer.MAX_VALUE),
+                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x7F,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
+            {
+                new ByteStringBuilder().append(Long.MIN_VALUE).append(Long.MAX_VALUE),
+                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x7F, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
+            { new ByteStringBuilder(11).append("this is a").append(" test"),
+                "this is a test".getBytes("UTF-8") },
+            { new ByteStringBuilder().append((Object) "this is a").append((Object) " test"),
+                "this is a test".getBytes("UTF-8") },
+            {
+                new ByteStringBuilder().append("this is a".toCharArray()).append(
+                        " test".toCharArray()), "this is a test".getBytes("UTF-8") },
+            {
+                new ByteStringBuilder().append((Object) "this is a".toCharArray()).append(
+                        (Object) " test".toCharArray()), "this is a test".getBytes("UTF-8") },
+            {
+                new ByteStringBuilder().append((Object) EIGHT_BYTES).append((Object) EIGHT_BYTES),
+                new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
+                    (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x01, (byte) 0x02, (byte) 0x03,
+                    (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
+            {
+                new ByteStringBuilder().appendBERLength(0x00000000).appendBERLength(0x00000001)
+                        .appendBERLength(0x0000000F).appendBERLength(0x00000010).appendBERLength(
+                                0x0000007F).appendBERLength(0x000000FF).appendBERLength(0x00000100)
+                        .appendBERLength(0x00000FFF).appendBERLength(0x00001000).appendBERLength(
+                                0x0000FFFF).appendBERLength(0x00010000).appendBERLength(0x000FFFFF)
+                        .appendBERLength(0x00100000).appendBERLength(0x00FFFFFF).appendBERLength(
+                                0x01000000).appendBERLength(0x0FFFFFFF).appendBERLength(0x10000000)
+                        .appendBERLength(0xFFFFFFFF),
+                new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x0F, (byte) 0x10, (byte) 0x7F,
+                    (byte) 0x81, (byte) 0xFF, (byte) 0x82, (byte) 0x01, (byte) 0x00, (byte) 0x82,
+                    (byte) 0x0F, (byte) 0xFF, (byte) 0x82, (byte) 0x10, (byte) 0x00, (byte) 0x82,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0x83, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+                    (byte) 0x83, (byte) 0x0F, (byte) 0xFF, (byte) 0xFF, (byte) 0x83, (byte) 0x10,
+                    (byte) 0x00, (byte) 0x00, (byte) 0x83, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0x84, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x84,
+                    (byte) 0x0F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x84, (byte) 0x10,
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x84, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF } }, };
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
index 711f278..2eb9091 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,189 +27,142 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.ByteString;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This class defines a set of tests for the ByteString class.
  */
 @SuppressWarnings("javadoc")
-public class ByteStringTestCase extends ByteSequenceTestCase
-{
-  /**
-   * ByteString data provider.
-   *
-   * @return The array of ByteStrings and the bytes it should contain.
-   */
-  @DataProvider(name = "byteSequenceProvider")
-  public Object[][] byteSequenceProvider() throws Exception
-  {
-    byte[] testBytes = new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-        (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-        (byte) 0x08 };
+public class ByteStringTestCase extends ByteSequenceTestCase {
+    /**
+     * ByteString data provider.
+     *
+     * @return The array of ByteStrings and the bytes it should contain.
+     */
+    @DataProvider(name = "byteSequenceProvider")
+    public Object[][] byteSequenceProvider() throws Exception {
+        byte[] testBytes =
+                new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
+                    (byte) 0x06, (byte) 0x07, (byte) 0x08 };
 
-    return new Object[][] {
-        { ByteString.empty(), new byte[0] },
-        { ByteString.valueOf(1),
-            new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 } },
-        { ByteString.valueOf(Integer.MAX_VALUE),
-            new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
-        { ByteString.valueOf(Integer.MIN_VALUE),
-            new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
-        {
-            ByteString.valueOf(Long.MAX_VALUE),
-            new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
-        {
-            ByteString.valueOf(Long.MIN_VALUE),
-            new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
-        { ByteString.valueOf("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
-        { ByteString.valueOf((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
-        { ByteString.valueOf("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
-        { ByteString.valueOf((Object) "cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
-        { ByteString.valueOf(testBytes), testBytes },
-        { ByteString.valueOf((Object) testBytes), testBytes },
-        { ByteString.valueOf(ByteString.valueOf("cn=testvalue")), "cn=testvalue".getBytes("UTF-8") },
-        { ByteString.wrap(new byte[0]), new byte[0] },
-        {
-            ByteString
-                .wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                    (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                    (byte) 0x08 }),
-            new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
-                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
-        {
-            ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                (byte) 0x08, (byte) 0x09, (byte) 0x10 }, 0, 8),
-            new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
-                (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
-        {
-            ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                (byte) 0x08, (byte) 0x09, (byte) 0x10 }, 1, 8),
-            new byte[] { (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
-                (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09 } },
-        {
-            ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                (byte) 0x08, (byte) 0x09, (byte) 0x10 }, 2, 8),
-            new byte[] { (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
-                (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x10 } },
-        {
-            ByteString.wrap(
-                new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03,
-                    (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-                    (byte) 0x08 }, 3, 0), new byte[0] }, };
-  }
+        return new Object[][] {
+            { ByteString.empty(), new byte[0] },
+            { ByteString.valueOf(1),
+                new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 } },
+            { ByteString.valueOf(Integer.MAX_VALUE),
+                new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
+            { ByteString.valueOf(Integer.MIN_VALUE),
+                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
+            {
+                ByteString.valueOf(Long.MAX_VALUE),
+                new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } },
+            {
+                ByteString.valueOf(Long.MIN_VALUE),
+                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
+            { ByteString.valueOf("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
+            { ByteString.valueOf((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
+            { ByteString.valueOf("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
+            { ByteString.valueOf((Object) "cn=testvalue".toCharArray()),
+                "cn=testvalue".getBytes("UTF-8") },
+            { ByteString.valueOf(testBytes), testBytes },
+            { ByteString.valueOf((Object) testBytes), testBytes },
+            { ByteString.valueOf(ByteString.valueOf("cn=testvalue")),
+                "cn=testvalue".getBytes("UTF-8") },
+            { ByteString.wrap(new byte[0]), new byte[0] },
+            {
+                ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                    (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 }),
+                new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
+                    (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
+            {
+                ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                    (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x10 },
+                        0, 8),
+                new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
+                    (byte) 0x06, (byte) 0x07, (byte) 0x08 } },
+            {
+                ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                    (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x10 },
+                        1, 8),
+                new byte[] { (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
+                    (byte) 0x07, (byte) 0x08, (byte) 0x09 } },
+            {
+                ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                    (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x10 },
+                        2, 8),
+                new byte[] { (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
+                    (byte) 0x08, (byte) 0x09, (byte) 0x10 } },
+            {
+                ByteString.wrap(new byte[] { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+                    (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08 }, 3, 0), new byte[0] }, };
+    }
 
+    @DataProvider(name = "byteStringIntegerProvider")
+    public Object[][] byteStringIntegerProvider() {
+        return new Object[][] { { ByteString.valueOf(0), 0 }, { ByteString.valueOf(1), 1 },
+            { ByteString.valueOf(Integer.MAX_VALUE), Integer.MAX_VALUE },
+            { ByteString.valueOf(Integer.MIN_VALUE), Integer.MIN_VALUE }, };
+    }
 
+    @DataProvider(name = "byteStringLongProvider")
+    public Object[][] byteStringLongProvider() {
+        return new Object[][] { { ByteString.valueOf(0L), 0L }, { ByteString.valueOf(1L), 1L },
+            { ByteString.valueOf(Long.MAX_VALUE), Long.MAX_VALUE },
+            { ByteString.valueOf(Long.MIN_VALUE), Long.MIN_VALUE } };
+    }
 
-  @DataProvider(name = "byteStringIntegerProvider")
-  public Object[][] byteStringIntegerProvider()
-  {
-    return new Object[][] { { ByteString.valueOf(0), 0 },
-        { ByteString.valueOf(1), 1 },
-        { ByteString.valueOf(Integer.MAX_VALUE), Integer.MAX_VALUE },
-        { ByteString.valueOf(Integer.MIN_VALUE), Integer.MIN_VALUE }, };
-  }
+    @DataProvider(name = "byteStringCharArrayProvider")
+    public Object[][] byteStringCharArrayProvider() {
+        return new Object[][] { { "" }, { "1" }, { "1234567890" } };
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testInvalidWrapLength() {
+        ByteString.wrap(new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03 }, 2, 8);
+    }
 
+    @Test(dataProvider = "byteStringIntegerProvider")
+    public void testToInteger(final ByteString bs, final int i) {
+        Assert.assertEquals(bs.toInt(), i);
+    }
 
-  @DataProvider(name = "byteStringLongProvider")
-  public Object[][] byteStringLongProvider()
-  {
-    return new Object[][] { { ByteString.valueOf(0L), 0L },
-        { ByteString.valueOf(1L), 1L },
-        { ByteString.valueOf(Long.MAX_VALUE), Long.MAX_VALUE },
-        { ByteString.valueOf(Long.MIN_VALUE), Long.MIN_VALUE } };
-  }
+    @Test(dataProvider = "byteStringLongProvider")
+    public void testToLong(final ByteString bs, final long l) {
+        Assert.assertEquals(bs.toLong(), l);
+    }
 
+    @Test(dataProvider = "byteStringCharArrayProvider")
+    public void testFromStringToCharArray(final String s) {
+        ByteString bs = ByteString.valueOf(s);
+        Assert.assertTrue(Arrays.equals(bs.toCharArray(), s.toCharArray()));
+    }
 
+    @Test(dataProvider = "byteStringCharArrayProvider")
+    public void testFromCharArrayToCharArray(final String s) {
+        final char[] chars = s.toCharArray();
+        ByteString bs = ByteString.valueOf(chars);
+        Assert.assertTrue(Arrays.equals(bs.toCharArray(), chars));
+    }
 
-  @DataProvider(name = "byteStringCharArrayProvider")
-  public Object[][] byteStringCharArrayProvider()
-  {
-    return new Object[][] { { "" }, { "1" }, { "1234567890" } };
-  }
+    @Test(dataProvider = "byteStringCharArrayProvider")
+    public void testValueOfCharArray(final String s) {
+        ByteString bs = ByteString.valueOf(s.toCharArray());
+        Assert.assertEquals(bs.toString(), s);
+    }
 
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testUndersizedToInteger() {
+        ByteString.wrap(new byte[] { (byte) 0x00, (byte) 0x01 }).toInt();
+    }
 
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testInvalidWrapLength()
-  {
-    ByteString.wrap(new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x02,
-        (byte) 0x03 }, 2, 8);
-  }
-
-
-
-  @Test(dataProvider = "byteStringIntegerProvider")
-  public void testToInteger(final ByteString bs, final int i)
-  {
-    Assert.assertEquals(bs.toInt(), i);
-  }
-
-
-
-  @Test(dataProvider = "byteStringLongProvider")
-  public void testToLong(final ByteString bs, final long l)
-  {
-    Assert.assertEquals(bs.toLong(), l);
-  }
-
-
-
-  @Test(dataProvider = "byteStringCharArrayProvider")
-  public void testFromStringToCharArray(final String s)
-  {
-    ByteString bs = ByteString.valueOf(s);
-    Assert.assertTrue(Arrays.equals(bs.toCharArray(), s.toCharArray()));
-  }
-
-
-
-  @Test(dataProvider = "byteStringCharArrayProvider")
-  public void testFromCharArrayToCharArray(final String s)
-  {
-    final char[] chars = s.toCharArray();
-    ByteString bs = ByteString.valueOf(chars);
-    Assert.assertTrue(Arrays.equals(bs.toCharArray(), chars));
-  }
-
-
-
-  @Test(dataProvider = "byteStringCharArrayProvider")
-  public void testValueOfCharArray(final String s)
-  {
-    ByteString bs = ByteString.valueOf(s.toCharArray());
-    Assert.assertEquals(bs.toString(), s);
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testUndersizedToInteger()
-  {
-    ByteString.wrap(new byte[] { (byte) 0x00, (byte) 0x01 }).toInt();
-  }
-
-
-
-  @Test(expectedExceptions = IndexOutOfBoundsException.class)
-  public void testUndersizedToLong()
-  {
-    ByteString.wrap(
-        new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03 })
-        .toLong();
-  }
+    @Test(expectedExceptions = IndexOutOfBoundsException.class)
+    public void testUndersizedToLong() {
+        ByteString.wrap(new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03 }).toLong();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
index aeb42b3..180889c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,14 +27,13 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.fest.assertions.Assertions.assertThat;
-
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
 
 import java.net.InetSocketAddress;
 import java.util.Arrays;
@@ -62,430 +60,375 @@
 import com.forgerock.opendj.util.CompletedFutureResult;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Tests the {@code ConnectionFactory} classes.
  */
 @SuppressWarnings("javadoc")
-public class ConnectionFactoryTestCase extends SdkTestCase
-{
-  class MyResultHandler implements ResultHandler<Connection>
-  {
-    // latch.
-    private final CountDownLatch latch;
-    // invalid flag.
-    private volatile ErrorResultException error;
+public class ConnectionFactoryTestCase extends SdkTestCase {
+    class MyResultHandler implements ResultHandler<Connection> {
+        // latch.
+        private final CountDownLatch latch;
+        // invalid flag.
+        private volatile ErrorResultException error;
 
+        MyResultHandler(final CountDownLatch latch) {
+            this.latch = latch;
+        }
 
+        public void handleErrorResult(final ErrorResultException error) {
+            // came here.
+            this.error = error;
+            latch.countDown();
+        }
 
-    MyResultHandler(final CountDownLatch latch)
-    {
-      this.latch = latch;
+        public void handleResult(final Connection con) {
+            //
+            latch.countDown();
+        }
     }
 
-
-
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      // came here.
-      this.error = error;
-      latch.countDown();
+    /**
+     * Ensures that the LDAP Server is running.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @BeforeClass()
+    public void startServer() throws Exception {
+        TestCaseUtils.startServer();
     }
 
-
-
-    public void handleResult(final Connection con)
-    {
-      //
-      latch.countDown();
-    }
-  }
-
-
-
-  /**
-   * Ensures that the LDAP Server is running.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @BeforeClass()
-  public void startServer() throws Exception
-  {
-    TestCaseUtils.startServer();
-  }
-
-
-
-  /**
-   * Disables logging before the tests.
-   */
-  @BeforeClass()
-  public void disableLogging()
-  {
-    StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
-  }
-
-
-
-  /**
-   * Re-enable logging after the tests.
-   */
-  @AfterClass()
-  public void enableLogging()
-  {
-    StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
-  }
-
-
-
-  @DataProvider(name = "connectionFactories")
-  public Object[][] getConnectionFactories() throws Exception
-  {
-    Object[][] factories = new Object[21][1];
-
-    // HeartBeatConnectionFactory
-    // Use custom search request.
-    SearchRequest request = Requests.newSearchRequest(
-        "uid=user.0,ou=people,o=test", SearchScope.BASE_OBJECT,
-        "objectclass=*", "cn");
-
-    factories[0][0] = new HeartBeatConnectionFactory(new LDAPConnectionFactory(
-        "localhost", TestCaseUtils.getLdapPort()), 1000, TimeUnit.MILLISECONDS,
-        request);
-
-    // InternalConnectionFactory
-    factories[1][0] = Connections.newInternalConnectionFactory(
-        LDAPServer.getInstance(), null);
-
-    // AuthenticatedConnectionFactory
-    factories[2][0] = new AuthenticatedConnectionFactory(
-        new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort()),
-        Requests.newSimpleBindRequest("", new char[0]));
-
-    // AuthenticatedConnectionFactory with multi-stage SASL
-    factories[3][0] = new AuthenticatedConnectionFactory(
-        new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort()),
-        Requests.newCRAMMD5SASLBindRequest("id:user", "password".toCharArray()));
-
-    // LDAPConnectionFactory with default options
-    factories[4][0] = new LDAPConnectionFactory("localhost",
-        TestCaseUtils.getLdapPort());
-
-    // LDAPConnectionFactory with startTLS
-    SSLContext sslContext = new SSLContextBuilder().setTrustManager(
-        TrustManagers.trustAll()).getSSLContext();
-    LDAPOptions options = new LDAPOptions()
-        .setSSLContext(sslContext)
-        .setUseStartTLS(true)
-        .addEnabledCipherSuite(
-            new String[] { "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
-                "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
-                "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
-                "SSL_DH_anon_WITH_DES_CBC_SHA", "SSL_DH_anon_WITH_RC4_128_MD5",
-                "TLS_DH_anon_WITH_AES_128_CBC_SHA",
-                "TLS_DH_anon_WITH_AES_256_CBC_SHA" });
-    factories[5][0] = new LDAPConnectionFactory("localhost",
-        TestCaseUtils.getLdapPort(), options);
-
-    // startTLS + SASL confidentiality
-    // Use IP address here so that DIGEST-MD5 host verification works if local
-    // host name is not localhost (e.g. on some machines it might be
-    // localhost.localdomain).
-    factories[6][0] = new AuthenticatedConnectionFactory(
-        new LDAPConnectionFactory(new InetSocketAddress("127.0.0.1",
-            TestCaseUtils.getLdapPort()), options), Requests
-            .newDigestMD5SASLBindRequest("id:user", "password".toCharArray())
-            .addQOP(DigestMD5SASLBindRequest.QOP_AUTH_CONF)
-            .setCipher(DigestMD5SASLBindRequest.CIPHER_LOW));
-
-    // Connection pool and load balancing tests.
-    ConnectionFactory offlineServer1 = Connections.newNamedConnectionFactory(
-        new LDAPConnectionFactory("localhost", TestCaseUtils.findFreePort()),
-        "offline1");
-    ConnectionFactory offlineServer2 = Connections.newNamedConnectionFactory(
-        new LDAPConnectionFactory("localhost", TestCaseUtils.findFreePort()),
-        "offline2");
-    ConnectionFactory onlineServer = Connections.newNamedConnectionFactory(
-        new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort()),
-        "online");
-
-    // Connection pools.
-    factories[7][0] = Connections.newFixedConnectionPool(onlineServer, 10);
-
-    // Round robin.
-    factories[8][0] = Connections
-        .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
-            onlineServer, offlineServer1)));
-    factories[9][0] = factories[8][0];
-    factories[10][0] = factories[8][0];
-    factories[11][0] = Connections
-        .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
-            offlineServer1, onlineServer)));
-    factories[12][0] = Connections
-        .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
-            offlineServer1, offlineServer2, onlineServer)));
-    factories[13][0] = Connections
-        .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
-            .<ConnectionFactory> asList(
-                Connections.newFixedConnectionPool(offlineServer1, 10),
-                Connections.newFixedConnectionPool(onlineServer, 10))));
-
-    // Fail-over.
-    factories[14][0] = Connections
-        .newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
-            onlineServer, offlineServer1)));
-    factories[15][0] = factories[14][0];
-    factories[16][0] = factories[14][0];
-    factories[17][0] = Connections
-        .newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
-            offlineServer1, onlineServer)));
-    factories[18][0] = Connections
-        .newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
-            offlineServer1, offlineServer2, onlineServer)));
-    factories[19][0] = Connections
-        .newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays
-            .<ConnectionFactory> asList(
-                Connections.newFixedConnectionPool(offlineServer1, 10),
-                Connections.newFixedConnectionPool(onlineServer, 10))));
-
-    factories[20][0] = Connections.newFixedConnectionPool(onlineServer, 10);
-
-    return factories;
-  }
-
-
-
-  /**
-   * Tests the async connection in the blocking mode. This is not fully async as
-   * it blocks on the future.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "connectionFactories")
-  public void testBlockingFutureNoHandler(ConnectionFactory factory)
-      throws Exception
-  {
-    final FutureResult<Connection> future = factory.getConnectionAsync(null);
-    final Connection con = future.get();
-    // quickly check if it is a valid connection.
-    // Don't use a result handler.
-    assertNotNull(con.readEntryAsync(DN.rootDN(), null, null).get());
-    con.close();
-  }
-
-
-
-  /**
-   * Tests the non-blocking fully async connection using a handler.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "connectionFactories")
-  public void testNonBlockingFutureWithHandler(ConnectionFactory factory)
-      throws Exception
-  {
-    // Use the handler to get the result asynchronously.
-    final CountDownLatch latch = new CountDownLatch(1);
-    final MyResultHandler handler = new MyResultHandler(latch);
-    factory.getConnectionAsync(handler);
-
-    // Since we don't have anything to do, we would rather
-    // be notified by the latch when the other thread calls our handler.
-    latch.await(); // should do a timed wait rather?
-    if (handler.error != null)
-    {
-      throw handler.error;
-    }
-  }
-
-
-
-  /**
-   * Tests the synchronous connection.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "connectionFactories")
-  public void testSynchronousConnection(ConnectionFactory factory)
-      throws Exception
-  {
-    final Connection con = factory.getConnection();
-    assertNotNull(con);
-    // quickly check if it is a valid connection.
-    assertTrue(con.readEntry("").getName().isRootDN());
-    con.close();
-  }
-
-
-
-  /**
-   * Verifies that LDAP connections take into consideration changes to the
-   * default schema post creation. See OPENDJ-159.
-   * <p>
-   * This test is disabled because it cannot be run in parallel with rest of the
-   * test suite, because it modifies the global default schema.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test(enabled = false)
-  public void testSchemaUsage() throws Exception
-  {
-    // Create a connection factory: this should always use the default schema,
-    // even if it is updated.
-    final ConnectionFactory factory = new LDAPConnectionFactory("localhost",
-        TestCaseUtils.getLdapPort());
-    final Schema defaultSchema = Schema.getDefaultSchema();
-
-    final Connection connection = factory.getConnection();
-    try
-    {
-      // Simulate a client which reads the schema from the server and then
-      // sets it as the application default. We then want subsequent
-      // operations to use this schema, not the original default.
-      final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-      builder.addAttributeType(
-          "( 0.9.2342.19200300.100.1.3 NAME 'mail' EQUALITY "
-              + "caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch "
-              + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )", false);
-      final Schema testSchema = builder.toSchema().asNonStrictSchema();
-      assertThat(testSchema.getWarnings()).isEmpty();
-      Schema.setDefaultSchema(testSchema);
-
-      // Read an entry containing the mail attribute.
-      final SearchResultEntry e = connection
-          .readEntry("uid=user.0,ou=people,o=test");
-
-      assertThat(e.getAttribute("mail")).isNotNull();
-      assertThat(
-          e.getAttribute(AttributeDescription.valueOf("mail", testSchema)))
-          .isNotNull();
-    }
-    finally
-    {
-      // Restore original schema.
-      Schema.setDefaultSchema(defaultSchema);
-
-      // Close connection.
-      connection.close();
-    }
-  }
-
-
-
-  /**
-   * Tests connection pool closure.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @SuppressWarnings("unchecked")
-  @Test
-  public void testConnectionPoolClose() throws Exception
-  {
-    // We'll use a pool of 4 connections.
-    final int SIZE = 4;
-
-    // Count number of real connections which are open.
-    final AtomicInteger realConnectionCount = new AtomicInteger();
-    final boolean[] realConnectionIsClosed = new boolean[SIZE];
-    Arrays.fill(realConnectionIsClosed, true);
-
-    // Mock underlying connection factory which always succeeds.
-    final ConnectionFactory mockFactory = mock(ConnectionFactory.class);
-    when(mockFactory.getConnectionAsync(any(ResultHandler.class))).thenAnswer(
-        new Answer<FutureResult<Connection>>()
-        {
-
-          public FutureResult<Connection> answer(InvocationOnMock invocation)
-              throws Throwable
-          {
-            // Update state.
-            final int connectionID = realConnectionCount.getAndIncrement();
-            realConnectionIsClosed[connectionID] = false;
-
-            // Mock connection decrements counter on close.
-            Connection mockConnection = mock(Connection.class);
-            doAnswer(new Answer<Void>()
-            {
-              public Void answer(InvocationOnMock invocation) throws Throwable
-              {
-                realConnectionCount.decrementAndGet();
-                realConnectionIsClosed[connectionID] = true;
-                return null;
-              }
-            }).when(mockConnection).close();
-            when(mockConnection.isValid()).thenReturn(true);
-            when(mockConnection.toString()).thenReturn(
-                "Mock connection " + connectionID);
-
-            // Execute handler and return future.
-            ResultHandler<? super Connection> handler = (ResultHandler<? super Connection>) invocation
-                .getArguments()[0];
-            if (handler != null)
-            {
-              handler.handleResult(mockConnection);
-            }
-            return new CompletedFutureResult<Connection>(mockConnection);
-          }
-        });
-
-    ConnectionPool pool = Connections.newFixedConnectionPool(mockFactory, SIZE);
-    Connection[] pooledConnections = new Connection[SIZE];
-    for (int i = 0; i < SIZE; i++)
-    {
-      pooledConnections[i] = pool.getConnection();
+    /**
+     * Disables logging before the tests.
+     */
+    @BeforeClass()
+    public void disableLogging() {
+        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
     }
 
-    // Pool is fully utilized.
-    assertThat(realConnectionCount.get()).isEqualTo(SIZE);
-    assertThat(pooledConnections[0].isClosed()).isFalse();
-    assertThat(pooledConnections[1].isClosed()).isFalse();
-    assertThat(pooledConnections[2].isClosed()).isFalse();
-    assertThat(pooledConnections[3].isClosed()).isFalse();
-    assertThat(realConnectionIsClosed[0]).isFalse();
-    assertThat(realConnectionIsClosed[1]).isFalse();
-    assertThat(realConnectionIsClosed[2]).isFalse();
-    assertThat(realConnectionIsClosed[3]).isFalse();
+    /**
+     * Re-enable logging after the tests.
+     */
+    @AfterClass()
+    public void enableLogging() {
+        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
+    }
 
-    // Release two connections.
-    pooledConnections[0].close();
-    pooledConnections[1].close();
-    assertThat(realConnectionCount.get()).isEqualTo(4);
-    assertThat(pooledConnections[0].isClosed()).isTrue();
-    assertThat(pooledConnections[1].isClosed()).isTrue();
-    assertThat(pooledConnections[2].isClosed()).isFalse();
-    assertThat(pooledConnections[3].isClosed()).isFalse();
-    assertThat(realConnectionIsClosed[0]).isFalse();
-    assertThat(realConnectionIsClosed[1]).isFalse();
-    assertThat(realConnectionIsClosed[2]).isFalse();
-    assertThat(realConnectionIsClosed[3]).isFalse();
+    @DataProvider(name = "connectionFactories")
+    public Object[][] getConnectionFactories() throws Exception {
+        Object[][] factories = new Object[21][1];
 
-    // Close the pool closing the two connections immediately.
-    pool.close();
-    assertThat(realConnectionCount.get()).isEqualTo(2);
-    assertThat(pooledConnections[0].isClosed()).isTrue();
-    assertThat(pooledConnections[1].isClosed()).isTrue();
-    assertThat(pooledConnections[2].isClosed()).isFalse();
-    assertThat(pooledConnections[3].isClosed()).isFalse();
-    assertThat(realConnectionIsClosed[0]).isTrue();
-    assertThat(realConnectionIsClosed[1]).isTrue();
-    assertThat(realConnectionIsClosed[2]).isFalse();
-    assertThat(realConnectionIsClosed[3]).isFalse();
+        // HeartBeatConnectionFactory
+        // Use custom search request.
+        SearchRequest request =
+                Requests.newSearchRequest("uid=user.0,ou=people,o=test", SearchScope.BASE_OBJECT,
+                        "objectclass=*", "cn");
 
-    // Release two remaining connections and check that they get closed.
-    pooledConnections[2].close();
-    pooledConnections[3].close();
-    assertThat(realConnectionCount.get()).isEqualTo(0);
-    assertThat(pooledConnections[0].isClosed()).isTrue();
-    assertThat(pooledConnections[1].isClosed()).isTrue();
-    assertThat(pooledConnections[2].isClosed()).isTrue();
-    assertThat(pooledConnections[3].isClosed()).isTrue();
-    assertThat(realConnectionIsClosed[0]).isTrue();
-    assertThat(realConnectionIsClosed[1]).isTrue();
-    assertThat(realConnectionIsClosed[2]).isTrue();
-    assertThat(realConnectionIsClosed[3]).isTrue();
-  }
+        factories[0][0] =
+                new HeartBeatConnectionFactory(new LDAPConnectionFactory("localhost", TestCaseUtils
+                        .getLdapPort()), 1000, TimeUnit.MILLISECONDS, request);
+
+        // InternalConnectionFactory
+        factories[1][0] = Connections.newInternalConnectionFactory(LDAPServer.getInstance(), null);
+
+        // AuthenticatedConnectionFactory
+        factories[2][0] =
+                new AuthenticatedConnectionFactory(new LDAPConnectionFactory("localhost",
+                        TestCaseUtils.getLdapPort()), Requests
+                        .newSimpleBindRequest("", new char[0]));
+
+        // AuthenticatedConnectionFactory with multi-stage SASL
+        factories[3][0] =
+                new AuthenticatedConnectionFactory(new LDAPConnectionFactory("localhost",
+                        TestCaseUtils.getLdapPort()), Requests.newCRAMMD5SASLBindRequest("id:user",
+                            "password".toCharArray()));
+
+        // LDAPConnectionFactory with default options
+        factories[4][0] = new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort());
+
+        // LDAPConnectionFactory with startTLS
+        SSLContext sslContext =
+                new SSLContextBuilder().setTrustManager(TrustManagers.trustAll()).getSSLContext();
+        LDAPOptions options =
+                new LDAPOptions().setSSLContext(sslContext).setUseStartTLS(true)
+                        .addEnabledCipherSuite(
+                                new String[] { "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+                                    "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
+                                    "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
+                                    "SSL_DH_anon_WITH_DES_CBC_SHA", "SSL_DH_anon_WITH_RC4_128_MD5",
+                                    "TLS_DH_anon_WITH_AES_128_CBC_SHA",
+                                    "TLS_DH_anon_WITH_AES_256_CBC_SHA" });
+        factories[5][0] =
+                new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort(), options);
+
+        // startTLS + SASL confidentiality
+        // Use IP address here so that DIGEST-MD5 host verification works if
+        // local
+        // host name is not localhost (e.g. on some machines it might be
+        // localhost.localdomain).
+        factories[6][0] =
+                new AuthenticatedConnectionFactory(new LDAPConnectionFactory(new InetSocketAddress(
+                        "127.0.0.1", TestCaseUtils.getLdapPort()), options), Requests
+                        .newDigestMD5SASLBindRequest("id:user", "password".toCharArray()).addQOP(
+                                DigestMD5SASLBindRequest.QOP_AUTH_CONF).setCipher(
+                                DigestMD5SASLBindRequest.CIPHER_LOW));
+
+        // Connection pool and load balancing tests.
+        ConnectionFactory offlineServer1 =
+                Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                        TestCaseUtils.findFreePort()), "offline1");
+        ConnectionFactory offlineServer2 =
+                Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                        TestCaseUtils.findFreePort()), "offline2");
+        ConnectionFactory onlineServer =
+                Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                        TestCaseUtils.getLdapPort()), "online");
+
+        // Connection pools.
+        factories[7][0] = Connections.newFixedConnectionPool(onlineServer, 10);
+
+        // Round robin.
+        factories[8][0] =
+                Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
+                        onlineServer, offlineServer1)));
+        factories[9][0] = factories[8][0];
+        factories[10][0] = factories[8][0];
+        factories[11][0] =
+                Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
+                        offlineServer1, onlineServer)));
+        factories[12][0] =
+                Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays.asList(
+                        offlineServer1, offlineServer2, onlineServer)));
+        factories[13][0] =
+                Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
+                        .<ConnectionFactory> asList(Connections.newFixedConnectionPool(
+                                offlineServer1, 10), Connections.newFixedConnectionPool(
+                                onlineServer, 10))));
+
+        // Fail-over.
+        factories[14][0] =
+                Connections.newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
+                        onlineServer, offlineServer1)));
+        factories[15][0] = factories[14][0];
+        factories[16][0] = factories[14][0];
+        factories[17][0] =
+                Connections.newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
+                        offlineServer1, onlineServer)));
+        factories[18][0] =
+                Connections.newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays.asList(
+                        offlineServer1, offlineServer2, onlineServer)));
+        factories[19][0] =
+                Connections.newLoadBalancer(new FailoverLoadBalancingAlgorithm(Arrays
+                        .<ConnectionFactory> asList(Connections.newFixedConnectionPool(
+                                offlineServer1, 10), Connections.newFixedConnectionPool(
+                                onlineServer, 10))));
+
+        factories[20][0] = Connections.newFixedConnectionPool(onlineServer, 10);
+
+        return factories;
+    }
+
+    /**
+     * Tests the async connection in the blocking mode. This is not fully async
+     * as it blocks on the future.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "connectionFactories")
+    public void testBlockingFutureNoHandler(ConnectionFactory factory) throws Exception {
+        final FutureResult<Connection> future = factory.getConnectionAsync(null);
+        final Connection con = future.get();
+        // quickly check if it is a valid connection.
+        // Don't use a result handler.
+        assertNotNull(con.readEntryAsync(DN.rootDN(), null, null).get());
+        con.close();
+    }
+
+    /**
+     * Tests the non-blocking fully async connection using a handler.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "connectionFactories")
+    public void testNonBlockingFutureWithHandler(ConnectionFactory factory) throws Exception {
+        // Use the handler to get the result asynchronously.
+        final CountDownLatch latch = new CountDownLatch(1);
+        final MyResultHandler handler = new MyResultHandler(latch);
+        factory.getConnectionAsync(handler);
+
+        // Since we don't have anything to do, we would rather
+        // be notified by the latch when the other thread calls our handler.
+        latch.await(); // should do a timed wait rather?
+        if (handler.error != null) {
+            throw handler.error;
+        }
+    }
+
+    /**
+     * Tests the synchronous connection.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "connectionFactories")
+    public void testSynchronousConnection(ConnectionFactory factory) throws Exception {
+        final Connection con = factory.getConnection();
+        assertNotNull(con);
+        // quickly check if it is a valid connection.
+        assertTrue(con.readEntry("").getName().isRootDN());
+        con.close();
+    }
+
+    /**
+     * Verifies that LDAP connections take into consideration changes to the
+     * default schema post creation. See OPENDJ-159.
+     * <p>
+     * This test is disabled because it cannot be run in parallel with rest of
+     * the test suite, because it modifies the global default schema.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test(enabled = false)
+    public void testSchemaUsage() throws Exception {
+        // Create a connection factory: this should always use the default
+        // schema,
+        // even if it is updated.
+        final ConnectionFactory factory =
+                new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort());
+        final Schema defaultSchema = Schema.getDefaultSchema();
+
+        final Connection connection = factory.getConnection();
+        try {
+            // Simulate a client which reads the schema from the server and then
+            // sets it as the application default. We then want subsequent
+            // operations to use this schema, not the original default.
+            final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+            builder.addAttributeType("( 0.9.2342.19200300.100.1.3 NAME 'mail' EQUALITY "
+                    + "caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch "
+                    + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )", false);
+            final Schema testSchema = builder.toSchema().asNonStrictSchema();
+            assertThat(testSchema.getWarnings()).isEmpty();
+            Schema.setDefaultSchema(testSchema);
+
+            // Read an entry containing the mail attribute.
+            final SearchResultEntry e = connection.readEntry("uid=user.0,ou=people,o=test");
+
+            assertThat(e.getAttribute("mail")).isNotNull();
+            assertThat(e.getAttribute(AttributeDescription.valueOf("mail", testSchema)))
+                    .isNotNull();
+        } finally {
+            // Restore original schema.
+            Schema.setDefaultSchema(defaultSchema);
+
+            // Close connection.
+            connection.close();
+        }
+    }
+
+    /**
+     * Tests connection pool closure.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testConnectionPoolClose() throws Exception {
+        // We'll use a pool of 4 connections.
+        final int size = 4;
+
+        // Count number of real connections which are open.
+        final AtomicInteger realConnectionCount = new AtomicInteger();
+        final boolean[] realConnectionIsClosed = new boolean[size];
+        Arrays.fill(realConnectionIsClosed, true);
+
+        // Mock underlying connection factory which always succeeds.
+        final ConnectionFactory mockFactory = mock(ConnectionFactory.class);
+        when(mockFactory.getConnectionAsync(any(ResultHandler.class))).thenAnswer(
+                new Answer<FutureResult<Connection>>() {
+
+                    public FutureResult<Connection> answer(InvocationOnMock invocation)
+                            throws Throwable {
+                        // Update state.
+                        final int connectionID = realConnectionCount.getAndIncrement();
+                        realConnectionIsClosed[connectionID] = false;
+
+                        // Mock connection decrements counter on close.
+                        Connection mockConnection = mock(Connection.class);
+                        doAnswer(new Answer<Void>() {
+                            public Void answer(InvocationOnMock invocation) throws Throwable {
+                                realConnectionCount.decrementAndGet();
+                                realConnectionIsClosed[connectionID] = true;
+                                return null;
+                            }
+                        }).when(mockConnection).close();
+                        when(mockConnection.isValid()).thenReturn(true);
+                        when(mockConnection.toString()).thenReturn(
+                                "Mock connection " + connectionID);
+
+                        // Execute handler and return future.
+                        ResultHandler<? super Connection> handler =
+                                (ResultHandler<? super Connection>) invocation.getArguments()[0];
+                        if (handler != null) {
+                            handler.handleResult(mockConnection);
+                        }
+                        return new CompletedFutureResult<Connection>(mockConnection);
+                    }
+                });
+
+        ConnectionPool pool = Connections.newFixedConnectionPool(mockFactory, size);
+        Connection[] pooledConnections = new Connection[size];
+        for (int i = 0; i < size; i++) {
+            pooledConnections[i] = pool.getConnection();
+        }
+
+        // Pool is fully utilized.
+        assertThat(realConnectionCount.get()).isEqualTo(size);
+        assertThat(pooledConnections[0].isClosed()).isFalse();
+        assertThat(pooledConnections[1].isClosed()).isFalse();
+        assertThat(pooledConnections[2].isClosed()).isFalse();
+        assertThat(pooledConnections[3].isClosed()).isFalse();
+        assertThat(realConnectionIsClosed[0]).isFalse();
+        assertThat(realConnectionIsClosed[1]).isFalse();
+        assertThat(realConnectionIsClosed[2]).isFalse();
+        assertThat(realConnectionIsClosed[3]).isFalse();
+
+        // Release two connections.
+        pooledConnections[0].close();
+        pooledConnections[1].close();
+        assertThat(realConnectionCount.get()).isEqualTo(4);
+        assertThat(pooledConnections[0].isClosed()).isTrue();
+        assertThat(pooledConnections[1].isClosed()).isTrue();
+        assertThat(pooledConnections[2].isClosed()).isFalse();
+        assertThat(pooledConnections[3].isClosed()).isFalse();
+        assertThat(realConnectionIsClosed[0]).isFalse();
+        assertThat(realConnectionIsClosed[1]).isFalse();
+        assertThat(realConnectionIsClosed[2]).isFalse();
+        assertThat(realConnectionIsClosed[3]).isFalse();
+
+        // Close the pool closing the two connections immediately.
+        pool.close();
+        assertThat(realConnectionCount.get()).isEqualTo(2);
+        assertThat(pooledConnections[0].isClosed()).isTrue();
+        assertThat(pooledConnections[1].isClosed()).isTrue();
+        assertThat(pooledConnections[2].isClosed()).isFalse();
+        assertThat(pooledConnections[3].isClosed()).isFalse();
+        assertThat(realConnectionIsClosed[0]).isTrue();
+        assertThat(realConnectionIsClosed[1]).isTrue();
+        assertThat(realConnectionIsClosed[2]).isFalse();
+        assertThat(realConnectionIsClosed[3]).isFalse();
+
+        // Release two remaining connections and check that they get closed.
+        pooledConnections[2].close();
+        pooledConnections[3].close();
+        assertThat(realConnectionCount.get()).isEqualTo(0);
+        assertThat(pooledConnections[0].isClosed()).isTrue();
+        assertThat(pooledConnections[1].isClosed()).isTrue();
+        assertThat(pooledConnections[2].isClosed()).isTrue();
+        assertThat(pooledConnections[3].isClosed()).isTrue();
+        assertThat(realConnectionIsClosed[0]).isTrue();
+        assertThat(realConnectionIsClosed[1]).isTrue();
+        assertThat(realConnectionIsClosed[2]).isTrue();
+        assertThat(realConnectionIsClosed[3]).isTrue();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java
index ccfd20b..54db79c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,1139 +27,934 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.RDN;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This class defines a set of tests for the org.forgerock.opendj.ldap.DN class.
  */
 @SuppressWarnings("javadoc")
-public class DNTestCase extends SdkTestCase
-{
-  /**
-   * child DN test data provider.
-   *
-   * @return The array of test data.
-   */
-  @DataProvider(name = "createChildDNTestData")
-  public Object[][] createChildDNTestData()
-  {
-    return new Object[][] {
-        { "", "", "" },
-        { "", "dc=org", "dc=org" },
-        { "", "dc=opendj,dc=org", "dc=opendj,dc=org" },
-        { "dc=org", "", "dc=org" },
-        { "dc=org", "dc=opendj", "dc=opendj,dc=org" },
-        { "dc=org", "dc=foo,dc=opendj", "dc=foo,dc=opendj,dc=org" },
-        { "dc=opendj,dc=org", "", "dc=opendj,dc=org" },
-        { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" },
-        { "dc=opendj,dc=org", "dc=bar,dc=foo", "dc=bar,dc=foo,dc=opendj,dc=org" }, };
-  }
-
-
-
-  /**
-   * Child RDN test data provider.
-   *
-   * @return The array of test data.
-   */
-  @DataProvider(name = "createChildRDNTestData")
-  public Object[][] createChildRDNTestData()
-  {
-    return new Object[][] { { "", "dc=org", "dc=org" },
-        { "dc=org", "dc=opendj", "dc=opendj,dc=org" },
-        { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" }, };
-  }
-
-
-
-  /**
-   * DN test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "testDNs")
-  public Object[][] createData()
-  {
-    return new Object[][] {
-        { "", "", "" },
-        { "   ", "", "" },
-        { "cn=", "cn=", "cn=" },
-        { "cn= ", "cn=", "cn=" },
-        { "cn =", "cn=", "cn=" },
-        { "cn = ", "cn=", "cn=" },
-        { "dc=com", "dc=com", "dc=com" },
-        { "dc=com+o=com", "dc=com+o=com", "dc=com+o=com" },
-        { "DC=COM", "dc=com", "DC=COM" },
-        { "dc = com", "dc=com", "dc=com" },
-        { " dc = com ", "dc=com", "dc=com" },
-        { "dc=example,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
-        { "dc=example, dc=com", "dc=example,dc=com", "dc=example,dc=com" },
-        { "dc=example ,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
-        { "dc =example , dc  =   com", "dc=example,dc=com", "dc=example,dc=com" },
-        { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
-            "cn=doe+givenname=john,ou=people,dc=example,dc=com",
-            "givenName=John+cn=Doe,ou=People,dc=example,dc=com" },
-        { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
-            "givenname=john\\+cn\\=doe,ou=people,dc=example,dc=com",
-            "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com" },
-        { "cn=Doe\\, John,ou=People,dc=example,dc=com",
-            "cn=doe\\, john,ou=people,dc=example,dc=com",
-            "cn=Doe\\, John,ou=People,dc=example,dc=com" },
-        { "UID=jsmith,DC=example,DC=net", "uid=jsmith,dc=example,dc=net",
-            "UID=jsmith,DC=example,DC=net" },
-        { "OU=Sales+CN=J. Smith,DC=example,DC=net",
-            "cn=j. smith+ou=sales,dc=example,dc=net",
-            "OU=Sales+CN=J. Smith,DC=example,DC=net" },
-        { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
-            "cn=james \\\"jim\\\" smith\\, iii,dc=example,dc=net",
-            "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net" },
-        { "CN=John Smith\\2C III,DC=example,DC=net",
-            "cn=john smith\\, iii,dc=example,dc=net",
-            "CN=John Smith\\, III,DC=example,DC=net" },
-        { "CN=\\23John Smith\\20,DC=example,DC=net",
-            "cn=\\#john smith,dc=example,dc=net",
-            "CN=\\#John Smith\\ ,DC=example,DC=net" },
-        {
-            "CN=Before\\0dAfter,DC=example,DC=net",
-            // \0d is a hex representation of Carriage return. It is mapped
-            // to a SPACE as defined in the MAP ( RFC 4518)
-            "cn=before after,dc=example,dc=net",
-            "CN=Before\\0dAfter,DC=example,DC=net" },
-        { "2.5.4.3=#04024869",
-        // Unicode codepoints from 0000-0008 are mapped to nothing.
-            "cn=hi", "2.5.4.3=\\04\\02Hi" },
-        { "1.1.1=", "1.1.1=", "1.1.1=" },
-        { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", "CN=Lu\u010di\u0107" },
-        { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius",
-            "ou=\u55b6\u696d\u90e8,o=airius", "ou=\u55b6\u696d\u90e8,o=Airius" },
-        { "photo=\\ john \\ ,dc=com", "photo=\\ john \\ ,dc=com",
-            "photo=\\ john \\ ,dc=com" },
-        { "AB-global=", "ab-global=", "AB-global=" },
-        { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
-            "cn=j. smith+ou=sales,dc=example,dc=net",
-            "OU=Sales+CN=J. Smith,DC=example,DC=net" },
-        { "cn=John+a=", "a=+cn=john", "cn=John+a=" },
-        { "O=\"Sue, Grabbit and Runn\",C=US", "o=sue\\, grabbit and runn,c=us",
-            "O=Sue\\, Grabbit and Runn,C=US" }, };
-  }
-
-
-
-  /**
-   * DN comparison test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "createDNComparisonData")
-  public Object[][] createDNComparisonData()
-  {
-    return new Object[][] {
-        { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 },
-        { "cn=hello   world,dc=com", "cn=hello world,dc=com", 0 },
-        { "  cn =  hello world  ,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 },
-        /**
-         * { "x-test-integer-type=10,dc=com", "x-test-integer-type=9,dc=com", 1
-         * }, { "x-test-integer-type=999,dc=com",
-         * "x-test-integer-type=1000,dc=com", -1 }, {
-         * "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", -1
-         * }, { "x-test-integer-type=0,dc=com", "x-test-integer-type=-1,dc=com",
-         * 1 },
-         **/
-        { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 },
-        { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 },
-        { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 },
-        { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 },
-        { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 },
-        { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 },
-        { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 },
-        { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 },
-        { "dc=aaa,dc=aaa", "dc=bbb", -1 },
-        { "dc=bbb,dc=aaa", "dc=bbb", -1 },
-        { "dc=ccc,dc=aaa", "dc=bbb", -1 },
-        { "dc=aaa,dc=bbb", "dc=bbb", 1 },
-        { "dc=bbb,dc=bbb", "dc=bbb", 1 },
-        { "dc=ccc,dc=bbb", "dc=bbb", 1 },
-        { "dc=aaa,dc=ccc", "dc=bbb", 1 },
-        { "dc=bbb,dc=ccc", "dc=bbb", 1 },
-        { "dc=ccc,dc=ccc", "dc=bbb", 1 },
-        { "", "dc=bbb", -1 },
-        { "dc=bbb", "", 1 } };
-  }
-
-
-
-  /**
-   * DN equality test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "createDNEqualityData")
-  public Object[][] createDNEqualityData()
-  {
-    return new Object[][] {
-        { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 },
-        { "cn=hello   world,dc=com", "cn=hello world,dc=com", 0 },
-        { "  cn =  hello world  ,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 },
-        { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 },
-        { "x-test-integer-type=10,dc=com", "x-test-integer-type=9,dc=com", 1 },
-        { "x-test-integer-type=999,dc=com", "x-test-integer-type=1000,dc=com",
-            -1 },
-        { "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", -1 },
-        { "x-test-integer-type=0,dc=com", "x-test-integer-type=-1,dc=com", 1 },
-        { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 },
-        { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 },
-        { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 },
-        { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 },
-        { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 },
-        { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 },
-        { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 },
-        { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 },
-        { "dc=aaa,dc=aaa", "dc=bbb", -1 }, { "dc=bbb,dc=aaa", "dc=bbb", -1 },
-        { "dc=ccc,dc=aaa", "dc=bbb", -1 }, { "dc=aaa,dc=bbb", "dc=bbb", 1 },
-        { "dc=bbb,dc=bbb", "dc=bbb", 1 }, { "dc=ccc,dc=bbb", "dc=bbb", 1 },
-        { "dc=aaa,dc=ccc", "dc=bbb", 1 }, { "dc=bbb,dc=ccc", "dc=bbb", 1 },
-        { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 },
-        { "dc=bbb", "", 1 } };
-  }
-
-
-
-  /**
-   * Illegal DN test data provider.
-   *
-   * @return The array of illegal test DN strings.
-   */
-  @DataProvider(name = "illegalDNs")
-  public Object[][] createIllegalData()
-  {
-    return new Object[][] { { "manager" }, { "manager " }, { "=Jim" },
-        { " =Jim" }, { "= Jim" },
-        { " = Jim" },
-        { "cn+Jim" },
-        { "cn + Jim" },
-        { "cn=Jim+" },
-        { "cn=Jim+manager" },
-        { "cn=Jim+manager " },
-        { "cn=Jim+manager," },// { "cn=Jim," }, { "cn=Jim,  " }, { "c[n]=Jim" },
-        { "_cn=Jim" }, { "c_n=Jim" }, { "cn\"=Jim" }, { "c\"n=Jim" },
-        { "1cn=Jim" }, { "cn+uid=Jim" }, { "-cn=Jim" }, { "/tmp=a" },
-        { "\\tmp=a" }, { "cn;lang-en=Jim" }, { "@cn=Jim" },
-        { "_name_=Jim" },
-        { "\u03c0=pi" },
-        { "v1.0=buggy" },// { "1.=buggy" }, { ".1=buggy" },
-        { "oid.1." }, { "1.3.6.1.4.1.1466..0=#04024869" }, { "cn=#a" },
-        { "cn=#ag" }, { "cn=#ga" }, { "cn=#abcdefgh" },
-        { "cn=a\\b" }, // { "cn=a\\bg" }, { "cn=\"hello" },
-        { "cn=+mail=,dc=example,dc=com" }, { "cn=xyz+sn=,dc=example,dc=com" },
-        { "cn=,dc=example,dc=com" } };
-  }
-
-
-
-  /**
-   * Is Child of test data provider.
-   *
-   * @return The array of test data.
-   */
-  @DataProvider(name = "createIsChildOfTestData")
-  public Object[][] createIsChildOfTestData()
-  {
-    return new Object[][] { { "", "", false }, { "", "dc=org", false },
-        { "", "dc=opendj,dc=org", false },
-        { "", "dc=foo,dc=opendj,dc=org", false }, { "dc=org", "", true },
-        { "dc=org", "dc=org", false }, { "dc=org", "dc=opendj,dc=org", false },
-        { "dc=org", "dc=foo,dc=opendj,dc=org", false },
-        { "dc=opendj,dc=org", "", false },
-        { "dc=opendj,dc=org", "dc=org", true },
-        { "dc=opendj,dc=org", "dc=opendj,dc=org", false },
-        { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
-        { "dc=foo,dc=opendj,dc=org", "", false },
-        { "dc=foo,dc=opendj,dc=org", "dc=org", false },
-        { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true },
-        { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
-        { "dc=org", "dc=com", false },
-        { "dc=opendj,dc=org", "dc=foo,dc=org", false },
-        { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
-  }
-
-
-
-  /**
-   * DN test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "createNumComponentsTestData")
-  public Object[][] createNumComponentsTestData()
-  {
-    return new Object[][] { { "", 0 }, { "dc=com", 1 },
-        { "dc=opendj,dc=com", 2 }, { "dc=world,dc=opendj,dc=com", 3 },
-        { "dc=hello,dc=world,dc=opendj,dc=com", 4 }, };
-  }
-
-
-
-  /**
-   * DN test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "createParentAndRDNTestData")
-  public Object[][] createParentAndRDNTestData()
-  {
-    return new Object[][] {
-        { "", null, null },
-        { "dc=com", "", "dc=com" },
-        { "dc=opendj,dc=com", "dc=com", "dc=opendj" },
-        { "dc=world,dc=opendj,dc=com", "dc=opendj,dc=com", "dc=world" },
-        { "dc=hello,dc=world,dc=opendj,dc=com", "dc=world,dc=opendj,dc=com",
-            "dc=hello" }, };
-  }
-
-
-
-  /**
-   * DN test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "createRDNTestData")
-  public Object[][] createRDNTestData()
-  {
-    return new Object[][] { { "dc=com", 0, "dc=com" },
-        { "dc=opendj,dc=com", 0, "dc=opendj" },
-        { "dc=opendj,dc=com", 1, "dc=com" },
-        { "dc=hello,dc=world,dc=opendj,dc=com", 0, "dc=hello" },
-        { "dc=hello,dc=world,dc=opendj,dc=com", 1, "dc=world" },
-        { "dc=hello,dc=world,dc=opendj,dc=com", 2, "dc=opendj" },
-        { "dc=hello,dc=world,dc=opendj,dc=com", 3, "dc=com" }, };
-  }
-
-
-
-  /**
-   * Subordinate test data provider.
-   *
-   * @return The array of subordinate and superior DN Strings.
-   */
-  @DataProvider(name = "createSubordinateTestData")
-  public Object[][] createSubordinateTestData()
-  {
-    return new Object[][] { { "", "", true }, { "", "dc=org", false },
-        { "", "dc=opendj,dc=org", false },
-        { "", "dc=foo,dc=opendj,dc=org", false }, { "dc=org", "", true },
-        { "dc=org", "dc=org", true }, { "dc=org", "dc=opendj,dc=org", false },
-        { "dc=org", "dc=foo,dc=opendj,dc=org", false },
-        { "dc=opendj,dc=org", "", true },
-        { "dc=opendj,dc=org", "dc=org", true },
-        { "dc=opendj,dc=org", "dc=opendj,dc=org", true },
-        { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
-        { "dc=foo,dc=opendj,dc=org", "", true },
-        { "dc=foo,dc=opendj,dc=org", "dc=org", true },
-        { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true },
-        { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
-        { "dc=org", "dc=com", false },
-        { "dc=opendj,dc=org", "dc=foo,dc=org", false },
-        { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
-  }
-
-
-
-  /**
-   * Superior test data provider.
-   *
-   * @return The array of superior and subordindate DN Strings.
-   */
-  @DataProvider(name = "createSuperiorTestData")
-  public Object[][] createSuperiorTestData()
-  {
-    return new Object[][] { { "", "", true }, { "", "dc=org", true },
-        { "", "dc=opendj,dc=org", true },
-        { "", "dc=foo,dc=opendj,dc=org", true }, { "dc=org", "", false },
-        { "dc=org", "dc=org", true }, { "dc=org", "dc=opendj,dc=org", true },
-        { "dc=org", "dc=foo,dc=opendj,dc=org", true },
-        { "dc=opendj,dc=org", "", false },
-        { "dc=opendj,dc=org", "dc=org", false },
-        { "dc=opendj,dc=org", "dc=opendj,dc=org", true },
-        { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
-        { "dc=foo,dc=opendj,dc=org", "", false },
-        { "dc=foo,dc=opendj,dc=org", "dc=org", false },
-        { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", false },
-        { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
-        { "dc=org", "dc=com", false },
-        { "dc=opendj,dc=org", "dc=foo,dc=org", false },
-        { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
-  }
-
-
-
-  @Test()
-  public void testAdminData()
-  {
-    DN.valueOf("cn=cn\\=admin data");
-    final DN theDN = DN.valueOf("cn=my dn");
-    final RDN theRDN = new RDN("cn", "my rdn");
-    final DN theChildDN = theDN.child(theRDN);
-    DN.valueOf(theChildDN.toString());
-  }
-
-
-
-  /**
-   * Test the child(DN) method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param l
-   *          The local name to be appended.
-   * @param e
-   *          The expected DN.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createChildDNTestData")
-  public void testChildDN(final String s, final String l, final String e)
-      throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    final DN localName = DN.valueOf(l);
-    final DN expected = DN.valueOf(e);
-
-    assertEquals(dn.child(localName), expected);
-  }
-
-
-
-  /**
-   * Test the child(DN) method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
-  public void testChildDNException() throws Exception
-  {
-    final DN dn = DN.valueOf("dc=org");
-    dn.child((DN) null);
-  }
-
-
-
-  /**
-   * Test the child(DN) method's interaction with other methods.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testChildDNInteraction() throws Exception
-  {
-    final DN p = DN.valueOf("dc=opendj,dc=org");
-    final DN l = DN.valueOf("dc=foo");
-    final DN e = DN.valueOf("dc=foo,dc=opendj,dc=org");
-    final DN c = p.child(l);
-
-    assertEquals(c.size(), 3);
-
-    assertEquals(c.compareTo(p), 1);
-    assertEquals(p.compareTo(c), -1);
-
-    assertTrue(p.isParentOf(c));
-    assertFalse(c.isParentOf(p));
-
-    assertTrue(c.isChildOf(p));
-    assertFalse(p.isChildOf(c));
-
-    assertEquals(c, e);
-    assertEquals(c.hashCode(), e.hashCode());
-
-    assertEquals(c.toString(), e.toString());
-
-    assertEquals(c.rdn(), RDN.valueOf("dc=foo"));
-
-    assertEquals(c.parent(), DN.valueOf("dc=opendj,dc=org"));
-    assertEquals(c.parent(), e.parent());
-
-    assertEquals(c.child(RDN.valueOf("dc=xxx")), DN
-        .valueOf("dc=xxx,dc=foo,dc=opendj,dc=org"));
-    assertEquals(c.child(DN.valueOf("dc=xxx,dc=yyy")), DN
-        .valueOf("dc=xxx,dc=yyy,dc=foo,dc=opendj,dc=org"));
-  }
-
-
-
-  /**
-   * Test the child(RDN...) method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param r
-   *          The RDN to be appended.
-   * @param e
-   *          The expected DN.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createChildRDNTestData")
-  public void testChildSingleRDN(final String s, final String r, final String e)
-      throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    final RDN rdn = RDN.valueOf(r);
-    final DN expected = DN.valueOf(e);
-
-    assertEquals(dn.child(rdn), expected);
-  }
-
-
-
-  /**
-   * Test DN compareTo
-   *
-   * @param first
-   *          First DN to compare.
-   * @param second
-   *          Second DN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createDNComparisonData")
-  public void testCompareTo(final String first, final String second,
-      final int result) throws Exception
-  {
-    final DN dn1 = DN.valueOf(first);
-    final DN dn2 = DN.valueOf(second);
-
-    int rc = dn1.compareTo(dn2);
-
-    // Normalize the result.
-    if (rc < 0)
-    {
-      rc = -1;
-    }
-    else if (rc > 0)
-    {
-      rc = 1;
+public class DNTestCase extends SdkTestCase {
+    /**
+     * child DN test data provider.
+     *
+     * @return The array of test data.
+     */
+    @DataProvider(name = "createChildDNTestData")
+    public Object[][] createChildDNTestData() {
+        return new Object[][] { { "", "", "" }, { "", "dc=org", "dc=org" },
+            { "", "dc=opendj,dc=org", "dc=opendj,dc=org" }, { "dc=org", "", "dc=org" },
+            { "dc=org", "dc=opendj", "dc=opendj,dc=org" },
+            { "dc=org", "dc=foo,dc=opendj", "dc=foo,dc=opendj,dc=org" },
+            { "dc=opendj,dc=org", "", "dc=opendj,dc=org" },
+            { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" },
+            { "dc=opendj,dc=org", "dc=bar,dc=foo", "dc=bar,dc=foo,dc=opendj,dc=org" }, };
     }
 
-    assertEquals(rc, result, "Comparison for <" + first + "> and <" + second
-        + ">.");
-  }
-
-
-
-  /**
-   * Test DN equality
-   *
-   * @param first
-   *          First DN to compare.
-   * @param second
-   *          Second DN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createDNEqualityData")
-  public void testEquality(final String first, final String second,
-      final int result) throws Exception
-  {
-    final DN dn1 = DN.valueOf(first);
-    final DN dn2 = DN.valueOf(second);
-
-    if (result == 0)
-    {
-      assertTrue(dn1.equals(dn2), "DN equality for <" + first + "> and <"
-          + second + ">");
+    /**
+     * Child RDN test data provider.
+     *
+     * @return The array of test data.
+     */
+    @DataProvider(name = "createChildRDNTestData")
+    public Object[][] createChildRDNTestData() {
+        return new Object[][] { { "", "dc=org", "dc=org" },
+            { "dc=org", "dc=opendj", "dc=opendj,dc=org" },
+            { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" }, };
     }
-    else
-    {
-      assertFalse(dn1.equals(dn2), "DN equality for <" + first + "> and <"
-          + second + ">");
+
+    /**
+     * DN test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "testDNs")
+    public Object[][] createData() {
+        return new Object[][] {
+            { "", "", "" },
+            { "   ", "", "" },
+            { "cn=", "cn=", "cn=" },
+            { "cn= ", "cn=", "cn=" },
+            { "cn =", "cn=", "cn=" },
+            { "cn = ", "cn=", "cn=" },
+            { "dc=com", "dc=com", "dc=com" },
+            { "dc=com+o=com", "dc=com+o=com", "dc=com+o=com" },
+            { "DC=COM", "dc=com", "DC=COM" },
+            { "dc = com", "dc=com", "dc=com" },
+            { " dc = com ", "dc=com", "dc=com" },
+            { "dc=example,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
+            { "dc=example, dc=com", "dc=example,dc=com", "dc=example,dc=com" },
+            { "dc=example ,dc=com", "dc=example,dc=com", "dc=example,dc=com" },
+            { "dc =example , dc  =   com", "dc=example,dc=com", "dc=example,dc=com" },
+            { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
+                "cn=doe+givenname=john,ou=people,dc=example,dc=com",
+                "givenName=John+cn=Doe,ou=People,dc=example,dc=com" },
+            { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
+                "givenname=john\\+cn\\=doe,ou=people,dc=example,dc=com",
+                "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com" },
+            { "cn=Doe\\, John,ou=People,dc=example,dc=com",
+                "cn=doe\\, john,ou=people,dc=example,dc=com",
+                "cn=Doe\\, John,ou=People,dc=example,dc=com" },
+            { "UID=jsmith,DC=example,DC=net", "uid=jsmith,dc=example,dc=net",
+                "UID=jsmith,DC=example,DC=net" },
+            { "OU=Sales+CN=J. Smith,DC=example,DC=net", "cn=j. smith+ou=sales,dc=example,dc=net",
+                "OU=Sales+CN=J. Smith,DC=example,DC=net" },
+            { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
+                "cn=james \\\"jim\\\" smith\\, iii,dc=example,dc=net",
+                "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net" },
+            { "CN=John Smith\\2C III,DC=example,DC=net", "cn=john smith\\, iii,dc=example,dc=net",
+                "CN=John Smith\\, III,DC=example,DC=net" },
+            { "CN=\\23John Smith\\20,DC=example,DC=net", "cn=\\#john smith,dc=example,dc=net",
+                "CN=\\#John Smith\\ ,DC=example,DC=net" },
+            { "CN=Before\\0dAfter,DC=example,DC=net",
+                // \0d is a hex representation of Carriage return. It is mapped
+                // to a SPACE as defined in the MAP ( RFC 4518)
+                "cn=before after,dc=example,dc=net", "CN=Before\\0dAfter,DC=example,DC=net" },
+            { "2.5.4.3=#04024869",
+                // Unicode codepoints from 0000-0008 are mapped to nothing.
+                "cn=hi", "2.5.4.3=\\04\\02Hi" },
+            { "1.1.1=", "1.1.1=", "1.1.1=" },
+            { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", "CN=Lu\u010di\u0107" },
+            { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius", "ou=\u55b6\u696d\u90e8,o=airius",
+                "ou=\u55b6\u696d\u90e8,o=Airius" },
+            { "photo=\\ john \\ ,dc=com", "photo=\\ john \\ ,dc=com", "photo=\\ john \\ ,dc=com" },
+            { "AB-global=", "ab-global=", "AB-global=" },
+            { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
+                "cn=j. smith+ou=sales,dc=example,dc=net", "OU=Sales+CN=J. Smith,DC=example,DC=net" },
+            { "cn=John+a=", "a=+cn=john", "cn=John+a=" },
+            { "O=\"Sue, Grabbit and Runn\",C=US", "o=sue\\, grabbit and runn,c=us",
+                "O=Sue\\, Grabbit and Runn,C=US" }, };
     }
-  }
 
-
-
-  /**
-   * Tests the equals method with a value that's not a DN.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testEqualsNonDN() throws Exception
-  {
-    final DN dn = DN.valueOf("dc=example,dc=com");
-
-    assertFalse(dn.equals(DN.valueOf("not a DN")));
-  }
-
-
-
-  /**
-   * Test DN hashCode
-   *
-   * @param first
-   *          First DN to compare.
-   * @param second
-   *          Second DN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createDNEqualityData")
-  public void testHashCode(final String first, final String second,
-      final int result) throws Exception
-  {
-    final DN dn1 = DN.valueOf(first);
-    final DN dn2 = DN.valueOf(second);
-
-    final int h1 = dn1.hashCode();
-    final int h2 = dn2.hashCode();
-
-    if (result == 0)
-    {
-      if (h1 != h2)
-      {
-        fail("Hash codes for <" + first + "> and <" + second
-            + "> should be the same.");
-      }
+    /**
+     * DN comparison test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "createDNComparisonData")
+    public Object[][] createDNComparisonData() {
+        return new Object[][] { { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 },
+            { "cn=hello   world,dc=com", "cn=hello world,dc=com", 0 },
+            { "  cn =  hello world  ,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 },
+            /**
+             * { "x-test-integer-type=10,dc=com",
+             * "x-test-integer-type=9,dc=com", 1 }, {
+             * "x-test-integer-type=999,dc=com",
+             * "x-test-integer-type=1000,dc=com", -1 }, {
+             * "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com",
+             * -1 }, { "x-test-integer-type=0,dc=com",
+             * "x-test-integer-type=-1,dc=com", 1 },
+             **/
+            { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 }, { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 },
+            { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 }, { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 },
+            { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 },
+            { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 },
+            { "dc=aaa,dc=aaa", "dc=bbb", -1 }, { "dc=bbb,dc=aaa", "dc=bbb", -1 },
+            { "dc=ccc,dc=aaa", "dc=bbb", -1 }, { "dc=aaa,dc=bbb", "dc=bbb", 1 },
+            { "dc=bbb,dc=bbb", "dc=bbb", 1 }, { "dc=ccc,dc=bbb", "dc=bbb", 1 },
+            { "dc=aaa,dc=ccc", "dc=bbb", 1 }, { "dc=bbb,dc=ccc", "dc=bbb", 1 },
+            { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 }, { "dc=bbb", "", 1 } };
     }
-    else
-    {
-      if (h1 == h2)
-      {
-        fail("Hash codes for <" + first + "> and <" + second
-            + "> should be the same.");
-      }
+
+    /**
+     * DN equality test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "createDNEqualityData")
+    public Object[][] createDNEqualityData() {
+        return new Object[][] { { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 },
+            { "cn=hello   world,dc=com", "cn=hello world,dc=com", 0 },
+            { "  cn =  hello world  ,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 },
+            { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 },
+            { "x-test-integer-type=10,dc=com", "x-test-integer-type=9,dc=com", 1 },
+            { "x-test-integer-type=999,dc=com", "x-test-integer-type=1000,dc=com", -1 },
+            { "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", -1 },
+            { "x-test-integer-type=0,dc=com", "x-test-integer-type=-1,dc=com", 1 },
+            { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 }, { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 },
+            { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 }, { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 },
+            { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 },
+            { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 },
+            { "dc=aaa,dc=aaa", "dc=bbb", -1 }, { "dc=bbb,dc=aaa", "dc=bbb", -1 },
+            { "dc=ccc,dc=aaa", "dc=bbb", -1 }, { "dc=aaa,dc=bbb", "dc=bbb", 1 },
+            { "dc=bbb,dc=bbb", "dc=bbb", 1 }, { "dc=ccc,dc=bbb", "dc=bbb", 1 },
+            { "dc=aaa,dc=ccc", "dc=bbb", 1 }, { "dc=bbb,dc=ccc", "dc=bbb", 1 },
+            { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 }, { "dc=bbb", "", 1 } };
     }
-  }
 
+    /**
+     * Illegal DN test data provider.
+     *
+     * @return The array of illegal test DN strings.
+     */
+    @DataProvider(name = "illegalDNs")
+    public Object[][] createIllegalData() {
+        return new Object[][] { { "manager" }, { "manager " },
+            { "=Jim" },
+            { " =Jim" },
+            { "= Jim" },
+            { " = Jim" },
+            { "cn+Jim" },
+            { "cn + Jim" },
+            { "cn=Jim+" },
+            { "cn=Jim+manager" },
+            { "cn=Jim+manager " },
+            { "cn=Jim+manager," }, // { "cn=Jim," }, { "cn=Jim,  " }, {
+                                   // "c[n]=Jim" },
+            { "_cn=Jim" }, { "c_n=Jim" }, { "cn\"=Jim" }, { "c\"n=Jim" }, { "1cn=Jim" },
+            { "cn+uid=Jim" }, { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" },
+            { "@cn=Jim" }, { "_name_=Jim" },
+            { "\u03c0=pi" },
+            { "v1.0=buggy" }, // { "1.=buggy" }, { ".1=buggy" },
+            { "oid.1." }, { "1.3.6.1.4.1.1466..0=#04024869" }, { "cn=#a" }, { "cn=#ag" },
+            { "cn=#ga" }, { "cn=#abcdefgh" },
+            { "cn=a\\b" }, // { "cn=a\\bg" }, { "cn=\"hello" },
+            { "cn=+mail=,dc=example,dc=com" }, { "cn=xyz+sn=,dc=example,dc=com" },
+            { "cn=,dc=example,dc=com" } };
+    }
 
+    /**
+     * Is Child of test data provider.
+     *
+     * @return The array of test data.
+     */
+    @DataProvider(name = "createIsChildOfTestData")
+    public Object[][] createIsChildOfTestData() {
+        return new Object[][] { { "", "", false }, { "", "dc=org", false },
+            { "", "dc=opendj,dc=org", false }, { "", "dc=foo,dc=opendj,dc=org", false },
+            { "dc=org", "", true }, { "dc=org", "dc=org", false },
+            { "dc=org", "dc=opendj,dc=org", false },
+            { "dc=org", "dc=foo,dc=opendj,dc=org", false }, { "dc=opendj,dc=org", "", false },
+            { "dc=opendj,dc=org", "dc=org", true },
+            { "dc=opendj,dc=org", "dc=opendj,dc=org", false },
+            { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
+            { "dc=foo,dc=opendj,dc=org", "", false },
+            { "dc=foo,dc=opendj,dc=org", "dc=org", false },
+            { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true },
+            { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
+            { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false },
+            { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
+    }
 
-  /**
-   * Test that decoding an illegal DN as a String throws an exception.
-   *
-   * @param dn
-   *          The illegal DN to be tested.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "illegalDNs", expectedExceptions = {
-      LocalizedIllegalArgumentException.class, NullPointerException.class })
-  public void testIllegalStringDNs(final String dn) throws Exception
-  {
-    DN.valueOf(dn);
-  }
+    /**
+     * DN test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "createNumComponentsTestData")
+    public Object[][] createNumComponentsTestData() {
+        return new Object[][] { { "", 0 }, { "dc=com", 1 }, { "dc=opendj,dc=com", 2 },
+            { "dc=world,dc=opendj,dc=com", 3 }, { "dc=hello,dc=world,dc=opendj,dc=com", 4 }, };
+    }
 
+    /**
+     * DN test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "createParentAndRDNTestData")
+    public Object[][] createParentAndRDNTestData() {
+        return new Object[][] { { "", null, null }, { "dc=com", "", "dc=com" },
+            { "dc=opendj,dc=com", "dc=com", "dc=opendj" },
+            { "dc=world,dc=opendj,dc=com", "dc=opendj,dc=com", "dc=world" },
+            { "dc=hello,dc=world,dc=opendj,dc=com", "dc=world,dc=opendj,dc=com", "dc=hello" }, };
+    }
 
+    /**
+     * DN test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "createRDNTestData")
+    public Object[][] createRDNTestData() {
+        return new Object[][] { { "dc=com", 0, "dc=com" }, { "dc=opendj,dc=com", 0, "dc=opendj" },
+            { "dc=opendj,dc=com", 1, "dc=com" },
+            { "dc=hello,dc=world,dc=opendj,dc=com", 0, "dc=hello" },
+            { "dc=hello,dc=world,dc=opendj,dc=com", 1, "dc=world" },
+            { "dc=hello,dc=world,dc=opendj,dc=com", 2, "dc=opendj" },
+            { "dc=hello,dc=world,dc=opendj,dc=com", 3, "dc=com" }, };
+    }
 
-  /**
-   * Test the isChildOf method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param d
-   *          The dn parameter.
-   * @param e
-   *          The expected result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createIsChildOfTestData")
-  public void testIsChildOf(final String s, final String d, final boolean e)
-      throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    final DN other = DN.valueOf(d);
+    /**
+     * Subordinate test data provider.
+     *
+     * @return The array of subordinate and superior DN Strings.
+     */
+    @DataProvider(name = "createSubordinateTestData")
+    public Object[][] createSubordinateTestData() {
+        return new Object[][] { { "", "", true }, { "", "dc=org", false },
+            { "", "dc=opendj,dc=org", false }, { "", "dc=foo,dc=opendj,dc=org", false },
+            { "dc=org", "", true }, { "dc=org", "dc=org", true },
+            { "dc=org", "dc=opendj,dc=org", false },
+            { "dc=org", "dc=foo,dc=opendj,dc=org", false }, { "dc=opendj,dc=org", "", true },
+            { "dc=opendj,dc=org", "dc=org", true },
+            { "dc=opendj,dc=org", "dc=opendj,dc=org", true },
+            { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false },
+            { "dc=foo,dc=opendj,dc=org", "", true }, { "dc=foo,dc=opendj,dc=org", "dc=org", true },
+            { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true },
+            { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
+            { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false },
+            { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
+    }
 
-    assertEquals(dn.isChildOf(other), e, s + " isChildOf " + d);
-  }
+    /**
+     * Superior test data provider.
+     *
+     * @return The array of superior and subordindate DN Strings.
+     */
+    @DataProvider(name = "createSuperiorTestData")
+    public Object[][] createSuperiorTestData() {
+        return new Object[][] { { "", "", true }, { "", "dc=org", true },
+            { "", "dc=opendj,dc=org", true }, { "", "dc=foo,dc=opendj,dc=org", true },
+            { "dc=org", "", false }, { "dc=org", "dc=org", true },
+            { "dc=org", "dc=opendj,dc=org", true }, { "dc=org", "dc=foo,dc=opendj,dc=org", true },
+            { "dc=opendj,dc=org", "", false }, { "dc=opendj,dc=org", "dc=org", false },
+            { "dc=opendj,dc=org", "dc=opendj,dc=org", true },
+            { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
+            { "dc=foo,dc=opendj,dc=org", "", false },
+            { "dc=foo,dc=opendj,dc=org", "dc=org", false },
+            { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", false },
+            { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true },
+            { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false },
+            { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, };
+    }
 
+    @Test()
+    public void testAdminData() {
+        DN.valueOf("cn=cn\\=admin data");
+        final DN theDN = DN.valueOf("cn=my dn");
+        final RDN theRDN = new RDN("cn", "my rdn");
+        final DN theChildDN = theDN.child(theRDN);
+        DN.valueOf(theChildDN.toString());
+    }
 
+    /**
+     * Test the child(DN) method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param l
+     *            The local name to be appended.
+     * @param e
+     *            The expected DN.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createChildDNTestData")
+    public void testChildDN(final String s, final String l, final String e) throws Exception {
+        final DN dn = DN.valueOf(s);
+        final DN localName = DN.valueOf(l);
+        final DN expected = DN.valueOf(e);
 
-  /**
-   * Test the isChildOf method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
-  public void testIsChildOfException() throws Exception
-  {
-    final DN dn = DN.valueOf("dc=com");
-    dn.isChildOf((String) null);
-  }
+        assertEquals(dn.child(localName), expected);
+    }
 
+    /**
+     * Test the child(DN) method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
+    public void testChildDNException() throws Exception {
+        final DN dn = DN.valueOf("dc=org");
+        dn.child((DN) null);
+    }
 
+    /**
+     * Test the child(DN) method's interaction with other methods.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testChildDNInteraction() throws Exception {
+        final DN p = DN.valueOf("dc=opendj,dc=org");
+        final DN l = DN.valueOf("dc=foo");
+        final DN e = DN.valueOf("dc=foo,dc=opendj,dc=org");
+        final DN c = p.child(l);
 
-  /**
-   * Tests the parent method that require iteration.
-   */
-  @Test()
-  public void testIterableParent()
-  {
-    final String str = "ou=people,dc=example,dc=com";
-    final DN dn = DN.valueOf(str);
-    // Parent at index 0 is self.
-    assertEquals(dn, dn.parent(0));
-    assertEquals(dn.parent(1), DN.valueOf("dc=example,dc=com"));
-    assertEquals(dn.parent(2), DN.valueOf("dc=com"));
-    assertEquals(dn.parent(3), DN.rootDN());
-  }
+        assertEquals(c.size(), 3);
 
+        assertEquals(c.compareTo(p), 1);
+        assertEquals(p.compareTo(c), -1);
 
+        assertTrue(p.isParentOf(c));
+        assertFalse(c.isParentOf(p));
 
-  /**
-   * Test the getNumComponents method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param sz
-   *          The expected number of RDNs.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createNumComponentsTestData")
-  public void testNumComponents(final String s, final int sz) throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    assertEquals(dn.size(), sz);
-  }
+        assertTrue(c.isChildOf(p));
+        assertFalse(p.isChildOf(c));
 
+        assertEquals(c, e);
+        assertEquals(c.hashCode(), e.hashCode());
 
+        assertEquals(c.toString(), e.toString());
 
-  /**
-   * Test the parent method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param p
-   *          The expected parent.
-   * @param r
-   *          The expected rdn.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createParentAndRDNTestData")
-  public void testParent(final String s, final String p, final String r)
-      throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    final DN parent = (p != null ? DN.valueOf(p) : null);
+        assertEquals(c.rdn(), RDN.valueOf("dc=foo"));
 
-    assertEquals(dn.parent(), parent, "For DN " + s);
-  }
+        assertEquals(c.parent(), DN.valueOf("dc=opendj,dc=org"));
+        assertEquals(c.parent(), e.parent());
 
+        assertEquals(c.child(RDN.valueOf("dc=xxx")), DN.valueOf("dc=xxx,dc=foo,dc=opendj,dc=org"));
+        assertEquals(c.child(DN.valueOf("dc=xxx,dc=yyy")), DN
+                .valueOf("dc=xxx,dc=yyy,dc=foo,dc=opendj,dc=org"));
+    }
 
+    /**
+     * Test the child(RDN...) method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param r
+     *            The RDN to be appended.
+     * @param e
+     *            The expected DN.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createChildRDNTestData")
+    public void testChildSingleRDN(final String s, final String r, final String e) throws Exception {
+        final DN dn = DN.valueOf(s);
+        final RDN rdn = RDN.valueOf(r);
+        final DN expected = DN.valueOf(e);
 
-  /**
-   * Test the parent method's interaction with other methods.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testParentInteraction() throws Exception
-  {
-    final DN c = DN.valueOf("dc=foo,dc=bar,dc=opendj,dc=org");
-    final DN e = DN.valueOf("dc=bar,dc=opendj,dc=org");
-    final DN p = c.parent();
+        assertEquals(dn.child(rdn), expected);
+    }
 
-    assertEquals(p.size(), 3);
+    /**
+     * Test DN compareTo
+     *
+     * @param first
+     *            First DN to compare.
+     * @param second
+     *            Second DN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createDNComparisonData")
+    public void testCompareTo(final String first, final String second, final int result)
+            throws Exception {
+        final DN dn1 = DN.valueOf(first);
+        final DN dn2 = DN.valueOf(second);
 
-    assertEquals(p.compareTo(c), -1);
-    assertEquals(c.compareTo(p), 1);
+        int rc = dn1.compareTo(dn2);
 
-    assertTrue(p.isParentOf(c));
-    assertFalse(c.isParentOf(p));
+        // Normalize the result.
+        if (rc < 0) {
+            rc = -1;
+        } else if (rc > 0) {
+            rc = 1;
+        }
 
-    assertTrue(c.isChildOf(p));
-    assertFalse(p.isChildOf(c));
+        assertEquals(rc, result, "Comparison for <" + first + "> and <" + second + ">.");
+    }
 
-    assertEquals(p, e);
-    assertEquals(p.hashCode(), e.hashCode());
+    /**
+     * Test DN equality
+     *
+     * @param first
+     *            First DN to compare.
+     * @param second
+     *            Second DN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createDNEqualityData")
+    public void testEquality(final String first, final String second, final int result)
+            throws Exception {
+        final DN dn1 = DN.valueOf(first);
+        final DN dn2 = DN.valueOf(second);
 
-    assertEquals(p.toString(), e.toString());
+        if (result == 0) {
+            assertTrue(dn1.equals(dn2), "DN equality for <" + first + "> and <" + second + ">");
+        } else {
+            assertFalse(dn1.equals(dn2), "DN equality for <" + first + "> and <" + second + ">");
+        }
+    }
 
-    assertEquals(p.rdn(), RDN.valueOf("dc=bar"));
+    /**
+     * Tests the equals method with a value that's not a DN.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testEqualsNonDN() throws Exception {
+        final DN dn = DN.valueOf("dc=example,dc=com");
 
-    assertEquals(p.rdn(), RDN.valueOf("dc=bar"));
+        assertFalse(dn.equals(DN.valueOf("not a DN")));
+    }
 
-    assertEquals(p.parent(), DN.valueOf("dc=opendj,dc=org"));
-    assertEquals(p.parent(), e.parent());
+    /**
+     * Test DN hashCode
+     *
+     * @param first
+     *            First DN to compare.
+     * @param second
+     *            Second DN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createDNEqualityData")
+    public void testHashCode(final String first, final String second, final int result)
+            throws Exception {
+        final DN dn1 = DN.valueOf(first);
+        final DN dn2 = DN.valueOf(second);
 
-    assertEquals(p.child(RDN.valueOf("dc=foo")), DN
-        .valueOf("dc=foo,dc=bar,dc=opendj,dc=org"));
-    assertEquals(p.child(RDN.valueOf("dc=foo")), c);
-    assertEquals(p.child(DN.valueOf("dc=xxx,dc=foo")), DN
-        .valueOf("dc=xxx,dc=foo,dc=bar,dc=opendj,dc=org"));
-  }
+        final int h1 = dn1.hashCode();
+        final int h2 = dn2.hashCode();
 
+        if (result == 0) {
+            if (h1 != h2) {
+                fail("Hash codes for <" + first + "> and <" + second + "> should be the same.");
+            }
+        } else {
+            if (h1 == h2) {
+                fail("Hash codes for <" + first + "> and <" + second + "> should be the same.");
+            }
+        }
+    }
 
+    /**
+     * Test that decoding an illegal DN as a String throws an exception.
+     *
+     * @param dn
+     *            The illegal DN to be tested.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "illegalDNs", expectedExceptions = {
+            LocalizedIllegalArgumentException.class, NullPointerException.class })
+    public void testIllegalStringDNs(final String dn) throws Exception {
+        DN.valueOf(dn);
+    }
 
-  /**
-   * Test the getRDN method.
-   *
-   * @param s
-   *          The test DN string.
-   * @param p
-   *          The expected parent.
-   * @param r
-   *          The expected rdn.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createParentAndRDNTestData")
-  public void testRDN(final String s, final String p, final String r)
-      throws Exception
-  {
-    final DN dn = DN.valueOf(s);
-    final RDN rdn = (r != null ? RDN.valueOf(r) : null);
+    /**
+     * Test the isChildOf method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param d
+     *            The dn parameter.
+     * @param e
+     *            The expected result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createIsChildOfTestData")
+    public void testIsChildOf(final String s, final String d, final boolean e) throws Exception {
+        final DN dn = DN.valueOf(s);
+        final DN other = DN.valueOf(d);
 
-    assertEquals(dn.rdn(), rdn, "For DN " + s);
-  }
+        assertEquals(dn.isChildOf(other), e, s + " isChildOf " + d);
+    }
 
+    /**
+     * Test the isChildOf method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
+    public void testIsChildOfException() throws Exception {
+        final DN dn = DN.valueOf("dc=com");
+        dn.isChildOf((String) null);
+    }
 
+    /**
+     * Tests the parent method that require iteration.
+     */
+    @Test()
+    public void testIterableParent() {
+        final String str = "ou=people,dc=example,dc=com";
+        final DN dn = DN.valueOf(str);
+        // Parent at index 0 is self.
+        assertEquals(dn, dn.parent(0));
+        assertEquals(dn.parent(1), DN.valueOf("dc=example,dc=com"));
+        assertEquals(dn.parent(2), DN.valueOf("dc=com"));
+        assertEquals(dn.parent(3), DN.rootDN());
+    }
 
-  /**
-   * Tests the root DN.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testRootDN1() throws Exception
-  {
-    final DN dn = DN.valueOf("");
-    assertTrue(dn.isRootDN());
-    assertEquals(dn, DN.rootDN());
-  }
+    /**
+     * Test the getNumComponents method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param sz
+     *            The expected number of RDNs.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createNumComponentsTestData")
+    public void testNumComponents(final String s, final int sz) throws Exception {
+        final DN dn = DN.valueOf(s);
+        assertEquals(dn.size(), sz);
+    }
 
+    /**
+     * Test the parent method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param p
+     *            The expected parent.
+     * @param r
+     *            The expected rdn.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createParentAndRDNTestData")
+    public void testParent(final String s, final String p, final String r) throws Exception {
+        final DN dn = DN.valueOf(s);
+        final DN parent = (p != null ? DN.valueOf(p) : null);
 
+        assertEquals(dn.parent(), parent, "For DN " + s);
+    }
 
-  /**
-   * Tests the root DN.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
-  public void testRootDN2() throws Exception
-  {
-    final DN dn = DN.valueOf(null);
-    assertEquals(dn, DN.rootDN());
-  }
-
-
-
-  /**
-   * Test the root dn.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testRootDN3() throws Exception
-  {
-    final DN nullDN = DN.rootDN();
-    assertTrue(nullDN.isRootDN());
-    assertTrue(nullDN.size() == 0);
-  }
-
-
-
-  /**
-   * Test the root dn.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testRootDN4() throws Exception
-  {
-    final DN dn = DN.valueOf("dc=com");
-    assertFalse(dn.isRootDN());
-  }
-
-
-
-  /**
-   * Tests the subordinate dns.
-   */
-  @Test(dataProvider = "createSubordinateTestData")
-  public void testSubordinateDN(final String sub, final String base,
-      final boolean e) throws Exception
-  {
-    final DN dn = DN.valueOf(sub);
-    final DN other = DN.valueOf(base);
-    assertEquals(dn.isSubordinateOrEqualTo(other), e, sub + " isSubordinateOf "
-        + base);
-  }
-
-
-
-  /**
-   * Tests the supeiror dns.
-   */
-  @Test(dataProvider = "createSuperiorTestData")
-  public void testSuperiorDN(final String base, final String sub,
-      final boolean e) throws Exception
-  {
-    final DN dn = DN.valueOf(base);
-    final DN other = DN.valueOf(sub);
-    assertEquals(dn.isSuperiorOrEqualTo(other), e, base + " isSuperiorOf "
-        + sub);
-  }
+    /**
+     * Test the parent method's interaction with other methods.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testParentInteraction() throws Exception {
+        final DN c = DN.valueOf("dc=foo,dc=bar,dc=opendj,dc=org");
+        final DN e = DN.valueOf("dc=bar,dc=opendj,dc=org");
+        final DN p = c.parent();
 
+        assertEquals(p.size(), 3);
 
+        assertEquals(p.compareTo(c), -1);
+        assertEquals(c.compareTo(p), 1);
 
-  /**
-   * Test the RFC 4514 string representation of the DN.
-   *
-   * @param rawDN
-   *          Raw DN string representation.
-   * @param normDN
-   *          Normalized DN string representation.
-   * @param stringDN
-   *          String representation.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "testDNs")
-  public void testToString(final String rawDN, final String normDN,
-      final String stringDN) throws Exception
-  {
-    // DN dn = DN.valueOf(rawDN);
-    // assertEquals(dn.toString(), stringDN);
-  }
+        assertTrue(p.isParentOf(c));
+        assertFalse(c.isParentOf(p));
 
+        assertTrue(c.isChildOf(p));
+        assertFalse(p.isChildOf(c));
 
+        assertEquals(p, e);
+        assertEquals(p.hashCode(), e.hashCode());
 
-  /**
-   * Tests the <CODE>valueOf</CODE> method which takes a String argument.
-   *
-   * @param rawDN
-   *          Raw DN string representation.
-   * @param normDN
-   *          Normalized DN string representation.
-   * @param stringDN
-   *          String representation.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "testDNs")
-  public void testValueOfString(final String rawDN, final String normDN,
-      final String stringDN) throws Exception
-  {
-    final DN raw = DN.valueOf(rawDN);
-    final DN string = DN.valueOf(stringDN);
-    assertEquals(raw, string);
-  }
+        assertEquals(p.toString(), e.toString());
 
+        assertEquals(p.rdn(), RDN.valueOf("dc=bar"));
 
+        assertEquals(p.rdn(), RDN.valueOf("dc=bar"));
 
-  /**
-   * Test data for testInScopeOf tests.
-   *
-   * @return Test data.
-   */
-  @DataProvider
-  public Object[][] createIsInScopeOfTestData()
-  {
-    // @formatter:off
-    return new Object[][]
-    {
-      { "dc=x,dc=y", "dc=x,dc=y", SearchScope.BASE_OBJECT, true  },
-      { "dc=x,dc=y", "dc=z,dc=y", SearchScope.BASE_OBJECT, false },
-      { "dc=x,dc=z", "dc=x,dc=y", SearchScope.BASE_OBJECT, false },
-      { "dc=x,dc=y", "dc=y",      SearchScope.BASE_OBJECT, false },
-      { "dc=y",      "dc=x,dc=y", SearchScope.BASE_OBJECT, false },
+        assertEquals(p.parent(), DN.valueOf("dc=opendj,dc=org"));
+        assertEquals(p.parent(), e.parent());
 
-      { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.SINGLE_LEVEL, false },
-      { "dc=x,dc=y",      "dc=y",      SearchScope.SINGLE_LEVEL, true  },
-      { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.SINGLE_LEVEL, false },
-      { "dc=y",           "dc=x,dc=y", SearchScope.SINGLE_LEVEL, false },
-      { "dc=x,dc=z",      "dc=y",      SearchScope.SINGLE_LEVEL, false },
+        assertEquals(p.child(RDN.valueOf("dc=foo")), DN.valueOf("dc=foo,dc=bar,dc=opendj,dc=org"));
+        assertEquals(p.child(RDN.valueOf("dc=foo")), c);
+        assertEquals(p.child(DN.valueOf("dc=xxx,dc=foo")), DN
+                .valueOf("dc=xxx,dc=foo,dc=bar,dc=opendj,dc=org"));
+    }
 
-      { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.SUBORDINATES, false },
-      { "dc=x,dc=y",      "dc=y",      SearchScope.SUBORDINATES, true  },
-      { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.SUBORDINATES, true  },
-      { "dc=y",           "dc=x,dc=y", SearchScope.SUBORDINATES, false },
-      { "dc=x,dc=z",      "dc=y",      SearchScope.SUBORDINATES, false },
+    /**
+     * Test the getRDN method.
+     *
+     * @param s
+     *            The test DN string.
+     * @param p
+     *            The expected parent.
+     * @param r
+     *            The expected rdn.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createParentAndRDNTestData")
+    public void testRDN(final String s, final String p, final String r) throws Exception {
+        final DN dn = DN.valueOf(s);
+        final RDN rdn = (r != null ? RDN.valueOf(r) : null);
 
-      { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.WHOLE_SUBTREE, true },
-      { "dc=x,dc=y",      "dc=y",      SearchScope.WHOLE_SUBTREE, true  },
-      { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.WHOLE_SUBTREE, true  },
-      { "dc=y",           "dc=x,dc=y", SearchScope.WHOLE_SUBTREE, false },
-      { "dc=x,dc=z",      "dc=y",      SearchScope.WHOLE_SUBTREE, false },
-    };
-    // @formatter:on
-  }
+        assertEquals(dn.rdn(), rdn, "For DN " + s);
+    }
 
+    /**
+     * Tests the root DN.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testRootDN1() throws Exception {
+        final DN dn = DN.valueOf("");
+        assertTrue(dn.isRootDN());
+        assertEquals(dn, DN.rootDN());
+    }
 
+    /**
+     * Tests the root DN.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = { NullPointerException.class, AssertionError.class })
+    public void testRootDN2() throws Exception {
+        final DN dn = DN.valueOf(null);
+        assertEquals(dn, DN.rootDN());
+    }
 
-  /**
-   * Tests {@link DN#isInScopeOf(String, SearchScope)}.
-   *
-   * @param dn
-   *          The target DN.
-   * @param baseDN
-   *          The scope base DN.
-   * @param scope
-   *          The search scope.
-   * @param expectedResult
-   *          The expected result.
-   */
-  @Test(dataProvider="createIsInScopeOfTestData")
-  public void testIsInScopeOfString(final String dn, final String baseDN,
-      final SearchScope scope, final boolean expectedResult)
-  {
-    assertEquals(DN.valueOf(dn).isInScopeOf(baseDN, scope), expectedResult);
-  }
+    /**
+     * Test the root dn.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testRootDN3() throws Exception {
+        final DN nullDN = DN.rootDN();
+        assertTrue(nullDN.isRootDN());
+        assertTrue(nullDN.size() == 0);
+    }
 
+    /**
+     * Test the root dn.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testRootDN4() throws Exception {
+        final DN dn = DN.valueOf("dc=com");
+        assertFalse(dn.isRootDN());
+    }
 
+    /**
+     * Tests the subordinate dns.
+     */
+    @Test(dataProvider = "createSubordinateTestData")
+    public void testSubordinateDN(final String sub, final String base, final boolean e)
+            throws Exception {
+        final DN dn = DN.valueOf(sub);
+        final DN other = DN.valueOf(base);
+        assertEquals(dn.isSubordinateOrEqualTo(other), e, sub + " isSubordinateOf " + base);
+    }
 
-  /**
-   * Tests {@link DN#isInScopeOf(DN, SearchScope)}.
-   *
-   * @param dn
-   *          The target DN.
-   * @param baseDN
-   *          The scope base DN.
-   * @param scope
-   *          The search scope.
-   * @param expectedResult
-   *          The expected result.
-   */
-  @Test(dataProvider = "createIsInScopeOfTestData")
-  public void testIsInScopeOfDN(final String dn, final String baseDN,
-      final SearchScope scope, final boolean expectedResult)
-  {
-    assertEquals(DN.valueOf(dn).isInScopeOf(DN.valueOf(baseDN), scope),
-        expectedResult);
-  }
+    /**
+     * Tests the supeiror dns.
+     */
+    @Test(dataProvider = "createSuperiorTestData")
+    public void testSuperiorDN(final String base, final String sub, final boolean e)
+            throws Exception {
+        final DN dn = DN.valueOf(base);
+        final DN other = DN.valueOf(sub);
+        assertEquals(dn.isSuperiorOrEqualTo(other), e, base + " isSuperiorOf " + sub);
+    }
 
+    /**
+     * Test the RFC 4514 string representation of the DN.
+     *
+     * @param rawDN
+     *            Raw DN string representation.
+     * @param normDN
+     *            Normalized DN string representation.
+     * @param stringDN
+     *            String representation.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "testDNs")
+    public void testToString(final String rawDN, final String normDN, final String stringDN)
+            throws Exception {
+        // DN dn = DN.valueOf(rawDN);
+        // assertEquals(dn.toString(), stringDN);
+    }
 
+    /**
+     * Tests the <CODE>valueOf</CODE> method which takes a String argument.
+     *
+     * @param rawDN
+     *            Raw DN string representation.
+     * @param normDN
+     *            Normalized DN string representation.
+     * @param stringDN
+     *            String representation.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "testDNs")
+    public void testValueOfString(final String rawDN, final String normDN, final String stringDN)
+            throws Exception {
+        final DN raw = DN.valueOf(rawDN);
+        final DN string = DN.valueOf(stringDN);
+        assertEquals(raw, string);
+    }
 
-  /**
-   * Test data for testLocalName tests.
-   *
-   * @return Test data.
-   */
-  @DataProvider
-  public Object[][] createLocalNameTestData()
-  {
-    // @formatter:off
-    return new Object[][]
-    {
-      { "", 0, "" },
-      { "", 1, "" },
+    /**
+     * Test data for testInScopeOf tests.
+     *
+     * @return Test data.
+     */
+    @DataProvider
+    public Object[][] createIsInScopeOfTestData() {
+        // @formatter:off
+        return new Object[][] {
+            { "dc=x,dc=y", "dc=x,dc=y", SearchScope.BASE_OBJECT, true  },
+            { "dc=x,dc=y", "dc=z,dc=y", SearchScope.BASE_OBJECT, false },
+            { "dc=x,dc=z", "dc=x,dc=y", SearchScope.BASE_OBJECT, false },
+            { "dc=x,dc=y", "dc=y",      SearchScope.BASE_OBJECT, false },
+            { "dc=y",      "dc=x,dc=y", SearchScope.BASE_OBJECT, false },
 
-      { "dc=x", 0, "" },
-      { "dc=x", 1, "dc=x" },
-      { "dc=x", 2, "dc=x" },
+            { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.SINGLE_LEVEL, false },
+            { "dc=x,dc=y",      "dc=y",      SearchScope.SINGLE_LEVEL, true  },
+            { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.SINGLE_LEVEL, false },
+            { "dc=y",           "dc=x,dc=y", SearchScope.SINGLE_LEVEL, false },
+            { "dc=x,dc=z",      "dc=y",      SearchScope.SINGLE_LEVEL, false },
 
-      { "dc=x,dc=y", 0, "" },
-      { "dc=x,dc=y", 1, "dc=x" },
-      { "dc=x,dc=y", 2, "dc=x,dc=y" },
-      { "dc=x,dc=y", 3, "dc=x,dc=y" },
+            { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.SUBORDINATES, false },
+            { "dc=x,dc=y",      "dc=y",      SearchScope.SUBORDINATES, true  },
+            { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.SUBORDINATES, true  },
+            { "dc=y",           "dc=x,dc=y", SearchScope.SUBORDINATES, false },
+            { "dc=x,dc=z",      "dc=y",      SearchScope.SUBORDINATES, false },
 
-      { "dc=x,dc=y,dc=z", 0, "" },
-      { "dc=x,dc=y,dc=z", 1, "dc=x" },
-      { "dc=x,dc=y,dc=z", 2, "dc=x,dc=y" },
-      { "dc=x,dc=y,dc=z", 3, "dc=x,dc=y,dc=z" },
-      { "dc=x,dc=y,dc=z", 4, "dc=x,dc=y,dc=z" },
-    };
-    // @formatter:on
-  }
+            { "dc=x,dc=y",      "dc=x,dc=y", SearchScope.WHOLE_SUBTREE, true },
+            { "dc=x,dc=y",      "dc=y",      SearchScope.WHOLE_SUBTREE, true  },
+            { "dc=z,dc=x,dc=y", "dc=y",      SearchScope.WHOLE_SUBTREE, true  },
+            { "dc=y",           "dc=x,dc=y", SearchScope.WHOLE_SUBTREE, false },
+            { "dc=x,dc=z",      "dc=y",      SearchScope.WHOLE_SUBTREE, false },
+        };
+        // @formatter:on
+    }
 
+    /**
+     * Tests {@link DN#isInScopeOf(String, SearchScope)}.
+     *
+     * @param dn
+     *            The target DN.
+     * @param baseDN
+     *            The scope base DN.
+     * @param scope
+     *            The search scope.
+     * @param expectedResult
+     *            The expected result.
+     */
+    @Test(dataProvider = "createIsInScopeOfTestData")
+    public void testIsInScopeOfString(final String dn, final String baseDN,
+            final SearchScope scope, final boolean expectedResult) {
+        assertEquals(DN.valueOf(dn).isInScopeOf(baseDN, scope), expectedResult);
+    }
 
+    /**
+     * Tests {@link DN#isInScopeOf(DN, SearchScope)}.
+     *
+     * @param dn
+     *            The target DN.
+     * @param baseDN
+     *            The scope base DN.
+     * @param scope
+     *            The search scope.
+     * @param expectedResult
+     *            The expected result.
+     */
+    @Test(dataProvider = "createIsInScopeOfTestData")
+    public void testIsInScopeOfDN(final String dn, final String baseDN, final SearchScope scope,
+            final boolean expectedResult) {
+        assertEquals(DN.valueOf(dn).isInScopeOf(DN.valueOf(baseDN), scope), expectedResult);
+    }
 
-  /**
-   * Tests {@link DN#localName(int)}.
-   *
-   * @param dn
-   *          The DN whose local name is to be obtained.
-   * @param index
-   *          The number of RDNs in the local name.
-   * @param expectedDN
-   *          The expected local name.
-   */
-  @Test(dataProvider = "createLocalNameTestData")
-  public void testLocalName(final String dn, final int index,
-      final String expectedDN)
-  {
-    assertEquals(DN.valueOf(dn).localName(index), DN.valueOf(expectedDN));
-  }
+    /**
+     * Test data for testLocalName tests.
+     *
+     * @return Test data.
+     */
+    @DataProvider
+    public Object[][] createLocalNameTestData() {
+        // @formatter:off
+        return new Object[][] {
+            { "", 0, "" },
+            { "", 1, "" },
 
+            { "dc=x", 0, "" },
+            { "dc=x", 1, "dc=x" },
+            { "dc=x", 2, "dc=x" },
 
+            { "dc=x,dc=y", 0, "" },
+            { "dc=x,dc=y", 1, "dc=x" },
+            { "dc=x,dc=y", 2, "dc=x,dc=y" },
+            { "dc=x,dc=y", 3, "dc=x,dc=y" },
 
-  /**
-   * Test data for testLocalName tests.
-   *
-   * @return Test data.
-   */
-  @DataProvider
-  public Object[][] createRenameTestData()
-  {
-    // @formatter:off
-    return new Object[][]
-    {
-      { "", "", "", "" },
-      { "", "", "dc=x", "dc=x" },
-      { "dc=x", "", "dc=y", "dc=x,dc=y" },
-      { "dc=x", "dc=x", "dc=y", "dc=y" },
-      { "dc=x,dc=y", "dc=y", "dc=z", "dc=x,dc=z" },
-      { "dc=x,dc=y", "dc=x,dc=y", "dc=z", "dc=z" },
-      { "dc=x,dc=y", "dc=x", "dc=z", "dc=x,dc=y" },
-    };
-    // @formatter:on
-  }
+            { "dc=x,dc=y,dc=z", 0, "" },
+            { "dc=x,dc=y,dc=z", 1, "dc=x" },
+            { "dc=x,dc=y,dc=z", 2, "dc=x,dc=y" },
+            { "dc=x,dc=y,dc=z", 3, "dc=x,dc=y,dc=z" },
+            { "dc=x,dc=y,dc=z", 4, "dc=x,dc=y,dc=z" },
+        };
+        // @formatter:on
+    }
 
+    /**
+     * Tests {@link DN#localName(int)}.
+     *
+     * @param dn
+     *            The DN whose local name is to be obtained.
+     * @param index
+     *            The number of RDNs in the local name.
+     * @param expectedDN
+     *            The expected local name.
+     */
+    @Test(dataProvider = "createLocalNameTestData")
+    public void testLocalName(final String dn, final int index, final String expectedDN) {
+        assertEquals(DN.valueOf(dn).localName(index), DN.valueOf(expectedDN));
+    }
 
+    /**
+     * Test data for testLocalName tests.
+     *
+     * @return Test data.
+     */
+    @DataProvider
+    public Object[][] createRenameTestData() {
+        // @formatter:off
+        return new Object[][] {
+            { "", "", "", "" },
+            { "", "", "dc=x", "dc=x" },
+            { "dc=x", "", "dc=y", "dc=x,dc=y" },
+            { "dc=x", "dc=x", "dc=y", "dc=y" },
+            { "dc=x,dc=y", "dc=y", "dc=z", "dc=x,dc=z" },
+            { "dc=x,dc=y", "dc=x,dc=y", "dc=z", "dc=z" },
+            { "dc=x,dc=y", "dc=x", "dc=z", "dc=x,dc=y" },
+        };
+        // @formatter:on
+    }
 
-  /**
-   * Tests {@link DN#rename(DN, DN)}.
-   *
-   * @param dn
-   *          The DN to be renamed.
-   * @param fromDN
-   *          The source DN.
-   * @param toDN
-   *          The destination DN.
-   * @param expectedDN
-   *          The expected result.
-   */
-  @Test(dataProvider = "createRenameTestData")
-  public void testRename(final String dn, final String fromDN,
-      final String toDN, final String expectedDN)
-  {
-    assertEquals(DN.valueOf(dn).rename(DN.valueOf(fromDN), DN.valueOf(toDN)),
-        DN.valueOf(expectedDN));
-  }
+    /**
+     * Tests {@link DN#rename(DN, DN)}.
+     *
+     * @param dn
+     *            The DN to be renamed.
+     * @param fromDN
+     *            The source DN.
+     * @param toDN
+     *            The destination DN.
+     * @param expectedDN
+     *            The expected result.
+     */
+    @Test(dataProvider = "createRenameTestData")
+    public void testRename(final String dn, final String fromDN, final String toDN,
+            final String expectedDN) {
+        assertEquals(DN.valueOf(dn).rename(DN.valueOf(fromDN), DN.valueOf(toDN)), DN
+                .valueOf(expectedDN));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java
index 628d042..b08f423 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,207 +26,190 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Iterator;
 
-import org.forgerock.opendj.ldap.Entries;
-import org.forgerock.opendj.ldap.Entry;
-import org.forgerock.opendj.ldap.LinkedHashMapEntry;
-import org.forgerock.opendj.ldap.Modification;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test {@code Entries}.
  */
-public final class EntriesTestCase extends SdkTestCase
-{
-  /**
-   * Creates test data for {@link #testDiffEntries}.
-   *
-   * @return The test data.
-   */
-  @DataProvider(name = "createTestDiffEntriesData")
-  public Object[][] createTestDiffEntriesData()
-  {
-    // @formatter:off
-    Entry empty = new LinkedHashMapEntry(
-        "dn: cn=test",
-        "objectClass: top",
-        "objectClass: test"
-    );
+public final class EntriesTestCase extends SdkTestCase {
+    /**
+     * Creates test data for {@link #testDiffEntries}.
+     *
+     * @return The test data.
+     */
+    @DataProvider(name = "createTestDiffEntriesData")
+    public Object[][] createTestDiffEntriesData() {
+        // @formatter:off
+        Entry empty = new LinkedHashMapEntry(
+            "dn: cn=test",
+            "objectClass: top",
+            "objectClass: test"
+        );
 
-    Entry from = new LinkedHashMapEntry(
-        "dn: cn=test",
-        "objectClass: top",
-        "objectClass: test",
-        "fromOnly: fromOnlyValue",
-        "bothSame: one",
-        "bothSame: two",
-        "bothSame: three",
-        "bothDifferentDeletes: common",
-        "bothDifferentDeletes: fromOnly1",
-        "bothDifferentDeletes: fromOnly2",
-        "bothDifferentAdds: common",
-        "bothDifferentAddsAndDeletes: common",
-        "bothDifferentAddsAndDeletes: fromOnly",
-        "bothDifferentReplace: fromOnly1",
-        "bothDifferentReplace: fromOnly2"
-    );
+        Entry from = new LinkedHashMapEntry(
+            "dn: cn=test",
+            "objectClass: top",
+            "objectClass: test",
+            "fromOnly: fromOnlyValue",
+            "bothSame: one",
+            "bothSame: two",
+            "bothSame: three",
+            "bothDifferentDeletes: common",
+            "bothDifferentDeletes: fromOnly1",
+            "bothDifferentDeletes: fromOnly2",
+            "bothDifferentAdds: common",
+            "bothDifferentAddsAndDeletes: common",
+            "bothDifferentAddsAndDeletes: fromOnly",
+            "bothDifferentReplace: fromOnly1",
+            "bothDifferentReplace: fromOnly2"
+        );
 
-    Entry to = new LinkedHashMapEntry(
-        "dn: cn=test",
-        "objectClass: top",
-        "objectClass: test",
-        "toOnly: toOnlyValue",
-        "bothSame: one",
-        "bothSame: two",
-        "bothSame: three",
-        "bothDifferentDeletes: common",
-        "bothDifferentAdds: common",
-        "bothDifferentAdds: toOnly1",
-        "bothDifferentAdds: toOnly2",
-        "bothDifferentAddsAndDeletes: common",
-        "bothDifferentAddsAndDeletes: toOnly",
-        "bothDifferentReplace: toOnly1",
-        "bothDifferentReplace: toOnly2"
-    );
+        Entry to = new LinkedHashMapEntry(
+            "dn: cn=test",
+            "objectClass: top",
+            "objectClass: test",
+            "toOnly: toOnlyValue",
+            "bothSame: one",
+            "bothSame: two",
+            "bothSame: three",
+            "bothDifferentDeletes: common",
+            "bothDifferentAdds: common",
+            "bothDifferentAdds: toOnly1",
+            "bothDifferentAdds: toOnly2",
+            "bothDifferentAddsAndDeletes: common",
+            "bothDifferentAddsAndDeletes: toOnly",
+            "bothDifferentReplace: toOnly1",
+            "bothDifferentReplace: toOnly2"
+        );
 
-    ModifyRequest diffFromEmpty = Requests.newModifyRequest(
-        "dn: cn=test",
-        "changetype: modify",
-        "delete: bothDifferentAdds",
-        "bothDifferentAdds: common",
-        "-",
-        "delete: bothDifferentAddsAndDeletes",
-        "bothDifferentAddsAndDeletes: common",
-        "bothDifferentAddsAndDeletes: fromOnly",
-        "-",
-        "delete: bothDifferentDeletes",
-        "bothDifferentDeletes: common",
-        "bothDifferentDeletes: fromOnly1",
-        "bothDifferentDeletes: fromOnly2",
-        "-",
-        "delete: bothDifferentReplace",
-        "bothDifferentReplace: fromOnly1",
-        "bothDifferentReplace: fromOnly2",
-        "-",
-        "delete: bothSame",
-        "bothSame: one",
-        "bothSame: two",
-        "bothSame: three",
-        "-",
-        "delete: fromOnly",
-        "fromOnly: fromOnlyValue"
-    );
+        ModifyRequest diffFromEmpty = Requests.newModifyRequest(
+            "dn: cn=test",
+            "changetype: modify",
+            "delete: bothDifferentAdds",
+            "bothDifferentAdds: common",
+            "-",
+            "delete: bothDifferentAddsAndDeletes",
+            "bothDifferentAddsAndDeletes: common",
+            "bothDifferentAddsAndDeletes: fromOnly",
+            "-",
+            "delete: bothDifferentDeletes",
+            "bothDifferentDeletes: common",
+            "bothDifferentDeletes: fromOnly1",
+            "bothDifferentDeletes: fromOnly2",
+            "-",
+            "delete: bothDifferentReplace",
+            "bothDifferentReplace: fromOnly1",
+            "bothDifferentReplace: fromOnly2",
+            "-",
+            "delete: bothSame",
+            "bothSame: one",
+            "bothSame: two",
+            "bothSame: three",
+            "-",
+            "delete: fromOnly",
+            "fromOnly: fromOnlyValue"
+        );
 
-    ModifyRequest diffEmptyTo = Requests.newModifyRequest(
-        "dn: cn=test",
-        "changetype: modify",
-        "add: bothDifferentAdds",
-        "bothDifferentAdds: common",
-        "bothDifferentAdds: toOnly1",
-        "bothDifferentAdds: toOnly2",
-        "-",
-        "add: bothDifferentAddsAndDeletes",
-        "bothDifferentAddsAndDeletes: common",
-        "bothDifferentAddsAndDeletes: toOnly",
-        "-",
-        "add: bothDifferentDeletes",
-        "bothDifferentDeletes: common",
-        "-",
-        "add: bothDifferentReplace",
-        "bothDifferentReplace: toOnly1",
-        "bothDifferentReplace: toOnly2",
-        "-",
-        "add: bothSame",
-        "bothSame: one",
-        "bothSame: two",
-        "bothSame: three",
-        "-",
-        "add: toOnly",
-        "toOnly: toOnlyValue"
-    );
+        ModifyRequest diffEmptyTo = Requests.newModifyRequest(
+            "dn: cn=test",
+            "changetype: modify",
+            "add: bothDifferentAdds",
+            "bothDifferentAdds: common",
+            "bothDifferentAdds: toOnly1",
+            "bothDifferentAdds: toOnly2",
+            "-",
+            "add: bothDifferentAddsAndDeletes",
+            "bothDifferentAddsAndDeletes: common",
+            "bothDifferentAddsAndDeletes: toOnly",
+            "-",
+            "add: bothDifferentDeletes",
+            "bothDifferentDeletes: common",
+            "-",
+            "add: bothDifferentReplace",
+            "bothDifferentReplace: toOnly1",
+            "bothDifferentReplace: toOnly2",
+            "-",
+            "add: bothSame",
+            "bothSame: one",
+            "bothSame: two",
+            "bothSame: three",
+            "-",
+            "add: toOnly",
+            "toOnly: toOnlyValue"
+        );
 
-    ModifyRequest diffFromTo = Requests.newModifyRequest(
-        "dn: cn=test",
-        "changetype: modify",
-        "add: bothDifferentAdds",
-        "bothDifferentAdds: toOnly1",
-        "bothDifferentAdds: toOnly2",
-        "-",
-        "add: bothDifferentAddsAndDeletes",
-        "bothDifferentAddsAndDeletes: toOnly",
-        "-",
-        "delete: bothDifferentAddsAndDeletes",
-        "bothDifferentAddsAndDeletes: fromOnly",
-        "-",
-        "delete: bothDifferentDeletes",
-        "bothDifferentDeletes: fromOnly1",
-        "bothDifferentDeletes: fromOnly2",
-        "-",
-        "add: bothDifferentReplace",
-        "bothDifferentReplace: toOnly1",
-        "bothDifferentReplace: toOnly2",
-        "-",
-        "delete: bothDifferentReplace",
-        "bothDifferentReplace: fromOnly1",
-        "bothDifferentReplace: fromOnly2",
-        "-",
-        "delete: fromOnly",
-        "fromOnly: fromOnlyValue",
-        "-",
-        "add: toOnly",
-        "toOnly: toOnlyValue"
-    );
+        ModifyRequest diffFromTo = Requests.newModifyRequest(
+            "dn: cn=test",
+            "changetype: modify",
+            "add: bothDifferentAdds",
+            "bothDifferentAdds: toOnly1",
+            "bothDifferentAdds: toOnly2",
+            "-",
+            "add: bothDifferentAddsAndDeletes",
+            "bothDifferentAddsAndDeletes: toOnly",
+            "-",
+            "delete: bothDifferentAddsAndDeletes",
+            "bothDifferentAddsAndDeletes: fromOnly",
+            "-",
+            "delete: bothDifferentDeletes",
+            "bothDifferentDeletes: fromOnly1",
+            "bothDifferentDeletes: fromOnly2",
+            "-",
+            "add: bothDifferentReplace",
+            "bothDifferentReplace: toOnly1",
+            "bothDifferentReplace: toOnly2",
+            "-",
+            "delete: bothDifferentReplace",
+            "bothDifferentReplace: fromOnly1",
+            "bothDifferentReplace: fromOnly2",
+            "-",
+            "delete: fromOnly",
+            "fromOnly: fromOnlyValue",
+            "-",
+            "add: toOnly",
+            "toOnly: toOnlyValue"
+        );
 
-    // From, to, diff.
-    return new Object[][]
-    {
-      { from,  empty, diffFromEmpty },
-      { empty, to,    diffEmptyTo   },
-      { from,  to,    diffFromTo    }
-    };
+        // From, to, diff.
+        return new Object[][] {
+            { from,  empty, diffFromEmpty },
+            { empty, to,    diffEmptyTo   },
+            { from,  to,    diffFromTo    }
+        };
 
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Tests {@link Entries#diffEntries(Entry, Entry)}.
-   *
-   * @param from
-   *          Source entry.
-   * @param to
-   *          Destination entry.
-   * @param expected
-   *          Expected modifications.
-   */
-  @Test(dataProvider = "createTestDiffEntriesData")
-  public void testDiffEntries(final Entry from, final Entry to,
-      final ModifyRequest expected)
-  {
-    ModifyRequest actual = Entries.diffEntries(from, to);
-
-    Assert.assertEquals(from.getName(), actual.getName());
-    Assert.assertEquals(actual.getModifications().size(), expected
-        .getModifications().size());
-    Iterator<Modification> i1 = actual.getModifications().iterator();
-    Iterator<Modification> i2 = expected.getModifications().iterator();
-    while (i1.hasNext())
-    {
-      Modification m1 = i1.next();
-      Modification m2 = i2.next();
-
-      Assert.assertEquals(m1.getModificationType(), m2.getModificationType());
-      Assert.assertEquals(m1.getAttribute(), m2.getAttribute());
+        // @formatter:on
     }
-  }
+
+    /**
+     * Tests {@link Entries#diffEntries(Entry, Entry)}.
+     *
+     * @param from
+     *            Source entry.
+     * @param to
+     *            Destination entry.
+     * @param expected
+     *            Expected modifications.
+     */
+    @Test(dataProvider = "createTestDiffEntriesData")
+    public void testDiffEntries(final Entry from, final Entry to, final ModifyRequest expected) {
+        ModifyRequest actual = Entries.diffEntries(from, to);
+
+        Assert.assertEquals(from.getName(), actual.getName());
+        Assert.assertEquals(actual.getModifications().size(), expected.getModifications().size());
+        Iterator<Modification> i1 = actual.getModifications().iterator();
+        Iterator<Modification> i2 = expected.getModifications().iterator();
+        while (i1.hasNext()) {
+            Modification m1 = i1.next();
+            Modification m2 = i2.next();
+
+            Assert.assertEquals(m1.getModificationType(), m2.getModificationType());
+            Assert.assertEquals(m1.getAttribute(), m2.getAttribute());
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java
index b6810ec..5476659 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,98 +26,69 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.Entry;
-import org.forgerock.opendj.ldap.LinkedHashMapEntry;
-import org.forgerock.opendj.ldap.TreeMapEntry;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test {@code Entry}.
  */
 @SuppressWarnings("javadoc")
-public final class EntryTestCase extends SdkTestCase
-{
-  private static interface EntryFactory
-  {
-    Entry newEntry(String... ldifLines);
-  }
-
-
-
-  private static final class LinkedHashMapEntryFactory implements EntryFactory
-  {
-    public Entry newEntry(final String... ldifLines)
-    {
-      return new LinkedHashMapEntry(ldifLines);
+public final class EntryTestCase extends SdkTestCase {
+    private static interface EntryFactory {
+        Entry newEntry(String... ldifLines);
     }
-  }
 
-
-
-  private static final class TreeMapEntryFactory implements EntryFactory
-  {
-    public Entry newEntry(final String... ldifLines)
-    {
-      return new TreeMapEntry(ldifLines);
+    private static final class LinkedHashMapEntryFactory implements EntryFactory {
+        public Entry newEntry(final String... ldifLines) {
+            return new LinkedHashMapEntry(ldifLines);
+        }
     }
-  }
 
-
-
-  @DataProvider(name = "EntryFactory")
-  public Object[][] entryFactory()
-  {
-    // Value, type, options, containsOptions("foo")
-    return new Object[][] { { new TreeMapEntryFactory() },
-        { new LinkedHashMapEntryFactory() } };
-  }
-
-
-
-  @Test(dataProvider = "EntryFactory")
-  public void smokeTest(final EntryFactory factory) throws Exception
-  {
-    final Entry entry1 = factory.newEntry(
-        "dn: cn=Joe Bloggs,dc=example,dc=com", "objectClass: top",
-        "objectClass: person", "cn: Joe Bloggs", "sn: Bloggs",
-        "givenName: Joe", "description: A description");
-
-    final Entry entry2 = factory.newEntry(
-        "dn: cn=Joe Bloggs,dc=example,dc=com", "changetype: add",
-        "objectClass: top", "objectClass: person", "cn: Joe Bloggs",
-        "sn: Bloggs", "givenName: Joe", "description: A description");
-
-    Assert.assertEquals(entry1, entry2);
-
-    for (final Entry e : new Entry[] { entry1, entry2 })
-    {
-      Assert.assertEquals(e.getName(), DN
-          .valueOf("cn=Joe Bloggs,dc=example,dc=com"));
-      Assert.assertEquals(e.getAttributeCount(), 5);
-
-      Assert.assertEquals(e.getAttribute("objectClass").size(), 2);
-      Assert.assertTrue(e.containsAttribute("objectClass", "top", "person"));
-      Assert.assertFalse(e.containsAttribute("objectClass", "top", "person",
-          "foo"));
-
-      Assert.assertTrue(e.containsAttribute("objectClass"));
-      Assert.assertTrue(e.containsAttribute("cn"));
-      Assert.assertTrue(e.containsAttribute("cn", "Joe Bloggs"));
-      Assert.assertFalse(e.containsAttribute("cn", "Jane Bloggs"));
-      Assert.assertTrue(e.containsAttribute("sn"));
-      Assert.assertTrue(e.containsAttribute("givenName"));
-      Assert.assertTrue(e.containsAttribute("description"));
-
-      Assert.assertEquals(e.getAttribute("cn").firstValueAsString(),
-          "Joe Bloggs");
-      Assert.assertEquals(e.getAttribute("sn").firstValueAsString(), "Bloggs");
+    private static final class TreeMapEntryFactory implements EntryFactory {
+        public Entry newEntry(final String... ldifLines) {
+            return new TreeMapEntry(ldifLines);
+        }
     }
-  }
+
+    @DataProvider(name = "EntryFactory")
+    public Object[][] entryFactory() {
+        // Value, type, options, containsOptions("foo")
+        return new Object[][] { { new TreeMapEntryFactory() }, { new LinkedHashMapEntryFactory() } };
+    }
+
+    @Test(dataProvider = "EntryFactory")
+    public void smokeTest(final EntryFactory factory) throws Exception {
+        final Entry entry1 =
+                factory.newEntry("dn: cn=Joe Bloggs,dc=example,dc=com", "objectClass: top",
+                        "objectClass: person", "cn: Joe Bloggs", "sn: Bloggs", "givenName: Joe",
+                        "description: A description");
+
+        final Entry entry2 =
+                factory.newEntry("dn: cn=Joe Bloggs,dc=example,dc=com", "changetype: add",
+                        "objectClass: top", "objectClass: person", "cn: Joe Bloggs", "sn: Bloggs",
+                        "givenName: Joe", "description: A description");
+
+        Assert.assertEquals(entry1, entry2);
+
+        for (final Entry e : new Entry[] { entry1, entry2 }) {
+            Assert.assertEquals(e.getName(), DN.valueOf("cn=Joe Bloggs,dc=example,dc=com"));
+            Assert.assertEquals(e.getAttributeCount(), 5);
+
+            Assert.assertEquals(e.getAttribute("objectClass").size(), 2);
+            Assert.assertTrue(e.containsAttribute("objectClass", "top", "person"));
+            Assert.assertFalse(e.containsAttribute("objectClass", "top", "person", "foo"));
+
+            Assert.assertTrue(e.containsAttribute("objectClass"));
+            Assert.assertTrue(e.containsAttribute("cn"));
+            Assert.assertTrue(e.containsAttribute("cn", "Joe Bloggs"));
+            Assert.assertFalse(e.containsAttribute("cn", "Jane Bloggs"));
+            Assert.assertTrue(e.containsAttribute("sn"));
+            Assert.assertTrue(e.containsAttribute("givenName"));
+            Assert.assertTrue(e.containsAttribute("description"));
+
+            Assert.assertEquals(e.getAttribute("cn").firstValueAsString(), "Joe Bloggs");
+            Assert.assertEquals(e.getAttribute("sn").firstValueAsString(), "Bloggs");
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java
index 44466f2..12a9465 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
@@ -39,200 +36,183 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 @SuppressWarnings("javadoc")
-public class FilterTestCase extends SdkTestCase
-{
-  @DataProvider(name = "badfilterstrings")
-  public Object[][] getBadFilterStrings() throws Exception
-  {
-    return new Object[][] { { null, null }, { "", null }, { "=", null },
-        { "()", null }, { "(&(objectClass=*)(sn=s*s)", null },
-        { "(dob>12221)", null }, { "(cn=bob\\2 doe)", null },
-        { "(cn=\\4j\\w2\\yu)", null }, { "(cn=ds\\2)", null },
-        { "(&(givenname=bob)|(sn=pep)dob=12))", null }, { "(:=bob)", null },
-        { "(=sally)", null }, { "(cn=billy bob", null },
-        { "(|(!(title=sweep*)(l=Paris*)))", null }, { "(|(!))", null },
-        { "((uid=user.0))", null }, { "(&&(uid=user.0))", null },
-        { "!uid=user.0", null }, { "(:dn:=Sally)", null }, };
-  }
+public class FilterTestCase extends SdkTestCase {
+    @DataProvider(name = "badfilterstrings")
+    public Object[][] getBadFilterStrings() throws Exception {
+        return new Object[][] { { null, null }, { "", null }, { "=", null }, { "()", null },
+            { "(&(objectClass=*)(sn=s*s)", null }, { "(dob>12221)", null },
+            { "(cn=bob\\2 doe)", null }, { "(cn=\\4j\\w2\\yu)", null }, { "(cn=ds\\2)", null },
+            { "(&(givenname=bob)|(sn=pep)dob=12))", null }, { "(:=bob)", null },
+            { "(=sally)", null }, { "(cn=billy bob", null },
+            { "(|(!(title=sweep*)(l=Paris*)))", null }, { "(|(!))", null },
+            { "((uid=user.0))", null }, { "(&&(uid=user.0))", null }, { "!uid=user.0", null },
+            { "(:dn:=Sally)", null }, };
+    }
 
+    @DataProvider(name = "filterstrings")
+    public Object[][] getFilterStrings() throws Exception {
+        final Filter equal =
+                Filter.newEqualityMatchFilter("objectClass", ByteString.valueOf("\\test*(Value)"));
+        final Filter equal2 = Filter.newEqualityMatchFilter("objectClass", ByteString.valueOf(""));
+        final Filter approx =
+                Filter.newApproxMatchFilter("sn", ByteString.valueOf("\\test*(Value)"));
+        final Filter greater =
+                Filter.newGreaterOrEqualFilter("employeeNumber", ByteString
+                        .valueOf("\\test*(Value)"));
+        final Filter less =
+                Filter.newLessOrEqualFilter("dob", ByteString.valueOf("\\test*(Value)"));
+        final Filter presense = Filter.newPresentFilter("login");
 
+        final ArrayList<ByteString> any = new ArrayList<ByteString>(0);
+        final ArrayList<ByteString> multiAny = new ArrayList<ByteString>(1);
+        multiAny.add(ByteString.valueOf("\\wid*(get)"));
+        multiAny.add(ByteString.valueOf("*"));
 
-  @DataProvider(name = "filterstrings")
-  public Object[][] getFilterStrings() throws Exception
-  {
-    final Filter equal = Filter.newEqualityMatchFilter("objectClass",
-        ByteString.valueOf("\\test*(Value)"));
-    final Filter equal2 = Filter.newEqualityMatchFilter("objectClass",
-        ByteString.valueOf(""));
-    final Filter approx = Filter.newApproxMatchFilter("sn", ByteString
-        .valueOf("\\test*(Value)"));
-    final Filter greater = Filter.newGreaterOrEqualFilter("employeeNumber",
-        ByteString.valueOf("\\test*(Value)"));
-    final Filter less = Filter.newLessOrEqualFilter("dob", ByteString
-        .valueOf("\\test*(Value)"));
-    final Filter presense = Filter.newPresentFilter("login");
+        final Filter substring1 =
+                Filter.newSubstringsFilter("givenName", ByteString.valueOf("\\Jo*()"), any,
+                        ByteString.valueOf("\\n*()"));
+        final Filter substring2 =
+                Filter.newSubstringsFilter("givenName", ByteString.valueOf("\\Jo*()"), multiAny,
+                        ByteString.valueOf("\\n*()"));
+        final Filter substring3 =
+                Filter.newSubstringsFilter("givenName", ByteString.valueOf(""), any, ByteString
+                        .valueOf("\\n*()"));
+        final Filter substring4 =
+                Filter.newSubstringsFilter("givenName", ByteString.valueOf("\\Jo*()"), any,
+                        ByteString.valueOf(""));
+        final Filter substring5 =
+                Filter.newSubstringsFilter("givenName", ByteString.valueOf(""), multiAny,
+                        ByteString.valueOf(""));
+        final Filter extensible1 =
+                Filter.newExtensibleMatchFilter("2.4.6.8.19", "cn", ByteString
+                        .valueOf("\\John* (Doe)"), false);
+        final Filter extensible2 =
+                Filter.newExtensibleMatchFilter("2.4.6.8.19", "cn", ByteString
+                        .valueOf("\\John* (Doe)"), true);
+        final Filter extensible3 =
+                Filter.newExtensibleMatchFilter("2.4.6.8.19", null, ByteString
+                        .valueOf("\\John* (Doe)"), true);
+        final Filter extensible4 =
+                Filter.newExtensibleMatchFilter(null, "cn", ByteString.valueOf("\\John* (Doe)"),
+                        true);
+        final Filter extensible5 =
+                Filter.newExtensibleMatchFilter("2.4.6.8.19", null, ByteString
+                        .valueOf("\\John* (Doe)"), false);
 
-    final ArrayList<ByteString> any = new ArrayList<ByteString>(0);
-    final ArrayList<ByteString> multiAny = new ArrayList<ByteString>(1);
-    multiAny.add(ByteString.valueOf("\\wid*(get)"));
-    multiAny.add(ByteString.valueOf("*"));
+        final ArrayList<Filter> list1 = new ArrayList<Filter>();
+        list1.add(equal);
+        list1.add(approx);
 
-    final Filter substring1 = Filter.newSubstringsFilter("givenName",
-        ByteString.valueOf("\\Jo*()"), any, ByteString.valueOf("\\n*()"));
-    final Filter substring2 = Filter.newSubstringsFilter("givenName",
-        ByteString.valueOf("\\Jo*()"), multiAny, ByteString.valueOf("\\n*()"));
-    final Filter substring3 = Filter.newSubstringsFilter("givenName",
-        ByteString.valueOf(""), any, ByteString.valueOf("\\n*()"));
-    final Filter substring4 = Filter.newSubstringsFilter("givenName",
-        ByteString.valueOf("\\Jo*()"), any, ByteString.valueOf(""));
-    final Filter substring5 = Filter.newSubstringsFilter("givenName",
-        ByteString.valueOf(""), multiAny, ByteString.valueOf(""));
-    final Filter extensible1 = Filter.newExtensibleMatchFilter("2.4.6.8.19",
-        "cn", ByteString.valueOf("\\John* (Doe)"), false);
-    final Filter extensible2 = Filter.newExtensibleMatchFilter("2.4.6.8.19",
-        "cn", ByteString.valueOf("\\John* (Doe)"), true);
-    final Filter extensible3 = Filter.newExtensibleMatchFilter("2.4.6.8.19",
-        null, ByteString.valueOf("\\John* (Doe)"), true);
-    final Filter extensible4 = Filter.newExtensibleMatchFilter(null, "cn",
-        ByteString.valueOf("\\John* (Doe)"), true);
-    final Filter extensible5 = Filter.newExtensibleMatchFilter("2.4.6.8.19",
-        null, ByteString.valueOf("\\John* (Doe)"), false);
+        final Filter and = Filter.newAndFilter(list1);
 
-    final ArrayList<Filter> list1 = new ArrayList<Filter>();
-    list1.add(equal);
-    list1.add(approx);
+        final ArrayList<Filter> list2 = new ArrayList<Filter>();
+        list2.add(substring1);
+        list2.add(extensible1);
+        list2.add(and);
 
-    final Filter and = Filter.newAndFilter(list1);
+        return new Object[][] {
+            { "(objectClass=\\5Ctest\\2A\\28Value\\29)", equal },
 
-    final ArrayList<Filter> list2 = new ArrayList<Filter>();
-    list2.add(substring1);
-    list2.add(extensible1);
-    list2.add(and);
+            { "(objectClass=)", equal2 },
 
-    return new Object[][] {
-        { "(objectClass=\\5Ctest\\2A\\28Value\\29)", equal },
+            { "(sn~=\\5Ctest\\2A\\28Value\\29)", approx },
 
-        { "(objectClass=)", equal2 },
+            { "(employeeNumber>=\\5Ctest\\2A\\28Value\\29)", greater },
 
-        { "(sn~=\\5Ctest\\2A\\28Value\\29)", approx },
+            { "(dob<=\\5Ctest\\2A\\28Value\\29)", less },
 
-        { "(employeeNumber>=\\5Ctest\\2A\\28Value\\29)", greater },
+            { "(login=*)", presense },
 
-        { "(dob<=\\5Ctest\\2A\\28Value\\29)", less },
+            { "(givenName=\\5CJo\\2A\\28\\29*\\5Cn\\2A\\28\\29)", substring1 },
 
-        { "(login=*)", presense },
+            { "(givenName=\\5CJo\\2A\\28\\29*\\5Cwid\\2A\\28get\\29*\\2A*\\5Cn\\2A\\28\\29)",
+                substring2 },
 
-        { "(givenName=\\5CJo\\2A\\28\\29*\\5Cn\\2A\\28\\29)", substring1 },
+            { "(givenName=*\\5Cn\\2A\\28\\29)", substring3 },
 
-        {
-            "(givenName=\\5CJo\\2A\\28\\29*\\5Cwid\\2A\\28get\\29*\\2A*\\5Cn\\2A\\28\\29)",
-            substring2 },
+            { "(givenName=\\5CJo\\2A\\28\\29*)", substring4 },
 
-        { "(givenName=*\\5Cn\\2A\\28\\29)", substring3 },
+            { "(givenName=*\\5Cwid\\2A\\28get\\29*\\2A*)", substring5 },
 
-        { "(givenName=\\5CJo\\2A\\28\\29*)", substring4 },
+            { "(cn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible1 },
 
-        { "(givenName=*\\5Cwid\\2A\\28get\\29*\\2A*)", substring5 },
+            { "(cn:dn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible2 },
 
-        { "(cn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible1 },
+            { "(:dn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible3 },
 
-        { "(cn:dn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible2 },
+            { "(cn:dn:=\\5CJohn\\2A \\28Doe\\29)", extensible4 },
 
-        { "(:dn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible3 },
+            { "(:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible5 },
 
-        { "(cn:dn:=\\5CJohn\\2A \\28Doe\\29)", extensible4 },
+            { "(&(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29))",
+                Filter.newAndFilter(list1) },
 
-        { "(:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)", extensible5 },
+            { "(|(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29))",
+                Filter.newOrFilter(list1) },
 
-        {
-            "(&(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29))",
-            Filter.newAndFilter(list1) },
+            { "(!(objectClass=\\5Ctest\\2A\\28Value\\29))", Filter.newNotFilter(equal) },
 
-        {
-            "(|(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29))",
-            Filter.newOrFilter(list1) },
+            {
+                "(|(givenName=\\5CJo\\2A\\28\\29*\\5Cn\\2A\\28\\29)(cn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)"
+                        + "(&(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29)))",
+                Filter.newOrFilter(list2) }
 
-        { "(!(objectClass=\\5Ctest\\2A\\28Value\\29))",
-            Filter.newNotFilter(equal) },
+        };
+    }
 
-        {
-            "(|(givenName=\\5CJo\\2A\\28\\29*\\5Cn\\2A\\28\\29)(cn:2.4.6.8.19:=\\5CJohn\\2A \\28Doe\\29)"
-                + "(&(objectClass=\\5Ctest\\2A\\28Value\\29)(sn~=\\5Ctest\\2A\\28Value\\29)))",
-            Filter.newOrFilter(list2) }
+    /**
+     * Decodes the specified filter strings.
+     *
+     * @param filterStr
+     * @param filter
+     * @throws Exception
+     */
+    @Test(dataProvider = "filterstrings")
+    public void testDecode(final String filterStr, final Filter filter) throws Exception {
+        final Filter decoded = Filter.valueOf(filterStr);
+        assertEquals(decoded.toString(), filter.toString());
+    }
 
-    };
-  }
+    /**
+     * Decodes the specified filter strings.
+     *
+     * @param filterStr
+     * @param filter
+     * @throws Exception
+     */
+    @Test(dataProvider = "filterstrings")
+    public void testToString(final String filterStr, final Filter filter) throws Exception {
+        assertEquals(filterStr, filter.toString());
+    }
 
+    /**
+     * Decodes the erroneous filter strings.
+     *
+     * @param filterStr
+     * @param filter
+     * @throws Exception
+     */
+    @Test(dataProvider = "badfilterstrings", expectedExceptions = {
+            LocalizedIllegalArgumentException.class, NullPointerException.class })
+    public void testDecodeException(final String filterStr, final Filter filter) throws Exception {
+        Filter.valueOf(filterStr);
+    }
 
-
-  /**
-   * Decodes the specified filter strings.
-   *
-   * @param filterStr
-   * @param filter
-   * @throws Exception
-   */
-  @Test(dataProvider = "filterstrings")
-  public void testDecode(final String filterStr, final Filter filter)
-      throws Exception
-  {
-    final Filter decoded = Filter.valueOf(filterStr);
-    assertEquals(decoded.toString(), filter.toString());
-  }
-
-
-
-  /**
-   * Decodes the specified filter strings.
-   *
-   * @param filterStr
-   * @param filter
-   * @throws Exception
-   */
-  @Test(dataProvider = "filterstrings")
-  public void testToString(final String filterStr, final Filter filter)
-      throws Exception
-  {
-    assertEquals(filterStr, filter.toString());
-  }
-
-
-
-  /**
-   * Decodes the erroneous filter strings.
-   *
-   * @param filterStr
-   * @param filter
-   * @throws Exception
-   */
-  @Test(dataProvider = "badfilterstrings", expectedExceptions = {
-      LocalizedIllegalArgumentException.class, NullPointerException.class })
-  public void testDecodeException(final String filterStr, final Filter filter)
-      throws Exception
-  {
-    Filter.valueOf(filterStr);
-  }
-
-
-
-  /**
-   * Tests the matcher.
-   *
-   * @throws Exception
-   */
-  @Test
-  public void testMatcher() throws Exception
-  {
-    final Filter equal = Filter.newEqualityMatchFilter("cn", ByteString
-        .valueOf("\\test*(Value)"));
-    final LinkedHashMapEntry entry = new LinkedHashMapEntry(DN
-        .valueOf("cn=\\test*(Value),dc=org"));
-    entry.addAttribute("cn", "\\test*(Value)");
-    entry.addAttribute("objectclass", "top,person");
-    final Matcher matcher = equal.matcher();
-    assertTrue(matcher.matches(entry).toBoolean());
-  }
+    /**
+     * Tests the matcher.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testMatcher() throws Exception {
+        final Filter equal =
+                Filter.newEqualityMatchFilter("cn", ByteString.valueOf("\\test*(Value)"));
+        final LinkedHashMapEntry entry =
+                new LinkedHashMapEntry(DN.valueOf("cn=\\test*(Value),dc=org"));
+        entry.addAttribute("cn", "\\test*(Value)");
+        entry.addAttribute("objectclass", "top,person");
+        final Matcher matcher = equal.matcher();
+        assertTrue(matcher.matches(entry).toBoolean());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java
index 4c1e11c..21b9356 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPListenerTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,15 +27,27 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
@@ -44,1022 +55,817 @@
 
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Tests the LDAPListener class.
  */
-public class LDAPListenerTestCase extends SdkTestCase
-{
+public class LDAPListenerTestCase extends SdkTestCase {
 
-  private static class MockConnectionEventListener implements
-      ConnectionEventListener
-  {
-    final CountDownLatch closeLatch = new CountDownLatch(1);
-    String errorMessage = null;
-
-
-
-    @Override
-    public void handleConnectionClosed()
-    {
-      errorMessage = "Unexpected call to handleConnectionClosed";
-      closeLatch.countDown();
-    }
-
-
-
-    @Override
-    public void handleConnectionError(final boolean isDisconnectNotification,
-        final ErrorResultException error)
-    {
-      errorMessage = "Unexpected call to handleConnectionError";
-      closeLatch.countDown();
-    }
-
-
-
-    @Override
-    public void handleUnsolicitedNotification(final ExtendedResult notification)
-    {
-      errorMessage = "Unexpected call to handleUnsolicitedNotification";
-      closeLatch.countDown();
-    }
-  }
-
-
-
-  private static class MockServerConnection implements
-      ServerConnection<Integer>
-  {
-    volatile LDAPClientContext context = null;
-    final CountDownLatch isConnected = new CountDownLatch(1);
-    final CountDownLatch isClosed = new CountDownLatch(1);
-
-
-
-    MockServerConnection()
-    {
-      // Do nothing.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAbandon(final Integer requestContext,
-        final AbandonRequest request) throws UnsupportedOperationException
-    {
-      // Do nothing.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleAdd(final Integer requestContext,
-        final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleBind(final Integer requestContext, final int version,
-        final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleCompare(final Integer requestContext,
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler
-          .handleResult(Responses.newCompareResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionClosed(final Integer requestContext,
-        final UnbindRequest request)
-    {
-      isClosed.countDown();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionDisconnected(final ResultCode resultCode,
-        final String message)
-    {
-      // Do nothing.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleConnectionError(final Throwable error)
-    {
-      // Do nothing.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleDelete(final Integer requestContext,
-        final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <R extends ExtendedResult> void handleExtendedRequest(
-        final Integer requestContext, final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleErrorResult(ErrorResultException
-          .newErrorResult(request.getResultDecoder().newExtendedErrorResult(
-              ResultCode.PROTOCOL_ERROR, "",
-              "Extended operation " + request.getOID() + " not supported")));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModify(final Integer requestContext,
-        final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleModifyDN(final Integer requestContext,
-        final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleSearch(final Integer requestContext,
-        final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-        throws UnsupportedOperationException
-    {
-      resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
-    }
-
-  }
-
-
-
-  private static class MockServerConnectionFactory implements
-      ServerConnectionFactory<LDAPClientContext, Integer>
-  {
-
-    private final MockServerConnection serverConnection;
-
-
-
-    private MockServerConnectionFactory(
-        final MockServerConnection serverConnection)
-    {
-      this.serverConnection = serverConnection;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ServerConnection<Integer> handleAccept(
-        final LDAPClientContext clientContext) throws ErrorResultException
-    {
-      serverConnection.context = clientContext;
-      serverConnection.isConnected.countDown();
-      return serverConnection;
-    }
-  }
-
-
-
-  /**
-   * Disables logging before the tests.
-   */
-  @BeforeClass()
-  public void disableLogging()
-  {
-    StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
-  }
-
-
-
-  /**
-   * Re-enable logging after the tests.
-   */
-  @AfterClass()
-  public void enableLogging()
-  {
-    StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
-  }
-
-
-
-  /**
-   * Tests connection event listener.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test
-  public void testConnectionEventListenerClose() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    final Connection connection;
-    try
-    {
-      // Connect and bind.
-      connection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-
-      final MockConnectionEventListener listener = new MockConnectionEventListener()
-      {
+    private static class MockConnectionEventListener implements ConnectionEventListener {
+        final CountDownLatch closeLatch = new CountDownLatch(1);
+        String errorMessage = null;
 
         @Override
-        public void handleConnectionClosed()
-        {
-          closeLatch.countDown();
+        public void handleConnectionClosed() {
+            errorMessage = "Unexpected call to handleConnectionClosed";
+            closeLatch.countDown();
         }
-      };
-
-      connection.addConnectionEventListener(listener);
-      Assert.assertEquals(listener.closeLatch.getCount(), 1);
-      connection.close();
-      listener.closeLatch.await();
-      Assert.assertNull(listener.errorMessage);
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests connection event listener.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test(enabled = false)
-  public void testConnectionEventListenerDisconnect() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    final Connection connection;
-    try
-    {
-      // Connect and bind.
-      connection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-
-      final MockConnectionEventListener listener = new MockConnectionEventListener()
-      {
 
         @Override
-        public void handleConnectionError(
-            final boolean isDisconnectNotification,
-            final ErrorResultException error)
-        {
-          if (isDisconnectNotification)
-          {
-            errorMessage = "Unexpected disconnect notification";
-          }
-          closeLatch.countDown();
+        public void handleConnectionError(final boolean isDisconnectNotification,
+                final ErrorResultException error) {
+            errorMessage = "Unexpected call to handleConnectionError";
+            closeLatch.countDown();
         }
-      };
-
-      connection.addConnectionEventListener(listener);
-      Assert.assertEquals(listener.closeLatch.getCount(), 1);
-      Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-          TimeUnit.SECONDS));
-      onlineServerConnection.context.disconnect();
-      listener.closeLatch.await();
-      Assert.assertNull(listener.errorMessage);
-      connection.close();
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests connection event listener.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test
-  public void testConnectionEventListenerDisconnectNotification()
-      throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    final Connection connection;
-    try
-    {
-      // Connect and bind.
-      connection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-
-      final MockConnectionEventListener listener = new MockConnectionEventListener()
-      {
 
         @Override
-        public void handleConnectionError(
-            final boolean isDisconnectNotification,
-            final ErrorResultException error)
-        {
-          if (!isDisconnectNotification
-              || !error.getResult().getResultCode().equals(ResultCode.BUSY)
-              || !error.getResult().getDiagnosticMessage().equals("test"))
-          {
-            errorMessage = "Missing disconnect notification: " + error;
-          }
-          closeLatch.countDown();
+        public void handleUnsolicitedNotification(final ExtendedResult notification) {
+            errorMessage = "Unexpected call to handleUnsolicitedNotification";
+            closeLatch.countDown();
         }
-      };
-
-      connection.addConnectionEventListener(listener);
-      Assert.assertEquals(listener.closeLatch.getCount(), 1);
-      Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-          TimeUnit.SECONDS));
-      onlineServerConnection.context.disconnect(ResultCode.BUSY, "test");
-      listener.closeLatch.await();
-      Assert.assertNull(listener.errorMessage);
-      connection.close();
     }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
 
+    private static class MockServerConnection implements ServerConnection<Integer> {
+        volatile LDAPClientContext context = null;
+        final CountDownLatch isConnected = new CountDownLatch(1);
+        final CountDownLatch isClosed = new CountDownLatch(1);
 
+        MockServerConnection() {
+            // Do nothing.
+        }
 
-  /**
-   * Tests connection event listener.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test
-  public void testConnectionEventListenerUnbind() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    final Connection connection;
-    try
-    {
-      // Connect and bind.
-      connection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-
-      final MockConnectionEventListener listener = new MockConnectionEventListener()
-      {
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public void handleConnectionClosed()
-        {
-          closeLatch.countDown();
+        public void handleAbandon(final Integer requestContext, final AbandonRequest request)
+                throws UnsupportedOperationException {
+            // Do nothing.
         }
-      };
 
-      connection.addConnectionEventListener(listener);
-      Assert.assertEquals(listener.closeLatch.getCount(), 1);
-      connection.close(Requests.newUnbindRequest(), "called from unit test");
-      listener.closeLatch.await();
-      Assert.assertNull(listener.errorMessage);
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests basic LDAP listener functionality.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @Test
-  public void testLDAPListenerBasic() throws Exception
-  {
-    final MockServerConnection serverConnection = new MockServerConnection();
-    final MockServerConnectionFactory serverConnectionFactory = new MockServerConnectionFactory(
-        serverConnection);
-    final LDAPListener listener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), serverConnectionFactory);
-    try
-    {
-      // Connect and close.
-      final Connection connection = new LDAPConnectionFactory(
-          listener.getSocketAddress()).getConnection();
-
-      Assert.assertTrue(serverConnection.isConnected
-          .await(10, TimeUnit.SECONDS));
-      Assert.assertEquals(serverConnection.isClosed.getCount(), 1);
-
-      connection.close();
-
-      Assert.assertTrue(serverConnection.isClosed.await(10, TimeUnit.SECONDS));
-    }
-    finally
-    {
-      listener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests LDAP listener which attempts to open a connection to a remote offline
-   * server at the point when the listener accepts the client connection.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @Test(enabled = false)
-  public void testLDAPListenerLoadBalanceDuringHandleAccept() throws Exception
-  {
-    // Online server listener.
-    final int onlineServerPort = TestCaseUtils.findFreePort();
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        onlineServerPort, onlineServerConnectionFactory);
-
-    try
-    {
-      // Connection pool and load balancing tests.
-      final ConnectionFactory offlineServer1 = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              TestCaseUtils.findFreePort()), "offline1");
-      final ConnectionFactory offlineServer2 = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              TestCaseUtils.findFreePort()), "offline2");
-      final ConnectionFactory onlineServer = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              onlineServerPort), "online");
-
-      // Round robin.
-      final ConnectionFactory loadBalancer = Connections
-          .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
-              .<ConnectionFactory> asList(
-                  Connections.newFixedConnectionPool(offlineServer1, 10),
-                  Connections.newFixedConnectionPool(offlineServer2, 10),
-                  Connections.newFixedConnectionPool(onlineServer, 10))));
-
-      final MockServerConnection proxyServerConnection = new MockServerConnection();
-      final MockServerConnectionFactory proxyServerConnectionFactory = new MockServerConnectionFactory(
-          proxyServerConnection)
-      {
-
+        /**
+         * {@inheritDoc}
+         */
         @Override
-        public ServerConnection<Integer> handleAccept(
-            final LDAPClientContext clientContext) throws ErrorResultException
-        {
-          // Get connection from load balancer, this should fail over twice
-          // before getting connection to online server.
-          try
-          {
-            loadBalancer.getConnection().close();
-          }
-          catch (final InterruptedException e)
-          {
-            // Unexpected.
-            throw ErrorResultException.newErrorResult(ResultCode.OTHER,
-                "Unexpected exception when connecting to online server", e);
-          }
-          return super.handleAccept(clientContext);
+        public void handleAdd(final Integer requestContext, final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
         }
 
-      };
-
-      final LDAPListener proxyListener = new LDAPListener("localhost",
-          TestCaseUtils.findFreePort(), proxyServerConnectionFactory);
-      try
-      {
-        // Connect and close.
-        final Connection connection = new LDAPConnectionFactory(
-            proxyListener.getSocketAddress()).getConnection();
-
-        Assert.assertTrue(proxyServerConnection.isConnected.await(10,
-            TimeUnit.SECONDS));
-        Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-            TimeUnit.SECONDS));
-
-        // Wait for connect/close to complete.
-        connection.close();
-
-        proxyServerConnection.isClosed.await();
-      }
-      finally
-      {
-        proxyListener.close();
-      }
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests LDAP listener which attempts to open a connection to a load balancing
-   * pool at the point when the listener handles a bind request.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @Test
-  public void testLDAPListenerLoadBalanceDuringHandleBind() throws Exception
-  {
-    // Online server listener.
-    final int onlineServerPort = TestCaseUtils.findFreePort();
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        onlineServerPort, onlineServerConnectionFactory);
-
-    try
-    {
-      // Connection pool and load balancing tests.
-      final ConnectionFactory offlineServer1 = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              TestCaseUtils.findFreePort()), "offline1");
-      final ConnectionFactory offlineServer2 = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              TestCaseUtils.findFreePort()), "offline2");
-      final ConnectionFactory onlineServer = Connections
-          .newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
-              onlineServerPort), "online");
-
-      // Round robin.
-      final ConnectionFactory loadBalancer = Connections
-          .newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
-              .<ConnectionFactory> asList(
-                  Connections.newFixedConnectionPool(offlineServer1, 10),
-                  Connections.newFixedConnectionPool(offlineServer2, 10),
-                  Connections.newFixedConnectionPool(onlineServer, 10))));
-
-      final MockServerConnection proxyServerConnection = new MockServerConnection()
-      {
-
         /**
          * {@inheritDoc}
          */
         @Override
         public void handleBind(final Integer requestContext, final int version,
-            final BindRequest request,
-            final IntermediateResponseHandler intermediateResponseHandler,
-            final ResultHandler<? super BindResult> resultHandler)
-            throws UnsupportedOperationException
-        {
-          // Get connection from load balancer, this should fail over twice
-          // before getting connection to online server.
-          try
-          {
-            loadBalancer.getConnection().close();
-            resultHandler.handleResult(Responses
-                .newBindResult(ResultCode.SUCCESS));
-          }
-          catch (final Exception e)
-          {
-            // Unexpected.
-            resultHandler
-                .handleErrorResult(ErrorResultException.newErrorResult(
-                    ResultCode.OTHER,
-                    "Unexpected exception when connecting to load balancer", e));
-          }
+                final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
         }
 
-      };
-      final MockServerConnectionFactory proxyServerConnectionFactory = new MockServerConnectionFactory(
-          proxyServerConnection);
-
-      final LDAPListener proxyListener = new LDAPListener("localhost",
-          TestCaseUtils.findFreePort(), proxyServerConnectionFactory);
-      try
-      {
-        // Connect, bind, and close.
-        final Connection connection = new LDAPConnectionFactory(
-            proxyListener.getSocketAddress()).getConnection();
-        try
-        {
-          connection.bind("cn=test", "password".toCharArray());
-
-          Assert.assertTrue(proxyServerConnection.isConnected.await(10,
-              TimeUnit.SECONDS));
-          Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-              TimeUnit.SECONDS));
-        }
-        finally
-        {
-          connection.close();
-        }
-
-        // Wait for connect/close to complete.
-        proxyServerConnection.isClosed.await();
-      }
-      finally
-      {
-        proxyListener.close();
-      }
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests LDAP listener which attempts to open a connection to a remote offline
-   * server at the point when the listener accepts the client connection.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @Test(enabled = false)
-  public void testLDAPListenerProxyDuringHandleAccept() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    try
-    {
-      final int offlineServerPort = TestCaseUtils.findFreePort();
-
-      final MockServerConnection proxyServerConnection = new MockServerConnection();
-      final MockServerConnectionFactory proxyServerConnectionFactory = new MockServerConnectionFactory(
-          proxyServerConnection)
-      {
-
-        @Override
-        public ServerConnection<Integer> handleAccept(
-            final LDAPClientContext clientContext) throws ErrorResultException
-        {
-          // First attempt offline server.
-          LDAPConnectionFactory lcf = new LDAPConnectionFactory("localhost",
-              offlineServerPort);
-          try
-          {
-            // This is expected to fail.
-            lcf.getConnection().close();
-            throw ErrorResultException.newErrorResult(ResultCode.OTHER,
-                "Connection to offline server succeeded unexpectedly");
-          }
-          catch (final ConnectionException ce)
-          {
-            // This is expected - so go to online server.
-            try
-            {
-              lcf = new LDAPConnectionFactory(
-                  onlineServerListener.getSocketAddress());
-              lcf.getConnection().close();
-            }
-            catch (final Exception e)
-            {
-              // Unexpected.
-              throw ErrorResultException.newErrorResult(ResultCode.OTHER,
-                  "Unexpected exception when connecting to online server", e);
-            }
-          }
-          catch (final Exception e)
-          {
-            // Unexpected.
-            throw ErrorResultException.newErrorResult(ResultCode.OTHER,
-                "Unexpected exception when connecting to offline server", e);
-          }
-
-          return super.handleAccept(clientContext);
-        }
-
-      };
-      final LDAPListener proxyListener = new LDAPListener("localhost",
-          TestCaseUtils.findFreePort(), proxyServerConnectionFactory);
-      try
-      {
-        // Connect and close.
-        final Connection connection = new LDAPConnectionFactory(
-            proxyListener.getSocketAddress()).getConnection();
-
-        Assert.assertTrue(proxyServerConnection.isConnected.await(10,
-            TimeUnit.SECONDS));
-        Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-            TimeUnit.SECONDS));
-
-        connection.close();
-
-        // Wait for connect/close to complete.
-        proxyServerConnection.isClosed.await();
-      }
-      finally
-      {
-        proxyListener.close();
-      }
-    }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests LDAP listener which attempts to open a connection to a remote offline
-   * server at the point when the listener handles a bind request.
-   *
-   * @throws Exception
-   *           If an unexpected exception occurred.
-   */
-  @Test
-  public void testLDAPListenerProxyDuringHandleBind() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    try
-    {
-      final int offlineServerPort = TestCaseUtils.findFreePort();
-
-      final MockServerConnection proxyServerConnection = new MockServerConnection()
-      {
-
         /**
          * {@inheritDoc}
          */
         @Override
-        public void handleBind(final Integer requestContext, final int version,
-            final BindRequest request,
-            final IntermediateResponseHandler intermediateResponseHandler,
-            final ResultHandler<? super BindResult> resultHandler)
-            throws UnsupportedOperationException
-        {
-          // First attempt offline server.
-          LDAPConnectionFactory lcf = new LDAPConnectionFactory("localhost",
-              offlineServerPort);
-          try
-          {
-            // This is expected to fail.
-            lcf.getConnection().close();
-            resultHandler.handleErrorResult(ErrorResultException
-                .newErrorResult(ResultCode.OTHER,
-                    "Connection to offline server succeeded unexpectedly"));
-          }
-          catch (final ConnectionException ce)
-          {
-            // This is expected - so go to online server.
-            try
-            {
-              lcf = new LDAPConnectionFactory(
-                  onlineServerListener.getSocketAddress());
-              lcf.getConnection().close();
-              resultHandler.handleResult(Responses
-                  .newBindResult(ResultCode.SUCCESS));
+        public void handleCompare(final Integer requestContext, final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newCompareResult(ResultCode.SUCCESS));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionClosed(final Integer requestContext, final UnbindRequest request) {
+            isClosed.countDown();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionDisconnected(final ResultCode resultCode, final String message) {
+            // Do nothing.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleConnectionError(final Throwable error) {
+            // Do nothing.
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleDelete(final Integer requestContext, final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public <R extends ExtendedResult> void handleExtendedRequest(final Integer requestContext,
+                final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) throws UnsupportedOperationException {
+            resultHandler.handleErrorResult(ErrorResultException.newErrorResult(request
+                    .getResultDecoder().newExtendedErrorResult(ResultCode.PROTOCOL_ERROR, "",
+                            "Extended operation " + request.getOID() + " not supported")));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModify(final Integer requestContext, final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleModifyDN(final Integer requestContext, final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void handleSearch(final Integer requestContext, final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) throws UnsupportedOperationException {
+            resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+        }
+
+    }
+
+    private static class MockServerConnectionFactory implements
+            ServerConnectionFactory<LDAPClientContext, Integer> {
+
+        private final MockServerConnection serverConnection;
+
+        private MockServerConnectionFactory(final MockServerConnection serverConnection) {
+            this.serverConnection = serverConnection;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public ServerConnection<Integer> handleAccept(final LDAPClientContext clientContext)
+                throws ErrorResultException {
+            serverConnection.context = clientContext;
+            serverConnection.isConnected.countDown();
+            return serverConnection;
+        }
+    }
+
+    /**
+     * Disables logging before the tests.
+     */
+    @BeforeClass()
+    public void disableLogging() {
+        StaticUtils.DEBUG_LOG.setLevel(Level.SEVERE);
+    }
+
+    /**
+     * Re-enable logging after the tests.
+     */
+    @AfterClass()
+    public void enableLogging() {
+        StaticUtils.DEBUG_LOG.setLevel(Level.INFO);
+    }
+
+    /**
+     * Tests connection event listener.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test
+    public void testConnectionEventListenerClose() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        final Connection connection;
+        try {
+            // Connect and bind.
+            connection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+
+            final MockConnectionEventListener listener = new MockConnectionEventListener() {
+
+                @Override
+                public void handleConnectionClosed() {
+                    closeLatch.countDown();
+                }
+            };
+
+            connection.addConnectionEventListener(listener);
+            Assert.assertEquals(listener.closeLatch.getCount(), 1);
+            connection.close();
+            listener.closeLatch.await();
+            Assert.assertNull(listener.errorMessage);
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests connection event listener.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test(enabled = false)
+    public void testConnectionEventListenerDisconnect() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        final Connection connection;
+        try {
+            // Connect and bind.
+            connection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+
+            final MockConnectionEventListener listener = new MockConnectionEventListener() {
+
+                @Override
+                public void handleConnectionError(final boolean isDisconnectNotification,
+                        final ErrorResultException error) {
+                    if (isDisconnectNotification) {
+                        errorMessage = "Unexpected disconnect notification";
+                    }
+                    closeLatch.countDown();
+                }
+            };
+
+            connection.addConnectionEventListener(listener);
+            Assert.assertEquals(listener.closeLatch.getCount(), 1);
+            Assert.assertTrue(onlineServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+            onlineServerConnection.context.disconnect();
+            listener.closeLatch.await();
+            Assert.assertNull(listener.errorMessage);
+            connection.close();
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests connection event listener.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test
+    public void testConnectionEventListenerDisconnectNotification() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        final Connection connection;
+        try {
+            // Connect and bind.
+            connection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+
+            final MockConnectionEventListener listener = new MockConnectionEventListener() {
+
+                @Override
+                public void handleConnectionError(final boolean isDisconnectNotification,
+                        final ErrorResultException error) {
+                    if (!isDisconnectNotification
+                            || !error.getResult().getResultCode().equals(ResultCode.BUSY)
+                            || !error.getResult().getDiagnosticMessage().equals("test")) {
+                        errorMessage = "Missing disconnect notification: " + error;
+                    }
+                    closeLatch.countDown();
+                }
+            };
+
+            connection.addConnectionEventListener(listener);
+            Assert.assertEquals(listener.closeLatch.getCount(), 1);
+            Assert.assertTrue(onlineServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+            onlineServerConnection.context.disconnect(ResultCode.BUSY, "test");
+            listener.closeLatch.await();
+            Assert.assertNull(listener.errorMessage);
+            connection.close();
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests connection event listener.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test
+    public void testConnectionEventListenerUnbind() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        final Connection connection;
+        try {
+            // Connect and bind.
+            connection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+
+            final MockConnectionEventListener listener = new MockConnectionEventListener() {
+
+                @Override
+                public void handleConnectionClosed() {
+                    closeLatch.countDown();
+                }
+            };
+
+            connection.addConnectionEventListener(listener);
+            Assert.assertEquals(listener.closeLatch.getCount(), 1);
+            connection.close(Requests.newUnbindRequest(), "called from unit test");
+            listener.closeLatch.await();
+            Assert.assertNull(listener.errorMessage);
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests basic LDAP listener functionality.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @Test
+    public void testLDAPListenerBasic() throws Exception {
+        final MockServerConnection serverConnection = new MockServerConnection();
+        final MockServerConnectionFactory serverConnectionFactory =
+                new MockServerConnectionFactory(serverConnection);
+        final LDAPListener listener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(), serverConnectionFactory);
+        try {
+            // Connect and close.
+            final Connection connection =
+                    new LDAPConnectionFactory(listener.getSocketAddress()).getConnection();
+
+            Assert.assertTrue(serverConnection.isConnected.await(10, TimeUnit.SECONDS));
+            Assert.assertEquals(serverConnection.isClosed.getCount(), 1);
+
+            connection.close();
+
+            Assert.assertTrue(serverConnection.isClosed.await(10, TimeUnit.SECONDS));
+        } finally {
+            listener.close();
+        }
+    }
+
+    /**
+     * Tests LDAP listener which attempts to open a connection to a remote
+     * offline server at the point when the listener accepts the client
+     * connection.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @Test(enabled = false)
+    public void testLDAPListenerLoadBalanceDuringHandleAccept() throws Exception {
+        // Online server listener.
+        final int onlineServerPort = TestCaseUtils.findFreePort();
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", onlineServerPort, onlineServerConnectionFactory);
+
+        try {
+            // Connection pool and load balancing tests.
+            final ConnectionFactory offlineServer1 =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            TestCaseUtils.findFreePort()), "offline1");
+            final ConnectionFactory offlineServer2 =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            TestCaseUtils.findFreePort()), "offline2");
+            final ConnectionFactory onlineServer =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            onlineServerPort), "online");
+
+            // Round robin.
+            final ConnectionFactory loadBalancer =
+                    Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
+                            .<ConnectionFactory> asList(Connections.newFixedConnectionPool(
+                                    offlineServer1, 10), Connections.newFixedConnectionPool(
+                                    offlineServer2, 10), Connections.newFixedConnectionPool(
+                                    onlineServer, 10))));
+
+            final MockServerConnection proxyServerConnection = new MockServerConnection();
+            final MockServerConnectionFactory proxyServerConnectionFactory =
+                    new MockServerConnectionFactory(proxyServerConnection) {
+
+                        @Override
+                        public ServerConnection<Integer> handleAccept(
+                                final LDAPClientContext clientContext) throws ErrorResultException {
+                            // Get connection from load balancer, this should
+                            // fail over twice
+                            // before getting connection to online server.
+                            try {
+                                loadBalancer.getConnection().close();
+                            } catch (final InterruptedException e) {
+                                // Unexpected.
+                                throw ErrorResultException.newErrorResult(ResultCode.OTHER,
+                                        "Unexpected exception when connecting to online server", e);
+                            }
+                            return super.handleAccept(clientContext);
+                        }
+
+                    };
+
+            final LDAPListener proxyListener =
+                    new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                            proxyServerConnectionFactory);
+            try {
+                // Connect and close.
+                final Connection connection =
+                        new LDAPConnectionFactory(proxyListener.getSocketAddress()).getConnection();
+
+                Assert.assertTrue(proxyServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+                Assert.assertTrue(onlineServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+
+                // Wait for connect/close to complete.
+                connection.close();
+
+                proxyServerConnection.isClosed.await();
+            } finally {
+                proxyListener.close();
             }
-            catch (final Exception e)
-            {
-              // Unexpected.
-              resultHandler.handleErrorResult(ErrorResultException
-                  .newErrorResult(ResultCode.OTHER,
-                      "Unexpected exception when connecting to online server",
-                      e));
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests LDAP listener which attempts to open a connection to a load
+     * balancing pool at the point when the listener handles a bind request.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @Test
+    public void testLDAPListenerLoadBalanceDuringHandleBind() throws Exception {
+        // Online server listener.
+        final int onlineServerPort = TestCaseUtils.findFreePort();
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", onlineServerPort, onlineServerConnectionFactory);
+
+        try {
+            // Connection pool and load balancing tests.
+            final ConnectionFactory offlineServer1 =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            TestCaseUtils.findFreePort()), "offline1");
+            final ConnectionFactory offlineServer2 =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            TestCaseUtils.findFreePort()), "offline2");
+            final ConnectionFactory onlineServer =
+                    Connections.newNamedConnectionFactory(new LDAPConnectionFactory("localhost",
+                            onlineServerPort), "online");
+
+            // Round robin.
+            final ConnectionFactory loadBalancer =
+                    Connections.newLoadBalancer(new RoundRobinLoadBalancingAlgorithm(Arrays
+                            .<ConnectionFactory> asList(Connections.newFixedConnectionPool(
+                                    offlineServer1, 10), Connections.newFixedConnectionPool(
+                                    offlineServer2, 10), Connections.newFixedConnectionPool(
+                                    onlineServer, 10))));
+
+            final MockServerConnection proxyServerConnection = new MockServerConnection() {
+
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
+                public void handleBind(final Integer requestContext, final int version,
+                        final BindRequest request,
+                        final IntermediateResponseHandler intermediateResponseHandler,
+                        final ResultHandler<? super BindResult> resultHandler)
+                        throws UnsupportedOperationException {
+                    // Get connection from load balancer, this should fail over
+                    // twice
+                    // before getting connection to online server.
+                    try {
+                        loadBalancer.getConnection().close();
+                        resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
+                    } catch (final Exception e) {
+                        // Unexpected.
+                        resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                                ResultCode.OTHER,
+                                "Unexpected exception when connecting to load balancer", e));
+                    }
+                }
+
+            };
+            final MockServerConnectionFactory proxyServerConnectionFactory =
+                    new MockServerConnectionFactory(proxyServerConnection);
+
+            final LDAPListener proxyListener =
+                    new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                            proxyServerConnectionFactory);
+            try {
+                // Connect, bind, and close.
+                final Connection connection =
+                        new LDAPConnectionFactory(proxyListener.getSocketAddress()).getConnection();
+                try {
+                    connection.bind("cn=test", "password".toCharArray());
+
+                    Assert.assertTrue(proxyServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+                    Assert.assertTrue(onlineServerConnection.isConnected
+                            .await(10, TimeUnit.SECONDS));
+                } finally {
+                    connection.close();
+                }
+
+                // Wait for connect/close to complete.
+                proxyServerConnection.isClosed.await();
+            } finally {
+                proxyListener.close();
             }
-          }
-          catch (final Exception e)
-          {
-            // Unexpected.
-            resultHandler
-                .handleErrorResult(ErrorResultException
-                    .newErrorResult(
-                        ResultCode.OTHER,
-                        "Unexpected exception when connecting to offline server",
-                        e));
-          }
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests LDAP listener which attempts to open a connection to a remote
+     * offline server at the point when the listener accepts the client
+     * connection.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @Test(enabled = false)
+    public void testLDAPListenerProxyDuringHandleAccept() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        try {
+            final int offlineServerPort = TestCaseUtils.findFreePort();
+
+            final MockServerConnection proxyServerConnection = new MockServerConnection();
+            final MockServerConnectionFactory proxyServerConnectionFactory =
+                    new MockServerConnectionFactory(proxyServerConnection) {
+
+                        @Override
+                        public ServerConnection<Integer> handleAccept(
+                                final LDAPClientContext clientContext) throws ErrorResultException {
+                            // First attempt offline server.
+                            LDAPConnectionFactory lcf =
+                                    new LDAPConnectionFactory("localhost", offlineServerPort);
+                            try {
+                                // This is expected to fail.
+                                lcf.getConnection().close();
+                                throw ErrorResultException.newErrorResult(ResultCode.OTHER,
+                                        "Connection to offline server succeeded unexpectedly");
+                            } catch (final ConnectionException ce) {
+                                // This is expected - so go to online server.
+                                try {
+                                    lcf =
+                                            new LDAPConnectionFactory(onlineServerListener
+                                                    .getSocketAddress());
+                                    lcf.getConnection().close();
+                                } catch (final Exception e) {
+                                    // Unexpected.
+                                    throw ErrorResultException
+                                            .newErrorResult(
+                                                    ResultCode.OTHER,
+                                                    "Unexpected exception when connecting to online server",
+                                                    e);
+                                }
+                            } catch (final Exception e) {
+                                // Unexpected.
+                                throw ErrorResultException
+                                        .newErrorResult(
+                                                ResultCode.OTHER,
+                                                "Unexpected exception when connecting to offline server",
+                                                e);
+                            }
+
+                            return super.handleAccept(clientContext);
+                        }
+
+                    };
+            final LDAPListener proxyListener =
+                    new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                            proxyServerConnectionFactory);
+            try {
+                // Connect and close.
+                final Connection connection =
+                        new LDAPConnectionFactory(proxyListener.getSocketAddress()).getConnection();
+
+                Assert.assertTrue(proxyServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+                Assert.assertTrue(onlineServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+
+                connection.close();
+
+                // Wait for connect/close to complete.
+                proxyServerConnection.isClosed.await();
+            } finally {
+                proxyListener.close();
+            }
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests LDAP listener which attempts to open a connection to a remote
+     * offline server at the point when the listener handles a bind request.
+     *
+     * @throws Exception
+     *             If an unexpected exception occurred.
+     */
+    @Test
+    public void testLDAPListenerProxyDuringHandleBind() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        try {
+            final int offlineServerPort = TestCaseUtils.findFreePort();
+
+            final MockServerConnection proxyServerConnection = new MockServerConnection() {
+
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
+                public void handleBind(final Integer requestContext, final int version,
+                        final BindRequest request,
+                        final IntermediateResponseHandler intermediateResponseHandler,
+                        final ResultHandler<? super BindResult> resultHandler)
+                        throws UnsupportedOperationException {
+                    // First attempt offline server.
+                    LDAPConnectionFactory lcf =
+                            new LDAPConnectionFactory("localhost", offlineServerPort);
+                    try {
+                        // This is expected to fail.
+                        lcf.getConnection().close();
+                        resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                                ResultCode.OTHER,
+                                "Connection to offline server succeeded unexpectedly"));
+                    } catch (final ConnectionException ce) {
+                        // This is expected - so go to online server.
+                        try {
+                            lcf =
+                                    new LDAPConnectionFactory(onlineServerListener
+                                            .getSocketAddress());
+                            lcf.getConnection().close();
+                            resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
+                        } catch (final Exception e) {
+                            // Unexpected.
+                            resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                                    ResultCode.OTHER,
+                                    "Unexpected exception when connecting to online server", e));
+                        }
+                    } catch (final Exception e) {
+                        // Unexpected.
+                        resultHandler.handleErrorResult(ErrorResultException.newErrorResult(
+                                ResultCode.OTHER,
+                                "Unexpected exception when connecting to offline server", e));
+                    }
+                }
+
+            };
+            final MockServerConnectionFactory proxyServerConnectionFactory =
+                    new MockServerConnectionFactory(proxyServerConnection);
+            final LDAPListener proxyListener =
+                    new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                            proxyServerConnectionFactory);
+            try {
+                // Connect, bind, and close.
+                final Connection connection =
+                        new LDAPConnectionFactory(proxyListener.getSocketAddress()).getConnection();
+                try {
+                    connection.bind("cn=test", "password".toCharArray());
+
+                    Assert.assertTrue(proxyServerConnection.isConnected.await(10, TimeUnit.SECONDS));
+                    Assert.assertTrue(onlineServerConnection.isConnected
+                            .await(10, TimeUnit.SECONDS));
+                } finally {
+                    connection.close();
+                }
+
+                // Wait for connect/close to complete.
+                proxyServerConnection.isClosed.await();
+            } finally {
+                proxyListener.close();
+            }
+        } finally {
+            onlineServerListener.close();
+        }
+    }
+
+    /**
+     * Tests server-side disconnection.
+     *
+     * @throws Exception
+     *             If an unexpected error occurred.
+     */
+    @Test
+    public void testServerDisconnect() throws Exception {
+        final MockServerConnection onlineServerConnection = new MockServerConnection();
+        final MockServerConnectionFactory onlineServerConnectionFactory =
+                new MockServerConnectionFactory(onlineServerConnection);
+        final LDAPListener onlineServerListener =
+                new LDAPListener("localhost", TestCaseUtils.findFreePort(),
+                        onlineServerConnectionFactory);
+
+        final Connection connection;
+        try {
+            // Connect and bind.
+            connection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+            try {
+                connection.bind("cn=test", "password".toCharArray());
+            } catch (final ErrorResultException e) {
+                connection.close();
+                throw e;
+            }
+        } finally {
+            onlineServerConnection.context.disconnect();
+            onlineServerListener.close();
         }
 
-      };
-      final MockServerConnectionFactory proxyServerConnectionFactory = new MockServerConnectionFactory(
-          proxyServerConnection);
-      final LDAPListener proxyListener = new LDAPListener("localhost",
-          TestCaseUtils.findFreePort(), proxyServerConnectionFactory);
-      try
-      {
-        // Connect, bind, and close.
-        final Connection connection = new LDAPConnectionFactory(
-            proxyListener.getSocketAddress()).getConnection();
-        try
-        {
-          connection.bind("cn=test", "password".toCharArray());
-
-          Assert.assertTrue(proxyServerConnection.isConnected.await(10,
-              TimeUnit.SECONDS));
-          Assert.assertTrue(onlineServerConnection.isConnected.await(10,
-              TimeUnit.SECONDS));
-        }
-        finally
-        {
-          connection.close();
+        try {
+            // Connect and bind.
+            final Connection failedConnection =
+                    new LDAPConnectionFactory(onlineServerListener.getSocketAddress())
+                            .getConnection();
+            failedConnection.close();
+            connection.close();
+            Assert.fail("Connection attempt to closed listener succeeded unexpectedly");
+        } catch (final ConnectionException e) {
+            // Expected.
         }
 
-        // Wait for connect/close to complete.
-        proxyServerConnection.isClosed.await();
-      }
-      finally
-      {
-        proxyListener.close();
-      }
+        try {
+            connection.bind("cn=test", "password".toCharArray());
+            Assert.fail("Bind attempt on closed connection succeeded unexpectedly");
+        } catch (final ErrorResultException e) {
+            // Expected.
+            Assert.assertFalse(connection.isValid());
+            Assert.assertFalse(connection.isClosed());
+        } finally {
+            connection.close();
+            Assert.assertFalse(connection.isValid());
+            Assert.assertTrue(connection.isClosed());
+        }
     }
-    finally
-    {
-      onlineServerListener.close();
-    }
-  }
-
-
-
-  /**
-   * Tests server-side disconnection.
-   *
-   * @throws Exception
-   *           If an unexpected error occurred.
-   */
-  @Test
-  public void testServerDisconnect() throws Exception
-  {
-    final MockServerConnection onlineServerConnection = new MockServerConnection();
-    final MockServerConnectionFactory onlineServerConnectionFactory = new MockServerConnectionFactory(
-        onlineServerConnection);
-    final LDAPListener onlineServerListener = new LDAPListener("localhost",
-        TestCaseUtils.findFreePort(), onlineServerConnectionFactory);
-
-    final Connection connection;
-    try
-    {
-      // Connect and bind.
-      connection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-      try
-      {
-        connection.bind("cn=test", "password".toCharArray());
-      }
-      catch (final ErrorResultException e)
-      {
-        connection.close();
-        throw e;
-      }
-    }
-    finally
-    {
-      onlineServerConnection.context.disconnect();
-      onlineServerListener.close();
-    }
-
-    try
-    {
-      // Connect and bind.
-      final Connection failedConnection = new LDAPConnectionFactory(
-          onlineServerListener.getSocketAddress()).getConnection();
-      failedConnection.close();
-      connection.close();
-      Assert
-          .fail("Connection attempt to closed listener succeeded unexpectedly");
-    }
-    catch (final ConnectionException e)
-    {
-      // Expected.
-    }
-
-    try
-    {
-      connection.bind("cn=test", "password".toCharArray());
-      Assert.fail("Bind attempt on closed connection succeeded unexpectedly");
-    }
-    catch (final ErrorResultException e)
-    {
-      // Expected.
-      Assert.assertFalse(connection.isValid());
-      Assert.assertFalse(connection.isClosed());
-    }
-    finally
-    {
-      connection.close();
-      Assert.assertFalse(connection.isValid());
-      Assert.assertTrue(connection.isClosed());
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java
index 9dd693a..c24add4 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,31 +27,55 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static com.forgerock.opendj.ldap.LDAPConstants.TYPE_AUTHENTICATION_SASL;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.net.ssl.SSLContext;
-import javax.security.auth.callback.*;
-import javax.security.sasl.*;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.AuthorizeCallback;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslException;
+import javax.security.sasl.SaslServer;
 
 import org.forgerock.opendj.asn1.ASN1;
 import org.forgerock.opendj.asn1.ASN1Reader;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
-import org.forgerock.opendj.ldap.requests.*;
-import org.forgerock.opendj.ldap.responses.*;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.GenericBindRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Request;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.StartTLSExtendedRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
 import com.forgerock.opendj.ldap.controls.AccountUsabilityRequestControl;
 import com.forgerock.opendj.ldap.controls.AccountUsabilityResponseControl;
 
-
-
 /**
  * A simple ldap server that manages 1000 entries and used for running
  * testcases.
@@ -60,725 +83,556 @@
  * FIXME: make it MT-safe.
  */
 @SuppressWarnings("javadoc")
-public class LDAPServer implements
-    ServerConnectionFactory<LDAPClientContext, Integer>
-{
-  // Creates an abandonable request from the ordinary requests.
-  private static class AbandonableRequest implements Request
-  {
-    // the request.
-    private final Request request;
+public class LDAPServer implements ServerConnectionFactory<LDAPClientContext, Integer> {
+    // Creates an abandonable request from the ordinary requests.
+    private static class AbandonableRequest implements Request {
+        // the request.
+        private final Request request;
 
-    // whether is has been cancelled.
-    private final AtomicBoolean isCanceled;
+        // whether is has been cancelled.
+        private final AtomicBoolean isCanceled;
 
+        // Ctor.
+        AbandonableRequest(final Request request) {
+            this.request = request;
+            this.isCanceled = new AtomicBoolean(false);
+        }
 
+        public Request addControl(final Control cntrl) {
+            return request.addControl(cntrl);
+        }
 
-    // Ctor.
-    AbandonableRequest(final Request request)
-    {
-      this.request = request;
-      this.isCanceled = new AtomicBoolean(false);
+        public <C extends Control> C getControl(final ControlDecoder<C> decoder,
+                final DecodeOptions options) throws DecodeException {
+            return request.getControl(decoder, options);
+        }
+
+        public List<Control> getControls() {
+            return request.getControls();
+        }
+
+        void cancel() {
+            isCanceled.set(true);
+        }
+
+        boolean isCanceled() {
+            return isCanceled.get();
+        }
     }
 
-
-
-    public Request addControl(final Control cntrl)
-    {
-      return request.addControl(cntrl);
-    }
-
-
-
-    public <C extends Control> C getControl(final ControlDecoder<C> decoder,
-        final DecodeOptions options) throws DecodeException
-    {
-      return request.getControl(decoder, options);
-    }
-
-
-
-    public List<Control> getControls()
-    {
-      return request.getControls();
-    }
-
-
-
-    void cancel()
-    {
-      isCanceled.set(true);
-    }
-
-
-
-    boolean isCanceled()
-    {
-      return isCanceled.get();
-    }
-  }
-
-
-
-  // The singleton instance.
-  private static final LDAPServer instance = new LDAPServer();
-
-
-
-  /**
-   * Returns the singleton instance.
-   *
-   * @return Singleton instance.
-   */
-  public static LDAPServer getInstance()
-  {
-    return instance;
-  }
-
-
-
-  private class LDAPServerConnection implements ServerConnection<Integer>
-  {
-
-    private final LDAPClientContext clientContext;
-    private SaslServer saslServer;
-
-
-
-    private LDAPServerConnection(LDAPClientContext clientContext)
-    {
-      this.clientContext = clientContext;
-    }
-
-
+    // The singleton instance.
+    private static final LDAPServer INSTANCE = new LDAPServer();
 
     /**
-     * Abandons the request sent by the client.
+     * Returns the singleton instance.
      *
-     * @param context
-     * @param request
-     * @throws UnsupportedOperationException
+     * @return Singleton instance.
      */
-    public void handleAbandon(final Integer context,
-        final AbandonRequest request) throws UnsupportedOperationException
-    {
-      // Check if we have any concurrent operation with this message id.
-      final AbandonableRequest req = requestsInProgress.get(request
-          .getRequestID());
-      if (req == null)
-      {
-        // Nothing to do here.
-        return;
-      }
-      // Cancel the request
-      req.cancel();
-      // No response is needed.
+    public static LDAPServer getInstance() {
+        return INSTANCE;
     }
 
+    private class LDAPServerConnection implements ServerConnection<Integer> {
 
+        private final LDAPClientContext clientContext;
+        private SaslServer saslServer;
 
-    /**
-     * Adds the request sent by the client.
-     *
-     * @param context
-     * @param request
-     * @param handler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public void handleAdd(final Integer context, final AddRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> handler)
-        throws UnsupportedOperationException
-    {
-      Result result = null;
-      final AbandonableRequest abReq = new AbandonableRequest(request);
-      requestsInProgress.put(context, abReq);
-      // Get the DN.
-      final DN dn = request.getName();
-      if (entryMap.containsKey(dn))
-      {
-        // duplicate entry.
-        result = Responses.newResult(ResultCode.ENTRY_ALREADY_EXISTS);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        handler.handleErrorResult(ere);
-        // doesn't matter if it was canceled.
-        requestsInProgress.remove(context);
-        return;
-      }
+        private LDAPServerConnection(LDAPClientContext clientContext) {
+            this.clientContext = clientContext;
+        }
 
-      // Create an entry out of this request.
-      final SearchResultEntry entry = Responses.newSearchResultEntry(dn);
-      for (final Control control : request.getControls())
-      {
-        entry.addControl(control);
-      }
+        /**
+         * Abandons the request sent by the client.
+         *
+         * @param context
+         * @param request
+         * @throws UnsupportedOperationException
+         */
+        public void handleAbandon(final Integer context, final AbandonRequest request)
+                throws UnsupportedOperationException {
+            // Check if we have any concurrent operation with this message id.
+            final AbandonableRequest req = requestsInProgress.get(request.getRequestID());
+            if (req == null) {
+                // Nothing to do here.
+                return;
+            }
+            // Cancel the request
+            req.cancel();
+            // No response is needed.
+        }
 
-      for (final Attribute attr : request.getAllAttributes())
-      {
-        entry.addAttribute(attr);
-      }
-
-      if (abReq.isCanceled())
-      {
-        result = Responses.newResult(ResultCode.CANCELLED);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        handler.handleErrorResult(ere);
-        requestsInProgress.remove(context);
-        return;
-      }
-      // Add this to the map.
-      entryMap.put(dn, entry);
-      requestsInProgress.remove(context);
-      result = Responses.newResult(ResultCode.SUCCESS);
-      handler.handleResult(result);
-    }
-
-
-
-    /**
-     * @param context
-     * @param version
-     * @param request
-     * @param resultHandler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public void handleBind(final Integer context, final int version,
-        final BindRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super BindResult> resultHandler)
-        throws UnsupportedOperationException
-    {
-      // TODO: all bind types.
-      final AbandonableRequest abReq = new AbandonableRequest(request);
-      requestsInProgress.put(context, abReq);
-      if (request.getAuthenticationType() == TYPE_AUTHENTICATION_SASL
-          && request instanceof GenericBindRequest)
-      {
-        ASN1Reader reader = ASN1.getReader(((GenericBindRequest) request)
-            .getAuthenticationValue());
-        try
-        {
-          String saslMech = reader.readOctetStringAsString();
-          ByteString saslCred;
-          if (reader.hasNextElement())
-          {
-            saslCred = reader.readOctetString();
-          }
-          else
-          {
-            saslCred = ByteString.empty();
-          }
-
-          if (saslServer == null
-              || !saslServer.getMechanismName().equalsIgnoreCase(saslMech))
-          {
-            final Map<String, String> props = new HashMap<String, String>();
-            props.put(Sasl.QOP, "auth-conf,auth-int,auth");
-            saslServer = Sasl.createSaslServer(saslMech, "ldap", clientContext
-                .getLocalAddress().getHostName(), props, new CallbackHandler()
-            {
-              public void handle(Callback[] callbacks) throws IOException,
-                  UnsupportedCallbackException
-              {
-                for (final Callback callback : callbacks)
-                {
-                  if (callback instanceof NameCallback)
-                  {
-                    // Do nothing
-                  }
-                  else if (callback instanceof PasswordCallback)
-                  {
-                    ((PasswordCallback) callback).setPassword("password"
-                        .toCharArray());
-                  }
-                  else if (callback instanceof AuthorizeCallback)
-                  {
-                    ((AuthorizeCallback) callback).setAuthorized(true);
-                  }
-                  else if (callback instanceof RealmCallback)
-                  {
-                    // Do nothing
-                  }
-                  else
-                  {
-                    throw new UnsupportedCallbackException(callback);
-
-                  }
-                }
-              }
-            });
-          }
-
-          byte[] challenge = saslServer
-              .evaluateResponse(saslCred.toByteArray());
-          if (saslServer.isComplete())
-          {
-            resultHandler.handleResult(Responses.newBindResult(
-                ResultCode.SUCCESS).setServerSASLCredentials(
-                ByteString.wrap(challenge)));
-
-            String qop = (String) saslServer.getNegotiatedProperty(Sasl.QOP);
-            if (qop != null
-                && (qop.equalsIgnoreCase("auth-int") || qop
-                    .equalsIgnoreCase("auth-conf")))
-            {
-              ConnectionSecurityLayer csl = new ConnectionSecurityLayer()
-              {
-                public void dispose()
-                {
-                  try
-                  {
-                    saslServer.dispose();
-                  }
-                  catch (SaslException e)
-                  {
-                    e.printStackTrace();
-                  }
-                }
-
-
-
-                public byte[] unwrap(byte[] incoming, int offset, int len)
-                    throws ErrorResultException
-                {
-                  try
-                  {
-                    return saslServer.unwrap(incoming, offset, len);
-                  }
-                  catch (SaslException e)
-                  {
-                    throw ErrorResultException.newErrorResult(Responses
-                        .newResult(ResultCode.OPERATIONS_ERROR).setCause(e));
-                  }
-                }
-
-
-
-                public byte[] wrap(byte[] outgoing, int offset, int len)
-                    throws ErrorResultException
-                {
-                  try
-                  {
-                    return saslServer.wrap(outgoing, offset, len);
-                  }
-                  catch (SaslException e)
-                  {
-                    throw ErrorResultException.newErrorResult(Responses
-                        .newResult(ResultCode.OPERATIONS_ERROR).setCause(e));
-                  }
-                }
-              };
-
-              clientContext.enableConnectionSecurityLayer(csl);
+        /**
+         * Adds the request sent by the client.
+         *
+         * @param context
+         * @param request
+         * @param handler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleAdd(final Integer context, final AddRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> handler) throws UnsupportedOperationException {
+            Result result = null;
+            final AbandonableRequest abReq = new AbandonableRequest(request);
+            requestsInProgress.put(context, abReq);
+            // Get the DN.
+            final DN dn = request.getName();
+            if (entryMap.containsKey(dn)) {
+                // duplicate entry.
+                result = Responses.newResult(ResultCode.ENTRY_ALREADY_EXISTS);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                handler.handleErrorResult(ere);
+                // doesn't matter if it was canceled.
+                requestsInProgress.remove(context);
+                return;
             }
 
-          }
-          else
-          {
-            resultHandler.handleResult(Responses.newBindResult(
-                ResultCode.SASL_BIND_IN_PROGRESS).setServerSASLCredentials(
-                ByteString.wrap(challenge)));
-          }
-        }
-        catch (Exception e)
-        {
-          resultHandler.handleErrorResult(ErrorResultException
-              .newErrorResult(Responses
-                  .newBindResult(ResultCode.OPERATIONS_ERROR).setCause(e)
-                  .setDiagnosticMessage(e.toString())));
-        }
-      }
-      else
-      {
-        resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
-      }
-      requestsInProgress.remove(context);
-    }
+            // Create an entry out of this request.
+            final SearchResultEntry entry = Responses.newSearchResultEntry(dn);
+            for (final Control control : request.getControls()) {
+                entry.addControl(control);
+            }
 
+            for (final Attribute attr : request.getAllAttributes()) {
+                entry.addAttribute(attr);
+            }
 
-
-    /**
-     * {@inheritDoc}
-     */
-    public void handleConnectionClosed(final Integer context,
-        final UnbindRequest request)
-    {
-      close();
-    }
-
-
-
-    private void close()
-    {
-      if (saslServer != null)
-      {
-        try
-        {
-          saslServer.dispose();
-        }
-        catch (SaslException e)
-        {
-          e.printStackTrace();
-        }
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void handleConnectionDisconnected(ResultCode resultCode,
-        String message)
-    {
-      close();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void handleConnectionError(final Throwable error)
-    {
-      close();
-    }
-
-
-
-    /**
-     * @param context
-     * @param request
-     * @param resultHandler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public void handleCompare(final Integer context,
-        final CompareRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super CompareResult> resultHandler)
-        throws UnsupportedOperationException
-    {
-      CompareResult result = null;
-      final AbandonableRequest abReq = new AbandonableRequest(request);
-      requestsInProgress.put(context, abReq);
-      // Get the DN.
-      final DN dn = request.getName();
-      if (!entryMap.containsKey(dn))
-      {
-        // entry not found.
-        result = Responses.newCompareResult(ResultCode.NO_SUCH_ATTRIBUTE);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        resultHandler.handleErrorResult(ere);
-        // doesn't matter if it was canceled.
-        requestsInProgress.remove(context);
-        return;
-      }
-
-      // Get the entry.
-      final Entry entry = entryMap.get(dn);
-      final AttributeDescription attrDesc = request.getAttributeDescription();
-      for (final Attribute attr : entry.getAllAttributes(attrDesc))
-      {
-        final Iterator<ByteString> it = attr.iterator();
-        while (it.hasNext())
-        {
-          final ByteString s = it.next();
-          if (abReq.isCanceled())
-          {
-            final Result r = Responses.newResult(ResultCode.CANCELLED);
-            final ErrorResultException ere = ErrorResultException
-                .newErrorResult(r);
-            resultHandler.handleErrorResult(ere);
+            if (abReq.isCanceled()) {
+                result = Responses.newResult(ResultCode.CANCELLED);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                handler.handleErrorResult(ere);
+                requestsInProgress.remove(context);
+                return;
+            }
+            // Add this to the map.
+            entryMap.put(dn, entry);
             requestsInProgress.remove(context);
-            return;
-          }
-          if (s.equals(request.getAssertionValue()))
-          {
-            result = Responses.newCompareResult(ResultCode.COMPARE_TRUE);
+            result = Responses.newResult(ResultCode.SUCCESS);
+            handler.handleResult(result);
+        }
+
+        /**
+         * @param context
+         * @param version
+         * @param request
+         * @param resultHandler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleBind(final Integer context, final int version, final BindRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super BindResult> resultHandler)
+                throws UnsupportedOperationException {
+            // TODO: all bind types.
+            final AbandonableRequest abReq = new AbandonableRequest(request);
+            requestsInProgress.put(context, abReq);
+            if (request.getAuthenticationType() == TYPE_AUTHENTICATION_SASL
+                    && request instanceof GenericBindRequest) {
+                ASN1Reader reader =
+                        ASN1.getReader(((GenericBindRequest) request).getAuthenticationValue());
+                try {
+                    String saslMech = reader.readOctetStringAsString();
+                    ByteString saslCred;
+                    if (reader.hasNextElement()) {
+                        saslCred = reader.readOctetString();
+                    } else {
+                        saslCred = ByteString.empty();
+                    }
+
+                    if (saslServer == null
+                            || !saslServer.getMechanismName().equalsIgnoreCase(saslMech)) {
+                        final Map<String, String> props = new HashMap<String, String>();
+                        props.put(Sasl.QOP, "auth-conf,auth-int,auth");
+                        saslServer =
+                                Sasl.createSaslServer(saslMech, "ldap", clientContext
+                                        .getLocalAddress().getHostName(), props,
+                                        new CallbackHandler() {
+                                            public void handle(Callback[] callbacks)
+                                                    throws IOException,
+                                                    UnsupportedCallbackException {
+                                                for (final Callback callback : callbacks) {
+                                                    if (callback instanceof NameCallback) {
+                                                        // Do nothing
+                                                    } else if (callback instanceof PasswordCallback) {
+                                                        ((PasswordCallback) callback)
+                                                                .setPassword("password"
+                                                                        .toCharArray());
+                                                    } else if (callback instanceof AuthorizeCallback) {
+                                                        ((AuthorizeCallback) callback)
+                                                                .setAuthorized(true);
+                                                    } else if (callback instanceof RealmCallback) {
+                                                        // Do nothing
+                                                    } else {
+                                                        throw new UnsupportedCallbackException(
+                                                                callback);
+
+                                                    }
+                                                }
+                                            }
+                                        });
+                    }
+
+                    byte[] challenge = saslServer.evaluateResponse(saslCred.toByteArray());
+                    if (saslServer.isComplete()) {
+                        resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS)
+                                .setServerSASLCredentials(ByteString.wrap(challenge)));
+
+                        String qop = (String) saslServer.getNegotiatedProperty(Sasl.QOP);
+                        if (qop != null
+                                && (qop.equalsIgnoreCase("auth-int") || qop
+                                        .equalsIgnoreCase("auth-conf"))) {
+                            ConnectionSecurityLayer csl = new ConnectionSecurityLayer() {
+                                public void dispose() {
+                                    try {
+                                        saslServer.dispose();
+                                    } catch (SaslException e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+
+                                public byte[] unwrap(byte[] incoming, int offset, int len)
+                                        throws ErrorResultException {
+                                    try {
+                                        return saslServer.unwrap(incoming, offset, len);
+                                    } catch (SaslException e) {
+                                        throw ErrorResultException
+                                                .newErrorResult(Responses.newResult(
+                                                        ResultCode.OPERATIONS_ERROR).setCause(e));
+                                    }
+                                }
+
+                                public byte[] wrap(byte[] outgoing, int offset, int len)
+                                        throws ErrorResultException {
+                                    try {
+                                        return saslServer.wrap(outgoing, offset, len);
+                                    } catch (SaslException e) {
+                                        throw ErrorResultException
+                                                .newErrorResult(Responses.newResult(
+                                                        ResultCode.OPERATIONS_ERROR).setCause(e));
+                                    }
+                                }
+                            };
+
+                            clientContext.enableConnectionSecurityLayer(csl);
+                        }
+
+                    } else {
+                        resultHandler.handleResult(Responses.newBindResult(
+                                ResultCode.SASL_BIND_IN_PROGRESS).setServerSASLCredentials(
+                                ByteString.wrap(challenge)));
+                    }
+                } catch (Exception e) {
+                    resultHandler.handleErrorResult(ErrorResultException.newErrorResult(Responses
+                            .newBindResult(ResultCode.OPERATIONS_ERROR).setCause(e)
+                            .setDiagnosticMessage(e.toString())));
+                }
+            } else {
+                resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
+            }
+            requestsInProgress.remove(context);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void handleConnectionClosed(final Integer context, final UnbindRequest request) {
+            close();
+        }
+
+        private void close() {
+            if (saslServer != null) {
+                try {
+                    saslServer.dispose();
+                } catch (SaslException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void handleConnectionDisconnected(ResultCode resultCode, String message) {
+            close();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void handleConnectionError(final Throwable error) {
+            close();
+        }
+
+        /**
+         * @param context
+         * @param request
+         * @param resultHandler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleCompare(final Integer context, final CompareRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super CompareResult> resultHandler)
+                throws UnsupportedOperationException {
+            CompareResult result = null;
+            final AbandonableRequest abReq = new AbandonableRequest(request);
+            requestsInProgress.put(context, abReq);
+            // Get the DN.
+            final DN dn = request.getName();
+            if (!entryMap.containsKey(dn)) {
+                // entry not found.
+                result = Responses.newCompareResult(ResultCode.NO_SUCH_ATTRIBUTE);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                resultHandler.handleErrorResult(ere);
+                // doesn't matter if it was canceled.
+                requestsInProgress.remove(context);
+                return;
+            }
+
+            // Get the entry.
+            final Entry entry = entryMap.get(dn);
+            final AttributeDescription attrDesc = request.getAttributeDescription();
+            for (final Attribute attr : entry.getAllAttributes(attrDesc)) {
+                final Iterator<ByteString> it = attr.iterator();
+                while (it.hasNext()) {
+                    final ByteString s = it.next();
+                    if (abReq.isCanceled()) {
+                        final Result r = Responses.newResult(ResultCode.CANCELLED);
+                        final ErrorResultException ere = ErrorResultException.newErrorResult(r);
+                        resultHandler.handleErrorResult(ere);
+                        requestsInProgress.remove(context);
+                        return;
+                    }
+                    if (s.equals(request.getAssertionValue())) {
+                        result = Responses.newCompareResult(ResultCode.COMPARE_TRUE);
+                        resultHandler.handleResult(result);
+                        requestsInProgress.remove(context);
+                        return;
+                    }
+                }
+            }
+            result = Responses.newCompareResult(ResultCode.COMPARE_FALSE);
             resultHandler.handleResult(result);
             requestsInProgress.remove(context);
+        }
+
+        /**
+         * @param context
+         * @param request
+         * @param handler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleDelete(final Integer context, final DeleteRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> handler) throws UnsupportedOperationException {
+            Result result = null;
+            final AbandonableRequest abReq = new AbandonableRequest(request);
+            requestsInProgress.put(context, abReq);
+            // Get the DN.
+            final DN dn = request.getName();
+            if (!entryMap.containsKey(dn)) {
+                // entry is not found.
+                result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                handler.handleErrorResult(ere);
+                // doesn't matter if it was canceled.
+                requestsInProgress.remove(context);
+                return;
+            }
+
+            if (abReq.isCanceled()) {
+                result = Responses.newResult(ResultCode.CANCELLED);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                handler.handleErrorResult(ere);
+                requestsInProgress.remove(context);
+                return;
+            }
+            // Remove this from the map.
+            entryMap.remove(dn);
+            requestsInProgress.remove(context);
+        }
+
+        /**
+         * @param context
+         * @param request
+         * @param resultHandler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public <R extends ExtendedResult> void handleExtendedRequest(final Integer context,
+                final ExtendedRequest<R> request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super R> resultHandler) throws UnsupportedOperationException {
+            if (request.getOID().equals(StartTLSExtendedRequest.OID)) {
+                final R result =
+                        request.getResultDecoder().newExtendedErrorResult(ResultCode.SUCCESS, "",
+                                "");
+                resultHandler.handleResult(result);
+                clientContext.enableTLS(sslContext, null, sslContext.getSocketFactory()
+                        .getSupportedCipherSuites(), false, false);
+            }
+        }
+
+        /**
+         * @param context
+         * @param request
+         * @param resultHandler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleModify(final Integer context, final ModifyRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            // TODO:
+        }
+
+        /**
+         * @param context
+         * @param request
+         * @param resultHandler
+         * @param intermediateResponseHandler
+         * @throws UnsupportedOperationException
+         */
+        public void handleModifyDN(final Integer context, final ModifyDNRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final ResultHandler<? super Result> resultHandler)
+                throws UnsupportedOperationException {
+            // TODO
+        }
+
+        /**
+         * @param request
+         * @param intermediateResponseHandler
+         * @param resultHandler
+         * @param context
+         * @throws UnsupportedOperationException
+         */
+        public void handleSearch(final Integer context, final SearchRequest request,
+                final IntermediateResponseHandler intermediateResponseHandler,
+                final SearchResultHandler resultHandler) throws UnsupportedOperationException {
+            Result result = null;
+            final AbandonableRequest abReq = new AbandonableRequest(request);
+            requestsInProgress.put(context, abReq);
+            // Get the DN.
+            final DN dn = request.getName();
+            if (!entryMap.containsKey(dn)) {
+                // Entry not found.
+                result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                resultHandler.handleErrorResult(ere);
+                // Should searchResultHandler handle anything?
+
+                // doesn't matter if it was canceled.
+                requestsInProgress.remove(context);
+                return;
+            }
+
+            if (abReq.isCanceled()) {
+                result = Responses.newResult(ResultCode.CANCELLED);
+                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
+                resultHandler.handleErrorResult(ere);
+                requestsInProgress.remove(context);
+                return;
+            }
+
+            final SearchResultEntry e =
+                    Responses.newSearchResultEntry(new LinkedHashMapEntry(entryMap.get(dn)));
+            // Check we have had any controls in the request.
+            for (final Control control : request.getControls()) {
+                if (control.getOID().equals(AccountUsabilityRequestControl.OID)) {
+                    e.addControl(AccountUsabilityResponseControl.newControl(false, false, false,
+                            10, false, 0));
+                }
+            }
+            resultHandler.handleEntry(e);
+            result = Responses.newResult(ResultCode.SUCCESS);
+            resultHandler.handleResult(result);
+            requestsInProgress.remove(context);
+        }
+    }
+
+    // The mapping between entry DNs and the corresponding entries.
+    private final ConcurrentHashMap<DN, Entry> entryMap = new ConcurrentHashMap<DN, Entry>();
+
+    // The LDAP listener.
+    private LDAPListener listener = null;
+
+    // whether the server is running.
+    private volatile boolean isRunning;
+
+    // The mapping between the message id and the requests the server is
+    // currently
+    // handling.
+    private final ConcurrentHashMap<Integer, AbandonableRequest> requestsInProgress =
+            new ConcurrentHashMap<Integer, AbandonableRequest>();
+
+    private SSLContext sslContext;
+
+    private LDAPServer() {
+        // Add the root dse first.
+        entryMap.put(DN.rootDN(), Entries.unmodifiableEntry(new LinkedHashMapEntry()));
+        for (int i = 0; i < 1000; i++) {
+            final String dn = String.format("uid=user.%d,ou=people,o=test", i);
+            final String cn = String.format("cn: user.%d", i);
+            final String sn = String.format("sn: %d", i);
+            final String uid = String.format("uid: user.%d", i);
+
+            // See
+            // org.forgerock.opendj.ldap.ConnectionFactoryTestCase.testSchemaUsage().
+            final String mail = String.format("mail: user.%d@example.com", i);
+
+            final DN d = DN.valueOf(dn);
+            final Entry e =
+                    new LinkedHashMapEntry("dn: " + dn, "objectclass: person",
+                            "objectclass: inetorgperson", "objectclass: top", cn, sn, uid, mail);
+            entryMap.put(d, Entries.unmodifiableEntry(e));
+        }
+    }
+
+    /**
+     * @param context
+     * @return
+     */
+    public ServerConnection<Integer> handleAccept(final LDAPClientContext context) {
+        return new LDAPServerConnection(context);
+    }
+
+    /**
+     * Returns whether the server is running or not.
+     *
+     * @return Whether the server is running.
+     */
+    public boolean isRunning() {
+        return isRunning;
+    }
+
+    /**
+     * Starts the server.
+     *
+     * @param port
+     * @exception IOException
+     */
+    public synchronized void start(final int port) throws Exception {
+        if (isRunning) {
             return;
-          }
         }
-      }
-      result = Responses.newCompareResult(ResultCode.COMPARE_FALSE);
-      resultHandler.handleResult(result);
-      requestsInProgress.remove(context);
+        sslContext = new SSLContextBuilder().getSSLContext();
+        listener =
+                new LDAPListener(port, getInstance(), new LDAPListenerOptions().setBacklog(4096));
+        isRunning = true;
     }
 
-
-
     /**
-     * @param context
-     * @param request
-     * @param handler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
+     * Stops the server.
      */
-    public void handleDelete(final Integer context,
-        final DeleteRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> handler)
-        throws UnsupportedOperationException
-    {
-      Result result = null;
-      final AbandonableRequest abReq = new AbandonableRequest(request);
-      requestsInProgress.put(context, abReq);
-      // Get the DN.
-      final DN dn = request.getName();
-      if (!entryMap.containsKey(dn))
-      {
-        // entry is not found.
-        result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        handler.handleErrorResult(ere);
-        // doesn't matter if it was canceled.
-        requestsInProgress.remove(context);
-        return;
-      }
-
-      if (abReq.isCanceled())
-      {
-        result = Responses.newResult(ResultCode.CANCELLED);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        handler.handleErrorResult(ere);
-        requestsInProgress.remove(context);
-        return;
-      }
-      // Remove this from the map.
-      entryMap.remove(dn);
-      requestsInProgress.remove(context);
-    }
-
-
-
-    /**
-     * @param context
-     * @param request
-     * @param resultHandler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public <R extends ExtendedResult> void handleExtendedRequest(
-        final Integer context, final ExtendedRequest<R> request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super R> resultHandler)
-        throws UnsupportedOperationException
-    {
-      if (request.getOID().equals(StartTLSExtendedRequest.OID))
-      {
-        final R result = request.getResultDecoder().newExtendedErrorResult(
-            ResultCode.SUCCESS, "", "");
-        resultHandler.handleResult(result);
-        clientContext.enableTLS(sslContext, null, sslContext.getSocketFactory()
-            .getSupportedCipherSuites(), false, false);
-      }
-    }
-
-
-
-    /**
-     * @param context
-     * @param request
-     * @param resultHandler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public void handleModify(final Integer context,
-        final ModifyRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      // TODO:
-    }
-
-
-
-    /**
-     * @param context
-     * @param request
-     * @param resultHandler
-     * @param intermediateResponseHandler
-     * @throws UnsupportedOperationException
-     */
-    public void handleModifyDN(final Integer context,
-        final ModifyDNRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final ResultHandler<? super Result> resultHandler)
-        throws UnsupportedOperationException
-    {
-      // TODO
-    }
-
-
-
-    /**
-     * @param request
-     * @param intermediateResponseHandler
-     * @param resultHandler
-     * @param context
-     * @throws UnsupportedOperationException
-     */
-    public void handleSearch(final Integer context,
-        final SearchRequest request,
-        final IntermediateResponseHandler intermediateResponseHandler,
-        final SearchResultHandler resultHandler)
-        throws UnsupportedOperationException
-    {
-      Result result = null;
-      final AbandonableRequest abReq = new AbandonableRequest(request);
-      requestsInProgress.put(context, abReq);
-      // Get the DN.
-      final DN dn = request.getName();
-      if (!entryMap.containsKey(dn))
-      {
-        // Entry not found.
-        result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        resultHandler.handleErrorResult(ere);
-        // Should searchResultHandler handle anything?
-
-        // doesn't matter if it was canceled.
-        requestsInProgress.remove(context);
-        return;
-      }
-
-      if (abReq.isCanceled())
-      {
-        result = Responses.newResult(ResultCode.CANCELLED);
-        final ErrorResultException ere = ErrorResultException
-            .newErrorResult(result);
-        resultHandler.handleErrorResult(ere);
-        requestsInProgress.remove(context);
-        return;
-      }
-
-      final SearchResultEntry e = Responses
-          .newSearchResultEntry(new LinkedHashMapEntry(entryMap.get(dn)));
-      // Check we have had any controls in the request.
-      for (final Control control : request.getControls())
-      {
-        if (control.getOID().equals(AccountUsabilityRequestControl.OID))
-        {
-          e.addControl(AccountUsabilityResponseControl.newControl(false, false,
-              false, 10, false, 0));
+    public synchronized void stop() {
+        if (!isRunning) {
+            return;
         }
-      }
-      resultHandler.handleEntry(e);
-      result = Responses.newResult(ResultCode.SUCCESS);
-      resultHandler.handleResult(result);
-      requestsInProgress.remove(context);
+        listener.close();
+        isRunning = false;
     }
-  }
-
-
-
-  // The mapping between entry DNs and the corresponding entries.
-  private final ConcurrentHashMap<DN, Entry> entryMap = new ConcurrentHashMap<DN, Entry>();
-
-  // The LDAP listener.
-  private LDAPListener listener = null;
-
-  // whether the server is running.
-  private volatile boolean isRunning;
-
-  // The mapping between the message id and the requests the server is currently
-  // handling.
-  private final ConcurrentHashMap<Integer, AbandonableRequest> requestsInProgress = new ConcurrentHashMap<Integer, AbandonableRequest>();
-
-  private SSLContext sslContext;
-
-
-
-  private LDAPServer()
-  {
-    // Add the root dse first.
-    entryMap.put(DN.rootDN(),
-        Entries.unmodifiableEntry(new LinkedHashMapEntry()));
-    for (int i = 0; i < 1000; i++)
-    {
-      final String dn = String.format("uid=user.%d,ou=people,o=test", i);
-      final String cn = String.format("cn: user.%d", i);
-      final String sn = String.format("sn: %d", i);
-      final String uid = String.format("uid: user.%d", i);
-
-      // See
-      // org.forgerock.opendj.ldap.ConnectionFactoryTestCase.testSchemaUsage().
-      final String mail = String.format("mail: user.%d@example.com", i);
-
-      final DN d = DN.valueOf(dn);
-      final Entry e = new LinkedHashMapEntry("dn: " + dn,
-          "objectclass: person", "objectclass: inetorgperson",
-          "objectclass: top", cn, sn, uid, mail);
-      entryMap.put(d, Entries.unmodifiableEntry(e));
-    }
-  }
-
-
-
-  /**
-   * @param context
-   * @return
-   */
-  public ServerConnection<Integer> handleAccept(final LDAPClientContext context)
-  {
-    return new LDAPServerConnection(context);
-  }
-
-
-
-  /**
-   * Returns whether the server is running or not.
-   *
-   * @return Whether the server is running.
-   */
-  public boolean isRunning()
-  {
-    return isRunning;
-  }
-
-
-
-  /**
-   * Starts the server.
-   *
-   * @param port
-   * @exception IOException
-   */
-  public synchronized void start(final int port) throws Exception
-  {
-    if (isRunning)
-    {
-      return;
-    }
-    sslContext = new SSLContextBuilder().getSSLContext();
-    listener = new LDAPListener(port, getInstance(),
-        new LDAPListenerOptions().setBacklog(4096));
-    isRunning = true;
-  }
-
-
-
-  /**
-   * Stops the server.
-   */
-  public synchronized void stop()
-  {
-    if (!isRunning)
-    {
-      return;
-    }
-    listener.close();
-    isRunning = false;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java
index c375274..45ced49 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,210 +26,169 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.Filter;
-import org.forgerock.opendj.ldap.LDAPUrl;
-import org.forgerock.opendj.ldap.SearchScope;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
- * This class defines a set of tests for the org.forgerock.opendj.ldap.LDAPUrl class.
+ * This class defines a set of tests for the org.forgerock.opendj.ldap.LDAPUrl
+ * class.
  */
-public class LDAPUrlTestCase extends SdkTestCase
-{
-  /**
-   * LDAPUrl encoding test data provider.
-   *
-   * @return The array of test encoding of LDAP URL strings.
-   */
-  @DataProvider(name = "ldapurls")
-  public Object[][] createEncodingData()
-  {
-    return new Object[][] {
-        { "ldap://", "ldap://", true },
-        { "ldap:///", "ldap:///", true },
-        { "ldap://ldap.example.net", "ldap://ldap.example.net", true },
-        { "ldap://ldap.example.net/", "ldap://ldap.example.net/", true },
-        { "ldap://ldap.example.net/?", "ldap://ldap.example.net/?", true },
-        { "ldap:///o=University of Michigan,c=US",
-            "ldap:///o=University%20of%20Michigan,c=US", true },
-        { "ldap://ldap1.example.net/o=University of Michigan,c=US",
-            "ldap://ldap1.example.net/o=University%20of%20Michigan,c=US", true },
-        {
-            "ldap://ldap1.example.net/o=University of Michigan,c=US?postalAddress",
-            "ldap://ldap1.example.net/o=University%20of%20Michigan,c=US?postalAddress",
-            true },
-        {
-            "ldap://ldap1.example.net:6666/o=University of Michigan,c=US??sub?(cn=Babs Jensen)",
-            "ldap://ldap1.example.net:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
-            true },
-        { "LDAP://ldap1.example.com/c=GB?objectClass?ONE",
-            "LDAP://ldap1.example.com/c=GB?objectClass?ONE", true },
-        // { "ldap://ldap2.example.com/o=Question?,c=US?mail",
-        // "ldap://ldap2.example.com/o=Question%3f,c=US?mail",true },
-        {
-            "ldap://ldap3.example.com/o=Babsco,c=US???(four-octet=\00\00\00\04)",
-            "ldap://ldap3.example.com/o=Babsco,c=US???(four-octet=%5c00%5c00%5c00%5c04)",
-            true },
-        { "ldap://ldap.example.com/o=An Example\\2C Inc.,c=US",
-            "ldap://ldap.example.com/o=An%20Example%5C2C%20Inc.,c=US", true },
-        { "ldap:///", "ldap:///", true }, { "ldap:///", "ldap:///", true },
-        { "ldap:///", "ldap:///", true }, };
-  }
-
-
-
-  /**
-   * LDAPUrl construction test data provider.
-   *
-   * @return The array of test construction of LDAPUrl objects.
-   */
-  @DataProvider(name = "urlobjects1")
-  public Object[][] createURLObjects1()
-  {
-    return new Object[][] {
-        { new LDAPUrl(false, null, null, null, null, null), "ldap:///???" },
-        { new LDAPUrl(true, null, null, null, null, null), "ldaps:///???" },
-        { new LDAPUrl(true, "void.central.sun.com", null, null, null, null),
-            "ldaps://void.central.sun.com/???" },
-        { new LDAPUrl(true, null, 1245, null, null, null), "ldaps://:1245/???" },
-        { new LDAPUrl(true, "void.central", 123, null, null, null),
-            "ldaps://void.central:123/???" },
-        { new LDAPUrl(true, null, null, null, null, null, "cn", "sn"),
-            "ldaps:///?cn,sn??" },
-        {
-            new LDAPUrl(true, null, null, null, null, Filter
-                .newEqualityMatchFilter("uid", "abc"), "cn"),
-            "ldaps:///?cn??(uid=abc)" },
-        {
-            new LDAPUrl(true, null, null, null, SearchScope.WHOLE_SUBTREE,
-                Filter.newEqualityMatchFilter("uid", "abc"), "cn"),
-            "ldaps:///?cn?sub?(uid=abc)" },
-        {
-            new LDAPUrl(true, null, null, DN.valueOf("uid=abc,o=target"),
-                SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid",
-                    "abc"), "cn"), "ldaps:///uid=abc,o=target?cn?sub?(uid=abc)" },
-        {
-            new LDAPUrl(true, "localhost", 1345,
-                DN.valueOf("uid=abc,o=target"), SearchScope.WHOLE_SUBTREE,
-                Filter.newEqualityMatchFilter("uid", "abc"), "cn"),
-            "ldaps://localhost:1345/uid=abc,o=target?cn?sub?(uid=abc)" }, };
-  }
-
-
-
-  /**
-   * LDAPUrl construction test data provider.
-   *
-   * @return The array of test construction of LDAPUrl objects.
-   */
-  @DataProvider(name = "urlobjects2")
-  public Object[][] createURLObjects2()
-  {
-    return new Object[][] {
-        { new LDAPUrl(false, null, null, null, null, null),
-            LDAPUrl.valueOf("ldap:///") },
-        { new LDAPUrl(true, null, null, null, null, null),
-            LDAPUrl.valueOf("ldaps:///") },
-        { new LDAPUrl(true, "void.central.sun.com", null, null, null, null),
-            LDAPUrl.valueOf("ldaps://void.central.sun.com") },
-        { new LDAPUrl(true, null, 1245, null, null, null),
-            LDAPUrl.valueOf("ldaps://:1245") },
-        { new LDAPUrl(true, "void.central", 123, null, null, null),
-            LDAPUrl.valueOf("ldaps://void.central:123") },
-        { new LDAPUrl(true, null, null, null, null, null, "cn", "sn"),
-            LDAPUrl.valueOf("ldaps:///?cn,sn??") },
-        {
-            new LDAPUrl(true, null, null, null, null, Filter
-                .newEqualityMatchFilter("uid", "abc"), "cn"),
-            LDAPUrl.valueOf("ldaps:///?cn??(uid=abc)") },
-        {
-            new LDAPUrl(true, null, null, null, SearchScope.WHOLE_SUBTREE,
-                Filter.newEqualityMatchFilter("uid", "abc"), "cn"),
-            LDAPUrl.valueOf("ldaps:///?cn?sub?(uid=abc)") },
-        {
-            new LDAPUrl(true, null, null, DN.valueOf("uid=abc,o=target"),
-                SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid",
-                    "abc"), "cn"),
-            LDAPUrl.valueOf("ldaps:///uid=abc,o=target?cn?sub?(uid=abc)") },
-        {
-            new LDAPUrl(true, "localhost", 1345,
-                DN.valueOf("uid=abc,o=target"), SearchScope.WHOLE_SUBTREE,
-                Filter.newEqualityMatchFilter("uid", "abc"), "cn"),
-            LDAPUrl
-                .valueOf("ldaps://localhost:1345/uid=abc,o=target?cn?sub?(uid=abc)") }, };
-  }
-
-
-
-  /**
-   * Tests equals method of the LDAP URL.
-   *
-   * @param urlObj1
-   *          The LDAPUrl object.
-   * @param urlObj2
-   *          The LDAPUrl object.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "urlobjects2")
-  public void testLDAPURLCtor(final LDAPUrl urlObj1, final LDAPUrl urlObj2)
-      throws Exception
-  {
-    assertTrue(urlObj1.equals(urlObj2));
-  }
-
-
-
-  /**
-   * Test Whether the LDAP URL (non-encoded) is constructed properly from the
-   * arguments.
-   *
-   * @param urlObj
-   *          The LDAPUrl object.
-   * @param urlString
-   *          The non-encoded ldap url.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "urlobjects1")
-  public void testLDAPURLCtor(final LDAPUrl urlObj, final String urlString)
-      throws Exception
-  {
-    assertEquals(urlString, urlObj.toString());
-  }
-
-
-
-  /**
-   * Test the LDAP URL encoding.
-   *
-   * @param toEncode
-   *          The URL that needs encoding.
-   * @param encoded
-   *          The encoded URL.
-   * @param valid
-   *          if the encoding is valid.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "ldapurls")
-  public void testURLEncoding(final String toEncode, final String encoded,
-      final boolean valid) throws Exception
-  {
-    final LDAPUrl url1 = LDAPUrl.valueOf(toEncode);
-    final LDAPUrl url2 = LDAPUrl.valueOf(encoded);
-    if (valid)
-    {
-      assertTrue(url1.equals(url2));
+public class LDAPUrlTestCase extends SdkTestCase {
+    /**
+     * LDAPUrl encoding test data provider.
+     *
+     * @return The array of test encoding of LDAP URL strings.
+     */
+    @DataProvider(name = "ldapurls")
+    public Object[][] createEncodingData() {
+        return new Object[][] {
+            { "ldap://", "ldap://", true },
+            { "ldap:///", "ldap:///", true },
+            { "ldap://ldap.example.net", "ldap://ldap.example.net", true },
+            { "ldap://ldap.example.net/", "ldap://ldap.example.net/", true },
+            { "ldap://ldap.example.net/?", "ldap://ldap.example.net/?", true },
+            { "ldap:///o=University of Michigan,c=US", "ldap:///o=University%20of%20Michigan,c=US",
+                true },
+            { "ldap://ldap1.example.net/o=University of Michigan,c=US",
+                "ldap://ldap1.example.net/o=University%20of%20Michigan,c=US", true },
+            { "ldap://ldap1.example.net/o=University of Michigan,c=US?postalAddress",
+                "ldap://ldap1.example.net/o=University%20of%20Michigan,c=US?postalAddress", true },
+            {
+                "ldap://ldap1.example.net:6666/o=University of Michigan,c=US??sub?(cn=Babs Jensen)",
+                "ldap://ldap1.example.net:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
+                true },
+            { "LDAP://ldap1.example.com/c=GB?objectClass?ONE",
+                "LDAP://ldap1.example.com/c=GB?objectClass?ONE", true },
+            // { "ldap://ldap2.example.com/o=Question?,c=US?mail",
+            // "ldap://ldap2.example.com/o=Question%3f,c=US?mail",true },
+            { "ldap://ldap3.example.com/o=Babsco,c=US???(four-octet=\00\00\00\04)",
+                "ldap://ldap3.example.com/o=Babsco,c=US???(four-octet=%5c00%5c00%5c00%5c04)", true },
+            { "ldap://ldap.example.com/o=An Example\\2C Inc.,c=US",
+                "ldap://ldap.example.com/o=An%20Example%5C2C%20Inc.,c=US", true },
+            { "ldap:///", "ldap:///", true }, { "ldap:///", "ldap:///", true },
+            { "ldap:///", "ldap:///", true }, };
     }
-  }
+
+    /**
+     * LDAPUrl construction test data provider.
+     *
+     * @return The array of test construction of LDAPUrl objects.
+     */
+    @DataProvider(name = "urlobjects1")
+    public Object[][] createURLObjects1() {
+        return new Object[][] {
+            { new LDAPUrl(false, null, null, null, null, null), "ldap:///???" },
+            { new LDAPUrl(true, null, null, null, null, null), "ldaps:///???" },
+            { new LDAPUrl(true, "void.central.sun.com", null, null, null, null),
+                "ldaps://void.central.sun.com/???" },
+            { new LDAPUrl(true, null, 1245, null, null, null), "ldaps://:1245/???" },
+            { new LDAPUrl(true, "void.central", 123, null, null, null),
+                "ldaps://void.central:123/???" },
+            { new LDAPUrl(true, null, null, null, null, null, "cn", "sn"), "ldaps:///?cn,sn??" },
+            {
+                new LDAPUrl(true, null, null, null, null, Filter.newEqualityMatchFilter("uid",
+                        "abc"), "cn"), "ldaps:///?cn??(uid=abc)" },
+            {
+                new LDAPUrl(true, null, null, null, SearchScope.WHOLE_SUBTREE, Filter
+                        .newEqualityMatchFilter("uid", "abc"), "cn"), "ldaps:///?cn?sub?(uid=abc)" },
+            {
+                new LDAPUrl(true, null, null, DN.valueOf("uid=abc,o=target"),
+                        SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid", "abc"),
+                        "cn"), "ldaps:///uid=abc,o=target?cn?sub?(uid=abc)" },
+            {
+                new LDAPUrl(true, "localhost", 1345, DN.valueOf("uid=abc,o=target"),
+                        SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid", "abc"),
+                        "cn"), "ldaps://localhost:1345/uid=abc,o=target?cn?sub?(uid=abc)" }, };
+    }
+
+    /**
+     * LDAPUrl construction test data provider.
+     *
+     * @return The array of test construction of LDAPUrl objects.
+     */
+    @DataProvider(name = "urlobjects2")
+    public Object[][] createURLObjects2() {
+        return new Object[][] {
+            { new LDAPUrl(false, null, null, null, null, null), LDAPUrl.valueOf("ldap:///") },
+            { new LDAPUrl(true, null, null, null, null, null), LDAPUrl.valueOf("ldaps:///") },
+            { new LDAPUrl(true, "void.central.sun.com", null, null, null, null),
+                LDAPUrl.valueOf("ldaps://void.central.sun.com") },
+            { new LDAPUrl(true, null, 1245, null, null, null), LDAPUrl.valueOf("ldaps://:1245") },
+            { new LDAPUrl(true, "void.central", 123, null, null, null),
+                LDAPUrl.valueOf("ldaps://void.central:123") },
+            { new LDAPUrl(true, null, null, null, null, null, "cn", "sn"),
+                LDAPUrl.valueOf("ldaps:///?cn,sn??") },
+            {
+                new LDAPUrl(true, null, null, null, null, Filter.newEqualityMatchFilter("uid",
+                        "abc"), "cn"), LDAPUrl.valueOf("ldaps:///?cn??(uid=abc)") },
+            {
+                new LDAPUrl(true, null, null, null, SearchScope.WHOLE_SUBTREE, Filter
+                        .newEqualityMatchFilter("uid", "abc"), "cn"),
+                LDAPUrl.valueOf("ldaps:///?cn?sub?(uid=abc)") },
+            {
+                new LDAPUrl(true, null, null, DN.valueOf("uid=abc,o=target"),
+                        SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid", "abc"),
+                        "cn"), LDAPUrl.valueOf("ldaps:///uid=abc,o=target?cn?sub?(uid=abc)") },
+            {
+                new LDAPUrl(true, "localhost", 1345, DN.valueOf("uid=abc,o=target"),
+                        SearchScope.WHOLE_SUBTREE, Filter.newEqualityMatchFilter("uid", "abc"),
+                        "cn"),
+                LDAPUrl.valueOf("ldaps://localhost:1345/uid=abc,o=target?cn?sub?(uid=abc)") }, };
+    }
+
+    /**
+     * Tests equals method of the LDAP URL.
+     *
+     * @param urlObj1
+     *            The LDAPUrl object.
+     * @param urlObj2
+     *            The LDAPUrl object.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "urlobjects2")
+    public void testLDAPURLCtor(final LDAPUrl urlObj1, final LDAPUrl urlObj2) throws Exception {
+        assertTrue(urlObj1.equals(urlObj2));
+    }
+
+    /**
+     * Test Whether the LDAP URL (non-encoded) is constructed properly from the
+     * arguments.
+     *
+     * @param urlObj
+     *            The LDAPUrl object.
+     * @param urlString
+     *            The non-encoded ldap url.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "urlobjects1")
+    public void testLDAPURLCtor(final LDAPUrl urlObj, final String urlString) throws Exception {
+        assertEquals(urlString, urlObj.toString());
+    }
+
+    /**
+     * Test the LDAP URL encoding.
+     *
+     * @param toEncode
+     *            The URL that needs encoding.
+     * @param encoded
+     *            The encoded URL.
+     * @param valid
+     *            if the encoding is valid.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "ldapurls")
+    public void testURLEncoding(final String toEncode, final String encoded, final boolean valid)
+            throws Exception {
+        final LDAPUrl url1 = LDAPUrl.valueOf(toEncode);
+        final LDAPUrl url2 = LDAPUrl.valueOf(encoded);
+        if (valid) {
+            assertTrue(url1.equals(url2));
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java
index ae8d8eb..6fe2d4f 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
@@ -38,450 +35,396 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test {@code BasicAttribute}.
  */
 
 @SuppressWarnings("javadoc")
-public final class LinkedAttributeTestCase extends SdkTestCase
-{
-  @Test
-  public void smokeTest() throws Exception
-  {
-    // TODO: write a proper test suite.
-    final AbstractAttribute attribute = new LinkedAttribute(
-        AttributeDescription.valueOf("ALTSERVER", Schema.getCoreSchema()));
+public final class LinkedAttributeTestCase extends SdkTestCase {
+    @Test
+    public void smokeTest() throws Exception {
+        // TODO: write a proper test suite.
+        final AbstractAttribute attribute =
+                new LinkedAttribute(AttributeDescription.valueOf("ALTSERVER", Schema
+                        .getCoreSchema()));
 
-    attribute.add(1);
-    attribute.add("a value");
-    attribute.add(ByteString.valueOf("another value"));
+        attribute.add(1);
+        attribute.add("a value");
+        attribute.add(ByteString.valueOf("another value"));
 
-    Assert.assertTrue(attribute.contains(1));
-    Assert.assertTrue(attribute.contains("a value"));
-    Assert.assertTrue(attribute.contains(ByteString.valueOf("another value")));
+        Assert.assertTrue(attribute.contains(1));
+        Assert.assertTrue(attribute.contains("a value"));
+        Assert.assertTrue(attribute.contains(ByteString.valueOf("another value")));
 
-    Assert.assertEquals(attribute.size(), 3);
-    Assert.assertTrue(attribute.remove(1));
-    Assert.assertEquals(attribute.size(), 2);
-    Assert.assertFalse(attribute.remove("a missing value"));
-    Assert.assertEquals(attribute.size(), 2);
-    Assert.assertTrue(attribute.remove("a value"));
-    Assert.assertEquals(attribute.size(), 1);
-    Assert.assertTrue(attribute.remove(ByteString.valueOf("another value")));
-    Assert.assertEquals(attribute.size(), 0);
-  }
-
-
-
-  @Test
-  public void testAdd()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertTrue(a.add(ByteString.valueOf("value1")));
-    Assert.assertFalse(a.add(ByteString.valueOf("value1")));
-    Assert.assertTrue(a.add(ByteString.valueOf("value2")));
-    Assert.assertFalse(a.add(ByteString.valueOf("value2")));
-    Assert.assertTrue(a.add(ByteString.valueOf("value3")));
-    Assert.assertFalse(a.add(ByteString.valueOf("value3")));
-    Assert.assertEquals(a.size(), 3);
-    Iterator<ByteString> i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertFalse(i.hasNext());
-  }
-
-
-
-  @Test
-  public void testAddAll()
-  {
-    // addAll to an empty attribute.
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
-    Iterator<ByteString> i = a.iterator();
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test");
-    Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value1")),
-        null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test");
-    Assert.assertTrue(a.addAll(
-        Arrays.asList(ByteString.valueOf("value1"),
-            ByteString.valueOf("value2")), null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-
-    // addAll to a single-valued attribute.
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value2")),
-        null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertTrue(a.addAll(
-        Arrays.asList(ByteString.valueOf("value2"),
-            ByteString.valueOf("value3")), null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertFalse(i.hasNext());
-
-    // addAll to a multi-valued attribute.
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value3")),
-        null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertFalse(i.hasNext());
-
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    Assert.assertTrue(a.addAll(
-        Arrays.asList(ByteString.valueOf("value3"),
-            ByteString.valueOf("value4")), null));
-    i = a.iterator();
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
-    Assert.assertFalse(i.hasNext());
-  }
-
-
-
-  @Test
-  public void testClear()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertTrue(a.isEmpty());
-    Assert.assertEquals(a.size(), 0);
-    a.clear();
-    Assert.assertTrue(a.isEmpty());
-    Assert.assertEquals(a.size(), 0);
-
-    a.add(ByteString.valueOf("value1"));
-    Assert.assertFalse(a.isEmpty());
-    Assert.assertEquals(a.size(), 1);
-    a.clear();
-    Assert.assertTrue(a.isEmpty());
-    Assert.assertEquals(a.size(), 0);
-
-    a.add(ByteString.valueOf("value1"));
-    a.add(ByteString.valueOf("value2"));
-    Assert.assertFalse(a.isEmpty());
-    Assert.assertEquals(a.size(), 2);
-    a.clear();
-    Assert.assertTrue(a.isEmpty());
-    Assert.assertEquals(a.size(), 0);
-
-    a.add(ByteString.valueOf("value1"));
-    a.add(ByteString.valueOf("value2"));
-    a.add(ByteString.valueOf("value3"));
-    Assert.assertFalse(a.isEmpty());
-    Assert.assertEquals(a.size(), 3);
-    a.clear();
-    Assert.assertTrue(a.isEmpty());
-    Assert.assertEquals(a.size(), 0);
-  }
-
-
-
-  @Test
-  public void testContains()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
-
-    a.add(ByteString.valueOf("value1"));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
-    Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
-
-    a.add(ByteString.valueOf("value2"));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
-    Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
-
-    a.add(ByteString.valueOf("value3"));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
-    Assert.assertTrue(a.contains(ByteString.valueOf("value3")));
-    Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
-  }
-
-
-
-  @Test
-  public void testContainsAll()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
-    Assert
-        .assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
-    Assert.assertFalse(a.containsAll(Arrays.asList(
-        ByteString.valueOf("value1"), ByteString.valueOf("value2"))));
-    Assert.assertFalse(a.containsAll(Arrays.asList(
-        ByteString.valueOf("value1"), ByteString.valueOf("value2"),
-        ByteString.valueOf("value3"))));
-
-    a.add(ByteString.valueOf("value1"));
-    Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
-    Assert
-        .assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
-    Assert.assertFalse(a.containsAll(Arrays.asList(
-        ByteString.valueOf("value1"), ByteString.valueOf("value2"))));
-    Assert.assertFalse(a.containsAll(Arrays.asList(
-        ByteString.valueOf("value1"), ByteString.valueOf("value2"),
-        ByteString.valueOf("value3"))));
-
-    a.add(ByteString.valueOf("value2"));
-    Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
-    Assert
-        .assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
-    Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"))));
-    Assert.assertFalse(a.containsAll(Arrays.asList(
-        ByteString.valueOf("value1"), ByteString.valueOf("value2"),
-        ByteString.valueOf("value3"))));
-  }
-
-
-
-  @Test
-  public void testFirstValue()
-  {
-    Attribute a = new LinkedAttribute("test");
-    try
-    {
-      a.firstValue();
-      Assert.fail("Expected NoSuchElementException");
-    }
-    catch (NoSuchElementException e)
-    {
-      // Expected.
+        Assert.assertEquals(attribute.size(), 3);
+        Assert.assertTrue(attribute.remove(1));
+        Assert.assertEquals(attribute.size(), 2);
+        Assert.assertFalse(attribute.remove("a missing value"));
+        Assert.assertEquals(attribute.size(), 2);
+        Assert.assertTrue(attribute.remove("a value"));
+        Assert.assertEquals(attribute.size(), 1);
+        Assert.assertTrue(attribute.remove(ByteString.valueOf("another value")));
+        Assert.assertEquals(attribute.size(), 0);
     }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
+    @Test
+    public void testAdd() {
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertTrue(a.add(ByteString.valueOf("value1")));
+        Assert.assertFalse(a.add(ByteString.valueOf("value1")));
+        Assert.assertTrue(a.add(ByteString.valueOf("value2")));
+        Assert.assertFalse(a.add(ByteString.valueOf("value2")));
+        Assert.assertTrue(a.add(ByteString.valueOf("value3")));
+        Assert.assertFalse(a.add(ByteString.valueOf("value3")));
+        Assert.assertEquals(a.size(), 3);
+        Iterator<ByteString> i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertFalse(i.hasNext());
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
+    @Test
+    public void testAddAll() {
+        // addAll to an empty attribute.
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
+        Iterator<ByteString> i = a.iterator();
+        Assert.assertFalse(i.hasNext());
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value2"),
-        ByteString.valueOf("value1"));
-    Assert.assertEquals(a.firstValue(), ByteString.valueOf("value2"));
-  }
+        a = new LinkedAttribute("test");
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value1")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertFalse(i.hasNext());
 
+        a = new LinkedAttribute("test");
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
 
+        // addAll to a single-valued attribute.
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertFalse(i.hasNext());
 
-  @Test
-  public void testGetAttributeDescription()
-  {
-    AttributeDescription ad = AttributeDescription.valueOf("test");
-    Attribute a = new LinkedAttribute(ad);
-    Assert.assertEquals(a.getAttributeDescription(), ad);
-  }
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value2")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
 
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value2"), ByteString
+                .valueOf("value3")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertFalse(i.hasNext());
 
+        // addAll to a multi-valued attribute.
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        Assert.assertFalse(a.addAll(Collections.<ByteString> emptyList(), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
 
-  @Test
-  public void testIterator()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Iterator<ByteString> i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value3")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertFalse(i.hasNext());
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        Assert.assertTrue(a.addAll(Arrays.asList(ByteString.valueOf("value3"), ByteString
+                .valueOf("value4")), null));
+        i = a.iterator();
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
+        Assert.assertFalse(i.hasNext());
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-  }
+    @Test
+    public void testClear() {
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertTrue(a.isEmpty());
+        Assert.assertEquals(a.size(), 0);
+        a.clear();
+        Assert.assertTrue(a.isEmpty());
+        Assert.assertEquals(a.size(), 0);
 
+        a.add(ByteString.valueOf("value1"));
+        Assert.assertFalse(a.isEmpty());
+        Assert.assertEquals(a.size(), 1);
+        a.clear();
+        Assert.assertTrue(a.isEmpty());
+        Assert.assertEquals(a.size(), 0);
 
+        a.add(ByteString.valueOf("value1"));
+        a.add(ByteString.valueOf("value2"));
+        Assert.assertFalse(a.isEmpty());
+        Assert.assertEquals(a.size(), 2);
+        a.clear();
+        Assert.assertTrue(a.isEmpty());
+        Assert.assertEquals(a.size(), 0);
 
-  @Test
-  public void testRemove()
-  {
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertFalse(a.remove(ByteString.valueOf("value1")));
-    Iterator<ByteString> i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a.add(ByteString.valueOf("value1"));
+        a.add(ByteString.valueOf("value2"));
+        a.add(ByteString.valueOf("value3"));
+        Assert.assertFalse(a.isEmpty());
+        Assert.assertEquals(a.size(), 3);
+        a.clear();
+        Assert.assertTrue(a.isEmpty());
+        Assert.assertEquals(a.size(), 0);
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertFalse(a.remove(ByteString.valueOf("value2")));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertFalse(i.hasNext());
-    Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+    @Test
+    public void testContains() {
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"));
-    Assert.assertFalse(a.remove(ByteString.valueOf("value3")));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-    Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertFalse(i.hasNext());
-    Assert.assertTrue(a.remove(ByteString.valueOf("value2")));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
-  }
+        a.add(ByteString.valueOf("value1"));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
+        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
 
+        a.add(ByteString.valueOf("value2"));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
+        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
 
+        a.add(ByteString.valueOf("value3"));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value1")));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value2")));
+        Assert.assertTrue(a.contains(ByteString.valueOf("value3")));
+        Assert.assertFalse(a.contains(ByteString.valueOf("value4")));
+    }
 
-  @Test
-  public void testRemoveAll()
-  {
-    // removeAll from an empty attribute.
-    Attribute a = new LinkedAttribute("test");
-    Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
-    Iterator<ByteString> i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+    @Test
+    public void testContainsAll() {
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"))));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3"))));
 
-    a = new LinkedAttribute("test");
-    Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1")),
-        null));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a.add(ByteString.valueOf("value1"));
+        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
+        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"))));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3"))));
 
-    a = new LinkedAttribute("test");
-    Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"))));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a.add(ByteString.valueOf("value2"));
+        Assert.assertTrue(a.containsAll(Collections.<ByteString> emptyList()));
+        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"))));
+        Assert.assertTrue(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"))));
+        Assert.assertFalse(a.containsAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3"))));
+    }
 
-    // removeAll from single-valued attribute.
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertFalse(i.hasNext());
+    @Test
+    public void testFirstValue() {
+        Attribute a = new LinkedAttribute("test");
+        try {
+            a.firstValue();
+            Assert.fail("Expected NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            // Expected.
+        }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")),
-        null));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"));
-    Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"))));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value1"));
 
-    // removeAll from multi-valued attribute.
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value2"), ByteString.valueOf("value1"));
+        Assert.assertEquals(a.firstValue(), ByteString.valueOf("value2"));
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")),
-        null));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
-    Assert.assertFalse(i.hasNext());
+    @Test
+    public void testGetAttributeDescription() {
+        AttributeDescription ad = AttributeDescription.valueOf("test");
+        Attribute a = new LinkedAttribute(ad);
+        Assert.assertEquals(a.getAttributeDescription(), ad);
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertTrue(a.removeAll(
-        Arrays.asList(ByteString.valueOf("value1"),
-            ByteString.valueOf("value2")), null));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
-    Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
-    Assert.assertFalse(i.hasNext());
+    @Test
+    public void testIterator() {
+        Attribute a = new LinkedAttribute("test");
+        Iterator<ByteString> i = a.iterator();
+        Assert.assertFalse(i.hasNext());
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertTrue(a.removeAll(
-        Arrays.asList(ByteString.valueOf("value1"),
-            ByteString.valueOf("value2"), ByteString.valueOf("value3")), null));
-    i = a.iterator();
-    Assert.assertTrue(i.hasNext());
-    Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertFalse(i.hasNext());
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4")), null));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
+    }
 
-    a = new LinkedAttribute("test", ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"));
-    Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"),
-        ByteString.valueOf("value2"), ByteString.valueOf("value3"),
-        ByteString.valueOf("value4"), ByteString.valueOf("value5")), null));
-    i = a.iterator();
-    Assert.assertFalse(i.hasNext());
-  }
+    @Test
+    public void testRemove() {
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertFalse(a.remove(ByteString.valueOf("value1")));
+        Iterator<ByteString> i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertFalse(a.remove(ByteString.valueOf("value2")));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertFalse(i.hasNext());
+        Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString.valueOf("value2"));
+        Assert.assertFalse(a.remove(ByteString.valueOf("value3")));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
+        Assert.assertTrue(a.remove(ByteString.valueOf("value1")));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertFalse(i.hasNext());
+        Assert.assertTrue(a.remove(ByteString.valueOf("value2")));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+    }
+
+    @Test
+    public void testRemoveAll() {
+        // removeAll from an empty attribute.
+        Attribute a = new LinkedAttribute("test");
+        Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
+        Iterator<ByteString> i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test");
+        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test");
+        Assert.assertFalse(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"))));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        // removeAll from single-valued attribute.
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a = new LinkedAttribute("test", ByteString.valueOf("value1"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"))));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        // removeAll from multi-valued attribute.
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertFalse(a.removeAll(Collections.<ByteString> emptyList(), null));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value1"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
+        Assert.assertFalse(i.hasNext());
+
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1")), null));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value2"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
+        Assert.assertFalse(i.hasNext());
+
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2")), null));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value3"));
+        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
+        Assert.assertFalse(i.hasNext());
+
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3")), null));
+        i = a.iterator();
+        Assert.assertTrue(i.hasNext());
+        Assert.assertEquals(i.next(), ByteString.valueOf("value4"));
+        Assert.assertFalse(i.hasNext());
+
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3"), ByteString.valueOf("value4")),
+                null));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+
+        a =
+                new LinkedAttribute("test", ByteString.valueOf("value1"), ByteString
+                        .valueOf("value2"), ByteString.valueOf("value3"), ByteString
+                        .valueOf("value4"));
+        Assert.assertTrue(a.removeAll(Arrays.asList(ByteString.valueOf("value1"), ByteString
+                .valueOf("value2"), ByteString.valueOf("value3"), ByteString.valueOf("value4"),
+                ByteString.valueOf("value5")), null));
+        i = a.iterator();
+        Assert.assertFalse(i.hasNext());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
index 27a5e6d..4961c05 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,8 +27,6 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
@@ -38,458 +35,372 @@
 import java.util.Iterator;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.AVA;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.RDN;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.Schema;
-import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
- * This class defines a set of tests for the {@link org.forgerock.opendj.ldap.RDN} class.
+ * This class defines a set of tests for the
+ * {@link org.forgerock.opendj.ldap.RDN} class.
  */
 @SuppressWarnings("javadoc")
-public final class RDNTestCase extends TypesTestCase
-{
+public final class RDNTestCase extends TypesTestCase {
 
-  // Domain component attribute type.
-  private AttributeType AT_DC;
+    // Domain component attribute type.
+    private static final AttributeType AT_DC;
 
-  // Common name attribute type.
-  private AttributeType AT_CN;
+    // Common name attribute type.
+    private static final AttributeType AT_CN;
 
-  // Test attribute value.
-  private AVA AV_DC_ORG;
+    // Test attribute value.
+    private static final AVA AV_DC_ORG;
 
-  // org bytestring.
-  private static final ByteString ORG = ByteString.valueOf("org");
-
-
-
-  /**
-   * RDN test data provider.
-   *
-   * @return The array of test RDN strings.
-   */
-  @DataProvider(name = "testRDNs")
-  public Object[][] createData()
-  {
-    return new Object[][] {
-        { "dc=hello world", "dc=hello world", "dc=hello world" },
-        { "dc =hello world", "dc=hello world", "dc=hello world" },
-        { "dc  =hello world", "dc=hello world", "dc=hello world" },
-        { "dc= hello world", "dc=hello world", "dc=hello world" },
-        { "dc=  hello world", "dc=hello world", "dc=hello world" },
-        { "undefined=hello", "undefined=hello", "undefined=hello" },
-        { "DC=HELLO WORLD", "dc=hello world", "DC=HELLO WORLD" },
-        { "dc = hello    world", "dc=hello world", "dc=hello    world" },
-        { "   dc = hello world   ", "dc=hello world", "dc=hello world" },
-        { "givenName=John+cn=Doe", "cn=doe+givenname=john",
-            "givenName=John+cn=Doe" },
-        { "givenName=John\\+cn=Doe", "givenname=john\\+cn\\=doe",
-            "givenName=John\\+cn=Doe" },
-        { "cn=Doe\\, John", "cn=doe\\, john", "cn=Doe\\, John" },
-        { "OU=Sales+CN=J. Smith", "cn=j. smith+ou=sales",
-            "OU=Sales+CN=J. Smith" },
-        { "CN=James \\\"Jim\\\" Smith\\, III",
-            "cn=james \\\"jim\\\" smith\\, iii",
-            "CN=James \\\"Jim\\\" Smith\\, III" },
-        // \0d is a hex representation of Carriage return. It is mapped
-        // to a SPACE as defined in the MAP ( RFC 4518)
-        { "CN=Before\\0dAfter", "cn=before after", "CN=Before\\0dAfter" },
-        { "cn=#04024869",
-        // Unicode codepoints from 0000-0008 are mapped to nothing.
-            "cn=hi", "cn=\\04\\02Hi" },
-        { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", "CN=Lu\u010di\u0107" },
-        { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8", "ou=\u55b6\u696d\u90e8",
-            "ou=\u55b6\u696d\u90e8" },
-        { "photo=\\ john \\ ", "photo=\\ john \\ ", "photo=\\ john \\ " },
-        { "AB-global=", "ab-global=", "AB-global=" },
-        { "cn=John+a=", "a=+cn=john", "cn=John+a=" },
-        { "O=\"Sue, Grabbit and Runn\"", "o=sue\\, grabbit and runn",
-            "O=Sue\\, Grabbit and Runn" }, };
-  }
-
-
-
-  /**
-   * Illegal RDN test data provider.
-   *
-   * @return The array of illegal test RDN strings.
-   */
-  @DataProvider(name = "illegalRDNs")
-  public Object[][] createIllegalData()
-  {
-    return new Object[][] { { null }, { "" }, { " " }, { "=" }, { "manager" },
-        { "manager " }, { "cn+" },
-        { "cn+Jim" },
-        { "cn=Jim+" },
-        { "cn=Jim +" },
-        { "cn=Jim+ " },
-        { "cn=Jim+sn" },
-        { "cn=Jim+sn " },
-        { "cn=Jim+sn equals" },// { "cn=Jim," }, { "cn=Jim;" }, { "cn=Jim,  " },
-        // { "cn=Jim+sn=a," }, { "cn=Jim, sn=Jam " }, { "cn+uid=Jim" },
-        { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" },
-        { "@cn=Jim" }, { "_name_=Jim" }, { "\u03c0=pi" }, { "v1.0=buggy" },
-        { "cn=Jim+sn=Bob++" }, { "cn=Jim+sn=Bob+," },
-        { "1.3.6.1.4.1.1466..0=#04024869" }, };
-  }
-
-
-
-  /**
-   * RDN equality test data provider.
-   *
-   * @return The array of test RDN strings.
-   */
-  @DataProvider(name = "createRDNEqualityData")
-  public Object[][] createRDNEqualityData()
-  {
-    // @formatter:off
-    return new Object[][] {
-        { "cn=hello world", "cn=hello world", 0 },
-        { "cn=hello world", "CN=hello world", 0 },
-        { "cn=hello   world", "cn=hello world", 0 },
-        { "  cn =  hello world  ", "cn=hello world", 0 },
-        { "cn=hello world\\ ", "cn=hello world", 0 },
-        { "cn=HELLO WORLD", "cn=hello world", 0 },
-        { "cn=HELLO+sn=WORLD", "sn=world+cn=hello", 0 },
-        { "cn=HELLO+sn=WORLD", "cn=hello+sn=nurse", 1 },
-        { "cn=HELLO+sn=WORLD", "cn=howdy+sn=yall", -1 },
-        { "cn=hello", "cn=hello+sn=world", -1 },
-        { "cn=hello+sn=world", "cn=hello", 1 },
-        { "cn=hello+sn=world", "cn=hello+description=world", 1 },
-        { "cn=hello", "sn=world", -1 },
-        { "sn=hello", "cn=world", 1 },
-        // { "x-test-integer-type=10", "x-test-integer-type=9", 1 },
-        // { "x-test-integer-type=999", "x-test-integer-type=1000", -1 },
-        // { "x-test-integer-type=-1", "x-test-integer-type=0", -1 },
-        // { "x-test-integer-type=0", "x-test-integer-type=-1", 1 },
-        { "cn=aaa", "cn=aaaa", -1 },
-        { "cn=AAA", "cn=aaaa", -1 },
-        { "cn=aaa", "cn=AAAA", -1 },
-        { "cn=aaaa", "cn=aaa", 1 },
-        { "cn=AAAA", "cn=aaa", 1 },
-        { "cn=aaaa", "cn=AAA", 1 },
-        { "cn=aaab", "cn=aaaa", 1 },
-        { "cn=aaaa", "cn=aaab", -1 },
-        { RDN.maxValue(), RDN.maxValue(), 0 },
-        { RDN.maxValue(), "cn=aaa", 1 },
-        { "cn=aaa", RDN.maxValue(), -1 },
-    };
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Set up the environment for performing the tests in this suite.
-   *
-   * @throws Exception
-   *           If the environment could not be set up.
-   */
-  @BeforeClass
-  public void setUp() throws Exception
-  {
-    AT_DC = Schema.getCoreSchema().getAttributeType("dc");
-    AT_CN = Schema.getCoreSchema().getAttributeType("cn");
-    // Set the avas.
-    AV_DC_ORG = new AVA(AT_DC, ByteString.valueOf("org"));
-  }
-
-
-
-  /**
-   * Test RDN compareTo
-   *
-   * @param first
-   *          First RDN to compare.
-   * @param second
-   *          Second RDN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createRDNEqualityData")
-  public void testCompareTo(final Object first, final Object second,
-      final int result) throws Exception
-  {
-    final RDN rdn1 = parseRDN(first);
-    final RDN rdn2 = parseRDN(second);
-
-    int rc = rdn1.compareTo(rdn2);
-
-    // Normalize the result.
-    if (rc < 0)
-    {
-      rc = -1;
-    }
-    else if (rc > 0)
-    {
-      rc = 1;
+    static {
+        AT_DC = Schema.getCoreSchema().getAttributeType("dc");
+        AT_CN = Schema.getCoreSchema().getAttributeType("cn");
+        // Set the avas.
+        AV_DC_ORG = new AVA(AT_DC, ByteString.valueOf("org"));
     }
 
-    assertEquals(rc, result, "Comparison for <" + first + "> and <" + second
-        + ">.");
-  }
+    // org bytestring.
+    private static final ByteString ORG = ByteString.valueOf("org");
 
-
-
-  private RDN parseRDN(final Object value)
-  {
-    return (value instanceof RDN) ? ((RDN) value) : RDN.valueOf(value.toString());
-  }
-
-
-
-  /**
-   * Test RDN construction with single AVA.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructor() throws Exception
-  {
-    final RDN rdn = new RDN(AT_DC, ORG);
-
-    assertEquals(rdn.size(), 1);
-    assertEquals(rdn.isMultiValued(), false);
-    assertEquals(rdn.getFirstAVA().getAttributeType(), AT_DC);
-    assertEquals(rdn.getFirstAVA().getAttributeType().getNameOrOID(), AT_DC
-        .getNameOrOID());
-    assertEquals(rdn.getFirstAVA(), AV_DC_ORG);
-  }
-
-
-
-  /**
-   * Test RDN construction with String attribute type and value.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructorWithString() throws Exception
-  {
-    final RDN rdn = new RDN("dc", "org");
-    assertEquals(rdn.size(), 1);
-    assertEquals(rdn.getFirstAVA().getAttributeType(), AT_DC);
-    assertEquals(rdn.getFirstAVA().getAttributeType().getNameOrOID(), "dc");
-    assertEquals(rdn.getFirstAVA(), AV_DC_ORG);
-  }
-
-
-
-  /**
-   * Test RDN string decoder against illegal strings.
-   *
-   * @param rawRDN
-   *          Illegal RDN string representation.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "illegalRDNs", expectedExceptions = {
-      NullPointerException.class, LocalizedIllegalArgumentException.class,
-      StringIndexOutOfBoundsException.class })
-  public void testDecodeIllegalString(final String rawRDN) throws Exception
-  {
-    RDN.valueOf(rawRDN);
-
-    fail("Expected exception for value \"" + rawRDN + "\"");
-  }
-
-
-
-  /**
-   * Test RDN string decoder.
-   *
-   * @param rawRDN
-   *          Raw RDN string representation.
-   * @param normRDN
-   *          Normalized RDN string representation.
-   * @param stringRDN
-   *          String representation.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  /**
-   * @Test(dataProvider = "testRDNs") public void testToString(String rawRDN,
-   *                    String normRDN, String stringRDN) throws Exception { RDN
-   *                    rdn = RDN.valueOf(rawRDN); assertEquals(rdn.toString(),
-   *                    stringRDN); }
-   **/
-
-  /**
-   * Test RDN string decoder.
-   *
-   * @param rawRDN
-   *          Raw RDN string representation.
-   * @param normRDN
-   *          Normalized RDN string representation.
-   * @param stringRDN
-   *          String representation.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "testRDNs")
-  public void testDecodeString(final String rawRDN, final String normRDN,
-      final String stringRDN) throws Exception
-  {
-    final RDN rdn = RDN.valueOf(rawRDN);
-    final RDN string = RDN.valueOf(stringRDN);
-    assertEquals(rdn, string);
-  }
-
-
-
-  /**
-   * Tests the valueof with ctor.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testDuplicateSingle()
-  {
-    final RDN rdn1 = new RDN(AT_DC, ORG);
-    final RDN rdn2 = RDN.valueOf("dc=org");
-
-    assertFalse(rdn1 == rdn2);
-    assertEquals(rdn1, rdn2);
-  }
-
-
-
-  /**
-   * Test RDN equality
-   *
-   * @param first
-   *          First RDN to compare.
-   * @param second
-   *          Second RDN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createRDNEqualityData")
-  public void testEquality(final Object first, final Object second,
-      final int result) throws Exception
-  {
-    final RDN rdn1 = parseRDN(first);
-    final RDN rdn2 = parseRDN(second);
-
-    if (result == 0)
-    {
-      assertTrue(rdn1.equals(rdn2), "RDN equality for <" + first + "> and <"
-          + second + ">");
+    /**
+     * RDN test data provider.
+     *
+     * @return The array of test RDN strings.
+     */
+    @DataProvider(name = "testRDNs")
+    public Object[][] createData() {
+        return new Object[][] {
+            { "dc=hello world", "dc=hello world", "dc=hello world" },
+            { "dc =hello world", "dc=hello world", "dc=hello world" },
+            { "dc  =hello world", "dc=hello world", "dc=hello world" },
+            { "dc= hello world", "dc=hello world", "dc=hello world" },
+            { "dc=  hello world", "dc=hello world", "dc=hello world" },
+            { "undefined=hello", "undefined=hello", "undefined=hello" },
+            { "DC=HELLO WORLD", "dc=hello world", "DC=HELLO WORLD" },
+            { "dc = hello    world", "dc=hello world", "dc=hello    world" },
+            { "   dc = hello world   ", "dc=hello world", "dc=hello world" },
+            { "givenName=John+cn=Doe", "cn=doe+givenname=john", "givenName=John+cn=Doe" },
+            { "givenName=John\\+cn=Doe", "givenname=john\\+cn\\=doe", "givenName=John\\+cn=Doe" },
+            { "cn=Doe\\, John", "cn=doe\\, john", "cn=Doe\\, John" },
+            { "OU=Sales+CN=J. Smith", "cn=j. smith+ou=sales", "OU=Sales+CN=J. Smith" },
+            { "CN=James \\\"Jim\\\" Smith\\, III", "cn=james \\\"jim\\\" smith\\, iii",
+                "CN=James \\\"Jim\\\" Smith\\, III" },
+            // \0d is a hex representation of Carriage return. It is mapped
+            // to a SPACE as defined in the MAP ( RFC 4518)
+            { "CN=Before\\0dAfter", "cn=before after", "CN=Before\\0dAfter" },
+            { "cn=#04024869",
+                // Unicode codepoints from 0000-0008 are mapped to nothing.
+                "cn=hi", "cn=\\04\\02Hi" },
+            { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", "CN=Lu\u010di\u0107" },
+            { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8", "ou=\u55b6\u696d\u90e8",
+                "ou=\u55b6\u696d\u90e8" },
+            { "photo=\\ john \\ ", "photo=\\ john \\ ", "photo=\\ john \\ " },
+            { "AB-global=", "ab-global=", "AB-global=" },
+            { "cn=John+a=", "a=+cn=john", "cn=John+a=" },
+            { "O=\"Sue, Grabbit and Runn\"", "o=sue\\, grabbit and runn",
+                "O=Sue\\, Grabbit and Runn" }, };
     }
-    else
-    {
-      assertFalse(rdn1.equals(rdn2), "RDN equality for <" + first + "> and <"
-          + second + ">");
+
+    /**
+     * Illegal RDN test data provider.
+     *
+     * @return The array of illegal test RDN strings.
+     */
+    @DataProvider(name = "illegalRDNs")
+    public Object[][] createIllegalData() {
+        return new Object[][] { { null }, { "" }, { " " }, { "=" }, { "manager" }, { "manager " },
+            { "cn+" }, { "cn+Jim" },
+            { "cn=Jim+" },
+            { "cn=Jim +" },
+            { "cn=Jim+ " },
+            { "cn=Jim+sn" },
+            { "cn=Jim+sn " },
+            { "cn=Jim+sn equals" }, // { "cn=Jim," }, { "cn=Jim;" }, {
+                                    // "cn=Jim,  " },
+            // { "cn=Jim+sn=a," }, { "cn=Jim, sn=Jam " }, { "cn+uid=Jim" },
+            { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" }, { "@cn=Jim" },
+            { "_name_=Jim" }, { "\u03c0=pi" }, { "v1.0=buggy" }, { "cn=Jim+sn=Bob++" },
+            { "cn=Jim+sn=Bob+," }, { "1.3.6.1.4.1.1466..0=#04024869" }, };
     }
-  }
 
-
-
-  /**
-   * Tests the equals method with a non-RDN argument.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testEqualityNonRDN()
-  {
-    final RDN rdn = new RDN(AT_DC, ORG);
-
-    assertFalse(rdn.equals("this isn't an RDN"));
-  }
-
-
-
-  /**
-   * Tests the equals method with a null argument.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testEqualityNull()
-  {
-    final RDN rdn = new RDN(AT_DC, ORG);
-
-    assertFalse(rdn.equals(null));
-  }
-
-
-
-  /**
-   * Test getAttributeName.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testGetAttributeName() throws Exception
-  {
-    final RDN rdn = RDN.valueOf("dc=opendj+cn=org");
-    assertTrue(rdn.isMultiValued());
-    assertEquals(rdn.size(), 2);
-    final Iterator<AVA> it = rdn.iterator();
-    assertEquals(it.next().getAttributeType().getNameOrOID(), AT_DC
-        .getNameOrOID());
-    assertEquals(it.next().getAttributeType().getNameOrOID(), AT_CN
-        .getNameOrOID());
-  }
-
-
-
-  /**
-   * Test RDN hashCode
-   *
-   * @param first
-   *          First RDN to compare.
-   * @param second
-   *          Second RDN to compare.
-   * @param result
-   *          Expected comparison result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "createRDNEqualityData")
-  public void testHashCode(final Object first, final Object second,
-      final int result) throws Exception
-  {
-    final RDN rdn1 = parseRDN(first);
-    final RDN rdn2 = parseRDN(second);
-
-    final int h1 = rdn1.hashCode();
-    final int h2 = rdn2.hashCode();
-
-    if (result == 0)
-    {
-      if (h1 != h2)
-      {
-        fail("Hash codes for <" + first + "> and <" + second
-            + "> should be the same.");
-      }
+    /**
+     * RDN equality test data provider.
+     *
+     * @return The array of test RDN strings.
+     */
+    @DataProvider(name = "createRDNEqualityData")
+    public Object[][] createRDNEqualityData() {
+        // @formatter:off
+        return new Object[][] {
+            { "cn=hello world", "cn=hello world", 0 },
+            { "cn=hello world", "CN=hello world", 0 },
+            { "cn=hello   world", "cn=hello world", 0 },
+            { "  cn =  hello world  ", "cn=hello world", 0 },
+            { "cn=hello world\\ ", "cn=hello world", 0 },
+            { "cn=HELLO WORLD", "cn=hello world", 0 },
+            { "cn=HELLO+sn=WORLD", "sn=world+cn=hello", 0 },
+            { "cn=HELLO+sn=WORLD", "cn=hello+sn=nurse", 1 },
+            { "cn=HELLO+sn=WORLD", "cn=howdy+sn=yall", -1 },
+            { "cn=hello", "cn=hello+sn=world", -1 },
+            { "cn=hello+sn=world", "cn=hello", 1 },
+            { "cn=hello+sn=world", "cn=hello+description=world", 1 },
+            { "cn=hello", "sn=world", -1 },
+            { "sn=hello", "cn=world", 1 },
+            // { "x-test-integer-type=10", "x-test-integer-type=9", 1 },
+            // { "x-test-integer-type=999", "x-test-integer-type=1000", -1 },
+            // { "x-test-integer-type=-1", "x-test-integer-type=0", -1 },
+            // { "x-test-integer-type=0", "x-test-integer-type=-1", 1 },
+            { "cn=aaa", "cn=aaaa", -1 },
+            { "cn=AAA", "cn=aaaa", -1 },
+            { "cn=aaa", "cn=AAAA", -1 },
+            { "cn=aaaa", "cn=aaa", 1 },
+            { "cn=AAAA", "cn=aaa", 1 },
+            { "cn=aaaa", "cn=AAA", 1 },
+            { "cn=aaab", "cn=aaaa", 1 },
+            { "cn=aaaa", "cn=aaab", -1 },
+            { RDN.maxValue(), RDN.maxValue(), 0 },
+            { RDN.maxValue(), "cn=aaa", 1 },
+            { "cn=aaa", RDN.maxValue(), -1 },
+        };
+        // @formatter:on
     }
-    else
-    {
-      if (h1 == h2)
-      {
-        fail("Hash codes for <" + first + "> and <" + second
-            + "> should be the same.");
-      }
+
+    /**
+     * Test RDN compareTo
+     *
+     * @param first
+     *            First RDN to compare.
+     * @param second
+     *            Second RDN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createRDNEqualityData")
+    public void testCompareTo(final Object first, final Object second, final int result)
+            throws Exception {
+        final RDN rdn1 = parseRDN(first);
+        final RDN rdn2 = parseRDN(second);
+
+        int rc = rdn1.compareTo(rdn2);
+
+        // Normalize the result.
+        if (rc < 0) {
+            rc = -1;
+        } else if (rc > 0) {
+            rc = 1;
+        }
+
+        assertEquals(rc, result, "Comparison for <" + first + "> and <" + second + ">.");
     }
-  }
+
+    private RDN parseRDN(final Object value) {
+        return (value instanceof RDN) ? ((RDN) value) : RDN.valueOf(value.toString());
+    }
+
+    /**
+     * Test RDN construction with single AVA.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructor() throws Exception {
+        final RDN rdn = new RDN(AT_DC, ORG);
+
+        assertEquals(rdn.size(), 1);
+        assertEquals(rdn.isMultiValued(), false);
+        assertEquals(rdn.getFirstAVA().getAttributeType(), AT_DC);
+        assertEquals(rdn.getFirstAVA().getAttributeType().getNameOrOID(), AT_DC.getNameOrOID());
+        assertEquals(rdn.getFirstAVA(), AV_DC_ORG);
+    }
+
+    /**
+     * Test RDN construction with String attribute type and value.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructorWithString() throws Exception {
+        final RDN rdn = new RDN("dc", "org");
+        assertEquals(rdn.size(), 1);
+        assertEquals(rdn.getFirstAVA().getAttributeType(), AT_DC);
+        assertEquals(rdn.getFirstAVA().getAttributeType().getNameOrOID(), "dc");
+        assertEquals(rdn.getFirstAVA(), AV_DC_ORG);
+    }
+
+    /**
+     * Test RDN string decoder against illegal strings.
+     *
+     * @param rawRDN
+     *            Illegal RDN string representation.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "illegalRDNs", expectedExceptions = { NullPointerException.class,
+            LocalizedIllegalArgumentException.class, StringIndexOutOfBoundsException.class })
+    public void testDecodeIllegalString(final String rawRDN) throws Exception {
+        RDN.valueOf(rawRDN);
+
+        fail("Expected exception for value \"" + rawRDN + "\"");
+    }
+
+    /**
+     * Test RDN string decoder.
+     *
+     * @param rawRDN
+     *            Raw RDN string representation.
+     * @param normRDN
+     *            Normalized RDN string representation.
+     * @param stringRDN
+     *            String representation.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    /**
+     * @Test(dataProvider = "testRDNs") public void testToString(String rawRDN,
+     *                    String normRDN, String stringRDN) throws Exception {
+     *                    RDN rdn = RDN.valueOf(rawRDN);
+     *                    assertEquals(rdn.toString(), stringRDN); }
+     **/
+
+    /**
+     * Test RDN string decoder.
+     *
+     * @param rawRDN
+     *            Raw RDN string representation.
+     * @param normRDN
+     *            Normalized RDN string representation.
+     * @param stringRDN
+     *            String representation.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "testRDNs")
+    public void testDecodeString(final String rawRDN, final String normRDN, final String stringRDN)
+            throws Exception {
+        final RDN rdn = RDN.valueOf(rawRDN);
+        final RDN string = RDN.valueOf(stringRDN);
+        assertEquals(rdn, string);
+    }
+
+    /**
+     * Tests the valueof with ctor.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testDuplicateSingle() {
+        final RDN rdn1 = new RDN(AT_DC, ORG);
+        final RDN rdn2 = RDN.valueOf("dc=org");
+
+        assertFalse(rdn1 == rdn2);
+        assertEquals(rdn1, rdn2);
+    }
+
+    /**
+     * Test RDN equality
+     *
+     * @param first
+     *            First RDN to compare.
+     * @param second
+     *            Second RDN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createRDNEqualityData")
+    public void testEquality(final Object first, final Object second, final int result)
+            throws Exception {
+        final RDN rdn1 = parseRDN(first);
+        final RDN rdn2 = parseRDN(second);
+
+        if (result == 0) {
+            assertTrue(rdn1.equals(rdn2), "RDN equality for <" + first + "> and <" + second + ">");
+        } else {
+            assertFalse(rdn1.equals(rdn2), "RDN equality for <" + first + "> and <" + second + ">");
+        }
+    }
+
+    /**
+     * Tests the equals method with a non-RDN argument.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testEqualityNonRDN() {
+        final RDN rdn = new RDN(AT_DC, ORG);
+
+        assertFalse(rdn.equals("this isn't an RDN"));
+    }
+
+    /**
+     * Tests the equals method with a null argument.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testEqualityNull() {
+        final RDN rdn = new RDN(AT_DC, ORG);
+
+        assertFalse(rdn.equals(null));
+    }
+
+    /**
+     * Test getAttributeName.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testGetAttributeName() throws Exception {
+        final RDN rdn = RDN.valueOf("dc=opendj+cn=org");
+        assertTrue(rdn.isMultiValued());
+        assertEquals(rdn.size(), 2);
+        final Iterator<AVA> it = rdn.iterator();
+        assertEquals(it.next().getAttributeType().getNameOrOID(), AT_DC.getNameOrOID());
+        assertEquals(it.next().getAttributeType().getNameOrOID(), AT_CN.getNameOrOID());
+    }
+
+    /**
+     * Test RDN hashCode
+     *
+     * @param first
+     *            First RDN to compare.
+     * @param second
+     *            Second RDN to compare.
+     * @param result
+     *            Expected comparison result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "createRDNEqualityData")
+    public void testHashCode(final Object first, final Object second, final int result)
+            throws Exception {
+        final RDN rdn1 = parseRDN(first);
+        final RDN rdn2 = parseRDN(second);
+
+        final int h1 = rdn1.hashCode();
+        final int h2 = rdn2.hashCode();
+
+        if (result == 0) {
+            if (h1 != h2) {
+                fail("Hash codes for <" + first + "> and <" + second + "> should be the same.");
+            }
+        } else {
+            if (h1 == h2) {
+                fail("Hash codes for <" + first + "> and <" + second + "> should be the same.");
+            }
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java
index 7f59340..48facfa 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,19 +26,14 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all types unit tests should extend. A type represents
  * the classes found directly under the package org.forgerock.opendj.ldap.
  */
 
 @Test(groups = { "precommit", "types", "sdk" })
-public abstract class SdkTestCase extends ForgeRockTestCase
-{
+public abstract class SdkTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
index 6a6b487..85bb408 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,152 +26,117 @@
 
 package org.forgerock.opendj.ldap;
 
-
-
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 
-import org.forgerock.opendj.ldap.Connection;
-import org.forgerock.opendj.ldap.ConnectionFactory;
-import org.forgerock.opendj.ldap.Connections;
-
-
-
 /**
  * This class defines some utility functions which can be used by test cases.
  */
-public final class TestCaseUtils
-{
-  /**
-   * The name of the system property that specifies the ldap port. Set this
-   * property when running the server if you want to use a given port number,
-   * otherwise a port is chosen randomly at test startup time.
-   */
-  public static final String PROPERTY_LDAP_PORT = "org.forgerock.opendj.test.LdapPort";
+public final class TestCaseUtils {
+    /**
+     * The name of the system property that specifies the ldap port. Set this
+     * property when running the server if you want to use a given port number,
+     * otherwise a port is chosen randomly at test startup time.
+     */
+    public static final String PROPERTY_LDAP_PORT = "org.forgerock.opendj.test.LdapPort";
 
-  /**
-   * Port number that's used by the server. Need to be used by the test cases to
-   * create connections.
-   */
-  public static final int port;
+    /**
+     * Port number that's used by the server. Need to be used by the test cases
+     * to create connections.
+     */
+    public static final int PORT;
 
-  static
-  {
-    final String ldapPort = System.getProperty(PROPERTY_LDAP_PORT);
-    if (ldapPort != null)
-    {
-      port = Integer.valueOf(ldapPort);
-    }
-    else
-    {
-      port = findFreePort();
-    }
-  }
-
-
-
-  /**
-   * Creates a temporary text file with the specified contents. It will be
-   * marked for automatic deletion when the JVM exits.
-   *
-   * @param lines
-   *          The file contents.
-   * @return The absolute path to the file that was created.
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  public static String createTempFile(final String... lines) throws Exception
-  {
-    final File f = File.createTempFile("LDIFBasedTestCase", ".txt");
-    f.deleteOnExit();
-
-    final FileWriter w = new FileWriter(f);
-    for (final String s : lines)
-    {
-      w.write(s + System.getProperty("line.separator"));
+    static {
+        final String ldapPort = System.getProperty(PROPERTY_LDAP_PORT);
+        if (ldapPort != null) {
+            PORT = Integer.valueOf(ldapPort);
+        } else {
+            PORT = findFreePort();
+        }
     }
 
-    w.close();
+    /**
+     * Creates a temporary text file with the specified contents. It will be
+     * marked for automatic deletion when the JVM exits.
+     *
+     * @param lines
+     *            The file contents.
+     * @return The absolute path to the file that was created.
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    public static String createTempFile(final String... lines) throws Exception {
+        final File f = File.createTempFile("LDIFBasedTestCase", ".txt");
+        f.deleteOnExit();
 
-    return f.getAbsolutePath();
-  }
+        final FileWriter w = new FileWriter(f);
+        for (final String s : lines) {
+            w.write(s + System.getProperty("line.separator"));
+        }
 
+        w.close();
 
-
-  /**
-   * Finds a free server socket port on the local host.
-   *
-   * @return The free port.
-   */
-  public static int findFreePort()
-  {
-    try
-    {
-      ServerSocket serverLdapSocket = new ServerSocket();
-      serverLdapSocket.setReuseAddress(true);
-      serverLdapSocket.bind(new InetSocketAddress("127.0.0.1", 0));
-      final int port = serverLdapSocket.getLocalPort();
-      serverLdapSocket.close();
-      return port;
+        return f.getAbsolutePath();
     }
-    catch (IOException e)
-    {
-      throw new RuntimeException(e);
+
+    /**
+     * Finds a free server socket port on the local host.
+     *
+     * @return The free port.
+     */
+    public static int findFreePort() {
+        try {
+            ServerSocket serverLdapSocket = new ServerSocket();
+            serverLdapSocket.setReuseAddress(true);
+            serverLdapSocket.bind(new InetSocketAddress("127.0.0.1", 0));
+            final int port = serverLdapSocket.getLocalPort();
+            serverLdapSocket.close();
+            return port;
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
-  }
 
+    /**
+     * Returns an internal client connection to the running ldap server.
+     *
+     * @return The internal client connection.
+     * @throws Exception
+     *             When an error occurs.
+     */
+    public static Connection getInternalConnection() throws Exception {
+        startServer();
+        final ConnectionFactory factory =
+                Connections.newInternalConnectionFactory(LDAPServer.getInstance(), null);
+        return factory.getConnection();
+    }
 
+    /**
+     * Returns the port which the test server listens on.
+     *
+     * @return The LDAP port.
+     */
+    public static int getLdapPort() {
+        return PORT;
+    }
 
-  /**
-   * Returns an internal client connection to the running ldap server.
-   *
-   * @return The internal client connection.
-   * @throws Exception
-   *           When an error occurs.
-   */
-  public static Connection getInternalConnection() throws Exception
-  {
-    startServer();
-    final ConnectionFactory factory = Connections.newInternalConnectionFactory(
-        LDAPServer.getInstance(), null);
-    return factory.getConnection();
-  }
+    /**
+     * Starts the test ldap server.
+     *
+     * @throws Exception
+     *             If an error occurs when starting the server.
+     */
+    public static void startServer() throws Exception {
+        LDAPServer.getInstance().start(PORT);
+    }
 
-
-
-  /**
-   * Returns the port which the test server listens on.
-   *
-   * @return The LDAP port.
-   */
-  public static int getLdapPort()
-  {
-    return port;
-  }
-
-
-
-  /**
-   * Starts the test ldap server.
-   *
-   * @throws Exception
-   *           If an error occurs when starting the server.
-   */
-  public static void startServer() throws Exception
-  {
-    LDAPServer.getInstance().start(port);
-  }
-
-
-
-  /**
-   * Stops the test ldap server.
-   */
-  public static void stopServer()
-  {
-    LDAPServer.getInstance().stop();
-  }
+    /**
+     * Stops the test ldap server.
+     */
+    public static void stopServer() {
+        LDAPServer.getInstance().stop();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TypesTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TypesTestCase.java
index bce876e..61dfc5c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TypesTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TypesTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,16 +25,12 @@
  */
 package org.forgerock.opendj.ldap;
 
-
-
 import static org.testng.Assert.assertTrue;
 
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all types unit tests should extend. A type represents
  * the classes found directly under the package org.forgerock.opendj.ldap.
@@ -43,115 +38,94 @@
 
 @Test(groups = { "precommit", "types", "sdk" })
 @SuppressWarnings("javadoc")
-public class TypesTestCase extends SdkTestCase
-{
-  /**
-   * Data provider for attribute descriptions.
-   *
-   * @return
-   */
-  @DataProvider(name = "dataForAttributeDescriptions")
-  public Object[][] dataForAttributeDescriptions()
-  {
-    // Value, type, options, containsOptions("foo")
-    return new Object[][] { { "cn" }, { "CN" }, { "objectClass" },
-        { "cn;foo" }, { "cn;FOO" }, { "cn;bar" }, { "cn;BAR" },
-        { "cn;foo;bar" }, { "cn;FOO;bar" }, };
-  }
-
-
-
-  /**
-   * Data provider for old and new attributes
-   *
-   * @return
-   */
-  @DataProvider(name = "dataForAttributeRename")
-  public Object[][] dataForAttributeRename()
-  {
-    return new Object[][] { { "cn", "cn", true }, { "CN", "cn", true },
-        { "objectClass", "cn", false }, { "cn;foo", "cn", true } };
-  }
-
-
-
-  /**
-   * Tests the attribute renaming method.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "dataForAttributeRename")
-  public void testAttributeRename(final String attr, final String desc,
-      final boolean valid) throws Exception
-  {
-    final AttributeDescription desc1 = AttributeDescription.valueOf(attr,
-        Schema.getCoreSchema());
-    final AttributeDescription desc2 = AttributeDescription.valueOf(desc,
-        Schema.getCoreSchema());
-    final Attribute attr1 = Attributes.emptyAttribute(desc1);
-    try
-    {
-      Attributes.renameAttribute(attr1, desc2);
+public class TypesTestCase extends SdkTestCase {
+    /**
+     * Data provider for attribute descriptions.
+     *
+     * @return
+     */
+    @DataProvider(name = "dataForAttributeDescriptions")
+    public Object[][] dataForAttributeDescriptions() {
+        // Value, type, options, containsOptions("foo")
+        return new Object[][] { { "cn" }, { "CN" }, { "objectClass" }, { "cn;foo" }, { "cn;FOO" },
+            { "cn;bar" }, { "cn;BAR" }, { "cn;foo;bar" }, { "cn;FOO;bar" }, };
     }
-    catch (final Exception e)
-    {
-      if (valid)
-      {
-        // shouldn't have come here.
-        throw e;
-      }
+
+    /**
+     * Data provider for old and new attributes
+     *
+     * @return
+     */
+    @DataProvider(name = "dataForAttributeRename")
+    public Object[][] dataForAttributeRename() {
+        return new Object[][] { { "cn", "cn", true }, { "CN", "cn", true },
+            { "objectClass", "cn", false }, { "cn;foo", "cn", true } };
     }
-  }
 
+    /**
+     * Tests the attribute renaming method.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "dataForAttributeRename")
+    public void testAttributeRename(final String attr, final String desc, final boolean valid)
+            throws Exception {
+        final AttributeDescription desc1 =
+                AttributeDescription.valueOf(attr, Schema.getCoreSchema());
+        final AttributeDescription desc2 =
+                AttributeDescription.valueOf(desc, Schema.getCoreSchema());
+        final Attribute attr1 = Attributes.emptyAttribute(desc1);
+        try {
+            Attributes.renameAttribute(attr1, desc2);
+        } catch (final Exception e) {
+            if (valid) {
+                // shouldn't have come here.
+                throw e;
+            }
+        }
+    }
 
+    /**
+     * Tests the empty attribute method.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "dataForAttributeDescriptions")
+    public void testEmptyAttribute(final String attrDesc) throws Exception {
+        final AttributeDescription desc =
+                AttributeDescription.valueOf(attrDesc, Schema.getCoreSchema());
+        final Attribute attr = Attributes.emptyAttribute(desc);
+        assertTrue(attr.isEmpty());
+    }
 
-  /**
-   * Tests the empty attribute method.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "dataForAttributeDescriptions")
-  public void testEmptyAttribute(final String attrDesc) throws Exception
-  {
-    final AttributeDescription desc = AttributeDescription.valueOf(attrDesc,
-        Schema.getCoreSchema());
-    final Attribute attr = Attributes.emptyAttribute(desc);
-    assertTrue(attr.isEmpty());
-  }
+    /**
+     * Tests the unmodifiable attribute method.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "dataForAttributeDescriptions",
+            expectedExceptions = UnsupportedOperationException.class)
+    public void testUnmodifiableAttribute(final String attrDesc) throws Exception {
+        final AttributeDescription desc =
+                AttributeDescription.valueOf(attrDesc, Schema.getCoreSchema());
+        final Attribute attr = Attributes.emptyAttribute(desc);
+        attr.add("test"); // should go through.
+        // Make it unmodifiable.
+        final Attribute attr1 = Attributes.unmodifiableAttribute(attr);
+        attr1.add("test");
+    }
 
-
-
-  /**
-   * Tests the unmodifiable attribute method.
-   *
-   * @throws Exception
-   */
-  @Test(dataProvider = "dataForAttributeDescriptions", expectedExceptions = UnsupportedOperationException.class)
-  public void testUnmodifiableAttribute(final String attrDesc) throws Exception
-  {
-    final AttributeDescription desc = AttributeDescription.valueOf(attrDesc,
-        Schema.getCoreSchema());
-    final Attribute attr = Attributes.emptyAttribute(desc);
-    attr.add("test"); // should go through.
-    // Make it unmodifiable.
-    final Attribute attr1 = Attributes.unmodifiableAttribute(attr);
-    attr1.add("test");
-  }
-
-
-
-  /**
-   * Tests the unmodifiable entry method.
-   *
-   * @throws Exception
-   */
-  @Test(expectedExceptions = UnsupportedOperationException.class)
-  public void testUnmodifiableEntry() throws Exception
-  {
-    final Entry entry = new LinkedHashMapEntry("cn=test");
-    // add a value.
-    entry.clearAttributes();
-    final Entry entry1 = Entries.unmodifiableEntry(entry);
-    entry1.clearAttributes();
-  }
+    /**
+     * Tests the unmodifiable entry method.
+     *
+     * @throws Exception
+     */
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void testUnmodifiableEntry() throws Exception {
+        final Entry entry = new LinkedHashMapEntry("cn=test");
+        // add a value.
+        entry.clearAttributes();
+        final Entry entry1 = Entries.unmodifiableEntry(entry);
+        entry1.clearAttributes();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java
index 9fc8cbb..a150907 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,15 +27,11 @@
 
 package org.forgerock.opendj.ldap.controls;
 
-
-
 import org.forgerock.opendj.ldap.TestCaseUtils;
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all controls unit tests should extend. A control
  * represents the classes found directly under the package
@@ -44,18 +39,16 @@
  */
 
 @Test(groups = { "precommit", "controls", "sdk" })
-public abstract class ControlsTestCase extends ForgeRockTestCase
-{
-  /**
-   * Set up the environment for performing the tests in this suite.
-   *
-   * @throws Exception
-   *           If the environment could not be set up.
-   */
-  @BeforeClass
-  public void setUp() throws Exception
-  {
-    // This test suite depends on having the schema available.
-    TestCaseUtils.startServer();
-  }
+public abstract class ControlsTestCase extends ForgeRockTestCase {
+    /**
+     * Set up the environment for performing the tests in this suite.
+     *
+     * @throws Exception
+     *             If the environment could not be set up.
+     */
+    @BeforeClass
+    public void setUp() throws Exception {
+        // This test suite depends on having the schema available.
+        TestCaseUtils.startServer();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java
index f9d65e3..8bfe322 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,44 +26,34 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.AbandonRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests Abandon requests.
  */
 @SuppressWarnings("javadoc")
-public class AbandonRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "abandonRequests")
-  public Object[][] getAbandonRequests() throws Exception
-  {
-    final AbandonRequest[] requests = { Requests.newAbandonRequest(-1),
-        Requests.newAbandonRequest(0), Requests.newAbandonRequest(1) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class AbandonRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "abandonRequests")
+    public Object[][] getAbandonRequests() throws Exception {
+        final AbandonRequest[] requests = {
+                Requests.newAbandonRequest(-1),
+                Requests.newAbandonRequest(0),
+                Requests.newAbandonRequest(1)
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected AbandonRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getAbandonRequests();
-    final AbandonRequest[] ops = new AbandonRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (AbandonRequest) objs[i][0];
+    @Override
+    protected AbandonRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getAbandonRequests();
+        final AbandonRequest[] ops = new AbandonRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (AbandonRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java
index 4a5d5d3..1603ff1 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,48 +26,36 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.requests.AddRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests ADD requests.
  */
 @SuppressWarnings("javadoc")
-public class AddRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "addRequests")
-  public Object[][] getAddRequests() throws Exception
-  {
-    final AddRequest[] requests = {
-        Requests.newAddRequest(DN.valueOf("uid=addrequest1")),
-        Requests.newAddRequest("cn=addrequesttestcase"),
-        Requests.newAddRequest("dn: ou=People,o=test", "objectClass: top",
-            "objectClass: organizationalUnit", "ou: People") };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class AddRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "addRequests")
+    public Object[][] getAddRequests() throws Exception {
+        final AddRequest[] requests = {
+                    Requests.newAddRequest(DN.valueOf("uid=addrequest1")),
+                    Requests.newAddRequest("cn=addrequesttestcase"),
+                    Requests.newAddRequest("dn: ou=People,o=test", "objectClass: top",
+                            "objectClass: organizationalUnit", "ou: People")
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected AddRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getAddRequests();
-    final AddRequest[] ops = new AddRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (AddRequest) objs[i][0];
+    @Override
+    protected AddRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getAddRequests();
+        final AddRequest[] ops = new AddRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (AddRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java
index 4b758cd..c97e41a 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,45 +26,33 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.AnonymousSASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests anonymous SASL bind requests.
  */
 @SuppressWarnings("javadoc")
-public class AnonymousSASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "anonymousSASLBindRequests")
-  public Object[][] getAnonymousSASLBindRequests() throws Exception
-  {
-    final AnonymousSASLBindRequest[] requests = {
-        Requests.newAnonymousSASLBindRequest(""),
-        Requests.newAnonymousSASLBindRequest("test") };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class AnonymousSASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "anonymousSASLBindRequests")
+    public Object[][] getAnonymousSASLBindRequests() throws Exception {
+        final AnonymousSASLBindRequest[] requests = {
+                Requests.newAnonymousSASLBindRequest(""),
+                 Requests.newAnonymousSASLBindRequest("test")
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected AnonymousSASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getAnonymousSASLBindRequests();
-    final AnonymousSASLBindRequest[] ops = new AnonymousSASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (AnonymousSASLBindRequest) objs[i][0];
+    @Override
+    protected AnonymousSASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getAnonymousSASLBindRequests();
+        final AnonymousSASLBindRequest[] ops = new AnonymousSASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (AnonymousSASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java
index 3c68cc6..fc1f7d8 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,48 +26,33 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.testng.Assert.assertNotNull;
 
-import org.forgerock.opendj.ldap.requests.BindClient;
-import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.testng.annotations.Test;
 
 import com.forgerock.opendj.ldap.LDAPConstants;
 
-
-
 /**
  * Tests the BIND requests.
  */
 @SuppressWarnings("javadoc")
-public abstract class BindRequestTestCase extends RequestTestCase
-{
-  @Test(dataProvider = "testRequests")
-  public void testAuthType(final BindRequest request) throws Exception
-  {
-    final byte b = request.getAuthenticationType();
-    if (!(b == LDAPConstants.TYPE_AUTHENTICATION_SASL || b == LDAPConstants.TYPE_AUTHENTICATION_SIMPLE))
-    {
-      throw new Exception("Invalid bind type");
+public abstract class BindRequestTestCase extends RequestTestCase {
+    @Test(dataProvider = "testRequests")
+    public void testAuthType(final BindRequest request) throws Exception {
+        final byte b = request.getAuthenticationType();
+        if (!(b == LDAPConstants.TYPE_AUTHENTICATION_SASL || b == LDAPConstants.TYPE_AUTHENTICATION_SIMPLE)) {
+            throw new Exception("Invalid bind type");
+        }
     }
-  }
 
+    @Test(dataProvider = "testRequests")
+    public void testBindClient(final BindRequest request) throws Exception {
+        final BindClient client = request.createBindClient("localhost");
+        assertNotNull(client);
+    }
 
-
-  @Test(dataProvider = "testRequests")
-  public void testBindClient(final BindRequest request) throws Exception
-  {
-    final BindClient client = request.createBindClient("localhost");
-    assertNotNull(client);
-  }
-
-
-
-  @Test(dataProvider = "testRequests")
-  public void testName(final BindRequest request) throws Exception
-  {
-    assertNotNull(request.getName());
-  }
+    @Test(dataProvider = "testRequests")
+    public void testName(final BindRequest request) throws Exception {
+        assertNotNull(request.getName());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java
index a1a4d97..4aae140 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,48 +27,36 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 
-import org.forgerock.opendj.ldap.requests.CRAMMD5SASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests CRAM MD5 SASL bind requests.
  */
 @SuppressWarnings("javadoc")
-public class CRAMMD5SASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "CRAMMD5SASLBindRequests")
-  public Object[][] getCRAMMD5SASLBindRequests() throws Exception
-  {
-    final CRAMMD5SASLBindRequest[] requests = {
-        Requests.newCRAMMD5SASLBindRequest("id1", EMPTY_BYTES),
-        Requests.newCRAMMD5SASLBindRequest("id2", getBytes("test")) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class CRAMMD5SASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "CRAMMD5SASLBindRequests")
+    public Object[][] getCRAMMD5SASLBindRequests() throws Exception {
+        final CRAMMD5SASLBindRequest[] requests = {
+                Requests.newCRAMMD5SASLBindRequest("id1", EMPTY_BYTES),
+                Requests.newCRAMMD5SASLBindRequest("id2", getBytes("test"))
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected CRAMMD5SASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getCRAMMD5SASLBindRequests();
-    final CRAMMD5SASLBindRequest[] ops = new CRAMMD5SASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (CRAMMD5SASLBindRequest) objs[i][0];
+    @Override
+    protected CRAMMD5SASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getCRAMMD5SASLBindRequests();
+        final CRAMMD5SASLBindRequest[] ops = new CRAMMD5SASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (CRAMMD5SASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java
index d30c7ac..85f8b6b 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,48 +26,34 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.CompareRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * @author sin
  */
 @SuppressWarnings("javadoc")
-public class CompareRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "CompareRequests")
-  public Object[][] getCompareRequests() throws Exception
-  {
-    final CompareRequest[] requests = {
-        Requests.newCompareRequest("uid=user.0,ou=people,o=test", "cn",
-            "user.0"),
-        Requests.newCompareRequest("uid=user.0,ou=people,o=test", "uid",
-            "user.0") };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class CompareRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "CompareRequests")
+    public Object[][] getCompareRequests() throws Exception {
+        final CompareRequest[] requests = {
+                Requests.newCompareRequest("uid=user.0,ou=people,o=test", "cn", "user.0"),
+                Requests.newCompareRequest("uid=user.0,ou=people,o=test", "uid", "user.0")
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected CompareRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getCompareRequests();
-    final CompareRequest[] ops = new CompareRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (CompareRequest) objs[i][0];
+    @Override
+    protected CompareRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getCompareRequests();
+        final CompareRequest[] ops = new CompareRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (CompareRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java
index d3c7151..93e9ce9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,47 +26,35 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.requests.DeleteRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests the delete request.
  */
 @SuppressWarnings("javadoc")
-public class DeleteRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "DeleteRequests")
-  public Object[][] getDeleteRequests() throws Exception
-  {
-    final DeleteRequest[] requests = {
-        Requests.newDeleteRequest(DN.valueOf("uid=Deleterequest1")),
-        Requests.newDeleteRequest("cn=Deleterequesttestcase"),
-        Requests.newDeleteRequest("uid=user.999,ou=people,o=test") };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class DeleteRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "DeleteRequests")
+    public Object[][] getDeleteRequests() throws Exception {
+        final DeleteRequest[] requests = {
+                Requests.newDeleteRequest(DN.valueOf("uid=Deleterequest1")),
+                Requests.newDeleteRequest("cn=Deleterequesttestcase"),
+                Requests.newDeleteRequest("uid=user.999,ou=people,o=test")
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected DeleteRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getDeleteRequests();
-    final DeleteRequest[] ops = new DeleteRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (DeleteRequest) objs[i][0];
+    @Override
+    protected DeleteRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getDeleteRequests();
+        final DeleteRequest[] ops = new DeleteRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (DeleteRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java
index b4a2743..ecb3647 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,94 +27,76 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 import static org.testng.Assert.assertEquals;
 
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.requests.DigestMD5SASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Tests Digest MD5 SASL requests.
  */
 @SuppressWarnings("javadoc")
-public class DigestMD5SASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "DigestMD5SASLBindRequests")
-  public Object[][] getDigestMD5SASLBindRequests() throws Exception
-  {
-    final DigestMD5SASLBindRequest[] requests = {
-        Requests.newDigestMD5SASLBindRequest("id1", EMPTY_BYTES),
-        Requests.newDigestMD5SASLBindRequest("id2", getBytes("password")) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class DigestMD5SASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "DigestMD5SASLBindRequests")
+    public Object[][] getDigestMD5SASLBindRequests() throws Exception {
+        final DigestMD5SASLBindRequest[] requests = {
+                Requests.newDigestMD5SASLBindRequest("id1", EMPTY_BYTES),
+                Requests.newDigestMD5SASLBindRequest("id2", getBytes("password"))
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected DigestMD5SASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getDigestMD5SASLBindRequests();
-    final DigestMD5SASLBindRequest[] ops = new DigestMD5SASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (DigestMD5SASLBindRequest) objs[i][0];
+    @Override
+    protected DigestMD5SASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getDigestMD5SASLBindRequests();
+        final DigestMD5SASLBindRequest[] ops = new DigestMD5SASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (DigestMD5SASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 
-  @Test(dataProvider = "DigestMD5SASLBindRequests")
-  public void testQOP(DigestMD5SASLBindRequest request) throws Exception
-  {
-    String[] options = new String[] {
-        DigestMD5SASLBindRequest.QOP_AUTH,
-        DigestMD5SASLBindRequest.QOP_AUTH_INT,
-        DigestMD5SASLBindRequest.QOP_AUTH_CONF };
-    request.addQOP(options);
-    assertEquals(request.getQOPs(), Arrays.asList(options));
-  }
+    @Test(dataProvider = "DigestMD5SASLBindRequests")
+    public void testQOP(DigestMD5SASLBindRequest request) throws Exception {
+        String[] options =
+                new String[] { DigestMD5SASLBindRequest.QOP_AUTH,
+                    DigestMD5SASLBindRequest.QOP_AUTH_INT, DigestMD5SASLBindRequest.QOP_AUTH_CONF };
+        request.addQOP(options);
+        assertEquals(request.getQOPs(), Arrays.asList(options));
+    }
 
-  @Test(dataProvider = "DigestMD5SASLBindRequests" )
-  public void testStrength(DigestMD5SASLBindRequest request) throws Exception
-  {
-    request.setCipher(DigestMD5SASLBindRequest.CIPHER_3DES);
-    assertEquals(request.getCipher(), DigestMD5SASLBindRequest.CIPHER_3DES);
+    @Test(dataProvider = "DigestMD5SASLBindRequests")
+    public void testStrength(DigestMD5SASLBindRequest request) throws Exception {
+        request.setCipher(DigestMD5SASLBindRequest.CIPHER_3DES);
+        assertEquals(request.getCipher(), DigestMD5SASLBindRequest.CIPHER_3DES);
 
-    request.setCipher(DigestMD5SASLBindRequest.CIPHER_MEDIUM);
-    assertEquals(request.getCipher(), DigestMD5SASLBindRequest.CIPHER_MEDIUM);
-  }
+        request.setCipher(DigestMD5SASLBindRequest.CIPHER_MEDIUM);
+        assertEquals(request.getCipher(), DigestMD5SASLBindRequest.CIPHER_MEDIUM);
+    }
 
-  @Test(dataProvider = "DigestMD5SASLBindRequests")
-  public void testServerAuth(DigestMD5SASLBindRequest request) throws Exception
-  {
-    request.setServerAuth(true);
-    assertEquals(request.isServerAuth(), true);
-  }
+    @Test(dataProvider = "DigestMD5SASLBindRequests")
+    public void testServerAuth(DigestMD5SASLBindRequest request) throws Exception {
+        request.setServerAuth(true);
+        assertEquals(request.isServerAuth(), true);
+    }
 
-  @Test(dataProvider = "DigestMD5SASLBindRequests")
-  public void testSendBuffer(DigestMD5SASLBindRequest request) throws Exception
-  {
-    request.setMaxSendBufferSize(1024);
-    assertEquals(request.getMaxSendBufferSize(), 1024);
-  }
+    @Test(dataProvider = "DigestMD5SASLBindRequests")
+    public void testSendBuffer(DigestMD5SASLBindRequest request) throws Exception {
+        request.setMaxSendBufferSize(1024);
+        assertEquals(request.getMaxSendBufferSize(), 1024);
+    }
 
-  @Test(dataProvider = "DigestMD5SASLBindRequests")
-  public void testRecieveBuffer(DigestMD5SASLBindRequest request) throws Exception
-  {;
-    request.setMaxReceiveBufferSize(1024);
-    assertEquals(request.getMaxReceiveBufferSize(), 1024);
-  }
+    @Test(dataProvider = "DigestMD5SASLBindRequests")
+    public void testRecieveBuffer(DigestMD5SASLBindRequest request) throws Exception {
+        request.setMaxReceiveBufferSize(1024);
+        assertEquals(request.getMaxReceiveBufferSize(), 1024);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java
index 5e178d9..d40e4b5 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,26 +26,19 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.testng.Assert.assertNotNull;
 
-import org.forgerock.opendj.ldap.requests.ExtendedRequest;
 import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Tests various extended requests.
  */
 @SuppressWarnings("javadoc")
-public abstract class ExtendedRequestTestCase extends RequestTestCase
-{
-  @Test(dataProvider = "testRequests")
-  public void testDecoder(final ExtendedRequest<?> request) throws Exception
-  {
-    final ExtendedResultDecoder<?> decoder = request.getResultDecoder();
-    assertNotNull(decoder);
-  }
+public abstract class ExtendedRequestTestCase extends RequestTestCase {
+    @Test(dataProvider = "testRequests")
+    public void testDecoder(final ExtendedRequest<?> request) throws Exception {
+        final ExtendedResultDecoder<?> decoder = request.getResultDecoder();
+        assertNotNull(decoder);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java
index 1470c1c..d2d68b1 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,44 +26,30 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.ExternalSASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests the external SASL Bind requests.
  */
 @SuppressWarnings("javadoc")
-public class ExternalSASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "ExternalSASLBindRequests")
-  public Object[][] getExternalSASLBindRequests() throws Exception
-  {
-    final ExternalSASLBindRequest[] requests = { Requests
-        .newExternalSASLBindRequest() };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class ExternalSASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "ExternalSASLBindRequests")
+    public Object[][] getExternalSASLBindRequests() throws Exception {
+        final ExternalSASLBindRequest[] requests = { Requests.newExternalSASLBindRequest() };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected ExternalSASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getExternalSASLBindRequests();
-    final ExternalSASLBindRequest[] ops = new ExternalSASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (ExternalSASLBindRequest) objs[i][0];
+    @Override
+    protected ExternalSASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getExternalSASLBindRequests();
+        final ExternalSASLBindRequest[] ops = new ExternalSASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (ExternalSASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java
index 1f69359..dac5e14 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,17 +27,12 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 import static org.testng.Assert.assertEquals;
 
 import java.util.Arrays;
 
-import org.forgerock.opendj.ldap.requests.BindRequest;
-import org.forgerock.opendj.ldap.requests.GSSAPISASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -46,72 +40,60 @@
  * Tests GSSAPI SASL Bind requests.
  */
 @SuppressWarnings("javadoc")
-public class GSSAPISASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "GSSAPISASLBindRequests")
-  public Object[][] getGSSAPISASLBindRequests() throws Exception
-  {
-    final GSSAPISASLBindRequest[] requests = {
-        Requests.newGSSAPISASLBindRequest("id1", EMPTY_BYTES),
-        Requests
-            .newGSSAPISASLBindRequest("id2", getBytes("password")) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class GSSAPISASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "GSSAPISASLBindRequests")
+    public Object[][] getGSSAPISASLBindRequests() throws Exception {
+        final GSSAPISASLBindRequest[] requests = {
+                Requests.newGSSAPISASLBindRequest("id1", EMPTY_BYTES),
+                Requests.newGSSAPISASLBindRequest("id2", getBytes("password"))
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected GSSAPISASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getGSSAPISASLBindRequests();
-    final GSSAPISASLBindRequest[] ops = new GSSAPISASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (GSSAPISASLBindRequest) objs[i][0];
+    @Override
+    protected GSSAPISASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getGSSAPISASLBindRequests();
+        final GSSAPISASLBindRequest[] ops = new GSSAPISASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (GSSAPISASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 
-  @Test(enabled = false)
-  public void testBindClient(BindRequest request) throws Exception {
-    // Should setup a test krb server...
-    super.testBindClient(request);
-  }
+    @Test(enabled = false)
+    public void testBindClient(BindRequest request) throws Exception {
+        // Should setup a test krb server...
+        super.testBindClient(request);
+    }
 
-  @Test(dataProvider = "GSSAPISASLBindRequests")
-  public void testQOP(GSSAPISASLBindRequest request) throws Exception
-  {
-    String[] options = new String[] {
-        GSSAPISASLBindRequest.QOP_AUTH,
-        GSSAPISASLBindRequest.QOP_AUTH_INT,
-        GSSAPISASLBindRequest.QOP_AUTH_CONF };
-    request.addQOP(options);
-    assertEquals(request.getQOPs(), Arrays.asList(options));
-  }
+    @Test(dataProvider = "GSSAPISASLBindRequests")
+    public void testQOP(GSSAPISASLBindRequest request) throws Exception {
+        String[] options =
+                new String[] { GSSAPISASLBindRequest.QOP_AUTH, GSSAPISASLBindRequest.QOP_AUTH_INT,
+                    GSSAPISASLBindRequest.QOP_AUTH_CONF };
+        request.addQOP(options);
+        assertEquals(request.getQOPs(), Arrays.asList(options));
+    }
 
-  @Test(dataProvider = "GSSAPISASLBindRequests")
-  public void testServerAuth(GSSAPISASLBindRequest request) throws Exception
-  {
-    request.setServerAuth(true);
-    assertEquals(request.isServerAuth(), true);
-  }
+    @Test(dataProvider = "GSSAPISASLBindRequests")
+    public void testServerAuth(GSSAPISASLBindRequest request) throws Exception {
+        request.setServerAuth(true);
+        assertEquals(request.isServerAuth(), true);
+    }
 
-  @Test(dataProvider = "GSSAPISASLBindRequests")
-  public void testSendBuffer(GSSAPISASLBindRequest request) throws Exception
-  {
-    request.setMaxSendBufferSize(512);
-    assertEquals(request.getMaxSendBufferSize(), 512);
-  }
+    @Test(dataProvider = "GSSAPISASLBindRequests")
+    public void testSendBuffer(GSSAPISASLBindRequest request) throws Exception {
+        request.setMaxSendBufferSize(512);
+        assertEquals(request.getMaxSendBufferSize(), 512);
+    }
 
-  @Test(dataProvider = "GSSAPISASLBindRequests")
-  public void testRecieveBuffer(GSSAPISASLBindRequest request) throws Exception
-  {
-    request.setMaxReceiveBufferSize(512);
-    assertEquals(request.getMaxReceiveBufferSize(), 512);
-  }
+    @Test(dataProvider = "GSSAPISASLBindRequests")
+    public void testRecieveBuffer(GSSAPISASLBindRequest request) throws Exception {
+        request.setMaxReceiveBufferSize(512);
+        assertEquals(request.getMaxReceiveBufferSize(), 512);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java
index 0259b4c..3a508e5 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,54 +27,40 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 
-import org.forgerock.opendj.ldap.requests.GenericBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
 import com.forgerock.opendj.ldap.LDAPConstants;
 
-
-
 /**
  * Tests Generic Bind requests.
  */
 @SuppressWarnings("javadoc")
-public class GenericBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "GenericBindRequests")
-  public Object[][] getGenericBindRequests() throws Exception
-  {
-    final GenericBindRequest[] requests = {
-        Requests.newGenericBindRequest(LDAPConstants.TYPE_AUTHENTICATION_SASL,
-            EMPTY_BYTES),
-        Requests.newGenericBindRequest(
-            LDAPConstants.TYPE_AUTHENTICATION_SIMPLE, getBytes("password")),
-        Requests.newGenericBindRequest("username",
-            LDAPConstants.TYPE_AUTHENTICATION_SIMPLE, getBytes("password")) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class GenericBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "GenericBindRequests")
+    public Object[][] getGenericBindRequests() throws Exception {
+        final GenericBindRequest[] requests = {
+                Requests.newGenericBindRequest(LDAPConstants.TYPE_AUTHENTICATION_SASL, EMPTY_BYTES),
+                Requests.newGenericBindRequest(LDAPConstants.TYPE_AUTHENTICATION_SIMPLE, getBytes("password")),
+                Requests.newGenericBindRequest("username", LDAPConstants.TYPE_AUTHENTICATION_SIMPLE,
+                        getBytes("password"))
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected GenericBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getGenericBindRequests();
-    final GenericBindRequest[] ops = new GenericBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (GenericBindRequest) objs[i][0];
+    @Override
+    protected GenericBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getGenericBindRequests();
+        final GenericBindRequest[] ops = new GenericBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (GenericBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java
index 61fe0da..b8135a7 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,46 +26,33 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests the Modify DN requests.
  */
 @SuppressWarnings("javadoc")
-public class ModifyDNRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "ModifyDNRequests")
-  public Object[][] getModifyDNRequests() throws Exception
-  {
-    final ModifyDNRequest[] requests = {
-        Requests.newModifyDNRequest("uid=user.100,ou=people,o=test",
-            "uid=100.user,ou=people,o=testl"),
-        Requests.newModifyDNRequest("cn=ModifyDNrequesttestcase", "cn=xyz"), };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class ModifyDNRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "ModifyDNRequests")
+    public Object[][] getModifyDNRequests() throws Exception {
+        final ModifyDNRequest[] requests = {
+                Requests.newModifyDNRequest("uid=user.100,ou=people,o=test", "uid=100.user,ou=people,o=testl"),
+                Requests.newModifyDNRequest("cn=ModifyDNrequesttestcase", "cn=xyz"),
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected ModifyDNRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getModifyDNRequests();
-    final ModifyDNRequest[] ops = new ModifyDNRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (ModifyDNRequest) objs[i][0];
+    @Override
+    protected ModifyDNRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getModifyDNRequests();
+        final ModifyDNRequest[] ops = new ModifyDNRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (ModifyDNRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java
index 9858947..8035509 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,52 +26,40 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.ModificationType;
-import org.forgerock.opendj.ldap.requests.ModifyRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests the modify request.
  */
 @SuppressWarnings("javadoc")
-public class ModifyRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "ModifyRequests")
-  public Object[][] getModifyRequests() throws Exception
-  {
-    final ModifyRequest[] requests = {
-        Requests.newModifyRequest(DN.valueOf("uid=Modifyrequest1"))
-            .addModification(ModificationType.ADD, "userpassword", "password"),
-        Requests.newModifyRequest("cn=Modifyrequesttestcase").addModification(
-            ModificationType.ADD, "userpassword", "password"),
-        Requests.newModifyRequest("dn: ou=People,o=test", "changetype: modify",
-            "add: userpassword", "userpassword: password") };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class ModifyRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "ModifyRequests")
+    public Object[][] getModifyRequests() throws Exception {
+        final ModifyRequest[] requests = {
+                Requests.newModifyRequest(DN.valueOf("uid=Modifyrequest1")).addModification(
+                        ModificationType.ADD, "userpassword", "password"),
+                Requests.newModifyRequest("cn=Modifyrequesttestcase").addModification(
+                        ModificationType.ADD, "userpassword", "password"),
+                Requests.newModifyRequest("dn: ou=People,o=test", "changetype: modify",
+                        "add: userpassword", "userpassword: password")
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected ModifyRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getModifyRequests();
-    final ModifyRequest[] ops = new ModifyRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (ModifyRequest) objs[i][0];
+    @Override
+    protected ModifyRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getModifyRequests();
+        final ModifyRequest[] ops = new ModifyRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (ModifyRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java
index 712d8fc..ace54c4 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,48 +27,36 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static com.forgerock.opendj.util.StaticUtils.EMPTY_BYTES;
 import static com.forgerock.opendj.util.StaticUtils.getBytes;
 
-import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest;
-import org.forgerock.opendj.ldap.requests.Requests;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests Plain SASL Bind requests.
  */
 @SuppressWarnings("javadoc")
-public class PlainSASLBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "plainSASLBindRequests")
-  public Object[][] getPlainSASLBindRequests() throws Exception
-  {
-    final PlainSASLBindRequest[] requests = {
-        Requests.newPlainSASLBindRequest("id1", EMPTY_BYTES),
-        Requests.newPlainSASLBindRequest("id2", getBytes("password")) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class PlainSASLBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "plainSASLBindRequests")
+    public Object[][] getPlainSASLBindRequests() throws Exception {
+        final PlainSASLBindRequest[] requests = {
+                Requests.newPlainSASLBindRequest("id1", EMPTY_BYTES),
+                Requests.newPlainSASLBindRequest("id2", getBytes("password"))
+        };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected PlainSASLBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getPlainSASLBindRequests();
-    final PlainSASLBindRequest[] ops = new PlainSASLBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (PlainSASLBindRequest) objs[i][0];
+    @Override
+    protected PlainSASLBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getPlainSASLBindRequests();
+        final PlainSASLBindRequest[] ops = new PlainSASLBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (PlainSASLBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestTestCase.java
index a940677..0dffeb4 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
@@ -39,99 +36,76 @@
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ControlDecoder;
 import org.forgerock.opendj.ldap.controls.GenericControl;
-import org.forgerock.opendj.ldap.requests.Request;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Tests the Request class.
  */
 @SuppressWarnings("javadoc")
-public abstract class RequestTestCase extends RequestsTestCase
-{
-  // Dummy decoder which does nothing.
-  private static class MyDecoder implements ControlDecoder<Control>
-  {
-    public Control decodeControl(final Control control,
-        final DecodeOptions options) throws DecodeException
-    {
-      // do nothing.
-      return control;
+public abstract class RequestTestCase extends RequestsTestCase {
+    // Dummy decoder which does nothing.
+    private static class MyDecoder implements ControlDecoder<Control> {
+        public Control decodeControl(final Control control, final DecodeOptions options)
+                throws DecodeException {
+            // do nothing.
+            return control;
+        }
+
+        public String getOID() {
+            return "1.2.3".intern();
+        }
     }
 
+    // Connection used for sedning requests.
+    protected Connection con;
 
+    /**
+     * Request data to be validated.
+     *
+     * @return An array of requests.
+     * @throws Exception
+     */
+    @DataProvider(name = "testRequests")
+    public Object[][] getTestRequests() throws Exception {
+        final Request[] requestArray = createTestRequests();
+        final Object[][] objectArray = new Object[requestArray.length][1];
 
-    public String getOID()
-    {
-      return "1.2.3".intern();
+        for (int i = 0; i < requestArray.length; i++) {
+            objectArray[i][0] = requestArray[i];
+        }
+        return objectArray;
     }
-  }
 
-
-
-  // Connection used for sedning requests.
-  protected Connection con;
-
-
-
-  /**
-   * Request data to be validated.
-   *
-   * @return An array of requests.
-   * @throws Exception
-   */
-  @DataProvider(name = "testRequests")
-  public Object[][] getTestRequests() throws Exception
-  {
-    final Request[] requestArray = createTestRequests();
-    final Object[][] objectArray = new Object[requestArray.length][1];
-
-    for (int i = 0; i < requestArray.length; i++)
-    {
-      objectArray[i][0] = requestArray[i];
+    /**
+     * Ensures that the LDAP Server is running.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @BeforeClass()
+    public void startServer() throws Exception {
+        TestCaseUtils.startServer();
+        con = TestCaseUtils.getInternalConnection();
     }
-    return objectArray;
-  }
 
+    @Test(dataProvider = "testRequests")
+    public void testControls(final Request request) throws Exception {
+        // Add an arbitrary control and see if it is present.
+        Control control = GenericControl.newControl("1.2.3".intern());
+        request.addControl(control);
+        assertTrue(request.getControls().size() > 0);
+        final MyDecoder decoder = new MyDecoder();
+        control = request.getControl(decoder, new DecodeOptions());
+        assertNotNull(control);
+    }
 
-
-  /**
-   * Ensures that the LDAP Server is running.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @BeforeClass()
-  public void startServer() throws Exception
-  {
-    TestCaseUtils.startServer();
-    con = TestCaseUtils.getInternalConnection();
-  }
-
-
-
-  @Test(dataProvider = "testRequests")
-  public void testControls(final Request request) throws Exception
-  {
-    // Add an arbitrary control and see if it is present.
-    Control control = GenericControl.newControl("1.2.3".intern());
-    request.addControl(control);
-    assertTrue(request.getControls().size() > 0);
-    final MyDecoder decoder = new MyDecoder();
-    control = request.getControl(decoder, new DecodeOptions());
-    assertNotNull(control);
-  }
-
-
-
-  /**
-   * Creates the test requests.
-   *
-   * @return
-   * @throws Exception
-   */
-  protected abstract Request[] createTestRequests() throws Exception;
+    /**
+     * Creates the test requests.
+     *
+     * @return
+     * @throws Exception
+     */
+    protected abstract Request[] createTestRequests() throws Exception;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java
index cacb320..05e33bf 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all requests unit tests should extend. Requests
  * represents the classes found directly under the package
@@ -42,6 +37,5 @@
  */
 
 @Test(groups = { "precommit", "requests", "sdk" })
-public abstract class RequestsTestCase extends ForgeRockTestCase
-{
+public abstract class RequestsTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java
index 759b1d8..3480e87 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,45 +26,32 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.Requests;
-import org.forgerock.opendj.ldap.requests.SimpleBindRequest;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests Simple Bind requests.
  */
 @SuppressWarnings("javadoc")
-public class SimpleBindRequestTestCase extends BindRequestTestCase
-{
-  @DataProvider(name = "simpleBindRequests")
-  public Object[][] getSimpleBindRequests() throws Exception
-  {
-    final SimpleBindRequest[] requests = { Requests.newSimpleBindRequest(),// anonymous;
-        Requests.newSimpleBindRequest("username", "password".toCharArray()) };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class SimpleBindRequestTestCase extends BindRequestTestCase {
+    @DataProvider(name = "simpleBindRequests")
+    public Object[][] getSimpleBindRequests() throws Exception {
+        final SimpleBindRequest[] requests = { Requests.newSimpleBindRequest(), // anonymous;
+            Requests.newSimpleBindRequest("username", "password".toCharArray()) };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected SimpleBindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getSimpleBindRequests();
-    final SimpleBindRequest[] ops = new SimpleBindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (SimpleBindRequest) objs[i][0];
+    @Override
+    protected SimpleBindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getSimpleBindRequests();
+        final SimpleBindRequest[] ops = new SimpleBindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (SimpleBindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java
index 10cc03c..0daa8dc 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,43 +26,30 @@
 
 package org.forgerock.opendj.ldap.requests;
 
-
-
-import org.forgerock.opendj.ldap.requests.Requests;
-import org.forgerock.opendj.ldap.requests.UnbindRequest;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Tests the unbind requests.
  */
 @SuppressWarnings("javadoc")
-public class UnbindRequestTestCase extends RequestTestCase
-{
-  @DataProvider(name = "UnbindRequests")
-  public Object[][] getUnbindRequests() throws Exception
-  {
-    final UnbindRequest[] requests = { Requests.newUnbindRequest(), };
-    final Object[][] objArray = new Object[requests.length][1];
-    for (int i = 0; i < requests.length; i++)
-    {
-      objArray[i][0] = requests[i];
+public class UnbindRequestTestCase extends RequestTestCase {
+    @DataProvider(name = "UnbindRequests")
+    public Object[][] getUnbindRequests() throws Exception {
+        final UnbindRequest[] requests = { Requests.newUnbindRequest(), };
+        final Object[][] objArray = new Object[requests.length][1];
+        for (int i = 0; i < requests.length; i++) {
+            objArray[i][0] = requests[i];
+        }
+        return objArray;
     }
-    return objArray;
-  }
 
-
-
-  @Override
-  protected UnbindRequest[] createTestRequests() throws Exception
-  {
-    final Object[][] objs = getUnbindRequests();
-    final UnbindRequest[] ops = new UnbindRequest[objs.length];
-    for (int i = 0; i < objs.length; i++)
-    {
-      ops[i] = (UnbindRequest) objs[i][0];
+    @Override
+    protected UnbindRequest[] createTestRequests() throws Exception {
+        final Object[][] objs = getUnbindRequests();
+        final UnbindRequest[] ops = new UnbindRequest[objs.length];
+        for (int i = 0; i < objs.length; i++) {
+            ops[i] = (UnbindRequest) objs[i][0];
+        }
+        return ops;
     }
-    return ops;
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java
index e5dea6a..e169001 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,13 +27,9 @@
 
 package org.forgerock.opendj.ldap.responses;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all responses unit tests should extend. Responses
  * represents the classes found directly under the package
@@ -42,6 +37,5 @@
  */
 
 @Test(groups = { "precommit", "responses", "sdk" })
-public abstract class ResponsesTestCase extends ForgeRockTestCase
-{
+public abstract class ResponsesTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java
index ba7b577..f39d647 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,175 +25,139 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.SchemaElement;
-import org.forgerock.opendj.ldap.schema.SchemaException;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Abstract schema element tests.
  */
 @SuppressWarnings("javadoc")
-public abstract class AbstractSchemaElementTestCase extends SchemaTestCase
-{
-  protected static final Map<String, List<String>> EMPTY_PROPS = Collections
-      .emptyMap();
-  protected static final List<String> EMPTY_NAMES = Collections.emptyList();
+public abstract class AbstractSchemaElementTestCase extends SchemaTestCase {
+    protected static final Map<String, List<String>> EMPTY_PROPS = Collections.emptyMap();
+    protected static final List<String> EMPTY_NAMES = Collections.emptyList();
 
+    @DataProvider(name = "equalsTestData")
+    public abstract Object[][] createEqualsTestData() throws SchemaException, DecodeException;
 
+    /**
+     * Check that the equals operator works as expected.
+     *
+     * @param e1
+     *            The first element
+     * @param e2
+     *            The second element
+     * @param result
+     *            The expected result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "equalsTestData")
+    public final void testEquals(final SchemaElement e1, final SchemaElement e2,
+            final boolean result) throws Exception {
 
-  @DataProvider(name = "equalsTestData")
-  public abstract Object[][] createEqualsTestData() throws SchemaException,
-      DecodeException;
-
-
-
-  /**
-   * Check that the equals operator works as expected.
-   *
-   * @param e1
-   *          The first element
-   * @param e2
-   *          The second element
-   * @param result
-   *          The expected result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "equalsTestData")
-  public final void testEquals(final SchemaElement e1, final SchemaElement e2,
-      final boolean result) throws Exception
-  {
-
-    Assert.assertEquals(e1.equals(e2), result);
-    Assert.assertEquals(e2.equals(e1), result);
-  }
-
-
-
-  /**
-   * Check that the {@link SchemaElement#getDescription()} method returns a
-   * description.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetDescription() throws Exception
-  {
-    final SchemaElement e = getElement("hello", EMPTY_PROPS);
-    Assert.assertEquals(e.getDescription(), "hello");
-  }
-
-
-
-  /**
-   * Check that the {@link SchemaElement#getDescription()} method returns
-   * <code>null</code> when there is no description.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetDescriptionDefault() throws Exception
-  {
-    final SchemaElement e = getElement("", EMPTY_PROPS);
-    Assert.assertEquals(e.getDescription(), "");
-  }
-
-
-
-  /**
-   * Check that the {@link SchemaElement#getExtraProperty(String)} method
-   * returns values.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetExtraProperty() throws Exception
-  {
-    final List<String> values = new ArrayList<String>();
-    values.add("one");
-    values.add("two");
-    final Map<String, List<String>> props = Collections.singletonMap("test",
-        values);
-    final SchemaElement e = getElement("", props);
-
-    int i = 0;
-    for (final String value : e.getExtraProperty("test"))
-    {
-      Assert.assertEquals(value, values.get(i));
-      i++;
+        Assert.assertEquals(e1.equals(e2), result);
+        Assert.assertEquals(e2.equals(e1), result);
     }
-  }
 
+    /**
+     * Check that the {@link SchemaElement#getDescription()} method returns a
+     * description.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetDescription() throws Exception {
+        final SchemaElement e = getElement("hello", EMPTY_PROPS);
+        Assert.assertEquals(e.getDescription(), "hello");
+    }
 
+    /**
+     * Check that the {@link SchemaElement#getDescription()} method returns
+     * <code>null</code> when there is no description.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetDescriptionDefault() throws Exception {
+        final SchemaElement e = getElement("", EMPTY_PROPS);
+        Assert.assertEquals(e.getDescription(), "");
+    }
 
-  /**
-   * Check that the {@link SchemaElement#getExtraProperty(String)} method
-   * returns <code>null</code> when there is no property.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetExtraPropertyDefault() throws Exception
-  {
-    final SchemaElement e = getElement("", EMPTY_PROPS);
-    Assert.assertTrue(e.getExtraProperty("test").isEmpty());
-  }
+    /**
+     * Check that the {@link SchemaElement#getExtraProperty(String)} method
+     * returns values.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetExtraProperty() throws Exception {
+        final List<String> values = new ArrayList<String>();
+        values.add("one");
+        values.add("two");
+        final Map<String, List<String>> props = Collections.singletonMap("test", values);
+        final SchemaElement e = getElement("", props);
 
+        int i = 0;
+        for (final String value : e.getExtraProperty("test")) {
+            Assert.assertEquals(value, values.get(i));
+            i++;
+        }
+    }
 
+    /**
+     * Check that the {@link SchemaElement#getExtraProperty(String)} method
+     * returns <code>null</code> when there is no property.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetExtraPropertyDefault() throws Exception {
+        final SchemaElement e = getElement("", EMPTY_PROPS);
+        Assert.assertTrue(e.getExtraProperty("test").isEmpty());
+    }
 
-  /**
-   * Check that the {@link SchemaElement#getExtraPropertyNames()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetExtraPropertyNames() throws Exception
-  {
-    final SchemaElement e = getElement("", EMPTY_PROPS);
-    Assert.assertTrue(e.getExtraProperty("test").isEmpty());
-  }
+    /**
+     * Check that the {@link SchemaElement#getExtraPropertyNames()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetExtraPropertyNames() throws Exception {
+        final SchemaElement e = getElement("", EMPTY_PROPS);
+        Assert.assertTrue(e.getExtraProperty("test").isEmpty());
+    }
 
+    /**
+     * Check that the hasCode method operator works as expected.
+     *
+     * @param e1
+     *            The first element
+     * @param e2
+     *            The second element
+     * @param result
+     *            The expected result.
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dataProvider = "equalsTestData")
+    public final void testHashCode(final SchemaElement e1, final SchemaElement e2,
+            final boolean result) throws Exception {
 
+        Assert.assertEquals(e1.hashCode() == e2.hashCode(), result);
+    }
 
-  /**
-   * Check that the hasCode method operator works as expected.
-   *
-   * @param e1
-   *          The first element
-   * @param e2
-   *          The second element
-   * @param result
-   *          The expected result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "equalsTestData")
-  public final void testHashCode(final SchemaElement e1,
-      final SchemaElement e2, final boolean result) throws Exception
-  {
-
-    Assert.assertEquals(e1.hashCode() == e2.hashCode(), result);
-  }
-
-
-
-  protected abstract SchemaElement getElement(String description,
-      Map<String, List<String>> extraProperties) throws SchemaException;
+    protected abstract SchemaElement getElement(String description,
+            Map<String, List<String>> extraProperties) throws SchemaException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java
index ddee172..dd52f82 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,141 +25,125 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.AMR_DOUBLE_METAPHONE_NAME;
 import static org.testng.Assert.assertEquals;
 
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Approximate matching rule tests.
  */
 @SuppressWarnings("javadoc")
-public class ApproximateMatchingRuleTest extends SchemaTestCase
-{
-  MatchingRule metaphone = Schema.getCoreSchema().getMatchingRule(
-      AMR_DOUBLE_METAPHONE_NAME);
+public class ApproximateMatchingRuleTest extends SchemaTestCase {
+    MatchingRule metaphone = Schema.getCoreSchema().getMatchingRule(AMR_DOUBLE_METAPHONE_NAME);
 
+    /**
+     * Test the normalization and the approximate comparison.
+     */
+    @Test(dataProvider = "approximatematchingrules")
+    public void approximateMatchingRules(final MatchingRule rule, final String value1,
+            final String value2, final ConditionResult result) throws Exception {
+        // normalize the 2 provided values
+        final ByteString normalizedValue1 =
+                rule.normalizeAttributeValue(ByteString.valueOf(value1));
 
+        // check that the approximatelyMatch return the expected result.
+        final ConditionResult liveResult =
+                rule.getAssertion(ByteString.valueOf(value2)).matches(normalizedValue1);
+        assertEquals(result, liveResult);
+    }
 
-  /**
-   * Test the normalization and the approximate comparison.
-   */
-  @Test(dataProvider = "approximatematchingrules")
-  public void approximateMatchingRules(final MatchingRule rule,
-      final String value1, final String value2, final ConditionResult result)
-      throws Exception
-  {
-    // normalize the 2 provided values
-    final ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString
-        .valueOf(value1));
-
-    // check that the approximatelyMatch return the expected result.
-    final ConditionResult liveResult = rule.getAssertion(
-        ByteString.valueOf(value2)).matches(normalizedValue1);
-    assertEquals(result, liveResult);
-  }
-
-
-
-  /**
-   * Build the data for the approximateMatchingRules test.
-   */
-  @DataProvider(name = "approximatematchingrules")
-  public Object[][] createapproximateMatchingRuleTest()
-  {
-    // fill this table with tables containing :
-    // - the name of the approxiamtematchingrule to test
-    // - 2 values that must be tested for matching
-    // - a boolean indicating if the values match or not
-    return new Object[][] {
-        { metaphone, "celebre", "selebre", ConditionResult.TRUE },
-        { metaphone, "cygale", "sigale", ConditionResult.TRUE },
-        { metaphone, "cigale", "sigale", ConditionResult.TRUE },
-        { metaphone, "accacia", "akacia", ConditionResult.TRUE },
-        { metaphone, "cigale", "sigale", ConditionResult.TRUE },
-        { metaphone, "bertucci", "bertuchi", ConditionResult.TRUE },
-        { metaphone, "manger", "manjer", ConditionResult.TRUE },
-        { metaphone, "gyei", "kei", ConditionResult.TRUE },
-        { metaphone, "agnostique", "aknostic", ConditionResult.TRUE },
-        { metaphone, "ghang", "kang", ConditionResult.TRUE },
-        { metaphone, "affiche", "afiche", ConditionResult.TRUE },
-        { metaphone, "succeed", "sukid", ConditionResult.TRUE },
-        { metaphone, "McCarthur", "macarthur", ConditionResult.TRUE },
-        { metaphone, "czet", "set", ConditionResult.TRUE },
-        { metaphone, "re\u00C7u", "ressu", ConditionResult.TRUE },
-        { metaphone, "ni\u00D1o", "nino", ConditionResult.TRUE },
-        { metaphone, "bateaux", "bateau", ConditionResult.TRUE },
-        { metaphone, "witz", "wits", ConditionResult.TRUE },
-        { metaphone, "barre", "bare", ConditionResult.TRUE },
-        { metaphone, "write", "rite", ConditionResult.TRUE },
-        { metaphone, "the", "ze", ConditionResult.FALSE },
-        { metaphone, "motion", "mochion", ConditionResult.TRUE },
-        { metaphone, "bois", "boi", ConditionResult.TRUE },
-        { metaphone, "schi", "chi", ConditionResult.TRUE },
-        { metaphone, "escalier", "eskalier", ConditionResult.TRUE },
-        { metaphone, "science", "sience", ConditionResult.TRUE },
-        { metaphone, "school", "skool", ConditionResult.TRUE },
-        { metaphone, "swap", "sap", ConditionResult.TRUE },
-        { metaphone, "szize", "size", ConditionResult.TRUE },
-        { metaphone, "shoek", "choek", ConditionResult.FALSE },
-        { metaphone, "sugar", "chugar", ConditionResult.TRUE },
-        { metaphone, "isle", "ile", ConditionResult.TRUE },
-        { metaphone, "yle", "ysle", ConditionResult.TRUE },
-        { metaphone, "focaccia", "focashia", ConditionResult.TRUE },
-        { metaphone, "machine", "mashine", ConditionResult.TRUE },
-        { metaphone, "michael", "mikael", ConditionResult.TRUE },
-        { metaphone, "abba", "aba", ConditionResult.TRUE },
-        { metaphone, "caesar", "saesar", ConditionResult.TRUE },
-        { metaphone, "femme", "fame", ConditionResult.TRUE },
-        { metaphone, "panne", "pane", ConditionResult.TRUE },
-        { metaphone, "josa", "josa", ConditionResult.TRUE },
-        { metaphone, "jose", "hose", ConditionResult.TRUE },
-        { metaphone, "hello", "hello", ConditionResult.TRUE },
-        { metaphone, "hello", "ello", ConditionResult.FALSE },
-        { metaphone, "bag", "bak", ConditionResult.TRUE },
-        { metaphone, "bagg", "bag", ConditionResult.TRUE },
-        { metaphone, "tagliaro", "takliaro", ConditionResult.TRUE },
-        { metaphone, "biaggi", "biaji", ConditionResult.TRUE },
-        { metaphone, "bioggi", "bioji", ConditionResult.TRUE },
-        { metaphone, "rough", "rouf", ConditionResult.TRUE },
-        { metaphone, "ghislane", "jislane", ConditionResult.TRUE },
-        { metaphone, "ghaslane", "kaslane", ConditionResult.TRUE },
-        { metaphone, "odd", "ot", ConditionResult.TRUE },
-        { metaphone, "edgar", "etkar", ConditionResult.TRUE },
-        { metaphone, "edge", "eje", ConditionResult.TRUE },
-        { metaphone, "accord", "akord", ConditionResult.TRUE },
-        { metaphone, "noize", "noise", ConditionResult.TRUE },
-        { metaphone, "orchid", "orkid", ConditionResult.TRUE },
-        { metaphone, "chemistry", "kemistry", ConditionResult.TRUE },
-        { metaphone, "chianti", "kianti", ConditionResult.TRUE },
-        { metaphone, "bacher", "baker", ConditionResult.TRUE },
-        { metaphone, "achtung", "aktung", ConditionResult.TRUE },
-        { metaphone, "Writing", "riting", ConditionResult.TRUE },
-        { metaphone, "xeon", "zeon", ConditionResult.TRUE },
-        { metaphone, "lonely", "loneli", ConditionResult.TRUE },
-        { metaphone, "bellaton", "belatton", ConditionResult.TRUE },
-        { metaphone, "pate", "patte", ConditionResult.TRUE },
-        { metaphone, "voiture", "vouatur", ConditionResult.TRUE },
-        { metaphone, "garbage", "garbedge", ConditionResult.TRUE },
-        { metaphone, "algorithme", "algorizm", ConditionResult.TRUE },
-        { metaphone, "testing", "testng", ConditionResult.TRUE },
-        { metaphone, "announce", "annonce", ConditionResult.TRUE },
-        { metaphone, "automaticly", "automatically", ConditionResult.TRUE },
-        { metaphone, "modifyd", "modified", ConditionResult.TRUE },
-        { metaphone, "bouteille", "butaille", ConditionResult.TRUE },
-        { metaphone, "xeon", "zeon", ConditionResult.TRUE },
-        { metaphone, "achtung", "aktung", ConditionResult.TRUE },
-        { metaphone, "throttle", "throddle", ConditionResult.TRUE },
-        { metaphone, "thimble", "thimblle", ConditionResult.TRUE },
-        { metaphone, "", "", ConditionResult.TRUE }, };
-  }
+    /**
+     * Build the data for the approximateMatchingRules test.
+     */
+    @DataProvider(name = "approximatematchingrules")
+    public Object[][] createapproximateMatchingRuleTest() {
+        // fill this table with tables containing :
+        // - the name of the approxiamtematchingrule to test
+        // - 2 values that must be tested for matching
+        // - a boolean indicating if the values match or not
+        return new Object[][] { { metaphone, "celebre", "selebre", ConditionResult.TRUE },
+            { metaphone, "cygale", "sigale", ConditionResult.TRUE },
+            { metaphone, "cigale", "sigale", ConditionResult.TRUE },
+            { metaphone, "accacia", "akacia", ConditionResult.TRUE },
+            { metaphone, "cigale", "sigale", ConditionResult.TRUE },
+            { metaphone, "bertucci", "bertuchi", ConditionResult.TRUE },
+            { metaphone, "manger", "manjer", ConditionResult.TRUE },
+            { metaphone, "gyei", "kei", ConditionResult.TRUE },
+            { metaphone, "agnostique", "aknostic", ConditionResult.TRUE },
+            { metaphone, "ghang", "kang", ConditionResult.TRUE },
+            { metaphone, "affiche", "afiche", ConditionResult.TRUE },
+            { metaphone, "succeed", "sukid", ConditionResult.TRUE },
+            { metaphone, "McCarthur", "macarthur", ConditionResult.TRUE },
+            { metaphone, "czet", "set", ConditionResult.TRUE },
+            { metaphone, "re\u00C7u", "ressu", ConditionResult.TRUE },
+            { metaphone, "ni\u00D1o", "nino", ConditionResult.TRUE },
+            { metaphone, "bateaux", "bateau", ConditionResult.TRUE },
+            { metaphone, "witz", "wits", ConditionResult.TRUE },
+            { metaphone, "barre", "bare", ConditionResult.TRUE },
+            { metaphone, "write", "rite", ConditionResult.TRUE },
+            { metaphone, "the", "ze", ConditionResult.FALSE },
+            { metaphone, "motion", "mochion", ConditionResult.TRUE },
+            { metaphone, "bois", "boi", ConditionResult.TRUE },
+            { metaphone, "schi", "chi", ConditionResult.TRUE },
+            { metaphone, "escalier", "eskalier", ConditionResult.TRUE },
+            { metaphone, "science", "sience", ConditionResult.TRUE },
+            { metaphone, "school", "skool", ConditionResult.TRUE },
+            { metaphone, "swap", "sap", ConditionResult.TRUE },
+            { metaphone, "szize", "size", ConditionResult.TRUE },
+            { metaphone, "shoek", "choek", ConditionResult.FALSE },
+            { metaphone, "sugar", "chugar", ConditionResult.TRUE },
+            { metaphone, "isle", "ile", ConditionResult.TRUE },
+            { metaphone, "yle", "ysle", ConditionResult.TRUE },
+            { metaphone, "focaccia", "focashia", ConditionResult.TRUE },
+            { metaphone, "machine", "mashine", ConditionResult.TRUE },
+            { metaphone, "michael", "mikael", ConditionResult.TRUE },
+            { metaphone, "abba", "aba", ConditionResult.TRUE },
+            { metaphone, "caesar", "saesar", ConditionResult.TRUE },
+            { metaphone, "femme", "fame", ConditionResult.TRUE },
+            { metaphone, "panne", "pane", ConditionResult.TRUE },
+            { metaphone, "josa", "josa", ConditionResult.TRUE },
+            { metaphone, "jose", "hose", ConditionResult.TRUE },
+            { metaphone, "hello", "hello", ConditionResult.TRUE },
+            { metaphone, "hello", "ello", ConditionResult.FALSE },
+            { metaphone, "bag", "bak", ConditionResult.TRUE },
+            { metaphone, "bagg", "bag", ConditionResult.TRUE },
+            { metaphone, "tagliaro", "takliaro", ConditionResult.TRUE },
+            { metaphone, "biaggi", "biaji", ConditionResult.TRUE },
+            { metaphone, "bioggi", "bioji", ConditionResult.TRUE },
+            { metaphone, "rough", "rouf", ConditionResult.TRUE },
+            { metaphone, "ghislane", "jislane", ConditionResult.TRUE },
+            { metaphone, "ghaslane", "kaslane", ConditionResult.TRUE },
+            { metaphone, "odd", "ot", ConditionResult.TRUE },
+            { metaphone, "edgar", "etkar", ConditionResult.TRUE },
+            { metaphone, "edge", "eje", ConditionResult.TRUE },
+            { metaphone, "accord", "akord", ConditionResult.TRUE },
+            { metaphone, "noize", "noise", ConditionResult.TRUE },
+            { metaphone, "orchid", "orkid", ConditionResult.TRUE },
+            { metaphone, "chemistry", "kemistry", ConditionResult.TRUE },
+            { metaphone, "chianti", "kianti", ConditionResult.TRUE },
+            { metaphone, "bacher", "baker", ConditionResult.TRUE },
+            { metaphone, "achtung", "aktung", ConditionResult.TRUE },
+            { metaphone, "Writing", "riting", ConditionResult.TRUE },
+            { metaphone, "xeon", "zeon", ConditionResult.TRUE },
+            { metaphone, "lonely", "loneli", ConditionResult.TRUE },
+            { metaphone, "bellaton", "belatton", ConditionResult.TRUE },
+            { metaphone, "pate", "patte", ConditionResult.TRUE },
+            { metaphone, "voiture", "vouatur", ConditionResult.TRUE },
+            { metaphone, "garbage", "garbedge", ConditionResult.TRUE },
+            { metaphone, "algorithme", "algorizm", ConditionResult.TRUE },
+            { metaphone, "testing", "testng", ConditionResult.TRUE },
+            { metaphone, "announce", "annonce", ConditionResult.TRUE },
+            { metaphone, "automaticly", "automatically", ConditionResult.TRUE },
+            { metaphone, "modifyd", "modified", ConditionResult.TRUE },
+            { metaphone, "bouteille", "butaille", ConditionResult.TRUE },
+            { metaphone, "xeon", "zeon", ConditionResult.TRUE },
+            { metaphone, "achtung", "aktung", ConditionResult.TRUE },
+            { metaphone, "throttle", "throddle", ConditionResult.TRUE },
+            { metaphone, "thimble", "thimblle", ConditionResult.TRUE },
+            { metaphone, "", "", ConditionResult.TRUE }, };
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java
index 9733aca..7e89671 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,78 +25,67 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_ATTRIBUTE_TYPE_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Attribute type syntax tests.
  */
-public class AttributeTypeSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        {
-            "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )", true },
-        {
-            "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " X-APPROX 'equalLengthApproximateMatch'"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " COLLECTIVE USAGE userApplications )", true },
-        { "(1.2.8.5 NAME 'testtype' DESC 'full type')", true },
-        { "(1.2.8.5 USAGE directoryOperation )", true },
-        {
-            "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " COLLECTIVE USAGE badUsage )", false },
-        {
-            "(1.2.8.a.b NAME 'testtype' DESC 'full type' OBSOLETE "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " COLLECTIVE USAGE directoryOperation )", false },
-        {
-            "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " BADTOKEN USAGE directoryOperation )", false },
-        {
-            "1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " NO-USER-MODIFICATION USAGE userApplications", false }, };
-  }
+public class AttributeTypeSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            {
+                "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " USAGE userApplications )", true },
+            {
+                "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " X-APPROX 'equalLengthApproximateMatch'"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " COLLECTIVE USAGE userApplications )", true },
+            { "(1.2.8.5 NAME 'testtype' DESC 'full type')", true },
+            { "(1.2.8.5 USAGE directoryOperation )", true },
+            {
+                "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " COLLECTIVE USAGE badUsage )", false },
+            {
+                "(1.2.8.a.b NAME 'testtype' DESC 'full type' OBSOLETE "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " COLLECTIVE USAGE directoryOperation )", false },
+            {
+                "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " BADTOKEN USAGE directoryOperation )", false },
+            {
+                "1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
+                        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                        + " SUBSTR caseIgnoreSubstringsMatch"
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                        + " NO-USER-MODIFICATION USAGE userApplications", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_ATTRIBUTE_TYPE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_ATTRIBUTE_TYPE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java
index e862b0c..0b3f9cf 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,11 +25,13 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.DecodeException;
@@ -38,612 +39,491 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Attribute type tests.
  */
 @SuppressWarnings("javadoc")
-public class AttributeTypeTest extends AbstractSchemaElementTestCase
-{
-  private final Schema schema;
+public class AttributeTypeTest extends AbstractSchemaElementTestCase {
+    private final Schema schema;
 
-
-
-  public AttributeTypeTest() throws Exception
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addAttributeType("1.2.1", EMPTY_NAMES, "", true, null, null, null,
-        null, null, "1.3.6.1.4.1.1466.115.121.1.27", true, false, false,
-        AttributeUsage.USER_APPLICATIONS, EMPTY_PROPS, false);
-    builder.addAttributeType(
-        "( 1.2.2 OBSOLETE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE "
-            + " COLLECTIVE X-ORIGIN ( 'Sun Java System Identity Management' "
-            + "'user defined' ) X-SCHEMA-FILE '98sunEmp.ldif')", false);
-    builder.addAttributeType("1.2.3", Collections.singletonList("testType"),
-        "", false, "1.2.2", null, null, null, null,
-        "1.3.6.1.4.1.1466.115.121.1.27", false, true, false,
-        AttributeUsage.USER_APPLICATIONS, EMPTY_PROPS, false);
-    builder.addAttributeType(
-        "( 1.2.4 NAME 'testType' SUP 1.2.3 SINGLE-VALUE COLLECTIVE )", false);
-    final List<String> names = new LinkedList<String>();
-    names.add("testType");
-    names.add("testnamealias");
-    names.add("anothernamealias");
-    builder.addAttributeType("1.2.5", names, "", false, null,
-        EMR_CASE_IGNORE_LIST_OID, null, SMR_CASE_IGNORE_LIST_OID,
-        AMR_DOUBLE_METAPHONE_OID, SYNTAX_INTEGER_OID, false, false, true,
-        AttributeUsage.DSA_OPERATION, EMPTY_PROPS, false);
-    builder.addAttributeType(
-        "( 1.2.6 NAME ( 'testType' 'testnamealias' 'anothernamealias1' ) "
-            + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SUP anothernamealias"
-            + " USAGE dSAOperation NO-USER-MODIFICATION )", false);
-    schema = builder.toSchema();
-    if (!schema.getWarnings().isEmpty())
-    {
-      throw new Exception("Base schema not valid!");
+    public AttributeTypeTest() throws Exception {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addAttributeType("1.2.1", EMPTY_NAMES, "", true, null, null, null, null, null,
+                "1.3.6.1.4.1.1466.115.121.1.27", true, false, false,
+                AttributeUsage.USER_APPLICATIONS, EMPTY_PROPS, false);
+        builder.addAttributeType(
+                "( 1.2.2 OBSOLETE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE "
+                        + " COLLECTIVE X-ORIGIN ( 'Sun Java System Identity Management' "
+                        + "'user defined' ) X-SCHEMA-FILE '98sunEmp.ldif')", false);
+        builder.addAttributeType("1.2.3", Collections.singletonList("testType"), "", false,
+                "1.2.2", null, null, null, null, "1.3.6.1.4.1.1466.115.121.1.27", false, true,
+                false, AttributeUsage.USER_APPLICATIONS, EMPTY_PROPS, false);
+        builder.addAttributeType("( 1.2.4 NAME 'testType' SUP 1.2.3 SINGLE-VALUE COLLECTIVE )",
+                false);
+        final List<String> names = new LinkedList<String>();
+        names.add("testType");
+        names.add("testnamealias");
+        names.add("anothernamealias");
+        builder.addAttributeType("1.2.5", names, "", false, null, EMR_CASE_IGNORE_LIST_OID, null,
+                SMR_CASE_IGNORE_LIST_OID, AMR_DOUBLE_METAPHONE_OID, SYNTAX_INTEGER_OID, false,
+                false, true, AttributeUsage.DSA_OPERATION, EMPTY_PROPS, false);
+        builder.addAttributeType("( 1.2.6 NAME ( 'testType' 'testnamealias' 'anothernamealias1' ) "
+                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SUP anothernamealias"
+                + " USAGE dSAOperation NO-USER-MODIFICATION )", false);
+        schema = builder.toSchema();
+        if (!schema.getWarnings().isEmpty()) {
+            throw new Exception("Base schema not valid!");
+        }
     }
-  }
 
+    @DataProvider(name = "equalsTestData")
+    public Object[][] createEqualsTestData() throws SchemaException, DecodeException {
+        return new Object[][] {
+            { schema.getAttributeType("1.2.3"), schema.getAttributeType("1.2.3"), true },
+            { schema.getAttributeType("1.2.4"), schema.getAttributeType("1.2.3"), false } };
+    }
 
+    @Test
+    public void testADSyntax() throws Exception {
+        // AD uses single quotes around OIDs
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' " + " SUP '1.2.5' "
+                + " EQUALITY 'caseIgnoreMatch' "
+                + " SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' USAGE dSAOperation )", false);
+        Assert.assertTrue(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  @DataProvider(name = "equalsTestData")
-  public Object[][] createEqualsTestData() throws SchemaException,
-      DecodeException
-  {
-    return new Object[][] {
-        { schema.getAttributeType("1.2.3"), schema.getAttributeType("1.2.3"),
-            true },
-        { schema.getAttributeType("1.2.4"), schema.getAttributeType("1.2.3"),
-            false } };
-  }
+    @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testADSyntaxQuoteMismatch() throws Exception {
+        // AD uses single quotes around OIDs
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' " + " SUP '1.2.5 "
+                + " EQUALITY 'caseIgnoreMatch' "
+                + " SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' USAGE dSAOperation )", false);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
+    @Test
+    public void testCollectiveOperational() throws Exception {
+        // Collective can't be operational
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
+                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                + " SUBSTR caseIgnoreSubstringsMatch"
+                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                + " COLLECTIVE USAGE directoryOperation )", false);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
+    /**
+     * Check constructor sets the default matching rules correctly.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructorDefaultMatchingRules() throws Exception {
+        final AttributeType type = schema.getAttributeType("1.2.1");
 
-  @Test
-  public void testADSyntax() throws Exception
-  {
-    // AD uses single quotes around OIDs
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder
-        .addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
-            + " SUP '1.2.5' " + " EQUALITY 'caseIgnoreMatch' "
-            + " SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' USAGE dSAOperation )",
-            false);
-    Assert.assertTrue(builder.toSchema().getWarnings().isEmpty());
-  }
+        final Syntax syntax = schema.getSyntax("1.3.6.1.4.1.1466.115.121.1.27");
+        Assert.assertEquals(type.getApproximateMatchingRule(), syntax.getApproximateMatchingRule());
+        Assert.assertEquals(type.getEqualityMatchingRule(), syntax.getEqualityMatchingRule());
+        Assert.assertEquals(type.getOrderingMatchingRule(), syntax.getOrderingMatchingRule());
+        Assert.assertEquals(type.getSubstringMatchingRule(), syntax.getSubstringMatchingRule());
+    }
 
+    /**
+     * Check constructor sets the default usage correctly.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructorDefaultUsage() throws Exception {
+        final AttributeType d = schema.getAttributeType("1.2.2");
 
+        Assert.assertEquals(d.getUsage(), AttributeUsage.USER_APPLICATIONS);
+    }
 
-  @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testADSyntaxQuoteMismatch() throws Exception
-  {
-    // AD uses single quotes around OIDs
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder
-        .addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
-            + " SUP '1.2.5 " + " EQUALITY 'caseIgnoreMatch' "
-            + " SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' USAGE dSAOperation )",
-            false);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
+    /**
+     * Check constructor inherits the matching rules from the parent type when
+     * required.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dependsOnMethods = "testConstructorMatchingRules")
+    public void testConstructorInheritsMatchingRules() throws Exception {
+        final AttributeType parent = schema.getAttributeType("1.2.5");
 
+        final AttributeType child = schema.getAttributeType("1.2.6");
 
+        Assert.assertEquals(parent.getApproximateMatchingRule(), child.getApproximateMatchingRule());
+        Assert.assertEquals(parent.getEqualityMatchingRule(), child.getEqualityMatchingRule());
+        // It should inherit ordering rule from parent's syntax since parent
+        // didn't specify an ordering matching rule.
+        Assert.assertEquals(parent.getSyntax().getOrderingMatchingRule(), child
+                .getOrderingMatchingRule());
+        Assert.assertEquals(parent.getSubstringMatchingRule(), child.getSubstringMatchingRule());
+    }
 
-  @Test
-  public void testCollectiveOperational() throws Exception
-  {
-    // Collective can't be operational
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder.addAttributeType(
-        "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
-            + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-            + " SUBSTR caseIgnoreSubstringsMatch"
-            + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-            + " COLLECTIVE USAGE directoryOperation )", false);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
+    /**
+     * Check constructor inherits the syntax from the parent type when required.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(dependsOnMethods = "testConstructorSyntax")
+    public void testConstructorInheritsSyntax() throws Exception {
+        AttributeType parent = schema.getAttributeType("1.2.3");
 
+        AttributeType child = schema.getAttributeType("1.2.4");
 
+        Assert.assertEquals(parent.getSyntax(), child.getSyntax());
 
-  /**
-   * Check constructor sets the default matching rules correctly.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructorDefaultMatchingRules() throws Exception
-  {
-    final AttributeType type = schema.getAttributeType("1.2.1");
+        parent = schema.getAttributeType("1.2.2");
 
-    final Syntax syntax = schema.getSyntax("1.3.6.1.4.1.1466.115.121.1.27");
-    Assert.assertEquals(type.getApproximateMatchingRule(), syntax
-        .getApproximateMatchingRule());
-    Assert.assertEquals(type.getEqualityMatchingRule(), syntax
-        .getEqualityMatchingRule());
-    Assert.assertEquals(type.getOrderingMatchingRule(), syntax
-        .getOrderingMatchingRule());
-    Assert.assertEquals(type.getSubstringMatchingRule(), syntax
-        .getSubstringMatchingRule());
-  }
+        child = schema.getAttributeType("1.2.3");
+        Assert.assertFalse(parent.getSyntax().equals(child.getSyntax()));
 
+        // Make sure paren't s syntax was not inherited in this case
+        child = schema.getAttributeType("1.2.6");
+        Assert.assertEquals(child.getSyntax().getOID(), SYNTAX_DIRECTORY_STRING_OID);
+    }
 
+    /**
+     * Check constructor sets the matching rules correctly.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructorMatchingRules() throws Exception {
+        final AttributeType type = schema.getAttributeType("1.2.5");
 
-  /**
-   * Check constructor sets the default usage correctly.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructorDefaultUsage() throws Exception
-  {
-    final AttributeType d = schema.getAttributeType("1.2.2");
+        Assert.assertEquals(type.getEqualityMatchingRule().getOID(), EMR_CASE_IGNORE_LIST_OID);
+        Assert.assertEquals(type.getOrderingMatchingRule().getOID(), type.getSyntax()
+                .getOrderingMatchingRule().getOID());
+        Assert.assertEquals(type.getSubstringMatchingRule().getOID(), SMR_CASE_IGNORE_LIST_OID);
+        Assert.assertEquals(type.getApproximateMatchingRule().getOID(), AMR_DOUBLE_METAPHONE_OID);
+    }
 
-    Assert.assertEquals(d.getUsage(), AttributeUsage.USER_APPLICATIONS);
-  }
+    /**
+     * Check that the primary name is added to the set of names.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testConstructorPrimaryName() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.3");
 
+        Assert.assertTrue(d.hasName("testType"));
+        Assert.assertFalse(d.hasName("xxx"));
 
+        d = schema.getAttributeType("1.2.4");
 
-  /**
-   * Check constructor inherits the matching rules from the parent type when
-   * required.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dependsOnMethods = "testConstructorMatchingRules")
-  public void testConstructorInheritsMatchingRules() throws Exception
-  {
-    final AttributeType parent = schema.getAttributeType("1.2.5");
+        Assert.assertTrue(d.hasName("testType"));
+        Assert.assertFalse(d.hasName("xxx"));
 
-    final AttributeType child = schema.getAttributeType("1.2.6");
+    }
 
-    Assert.assertEquals(parent.getApproximateMatchingRule(), child
-        .getApproximateMatchingRule());
-    Assert.assertEquals(parent.getEqualityMatchingRule(), child
-        .getEqualityMatchingRule());
-    // It should inherit ordering rule from parent's syntax since parent
-    // didn't specify an ordering matching rule.
-    Assert.assertEquals(parent.getSyntax().getOrderingMatchingRule(), child
-        .getOrderingMatchingRule());
-    Assert.assertEquals(parent.getSubstringMatchingRule(), child
-        .getSubstringMatchingRule());
-  }
+    /**
+     * Check constructor sets the syntax correctly.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testConstructorSyntax() throws Exception {
+        final AttributeType d = schema.getAttributeType("1.2.2");
 
+        Assert.assertEquals(d.getSyntax().getOID(), "1.3.6.1.4.1.1466.115.121.1.15");
+    }
 
+    /**
+     * Check that the type names are accessible.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testConstructorTypeNames() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.5");
 
-  /**
-   * Check constructor inherits the syntax from the parent type when required.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dependsOnMethods = "testConstructorSyntax")
-  public void testConstructorInheritsSyntax() throws Exception
-  {
-    AttributeType parent = schema.getAttributeType("1.2.3");
+        Assert.assertTrue(d.hasName("testType"));
+        Assert.assertTrue(d.hasName("testnamealias"));
+        Assert.assertTrue(d.hasName("anothernamealias"));
 
-    AttributeType child = schema.getAttributeType("1.2.4");
+        d = schema.getAttributeType("1.2.6");
 
-    Assert.assertEquals(parent.getSyntax(), child.getSyntax());
+        Assert.assertTrue(d.hasName("testType"));
+        Assert.assertTrue(d.hasName("testnamealias"));
+        Assert.assertTrue(d.hasName("anothernamealias1"));
+    }
 
-    parent = schema.getAttributeType("1.2.2");
+    /**
+     * Check that the {@link AttributeType#getUsage()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testGetAttributeUsage() throws Exception {
+        AttributeType type = schema.getAttributeType("1.2.1");
+        Assert.assertEquals(type.getUsage(), AttributeUsage.USER_APPLICATIONS);
+        type = schema.getAttributeType("1.2.6");
+        Assert.assertEquals(type.getUsage(), AttributeUsage.DSA_OPERATION);
+    }
 
-    child = schema.getAttributeType("1.2.3");
-    Assert.assertFalse(parent.getSyntax().equals(child.getSyntax()));
+    /**
+     * Check that the {@link CommonSchemaElements#getNameOrOID()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetNameOrOIDReturnsOID() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.1");
 
-    // Make sure paren't s syntax was not inherited in this case
-    child = schema.getAttributeType("1.2.6");
-    Assert
-        .assertEquals(child.getSyntax().getOID(), SYNTAX_DIRECTORY_STRING_OID);
-  }
+        Assert.assertEquals(d.getNameOrOID(), "1.2.1");
 
+        d = schema.getAttributeType("1.2.2");
 
+        Assert.assertEquals(d.getNameOrOID(), "1.2.2");
+    }
 
-  /**
-   * Check constructor sets the matching rules correctly.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructorMatchingRules() throws Exception
-  {
-    final AttributeType type = schema.getAttributeType("1.2.5");
+    /**
+     * Check that the {@link CommonSchemaElements#getNameOrOID()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetNameOrOIDReturnsPrimaryName() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.3");
+        Assert.assertEquals(d.getNameOrOID(), "testType");
+        d = schema.getAttributeType("1.2.4");
+        Assert.assertEquals(d.getNameOrOID(), "testType");
+    }
 
-    Assert.assertEquals(type.getEqualityMatchingRule().getOID(),
-        EMR_CASE_IGNORE_LIST_OID);
-    Assert.assertEquals(type.getOrderingMatchingRule().getOID(), type
-        .getSyntax().getOrderingMatchingRule().getOID());
-    Assert.assertEquals(type.getSubstringMatchingRule().getOID(),
-        SMR_CASE_IGNORE_LIST_OID);
-    Assert.assertEquals(type.getApproximateMatchingRule().getOID(),
-        AMR_DOUBLE_METAPHONE_OID);
-  }
+    /**
+     * Check that the {@link CommonSchemaElements#getNormalizedNames()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetNormalizedNames() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.5");
+        Iterator<String> i = d.getNames().iterator();
+        Assert.assertEquals(i.next(), "testType");
+        Assert.assertEquals(i.next(), "testnamealias");
+        Assert.assertEquals(i.next(), "anothernamealias");
 
+        d = schema.getAttributeType("1.2.6");
+        i = d.getNames().iterator();
+        Assert.assertEquals(i.next(), "testType");
+        Assert.assertEquals(i.next(), "testnamealias");
+        Assert.assertEquals(i.next(), "anothernamealias1");
+    }
 
+    /**
+     * Check that the {@link CommonSchemaElements#getOID()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testGetOID() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.3");
+        Assert.assertEquals(d.getOID(), "1.2.3");
+        d = schema.getAttributeType("1.2.4");
+        Assert.assertEquals(d.getOID(), "1.2.4");
 
-  /**
-   * Check that the primary name is added to the set of names.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testConstructorPrimaryName() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.3");
+    }
 
-    Assert.assertTrue(d.hasName("testType"));
-    Assert.assertFalse(d.hasName("xxx"));
+    /**
+     * Check that the {@link AttributeType#getSuperiorType()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testGetSuperiorType() throws Exception {
+        AttributeType type = schema.getAttributeType("1.2.3");
+        Assert.assertEquals(type.getSuperiorType().getOID(), "1.2.2");
+        type = schema.getAttributeType("1.2.4");
+        Assert.assertEquals(type.getSuperiorType().getOID(), "1.2.3");
+    }
 
-    d = schema.getAttributeType("1.2.4");
+    /**
+     * Check that the {@link CommonSchemaElements#hasNameOrOID(String)} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testHasNameOrOID() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.3");
 
-    Assert.assertTrue(d.hasName("testType"));
-    Assert.assertFalse(d.hasName("xxx"));
+        Assert.assertTrue(d.hasNameOrOID("testType"));
+        Assert.assertTrue(d.hasNameOrOID("1.2.3"));
+        Assert.assertFalse(d.hasNameOrOID("x.y.z"));
+        d = schema.getAttributeType("1.2.4");
 
-  }
+        Assert.assertTrue(d.hasNameOrOID("testType"));
+        Assert.assertTrue(d.hasNameOrOID("1.2.4"));
+        Assert.assertFalse(d.hasNameOrOID("x.y.z"));
+    }
 
+    @Test
+    public void testInheritFromNonCollective() throws Exception {
+        // Collective can't inherit from non-collective
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
+                + " OBSOLETE SUP 1.2.5 "
+                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                + " SUBSTR caseIgnoreSubstringsMatch"
+                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                + " COLLECTIVE USAGE userApplications )", false);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
+    @Test
+    public void testInheritFromUserAppUsage() throws Exception {
+        // directoryOperation can't inherit from userApplications
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
+                + " OBSOLETE SUP 1.2.1 "
+                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                + " SUBSTR caseIgnoreSubstringsMatch"
+                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                + " NO-USER-MODIFICATION USAGE directoryOperation )", false);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  /**
-   * Check constructor sets the syntax correctly.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testConstructorSyntax() throws Exception
-  {
-    final AttributeType d = schema.getAttributeType("1.2.2");
-
-    Assert
-        .assertEquals(d.getSyntax().getOID(), "1.3.6.1.4.1.1466.115.121.1.15");
-  }
-
-
-
-  /**
-   * Check that the type names are accessible.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testConstructorTypeNames() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.5");
-
-    Assert.assertTrue(d.hasName("testType"));
-    Assert.assertTrue(d.hasName("testnamealias"));
-    Assert.assertTrue(d.hasName("anothernamealias"));
-
-    d = schema.getAttributeType("1.2.6");
-
-    Assert.assertTrue(d.hasName("testType"));
-    Assert.assertTrue(d.hasName("testnamealias"));
-    Assert.assertTrue(d.hasName("anothernamealias1"));
-  }
-
-
-
-  /**
-   * Check that the {@link AttributeType#getUsage()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testGetAttributeUsage() throws Exception
-  {
-    AttributeType type = schema.getAttributeType("1.2.1");
-    Assert.assertEquals(type.getUsage(), AttributeUsage.USER_APPLICATIONS);
-    type = schema.getAttributeType("1.2.6");
-    Assert.assertEquals(type.getUsage(), AttributeUsage.DSA_OPERATION);
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#getNameOrOID()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetNameOrOIDReturnsOID() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.1");
-
-    Assert.assertEquals(d.getNameOrOID(), "1.2.1");
-
-    d = schema.getAttributeType("1.2.2");
-
-    Assert.assertEquals(d.getNameOrOID(), "1.2.2");
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#getNameOrOID()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetNameOrOIDReturnsPrimaryName() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.3");
-    Assert.assertEquals(d.getNameOrOID(), "testType");
-    d = schema.getAttributeType("1.2.4");
-    Assert.assertEquals(d.getNameOrOID(), "testType");
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#getNormalizedNames()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetNormalizedNames() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.5");
-    Iterator<String> i = d.getNames().iterator();
-    Assert.assertEquals(i.next(), "testType");
-    Assert.assertEquals(i.next(), "testnamealias");
-    Assert.assertEquals(i.next(), "anothernamealias");
-
-    d = schema.getAttributeType("1.2.6");
-    i = d.getNames().iterator();
-    Assert.assertEquals(i.next(), "testType");
-    Assert.assertEquals(i.next(), "testnamealias");
-    Assert.assertEquals(i.next(), "anothernamealias1");
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#getOID()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testGetOID() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.3");
-    Assert.assertEquals(d.getOID(), "1.2.3");
-    d = schema.getAttributeType("1.2.4");
-    Assert.assertEquals(d.getOID(), "1.2.4");
-
-  }
-
-
-
-  /**
-   * Check that the {@link AttributeType#getSuperiorType()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testGetSuperiorType() throws Exception
-  {
-    AttributeType type = schema.getAttributeType("1.2.3");
-    Assert.assertEquals(type.getSuperiorType().getOID(), "1.2.2");
-    type = schema.getAttributeType("1.2.4");
-    Assert.assertEquals(type.getSuperiorType().getOID(), "1.2.3");
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#hasNameOrOID(String)} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testHasNameOrOID() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.3");
-
-    Assert.assertTrue(d.hasNameOrOID("testType"));
-    Assert.assertTrue(d.hasNameOrOID("1.2.3"));
-    Assert.assertFalse(d.hasNameOrOID("x.y.z"));
-    d = schema.getAttributeType("1.2.4");
-
-    Assert.assertTrue(d.hasNameOrOID("testType"));
-    Assert.assertTrue(d.hasNameOrOID("1.2.4"));
-    Assert.assertFalse(d.hasNameOrOID("x.y.z"));
-  }
-
-
-
-  @Test
-  public void testInheritFromNonCollective() throws Exception
-  {
-    // Collective can't inherit from non-collective
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
-        + " OBSOLETE SUP 1.2.5 "
-        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-        + " SUBSTR caseIgnoreSubstringsMatch"
-        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-        + " COLLECTIVE USAGE userApplications )", false);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
-
-
-
-  @Test
-  public void testInheritFromUserAppUsage() throws Exception
-  {
-    // directoryOperation can't inherit from userApplications
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' "
-        + " OBSOLETE SUP 1.2.1 "
-        + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-        + " SUBSTR caseIgnoreSubstringsMatch"
-        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-        + " NO-USER-MODIFICATION USAGE directoryOperation )", false);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
-
-
-
-  /**
-   * Check that the {@link AttributeType#isCollective()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testIsCollective() throws Exception
-  {
-    AttributeType type = schema.getAttributeType("1.2.2");
-    Assert.assertTrue(type.isCollective());
-    type = schema.getAttributeType("1.2.3");
-    Assert.assertTrue(type.isCollective());
-    type = schema.getAttributeType("1.2.6");
-    Assert.assertFalse(type.isCollective());
-    type = schema.getAttributeType("1.2.5");
-    Assert.assertFalse(type.isCollective());
-  }
-
-
-
-  /**
-   * Check that the {@link AttributeType#isNoUserModification()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testIsNoUserModification() throws Exception
-  {
-    AttributeType type = schema.getAttributeType("1.2.5");
-    Assert.assertTrue(type.isNoUserModification());
-    type = schema.getAttributeType("1.2.6");
-    Assert.assertTrue(type.isNoUserModification());
-    type = schema.getAttributeType("1.2.3");
-    Assert.assertFalse(type.isNoUserModification());
-    type = schema.getAttributeType("1.2.4");
-    Assert.assertFalse(type.isNoUserModification());
-  }
-
-
-
-  /**
-   * Check that the {@link CommonSchemaElements#isObsolete()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public final void testIsObsolete() throws Exception
-  {
-    AttributeType d = schema.getAttributeType("1.2.3");
-    Assert.assertFalse(d.isObsolete());
-    d = schema.getAttributeType("1.2.4");
-    Assert.assertFalse(d.isObsolete());
-
-    d = schema.getAttributeType("1.2.1");
-    Assert.assertTrue(d.isObsolete());
-    d = schema.getAttributeType("1.2.2");
-    Assert.assertTrue(d.isObsolete());
-  }
-
-
-
-  /**
-   * Check that the {@link AttributeType#isSingleValue()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test
-  public void testIsSingleValue() throws Exception
-  {
-    AttributeType type = schema.getAttributeType("1.2.1");
-    Assert.assertTrue(type.isSingleValue());
-    type = schema.getAttributeType("1.2.2");
-    Assert.assertTrue(type.isSingleValue());
-    type = schema.getAttributeType("1.2.5");
-    Assert.assertFalse(type.isSingleValue());
-    type = schema.getAttributeType("1.2.6");
-    Assert.assertFalse(type.isSingleValue());
-  }
-
-
-
-  /**
-   * Check that the simple constructor throws an NPE when mandatory parameters
-   * are not specified.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = IllegalArgumentException.class)
-  public void testNoSupNorSyntax1() throws Exception
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addAttributeType("1.2.1", EMPTY_NAMES, "", true, null, null, null,
-        null, null, null, false, false, false, AttributeUsage.DSA_OPERATION,
-        EMPTY_PROPS, false);
-    builder.addAttributeType(
-        "( 1.2.2 OBSOLETE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )",
-        false);
-  }
-
+    /**
+     * Check that the {@link AttributeType#isCollective()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testIsCollective() throws Exception {
+        AttributeType type = schema.getAttributeType("1.2.2");
+        Assert.assertTrue(type.isCollective());
+        type = schema.getAttributeType("1.2.3");
+        Assert.assertTrue(type.isCollective());
+        type = schema.getAttributeType("1.2.6");
+        Assert.assertFalse(type.isCollective());
+        type = schema.getAttributeType("1.2.5");
+        Assert.assertFalse(type.isCollective());
+    }
 
+    /**
+     * Check that the {@link AttributeType#isNoUserModification()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testIsNoUserModification() throws Exception {
+        AttributeType type = schema.getAttributeType("1.2.5");
+        Assert.assertTrue(type.isNoUserModification());
+        type = schema.getAttributeType("1.2.6");
+        Assert.assertTrue(type.isNoUserModification());
+        type = schema.getAttributeType("1.2.3");
+        Assert.assertFalse(type.isNoUserModification());
+        type = schema.getAttributeType("1.2.4");
+        Assert.assertFalse(type.isNoUserModification());
+    }
 
-  /**
-   * Check that the simple constructor throws an NPE when mandatory parameters
-   * are not specified.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(expectedExceptions = IllegalArgumentException.class)
-  public void testNoSupNorSyntax2() throws Exception
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addAttributeType("( 1.2.2 OBSOLETE SINGLE-VALUE )", false);
-  }
+    /**
+     * Check that the {@link CommonSchemaElements#isObsolete()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public final void testIsObsolete() throws Exception {
+        AttributeType d = schema.getAttributeType("1.2.3");
+        Assert.assertFalse(d.isObsolete());
+        d = schema.getAttributeType("1.2.4");
+        Assert.assertFalse(d.isObsolete());
 
+        d = schema.getAttributeType("1.2.1");
+        Assert.assertTrue(d.isObsolete());
+        d = schema.getAttributeType("1.2.2");
+        Assert.assertTrue(d.isObsolete());
+    }
 
+    /**
+     * Check that the {@link AttributeType#isSingleValue()} method.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test
+    public void testIsSingleValue() throws Exception {
+        AttributeType type = schema.getAttributeType("1.2.1");
+        Assert.assertTrue(type.isSingleValue());
+        type = schema.getAttributeType("1.2.2");
+        Assert.assertTrue(type.isSingleValue());
+        type = schema.getAttributeType("1.2.5");
+        Assert.assertFalse(type.isSingleValue());
+        type = schema.getAttributeType("1.2.6");
+        Assert.assertFalse(type.isSingleValue());
+    }
 
-  @Test
-  public void testNoUserModNonOperational() throws Exception
-  {
-    // NO-USER-MODIFICATION can't have non-operational usage
-    final SchemaBuilder builder = new SchemaBuilder(schema);
-    builder.addAttributeType(
-        "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
-            + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-            + " SUBSTR caseIgnoreSubstringsMatch"
-            + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-            + " NO-USER-MODIFICATION USAGE userApplications )", false);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
+    /**
+     * Check that the simple constructor throws an NPE when mandatory parameters
+     * are not specified.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testNoSupNorSyntax1() throws Exception {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addAttributeType("1.2.1", EMPTY_NAMES, "", true, null, null, null, null, null,
+                null, false, false, false, AttributeUsage.DSA_OPERATION, EMPTY_PROPS, false);
+        builder.addAttributeType(
+                "( 1.2.2 OBSOLETE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )", false);
+    }
 
+    /**
+     * Check that the simple constructor throws an NPE when mandatory parameters
+     * are not specified.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testNoSupNorSyntax2() throws Exception {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addAttributeType("( 1.2.2 OBSOLETE SINGLE-VALUE )", false);
+    }
 
+    @Test
+    public void testNoUserModNonOperational() throws Exception {
+        // NO-USER-MODIFICATION can't have non-operational usage
+        final SchemaBuilder builder = new SchemaBuilder(schema);
+        builder.addAttributeType("(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE "
+                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                + " SUBSTR caseIgnoreSubstringsMatch"
+                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                + " NO-USER-MODIFICATION USAGE userApplications )", false);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  protected SchemaElement getElement(final String description,
-      final Map<String, List<String>> extraProperties) throws SchemaException
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addAttributeType("1.2.3", Collections.singletonList("testType"),
-        description, false, null, null, null, null, null,
-        "1.3.6.1.4.1.1466.115.121.1.27", false, false, false,
-        AttributeUsage.DSA_OPERATION, extraProperties, false);
-    return builder.toSchema().getAttributeType("1.2.3");
-  }
+    protected SchemaElement getElement(final String description,
+            final Map<String, List<String>> extraProperties) throws SchemaException {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addAttributeType("1.2.3", Collections.singletonList("testType"), description,
+                false, null, null, null, null, null, "1.3.6.1.4.1.1466.115.121.1.27", false, false,
+                false, AttributeUsage.DSA_OPERATION, extraProperties, false);
+        return builder.toSchema().getAttributeType("1.2.3");
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
index 651541d..62f8eb9 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,55 +25,41 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_BIT_STRING_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the BitStringEqualityMatchingRule.
  */
-public class BitStringEqualityMatchingRuleTest extends MatchingRuleTest
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "\'a\'B" }, { "0" }, { "010101" }, { "\'10101" },
-        { "\'1010\'A" }, };
-  }
+public class BitStringEqualityMatchingRuleTest extends MatchingRuleTest {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "\'a\'B" }, { "0" }, { "010101" }, { "\'10101" },
+            { "\'1010\'A" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] { { "\'0\'B", "\'0\'B", ConditionResult.TRUE },
+            { "\'1\'B", "\'1\'B", ConditionResult.TRUE },
+            { "\'0\'B", "\'1\'B", ConditionResult.FALSE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] { { "\'0\'B", "\'0\'B", ConditionResult.TRUE },
-        { "\'1\'B", "\'1\'B", ConditionResult.TRUE },
-        { "\'0\'B", "\'1\'B", ConditionResult.FALSE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_BIT_STRING_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_BIT_STRING_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java
index 43b500f..3f20d4f 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,41 +25,29 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BIT_STRING_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Bit string syntax tests.
  */
-public class BitStringSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "'0101'B", true }, { "'1'B", true },
-        { "'0'B", true }, { "invalid", false }, { "1", false },
-        { "'010100000111111010101000'B", true }, };
-  }
+public class BitStringSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "'0101'B", true }, { "'1'B", true }, { "'0'B", true },
+            { "invalid", false }, { "1", false }, { "'010100000111111010101000'B", true }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_BIT_STRING_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_BIT_STRING_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
index bb478a1..fe5200d 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,62 +25,44 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_BOOLEAN_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the BooleanEqualityMatchingRule.
  */
-public class BooleanEqualityMatchingRuleTest extends MatchingRuleTest
-{
+public class BooleanEqualityMatchingRuleTest extends MatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "garbage" }, };
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "garbage" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] { { "TRUE", "true", ConditionResult.TRUE },
+            { "YES", "true", ConditionResult.TRUE }, { "ON", "true", ConditionResult.TRUE },
+            { "1", "true", ConditionResult.TRUE }, { "FALSE", "false", ConditionResult.TRUE },
+            { "NO", "false", ConditionResult.TRUE }, { "OFF", "false", ConditionResult.TRUE },
+            { "0", "false", ConditionResult.TRUE }, { "TRUE", "false", ConditionResult.FALSE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] { { "TRUE", "true", ConditionResult.TRUE },
-        { "YES", "true", ConditionResult.TRUE },
-        { "ON", "true", ConditionResult.TRUE },
-        { "1", "true", ConditionResult.TRUE },
-        { "FALSE", "false", ConditionResult.TRUE },
-        { "NO", "false", ConditionResult.TRUE },
-        { "OFF", "false", ConditionResult.TRUE },
-        { "0", "false", ConditionResult.TRUE },
-        { "TRUE", "false", ConditionResult.FALSE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_BOOLEAN_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_BOOLEAN_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
index d1e5619..5bb9b32 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,60 +25,46 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_EXACT_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactEqualityMatchingRule.
  */
-public class CaseExactEqualityMatchingRuleTest extends MatchingRuleTest
-{
+public class CaseExactEqualityMatchingRuleTest extends MatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] {};
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+            { "12345678\u2163", "12345678\u2163", ConditionResult.TRUE },
+            { "ABC45678", "ABC45678", ConditionResult.TRUE },
+            { "  ABC45678  ", "ABC45678", ConditionResult.TRUE },
+            { "ABC   45678", "ABC 45678", ConditionResult.TRUE },
+            { "   ", " ", ConditionResult.TRUE }, { "", "", ConditionResult.TRUE },
+            { "ABC45678", "abc45678", ConditionResult.FALSE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
-        { "12345678\u2163", "12345678\u2163", ConditionResult.TRUE },
-        { "ABC45678", "ABC45678", ConditionResult.TRUE },
-        { "  ABC45678  ", "ABC45678", ConditionResult.TRUE },
-        { "ABC   45678", "ABC 45678", ConditionResult.TRUE },
-        { "   ", " ", ConditionResult.TRUE }, { "", "", ConditionResult.TRUE },
-        { "ABC45678", "abc45678", ConditionResult.FALSE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
index 4c9afec..08d6c11 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,62 +25,48 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_EXACT_IA5_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactIA5EqualityMatchingRule.
  */
-public class CaseExactIA5EqualityMatchingRuleTest extends MatchingRuleTest
-{
+public class CaseExactIA5EqualityMatchingRuleTest extends MatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "12345678\uFFFD" }, };
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "12345678\uFFFD" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+            { "ABC45678", "ABC45678", ConditionResult.TRUE },
+            { "ABC45678", "abc45678", ConditionResult.FALSE },
+            { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
+            { "test\u00AD\u200D", "test", ConditionResult.TRUE },
+            { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
+            { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
 
+        };
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
-        { "ABC45678", "ABC45678", ConditionResult.TRUE },
-        { "ABC45678", "abc45678", ConditionResult.FALSE },
-        { "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
-        { "test\u00AD\u200D", "test", ConditionResult.TRUE },
-        { "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
-        { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
-
-    };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_IA5_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_IA5_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java
index 0d7be9c..fb63054 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,126 +25,95 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_EXACT_IA5_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactIA5SubstringMatchingRule.
  */
-public class CaseExactIA5SubstringMatchingRuleTest extends
-    SubstringMatchingRuleTest
-{
+public class CaseExactIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest {
 
-  @Override
-  @DataProvider(name = "substringInvalidAssertionValues")
-  public Object[][] createMatchingRuleInvalidAssertionValues()
-  {
-    return new Object[][] { { "12345678\uFFFD", new String[0], null },
-        { null, new String[] { "12345678\uFFFD" }, null },
-        { null, new String[0], "12345678\uFFFD" }, };
-  }
+    @Override
+    @DataProvider(name = "substringInvalidAssertionValues")
+    public Object[][] createMatchingRuleInvalidAssertionValues() {
+        return new Object[][] { { "12345678\uFFFD", new String[0], null },
+            { null, new String[] { "12345678\uFFFD" }, null },
+            { null, new String[0], "12345678\uFFFD" }, };
+    }
 
+    @Override
+    @DataProvider(name = "substringInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "12345678\uFFFD" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringFinalMatchData")
+    public Object[][] createSubstringFinalMatchData() {
+        return new Object[][] { { "this is a value", "value", ConditionResult.TRUE },
+            { "this is a value", "alue", ConditionResult.TRUE },
+            { "this is a value", "ue", ConditionResult.TRUE },
+            { "this is a value", "e", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "this", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.FALSE },
+            { "this is a VALUE", "value", ConditionResult.FALSE },
+            { "end with space    ", " ", ConditionResult.FALSE },
+            { "end with space    ", "space", ConditionResult.TRUE }, };
+    }
 
-  @Override
-  @DataProvider(name = "substringInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "12345678\uFFFD" }, };
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringInitialMatchData")
+    public Object[][] createSubstringInitialMatchData() {
+        return new Object[][] { { "this is a value", "this", ConditionResult.TRUE },
+            { "this is a value", "th", ConditionResult.TRUE },
+            { "this is a value", "t", ConditionResult.TRUE },
+            { "this is a value", "is", ConditionResult.FALSE },
+            { "this is a value", "a", ConditionResult.FALSE },
+            { "this is a value", "value", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "NOT", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.FALSE }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringMiddleMatchData")
+    public Object[][] createSubstringMiddleMatchData() {
+        return new Object[][] {
+            { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { " " }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "this", "is", "a", "value" }, ConditionResult.TRUE },
+            // The matching rule requires ordered non overlapping substrings
+            // Issue #730 was not valid.
+            { "this is a value", new String[] { "value", "this" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "this is" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "his is", "a val", }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "THIS", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "not" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringFinalMatchData")
-  public Object[][] createSubstringFinalMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "value", ConditionResult.TRUE },
-        { "this is a value", "alue", ConditionResult.TRUE },
-        { "this is a value", "ue", ConditionResult.TRUE },
-        { "this is a value", "e", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "this", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.FALSE },
-        { "this is a VALUE", "value", ConditionResult.FALSE },
-        { "end with space    ", " ", ConditionResult.FALSE },
-        { "end with space    ", "space", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringInitialMatchData")
-  public Object[][] createSubstringInitialMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "this", ConditionResult.TRUE },
-        { "this is a value", "th", ConditionResult.TRUE },
-        { "this is a value", "t", ConditionResult.TRUE },
-        { "this is a value", "is", ConditionResult.FALSE },
-        { "this is a value", "a", ConditionResult.FALSE },
-        { "this is a value", "value", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "NOT", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.FALSE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringMiddleMatchData")
-  public Object[][] createSubstringMiddleMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "this", "is", "a", "value" },
-            ConditionResult.TRUE },
-        // The matching rule requires ordered non overlapping substrings
-        // Issue #730 was not valid.
-        { "this is a value", new String[] { "value", "this" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "this is" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "his is", "a val", },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "THIS", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "not" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_IA5_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_IA5_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
index 45bcc0c..ad2f43b 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,53 +25,39 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_EXACT_OID;
 
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactOrderingMatchingRule.
  */
-public class CaseExactOrderingMatchingRuleTest extends OrderingMatchingRuleTest
-{
+public class CaseExactOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "OrderingMatchingRuleInvalidValues")
-  public Object[][] createOrderingMatchingRuleInvalidValues()
-  {
-    return new Object[][] {};
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+    public Object[][] createOrderingMatchingRuleInvalidValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "Orderingmatchingrules")
+    public Object[][] createOrderingMatchingRuleTestData() {
+        return new Object[][] { { "12345678", "02345678", 1 }, { "abcdef", "bcdefa", -1 },
+            { "abcdef", "abcdef", 0 }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "Orderingmatchingrules")
-  public Object[][] createOrderingMatchingRuleTestData()
-  {
-    return new Object[][] { { "12345678", "02345678", 1 },
-        { "abcdef", "bcdefa", -1 }, { "abcdef", "abcdef", 0 }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(OMR_CASE_EXACT_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(OMR_CASE_EXACT_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java
index 5b67f3c..76f9658 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,126 +25,95 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_EXACT_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactSubstringMatchingRule class.
  */
-public class CaseExactSubstringMatchingRuleTest extends
-    SubstringMatchingRuleTest
-{
+public class CaseExactSubstringMatchingRuleTest extends SubstringMatchingRuleTest {
 
-  @Override
-  @DataProvider(name = "substringInvalidAssertionValues")
-  public Object[][] createMatchingRuleInvalidAssertionValues()
-  {
-    return new Object[][] {};
-  }
+    @Override
+    @DataProvider(name = "substringInvalidAssertionValues")
+    public Object[][] createMatchingRuleInvalidAssertionValues() {
+        return new Object[][] {};
+    }
 
+    @Override
+    @DataProvider(name = "substringInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringFinalMatchData")
+    public Object[][] createSubstringFinalMatchData() {
+        return new Object[][] { { "this is a value", "value", ConditionResult.TRUE },
+            { "this is a value", "alue", ConditionResult.TRUE },
+            { "this is a value", "ue", ConditionResult.TRUE },
+            { "this is a value", "e", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "this", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.FALSE },
+            { "this is a VALUE", "value", ConditionResult.FALSE },
+            { "end with space    ", " ", ConditionResult.FALSE },
+            { "end with space    ", "space", ConditionResult.TRUE }, };
+    }
 
-  @Override
-  @DataProvider(name = "substringInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] {};
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringInitialMatchData")
+    public Object[][] createSubstringInitialMatchData() {
+        return new Object[][] { { "this is a value", "this", ConditionResult.TRUE },
+            { "this is a value", "th", ConditionResult.TRUE },
+            { "this is a value", "t", ConditionResult.TRUE },
+            { "this is a value", "is", ConditionResult.FALSE },
+            { "this is a value", "a", ConditionResult.FALSE },
+            { "this is a value", "value", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "NOT", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.FALSE }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringMiddleMatchData")
+    public Object[][] createSubstringMiddleMatchData() {
+        return new Object[][] {
+            { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { " " }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "this", "is", "a", "value" }, ConditionResult.TRUE },
+            // The matching rule requires ordered non overlapping
+            // substrings.
+            // Issue #730 was not valid.
+            { "this is a value", new String[] { "value", "this" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "this is" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "his is", "a val", }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "THIS", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "not" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringFinalMatchData")
-  public Object[][] createSubstringFinalMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "value", ConditionResult.TRUE },
-        { "this is a value", "alue", ConditionResult.TRUE },
-        { "this is a value", "ue", ConditionResult.TRUE },
-        { "this is a value", "e", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "this", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.FALSE },
-        { "this is a VALUE", "value", ConditionResult.FALSE },
-        { "end with space    ", " ", ConditionResult.FALSE },
-        { "end with space    ", "space", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringInitialMatchData")
-  public Object[][] createSubstringInitialMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "this", ConditionResult.TRUE },
-        { "this is a value", "th", ConditionResult.TRUE },
-        { "this is a value", "t", ConditionResult.TRUE },
-        { "this is a value", "is", ConditionResult.FALSE },
-        { "this is a value", "a", ConditionResult.FALSE },
-        { "this is a value", "value", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "NOT", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.FALSE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringMiddleMatchData")
-  public Object[][] createSubstringMiddleMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "this", "is", "a", "value" },
-            ConditionResult.TRUE },
-        // The matching rule requires ordered non overlapping
-        // substrings.
-        // Issue #730 was not valid.
-        { "this is a value", new String[] { "value", "this" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "this is" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "his is", "a val", },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "THIS", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "not" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
index ea25878..2246d72 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,67 +25,53 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseIgnoreEqualityMatchingRule.
  */
-public class CaseIgnoreEqualityMatchingRuleTest extends MatchingRuleTest
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] {};
-  }
+public class CaseIgnoreEqualityMatchingRuleTest extends MatchingRuleTest {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] {
+            { " string ", "string", ConditionResult.TRUE },
+            { "string ", "string", ConditionResult.TRUE },
+            { " string", "string", ConditionResult.TRUE },
+            { "    ", " ", ConditionResult.TRUE },
+            { "Z", "z", ConditionResult.TRUE },
+            { "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", "abcdefghijklmnopqrstuvwxyz1234567890",
+                ConditionResult.TRUE },
+            { "foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
+            { "test\u00AD\u200D", "test", ConditionResult.TRUE },
+            { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
+            // Case-folding data below.
+            { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE },
+            { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE },
 
+        };
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] {
-        { " string ", "string", ConditionResult.TRUE },
-        { "string ", "string", ConditionResult.TRUE },
-        { " string", "string", ConditionResult.TRUE },
-        { "    ", " ", ConditionResult.TRUE },
-        { "Z", "z", ConditionResult.TRUE },
-        { "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
-            "abcdefghijklmnopqrstuvwxyz1234567890", ConditionResult.TRUE },
-        { "foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
-        { "test\u00AD\u200D", "test", ConditionResult.TRUE },
-        { "foo\u070Fbar", "foobar", ConditionResult.TRUE },
-        // Case-folding data below.
-        { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE },
-        { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE },
-
-    };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
index 35388d4..d4c593c 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,56 +25,42 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_IA5_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseExactIA5EqualityMatchingRule.
  */
-public class CaseIgnoreIA5EqualityMatchingRuleTest extends MatchingRuleTest
-{
+public class CaseIgnoreIA5EqualityMatchingRuleTest extends MatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "12345678\uFFFD" }, };
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "12345678\uFFFD" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+            { "ABC45678", "ABC45678", ConditionResult.TRUE },
+            { "ABC45678", "abc45678", ConditionResult.TRUE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
-        { "ABC45678", "ABC45678", ConditionResult.TRUE },
-        { "ABC45678", "abc45678", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_IA5_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_IA5_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java
index fb3f618..6399797 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,140 +25,108 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_IA5_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseIgnoreIA5SubstringMatchingRule.
  */
-public class CaseIgnoreIA5SubstringMatchingRuleTest extends
-    SubstringMatchingRuleTest
-{
+public class CaseIgnoreIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest {
 
-  @DataProvider(name = "substringInvalidAssertionValues")
-  public Object[][] createMatchingRuleInvalidAssertionValues()
-  {
-    return new Object[][] { { "12345678\uFFFD", new String[0], null },
-        { null, new String[] { "12345678\uFFFD" }, null },
-        { null, new String[0], "12345678\uFFFD" }, };
-  }
+    @DataProvider(name = "substringInvalidAssertionValues")
+    public Object[][] createMatchingRuleInvalidAssertionValues() {
+        return new Object[][] { { "12345678\uFFFD", new String[0], null },
+            { null, new String[] { "12345678\uFFFD" }, null },
+            { null, new String[0], "12345678\uFFFD" }, };
+    }
 
+    @DataProvider(name = "substringInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "12345678\uFFFD" }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringFinalMatchData")
+    public Object[][] createSubstringFinalMatchData() {
+        return new Object[][] { { "this is a value", "value", ConditionResult.TRUE },
+            { "this is a value", "alue", ConditionResult.TRUE },
+            { "this is a value", "ue", ConditionResult.TRUE },
+            { "this is a value", "e", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "this", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.TRUE },
+            { "this is a value", "AlUe", ConditionResult.TRUE },
+            { "this is a value", "UE", ConditionResult.TRUE },
+            { "this is a value", "E", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a VALUE", "value", ConditionResult.TRUE },
+            { "end with space    ", " ", ConditionResult.FALSE },
+            { "end with space    ", "space", ConditionResult.TRUE },
+            { "end with space    ", "SPACE", ConditionResult.TRUE }, };
+    }
 
-  @DataProvider(name = "substringInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "12345678\uFFFD" }, };
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringInitialMatchData")
+    public Object[][] createSubstringInitialMatchData() {
+        return new Object[][] { { "this is a value", "this", ConditionResult.TRUE },
+            { "this is a value", "th", ConditionResult.TRUE },
+            { "this is a value", "t", ConditionResult.TRUE },
+            { "this is a value", "is", ConditionResult.FALSE },
+            { "this is a value", "a", ConditionResult.FALSE },
+            { "this is a value", "TH", ConditionResult.TRUE },
+            { "this is a value", "T", ConditionResult.TRUE },
+            { "this is a value", "IS", ConditionResult.FALSE },
+            { "this is a value", "A", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "NOT", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.TRUE }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringMiddleMatchData")
+    public Object[][] createSubstringMiddleMatchData() {
+        return new Object[][] {
+            { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "THIS" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "IS" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "A" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "VALUE" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { " " }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "this", "is", "a", "value" }, ConditionResult.TRUE },
+            // The matching rule requires ordered non overlapping
+            // substrings.
+            // Issue #730 was not valid.
+            { "this is a value", new String[] { "value", "this" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "this is" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "IS", "a", "VALue" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "his IS", "A val", }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "not" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringFinalMatchData")
-  public Object[][] createSubstringFinalMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "value", ConditionResult.TRUE },
-        { "this is a value", "alue", ConditionResult.TRUE },
-        { "this is a value", "ue", ConditionResult.TRUE },
-        { "this is a value", "e", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "this", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.TRUE },
-        { "this is a value", "AlUe", ConditionResult.TRUE },
-        { "this is a value", "UE", ConditionResult.TRUE },
-        { "this is a value", "E", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a VALUE", "value", ConditionResult.TRUE },
-        { "end with space    ", " ", ConditionResult.FALSE },
-        { "end with space    ", "space", ConditionResult.TRUE },
-        { "end with space    ", "SPACE", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringInitialMatchData")
-  public Object[][] createSubstringInitialMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "this", ConditionResult.TRUE },
-        { "this is a value", "th", ConditionResult.TRUE },
-        { "this is a value", "t", ConditionResult.TRUE },
-        { "this is a value", "is", ConditionResult.FALSE },
-        { "this is a value", "a", ConditionResult.FALSE },
-        { "this is a value", "TH", ConditionResult.TRUE },
-        { "this is a value", "T", ConditionResult.TRUE },
-        { "this is a value", "IS", ConditionResult.FALSE },
-        { "this is a value", "A", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "NOT", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringMiddleMatchData")
-  public Object[][] createSubstringMiddleMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "THIS" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "IS" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "A" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "VALUE" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "this", "is", "a", "value" },
-            ConditionResult.TRUE },
-        // The matching rule requires ordered non overlapping
-        // substrings.
-        // Issue #730 was not valid.
-        { "this is a value", new String[] { "value", "this" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "this is" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "IS", "a", "VALue" },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "his IS", "A val", },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "not" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_IA5_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_IA5_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
index 3eda3df..2477520 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,65 +25,46 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_IGNORE_OID;
 
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseIgnoreOrderingMatchingRule.
  */
-public class CaseIgnoreOrderingMatchingRuleTest extends
-    OrderingMatchingRuleTest
-{
+public class CaseIgnoreOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "OrderingMatchingRuleInvalidValues")
-  public Object[][] createOrderingMatchingRuleInvalidValues()
-  {
-    return new Object[][] {};
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+    public Object[][] createOrderingMatchingRuleInvalidValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "Orderingmatchingrules")
+    public Object[][] createOrderingMatchingRuleTestData() {
+        return new Object[][] { { "12345678", "02345678", 1 }, { "abcdef", "bcdefa", -1 },
+            { "abcdef", "abcdef", 0 }, { "abcdef", "ABCDEF", 0 }, { "abcdef", "aCcdef", -1 },
+            { "aCcdef", "abcdef", 1 }, { "foo\u0020bar\u0020\u0020", "foo bar", 0 },
+            { "test\u00AD\u200D", "test", 0 }, { "foo\u070Fbar", "foobar", 0 },
+            // Case-folding data below.
+            { "foo\u0149bar", "foo\u02BC\u006Ebar", 0 }, { "foo\u017Bbar", "foo\u017Cbar", 0 },
+            { "foo\u017Bbar", "goo\u017Cbar", -1 },
+            // issue# 3583
+            { "a", "\u00f8", -1 }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "Orderingmatchingrules")
-  public Object[][] createOrderingMatchingRuleTestData()
-  {
-    return new Object[][] { { "12345678", "02345678", 1 },
-        { "abcdef", "bcdefa", -1 }, { "abcdef", "abcdef", 0 },
-        { "abcdef", "ABCDEF", 0 }, { "abcdef", "aCcdef", -1 },
-        { "aCcdef", "abcdef", 1 },
-        { "foo\u0020bar\u0020\u0020", "foo bar", 0 },
-        { "test\u00AD\u200D", "test", 0 },
-        { "foo\u070Fbar", "foobar", 0 },
-        // Case-folding data below.
-        { "foo\u0149bar", "foo\u02BC\u006Ebar", 0 },
-        { "foo\u017Bbar", "foo\u017Cbar", 0 },
-        { "foo\u017Bbar", "goo\u017Cbar", -1 },
-        // issue# 3583
-        { "a", "\u00f8", -1 }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(OMR_CASE_IGNORE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(OMR_CASE_IGNORE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java
index e99f4bc..8d24d25 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,138 +25,106 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID;
 
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Test the CaseIgnoreSubstringMatchingRule.
  */
-public class CaseIgnoreSubstringMatchingRuleTest extends
-    SubstringMatchingRuleTest
-{
+public class CaseIgnoreSubstringMatchingRuleTest extends SubstringMatchingRuleTest {
 
-  @DataProvider(name = "substringInvalidAssertionValues")
-  public Object[][] createMatchingRuleInvalidAssertionValues()
-  {
-    return new Object[][] {};
-  }
+    @DataProvider(name = "substringInvalidAssertionValues")
+    public Object[][] createMatchingRuleInvalidAssertionValues() {
+        return new Object[][] {};
+    }
 
+    @DataProvider(name = "substringInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] {};
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringFinalMatchData")
+    public Object[][] createSubstringFinalMatchData() {
+        return new Object[][] { { "this is a value", "value", ConditionResult.TRUE },
+            { "this is a value", "alue", ConditionResult.TRUE },
+            { "this is a value", "ue", ConditionResult.TRUE },
+            { "this is a value", "e", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "this", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.TRUE },
+            { "this is a value", "AlUe", ConditionResult.TRUE },
+            { "this is a value", "UE", ConditionResult.TRUE },
+            { "this is a value", "E", ConditionResult.TRUE },
+            { "this is a value", "valu", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a VALUE", "value", ConditionResult.TRUE },
+            { "end with space    ", " ", ConditionResult.FALSE },
+            { "end with space    ", "space", ConditionResult.TRUE },
+            { "end with space    ", "SPACE", ConditionResult.TRUE }, };
+    }
 
-  @DataProvider(name = "substringInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] {};
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringInitialMatchData")
+    public Object[][] createSubstringInitialMatchData() {
+        return new Object[][] { { "this is a value", "this", ConditionResult.TRUE },
+            { "this is a value", "th", ConditionResult.TRUE },
+            { "this is a value", "t", ConditionResult.TRUE },
+            { "this is a value", "is", ConditionResult.FALSE },
+            { "this is a value", "a", ConditionResult.FALSE },
+            { "this is a value", "TH", ConditionResult.TRUE },
+            { "this is a value", "T", ConditionResult.TRUE },
+            { "this is a value", "IS", ConditionResult.FALSE },
+            { "this is a value", "A", ConditionResult.FALSE },
+            { "this is a value", "VALUE", ConditionResult.FALSE },
+            { "this is a value", " ", ConditionResult.FALSE },
+            { "this is a value", "NOT", ConditionResult.FALSE },
+            { "this is a value", "THIS", ConditionResult.TRUE }, };
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "substringMiddleMatchData")
+    public Object[][] createSubstringMiddleMatchData() {
+        return new Object[][] {
+            { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "THIS" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "IS" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "A" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "VALUE" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { " " }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "this", "is", "a", "value" }, ConditionResult.TRUE },
+            // The matching rule requires ordered non overlapping
+            // substrings.
+            // Issue #730 was not valid.
+            { "this is a value", new String[] { "value", "this" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "this is" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "IS", "a", "VALue" }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "his IS", "A val", }, ConditionResult.TRUE },
+            { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "this", "not" }, ConditionResult.FALSE },
+            { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringFinalMatchData")
-  public Object[][] createSubstringFinalMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "value", ConditionResult.TRUE },
-        { "this is a value", "alue", ConditionResult.TRUE },
-        { "this is a value", "ue", ConditionResult.TRUE },
-        { "this is a value", "e", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "this", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.TRUE },
-        { "this is a value", "AlUe", ConditionResult.TRUE },
-        { "this is a value", "UE", ConditionResult.TRUE },
-        { "this is a value", "E", ConditionResult.TRUE },
-        { "this is a value", "valu", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a VALUE", "value", ConditionResult.TRUE },
-        { "end with space    ", " ", ConditionResult.FALSE },
-        { "end with space    ", "space", ConditionResult.TRUE },
-        { "end with space    ", "SPACE", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringInitialMatchData")
-  public Object[][] createSubstringInitialMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", "this", ConditionResult.TRUE },
-        { "this is a value", "th", ConditionResult.TRUE },
-        { "this is a value", "t", ConditionResult.TRUE },
-        { "this is a value", "is", ConditionResult.FALSE },
-        { "this is a value", "a", ConditionResult.FALSE },
-        { "this is a value", "TH", ConditionResult.TRUE },
-        { "this is a value", "T", ConditionResult.TRUE },
-        { "this is a value", "IS", ConditionResult.FALSE },
-        { "this is a value", "A", ConditionResult.FALSE },
-        { "this is a value", "VALUE", ConditionResult.FALSE },
-        { "this is a value", " ", ConditionResult.FALSE },
-        { "this is a value", "NOT", ConditionResult.FALSE },
-        { "this is a value", "THIS", ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "substringMiddleMatchData")
-  public Object[][] createSubstringMiddleMatchData()
-  {
-    return new Object[][] {
-        { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "THIS" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "IS" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "A" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "VALUE" }, ConditionResult.TRUE },
-        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
-        { "this is a value", new String[] { "this", "is", "a", "value" },
-            ConditionResult.TRUE },
-        // The matching rule requires ordered non overlapping
-        // substrings.
-        // Issue #730 was not valid.
-        { "this is a value", new String[] { "value", "this" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "this is" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "IS", "a", "VALue" },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "his IS", "A val", },
-            ConditionResult.TRUE },
-        { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
-        { "this is a value", new String[] { "this", "not" },
-            ConditionResult.FALSE },
-        { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java
index 188d9f0..2c84356 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,24 +25,17 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Core schema tests
  */
 @SuppressWarnings("javadoc")
-public class CoreSchemaTest extends SchemaTestCase
-{
-  @Test
-  public final void testCoreSchemaWarnings()
-  {
-    // Make sure core schema doesn't have any warnings.
-    Assert.assertTrue(Schema.getCoreSchema().getWarnings().isEmpty());
-  }
+public class CoreSchemaTest extends SchemaTestCase {
+    @Test
+    public final void testCoreSchemaWarnings() {
+        // Make sure core schema doesn't have any warnings.
+        Assert.assertTrue(Schema.getCoreSchema().getWarnings().isEmpty());
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java
index 1b0d69a..bd5b9b6 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,69 +25,55 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_CONTENT_RULE_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * DIT content rule syntax tests.
  */
-public class DITContentRuleSyntaxTest extends SyntaxTestCase
-{
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        {
-            "( 2.5.6.4 DESC 'content rule for organization' NOT "
-                + "( x121Address $ telexNumber ) )", true },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'rule with all possible fields' "
-                + " OBSOLETE" + " AUX ( posixAccount )" + " MUST ( cn $ sn )"
-                + " MAY ( dc )" + " NOT ( x121Address $ telexNumber ) )", true },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'ommit parenthesis' "
-                + " OBSOLETE" + " AUX posixAccount " + " MUST cn " + " MAY dc "
-                + " NOT x121Address )", true },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'use numeric OIDs' " + " OBSOLETE"
-                + " AUX 1.3.6.1.1.1.2.0" + " MUST cn " + " MAY dc "
-                + " NOT x121Address )", true },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'illegal OIDs' " + " OBSOLETE"
-                + " AUX 2.5.6.." + " MUST cn " + " MAY dc "
-                + " NOT x121Address )", false },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'illegal OIDs' " + " OBSOLETE"
-                + " AUX 2.5.6.x" + " MUST cn " + " MAY dc "
-                + " NOT x121Address )", false },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'missing closing parenthesis' "
-                + " OBSOLETE" + " AUX posixAccount" + " MUST cn " + " MAY dc "
-                + " NOT x121Address", false },
-        {
-            "( 2.5.6.4 NAME 'fullRule' DESC 'extra parameterss' "
-                + " MUST cn " + " X-name ( 'this is an extra parameter' ) )",
-            true },
+public class DITContentRuleSyntaxTest extends SyntaxTestCase {
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            {
+                "( 2.5.6.4 DESC 'content rule for organization' NOT "
+                        + "( x121Address $ telexNumber ) )", true },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'rule with all possible fields' " + " OBSOLETE"
+                        + " AUX ( posixAccount )" + " MUST ( cn $ sn )" + " MAY ( dc )"
+                        + " NOT ( x121Address $ telexNumber ) )", true },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'ommit parenthesis' " + " OBSOLETE"
+                        + " AUX posixAccount " + " MUST cn " + " MAY dc " + " NOT x121Address )",
+                true },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'use numeric OIDs' " + " OBSOLETE"
+                        + " AUX 1.3.6.1.1.1.2.0" + " MUST cn " + " MAY dc " + " NOT x121Address )",
+                true },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'illegal OIDs' " + " OBSOLETE" + " AUX 2.5.6.."
+                        + " MUST cn " + " MAY dc " + " NOT x121Address )", false },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'illegal OIDs' " + " OBSOLETE" + " AUX 2.5.6.x"
+                        + " MUST cn " + " MAY dc " + " NOT x121Address )", false },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'missing closing parenthesis' " + " OBSOLETE"
+                        + " AUX posixAccount" + " MUST cn " + " MAY dc " + " NOT x121Address",
+                false },
+            {
+                "( 2.5.6.4 NAME 'fullRule' DESC 'extra parameterss' " + " MUST cn "
+                        + " X-name ( 'this is an extra parameter' ) )", true },
 
-    };
-  }
+        };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_DIT_CONTENT_RULE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_DIT_CONTENT_RULE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java
index c6569b0..9ecf7c1 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -35,8 +34,6 @@
 
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Schema;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -44,174 +41,158 @@
  * Test the DistinguishedNameEqualityMatchingRule
  */
 @SuppressWarnings("javadoc")
-public class DistinguishedNameEqualityMatchingRuleTest extends MatchingRuleTest
-{
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public Object[][] createMatchingRuleInvalidAttributeValues()
-  {
-    return new Object[][] { { "manager" }, { "manager " }, { "=Jim" },
-        { " =Jim" }, { "= Jim" },
-        { " = Jim" },
-        { "cn+Jim" },
-        { "cn + Jim" },
-        { "cn=Jim+" },
-        { "cn=Jim+manager" },
-        { "cn=Jim+manager " },
-        { "cn=Jim+manager," },// { "cn=Jim," }, { "cn=Jim,  " }, { "c[n]=Jim" },
-        { "_cn=Jim" }, { "c_n=Jim" }, { "cn\"=Jim" }, { "c\"n=Jim" },
-        { "1cn=Jim" }, { "cn+uid=Jim" }, { "-cn=Jim" }, { "/tmp=a" },
-        { "\\tmp=a" }, { "cn;lang-en=Jim" }, { "@cn=Jim" },
-        { "_name_=Jim" },
-        { "\u03c0=pi" },
-        { "v1.0=buggy" },// { "1.=buggy" }, { ".1=buggy" },
-        { "oid.1." }, { "1.3.6.1.4.1.1466..0=#04024869" }, { "cn=#a" },
-        { "cn=#ag" }, { "cn=#ga" }, { "cn=#abcdefgh" },
-        { "cn=a\\b" }, // { "cn=a\\bg" }, { "cn=\"hello" },
-        { "cn=+mail=,dc=example,dc=com" }, { "cn=xyz+sn=,dc=example,dc=com" },
-        { "cn=,dc=example,dc=com" } };
-  }
+public class DistinguishedNameEqualityMatchingRuleTest extends MatchingRuleTest {
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public Object[][] createMatchingRuleInvalidAttributeValues() {
+        return new Object[][] { { "manager" }, { "manager " },
+            { "=Jim" },
+            { " =Jim" },
+            { "= Jim" },
+            { " = Jim" },
+            { "cn+Jim" },
+            { "cn + Jim" },
+            { "cn=Jim+" },
+            { "cn=Jim+manager" },
+            { "cn=Jim+manager " },
+            { "cn=Jim+manager," }, // { "cn=Jim," }, { "cn=Jim,  " }, {
+                                   // "c[n]=Jim" },
+            { "_cn=Jim" }, { "c_n=Jim" }, { "cn\"=Jim" }, { "c\"n=Jim" }, { "1cn=Jim" },
+            { "cn+uid=Jim" }, { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" },
+            { "@cn=Jim" }, { "_name_=Jim" },
+            { "\u03c0=pi" },
+            { "v1.0=buggy" }, // { "1.=buggy" }, { ".1=buggy" },
+            { "oid.1." }, { "1.3.6.1.4.1.1466..0=#04024869" }, { "cn=#a" }, { "cn=#ag" },
+            { "cn=#ga" }, { "cn=#abcdefgh" },
+            { "cn=a\\b" }, // { "cn=a\\bg" }, { "cn=\"hello" },
+            { "cn=+mail=,dc=example,dc=com" }, { "cn=xyz+sn=,dc=example,dc=com" },
+            { "cn=,dc=example,dc=com" } };
+    }
 
-  @DataProvider(name = "matchingrules")
-  public Object[][] createMatchingRuleTest()
-  {
-    return new Object[][] {
-        { "", "", ConditionResult.TRUE },
-        { "   ", "", ConditionResult.TRUE },
-        { "cn=", "cn=", ConditionResult.TRUE },
-        { "cn= ", "cn=", ConditionResult.TRUE },
-        { "cn =", "cn=", ConditionResult.TRUE },
-        { "cn = ", "cn=", ConditionResult.TRUE },
-        { "dc=com", "dc=com", ConditionResult.TRUE },
-        { "dc=com+o=com", "dc=com+o=com", ConditionResult.TRUE },
-        { "DC=COM", "dc=com", ConditionResult.TRUE },
-        { "dc = com", "dc=com", ConditionResult.TRUE },
-        { " dc = com ", "dc=com", ConditionResult.TRUE },
-        { "dc=example,dc=com", "dc=example,dc=com", ConditionResult.TRUE },
-        { "dc=example, dc=com", "dc=example,dc=com", ConditionResult.TRUE },
-        { "dc=example ,dc=com", "dc=example,dc=com", ConditionResult.TRUE },
-        { "dc =example , dc  =   com", "dc=example,dc=com",
-          ConditionResult.TRUE },
-        { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
-            "cn=doe+givenname=john,ou=people,dc=example,dc=com",
-            ConditionResult.TRUE },
-        { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
-            "givenname=john\\+cn\\=doe,ou=people,dc=example,dc=com",
-            ConditionResult.TRUE },
-        { "cn=Doe\\, John,ou=People,dc=example,dc=com",
-            "cn=doe\\, john,ou=people,dc=example,dc=com", ConditionResult.TRUE },
-        { "UID=jsmith,DC=example,DC=net", "uid=jsmith,dc=example,dc=net",
-          ConditionResult.TRUE },
-        { "OU=Sales+CN=J. Smith,DC=example,DC=net",
-            "cn=j. smith+ou=sales,dc=example,dc=net", ConditionResult.TRUE },
-        { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
-            "cn=james \\\"jim\\\" smith\\, iii,dc=example,dc=net",
-            ConditionResult.TRUE },
-        { "CN=John Smith\\2C III,DC=example,DC=net",
-            "cn=john smith\\, iii,dc=example,dc=net", ConditionResult.TRUE },
-        { "CN=\\23John Smith\\20,DC=example,DC=net",
-            "cn=\\#john smith,dc=example,dc=net", ConditionResult.TRUE },
-        {
-            "CN=Before\\0dAfter,DC=example,DC=net",
-            // \0d is a hex representation of Carriage return. It is mapped
-            // to a SPACE as defined in the MAP ( RFC 4518)
-            "cn=before after,dc=example,dc=net", ConditionResult.TRUE },
-        { "2.5.4.3=#04024869",
-        // Unicode codepoints from 0000-0008 are mapped to nothing.
-            "cn=hi", ConditionResult.TRUE },
-        { "1.1.1=", "1.1.1=", ConditionResult.TRUE },
-        { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107",
-          ConditionResult.TRUE },
-        { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius",
-            "ou=\u55b6\u696d\u90e8,o=airius", ConditionResult.TRUE },
-        { "photo=\\ john \\ ,dc=com", "photo=\\ john \\ ,dc=com",
-          ConditionResult.TRUE },
-        { "AB-global=", "ab-global=", ConditionResult.TRUE },
-        { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
-            "cn=j. smith+ou=sales,dc=example,dc=net", ConditionResult.TRUE },
-        { "cn=John+a=Doe", "a=Doe+cn=john", ConditionResult.TRUE },
-        { "O=\"Sue, Grabbit and Runn\",C=US", "o=sue\\, grabbit and runn,c=us",
-          ConditionResult.TRUE }, };
-  }
+    @DataProvider(name = "matchingrules")
+    public Object[][] createMatchingRuleTest() {
+        return new Object[][] {
+            { "", "", ConditionResult.TRUE },
+            { "   ", "", ConditionResult.TRUE },
+            { "cn=", "cn=", ConditionResult.TRUE },
+            { "cn= ", "cn=", ConditionResult.TRUE },
+            { "cn =", "cn=", ConditionResult.TRUE },
+            { "cn = ", "cn=", ConditionResult.TRUE },
+            { "dc=com", "dc=com", ConditionResult.TRUE },
+            { "dc=com+o=com", "dc=com+o=com", ConditionResult.TRUE },
+            { "DC=COM", "dc=com", ConditionResult.TRUE },
+            { "dc = com", "dc=com", ConditionResult.TRUE },
+            { " dc = com ", "dc=com", ConditionResult.TRUE },
+            { "dc=example,dc=com", "dc=example,dc=com", ConditionResult.TRUE },
+            { "dc=example, dc=com", "dc=example,dc=com", ConditionResult.TRUE },
+            { "dc=example ,dc=com", "dc=example,dc=com", ConditionResult.TRUE },
+            { "dc =example , dc  =   com", "dc=example,dc=com", ConditionResult.TRUE },
+            { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
+                "cn=doe+givenname=john,ou=people,dc=example,dc=com", ConditionResult.TRUE },
+            { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
+                "givenname=john\\+cn\\=doe,ou=people,dc=example,dc=com", ConditionResult.TRUE },
+            { "cn=Doe\\, John,ou=People,dc=example,dc=com",
+                "cn=doe\\, john,ou=people,dc=example,dc=com", ConditionResult.TRUE },
+            { "UID=jsmith,DC=example,DC=net", "uid=jsmith,dc=example,dc=net", ConditionResult.TRUE },
+            { "OU=Sales+CN=J. Smith,DC=example,DC=net", "cn=j. smith+ou=sales,dc=example,dc=net",
+                ConditionResult.TRUE },
+            { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
+                "cn=james \\\"jim\\\" smith\\, iii,dc=example,dc=net", ConditionResult.TRUE },
+            { "CN=John Smith\\2C III,DC=example,DC=net", "cn=john smith\\, iii,dc=example,dc=net",
+                ConditionResult.TRUE },
+            { "CN=\\23John Smith\\20,DC=example,DC=net", "cn=\\#john smith,dc=example,dc=net",
+                ConditionResult.TRUE },
+            { "CN=Before\\0dAfter,DC=example,DC=net",
+                // \0d is a hex representation of Carriage return. It is mapped
+                // to a SPACE as defined in the MAP ( RFC 4518)
+                "cn=before after,dc=example,dc=net", ConditionResult.TRUE },
+            { "2.5.4.3=#04024869",
+                // Unicode codepoints from 0000-0008 are mapped to nothing.
+                "cn=hi", ConditionResult.TRUE },
+            { "1.1.1=", "1.1.1=", ConditionResult.TRUE },
+            { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", ConditionResult.TRUE },
+            { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius", "ou=\u55b6\u696d\u90e8,o=airius",
+                ConditionResult.TRUE },
+            { "photo=\\ john \\ ,dc=com", "photo=\\ john \\ ,dc=com", ConditionResult.TRUE },
+            { "AB-global=", "ab-global=", ConditionResult.TRUE },
+            { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
+                "cn=j. smith+ou=sales,dc=example,dc=net", ConditionResult.TRUE },
+            { "cn=John+a=Doe", "a=Doe+cn=john", ConditionResult.TRUE },
+            { "O=\"Sue, Grabbit and Runn\",C=US", "o=sue\\, grabbit and runn,c=us",
+                ConditionResult.TRUE }, };
+    }
 
-   /**
-   * DN test data provider.
-   *
-   * @return The array of test DN strings.
-   */
-  @DataProvider(name = "testDNs")
-  public Object[][] createData()
-  {
-    return new Object[][] {
-        { "", ""},
-        { "   ", ""},
-        { "cn=", "cn="},
-        { "cn= ", "cn="},
-        { "cn =", "cn="},
-        { "cn = ", "cn="},
-        { "dc=com", "dc=com"},
-        { "dc=com+o=com", "dc=com\u0001o=com"},
-        { "DC=COM", "dc=com"},
-        { "dc = com", "dc=com"},
-        { " dc = com ", "dc=com"},
-        { "dc=example,dc=com", "dc=com\u0000dc=example"},
-        { "dc=example, dc=com", "dc=com\u0000dc=example"},
-        { "dc=example ,dc=com", "dc=com\u0000dc=example"},
-        { "dc =example , dc  =   com", "dc=com\u0000dc=example"},
-        { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
-            "dc=com\u0000dc=example\u0000ou=people\u0000cn=doe\u0001givenname=john"},
-        { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
-            "dc=com\u0000dc=example\u0000ou=people\u0000givenname=john\\+cn\\=doe"},
-        { "cn=Doe\\, John,ou=People,dc=example,dc=com",
-            "dc=com\u0000dc=example\u0000ou=people\u0000cn=doe\\, john"},
-        { "UID=jsmith,DC=example,DC=net", "dc=net\u0000dc=example\u0000uid=jsmith"},
-        { "OU=Sales+CN=J. Smith,DC=example,DC=net",
-            "dc=net\u0000dc=example\u0000cn=j. smith\u0001ou=sales"},
-        { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
-            "dc=net\u0000dc=example\u0000cn=james \\\"jim\\\" smith\\, iii"},
-        { "CN=John Smith\\2C III,DC=example,DC=net",
-            "dc=net\u0000dc=example\u0000cn=john smith\\, iii"},
-        { "CN=\\23John Smith\\20,DC=example,DC=net",
-            "dc=net\u0000dc=example\u0000cn=\\#john smith"},
-        {
-            "CN=Before\\0dAfter,DC=example,DC=net",
-            // \0d is a hex representation of Carriage return. It is mapped
-            // to a SPACE as defined in the MAP ( RFC 4518)
-            "dc=net\u0000dc=example\u0000cn=before after"},
-        { "2.5.4.3=#04024869",
-        // Unicode codepoints from 0000-0008 are mapped to nothing.
-            "cn=hi"},
-        { "1.1.1=", "1.1.1="},
-        { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107"},
-        { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius",
-            "o=airius\u0000ou=\u55b6\u696d\u90e8"},
-        { "photo=\\ john \\ ,dc=com", "dc=com\u0000photo=john"},
-        { "AB-global=", "ab-global="},
-        { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
-            "dc=net\u0000dc=example\u0000cn=j. smith\u0001ou=sales"},
-        { "cn=John+a=", "a=\u0001cn=john"},
-        { "O=\"Sue, Grabbit and Runn\",C=US",
-          "c=us\u0000o=sue\\, grabbit and runn" }, };
-  }
+    /**
+     * DN test data provider.
+     *
+     * @return The array of test DN strings.
+     */
+    @DataProvider(name = "testDNs")
+    public Object[][] createData() {
+        return new Object[][] {
+            { "", "" },
+            { "   ", "" },
+            { "cn=", "cn=" },
+            { "cn= ", "cn=" },
+            { "cn =", "cn=" },
+            { "cn = ", "cn=" },
+            { "dc=com", "dc=com" },
+            { "dc=com+o=com", "dc=com\u0001o=com" },
+            { "DC=COM", "dc=com" },
+            { "dc = com", "dc=com" },
+            { " dc = com ", "dc=com" },
+            { "dc=example,dc=com", "dc=com\u0000dc=example" },
+            { "dc=example, dc=com", "dc=com\u0000dc=example" },
+            { "dc=example ,dc=com", "dc=com\u0000dc=example" },
+            { "dc =example , dc  =   com", "dc=com\u0000dc=example" },
+            { "givenName=John+cn=Doe,ou=People,dc=example,dc=com",
+                "dc=com\u0000dc=example\u0000ou=people\u0000cn=doe\u0001givenname=john" },
+            { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com",
+                "dc=com\u0000dc=example\u0000ou=people\u0000givenname=john\\+cn\\=doe" },
+            { "cn=Doe\\, John,ou=People,dc=example,dc=com",
+                "dc=com\u0000dc=example\u0000ou=people\u0000cn=doe\\, john" },
+            { "UID=jsmith,DC=example,DC=net", "dc=net\u0000dc=example\u0000uid=jsmith" },
+            { "OU=Sales+CN=J. Smith,DC=example,DC=net",
+                "dc=net\u0000dc=example\u0000cn=j. smith\u0001ou=sales" },
+            { "CN=James \\\"Jim\\\" Smith\\, III,DC=example,DC=net",
+                "dc=net\u0000dc=example\u0000cn=james \\\"jim\\\" smith\\, iii" },
+            { "CN=John Smith\\2C III,DC=example,DC=net",
+                "dc=net\u0000dc=example\u0000cn=john smith\\, iii" },
+            { "CN=\\23John Smith\\20,DC=example,DC=net",
+                "dc=net\u0000dc=example\u0000cn=\\#john smith" },
+            { "CN=Before\\0dAfter,DC=example,DC=net",
+                // \0d is a hex representation of Carriage return. It is mapped
+                // to a SPACE as defined in the MAP ( RFC 4518)
+                "dc=net\u0000dc=example\u0000cn=before after" },
+            { "2.5.4.3=#04024869",
+                // Unicode codepoints from 0000-0008 are mapped to nothing.
+                "cn=hi" },
+            { "1.1.1=", "1.1.1=" },
+            { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107" },
+            { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius",
+                "o=airius\u0000ou=\u55b6\u696d\u90e8" },
+            { "photo=\\ john \\ ,dc=com", "dc=com\u0000photo=john" },
+            { "AB-global=", "ab-global=" },
+            { "OU= Sales + CN = J. Smith ,DC=example,DC=net",
+                "dc=net\u0000dc=example\u0000cn=j. smith\u0001ou=sales" },
+            { "cn=John+a=", "a=\u0001cn=john" },
+            { "O=\"Sue, Grabbit and Runn\",C=US", "c=us\u0000o=sue\\, grabbit and runn" }, };
+    }
 
-  protected MatchingRule getRule()
-  {
-    return Schema.getCoreSchema().getMatchingRule(EMR_DN_OID);
-  }
+    protected MatchingRule getRule() {
+        return Schema.getCoreSchema().getMatchingRule(EMR_DN_OID);
+    }
 
+    /**
+     * Test the normalized values
+     */
+    @Test(dataProvider = "testDNs")
+    public void matchingRules(final String value1, final String value2) throws Exception {
+        final MatchingRule rule = getRule();
 
-  /**
-   * Test the normalized values
-   */
-  @Test(dataProvider = "testDNs")
-  public void matchingRules(final String value1, final String value2)
-      throws Exception
-  {
-    final MatchingRule rule = getRule();
-
-    final ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString
-        .valueOf(value1));
-    final ByteString expectedValue = ByteString.valueOf(Normalizer.normalize(
-        value2, Form.NFKD));
-    assertEquals(normalizedValue1, expectedValue);
-  }
+        final ByteString normalizedValue1 =
+                rule.normalizeAttributeValue(ByteString.valueOf(value1));
+        final ByteString expectedValue =
+                ByteString.valueOf(Normalizer.normalize(value2, Form.NFKD));
+        assertEquals(normalizedValue1, expectedValue);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java
index 1b04bc5..de52d57 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.fest.assertions.Assertions.assertThat;
 import static org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.defaultPolicy;
 import static org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.ignoreAll;
@@ -45,1198 +42,1082 @@
 import org.forgerock.opendj.ldif.LDIFEntryReader;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test schema validation using {@link Schema#validateEntry}.
  */
 @Test
-public class EntrySchemaCheckingTestCase extends SchemaTestCase
-{
+public class EntrySchemaCheckingTestCase extends SchemaTestCase {
 
-  /**
-   * Tests schema checking for an entry covered by a DIT content rule to ensure
-   * that attributes allowed by the DIT content rule are allowed even if not
-   * directly allowed by any of the entry's objectclasses.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testAllowAttributeAllowedByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testallowatallowedbydcroc-oid "
-                + "NAME 'testAllowATAllowedByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testallowatallowedbydcroc-oid "
-                + "NAME 'testAllowATAllowedByDCR' MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
+    /**
+     * Tests schema checking for an entry covered by a DIT content rule to
+     * ensure that attributes allowed by the DIT content rule are allowed even
+     * if not directly allowed by any of the entry's objectclasses.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testAllowAttributeAllowedByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testallowatallowedbydcroc-oid "
+                                + "NAME 'testAllowATAllowedByDCROC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testallowatallowedbydcroc-oid "
+                                        + "NAME 'testAllowATAllowedByDCR' MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
 
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testAllowATAllowedByDCROC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testAllowATAllowedByDCROC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
 
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry covered by a DIT content rule to ensure
-   * that attributes required by the DIT content rule are allowed even if not
-   * directly allowed by any of the entry's objectclasses.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testAllowAttributeRequiredByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testallowatrequiredbydcroc-oid "
-                + "NAME 'testAllowATRequiredByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testallowatrequiredbydcroc-oid "
-                + "NAME 'testAllowATRequiredByDCR' MUST description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testAllowATRequiredByDCROC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that contains structural and auxiliary
-   * objectclasses where the auxiliary class is allowed by a DIT content rule.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testAuxiliaryClassAllowedByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testauxiliaryclassallowedbydcroc-oid "
-                + "NAME 'testAuxiliaryClassAllowedByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addObjectClass(
-            "( testauxiliaryclassallowedbydcrocaux-oid "
-                + "NAME 'testAuxiliaryClassAllowedByDCROCAux' SUP top AUXILIARY "
-                + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
-            false)
-        .addDITContentRule(
-            "( testauxiliaryclassallowedbydcroc-oid "
-                + "NAME 'testAuxiliaryClassAllowedByDCR' "
-                + "AUX testAuxiliaryClassAllowedByDCROCAux "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testAuxiliaryClassAllowedByDCROC",
-        "objectClass: testAuxiliaryClassAllowedByDCROCAux",
-        "cn: test");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that contains structural and auxiliary
-   * objectclasses where the auxiliary class is not allowed by the associated
-   * DIT content rule.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testAuxiliaryClassNotAllowedByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testauxiliaryclassnotallowedbydcroc-oid "
-                + "NAME 'testAuxiliaryClassNotAllowedByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addObjectClass(
-            "( testauxiliaryclassnotallowedbydcrocaux-oid "
-                + "NAME 'testAuxiliaryClassNotAllowedByDCROCAux' SUP top "
-                + "AUXILIARY MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testauxiliaryclassnotallowedbydcroc-oid "
-                + "NAME 'testAuxiliaryClassNotAllowedByDCR' "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testAuxiliaryClassNotAllowedByDCROC",
-        "objectClass: testAuxiliaryClassNotAllowedByDCROCAux",
-        "cn: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.removeAttribute("objectClass", "testAuxiliaryClassNotAllowedByDCROCAux");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that includes an attribute type that is
-   * not allowed by any of its object classes.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDisallowedAttributeType() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testdisallowedattributetypeoc-oid "
-                + "NAME 'testDisallowedAttributeTypeOC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testDisallowedAttributeTypeOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.removeAttribute("description", "foo");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Performs various tests to ensure that the server appropriately enforces DIT
-   * structure rule constraints.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDITStructureRuleConstraints() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testditstructureruleconstraintssupoc-oid "
-                + "NAME 'testDITStructureRuleConstraintsSupOC' SUP top "
-                + "STRUCTURAL MUST ou X-ORIGIN 'SchemaBackendTestCase')", false)
-        .addObjectClass(
-            "( testditstructureruleconstraintssuboc-oid "
-                + "NAME 'testDITStructureRuleConstraintsSubOC' SUP top "
-                + "STRUCTURAL MUST cn X-ORIGIN 'SchemaBackendTestCase')", false)
-        .addNameForm(
-            "( testditstructureruleconstraintsupsnf-oid "
-                + "NAME 'testDITStructureRuleConstraintsSupNF' "
-                + "OC testDITStructureRuleConstraintsSupOC MUST ou "
-                + "X-ORIGIN 'SchemaBackendTestCase' )", false)
-        .addNameForm(
-            "( testditstructureruleconstraintsubsnf-oid "
-                + "NAME 'testDITStructureRuleConstraintsSubNF' "
-                + "OC testDITStructureRuleConstraintsSubOC MUST cn "
-                + "X-ORIGIN 'SchemaBackendTestCase' )", false)
-        .addDITStructureRule(
-            "( 999014 " + "NAME 'testDITStructureRuleConstraintsSup' "
-                + "FORM testDITStructureRuleConstraintsSupNF "
-                + "X-ORIGIN 'SchemaBackendTestCase' )", false)
-        .addDITStructureRule(
-            "( 999015 " + "NAME 'testDITStructureRuleConstraintsSub' "
-                + "FORM testDITStructureRuleConstraintsSubNF SUP 999014 "
-                + "X-ORIGIN 'SchemaBackendTestCase' )", false).toSchema();
-
-    // @formatter:off
-    Entry e = newEntry(schema,
-        "dn: cn=child,ou=parent,o=test",
-        "objectClass: top",
-        "objectClass: testDITStructureRuleConstraintsSubOC",
-        "cn: child");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy()
-        .checkDITStructureRules(Policy.REJECT, newResolver(null)));
-
-    // @formatter:off
-    final Entry p = newEntry(schema,
-        "dn: ou=parent,o=test",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: testDITStructureRuleConstraintsSupOC",
-        "ou: parent");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema,
-        defaultPolicy().checkDITStructureRules(Policy.REJECT, newResolver(p)));
-
-    // @formatter:off
-    e = newEntry(schema,
-        "dn: cn=not below valid parent,o=test",
-        "objectClass: top",
-        "objectClass: testDITStructureRuleConstraintsSubOC",
-        "cn: not below valid parent");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy()
-        .checkDITStructureRules(Policy.REJECT, newResolver(null)));
-
-    // @formatter:off
-    e = newEntry(schema,
-        "dn: o=invalid entry below parent covered by DSR,ou=parent,o=test",
-        "objectClass: top",
-        "objectClass: organization",
-        "o: invalid entry below parent covered by DSR");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy()
-        .checkDITStructureRules(Policy.REJECT, newResolver(p)));
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry covered by a DIT content rule to ensure
-   * that attributes prohibited by the DIT content rule are not allowed even if
-   * they are allowed by the associated object classes.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDontAllowAttributeProhibitedByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testdontallowattributeprohibitedbydcroc-oid "
-                + "NAME 'testDontAllowAttributeProhibitedByDCROC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testdontallowattributeprohibitedbydcroc-oid "
-                + "NAME 'testDontAllowAttributeProhibitedByDCR' NOT description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testDontAllowAttributeProhibitedByDCROC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.removeAttribute("description", "foo");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry covered by a DIT content rule to ensure
-   * that attributes allowed by the DIT content rule are allowed but not
-   * required if they are not required by any of the associated object classes.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDontRequireAttributeAllowedByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testdontrequireatallowedbydcroc-oid "
-                + "NAME 'testDontRequireATAllowedByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testdontrequireatallowedbydcroc-oid "
-                + "NAME 'testDontRequireATAllowedByDCR' MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testDontRequireATAllowedByDCROC",
-        "cn: test");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry for which there is a DIT content rule
-   * covering the structural objectclass but that DIT content rule is marked
-   * OBSOLETE. In this case, any attribute types required by the DIT content
-   * rule should not be required for the entry.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testDontRequireAttributeRequiredByObsoleteDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testdontrequireatrequiredbyobsoletedcroc-oid "
-                + "NAME 'testDontRequireATRequiredByObsoleteDCROC' SUP top "
-                + "STRUCTURAL MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')",
-            false)
-        .addDITContentRule(
-            "( testdontrequireatrequiredbyobsoletedcroc-oid "
-                + "NAME 'testDontRequireATRequiredByObsoleteDCR' OBSOLETE "
-                + "MUST description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
-            false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testDontRequireATRequiredByObsoleteDCROC",
-        "cn: test");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that includes an attribute not defined
-   * in any objectClasses but the subtypes of the attribute are.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testInvalidSuperiorAttribute() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: uid=test.user,o=test",
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: organizationalPerson",
-        "sn: User",
-        "cn: Test User",
-        "name: foo");
-    // @formatter:off
-
-    assertDoesNotConformToSchema(e, defaultPolicy());
-
-    e.removeAttribute("name", "foo");
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that is missing an attribute required by
-   * an auxiliary object class.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMissingAttributeRequiredByAuxiliaryClass() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testmissingatrequiredbyauxiliaryoc-oid "
-                + "NAME 'testMissingATRequiredByAuxiliaryOC' SUP top AUXILIARY "
-                + "MUST ( cn $ description ) "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: device",
-        "objectClass: testMissingATRequiredByAuxiliaryOC",
-        "cn: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.addAttribute("description", "xxx");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that is missing an attribute required by
-   * its structural object class.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMissingAttributeRequiredByStructuralClass() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testmissingatrequiredbystructuraloc-oid "
-                + "NAME 'testMissingATRequiredByStructuralOC' SUP top STRUCTURAL "
-                + "MUST ( cn $ description ) "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testMissingATRequiredByStructuralOC",
-        "cn: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.addAttribute("description", "xxx");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that contains multiple structural
-   * objectclasses.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleStructuralClasses() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: uid=test.user,o=test",
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: organization",
-        "o: test",
-        "sn: User",
-        "cn: Test User");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, defaultPolicy());
-
-    e.removeAttribute("objectClass", "organization");
-    e.removeAttribute("o", "test");
-
-    assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that includes multiple values for a
-   * multivalued attribute.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleValuesForMultiValuedAttribute() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: o=test",
-        "objectClass: top",
-        "objectClass: organization",
-        "o: test",
-        "o: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that includes multiple values for a
-   * single-valued attribute.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleValuesForSingleValuedAttribute() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "dc: example",
-        "dc: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e,
-        ignoreAll().checkAttributeValues(Policy.REJECT));
-
-    e.removeAttribute("dc", "foo");
-    assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that includes multiple values for a
-   * single-valued operational attribute.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleValuesForSingleValuedOperationalAttribute()
-      throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: domain",
-        "dc: example",
-        "creatorsName: cn=Directory Manager",
-        "creatorsName: cn=Another Manager");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e,
-        ignoreAll().checkAttributeValues(Policy.REJECT));
-
-    e.removeAttribute("creatorsName", "cn=Another Manager");
-    assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * multivalued RDN component is compliant with that name form which requires
-   * one value but allows other values.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMVSatisfiesOptionalMultiValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testmvsatisfiesoptionalmultivaluednameformoc-oid "
-                + "NAME 'testMVSatisfiesOptionalMultiValuedNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testmvsatisfiesoptionalmultivaluednameform-oid "
-                + "NAME 'testMVSatisfiesOptionalMultiValuedNameForm' "
-                + "OC testMVSatisfiesOptionalMultiValuedNameFormOC MUST cn "
-                + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
-            false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test+description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testMVSatisfiesOptionalMultiValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be rejected if its
-   * multivalued RDN component violates that name form which only allows a
-   * single value.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMVViolatesSingleValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testmvviolatessinglevaluednameformoc-oid "
-                + "NAME 'testMVViolatesSingleValuedNameFormOC' SUP top STRUCTURAL "
-                + "MUST cn MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
-            false)
-        .addNameForm(
-            "( testmvviolatessinglevaluednameform-oid "
-                + "NAME 'testMVViolatesSingleValuedNameForm' "
-                + "OC testMVViolatesSingleValuedNameFormOC MUST cn "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test+description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testMVViolatesSingleValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.setName("cn=test,o=test");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that does not contain a structural
-   * objectclass.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testNoStructuralClass() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( domain-oid " + "NAME 'domain' SUP top STRUCTURAL "
-                + "MUST dc X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: dcObject",
-        "dc: example");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.addAttribute("objectClass", "domain");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry covered by a DIT content rule to ensure
-   * that attributes required by the DIT content rule are required even if not
-   * directly allowed by any of the entry's objectclasses.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testRequireAttributeRequiredByDCR() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testrequireatrequiredbydcroc-oid "
-                + "NAME 'testRequireATRequiredByDCROC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addDITContentRule(
-            "( testrequireatrequiredbydcroc-oid "
-                + "NAME 'testRequireATRequiredByDCR' MUST description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testRequireATRequiredByDCROC",
-        "cn: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.addAttribute("description", "foo");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * multivalued RDN component is compliant with that name form which requires
-   * multiple values.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testSatisfiesRequiredMultiValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testsatisfiesrequiredmultivaluednameformoc-oid "
-                + "NAME 'testSatisfiesRequiredMultiValuedNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testsatisfiesrequiredmultivaluednameform-oid "
-                + "NAME 'testSatisfiesRequiredMultiValuedNameForm' "
-                + "OC testSatisfiesRequiredMultiValuedNameFormOC "
-                + "MUST ( cn $ description ) "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test+description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testSatisfiesRequiredMultiValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * single-valued RDN component is compliant with that name form.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testSatisfiesSingleValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testsatisfiessinglevaluednameformoc-oid "
-                + "NAME 'testSatisfiesSingleValuedNameFormOC' SUP top STRUCTURAL "
-                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testsatisfiessinglevaluednameform-oid "
-                + "NAME 'testSatisfiesSingleValuedNameForm' "
-                + "OC testSatisfiesSingleValuedNameFormOC MUST cn "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testSatisfiesSingleValuedNameFormOC",
-        "cn: test");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * single-valued RDN component is compliant with that name form which requires
-   * one value but allows other values.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testSVSatisfiesOptionalMultiValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testsvsatisfiesoptionalmultivaluednameformoc-oid "
-                + "NAME 'testSVSatisfiesOptionalMultiValuedNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testsvsatisfiesoptionalmultivaluednameform-oid "
-                + "NAME 'testSVSatisfiesOptionalMultiValuedNameForm' "
-                + "OC testSVSatisfiesOptionalMultiValuedNameFormOC MUST cn "
-                + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
-            false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testSVSatisfiesOptionalMultiValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * single-valued RDN component violates that name form which requires one
-   * value but allows other values.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testSVViolatesOptionalMultiValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testsvviolatesoptionalmultivaluednameformoc-oid "
-                + "NAME 'testSVViolatesOptionalMultiValuedNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testsvviolatesoptionalmultivaluednameform-oid "
-                + "NAME 'testSVViolatesOptionalMultiValuedNameForm' "
-                + "OC testSVViolatesOptionalMultiValuedNameFormOC MUST cn "
-                + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
-            false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testSVViolatesOptionalMultiValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.setName("cn=test+description=foo,o=test");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that contains an undefined objectclass
-   * as well as a valid structural class.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testUndefinedAuxiliaryObjectClass() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: xxxundefinedauxiliaryxxx",
-        "cn: test",
-        "sn: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, defaultPolicy());
-
-    e.removeAttribute("objectClass", "xxxundefinedauxiliaryxxx");
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry that contains an undefined objectclass
-   * with no other structural class.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testUndefinedStructuralObjectClass() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: xxxundefinedstructuralxxx",
-        "o: test");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, defaultPolicy());
-
-    e.removeAttribute("objectClass", "xxxundefinedstructuralxxx");
-    e.addAttribute("objectClass", "organization");
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry with a valid single structural
-   * objectclass.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testValidSingleStructuralClass() throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: organization",
-        "o: example");
-    // @formatter:on
-
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests schema checking for an entry (not covered by a DIT content rule) with
-   * a valid single structural objectclass as well as an auxiliary objectclass.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testValidSingleStructuralClassAndAuxiliaryClass()
-      throws Exception
-  {
-    // @formatter:off
-    final Entry e = newEntry(
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: organization",
-        "objectClass: dcObject",
-        "dc: example",
-        "o: Example Org");
-    // @formatter:on
-
-    assertConformsToSchema(e, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be accepted if its
-   * single-valued RDN component only contains one of the multiple required
-   * attribute types.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testViolatesRequiredMultiValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testviolatesrequiredmultivaluednameformoc-oid "
-                + "NAME 'testViolatesRequiredMultiValuedNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testviolatesrequiredmultivaluednameform-oid "
-                + "NAME 'testViolatesRequiredMultiValuedNameForm' "
-                + "OC testViolatesRequiredMultiValuedNameFormOC "
-                + "MUST ( cn $ description ) "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: cn=test,o=test",
-        "objectClass: top",
-        "objectClass: testViolatesRequiredMultiValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.setName("cn=test+description=foo,o=test");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will be rejected if its
-   * single-valued RDN component violates that name form.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testViolatesSingleValuedNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testviolatessinglevaluednameformoc-oid "
-                + "NAME 'testViolatesSingleValuedNameFormOC' SUP top STRUCTURAL "
-                + "MUST cn MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
-            false)
-        .addNameForm(
-            "( testviolatessinglevaluednameform-oid "
-                + "NAME 'testViolatesSingleValuedNameForm' "
-                + "OC testViolatesSingleValuedNameFormOC MUST cn "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testViolatesSingleValuedNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertDoesNotConformToSchema(e, schema, defaultPolicy());
-
-    e.setName("cn=test,o=test");
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  /**
-   * Tests that an entry covered by a name form will not be rejected if its
-   * single-valued RDN component violates that name form but the name form is
-   * declared OBSOLETE.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testViolatesSingleValuedObsoleteNameForm() throws Exception
-  {
-    final Schema schema = new SchemaBuilder(Schema.getDefaultSchema())
-        .addObjectClass(
-            "( testviolatessinglevaluedobsoletenameformoc-oid "
-                + "NAME 'testViolatesSingleValuedObsoleteNameFormOC' SUP top "
-                + "STRUCTURAL MUST cn MAY description "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
-        .addNameForm(
-            "( testviolatessinglevaluedobsoletenameform-oid "
-                + "NAME 'testViolatesSingleValuedObsoleteNameForm' OBSOLETE "
-                + "OC testViolatesSingleValuedObsoleteNameFormOC MUST cn "
-                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
-
-    // @formatter:off
-    final Entry e = newEntry(schema,
-        "dn: description=foo,o=test",
-        "objectClass: top",
-        "objectClass: testViolatesSingleValuedObsoleteNameFormOC",
-        "cn: test",
-        "description: foo");
-    // @formatter:on
-
-    assertConformsToSchema(e, schema, defaultPolicy());
-  }
-
-
-
-  private void assertConformsToSchema(final Entry entry, final Schema schema,
-      final SchemaValidationPolicy policy)
-  {
-    final List<LocalizableMessage> errorMessages = new LinkedList<LocalizableMessage>();
-    assertThat(schema.validateEntry(entry, policy, errorMessages)).as(
-        errorMessages.toString()).isTrue();
-  }
-
-
-
-  private void assertConformsToSchema(final Entry entry,
-      final SchemaValidationPolicy policy)
-  {
-    assertConformsToSchema(entry, Schema.getDefaultSchema(), policy);
-  }
-
-
-
-  private void assertDoesNotConformToSchema(final Entry entry,
-      final Schema schema, final SchemaValidationPolicy policy)
-  {
-    final List<LocalizableMessage> errorMessages = new LinkedList<LocalizableMessage>();
-    assertThat(schema.validateEntry(entry, policy, errorMessages)).as(
-        errorMessages.toString()).isFalse();
-  }
-
-
-
-  private void assertDoesNotConformToSchema(final Entry entry,
-      final SchemaValidationPolicy policy)
-  {
-    assertDoesNotConformToSchema(entry, Schema.getDefaultSchema(), policy);
-  }
-
-
-
-  private Entry newEntry(final Schema schema, final String... ldif)
-  {
-    try
-    {
-      return new LDIFEntryReader(ldif).setSchema(schema).readEntry();
+        assertConformsToSchema(e, schema, defaultPolicy());
     }
-    catch (final Exception e)
-    {
-      throw new IllegalArgumentException(e);
+
+    /**
+     * Tests schema checking for an entry covered by a DIT content rule to
+     * ensure that attributes required by the DIT content rule are allowed even
+     * if not directly allowed by any of the entry's objectclasses.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testAllowAttributeRequiredByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testallowatrequiredbydcroc-oid "
+                                + "NAME 'testAllowATRequiredByDCROC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testallowatrequiredbydcroc-oid "
+                                        + "NAME 'testAllowATRequiredByDCR' MUST description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testAllowATRequiredByDCROC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
     }
-  }
 
+    /**
+     * Tests schema checking for an entry that contains structural and auxiliary
+     * objectclasses where the auxiliary class is allowed by a DIT content rule.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testAuxiliaryClassAllowedByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testauxiliaryclassallowedbydcroc-oid "
+                                        + "NAME 'testAuxiliaryClassAllowedByDCROC' SUP top STRUCTURAL "
+                                        + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addObjectClass(
+                                "( testauxiliaryclassallowedbydcrocaux-oid "
+                                        + "NAME 'testAuxiliaryClassAllowedByDCROCAux' SUP top AUXILIARY "
+                                        + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
+                                false).addDITContentRule(
+                                "( testauxiliaryclassallowedbydcroc-oid "
+                                        + "NAME 'testAuxiliaryClassAllowedByDCR' "
+                                        + "AUX testAuxiliaryClassAllowedByDCROCAux "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
 
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testAuxiliaryClassAllowedByDCROC",
+            "objectClass: testAuxiliaryClassAllowedByDCROCAux",
+            "cn: test");
+        // @formatter:on
 
-  private Entry newEntry(final String... ldif)
-  {
-    return newEntry(Schema.getDefaultSchema(), ldif);
-  }
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
 
+    /**
+     * Tests schema checking for an entry that contains structural and auxiliary
+     * objectclasses where the auxiliary class is not allowed by the associated
+     * DIT content rule.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testAuxiliaryClassNotAllowedByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testauxiliaryclassnotallowedbydcroc-oid "
+                                + "NAME 'testAuxiliaryClassNotAllowedByDCROC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addObjectClass(
+                                "( testauxiliaryclassnotallowedbydcrocaux-oid "
+                                        + "NAME 'testAuxiliaryClassNotAllowedByDCROCAux' SUP top "
+                                        + "AUXILIARY MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testauxiliaryclassnotallowedbydcroc-oid "
+                                        + "NAME 'testAuxiliaryClassNotAllowedByDCR' "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
 
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testAuxiliaryClassNotAllowedByDCROC",
+            "objectClass: testAuxiliaryClassNotAllowedByDCROCAux",
+            "cn: test");
+        // @formatter:on
 
-  private EntryResolver newResolver(final Entry e)
-  {
-    return new EntryResolver()
-    {
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
 
-      public Entry getEntry(final DN dn) throws ErrorResultException
-      {
-        if (e == null)
-        {
-          throw ErrorResultException.newErrorResult(ResultCode.NO_SUCH_OBJECT,
-              "no such entry " + dn.toString());
+        e.removeAttribute("objectClass", "testAuxiliaryClassNotAllowedByDCROCAux");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that includes an attribute type that
+     * is not allowed by any of its object classes.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDisallowedAttributeType() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testdisallowedattributetypeoc-oid "
+                                + "NAME 'testDisallowedAttributeTypeOC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testDisallowedAttributeTypeOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.removeAttribute("description", "foo");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Performs various tests to ensure that the server appropriately enforces
+     * DIT structure rule constraints.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDITStructureRuleConstraints() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testditstructureruleconstraintssupoc-oid "
+                                + "NAME 'testDITStructureRuleConstraintsSupOC' SUP top "
+                                + "STRUCTURAL MUST ou X-ORIGIN 'SchemaBackendTestCase')", false)
+                        .addObjectClass(
+                                "( testditstructureruleconstraintssuboc-oid "
+                                        + "NAME 'testDITStructureRuleConstraintsSubOC' SUP top "
+                                        + "STRUCTURAL MUST cn X-ORIGIN 'SchemaBackendTestCase')",
+                                false).addNameForm(
+                                "( testditstructureruleconstraintsupsnf-oid "
+                                        + "NAME 'testDITStructureRuleConstraintsSupNF' "
+                                        + "OC testDITStructureRuleConstraintsSupOC MUST ou "
+                                        + "X-ORIGIN 'SchemaBackendTestCase' )", false).addNameForm(
+                                "( testditstructureruleconstraintsubsnf-oid "
+                                        + "NAME 'testDITStructureRuleConstraintsSubNF' "
+                                        + "OC testDITStructureRuleConstraintsSubOC MUST cn "
+                                        + "X-ORIGIN 'SchemaBackendTestCase' )", false)
+                        .addDITStructureRule(
+                                "( 999014 " + "NAME 'testDITStructureRuleConstraintsSup' "
+                                        + "FORM testDITStructureRuleConstraintsSupNF "
+                                        + "X-ORIGIN 'SchemaBackendTestCase' )", false)
+                        .addDITStructureRule(
+                                "( 999015 " + "NAME 'testDITStructureRuleConstraintsSub' "
+                                        + "FORM testDITStructureRuleConstraintsSubNF SUP 999014 "
+                                        + "X-ORIGIN 'SchemaBackendTestCase' )", false).toSchema();
+
+        // @formatter:off
+        Entry e = newEntry(schema,
+            "dn: cn=child,ou=parent,o=test",
+            "objectClass: top",
+            "objectClass: testDITStructureRuleConstraintsSubOC",
+            "cn: child");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy().checkDITStructureRules(
+                Policy.REJECT, newResolver(null)));
+
+        // @formatter:off
+        final Entry p = newEntry(schema,
+            "dn: ou=parent,o=test",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: testDITStructureRuleConstraintsSupOC",
+            "ou: parent");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy().checkDITStructureRules(Policy.REJECT,
+                newResolver(p)));
+
+        // @formatter:off
+        e = newEntry(schema,
+            "dn: cn=not below valid parent,o=test",
+            "objectClass: top",
+            "objectClass: testDITStructureRuleConstraintsSubOC",
+            "cn: not below valid parent");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy().checkDITStructureRules(
+                Policy.REJECT, newResolver(null)));
+
+        // @formatter:off
+        e = newEntry(schema,
+            "dn: o=invalid entry below parent covered by DSR,ou=parent,o=test",
+            "objectClass: top",
+            "objectClass: organization",
+            "o: invalid entry below parent covered by DSR");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy().checkDITStructureRules(
+                Policy.REJECT, newResolver(p)));
+    }
+
+    /**
+     * Tests schema checking for an entry covered by a DIT content rule to
+     * ensure that attributes prohibited by the DIT content rule are not allowed
+     * even if they are allowed by the associated object classes.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDontAllowAttributeProhibitedByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testdontallowattributeprohibitedbydcroc-oid "
+                                        + "NAME 'testDontAllowAttributeProhibitedByDCROC' SUP top "
+                                        + "STRUCTURAL MUST cn MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testdontallowattributeprohibitedbydcroc-oid "
+                                        + "NAME 'testDontAllowAttributeProhibitedByDCR' NOT description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testDontAllowAttributeProhibitedByDCROC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.removeAttribute("description", "foo");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry covered by a DIT content rule to
+     * ensure that attributes allowed by the DIT content rule are allowed but
+     * not required if they are not required by any of the associated object
+     * classes.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDontRequireAttributeAllowedByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testdontrequireatallowedbydcroc-oid "
+                                + "NAME 'testDontRequireATAllowedByDCROC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testdontrequireatallowedbydcroc-oid "
+                                        + "NAME 'testDontRequireATAllowedByDCR' MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testDontRequireATAllowedByDCROC",
+            "cn: test");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry for which there is a DIT content rule
+     * covering the structural objectclass but that DIT content rule is marked
+     * OBSOLETE. In this case, any attribute types required by the DIT content
+     * rule should not be required for the entry.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testDontRequireAttributeRequiredByObsoleteDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testdontrequireatrequiredbyobsoletedcroc-oid "
+                                + "NAME 'testDontRequireATRequiredByObsoleteDCROC' SUP top "
+                                + "STRUCTURAL MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')",
+                        false).addDITContentRule(
+                        "( testdontrequireatrequiredbyobsoletedcroc-oid "
+                                + "NAME 'testDontRequireATRequiredByObsoleteDCR' OBSOLETE "
+                                + "MUST description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
+                        false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testDontRequireATRequiredByObsoleteDCROC",
+            "cn: test");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that includes an attribute not defined
+     * in any objectClasses but the subtypes of the attribute are.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testInvalidSuperiorAttribute() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: uid=test.user,o=test",
+            "objectClass: top",
+            "objectClass: person",
+            "objectClass: organizationalPerson",
+            "sn: User",
+            "cn: Test User",
+            "name: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, defaultPolicy());
+
+        e.removeAttribute("name", "foo");
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that is missing an attribute required
+     * by an auxiliary object class.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMissingAttributeRequiredByAuxiliaryClass() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testmissingatrequiredbyauxiliaryoc-oid "
+                                + "NAME 'testMissingATRequiredByAuxiliaryOC' SUP top AUXILIARY "
+                                + "MUST ( cn $ description ) "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: device",
+            "objectClass: testMissingATRequiredByAuxiliaryOC",
+            "cn: test");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.addAttribute("description", "xxx");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that is missing an attribute required
+     * by its structural object class.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMissingAttributeRequiredByStructuralClass() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testmissingatrequiredbystructuraloc-oid "
+                                + "NAME 'testMissingATRequiredByStructuralOC' SUP top STRUCTURAL "
+                                + "MUST ( cn $ description ) "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testMissingATRequiredByStructuralOC",
+            "cn: test");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.addAttribute("description", "xxx");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that contains multiple structural
+     * objectclasses.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMultipleStructuralClasses() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: uid=test.user,o=test",
+            "objectClass: top",
+            "objectClass: person",
+            "objectClass: organization",
+            "o: test",
+            "sn: User",
+            "cn: Test User");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, defaultPolicy());
+
+        e.removeAttribute("objectClass", "organization");
+        e.removeAttribute("o", "test");
+
+        assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
+    }
+
+    /**
+     * Tests schema checking for an entry that includes multiple values for a
+     * multivalued attribute.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMultipleValuesForMultiValuedAttribute() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: o=test",
+            "objectClass: top",
+            "objectClass: organization",
+            "o: test",
+            "o: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that includes multiple values for a
+     * single-valued attribute.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMultipleValuesForSingleValuedAttribute() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "dc: example",
+            "dc: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
+
+        e.removeAttribute("dc", "foo");
+        assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
+    }
+
+    /**
+     * Tests schema checking for an entry that includes multiple values for a
+     * single-valued operational attribute.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMultipleValuesForSingleValuedOperationalAttribute() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "objectClass: domain",
+            "dc: example",
+            "creatorsName: cn=Directory Manager",
+            "creatorsName: cn=Another Manager");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
+
+        e.removeAttribute("creatorsName", "cn=Another Manager");
+        assertConformsToSchema(e, ignoreAll().checkAttributeValues(Policy.REJECT));
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * multivalued RDN component is compliant with that name form which requires
+     * one value but allows other values.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMVSatisfiesOptionalMultiValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testmvsatisfiesoptionalmultivaluednameformoc-oid "
+                                        + "NAME 'testMVSatisfiesOptionalMultiValuedNameFormOC' SUP top "
+                                        + "STRUCTURAL MUST cn MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addNameForm(
+                                "( testmvsatisfiesoptionalmultivaluednameform-oid "
+                                        + "NAME 'testMVSatisfiesOptionalMultiValuedNameForm' "
+                                        + "OC testMVSatisfiesOptionalMultiValuedNameFormOC MUST cn "
+                                        + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
+                                false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test+description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testMVSatisfiesOptionalMultiValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be rejected if its
+     * multivalued RDN component violates that name form which only allows a
+     * single value.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testMVViolatesSingleValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testmvviolatessinglevaluednameformoc-oid "
+                                        + "NAME 'testMVViolatesSingleValuedNameFormOC' SUP top STRUCTURAL "
+                                        + "MUST cn MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
+                                false).addNameForm(
+                                "( testmvviolatessinglevaluednameform-oid "
+                                        + "NAME 'testMVViolatesSingleValuedNameForm' "
+                                        + "OC testMVViolatesSingleValuedNameFormOC MUST cn "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test+description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testMVViolatesSingleValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.setName("cn=test,o=test");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that does not contain a structural
+     * objectclass.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testNoStructuralClass() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( domain-oid " + "NAME 'domain' SUP top STRUCTURAL "
+                                + "MUST dc X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "objectClass: dcObject",
+            "dc: example");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.addAttribute("objectClass", "domain");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry covered by a DIT content rule to
+     * ensure that attributes required by the DIT content rule are required even
+     * if not directly allowed by any of the entry's objectclasses.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testRequireAttributeRequiredByDCR() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testrequireatrequiredbydcroc-oid "
+                                + "NAME 'testRequireATRequiredByDCROC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addDITContentRule(
+                                "( testrequireatrequiredbydcroc-oid "
+                                        + "NAME 'testRequireATRequiredByDCR' MUST description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testRequireATRequiredByDCROC",
+            "cn: test");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.addAttribute("description", "foo");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * multivalued RDN component is compliant with that name form which requires
+     * multiple values.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testSatisfiesRequiredMultiValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testsatisfiesrequiredmultivaluednameformoc-oid "
+                                + "NAME 'testSatisfiesRequiredMultiValuedNameFormOC' SUP top "
+                                + "STRUCTURAL MUST cn MAY description "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).addNameForm(
+                        "( testsatisfiesrequiredmultivaluednameform-oid "
+                                + "NAME 'testSatisfiesRequiredMultiValuedNameForm' "
+                                + "OC testSatisfiesRequiredMultiValuedNameFormOC "
+                                + "MUST ( cn $ description ) "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test+description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testSatisfiesRequiredMultiValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * single-valued RDN component is compliant with that name form.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testSatisfiesSingleValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testsatisfiessinglevaluednameformoc-oid "
+                                + "NAME 'testSatisfiesSingleValuedNameFormOC' SUP top STRUCTURAL "
+                                + "MUST cn X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addNameForm(
+                                "( testsatisfiessinglevaluednameform-oid "
+                                        + "NAME 'testSatisfiesSingleValuedNameForm' "
+                                        + "OC testSatisfiesSingleValuedNameFormOC MUST cn "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testSatisfiesSingleValuedNameFormOC",
+            "cn: test");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * single-valued RDN component is compliant with that name form which
+     * requires one value but allows other values.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testSVSatisfiesOptionalMultiValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testsvsatisfiesoptionalmultivaluednameformoc-oid "
+                                        + "NAME 'testSVSatisfiesOptionalMultiValuedNameFormOC' SUP top "
+                                        + "STRUCTURAL MUST cn MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addNameForm(
+                                "( testsvsatisfiesoptionalmultivaluednameform-oid "
+                                        + "NAME 'testSVSatisfiesOptionalMultiValuedNameForm' "
+                                        + "OC testSVSatisfiesOptionalMultiValuedNameFormOC MUST cn "
+                                        + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
+                                false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testSVSatisfiesOptionalMultiValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * single-valued RDN component violates that name form which requires one
+     * value but allows other values.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testSVViolatesOptionalMultiValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testsvviolatesoptionalmultivaluednameformoc-oid "
+                                        + "NAME 'testSVViolatesOptionalMultiValuedNameFormOC' SUP top "
+                                        + "STRUCTURAL MUST cn MAY description "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false)
+                        .addNameForm(
+                                "( testsvviolatesoptionalmultivaluednameform-oid "
+                                        + "NAME 'testSVViolatesOptionalMultiValuedNameForm' "
+                                        + "OC testSVViolatesOptionalMultiValuedNameFormOC MUST cn "
+                                        + "MAY description X-ORIGIN 'EntrySchemaCheckingTestCase' )",
+                                false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testSVViolatesOptionalMultiValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.setName("cn=test+description=foo,o=test");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that contains an undefined objectclass
+     * as well as a valid structural class.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testUndefinedAuxiliaryObjectClass() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: person",
+            "objectClass: xxxundefinedauxiliaryxxx",
+            "cn: test",
+            "sn: test");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, defaultPolicy());
+
+        e.removeAttribute("objectClass", "xxxundefinedauxiliaryxxx");
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry that contains an undefined objectclass
+     * with no other structural class.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testUndefinedStructuralObjectClass() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: xxxundefinedstructuralxxx",
+            "o: test");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, defaultPolicy());
+
+        e.removeAttribute("objectClass", "xxxundefinedstructuralxxx");
+        e.addAttribute("objectClass", "organization");
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry with a valid single structural
+     * objectclass.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testValidSingleStructuralClass() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "objectClass: organization",
+            "o: example");
+        // @formatter:on
+
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests schema checking for an entry (not covered by a DIT content rule)
+     * with a valid single structural objectclass as well as an auxiliary
+     * objectclass.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testValidSingleStructuralClassAndAuxiliaryClass() throws Exception {
+        // @formatter:off
+        final Entry e = newEntry(
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "objectClass: organization",
+            "objectClass: dcObject",
+            "dc: example",
+            "o: Example Org");
+        // @formatter:on
+
+        assertConformsToSchema(e, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be accepted if its
+     * single-valued RDN component only contains one of the multiple required
+     * attribute types.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testViolatesRequiredMultiValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testviolatesrequiredmultivaluednameformoc-oid "
+                                + "NAME 'testViolatesRequiredMultiValuedNameFormOC' SUP top "
+                                + "STRUCTURAL MUST cn MAY description "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).addNameForm(
+                        "( testviolatesrequiredmultivaluednameform-oid "
+                                + "NAME 'testViolatesRequiredMultiValuedNameForm' "
+                                + "OC testViolatesRequiredMultiValuedNameFormOC "
+                                + "MUST ( cn $ description ) "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: cn=test,o=test",
+            "objectClass: top",
+            "objectClass: testViolatesRequiredMultiValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.setName("cn=test+description=foo,o=test");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will be rejected if its
+     * single-valued RDN component violates that name form.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testViolatesSingleValuedNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema())
+                        .addObjectClass(
+                                "( testviolatessinglevaluednameformoc-oid "
+                                        + "NAME 'testViolatesSingleValuedNameFormOC' SUP top STRUCTURAL "
+                                        + "MUST cn MAY description X-ORIGIN 'EntrySchemaCheckingTestCase')",
+                                false).addNameForm(
+                                "( testviolatessinglevaluednameform-oid "
+                                        + "NAME 'testViolatesSingleValuedNameForm' "
+                                        + "OC testViolatesSingleValuedNameFormOC MUST cn "
+                                        + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false)
+                        .toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testViolatesSingleValuedNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertDoesNotConformToSchema(e, schema, defaultPolicy());
+
+        e.setName("cn=test,o=test");
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    /**
+     * Tests that an entry covered by a name form will not be rejected if its
+     * single-valued RDN component violates that name form but the name form is
+     * declared OBSOLETE.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test
+    public void testViolatesSingleValuedObsoleteNameForm() throws Exception {
+        final Schema schema =
+                new SchemaBuilder(Schema.getDefaultSchema()).addObjectClass(
+                        "( testviolatessinglevaluedobsoletenameformoc-oid "
+                                + "NAME 'testViolatesSingleValuedObsoleteNameFormOC' SUP top "
+                                + "STRUCTURAL MUST cn MAY description "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase')", false).addNameForm(
+                        "( testviolatessinglevaluedobsoletenameform-oid "
+                                + "NAME 'testViolatesSingleValuedObsoleteNameForm' OBSOLETE "
+                                + "OC testViolatesSingleValuedObsoleteNameFormOC MUST cn "
+                                + "X-ORIGIN 'EntrySchemaCheckingTestCase' )", false).toSchema();
+
+        // @formatter:off
+        final Entry e = newEntry(schema,
+            "dn: description=foo,o=test",
+            "objectClass: top",
+            "objectClass: testViolatesSingleValuedObsoleteNameFormOC",
+            "cn: test",
+            "description: foo");
+        // @formatter:on
+
+        assertConformsToSchema(e, schema, defaultPolicy());
+    }
+
+    private void assertConformsToSchema(final Entry entry, final Schema schema,
+            final SchemaValidationPolicy policy) {
+        final List<LocalizableMessage> errorMessages = new LinkedList<LocalizableMessage>();
+        assertThat(schema.validateEntry(entry, policy, errorMessages)).as(errorMessages.toString())
+                .isTrue();
+    }
+
+    private void assertConformsToSchema(final Entry entry, final SchemaValidationPolicy policy) {
+        assertConformsToSchema(entry, Schema.getDefaultSchema(), policy);
+    }
+
+    private void assertDoesNotConformToSchema(final Entry entry, final Schema schema,
+            final SchemaValidationPolicy policy) {
+        final List<LocalizableMessage> errorMessages = new LinkedList<LocalizableMessage>();
+        assertThat(schema.validateEntry(entry, policy, errorMessages)).as(errorMessages.toString())
+                .isFalse();
+    }
+
+    private void assertDoesNotConformToSchema(final Entry entry, final SchemaValidationPolicy policy) {
+        assertDoesNotConformToSchema(entry, Schema.getDefaultSchema(), policy);
+    }
+
+    private Entry newEntry(final Schema schema, final String... ldif) {
+        try {
+            return new LDIFEntryReader(ldif).setSchema(schema).readEntry();
+        } catch (final Exception e) {
+            throw new IllegalArgumentException(e);
         }
+    }
 
-        assertThat((Object) dn).isEqualTo(e.getName());
-        return e;
-      }
-    };
-  }
+    private Entry newEntry(final String... ldif) {
+        return newEntry(Schema.getDefaultSchema(), ldif);
+    }
+
+    private EntryResolver newResolver(final Entry e) {
+        return new EntryResolver() {
+
+            public Entry getEntry(final DN dn) throws ErrorResultException {
+                if (e == null) {
+                    throw ErrorResultException.newErrorResult(ResultCode.NO_SUCH_OBJECT,
+                            "no such entry " + dn.toString());
+                }
+
+                assertThat((Object) dn).isEqualTo(e.getName());
+                return e;
+            }
+        };
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java
index 3a5f3d0..652cd14 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OID_GENERIC_ENUM;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -37,97 +34,70 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Enum syntax tests.
  */
 @SuppressWarnings("javadoc")
-public class EnumSyntaxTestCase extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "arbit-day", false }, { "wednesday", true }, };
-  }
+public class EnumSyntaxTestCase extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "arbit-day", false }, { "wednesday", true }, };
+    }
 
+    @Test
+    public void testDecode() throws SchemaException, DecodeException {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 3.3.3  DESC 'Day Of The Week' "
+                + " X-ENUM  ( 'monday' 'tuesday'   'wednesday'  'thursday'  'friday' "
+                + " 'saturday' 'sunday') )", true);
+        final Schema schema = builder.toSchema();
+        final Syntax syntax = schema.getSyntax("3.3.3");
+        final MatchingRule rule = syntax.getOrderingMatchingRule();
+        Assert.assertEquals(rule.getGreaterOrEqualAssertion(ByteString.valueOf("monday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("thursday"))), ConditionResult.TRUE);
+        Assert.assertEquals(rule.getLessOrEqualAssertion(ByteString.valueOf("monday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("thursday"))),
+                ConditionResult.FALSE);
+        Assert.assertEquals(rule.getGreaterOrEqualAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("monday"))), ConditionResult.FALSE);
+        Assert.assertEquals(rule.getLessOrEqualAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("monday"))), ConditionResult.TRUE);
+        Assert.assertEquals(rule.getGreaterOrEqualAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))), ConditionResult.TRUE);
+        Assert.assertEquals(rule.getLessOrEqualAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))), ConditionResult.TRUE);
+        Assert.assertEquals(rule.getAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("monday"))), ConditionResult.TRUE);
+        Assert.assertEquals(rule.getAssertion(ByteString.valueOf("monday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("thursday"))),
+                ConditionResult.FALSE);
+        Assert.assertEquals(rule.getAssertion(ByteString.valueOf("tuesday")).matches(
+                rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))), ConditionResult.FALSE);
+        Assert.assertNotNull(schema.getMatchingRule(OMR_OID_GENERIC_ENUM + ".3.3.3"));
+    }
 
+    @Test
+    public void testDuplicateEnum() throws SchemaException, DecodeException {
+        // This should be handled silently.
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 3.3.3  DESC 'Day Of The Week' "
+                + " X-ENUM  ( 'monday' 'tuesday'   'wednesday'  'thursday'  'friday' "
+                + " 'saturday' 'monday') )", true);
+        builder.toSchema();
+    }
 
-  @Test
-  public void testDecode() throws SchemaException, DecodeException
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 3.3.3  DESC 'Day Of The Week' "
-        + " X-ENUM  ( 'monday' 'tuesday'   'wednesday'  'thursday'  'friday' "
-        + " 'saturday' 'sunday') )", true);
-    final Schema schema = builder.toSchema();
-    final Syntax syntax = schema.getSyntax("3.3.3");
-    final MatchingRule rule = syntax.getOrderingMatchingRule();
-    Assert.assertEquals(rule.getGreaterOrEqualAssertion(
-        ByteString.valueOf("monday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("thursday"))),
-        ConditionResult.TRUE);
-    Assert.assertEquals(rule.getLessOrEqualAssertion(
-        ByteString.valueOf("monday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("thursday"))),
-        ConditionResult.FALSE);
-    Assert.assertEquals(rule.getGreaterOrEqualAssertion(
-        ByteString.valueOf("tuesday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("monday"))),
-        ConditionResult.FALSE);
-    Assert.assertEquals(rule.getLessOrEqualAssertion(
-        ByteString.valueOf("tuesday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("monday"))),
-        ConditionResult.TRUE);
-    Assert.assertEquals(rule.getGreaterOrEqualAssertion(
-        ByteString.valueOf("tuesday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))),
-        ConditionResult.TRUE);
-    Assert.assertEquals(rule.getLessOrEqualAssertion(
-        ByteString.valueOf("tuesday")).matches(
-        rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))),
-        ConditionResult.TRUE);
-    Assert.assertEquals(rule.getAssertion(ByteString.valueOf("tuesday"))
-        .matches(rule.normalizeAttributeValue(ByteString.valueOf("monday"))),
-        ConditionResult.TRUE);
-    Assert.assertEquals(rule.getAssertion(ByteString.valueOf("monday"))
-        .matches(rule.normalizeAttributeValue(ByteString.valueOf("thursday"))),
-        ConditionResult.FALSE);
-    Assert.assertEquals(rule.getAssertion(ByteString.valueOf("tuesday"))
-        .matches(rule.normalizeAttributeValue(ByteString.valueOf("tuesday"))),
-        ConditionResult.FALSE);
-    Assert.assertNotNull(schema
-        .getMatchingRule(OMR_OID_GENERIC_ENUM + ".3.3.3"));
-  }
-
-
-
-  @Test
-  public void testDuplicateEnum() throws SchemaException, DecodeException
-  {
-    // This should be handled silently.
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 3.3.3  DESC 'Day Of The Week' "
-        + " X-ENUM  ( 'monday' 'tuesday'   'wednesday'  'thursday'  'friday' "
-        + " 'saturday' 'monday') )", true);
-    builder.toSchema();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule() throws SchemaException, DecodeException
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addEnumerationSyntax("3.3.3", "Day Of The Week", false, "monday",
-        "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
-    return builder.toSchema().getSyntax("3.3.3");
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() throws SchemaException, DecodeException {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addEnumerationSyntax("3.3.3", "Day Of The Week", false, "monday", "tuesday",
+                "wednesday", "thursday", "friday", "saturday", "sunday");
+        return builder.toSchema().getSyntax("3.3.3");
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java
index c5cc6d7..db3af17 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,51 +25,38 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_GENERALIZED_TIME_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Generalized time syntax tests.
  */
-public class GeneralizedTimeSyntaxTest extends SyntaxTestCase
-{
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "2006090613Z", true },
-        { "20060906135030+01", true }, { "200609061350Z", true },
-        { "20060906135030Z", true }, { "20061116135030Z", true },
-        { "20061126135030Z", true }, { "20061231235959Z", true },
-        { "20060906135030+0101", true }, { "20060906135030+2359", true },
-        { "20060906135030+3359", false }, { "20060906135030+2389", false },
-        { "20060906135030+2361", false }, { "20060906135030+", false },
-        { "20060906135030+0", false }, { "20060906135030+010", false },
-        { "20061200235959Z", false }, { "2006121a235959Z", false },
-        { "2006122a235959Z", false }, { "20060031235959Z", false },
-        { "20061331235959Z", false }, { "20062231235959Z", false },
-        { "20061232235959Z", false }, { "2006123123595aZ", false },
-        { "200a1231235959Z", false }, { "2006j231235959Z", false },
-        { "200612-1235959Z", false }, { "20061231#35959Z", false },
-        { "2006", false }, };
-  }
+public class GeneralizedTimeSyntaxTest extends SyntaxTestCase {
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "2006090613Z", true }, { "20060906135030+01", true },
+            { "200609061350Z", true }, { "20060906135030Z", true }, { "20061116135030Z", true },
+            { "20061126135030Z", true }, { "20061231235959Z", true },
+            { "20060906135030+0101", true }, { "20060906135030+2359", true },
+            { "20060906135030+3359", false }, { "20060906135030+2389", false },
+            { "20060906135030+2361", false }, { "20060906135030+", false },
+            { "20060906135030+0", false }, { "20060906135030+010", false },
+            { "20061200235959Z", false }, { "2006121a235959Z", false },
+            { "2006122a235959Z", false }, { "20060031235959Z", false },
+            { "20061331235959Z", false }, { "20062231235959Z", false },
+            { "20061232235959Z", false }, { "2006123123595aZ", false },
+            { "200a1231235959Z", false }, { "2006j231235959Z", false },
+            { "200612-1235959Z", false }, { "20061231#35959Z", false }, { "2006", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_GENERALIZED_TIME_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_GENERALIZED_TIME_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java
index ffce92c..c651611 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,46 +25,33 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_GUIDE_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Guide syntax tests.
  */
-public class GuideSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "sn$EQ|!(sn$EQ)", true }, { "!(sn$EQ)", true },
-        { "person#sn$EQ", true }, { "(sn$EQ)", true }, { "sn$EQ", true },
-        { "sn$SUBSTR", true }, { "sn$GE", true }, { "sn$LE", true },
-        { "sn$ME", false }, { "?true", true }, { "?false", true },
-        { "true|sn$GE", false }, { "sn$APPROX", true },
-        { "sn$EQ|(sn$EQ)", true }, { "sn$EQ|(sn$EQ", false },
-        { "sn$EQ|(sn$EQ)|sn$EQ", true }, { "sn$EQ|(cn$APPROX&?false)", true },
-        { "sn$EQ|(cn$APPROX&|?false)", false }, };
-  }
+public class GuideSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "sn$EQ|!(sn$EQ)", true }, { "!(sn$EQ)", true },
+            { "person#sn$EQ", true }, { "(sn$EQ)", true }, { "sn$EQ", true },
+            { "sn$SUBSTR", true }, { "sn$GE", true }, { "sn$LE", true }, { "sn$ME", false },
+            { "?true", true }, { "?false", true }, { "true|sn$GE", false }, { "sn$APPROX", true },
+            { "sn$EQ|(sn$EQ)", true }, { "sn$EQ|(sn$EQ", false }, { "sn$EQ|(sn$EQ)|sn$EQ", true },
+            { "sn$EQ|(cn$APPROX&?false)", true }, { "sn$EQ|(cn$APPROX&|?false)", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_GUIDE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_GUIDE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java
index bea8b6c..66fe5ed 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,40 +25,29 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_IA5_STRING_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * IA5 string syntax tests.
  */
-public class IA5StringSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, };
-  }
+public class IA5StringSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_IA5_STRING_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_IA5_STRING_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java
index 4fcf5a4..b78c37b 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,91 +25,69 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_LDAP_SYNTAX_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * LDAP syntax tests.
  */
-public class LDAPSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-9EN ('this' 'is' 'a' 'test'))", false },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "(X-name 'this", false },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "(X-name 'this'", false },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "Y-name 'this')", false },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "X-name 'this' 'is')",
-            false },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "X-name )", false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X- ('this' 'is' 'a' 'test'))", false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this')",
-            false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'",
-            false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'))))",
-            false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a  X-name-b ('this'))))",
-            false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a  'X-name-b' ('this'))))",
-            false },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'))",
-            true },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-a-_eN_- ('this' 'is' 'a' 'test'))", true },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "X-name ('this'))",
-            true },
-        { "( 2.5.4.3 DESC 'full syntax description' " + "X-name 'this')", true },
-        {
-            "( 2.5.4.3 DESC 'full syntax description' "
-                + "X-name 'this' X-name-a 'test')", true },
-        { "( 2.5.4.3 DESC 'full syntax description' )", true },
-        { "   (    2.5.4.3    DESC  ' syntax description'    )", true },
-        { "( 2.5.4.3 DESC syntax description )", false },
-        { "($%^*&!@ DESC 'syntax description' )", false },
-        { "(temp-oid DESC 'syntax description' )", true },
-        { "2.5.4.3 DESC 'syntax description' )", false },
-        { "(2.5.4.3 DESC 'syntax description' ", false }, };
-  }
+public class LDAPSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-9EN ('this' 'is' 'a' 'test'))",
+                false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "(X-name 'this", false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "(X-name 'this'", false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "Y-name 'this')", false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-name 'this' 'is')", false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-name )", false },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X- ('this' 'is' 'a' 'test'))", false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this')",
+                false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'", false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'))))",
+                false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a  X-name-b ('this'))))", false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a  'X-name-b' ('this'))))", false },
+            {
+                "( 2.5.4.3 DESC 'full syntax description' "
+                        + "X-name ('this' 'is' 'a' 'test') X-name-a 'this' X-name-b ('this'))",
+                true },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-a-_eN_- ('this' 'is' 'a' 'test'))",
+                true },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-name ('this'))", true },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-name 'this')", true },
+            { "( 2.5.4.3 DESC 'full syntax description' " + "X-name 'this' X-name-a 'test')", true },
+            { "( 2.5.4.3 DESC 'full syntax description' )", true },
+            { "   (    2.5.4.3    DESC  ' syntax description'    )", true },
+            { "( 2.5.4.3 DESC syntax description )", false },
+            { "($%^*&!@ DESC 'syntax description' )", false },
+            { "(temp-oid DESC 'syntax description' )", true },
+            { "2.5.4.3 DESC 'syntax description' )", false },
+            { "(2.5.4.3 DESC 'syntax description' ", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_LDAP_SYNTAX_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_LDAP_SYNTAX_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java
index 487c37e..872c406 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,50 +25,39 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Matching rule syntax tests.
  */
-public class MatchingRuleSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        {
-            "( 1.2.3.4 NAME 'fullMatchingRule' "
-                + " DESC 'description of matching rule' OBSOLETE "
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
-                + " X-name ( 'this is an extension' ) )", true },
-        {
-            "( 1.2.3.4 NAME 'missingClosingParenthesis' "
-                + " DESC 'description of matching rule' "
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
-                + " X-name ( 'this is an extension' ) ", false }, };
-  }
+public class MatchingRuleSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            {
+                "( 1.2.3.4 NAME 'fullMatchingRule' "
+                        + " DESC 'description of matching rule' OBSOLETE "
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
+                        + " X-name ( 'this is an extension' ) )", true },
+            {
+                "( 1.2.3.4 NAME 'missingClosingParenthesis' "
+                        + " DESC 'description of matching rule' "
+                        + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
+                        + " X-name ( 'this is an extension' ) ", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java
index b4961f5..59e1a8b 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,113 +25,91 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.testng.Assert.assertEquals;
 
 import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test The equality matching rules and the equality matching rule api.
  */
 @SuppressWarnings("javadoc")
-public abstract class MatchingRuleTest extends SchemaTestCase
-{
-  /**
-   * Generate invalid assertion values for the Matching Rule test.
-   *
-   * @return the data for the EqualityMatchingRulesInvalidValuestest.
-   */
-  @DataProvider(name = "matchingRuleInvalidAssertionValues")
-  public Object[][] createMatchingRuleInvalidAssertionValues()
-  {
-    return createMatchingRuleInvalidAttributeValues();
-  }
+public abstract class MatchingRuleTest extends SchemaTestCase {
+    /**
+     * Generate invalid assertion values for the Matching Rule test.
+     *
+     * @return the data for the EqualityMatchingRulesInvalidValuestest.
+     */
+    @DataProvider(name = "matchingRuleInvalidAssertionValues")
+    public Object[][] createMatchingRuleInvalidAssertionValues() {
+        return createMatchingRuleInvalidAttributeValues();
+    }
 
+    /**
+     * Generate invalid attribute values for the Matching Rule test.
+     *
+     * @return the data for the EqualityMatchingRulesInvalidValuestest.
+     */
+    @DataProvider(name = "matchingRuleInvalidAttributeValues")
+    public abstract Object[][] createMatchingRuleInvalidAttributeValues();
 
+    /**
+     * Generate data for the Matching Rule test.
+     *
+     * @return the data for the equality matching rule test.
+     */
+    @DataProvider(name = "matchingrules")
+    public abstract Object[][] createMatchingRuleTest();
 
-  /**
-   * Generate invalid attribute values for the Matching Rule test.
-   *
-   * @return the data for the EqualityMatchingRulesInvalidValuestest.
-   */
-  @DataProvider(name = "matchingRuleInvalidAttributeValues")
-  public abstract Object[][] createMatchingRuleInvalidAttributeValues();
+    /**
+     * Test the normalization and the comparison of valid values.
+     */
+    @Test(dataProvider = "matchingrules")
+    public void matchingRules(final String value1, final String value2, final ConditionResult result)
+            throws Exception {
+        final MatchingRule rule = getRule();
 
+        // normalize the 2 provided values and check that they are equals
+        final ByteString normalizedValue1 =
+                rule.normalizeAttributeValue(ByteString.valueOf(value1));
+        final Assertion assertion = rule.getAssertion(ByteString.valueOf(value2));
 
+        final ConditionResult liveResult = assertion.matches(normalizedValue1);
+        assertEquals(result, liveResult);
+    }
 
-  /**
-   * Generate data for the Matching Rule test.
-   *
-   * @return the data for the equality matching rule test.
-   */
-  @DataProvider(name = "matchingrules")
-  public abstract Object[][] createMatchingRuleTest();
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "matchingRuleInvalidAssertionValues")
+    public void matchingRulesInvalidAssertionValues(final String value) throws Exception {
+        // Get the instance of the rule to be tested.
+        final MatchingRule rule = getRule();
 
+        rule.getAssertion(ByteString.valueOf(value));
+    }
 
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "matchingRuleInvalidAttributeValues")
+    public void matchingRulesInvalidAttributeValues(final String value) throws Exception {
+        // Get the instance of the rule to be tested.
+        final MatchingRule rule = getRule();
 
-  /**
-   * Test the normalization and the comparison of valid values.
-   */
-  @Test(dataProvider = "matchingrules")
-  public void matchingRules(final String value1, final String value2,
-      final ConditionResult result) throws Exception
-  {
-    final MatchingRule rule = getRule();
+        rule.normalizeAttributeValue(ByteString.valueOf(value));
+    }
 
-    // normalize the 2 provided values and check that they are equals
-    final ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString
-        .valueOf(value1));
-    final Assertion assertion = rule.getAssertion(ByteString.valueOf(value2));
-
-    final ConditionResult liveResult = assertion.matches(normalizedValue1);
-    assertEquals(result, liveResult);
-  }
-
-
-
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "matchingRuleInvalidAssertionValues")
-  public void matchingRulesInvalidAssertionValues(final String value)
-      throws Exception
-  {
-    // Get the instance of the rule to be tested.
-    final MatchingRule rule = getRule();
-
-    rule.getAssertion(ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "matchingRuleInvalidAttributeValues")
-  public void matchingRulesInvalidAttributeValues(final String value)
-      throws Exception
-  {
-    // Get the instance of the rule to be tested.
-    final MatchingRule rule = getRule();
-
-    rule.normalizeAttributeValue(ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * Get an instance of the matching rule.
-   *
-   * @return An instance of the matching rule to test.
-   */
-  protected abstract MatchingRule getRule();
+    /**
+     * Get an instance of the matching rule.
+     *
+     * @return An instance of the matching rule to test.
+     */
+    protected abstract MatchingRule getRule();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java
index 1369047..ffaa8d0 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,48 +25,36 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_USE_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Matching rule use syntax tests.
  */
-public class MatchingRuleUseSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        {
-            "( 2.5.13.10 NAME 'fullMatchingRule' "
-                + " DESC 'description of matching rule' OBSOLETE "
-                + " APPLIES 2.5.4.3 " + " X-name 'this is an extension' )",
-            true },
-        {
-            "( 2.5.13.10 NAME 'missingClosingParenthesis' "
-                + " DESC 'description of matching rule' " + " SYNTAX 2.5.4.3 "
-                + " X-name ( 'this is an extension' ) ", false }, };
-  }
+public class MatchingRuleUseSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            {
+                "( 2.5.13.10 NAME 'fullMatchingRule' "
+                        + " DESC 'description of matching rule' OBSOLETE " + " APPLIES 2.5.4.3 "
+                        + " X-name 'this is an extension' )", true },
+            {
+                "( 2.5.13.10 NAME 'missingClosingParenthesis' "
+                        + " DESC 'description of matching rule' " + " SYNTAX 2.5.4.3 "
+                        + " X-name ( 'this is an extension' ) ", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_USE_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_USE_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java
index ba8afdf..d8fe607 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,112 +25,89 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Ordering matching rule tests.
  */
 @SuppressWarnings("javadoc")
-public abstract class OrderingMatchingRuleTest extends SchemaTestCase
-{
-  /**
-   * Create data for the OrderingMatchingRulesInvalidValues test.
-   *
-   * @return The data for the OrderingMatchingRulesInvalidValues test.
-   */
-  @DataProvider(name = "OrderingMatchingRuleInvalidValues")
-  public abstract Object[][] createOrderingMatchingRuleInvalidValues();
+public abstract class OrderingMatchingRuleTest extends SchemaTestCase {
+    /**
+     * Create data for the OrderingMatchingRulesInvalidValues test.
+     *
+     * @return The data for the OrderingMatchingRulesInvalidValues test.
+     */
+    @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+    public abstract Object[][] createOrderingMatchingRuleInvalidValues();
 
+    /**
+     * Create data for the OrderingMatchingRules test.
+     *
+     * @return The data for the OrderingMatchingRules test.
+     */
+    @DataProvider(name = "Orderingmatchingrules")
+    public abstract Object[][] createOrderingMatchingRuleTestData();
 
+    /**
+     * Test the comparison of valid values.
+     */
+    @Test(dataProvider = "Orderingmatchingrules")
+    public void orderingMatchingRules(final String value1, final String value2, final int result)
+            throws Exception {
+        // Make sure that the specified class can be instantiated as a task.
+        final MatchingRule ruleInstance = getRule();
 
-  /**
-   * Create data for the OrderingMatchingRules test.
-   *
-   * @return The data for the OrderingMatchingRules test.
-   */
-  @DataProvider(name = "Orderingmatchingrules")
-  public abstract Object[][] createOrderingMatchingRuleTestData();
+        final ByteString normalizedValue1 =
+                ruleInstance.normalizeAttributeValue(ByteString.valueOf(value1));
+        final ByteString normalizedValue2 =
+                ruleInstance.normalizeAttributeValue(ByteString.valueOf(value2));
 
+        // Test the comparator
+        final int comp = ruleInstance.comparator().compare(normalizedValue1, normalizedValue2);
+        if (comp == 0) {
+            Assert.assertEquals(comp, result);
+        } else if (comp > 0) {
+            Assert.assertTrue(result > 0);
+        } else if (comp < 0) {
+            Assert.assertTrue(result < 0);
+        }
 
+        Assertion a = ruleInstance.getGreaterOrEqualAssertion(ByteString.valueOf(value2));
+        Assert.assertEquals(a.matches(normalizedValue1), result >= 0 ? ConditionResult.TRUE
+                : ConditionResult.FALSE);
 
-  /**
-   * Test the comparison of valid values.
-   */
-  @Test(dataProvider = "Orderingmatchingrules")
-  public void orderingMatchingRules(final String value1, final String value2,
-      final int result) throws Exception
-  {
-    // Make sure that the specified class can be instantiated as a task.
-    final MatchingRule ruleInstance = getRule();
+        a = ruleInstance.getLessOrEqualAssertion(ByteString.valueOf(value2));
+        Assert.assertEquals(a.matches(normalizedValue1), result <= 0 ? ConditionResult.TRUE
+                : ConditionResult.FALSE);
 
-    final ByteString normalizedValue1 = ruleInstance
-        .normalizeAttributeValue(ByteString.valueOf(value1));
-    final ByteString normalizedValue2 = ruleInstance
-        .normalizeAttributeValue(ByteString.valueOf(value2));
-
-    // Test the comparator
-    final int comp = ruleInstance.comparator().compare(normalizedValue1,
-        normalizedValue2);
-    if (comp == 0)
-    {
-      Assert.assertEquals(comp, result);
-    }
-    else if (comp > 0)
-    {
-      Assert.assertTrue(result > 0);
-    }
-    else if (comp < 0)
-    {
-      Assert.assertTrue(result < 0);
+        a = ruleInstance.getAssertion(ByteString.valueOf(value2));
+        Assert.assertEquals(a.matches(normalizedValue1), result < 0 ? ConditionResult.TRUE
+                : ConditionResult.FALSE);
     }
 
-    Assertion a = ruleInstance.getGreaterOrEqualAssertion(ByteString
-        .valueOf(value2));
-    Assert.assertEquals(a.matches(normalizedValue1),
-        result >= 0 ? ConditionResult.TRUE : ConditionResult.FALSE);
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "OrderingMatchingRuleInvalidValues")
+    public void orderingMatchingRulesInvalidValues(final String value) throws Exception {
+        // Make sure that the specified class can be instantiated as a task.
+        final MatchingRule ruleInstance = getRule();
 
-    a = ruleInstance.getLessOrEqualAssertion(ByteString.valueOf(value2));
-    Assert.assertEquals(a.matches(normalizedValue1),
-        result <= 0 ? ConditionResult.TRUE : ConditionResult.FALSE);
+        // normalize the 2 provided values
+        ruleInstance.normalizeAttributeValue(ByteString.valueOf(value));
+    }
 
-    a = ruleInstance.getAssertion(ByteString.valueOf(value2));
-    Assert.assertEquals(a.matches(normalizedValue1),
-        result < 0 ? ConditionResult.TRUE : ConditionResult.FALSE);
-  }
-
-
-
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "OrderingMatchingRuleInvalidValues")
-  public void orderingMatchingRulesInvalidValues(final String value)
-      throws Exception
-  {
-    // Make sure that the specified class can be instantiated as a task.
-    final MatchingRule ruleInstance = getRule();
-
-    // normalize the 2 provided values
-    ruleInstance.normalizeAttributeValue(ByteString.valueOf(value));
-  }
-
-
-
-  /**
-   * Get the Ordering matching Rules that is to be tested.
-   *
-   * @return The Ordering matching Rules that is to be tested.
-   */
-  protected abstract MatchingRule getRule();
+    /**
+     * Get the Ordering matching Rules that is to be tested.
+     *
+     * @return The Ordering matching Rules that is to be tested.
+     */
+    protected abstract MatchingRule getRule();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java
index 1a7cfa4..b02f533 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,40 +25,28 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OTHER_MAILBOX_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Other mailbox syntax tests.
  */
-public class OtherMailboxSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "MyMail$Mymailbox", true },
-        { "MyMailMymailbox", false }, };
-  }
+public class OtherMailboxSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "MyMail$Mymailbox", true }, { "MyMailMymailbox", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_OTHER_MAILBOX_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_OTHER_MAILBOX_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java
index a657195..efb4175 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,74 +25,53 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import java.util.regex.Pattern;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.SchemaBuilder;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Regex syntax tests.
  */
 @SuppressWarnings("javadoc")
-public class RegexSyntaxTestCase extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "invalid regex", false }, { "host:0.0.0", true }, };
-  }
+public class RegexSyntaxTestCase extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "invalid regex", false }, { "host:0.0.0", true }, };
+    }
 
+    @Test
+    public void testDecode() {
+        // This should fail due to invalid pattern.
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' "
+                + " X-PATTERN '^[a-z-A-Z]+:[0-9.]+\\d$' )", true);
+        builder.toSchema();
+    }
 
+    @Test
+    public void testInvalidPattern() {
+        // This should fail due to invalid pattern.
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' "
+                + " X-PATTERN '^[a-z-A-Z+:[0-@.]+\\d$' )", true);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  @Test
-  public void testDecode()
-  {
-    // This should fail due to invalid pattern.
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax(
-        "( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' "
-            + " X-PATTERN '^[a-z-A-Z]+:[0-9.]+\\d$' )", true);
-    builder.toSchema();
-  }
-
-
-
-  @Test
-  public void testInvalidPattern()
-  {
-    // This should fail due to invalid pattern.
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax(
-        "( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' "
-            + " X-PATTERN '^[a-z-A-Z+:[0-@.]+\\d$' )", true);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addPatternSyntax("1.1.1",
-        "Host and Port in the format of HOST:PORT", Pattern
-            .compile("^[a-z-A-Z]+:[0-9.]+\\d$"), false);
-    return builder.toSchema().getSyntax("1.1.1");
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addPatternSyntax("1.1.1", "Host and Port in the format of HOST:PORT", Pattern
+                .compile("^[a-z-A-Z]+:[0-9.]+\\d$"), false);
+        return builder.toSchema().getSyntax("1.1.1");
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTest.java
index 3b6125c..1174f0d 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,397 +25,325 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.fest.assertions.Assertions.assertThat;
 import static org.fest.assertions.Fail.fail;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Test SchemaBuilder.
  */
-public class SchemaBuilderTest extends SchemaTestCase
-{
+public class SchemaBuilderTest extends SchemaTestCase {
 
-  /**
-   * Tests that schema validation resolves dependencies between parent/child
-   * attribute types regardless of the order in which they were added.
-   */
-  @Test
-  public void testAttributeTypeDependenciesChildThenParent()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )",
-            false)
-        .addAttributeType(
-            "( parenttype-oid NAME 'parenttype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-            false).toSchema();
-    assertThat(schema.getAttributeType("childtype").getSyntax()).isNotNull();
-    assertThat(schema.getAttributeType("childtype").getSyntax().getOID())
-        .isEqualTo("1.3.6.1.4.1.1466.115.121.1.15");
-  }
-
-
-
-  /**
-   * Tests that schema validation resolves dependencies between parent/child
-   * attribute types regardless of the order in which they were added.
-   */
-  @Test
-  public void testAttributeTypeDependenciesParentThenChild()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addAttributeType(
-            "( parenttype-oid NAME 'parenttype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-            false)
-        .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )",
-            false).toSchema();
-    assertThat(schema.getAttributeType("childtype").getSyntax()).isNotNull();
-    assertThat(schema.getAttributeType("childtype").getSyntax().getOID())
-        .isEqualTo("1.3.6.1.4.1.1466.115.121.1.15");
-  }
-
-
-
-  /**
-   * Tests that attribute types must have a syntax or a superior.
-   */
-  @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testAttributeTypeNoSuperiorNoSyntax()
-  {
-    new SchemaBuilder(Schema.getCoreSchema()).addAttributeType(
-        "( parenttype-oid NAME 'parenttype' )", false);
-  }
-
-
-
-  /**
-   * Tests that schema validation handles validation failures for superior
-   * attribute types regardless of the order.
-   */
-  @Test
-  public void testAttributeTypeSuperiorFailureChildThenParent()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )",
-            false)
-        .addAttributeType("( parenttype-oid NAME 'parenttype' SUP xxx )", false)
-        .toSchema();
-
-    try
-    {
-      schema.getAttributeType("childtype");
-      fail("childtype should not be in the schema because its parent is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
+    /**
+     * Tests that schema validation resolves dependencies between parent/child
+     * attribute types regardless of the order in which they were added.
+     */
+    @Test
+    public void testAttributeTypeDependenciesChildThenParent() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )",
+                                false)
+                        .addAttributeType(
+                                "( parenttype-oid NAME 'parenttype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
+                                false).toSchema();
+        assertThat(schema.getAttributeType("childtype").getSyntax()).isNotNull();
+        assertThat(schema.getAttributeType("childtype").getSyntax().getOID()).isEqualTo(
+                "1.3.6.1.4.1.1466.115.121.1.15");
     }
 
-    try
-    {
-      schema.getAttributeType("parenttype");
-      fail("parenttype should not be in the schema because it is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
-    }
-  }
-
-
-
-  /**
-   * Tests that schema validation handles validation failures for superior
-   * attribute types regardless of the order.
-   */
-  @Test
-  public void testAttributeTypeSuperiorFailureParentThenChild()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addAttributeType("( parenttype-oid NAME 'parenttype' SUP xxx )", false)
-        .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )",
-            false).toSchema();
-
-    try
-    {
-      schema.getAttributeType("childtype");
-      fail("childtype should not be in the schema because its parent is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
+    /**
+     * Tests that schema validation resolves dependencies between parent/child
+     * attribute types regardless of the order in which they were added.
+     */
+    @Test
+    public void testAttributeTypeDependenciesParentThenChild() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .addAttributeType(
+                                "( parenttype-oid NAME 'parenttype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
+                                false).addAttributeType(
+                                "( childtype-oid NAME 'childtype' SUP parenttype )", false)
+                        .toSchema();
+        assertThat(schema.getAttributeType("childtype").getSyntax()).isNotNull();
+        assertThat(schema.getAttributeType("childtype").getSyntax().getOID()).isEqualTo(
+                "1.3.6.1.4.1.1466.115.121.1.15");
     }
 
-    try
-    {
-      schema.getAttributeType("parenttype");
-      fail("parenttype should not be in the schema because it is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
-    }
-  }
-
-
-
-  /**
-   * Test for OPENDJ-156: Errors when parsing collective attribute definitions.
-   */
-  @Test
-  public void testCollectiveAttribute()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addAttributeType(
-            "( 2.5.4.11.1 NAME 'c-ou' "
-                + "SUP ou SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
-                + "COLLECTIVE X-ORIGIN 'RFC 3671' )", false).toSchema();
-    assertThat(schema.getWarnings()).isEmpty();
-  }
-
-
-
-  /**
-   * Tests that it is possible to create a schema which is an exact copy of
-   * another and take advantage of copy on write.
-   */
-  @Test
-  public void testCopyOnWriteNoChanges()
-  {
-    final Schema baseSchema = Schema.getCoreSchema();
-    final Schema schema = new SchemaBuilder(baseSchema).toSchema();
-
-    assertThat(schema).isSameAs(baseSchema);
-  }
-
-
-
-  /**
-   * Tests that it is possible to create a schema which is based on another.
-   */
-  @Test
-  public void testCopyOnWriteWithChanges()
-  {
-    final Schema baseSchema = Schema.getCoreSchema();
-    final Schema schema = new SchemaBuilder(baseSchema).addAttributeType(
-        "( testtype-oid NAME 'testtype' SUP name )", false).toSchema();
-    assertThat(schema).isNotSameAs(baseSchema);
-    assertThat(schema.getObjectClasses().containsAll(
-        baseSchema.getObjectClasses()));
-    assertThat(schema.getObjectClasses().size()).isEqualTo(
-        baseSchema.getObjectClasses().size());
-    assertThat(schema.getAttributeTypes().containsAll(
-        baseSchema.getAttributeTypes()));
-    assertThat(schema.getAttributeType("testtype")).isNotNull();
-    assertThat(schema.getSchemaName()).isEqualTo(baseSchema.getSchemaName());
-    assertThat(schema.allowMalformedNamesAndOptions()).isEqualTo(
-        baseSchema.allowMalformedNamesAndOptions());
-  }
-
-
-
-  /**
-   * Tests that it is possible to create an empty schema.
-   */
-  @Test
-  public void testCreateEmptySchema()
-  {
-    final Schema schema = new SchemaBuilder().toSchema();
-    assertThat(schema.getAttributeTypes()).isEmpty();
-    assertThat(schema.getObjectClasses()).isEmpty();
-    assertThat(schema.getSyntaxes()).isEmpty();
-    assertThat(schema.getWarnings()).isEmpty();
-    // Could go on...
-  }
-
-
-
-  /**
-   * Tests that multiple consecutive invocations of toSchema return the exact
-   * same schema.
-   */
-  @Test
-  public void testMultipleToSchema1()
-  {
-    final Schema baseSchema = Schema.getCoreSchema();
-    final SchemaBuilder builder = new SchemaBuilder(baseSchema);
-    final Schema schema1 = builder.toSchema();
-    final Schema schema2 = builder.toSchema();
-    assertThat(schema1).isSameAs(baseSchema);
-    assertThat(schema1).isSameAs(schema2);
-  }
-
-
-
-  /**
-   * Tests that multiple consecutive invocations of toSchema return the exact
-   * same schema.
-   */
-  @Test
-  public void testMultipleToSchema2()
-  {
-    final SchemaBuilder builder = new SchemaBuilder()
-        .addAttributeType(
-            "( testtype-oid NAME 'testtype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
-            false);
-    final Schema schema1 = builder.toSchema();
-    final Schema schema2 = builder.toSchema();
-    assertThat(schema1).isSameAs(schema2);
-    assertThat(schema1.getAttributeType("testtype")).isNotNull();
-    assertThat(schema2.getAttributeType("testtype")).isNotNull();
-  }
-
-
-
-  /**
-   * Tests that schema validation resolves dependencies between parent/child
-   * object classes regardless of the order in which they were added.
-   */
-  @Test
-  public void testObjectClassDependenciesChildThenParent()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addObjectClass(
-            "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
-            false)
-        .addObjectClass(
-            "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST cn )",
-            false).toSchema();
-
-    final AttributeType cn = schema.getAttributeType("cn");
-    final AttributeType sn = schema.getAttributeType("sn");
-
-    assertThat(schema.getObjectClass("childtype").isRequired(cn)).isTrue();
-    assertThat(schema.getObjectClass("childtype").isRequired(sn)).isTrue();
-  }
-
-
-
-  /**
-   * Tests that schema validation resolves dependencies between parent/child
-   * object classes regardless of the order in which they were added.
-   */
-  @Test
-  public void testObjectClassDependenciesParentThenChild()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addObjectClass(
-            "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST cn )",
-            false)
-        .addObjectClass(
-            "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
-            false).toSchema();
-
-    final AttributeType cn = schema.getAttributeType("cn");
-    final AttributeType sn = schema.getAttributeType("sn");
-
-    assertThat(schema.getObjectClass("childtype").isRequired(cn)).isTrue();
-    assertThat(schema.getObjectClass("childtype").isRequired(sn)).isTrue();
-  }
-
-
-
-  /**
-   * Tests that schema validation handles validation failures for superior
-   * object classes regardless of the order.
-   */
-  @Test
-  public void testObjectClassSuperiorFailureChildThenParent()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addObjectClass(
-            "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
-            false)
-        .addObjectClass(
-            "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST xxx )",
-            false).toSchema();
-
-    try
-    {
-      schema.getObjectClass("childtype");
-      fail("childtype should not be in the schema because its parent is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
+    /**
+     * Tests that attribute types must have a syntax or a superior.
+     */
+    @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testAttributeTypeNoSuperiorNoSyntax() {
+        new SchemaBuilder(Schema.getCoreSchema()).addAttributeType(
+                "( parenttype-oid NAME 'parenttype' )", false);
     }
 
-    try
-    {
-      schema.getObjectClass("parenttype");
-      fail("parenttype should not be in the schema because it is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
-    }
-  }
+    /**
+     * Tests that schema validation handles validation failures for superior
+     * attribute types regardless of the order.
+     */
+    @Test
+    public void testAttributeTypeSuperiorFailureChildThenParent() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema()).addAttributeType(
+                        "( childtype-oid NAME 'childtype' SUP parenttype )", false)
+                        .addAttributeType("( parenttype-oid NAME 'parenttype' SUP xxx )", false)
+                        .toSchema();
 
+        try {
+            schema.getAttributeType("childtype");
+            fail("childtype should not be in the schema because its parent is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
 
-
-  /**
-   * Tests that schema validation handles validation failures for superior
-   * object classes regardless of the order.
-   */
-  @Test
-  public void testObjectClassSuperiorFailureParentThenChild()
-  {
-    final Schema schema = new SchemaBuilder(Schema.getCoreSchema())
-        .addObjectClass(
-            "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST xxx )",
-            false)
-        .addObjectClass(
-            "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
-            false).toSchema();
-
-    try
-    {
-      schema.getObjectClass("childtype");
-      fail("childtype should not be in the schema because its parent is invalid");
-    }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
+        try {
+            schema.getAttributeType("parenttype");
+            fail("parenttype should not be in the schema because it is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
     }
 
-    try
-    {
-      schema.getObjectClass("parenttype");
-      fail("parenttype should not be in the schema because it is invalid");
+    /**
+     * Tests that schema validation handles validation failures for superior
+     * attribute types regardless of the order.
+     */
+    @Test
+    public void testAttributeTypeSuperiorFailureParentThenChild() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema()).addAttributeType(
+                        "( parenttype-oid NAME 'parenttype' SUP xxx )", false).addAttributeType(
+                        "( childtype-oid NAME 'childtype' SUP parenttype )", false).toSchema();
+
+        try {
+            schema.getAttributeType("childtype");
+            fail("childtype should not be in the schema because its parent is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
+
+        try {
+            schema.getAttributeType("parenttype");
+            fail("parenttype should not be in the schema because it is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
     }
-    catch (final UnknownSchemaElementException e)
-    {
-      // Expected.
+
+    /**
+     * Test for OPENDJ-156: Errors when parsing collective attribute
+     * definitions.
+     */
+    @Test
+    public void testCollectiveAttribute() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema()).addAttributeType(
+                        "( 2.5.4.11.1 NAME 'c-ou' "
+                                + "SUP ou SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
+                                + "COLLECTIVE X-ORIGIN 'RFC 3671' )", false).toSchema();
+        assertThat(schema.getWarnings()).isEmpty();
     }
-  }
 
+    /**
+     * Tests that it is possible to create a schema which is an exact copy of
+     * another and take advantage of copy on write.
+     */
+    @Test
+    public void testCopyOnWriteNoChanges() {
+        final Schema baseSchema = Schema.getCoreSchema();
+        final Schema schema = new SchemaBuilder(baseSchema).toSchema();
 
+        assertThat(schema).isSameAs(baseSchema);
+    }
 
-  /**
-   * Tests that a schema builder can be re-used after toSchema has been called.
-   */
-  @Test
-  public void testReuseSchemaBuilder()
-  {
-    final SchemaBuilder builder = new SchemaBuilder();
-    final Schema schema1 = builder
-        .addAttributeType(
-            "( testtype1-oid NAME 'testtype1' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
-            false).toSchema();
+    /**
+     * Tests that it is possible to create a schema which is based on another.
+     */
+    @Test
+    public void testCopyOnWriteWithChanges() {
+        final Schema baseSchema = Schema.getCoreSchema();
+        final Schema schema =
+                new SchemaBuilder(baseSchema).addAttributeType(
+                        "( testtype-oid NAME 'testtype' SUP name )", false).toSchema();
+        assertThat(schema).isNotSameAs(baseSchema);
+        assertThat(schema.getObjectClasses().containsAll(baseSchema.getObjectClasses()));
+        assertThat(schema.getObjectClasses().size())
+                .isEqualTo(baseSchema.getObjectClasses().size());
+        assertThat(schema.getAttributeTypes().containsAll(baseSchema.getAttributeTypes()));
+        assertThat(schema.getAttributeType("testtype")).isNotNull();
+        assertThat(schema.getSchemaName()).isEqualTo(baseSchema.getSchemaName());
+        assertThat(schema.allowMalformedNamesAndOptions()).isEqualTo(
+                baseSchema.allowMalformedNamesAndOptions());
+    }
 
-    final Schema schema2 = builder
-        .addAttributeType(
-            "( testtype2-oid NAME 'testtype2' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
-            false).toSchema();
-    assertThat(schema1).isNotSameAs(schema2);
-    assertThat(schema1.getAttributeType("testtype1")).isNotNull();
-    assertThat(schema1.hasAttributeType("testtype2")).isFalse();
-    assertThat(schema2.getAttributeType("testtype1")).isNotNull();
-    assertThat(schema2.getAttributeType("testtype2")).isNotNull();
-  }
+    /**
+     * Tests that it is possible to create an empty schema.
+     */
+    @Test
+    public void testCreateEmptySchema() {
+        final Schema schema = new SchemaBuilder().toSchema();
+        assertThat(schema.getAttributeTypes()).isEmpty();
+        assertThat(schema.getObjectClasses()).isEmpty();
+        assertThat(schema.getSyntaxes()).isEmpty();
+        assertThat(schema.getWarnings()).isEmpty();
+        // Could go on...
+    }
+
+    /**
+     * Tests that multiple consecutive invocations of toSchema return the exact
+     * same schema.
+     */
+    @Test
+    public void testMultipleToSchema1() {
+        final Schema baseSchema = Schema.getCoreSchema();
+        final SchemaBuilder builder = new SchemaBuilder(baseSchema);
+        final Schema schema1 = builder.toSchema();
+        final Schema schema2 = builder.toSchema();
+        assertThat(schema1).isSameAs(baseSchema);
+        assertThat(schema1).isSameAs(schema2);
+    }
+
+    /**
+     * Tests that multiple consecutive invocations of toSchema return the exact
+     * same schema.
+     */
+    @Test
+    public void testMultipleToSchema2() {
+        final SchemaBuilder builder =
+                new SchemaBuilder().addAttributeType(
+                        "( testtype-oid NAME 'testtype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
+                        false);
+        final Schema schema1 = builder.toSchema();
+        final Schema schema2 = builder.toSchema();
+        assertThat(schema1).isSameAs(schema2);
+        assertThat(schema1.getAttributeType("testtype")).isNotNull();
+        assertThat(schema2.getAttributeType("testtype")).isNotNull();
+    }
+
+    /**
+     * Tests that schema validation resolves dependencies between parent/child
+     * object classes regardless of the order in which they were added.
+     */
+    @Test
+    public void testObjectClassDependenciesChildThenParent() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema()).addObjectClass(
+                        "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
+                        false).addObjectClass(
+                        "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST cn )", false)
+                        .toSchema();
+
+        final AttributeType cn = schema.getAttributeType("cn");
+        final AttributeType sn = schema.getAttributeType("sn");
+
+        assertThat(schema.getObjectClass("childtype").isRequired(cn)).isTrue();
+        assertThat(schema.getObjectClass("childtype").isRequired(sn)).isTrue();
+    }
+
+    /**
+     * Tests that schema validation resolves dependencies between parent/child
+     * object classes regardless of the order in which they were added.
+     */
+    @Test
+    public void testObjectClassDependenciesParentThenChild() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .addObjectClass(
+                                "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST cn )",
+                                false)
+                        .addObjectClass(
+                                "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
+                                false).toSchema();
+
+        final AttributeType cn = schema.getAttributeType("cn");
+        final AttributeType sn = schema.getAttributeType("sn");
+
+        assertThat(schema.getObjectClass("childtype").isRequired(cn)).isTrue();
+        assertThat(schema.getObjectClass("childtype").isRequired(sn)).isTrue();
+    }
+
+    /**
+     * Tests that schema validation handles validation failures for superior
+     * object classes regardless of the order.
+     */
+    @Test
+    public void testObjectClassSuperiorFailureChildThenParent() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema()).addObjectClass(
+                        "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
+                        false).addObjectClass(
+                        "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST xxx )", false)
+                        .toSchema();
+
+        try {
+            schema.getObjectClass("childtype");
+            fail("childtype should not be in the schema because its parent is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
+
+        try {
+            schema.getObjectClass("parenttype");
+            fail("parenttype should not be in the schema because it is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
+    }
+
+    /**
+     * Tests that schema validation handles validation failures for superior
+     * object classes regardless of the order.
+     */
+    @Test
+    public void testObjectClassSuperiorFailureParentThenChild() {
+        final Schema schema =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .addObjectClass(
+                                "( parenttype-oid NAME 'parenttype' SUP top STRUCTURAL MUST xxx )",
+                                false)
+                        .addObjectClass(
+                                "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )",
+                                false).toSchema();
+
+        try {
+            schema.getObjectClass("childtype");
+            fail("childtype should not be in the schema because its parent is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
+
+        try {
+            schema.getObjectClass("parenttype");
+            fail("parenttype should not be in the schema because it is invalid");
+        } catch (final UnknownSchemaElementException e) {
+            // Expected.
+        }
+    }
+
+    /**
+     * Tests that a schema builder can be re-used after toSchema has been
+     * called.
+     */
+    @Test
+    public void testReuseSchemaBuilder() {
+        final SchemaBuilder builder = new SchemaBuilder();
+        final Schema schema1 =
+                builder.addAttributeType(
+                        "( testtype1-oid NAME 'testtype1' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
+                        false).toSchema();
+
+        final Schema schema2 =
+                builder.addAttributeType(
+                        "( testtype2-oid NAME 'testtype2' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
+                        false).toSchema();
+        assertThat(schema1).isNotSameAs(schema2);
+        assertThat(schema1.getAttributeType("testtype1")).isNotNull();
+        assertThat(schema1.hasAttributeType("testtype2")).isFalse();
+        assertThat(schema2.getAttributeType("testtype1")).isNotNull();
+        assertThat(schema2.getAttributeType("testtype2")).isNotNull();
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java
index 17297c0..040ab84 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,326 +25,291 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Tests schema compatibility options.
  */
-public class SchemaCompatTest extends SchemaTestCase
-{
-  /**
-   * Returns test data for valid attribute descriptions.
-   *
-   * @return The test data.
-   */
-  @DataProvider
-  public Object[][] validAttributeDescriptions()
-  {
-    // @formatter:off
-    return new Object[][] {
-        // No options.
-        { "cn", false },
-        { "cn-xxx", false },
-        { "cn", true },
-        { "cn-xxx", true },
-        { "cn_xxx", true },
-        { "cn.xxx", true },
-        // With options.
-        { "cn;xxx", false },
-        { "cn;xxx-yyy", false },
-        { "cn;xxx", true },
-        { "cn;xxx-yyy", true },
-        { "cn;xxx_yyy", true },
-        { "cn;xxx.yyy", true },
-    };
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Tests valid attribute description parsing behavior depends on compat
-   * options.
-   *
-   * @param atd
-   *          The attribute description to be parsed.
-   * @param allowIllegalCharacters
-   *          {@code true} if the attribute description requires the
-   *          compatibility option to be set.
-   */
-  @Test(dataProvider = "validAttributeDescriptions")
-  public void testValidAttributeDescriptions(String atd,
-      boolean allowIllegalCharacters)
-  {
-    SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema())
-        .allowMalformedNamesAndOptions(allowIllegalCharacters);
-    Schema schema = builder.toSchema().asNonStrictSchema();
-    AttributeDescription.valueOf(atd, schema);
-  }
-
-
-
-  /**
-   * Returns test data for invalid attribute descriptions.
-   *
-   * @return The test data.
-   */
-  @DataProvider
-  public Object[][] invalidAttributeDescriptions()
-  {
-    // @formatter:off
-    return new Object[][] {
-        // No options.
-        { "cn+xxx", false }, // always invalid
-        { "cn_xxx", false },
-        { "cn.xxx", false },
-        { "cn+xxx", true }, // always invalid
-        // With options.
-        { "cn;xxx+yyy", false }, // always invalid
-        { "cn;xxx_yyy", false },
-        { "cn;xxx.yyy", false },
-        { "cn;xxx+yyy", true }, // always invalid
-    };
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Tests invalid attribute description parsing behavior depends on compat
-   * options.
-   *
-   * @param atd
-   *          The attribute description to be parsed.
-   * @param allowIllegalCharacters
-   *          {@code true} if the attribute description requires the
-   *          compatibility option to be set.
-   */
-  @Test(dataProvider = "invalidAttributeDescriptions", expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testInvalidAttributeDescriptions(String atd,
-      boolean allowIllegalCharacters)
-  {
-    SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema())
-        .allowMalformedNamesAndOptions(allowIllegalCharacters);
-    Schema schema = builder.toSchema().asNonStrictSchema();
-    AttributeDescription.valueOf(atd, schema);
-  }
-
-
-
-  private static final Syntax ATD_SYNTAX = CoreSchema
-      .getAttributeTypeDescriptionSyntax();
-  private static final Syntax OCD_SYNTAX = CoreSchema
-      .getObjectClassDescriptionSyntax();
-
-
-
-  /**
-   * Returns test data for invalid schema elements.
-   *
-   * @return The test data.
-   */
-  @DataProvider
-  public Object[][] invalidSchemaElements()
-  {
-    // @formatter:off
-    return new Object[][] {
-        { "(testtype+oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(testtype_oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(testtype.oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(1.2.8.5 NAME 'test+type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(1.2.8.5 NAME 'test.type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(1.2.8.5 NAME 'test_type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(1.2.8.5 NAME 'test+type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          true
-        },
-    };
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Test schema builder schema element parsing with compat chars.
-   *
-   * @param element
-   *          The schema element.
-   * @param syntax
-   *          The type of element.
-   * @param allowIllegalCharacters
-   *          {@code true} if the element requires the compatibility option to
-   *          be set.
-   */
-  @Test(dataProvider = "invalidSchemaElements", expectedExceptions = LocalizedIllegalArgumentException.class)
-  public void testInvalidSchemaBuilderElementParsers(String element,
-      Syntax syntax, boolean allowIllegalCharacters)
-  {
-    SchemaBuilder builder = new SchemaBuilder()
-        .allowMalformedNamesAndOptions(allowIllegalCharacters);
-
-    if (syntax == ATD_SYNTAX)
-    {
-      builder.addAttributeType(element, false);
+public class SchemaCompatTest extends SchemaTestCase {
+    /**
+     * Returns test data for valid attribute descriptions.
+     *
+     * @return The test data.
+     */
+    @DataProvider
+    public Object[][] validAttributeDescriptions() {
+        // @formatter:off
+        return new Object[][] {
+            // No options.
+            { "cn", false },
+            { "cn-xxx", false },
+            { "cn", true },
+            { "cn-xxx", true },
+            { "cn_xxx", true },
+            { "cn.xxx", true },
+            // With options.
+            { "cn;xxx", false },
+            { "cn;xxx-yyy", false },
+            { "cn;xxx", true },
+            { "cn;xxx-yyy", true },
+            { "cn;xxx_yyy", true },
+            { "cn;xxx.yyy", true },
+        };
+        // @formatter:on
     }
-    else if (syntax == OCD_SYNTAX)
-    {
-      builder.addObjectClass(element, false);
+
+    /**
+     * Tests valid attribute description parsing behavior depends on compat
+     * options.
+     *
+     * @param atd
+     *            The attribute description to be parsed.
+     * @param allowIllegalCharacters
+     *            {@code true} if the attribute description requires the
+     *            compatibility option to be set.
+     */
+    @Test(dataProvider = "validAttributeDescriptions")
+    public void testValidAttributeDescriptions(String atd, boolean allowIllegalCharacters) {
+        SchemaBuilder builder =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .allowMalformedNamesAndOptions(allowIllegalCharacters);
+        Schema schema = builder.toSchema().asNonStrictSchema();
+        AttributeDescription.valueOf(atd, schema);
     }
-  }
 
-
-
-  /**
-   * Returns test data for valid schema elements.
-   *
-   * @return The test data.
-   */
-  @DataProvider
-  public Object[][] validSchemaElements()
-  {
-    // @formatter:off
-    return new Object[][] {
-        { "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(testtype-oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(testtype_oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          true
-        },
-        { "(testtype.oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
-                     + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                     + " SUBSTR caseIgnoreSubstringsMatch"
-                     + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                     + " USAGE userApplications )",
-          ATD_SYNTAX,
-          true
-        },
-        { "(1.2.8.5 NAME 'test-type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          false
-        },
-        { "(1.2.8.5 NAME 'test.type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          true
-        },
-        { "(1.2.8.5 NAME 'test_type' DESC 'full type' OBSOLETE SUP cn "
-                + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
-                + " SUBSTR caseIgnoreSubstringsMatch"
-                + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
-                + " USAGE userApplications )",
-          ATD_SYNTAX,
-          true
-        },
-    };
-    // @formatter:on
-  }
-
-
-
-  /**
-   * Test schema builder schema element parsing with compat chars.
-   *
-   * @param element
-   *          The schema element.
-   * @param syntax
-   *          The type of element.
-   * @param allowIllegalCharacters
-   *          {@code true} if the element requires the compatibility option to
-   *          be set.
-   */
-  @Test(dataProvider = "validSchemaElements")
-  public void testValidSchemaBuilderElementParsers(String element,
-      Syntax syntax, boolean allowIllegalCharacters)
-  {
-    SchemaBuilder builder = new SchemaBuilder()
-        .allowMalformedNamesAndOptions(allowIllegalCharacters);
-
-    if (syntax == ATD_SYNTAX)
-    {
-      builder.addAttributeType(element, false);
+    /**
+     * Returns test data for invalid attribute descriptions.
+     *
+     * @return The test data.
+     */
+    @DataProvider
+    public Object[][] invalidAttributeDescriptions() {
+        // @formatter:off
+        return new Object[][] {
+            // No options.
+            { "cn+xxx", false }, // always invalid
+            { "cn_xxx", false },
+            { "cn.xxx", false },
+            { "cn+xxx", true }, // always invalid
+            // With options.
+            { "cn;xxx+yyy", false }, // always invalid
+            { "cn;xxx_yyy", false },
+            { "cn;xxx.yyy", false },
+            { "cn;xxx+yyy", true }, // always invalid
+        };
+        // @formatter:on
     }
-    else if (syntax == OCD_SYNTAX)
-    {
-      builder.addObjectClass(element, false);
+
+    /**
+     * Tests invalid attribute description parsing behavior depends on compat
+     * options.
+     *
+     * @param atd
+     *            The attribute description to be parsed.
+     * @param allowIllegalCharacters
+     *            {@code true} if the attribute description requires the
+     *            compatibility option to be set.
+     */
+    @Test(dataProvider = "invalidAttributeDescriptions",
+            expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testInvalidAttributeDescriptions(String atd, boolean allowIllegalCharacters) {
+        SchemaBuilder builder =
+                new SchemaBuilder(Schema.getCoreSchema())
+                        .allowMalformedNamesAndOptions(allowIllegalCharacters);
+        Schema schema = builder.toSchema().asNonStrictSchema();
+        AttributeDescription.valueOf(atd, schema);
     }
-  }
+
+    private static final Syntax ATD_SYNTAX = CoreSchema.getAttributeTypeDescriptionSyntax();
+    private static final Syntax OCD_SYNTAX = CoreSchema.getObjectClassDescriptionSyntax();
+
+    /**
+     * Returns test data for invalid schema elements.
+     *
+     * @return The test data.
+     */
+    @DataProvider
+    public Object[][] invalidSchemaElements() {
+        // @formatter:off
+        return new Object[][] {
+            { "(testtype+oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(testtype_oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(testtype.oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(1.2.8.5 NAME 'test+type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(1.2.8.5 NAME 'test.type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(1.2.8.5 NAME 'test_type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(1.2.8.5 NAME 'test+type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              true
+            },
+        };
+        // @formatter:on
+    }
+
+    /**
+     * Test schema builder schema element parsing with compat chars.
+     *
+     * @param element
+     *            The schema element.
+     * @param syntax
+     *            The type of element.
+     * @param allowIllegalCharacters
+     *            {@code true} if the element requires the compatibility option
+     *            to be set.
+     */
+    @Test(dataProvider = "invalidSchemaElements",
+            expectedExceptions = LocalizedIllegalArgumentException.class)
+    public void testInvalidSchemaBuilderElementParsers(String element, Syntax syntax,
+            boolean allowIllegalCharacters) {
+        SchemaBuilder builder =
+                new SchemaBuilder().allowMalformedNamesAndOptions(allowIllegalCharacters);
+
+        if (syntax == ATD_SYNTAX) {
+            builder.addAttributeType(element, false);
+        } else if (syntax == OCD_SYNTAX) {
+            builder.addObjectClass(element, false);
+        }
+    }
+
+    /**
+     * Returns test data for valid schema elements.
+     *
+     * @return The test data.
+     */
+    @DataProvider
+    public Object[][] validSchemaElements() {
+        // @formatter:off
+        return new Object[][] {
+            { "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(testtype-oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(testtype_oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              true
+            },
+            { "(testtype.oid NAME 'testtype' DESC 'full type' OBSOLETE SUP cn "
+                         + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                         + " SUBSTR caseIgnoreSubstringsMatch"
+                         + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                         + " USAGE userApplications )",
+              ATD_SYNTAX,
+              true
+            },
+            { "(1.2.8.5 NAME 'test-type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              false
+            },
+            { "(1.2.8.5 NAME 'test.type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              true
+            },
+            { "(1.2.8.5 NAME 'test_type' DESC 'full type' OBSOLETE SUP cn "
+                    + " EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch"
+                    + " SUBSTR caseIgnoreSubstringsMatch"
+                    + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE"
+                    + " USAGE userApplications )",
+              ATD_SYNTAX,
+              true
+            },
+        };
+        // @formatter:on
+    }
+
+    /**
+     * Test schema builder schema element parsing with compat chars.
+     *
+     * @param element
+     *            The schema element.
+     * @param syntax
+     *            The type of element.
+     * @param allowIllegalCharacters
+     *            {@code true} if the element requires the compatibility option
+     *            to be set.
+     */
+    @Test(dataProvider = "validSchemaElements")
+    public void testValidSchemaBuilderElementParsers(String element, Syntax syntax,
+            boolean allowIllegalCharacters) {
+        SchemaBuilder builder =
+                new SchemaBuilder().allowMalformedNamesAndOptions(allowIllegalCharacters);
+
+        if (syntax == ATD_SYNTAX) {
+            builder.addAttributeType(element, false);
+        } else if (syntax == OCD_SYNTAX) {
+            builder.addObjectClass(element, false);
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
index f659fa5..6c9fdd7 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,17 +26,12 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all schema unit test should extend.
  */
 @Test(groups = { "precommit", "schema", "sdk" })
-public abstract class SchemaTestCase extends ForgeRockTestCase
-{
+public abstract class SchemaTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java
index fb3e7d1..f337e90 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,92 +26,66 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.SchemaUtils;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 import com.forgerock.opendj.util.SubstringReader;
 
-
-
 /**
  * Test schema utilities.
  */
 @SuppressWarnings("javadoc")
-public class SchemaUtilsTest extends SchemaTestCase
-{
+public class SchemaUtilsTest extends SchemaTestCase {
 
-  @DataProvider(name = "invalidOIDs")
-  public Object[][] createInvalidOIDs()
-  {
-    return new Object[][] { { "" }, { ".0" }, { "0." }, { "100." }, { ".999" },
-        { "1one" }, { "one+two+three" },
-        { "one.two.three" },
-        // AD puts quotes around OIDs - test mismatched quotes.
-        { "'0" }, { "'10" }, { "999'" }, { "0.0'" }, };
-  }
-
-
-
-  @DataProvider(name = "validOIDs")
-  public Object[][] createValidOIDs()
-  {
-    return new Object[][] {
-        // Compliant NOIDs
-        { "0.0" }, { "1.0" }, { "2.0" }, { "3.0" }, { "4.0" }, { "5.0" },
-        { "6.0" }, { "7.0" }, { "8.0" }, { "9.0" }, { "0.1" }, { "0.2" },
-        { "0.3" }, { "0.4" }, { "0.5" }, { "0.6" }, { "0.7" }, { "0.8" },
-        { "0.9" }, { "10.0" }, { "100.0" }, { "999.0" },
-        { "0.100" },
-        { "0.999" },
-        { "100.100" },
-        { "999.999" },
-        { "111.22.333.44.55555.66.777.88.999" },
-        { "a" },
-        { "a2" },
-        { "a-" },
-        { "one" },
-        { "one1" },
-        { "one-two" },
-        { "one1-two2-three3" },
-        // AD puts quotes around OIDs - not compliant but we need to
-        // handle them.
-        { "'0.0'" }, { "'10.0'" }, { "'999.0'" },
-        { "'111.22.333.44.55555.66.777.88.999'" }, { "'a'" }, { "'a2'" },
-        { "'a-'" }, { "'one'" }, { "'one1'" },
-        { "'one-two'" },
-        { "'one1-two2-three3'" },
-        // Not strictly legal, but we'll be lenient with what we accept.
-        { "0" }, { "1" }, { "2" }, { "3" }, { "4" }, { "5" }, { "6" }, { "7" },
-        { "8" }, { "9" }, { "00" }, { "01" }, { "01.0" }, { "0.01" },
-      };
-  }
-
-
-
-  @Test(dataProvider = "invalidOIDs", expectedExceptions = DecodeException.class)
-  public void testReadOIDInvalid(final String oid) throws DecodeException
-  {
-    final SubstringReader reader = new SubstringReader(oid);
-    SchemaUtils.readOID(reader, false);
-  }
-
-
-
-  @Test(dataProvider = "validOIDs")
-  public void testReadOIDValid(final String oid) throws DecodeException
-  {
-    String expected = oid;
-    if (oid.startsWith("'"))
-    {
-      expected = oid.substring(1, oid.length() - 1);
+    @DataProvider(name = "invalidOIDs")
+    public Object[][] createInvalidOIDs() {
+        return new Object[][] { { "" }, { ".0" }, { "0." }, { "100." }, { ".999" }, { "1one" },
+            { "one+two+three" }, { "one.two.three" },
+            // AD puts quotes around OIDs - test mismatched quotes.
+            { "'0" }, { "'10" }, { "999'" }, { "0.0'" }, };
     }
 
-    final SubstringReader reader = new SubstringReader(oid);
-    Assert.assertEquals(SchemaUtils.readOID(reader, false), expected);
-  }
+    @DataProvider(name = "validOIDs")
+    public Object[][] createValidOIDs() {
+        return new Object[][] {
+            // Compliant NOIDs
+            { "0.0" }, { "1.0" }, { "2.0" }, { "3.0" }, { "4.0" }, { "5.0" }, { "6.0" }, { "7.0" },
+            { "8.0" }, { "9.0" }, { "0.1" }, { "0.2" }, { "0.3" }, { "0.4" }, { "0.5" }, { "0.6" },
+            { "0.7" }, { "0.8" }, { "0.9" }, { "10.0" }, { "100.0" }, { "999.0" }, { "0.100" },
+            { "0.999" }, { "100.100" }, { "999.999" }, { "111.22.333.44.55555.66.777.88.999" },
+            { "a" },
+            { "a2" },
+            { "a-" },
+            { "one" },
+            { "one1" },
+            { "one-two" },
+            { "one1-two2-three3" },
+            // AD puts quotes around OIDs - not compliant but we need to
+            // handle them.
+            { "'0.0'" }, { "'10.0'" }, { "'999.0'" }, { "'111.22.333.44.55555.66.777.88.999'" },
+            { "'a'" }, { "'a2'" }, { "'a-'" }, { "'one'" }, { "'one1'" }, { "'one-two'" },
+            { "'one1-two2-three3'" },
+            // Not strictly legal, but we'll be lenient with what we accept.
+            { "0" }, { "1" }, { "2" }, { "3" }, { "4" }, { "5" }, { "6" }, { "7" }, { "8" },
+            { "9" }, { "00" }, { "01" }, { "01.0" }, { "0.01" }, };
+    }
+
+    @Test(dataProvider = "invalidOIDs", expectedExceptions = DecodeException.class)
+    public void testReadOIDInvalid(final String oid) throws DecodeException {
+        final SubstringReader reader = new SubstringReader(oid);
+        SchemaUtils.readOID(reader, false);
+    }
+
+    @Test(dataProvider = "validOIDs")
+    public void testReadOIDValid(final String oid) throws DecodeException {
+        String expected = oid;
+        if (oid.startsWith("'")) {
+            expected = oid.substring(1, oid.length() - 1);
+        }
+
+        final SubstringReader reader = new SubstringReader(oid);
+        Assert.assertEquals(SchemaUtils.readOID(reader, false), expected);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java
index 09197c3..89166aa 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,133 +25,95 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_IA5_STRING_OID;
 
-import org.forgerock.opendj.ldap.schema.ConflictingSchemaElementException;
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.SchemaBuilder;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Substitution syntax tests.
  */
 @SuppressWarnings("javadoc")
-public class SubstitutionSyntaxTestCase extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, };
-  }
+public class SubstitutionSyntaxTestCase extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, };
+    }
 
+    @Test
+    public void testSelfSubstitute1() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.15 "
+                + " DESC 'Replacing DirectorySyntax'  "
+                + " X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )", true);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
+    @Test
+    public void testSelfSubstitute2() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.15", "Replacing DirectorySyntax",
+                "1.3.6.1.4.1.1466.115.121.1.15", true);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  @Test
-  public void testSelfSubstitute1()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.15 "
-        + " DESC 'Replacing DirectorySyntax'  "
-        + " X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )", true);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
+    @Test(expectedExceptions = ConflictingSchemaElementException.class)
+    public void testSubstituteCore1() throws ConflictingSchemaElementException {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.26 "
+                + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '9.9.9' )", false);
+    }
 
+    @Test
+    public void testSubstituteCore1Override() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.26 "
+                + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '9.9.9' )", true);
+    }
 
+    @Test(expectedExceptions = ConflictingSchemaElementException.class)
+    public void testSubstituteCore2() throws ConflictingSchemaElementException {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.26", "Replacing DirectorySyntax",
+                "9.9.9", false);
+    }
 
-  @Test
-  public void testSelfSubstitute2()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.15",
-        "Replacing DirectorySyntax", "1.3.6.1.4.1.1466.115.121.1.15", true);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
+    @Test
+    public void testSubstituteCore2Override() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.26", "Replacing DirectorySyntax",
+                "9.9.9", true);
+    }
 
+    @Test
+    public void testUndefinedSubstitute1() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.15 "
+                + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '1.1.1' )", true);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
+    @Test
+    public void testUndefinedSubstitute2() {
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.15", "Replacing DirectorySyntax",
+                "1.1.1", true);
+        Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
+    }
 
-  @Test(expectedExceptions = ConflictingSchemaElementException.class)
-  public void testSubstituteCore1() throws ConflictingSchemaElementException
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.26 "
-        + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '9.9.9' )", false);
-  }
-
-
-
-  @Test
-  public void testSubstituteCore1Override()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.26 "
-        + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '9.9.9' )", true);
-  }
-
-
-
-  @Test(expectedExceptions = ConflictingSchemaElementException.class)
-  public void testSubstituteCore2() throws ConflictingSchemaElementException
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.26",
-        "Replacing DirectorySyntax", "9.9.9", false);
-  }
-
-
-
-  @Test
-  public void testSubstituteCore2Override()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.26",
-        "Replacing DirectorySyntax", "9.9.9", true);
-  }
-
-
-
-  @Test
-  public void testUndefinedSubstitute1()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSyntax("( 1.3.6.1.4.1.1466.115.121.1.15 "
-        + " DESC 'Replacing DirectorySyntax'  " + " X-SUBST '1.1.1' )", true);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
-
-
-
-  @Test
-  public void testUndefinedSubstitute2()
-  {
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSubstitutionSyntax("1.3.6.1.4.1.1466.115.121.1.15",
-        "Replacing DirectorySyntax", "1.1.1", true);
-    Assert.assertFalse(builder.toSchema().getWarnings().isEmpty());
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    // Use IA5String syntax as our substitute.
-    final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
-    builder.addSubstitutionSyntax("9.9.9", "Unimplemented Syntax",
-        SYNTAX_IA5_STRING_OID, false);
-    return builder.toSchema().getSyntax("9.9.9");
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        // Use IA5String syntax as our substitute.
+        final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema());
+        builder.addSubstitutionSyntax("9.9.9", "Unimplemented Syntax", SYNTAX_IA5_STRING_OID, false);
+        return builder.toSchema().getSyntax("9.9.9");
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java
index 7589cda..c0b654a 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.testng.Assert.fail;
 
 import java.util.ArrayList;
@@ -37,229 +34,178 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Abstract class for building test for the substring matching rules. This class
  * is intended to be extended by one class for each substring matching rules.
  */
 @SuppressWarnings("javadoc")
-public abstract class SubstringMatchingRuleTest extends SchemaTestCase
-{
-  /**
-   * Generate invalid assertion values for the Matching Rule test.
-   *
-   * @return the data for the EqualityMatchingRulesInvalidValuestest.
-   */
-  @DataProvider(name = "substringInvalidAssertionValues")
-  public abstract Object[][] createMatchingRuleInvalidAssertionValues();
+public abstract class SubstringMatchingRuleTest extends SchemaTestCase {
+    /**
+     * Generate invalid assertion values for the Matching Rule test.
+     *
+     * @return the data for the EqualityMatchingRulesInvalidValuestest.
+     */
+    @DataProvider(name = "substringInvalidAssertionValues")
+    public abstract Object[][] createMatchingRuleInvalidAssertionValues();
 
+    /**
+     * Generate invalid attribute values for the Matching Rule test.
+     *
+     * @return the data for the EqualityMatchingRulesInvalidValuestest.
+     */
+    @DataProvider(name = "substringInvalidAttributeValues")
+    public abstract Object[][] createMatchingRuleInvalidAttributeValues();
 
+    /**
+     * Generate data for the test of the final string match.
+     *
+     * @return the data for the test of the final string match.
+     */
+    @DataProvider(name = "substringInitialMatchData")
+    public abstract Object[][] createSubstringFinalMatchData();
 
-  /**
-   * Generate invalid attribute values for the Matching Rule test.
-   *
-   * @return the data for the EqualityMatchingRulesInvalidValuestest.
-   */
-  @DataProvider(name = "substringInvalidAttributeValues")
-  public abstract Object[][] createMatchingRuleInvalidAttributeValues();
+    /**
+     * Generate data for the test of the initial string match.
+     *
+     * @return the data for the test of the initial string match.
+     */
+    @DataProvider(name = "substringInitialMatchData")
+    public abstract Object[][] createSubstringInitialMatchData();
 
+    /**
+     * Generate data for the test of the middle string match.
+     *
+     * @return the data for the test of the middle string match.
+     */
+    @DataProvider(name = "substringMiddleMatchData")
+    public abstract Object[][] createSubstringMiddleMatchData();
 
+    /**
+     * Test the normalization and the final substring match.
+     */
+    @Test(dataProvider = "substringFinalMatchData")
+    public void finalMatchingRules(final String value, final String finalValue,
+            final ConditionResult result) throws Exception {
+        final MatchingRule rule = getRule();
 
-  /**
-   * Generate data for the test of the final string match.
-   *
-   * @return the data for the test of the final string match.
-   */
-  @DataProvider(name = "substringInitialMatchData")
-  public abstract Object[][] createSubstringFinalMatchData();
+        // normalize the 2 provided values and check that they are equals
+        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
 
-
-
-  /**
-   * Generate data for the test of the initial string match.
-   *
-   * @return the data for the test of the initial string match.
-   */
-  @DataProvider(name = "substringInitialMatchData")
-  public abstract Object[][] createSubstringInitialMatchData();
-
-
-
-  /**
-   * Generate data for the test of the middle string match.
-   *
-   * @return the data for the test of the middle string match.
-   */
-  @DataProvider(name = "substringMiddleMatchData")
-  public abstract Object[][] createSubstringMiddleMatchData();
-
-
-
-  /**
-   * Test the normalization and the final substring match.
-   */
-  @Test(dataProvider = "substringFinalMatchData")
-  public void finalMatchingRules(final String value, final String finalValue,
-      final ConditionResult result) throws Exception
-  {
-    final MatchingRule rule = getRule();
-
-    // normalize the 2 provided values and check that they are equals
-    final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString
-        .valueOf(value));
-
-    if (rule.getAssertion(null, null, ByteString.valueOf(finalValue)).matches(
-        normalizedValue) != result
-        || rule.getAssertion(ByteString.valueOf("*" + finalValue)).matches(
-            normalizedValue) != result)
-    {
-      fail("final substring matching rule " + rule
-          + " does not give expected result (" + result + ") for values : "
-          + value + " and " + finalValue);
-    }
-  }
-
-
-
-  /**
-   * Test the normalization and the initial substring match.
-   */
-  @Test(dataProvider = "substringInitialMatchData")
-  public void initialMatchingRules(final String value, final String initial,
-      final ConditionResult result) throws Exception
-  {
-    final MatchingRule rule = getRule();
-
-    // normalize the 2 provided values and check that they are equals
-    final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString
-        .valueOf(value));
-
-    if (rule.getAssertion(ByteString.valueOf(initial), null, null).matches(
-        normalizedValue) != result
-        || rule.getAssertion(ByteString.valueOf(initial + "*")).matches(
-            normalizedValue) != result)
-    {
-      fail("initial substring matching rule " + rule
-          + " does not give expected result (" + result + ") for values : "
-          + value + " and " + initial);
-    }
-  }
-
-
-
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "substringInvalidAssertionValues")
-  public void matchingRulesInvalidAssertionValues(final String subInitial,
-      final String[] anys, final String subFinal) throws Exception
-  {
-    // Get the instance of the rule to be tested.
-    final MatchingRule rule = getRule();
-
-    final List<ByteSequence> anyList = new ArrayList<ByteSequence>(anys.length);
-    for (final String middleSub : anys)
-    {
-      anyList.add(ByteString.valueOf(middleSub));
-    }
-    rule.getAssertion(subInitial == null ? null : ByteString
-        .valueOf(subInitial), anyList, subFinal == null ? null : ByteString
-        .valueOf(subFinal));
-  }
-
-
-
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "substringInvalidAssertionValues")
-  public void matchingRulesInvalidAssertionValuesString(
-      final String subInitial, final String[] anys, final String subFinal)
-      throws Exception
-  {
-    // Get the instance of the rule to be tested.
-    final MatchingRule rule = getRule();
-
-    final StringBuilder assertionString = new StringBuilder();
-    if (subInitial != null)
-    {
-      assertionString.append(subInitial);
-    }
-    assertionString.append("*");
-    for (final String middleSub : anys)
-    {
-      assertionString.append(middleSub);
-      assertionString.append("*");
-    }
-    if (subFinal != null)
-    {
-      assertionString.append(subFinal);
-    }
-    rule.getAssertion(ByteString.valueOf(assertionString.toString()));
-  }
-
-
-
-  /**
-   * Test the normalization and the middle substring match.
-   */
-  @Test(dataProvider = "substringMiddleMatchData")
-  public void middleMatchingRules(final String value,
-      final String[] middleSubs, final ConditionResult result) throws Exception
-  {
-    final MatchingRule rule = getRule();
-
-    // normalize the 2 provided values and check that they are equals
-    final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString
-        .valueOf(value));
-
-    final StringBuilder printableMiddleSubs = new StringBuilder();
-    final List<ByteSequence> middleList = new ArrayList<ByteSequence>(
-        middleSubs.length);
-    printableMiddleSubs.append("*");
-    for (final String middleSub : middleSubs)
-    {
-      printableMiddleSubs.append(middleSub);
-      printableMiddleSubs.append("*");
-      middleList.add(ByteString.valueOf(middleSub));
+        if (rule.getAssertion(null, null, ByteString.valueOf(finalValue)).matches(normalizedValue) != result
+                || rule.getAssertion(ByteString.valueOf("*" + finalValue)).matches(normalizedValue) != result) {
+            fail("final substring matching rule " + rule + " does not give expected result ("
+                    + result + ") for values : " + value + " and " + finalValue);
+        }
     }
 
-    if (rule.getAssertion(null, middleList, null).matches(normalizedValue) != result
-        || rule.getAssertion(ByteString.valueOf(printableMiddleSubs)).matches(
-            normalizedValue) != result)
-    {
-      fail("middle substring matching rule " + rule
-          + " does not give expected result (" + result + ") for values : "
-          + value + " and " + printableMiddleSubs);
+    /**
+     * Test the normalization and the initial substring match.
+     */
+    @Test(dataProvider = "substringInitialMatchData")
+    public void initialMatchingRules(final String value, final String initial,
+            final ConditionResult result) throws Exception {
+        final MatchingRule rule = getRule();
+
+        // normalize the 2 provided values and check that they are equals
+        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
+
+        if (rule.getAssertion(ByteString.valueOf(initial), null, null).matches(normalizedValue) != result
+                || rule.getAssertion(ByteString.valueOf(initial + "*")).matches(normalizedValue) != result) {
+            fail("initial substring matching rule " + rule + " does not give expected result ("
+                    + result + ") for values : " + value + " and " + initial);
+        }
     }
-  }
 
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "substringInvalidAssertionValues")
+    public void matchingRulesInvalidAssertionValues(final String subInitial, final String[] anys,
+            final String subFinal) throws Exception {
+        // Get the instance of the rule to be tested.
+        final MatchingRule rule = getRule();
 
+        final List<ByteSequence> anyList = new ArrayList<ByteSequence>(anys.length);
+        for (final String middleSub : anys) {
+            anyList.add(ByteString.valueOf(middleSub));
+        }
+        rule.getAssertion(subInitial == null ? null : ByteString.valueOf(subInitial), anyList,
+                subFinal == null ? null : ByteString.valueOf(subFinal));
+    }
 
-  /**
-   * Test that invalid values are rejected.
-   */
-  @Test(expectedExceptions = DecodeException.class, dataProvider = "substringInvalidAttributeValues")
-  public void substringInvalidAttributeValues(final String value)
-      throws Exception
-  {
-    // Get the instance of the rule to be tested.
-    final MatchingRule rule = getRule();
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "substringInvalidAssertionValues")
+    public void matchingRulesInvalidAssertionValuesString(final String subInitial,
+            final String[] anys, final String subFinal) throws Exception {
+        // Get the instance of the rule to be tested.
+        final MatchingRule rule = getRule();
 
-    rule.normalizeAttributeValue(ByteString.valueOf(value));
-  }
+        final StringBuilder assertionString = new StringBuilder();
+        if (subInitial != null) {
+            assertionString.append(subInitial);
+        }
+        assertionString.append("*");
+        for (final String middleSub : anys) {
+            assertionString.append(middleSub);
+            assertionString.append("*");
+        }
+        if (subFinal != null) {
+            assertionString.append(subFinal);
+        }
+        rule.getAssertion(ByteString.valueOf(assertionString.toString()));
+    }
 
+    /**
+     * Test the normalization and the middle substring match.
+     */
+    @Test(dataProvider = "substringMiddleMatchData")
+    public void middleMatchingRules(final String value, final String[] middleSubs,
+            final ConditionResult result) throws Exception {
+        final MatchingRule rule = getRule();
 
+        // normalize the 2 provided values and check that they are equals
+        final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value));
 
-  /**
-   * Get an instance of the matching rule.
-   *
-   * @return An instance of the matching rule to test.
-   */
-  protected abstract MatchingRule getRule();
+        final StringBuilder printableMiddleSubs = new StringBuilder();
+        final List<ByteSequence> middleList = new ArrayList<ByteSequence>(middleSubs.length);
+        printableMiddleSubs.append("*");
+        for (final String middleSub : middleSubs) {
+            printableMiddleSubs.append(middleSub);
+            printableMiddleSubs.append("*");
+            middleList.add(ByteString.valueOf(middleSub));
+        }
+
+        if (rule.getAssertion(null, middleList, null).matches(normalizedValue) != result
+                || rule.getAssertion(ByteString.valueOf(printableMiddleSubs)).matches(
+                        normalizedValue) != result) {
+            fail("middle substring matching rule " + rule + " does not give expected result ("
+                    + result + ") for values : " + value + " and " + printableMiddleSubs);
+        }
+    }
+
+    /**
+     * Test that invalid values are rejected.
+     */
+    @Test(expectedExceptions = DecodeException.class,
+            dataProvider = "substringInvalidAttributeValues")
+    public void substringInvalidAttributeValues(final String value) throws Exception {
+        // Get the instance of the rule to be tested.
+        final MatchingRule rule = getRule();
+
+        rule.normalizeAttributeValue(ByteString.valueOf(value));
+    }
+
+    /**
+     * Get an instance of the matching rule.
+     *
+     * @return An instance of the matching rule to test.
+     */
+    protected abstract MatchingRule getRule();
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java
index 976b21c..6d66f0a 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,77 +25,61 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.testng.Assert.fail;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
-import org.forgerock.opendj.ldap.schema.SchemaException;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * Syntax tests.
  */
 @SuppressWarnings("javadoc")
-public abstract class SyntaxTestCase extends SchemaTestCase
-{
-  /**
-   * Create data for the testAcceptableValues test. This should be a table of
-   * tables with 2 elements. The first one should be the value to test, the
-   * second the expected result of the test.
-   *
-   * @return a table containing data for the testAcceptableValues Test.
-   */
-  @DataProvider(name = "acceptableValues")
-  public abstract Object[][] createAcceptableValues();
+public abstract class SyntaxTestCase extends SchemaTestCase {
+    /**
+     * Create data for the testAcceptableValues test. This should be a table of
+     * tables with 2 elements. The first one should be the value to test, the
+     * second the expected result of the test.
+     *
+     * @return a table containing data for the testAcceptableValues Test.
+     */
+    @DataProvider(name = "acceptableValues")
+    public abstract Object[][] createAcceptableValues();
 
+    /**
+     * Test the normalization and the approximate comparison.
+     */
+    @Test(dataProvider = "acceptableValues")
+    public void testAcceptableValues(final String value, final Boolean result) throws Exception {
+        // Make sure that the specified class can be instantiated as a task.
+        final Syntax syntax = getRule();
 
+        final LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
+        // test the valueIsAcceptable method
+        final Boolean liveResult = syntax.valueIsAcceptable(ByteString.valueOf(value), reason);
 
-  /**
-   * Test the normalization and the approximate comparison.
-   */
-  @Test(dataProvider = "acceptableValues")
-  public void testAcceptableValues(final String value, final Boolean result)
-      throws Exception
-  {
-    // Make sure that the specified class can be instantiated as a task.
-    final Syntax syntax = getRule();
+        if (!liveResult.equals(result)) {
+            fail(syntax + ".valueIsAcceptable gave bad result for " + value + "reason : " + reason);
+        }
 
-    final LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
-    // test the valueIsAcceptable method
-    final Boolean liveResult = syntax.valueIsAcceptable(ByteString
-        .valueOf(value), reason);
-
-    if (!liveResult.equals(result))
-    {
-      fail(syntax + ".valueIsAcceptable gave bad result for " + value
-          + "reason : " + reason);
+        // call the getters
+        syntax.getApproximateMatchingRule();
+        syntax.getDescription();
+        syntax.getEqualityMatchingRule();
+        syntax.getOID();
+        syntax.getOrderingMatchingRule();
+        syntax.getSubstringMatchingRule();
+        syntax.hashCode();
+        syntax.isHumanReadable();
+        syntax.toString();
     }
 
-    // call the getters
-    syntax.getApproximateMatchingRule();
-    syntax.getDescription();
-    syntax.getEqualityMatchingRule();
-    syntax.getOID();
-    syntax.getOrderingMatchingRule();
-    syntax.getSubstringMatchingRule();
-    syntax.hashCode();
-    syntax.isHumanReadable();
-    syntax.toString();
-  }
-
-
-
-  /**
-   * Get an instance of the attribute syntax that muste be tested.
-   *
-   * @return An instance of the attribute syntax that muste be tested.
-   */
-  protected abstract Syntax getRule() throws SchemaException, DecodeException;
+    /**
+     * Get an instance of the attribute syntax that muste be tested.
+     *
+     * @return An instance of the attribute syntax that muste be tested.
+     */
+    protected abstract Syntax getRule() throws SchemaException, DecodeException;
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java
index c2a132f..a0269ea 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,42 +25,30 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_TELEX_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * Telex syntax tests.
  */
-public class TelexSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "123$france$456", true },
-        { "abcdefghijk$lmnopqr$stuvwxyz", true },
-        { "12345$67890$()+,-./:? ", true }, };
-  }
+public class TelexSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "123$france$456", true },
+            { "abcdefghijk$lmnopqr$stuvwxyz", true }, { "12345$67890$()+,-./:? ", true }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_TELEX_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_TELEX_OID);
+    }
 
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java
index 1f21cff..72b30ab 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,90 +25,71 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_UTC_TIME_OID;
 import static org.testng.Assert.assertTrue;
 
 import java.util.Date;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
-import org.forgerock.opendj.ldap.schema.UTCTimeSyntaxImpl;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * UTC time syntax tests.
  */
-public class UTCTimeSyntaxTest extends SyntaxTestCase
-{
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] {
-        // tests for the UTC time syntax.
-        { "060906135030+01", true }, { "0609061350Z", true },
-        { "060906135030Z", true }, { "061116135030Z", true },
-        { "061126135030Z", true }, { "061231235959Z", true },
-        { "060906135030+0101", true }, { "060906135030+2359", true },
-        { "060906135060+0101", true }, { "060906135061+0101", false },
-        { "060906135030+3359", false }, { "060906135030+2389", false },
-        { "062231235959Z", false }, { "061232235959Z", false },
-        { "06123123595aZ", false }, { "0a1231235959Z", false },
-        { "06j231235959Z", false }, { "0612-1235959Z", false },
-        { "061231#35959Z", false }, { "2006", false },
-        { "062106135030+0101", false }, { "060A06135030+0101", false },
-        { "061A06135030+0101", false }, { "060936135030+0101", false },
-        { "06090A135030+0101", false }, { "06091A135030+0101", false },
-        { "060900135030+0101", false }, { "060906335030+0101", false },
-        { "0609061A5030+0101", false }, { "0609062A5030+0101", false },
-        { "060906137030+0101", false }, { "060906135A30+0101", false },
-        { "060906135", false }, { "0609061350", false },
-        { "060906135070+0101", false }, { "06090613503A+0101", false },
-        { "06090613503", false }, { "0609061350Z0", false },
-        { "0609061350+0", false }, { "0609061350+000A", false },
-        { "0609061350+A00A", false }, { "060906135030Z0", false },
-        { "060906135030+010", false }, { "060906135030+010A", false },
-        { "060906135030+0A01", false }, { "060906135030+2501", false },
-        { "060906135030+0170", false }, { "060906135030+010A", false },
-        { "060906135030+A00A", false }, { "060906135030Q", false },
-        { "060906135030+", false }, };
-  }
+public class UTCTimeSyntaxTest extends SyntaxTestCase {
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] {
+            // tests for the UTC time syntax.
+            { "060906135030+01", true }, { "0609061350Z", true }, { "060906135030Z", true },
+            { "061116135030Z", true }, { "061126135030Z", true }, { "061231235959Z", true },
+            { "060906135030+0101", true }, { "060906135030+2359", true },
+            { "060906135060+0101", true }, { "060906135061+0101", false },
+            { "060906135030+3359", false }, { "060906135030+2389", false },
+            { "062231235959Z", false }, { "061232235959Z", false }, { "06123123595aZ", false },
+            { "0a1231235959Z", false }, { "06j231235959Z", false }, { "0612-1235959Z", false },
+            { "061231#35959Z", false }, { "2006", false }, { "062106135030+0101", false },
+            { "060A06135030+0101", false }, { "061A06135030+0101", false },
+            { "060936135030+0101", false }, { "06090A135030+0101", false },
+            { "06091A135030+0101", false }, { "060900135030+0101", false },
+            { "060906335030+0101", false }, { "0609061A5030+0101", false },
+            { "0609062A5030+0101", false }, { "060906137030+0101", false },
+            { "060906135A30+0101", false }, { "060906135", false }, { "0609061350", false },
+            { "060906135070+0101", false }, { "06090613503A+0101", false },
+            { "06090613503", false }, { "0609061350Z0", false }, { "0609061350+0", false },
+            { "0609061350+000A", false }, { "0609061350+A00A", false },
+            { "060906135030Z0", false }, { "060906135030+010", false },
+            { "060906135030+010A", false }, { "060906135030+0A01", false },
+            { "060906135030+2501", false }, { "060906135030+0170", false },
+            { "060906135030+010A", false }, { "060906135030+A00A", false },
+            { "060906135030Q", false }, { "060906135030+", false }, };
+    }
 
+    /**
+     * Tests the {@code createUTCTimeValue} and {@code decodeUTCTimeValue}
+     * methods.
+     *
+     * @throws Exception
+     *             If an unexpected problem occurs.
+     */
+    @Test()
+    public void testCreateAndDecodeUTCTimeValue() throws Exception {
+        final Date d = new Date();
+        final String timeValue = UTCTimeSyntaxImpl.createUTCTimeValue(d);
+        final Date decodedDate = UTCTimeSyntaxImpl.decodeUTCTimeValue(timeValue);
 
+        // UTCTime does not have support for sub-second values, so we need
+        // to make
+        // sure that the decoded value is within 1000 milliseconds.
+        assertTrue(Math.abs(d.getTime() - decodedDate.getTime()) < 1000);
+    }
 
-  /**
-   * Tests the {@code createUTCTimeValue} and {@code decodeUTCTimeValue}
-   * methods.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test()
-  public void testCreateAndDecodeUTCTimeValue() throws Exception
-  {
-    final Date d = new Date();
-    final String timeValue = UTCTimeSyntaxImpl.createUTCTimeValue(d);
-    final Date decodedDate = UTCTimeSyntaxImpl.decodeUTCTimeValue(timeValue);
-
-    // UTCTime does not have support for sub-second values, so we need
-    // to make
-    // sure that the decoded value is within 1000 milliseconds.
-    assertTrue(Math.abs(d.getTime() - decodedDate.getTime()) < 1000);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_UTC_TIME_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_UTC_TIME_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java
index 4eb523f..3ec444f 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,50 +25,39 @@
  */
 package org.forgerock.opendj.ldap.schema;
 
-
-
 import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_UUID_OID;
 
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.testng.annotations.DataProvider;
 
-
-
 /**
  * UUID syntax tests.
  */
-public class UUIDSyntaxTest extends SyntaxTestCase
-{
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  @DataProvider(name = "acceptableValues")
-  public Object[][] createAcceptableValues()
-  {
-    return new Object[][] { { "12345678-9ABC-DEF0-1234-1234567890ab", true },
-        { "12345678-9abc-def0-1234-1234567890ab", true },
-        { "12345678-9abc-def0-1234-1234567890ab", true },
-        { "12345678-9abc-def0-1234-1234567890ab", true },
-        { "02345678-9abc-def0-1234-1234567890ab", true },
-        { "12345678-9abc-def0-1234-1234567890ab", true },
-        { "12345678-9abc-def0-1234-1234567890ab", true },
-        { "02345678-9abc-def0-1234-1234567890ab", true },
-        { "G2345678-9abc-def0-1234-1234567890ab", false },
-        { "g2345678-9abc-def0-1234-1234567890ab", false },
-        { "12345678/9abc/def0/1234/1234567890ab", false },
-        { "12345678-9abc-def0-1234-1234567890a", false }, };
-  }
+public class UUIDSyntaxTest extends SyntaxTestCase {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @DataProvider(name = "acceptableValues")
+    public Object[][] createAcceptableValues() {
+        return new Object[][] { { "12345678-9ABC-DEF0-1234-1234567890ab", true },
+            { "12345678-9abc-def0-1234-1234567890ab", true },
+            { "12345678-9abc-def0-1234-1234567890ab", true },
+            { "12345678-9abc-def0-1234-1234567890ab", true },
+            { "02345678-9abc-def0-1234-1234567890ab", true },
+            { "12345678-9abc-def0-1234-1234567890ab", true },
+            { "12345678-9abc-def0-1234-1234567890ab", true },
+            { "02345678-9abc-def0-1234-1234567890ab", true },
+            { "G2345678-9abc-def0-1234-1234567890ab", false },
+            { "g2345678-9abc-def0-1234-1234567890ab", false },
+            { "12345678/9abc/def0/1234/1234567890ab", false },
+            { "12345678-9abc-def0-1234-1234567890a", false }, };
+    }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected Syntax getRule()
-  {
-    return Schema.getCoreSchema().getSyntax(SYNTAX_UUID_OID);
-  }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Syntax getRule() {
+        return Schema.getCoreSchema().getSyntax(SYNTAX_UUID_OID);
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java
index 91fe962..b083386 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,17 +26,22 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static org.fest.assertions.Assertions.assertThat;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyListOf;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 import java.util.Arrays;
 import java.util.Iterator;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.LinkedAttribute;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.RDN;
 import org.forgerock.opendj.ldap.requests.AddRequest;
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
@@ -46,480 +50,411 @@
 import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.Policy;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This class tests the LDIFChangeRecordReader functionality.
  */
-public final class LDIFChangeRecordReaderTestCase extends LDIFTestCase
-{
-  /**
-   * Tests reading a valid add change record with a changetype.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadAddRecordWithChangeType() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example"
+public final class LDIFChangeRecordReaderTestCase extends LDIFTestCase {
+    /**
+     * Tests reading a valid add change record with a changetype.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadAddRecordWithChangeType() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(AddRequest.class);
-    AddRequest addRequest = (AddRequest) record;
-    assertThat((Object) addRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-    assertThat(
-        addRequest.containsAttribute("objectClass", "top", "domainComponent"))
-        .isTrue();
-    assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
-    assertThat(addRequest.getAttributeCount()).isEqualTo(2);
-  }
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(AddRequest.class);
+        AddRequest addRequest = (AddRequest) record;
+        assertThat((Object) addRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+        assertThat(addRequest.containsAttribute("objectClass", "top", "domainComponent")).isTrue();
+        assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
+        assertThat(addRequest.getAttributeCount()).isEqualTo(2);
+    }
 
-
-
-  /**
-   * Tests reading a valid add change record without a changetype.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadAddRecordWithoutChangeType() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example"
+    /**
+     * Tests reading a valid add change record without a changetype.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadAddRecordWithoutChangeType() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(AddRequest.class);
-    AddRequest addRequest = (AddRequest) record;
-    assertThat((Object) addRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-    assertThat(
-        addRequest.containsAttribute("objectClass", "top", "domainComponent"))
-        .isTrue();
-    assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
-    assertThat(addRequest.getAttributeCount()).isEqualTo(2);
-  }
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(AddRequest.class);
+        AddRequest addRequest = (AddRequest) record;
+        assertThat((Object) addRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+        assertThat(addRequest.containsAttribute("objectClass", "top", "domainComponent")).isTrue();
+        assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
+        assertThat(addRequest.getAttributeCount()).isEqualTo(2);
+    }
 
-
-
-  /**
-   * Tests reading a valid modify change record.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadModifyRecord() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: modify",
-        "add: description",
-        "-",
-        "add: description",
-        "description: value1",
-        "-",
-        "add: description",
-        "description: value1",
-        "description: value2",
-        "-",
-        "delete: description",
-        "-",
-        "delete: description",
-        "description: value1",
-        "-",
-        "delete: description",
-        "description: value1",
-        "description: value2",
-        "-",
-        "replace: description",
-        "-",
-        "replace: description",
-        "description: value1",
-        "-",
-        "replace: description",
-        "description: value1",
-        "description: value2",
-        "-",
-        "increment: description",
-        "description: 1"
+    /**
+     * Tests reading a valid modify change record.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadModifyRecord() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: modify",
+            "add: description",
+            "-",
+            "add: description",
+            "description: value1",
+            "-",
+            "add: description",
+            "description: value1",
+            "description: value2",
+            "-",
+            "delete: description",
+            "-",
+            "delete: description",
+            "description: value1",
+            "-",
+            "delete: description",
+            "description: value1",
+            "description: value2",
+            "-",
+            "replace: description",
+            "-",
+            "replace: description",
+            "description: value1",
+            "-",
+            "replace: description",
+            "description: value1",
+            "description: value2",
+            "-",
+            "increment: description",
+            "description: 1"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(ModifyRequest.class);
-    ModifyRequest modifyRequest = (ModifyRequest) record;
-    assertThat((Object) modifyRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(ModifyRequest.class);
+        ModifyRequest modifyRequest = (ModifyRequest) record;
+        assertThat((Object) modifyRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
 
-    Iterator<Modification> changes = modifyRequest.getModifications()
-        .iterator();
-    Modification modification;
+        Iterator<Modification> changes = modifyRequest.getModifications().iterator();
+        Modification modification;
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.ADD);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.ADD);
+        assertThat(modification.getAttribute()).isEqualTo(new LinkedAttribute("description"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.ADD);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.ADD);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.ADD);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1", "value2"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.ADD);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1", "value2"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.DELETE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.DELETE);
+        assertThat(modification.getAttribute()).isEqualTo(new LinkedAttribute("description"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.DELETE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.DELETE);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.DELETE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1", "value2"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.DELETE);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1", "value2"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.REPLACE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.REPLACE);
+        assertThat(modification.getAttribute()).isEqualTo(new LinkedAttribute("description"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.REPLACE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.REPLACE);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.REPLACE);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "value1", "value2"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.REPLACE);
+        assertThat(modification.getAttribute()).isEqualTo(
+                new LinkedAttribute("description", "value1", "value2"));
 
-    modification = changes.next();
-    assertThat(modification.getModificationType()).isEqualTo(
-        ModificationType.INCREMENT);
-    assertThat(modification.getAttribute()).isEqualTo(
-        new LinkedAttribute("description", "1"));
+        modification = changes.next();
+        assertThat(modification.getModificationType()).isEqualTo(ModificationType.INCREMENT);
+        assertThat(modification.getAttribute()).isEqualTo(new LinkedAttribute("description", "1"));
 
-    assertThat(changes.hasNext()).isFalse();
-  }
+        assertThat(changes.hasNext()).isFalse();
+    }
 
-
-
-  /**
-   * Tests reading a valid delete change record.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadDeleteRecord() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: delete"
+    /**
+     * Tests reading a valid delete change record.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadDeleteRecord() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: delete"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(DeleteRequest.class);
-    DeleteRequest deleteRequest = (DeleteRequest) record;
-    assertThat((Object) deleteRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-  }
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(DeleteRequest.class);
+        DeleteRequest deleteRequest = (DeleteRequest) record;
+        assertThat((Object) deleteRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+    }
 
-
-
-  /**
-   * Tests reading a valid moddn change record.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadModdnRecordWithoutNewSuperior() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: moddn",
-        "newrdn: dc=eggsample",
-        "deleteoldrdn: true"
+    /**
+     * Tests reading a valid moddn change record.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadModdnRecordWithoutNewSuperior() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: moddn",
+            "newrdn: dc=eggsample",
+            "deleteoldrdn: true"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(ModifyDNRequest.class);
-    ModifyDNRequest modifyDNRequest = (ModifyDNRequest) record;
-    assertThat((Object) modifyDNRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-    assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo(
-        RDN.valueOf("dc=eggsample"));
-    assertThat(modifyDNRequest.isDeleteOldRDN()).isTrue();
-    assertThat(modifyDNRequest.getNewSuperior()).isNull();
-  }
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(ModifyDNRequest.class);
+        ModifyDNRequest modifyDNRequest = (ModifyDNRequest) record;
+        assertThat((Object) modifyDNRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+        assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo(RDN.valueOf("dc=eggsample"));
+        assertThat(modifyDNRequest.isDeleteOldRDN()).isTrue();
+        assertThat(modifyDNRequest.getNewSuperior()).isNull();
+    }
 
-
-
-  /**
-   * Tests reading a valid moddn change record.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testReadModdnRecordWithNewSuperior() throws Exception
-  {
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: moddn",
-        "newrdn: dc=eggsample",
-        "deleteoldrdn: true",
-        "newsuperior: dc=org"
+    /**
+     * Tests reading a valid moddn change record.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testReadModdnRecordWithNewSuperior() throws Exception {
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: moddn",
+            "newrdn: dc=eggsample",
+            "deleteoldrdn: true",
+            "newsuperior: dc=org"
         );
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(ModifyDNRequest.class);
-    ModifyDNRequest modifyDNRequest = (ModifyDNRequest) record;
-    assertThat((Object) modifyDNRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-    assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo(
-        RDN.valueOf("dc=eggsample"));
-    assertThat(modifyDNRequest.isDeleteOldRDN()).isTrue();
-    assertThat((Object) modifyDNRequest.getNewSuperior()).isEqualTo(
-        DN.valueOf("dc=org"));
-  }
+        assertThat(reader.hasNext()).isTrue();
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(ModifyDNRequest.class);
+        ModifyDNRequest modifyDNRequest = (ModifyDNRequest) record;
+        assertThat((Object) modifyDNRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+        assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo(RDN.valueOf("dc=eggsample"));
+        assertThat(modifyDNRequest.isDeleteOldRDN()).isTrue();
+        assertThat((Object) modifyDNRequest.getNewSuperior()).isEqualTo(DN.valueOf("dc=org"));
+    }
 
+    /**
+     * Tests reading a malformed record invokes the rejected record listener.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testRejectedRecordListenerMalformedFirstRecord() throws Exception {
+        RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
 
-
-  /**
-   * Tests reading a malformed record invokes the rejected record listener.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testRejectedRecordListenerMalformedFirstRecord() throws Exception
-  {
-    RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
-
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: baddn",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example"
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: baddn",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example"
         ).setRejectedLDIFListener(listener);
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isFalse();
+        assertThat(reader.hasNext()).isFalse();
 
-    verify(listener).handleMalformedRecord(
-        eq(1L),
-        eq(Arrays.asList("dn: baddn", "changetype: add", "objectClass: top",
-            "objectClass: domainComponent", "dc: example")),
-        any(LocalizableMessage.class));
-  }
+        verify(listener).handleMalformedRecord(
+                eq(1L),
+                eq(Arrays.asList("dn: baddn", "changetype: add", "objectClass: top",
+                        "objectClass: domainComponent", "dc: example")),
+                any(LocalizableMessage.class));
+    }
 
+    /**
+     * Tests reading a malformed record invokes the rejected record listener.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testRejectedRecordListenerMalformedSecondRecord() throws Exception {
+        RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
 
-
-  /**
-   * Tests reading a malformed record invokes the rejected record listener.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testRejectedRecordListenerMalformedSecondRecord()
-      throws Exception
-  {
-    RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
-
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example",
-        "",
-        "dn: baddn",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example"
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example",
+            "",
+            "dn: baddn",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example"
         ).setRejectedLDIFListener(listener);
-    // @formatter:on
+        // @formatter:on
 
-    reader.readChangeRecord(); // Skip good record.
-    assertThat(reader.hasNext()).isFalse();
+        reader.readChangeRecord(); // Skip good record.
+        assertThat(reader.hasNext()).isFalse();
 
-    verify(listener).handleMalformedRecord(
-        eq(7L),
-        eq(Arrays.asList("dn: baddn", "changetype: add", "objectClass: top",
-            "objectClass: domainComponent", "dc: example")),
-        any(LocalizableMessage.class));
-  }
+        verify(listener).handleMalformedRecord(
+                eq(7L),
+                eq(Arrays.asList("dn: baddn", "changetype: add", "objectClass: top",
+                        "objectClass: domainComponent", "dc: example")),
+                any(LocalizableMessage.class));
+    }
 
+    /**
+     * Tests reading a skipped record invokes the rejected record listener.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testRejectedRecordListenerSkipsRecord() throws Exception {
+        RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
 
-
-  /**
-   * Tests reading a skipped record invokes the rejected record listener.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testRejectedRecordListenerSkipsRecord() throws Exception
-  {
-    RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
-
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example"
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example"
         ).setRejectedLDIFListener(listener).setExcludeBranch(DN.valueOf("dc=com"));
-    // @formatter:on
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isFalse();
+        assertThat(reader.hasNext()).isFalse();
 
-    verify(listener)
-        .handleSkippedRecord(
-            eq(1L),
-            eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add",
-                "objectClass: top", "objectClass: domainComponent",
-                "dc: example")), any(LocalizableMessage.class));
-  }
+        verify(listener).handleSkippedRecord(
+                eq(1L),
+                eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add", "objectClass: top",
+                        "objectClass: domainComponent", "dc: example")),
+                any(LocalizableMessage.class));
+    }
 
+    /**
+     * Tests reading a record which does not conform to the schema invokes the
+     * rejected record listener.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testRejectedRecordListenerRejectsBadSchemaRecord() throws Exception {
+        RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
 
-
-  /**
-   * Tests reading a record which does not conform to the schema invokes the
-   * rejected record listener.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testRejectedRecordListenerRejectsBadSchemaRecord()
-      throws Exception
-  {
-    RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
-
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example",
-        "xxx: unknown attribute"
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example",
+            "xxx: unknown attribute"
         ).setRejectedLDIFListener(listener)
-         .setSchemaValidationPolicy(
-             SchemaValidationPolicy.ignoreAll()
-             .checkAttributesAndObjectClasses(Policy.REJECT));
-    // @formatter:on
+             .setSchemaValidationPolicy(
+                 SchemaValidationPolicy.ignoreAll()
+                     .checkAttributesAndObjectClasses(Policy.REJECT));
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isFalse();
+        assertThat(reader.hasNext()).isFalse();
 
-    verify(listener).handleSchemaValidationFailure(
-        eq(1L),
-        eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add",
-            "objectClass: top", "objectClass: domainComponent", "dc: example",
-            "xxx: unknown attribute")), anyListOf(LocalizableMessage.class));
-  }
+        verify(listener).handleSchemaValidationFailure(
+                eq(1L),
+                eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add", "objectClass: top",
+                        "objectClass: domainComponent", "dc: example", "xxx: unknown attribute")),
+                anyListOf(LocalizableMessage.class));
+    }
 
+    /**
+     * Tests reading a record which does not conform to the schema invokes the
+     * warning record listener.
+     *
+     * @throws Exception
+     *             if an unexpected error occurred.
+     */
+    @Test
+    public void testRejectedRecordListenerWarnsBadSchemaRecord() throws Exception {
+        RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
 
-
-  /**
-   * Tests reading a record which does not conform to the schema invokes the
-   * warning record listener.
-   *
-   * @throws Exception
-   *           if an unexpected error occurred.
-   */
-  @Test
-  public void testRejectedRecordListenerWarnsBadSchemaRecord()
-      throws Exception
-  {
-    RejectedLDIFListener listener = mock(RejectedLDIFListener.class);
-
-    // @formatter:off
-    LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
-        "dn: dc=example,dc=com",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: domainComponent",
-        "dc: example",
-        "xxx: unknown attribute"
+        // @formatter:off
+        LDIFChangeRecordReader reader = new LDIFChangeRecordReader(
+            "dn: dc=example,dc=com",
+            "changetype: add",
+            "objectClass: top",
+            "objectClass: domainComponent",
+            "dc: example",
+            "xxx: unknown attribute"
         ).setRejectedLDIFListener(listener)
-         .setSchemaValidationPolicy(
-             SchemaValidationPolicy.ignoreAll()
-             .checkAttributesAndObjectClasses(Policy.WARN));
-    // @formatter:on
+             .setSchemaValidationPolicy(
+                 SchemaValidationPolicy.ignoreAll()
+                     .checkAttributesAndObjectClasses(Policy.WARN));
+        // @formatter:on
 
-    assertThat(reader.hasNext()).isTrue();
+        assertThat(reader.hasNext()).isTrue();
 
-    ChangeRecord record = reader.readChangeRecord();
-    assertThat(record).isInstanceOf(AddRequest.class);
-    AddRequest addRequest = (AddRequest) record;
-    assertThat((Object) addRequest.getName()).isEqualTo(
-        DN.valueOf("dc=example,dc=com"));
-    assertThat(
-        addRequest.containsAttribute("objectClass", "top", "domainComponent"))
-        .isTrue();
-    assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
-    assertThat(addRequest.getAttributeCount()).isEqualTo(2);
+        ChangeRecord record = reader.readChangeRecord();
+        assertThat(record).isInstanceOf(AddRequest.class);
+        AddRequest addRequest = (AddRequest) record;
+        assertThat((Object) addRequest.getName()).isEqualTo(DN.valueOf("dc=example,dc=com"));
+        assertThat(addRequest.containsAttribute("objectClass", "top", "domainComponent")).isTrue();
+        assertThat(addRequest.containsAttribute("dc", "example")).isTrue();
+        assertThat(addRequest.getAttributeCount()).isEqualTo(2);
 
-    verify(listener).handleSchemaValidationWarning(
-        eq(1L),
-        eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add",
-            "objectClass: top", "objectClass: domainComponent", "dc: example",
-            "xxx: unknown attribute")), anyListOf(LocalizableMessage.class));
-  }
+        verify(listener).handleSchemaValidationWarning(
+                eq(1L),
+                eq(Arrays.asList("dn: dc=example,dc=com", "changetype: add", "objectClass: top",
+                        "objectClass: domainComponent", "dc: example", "xxx: unknown attribute")),
+                anyListOf(LocalizableMessage.class));
+    }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
index 281850c..c739fb4 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import static org.testng.Assert.assertNotNull;
 
 import java.io.FileInputStream;
@@ -37,113 +34,77 @@
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.TestCaseUtils;
-import org.forgerock.opendj.ldif.LDIFEntryReader;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This class tests the LDIFEntryReader functionality.
  */
-public final class LDIFEntryReaderTestCase extends LDIFTestCase
-{
-  /**
-   * Tests readEntry method of LDIFEntryReader class.See
-   * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test()
-  public void testEmpty() throws Exception
-  {
-    final String path = TestCaseUtils.createTempFile("");
-    final FileInputStream in = new FileInputStream(path);
-    final LDIFEntryReader reader = new LDIFEntryReader(in);
-    try
-    {
-      Assert.assertFalse(reader.hasNext());
-      Assert.assertFalse(reader.hasNext());
-      try
-      {
-        reader.readEntry();
-        Assert
-            .fail("reader.readEntry() should have thrown NoSuchElementException");
-      }
-      catch (NoSuchElementException e)
-      {
-        // This is expected.
-      }
-      Assert.assertFalse(reader.hasNext());
+public final class LDIFEntryReaderTestCase extends LDIFTestCase {
+    /**
+     * Tests readEntry method of LDIFEntryReader class.See
+     * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test()
+    public void testEmpty() throws Exception {
+        final String path = TestCaseUtils.createTempFile("");
+        final FileInputStream in = new FileInputStream(path);
+        final LDIFEntryReader reader = new LDIFEntryReader(in);
+        try {
+            Assert.assertFalse(reader.hasNext());
+            Assert.assertFalse(reader.hasNext());
+            try {
+                reader.readEntry();
+                Assert.fail("reader.readEntry() should have thrown NoSuchElementException");
+            } catch (NoSuchElementException e) {
+                // This is expected.
+            }
+            Assert.assertFalse(reader.hasNext());
+        } finally {
+            reader.close();
+        }
     }
-    finally
-    {
-      reader.close();
-    }
-  }
 
-
-
-  /**
-   * Tests readEntry method of LDIFEntryReader class.See
-   * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test()
-  public void testReadEntry() throws Exception
-  {
-    final String path = TestCaseUtils
-        .createTempFile(
-            "dn: uid=1,ou=people,dc=ucsf,dc=edu",
-            "objectClass: top",
-            "objectClass: person",
-            "objectClass: organizationalperson",
-            "objectClass: inetorgperson",
-            "givenName: Aaccf",
-            "sn: Amar",
-            "cn: Aaccf Amar",
-            "initials: ASA",
-            "employeeNumber: 020000001",
-            "uid: 1",
-            "mail: Aaccf.Amar@ucsf.edu",
-            "userPassword: password",
-            "telephoneNumber: +1 685 622 6202",
-            "homePhone: +1 225 216 5900",
-            "pager: +1 779 041 6341",
-            "mobile: +1 010 154 3228",
-            "street: 01251 Chestnut Street",
-            "l: Panama City",
-            "st: DE",
-            "postalCode: 50369",
-            "postalAddress: Aaccf Amar$01251 Chestnut Street$Panama City, DE  50369",
-            "description: This is the description for Aaccf Amar.");
-    final FileInputStream in = new FileInputStream(path);
-    final LDIFEntryReader reader = new LDIFEntryReader(in);
-    try
-    {
-      Assert.assertTrue(reader.hasNext());
-      final Entry entry = reader.readEntry();
-      assertNotNull(entry);
-      Assert.assertEquals(entry.getName(),
-          DN.valueOf("uid=1,ou=people,dc=ucsf,dc=edu"));
-      Assert.assertFalse(reader.hasNext());
-      try
-      {
-        reader.readEntry();
-        Assert
-            .fail("reader.readEntry() should have thrown NoSuchElementException");
-      }
-      catch (NoSuchElementException e)
-      {
-        // This is expected.
-      }
+    /**
+     * Tests readEntry method of LDIFEntryReader class.See
+     * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test()
+    public void testReadEntry() throws Exception {
+        final String path =
+                TestCaseUtils.createTempFile("dn: uid=1,ou=people,dc=ucsf,dc=edu",
+                        "objectClass: top", "objectClass: person",
+                        "objectClass: organizationalperson", "objectClass: inetorgperson",
+                        "givenName: Aaccf", "sn: Amar", "cn: Aaccf Amar", "initials: ASA",
+                        "employeeNumber: 020000001", "uid: 1", "mail: Aaccf.Amar@ucsf.edu",
+                        "userPassword: password", "telephoneNumber: +1 685 622 6202",
+                        "homePhone: +1 225 216 5900", "pager: +1 779 041 6341",
+                        "mobile: +1 010 154 3228", "street: 01251 Chestnut Street",
+                        "l: Panama City", "st: DE", "postalCode: 50369",
+                        "postalAddress: Aaccf Amar$01251 Chestnut Street$Panama City, DE  50369",
+                        "description: This is the description for Aaccf Amar.");
+        final FileInputStream in = new FileInputStream(path);
+        final LDIFEntryReader reader = new LDIFEntryReader(in);
+        try {
+            Assert.assertTrue(reader.hasNext());
+            final Entry entry = reader.readEntry();
+            assertNotNull(entry);
+            Assert.assertEquals(entry.getName(), DN.valueOf("uid=1,ou=people,dc=ucsf,dc=edu"));
+            Assert.assertFalse(reader.hasNext());
+            try {
+                reader.readEntry();
+                Assert.fail("reader.readEntry() should have thrown NoSuchElementException");
+            } catch (NoSuchElementException e) {
+                // This is expected.
+            }
+        } finally {
+            reader.close();
+        }
     }
-    finally
-    {
-      reader.close();
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
index b707dd8..cc1f3e7 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,71 +26,51 @@
 
 package org.forgerock.opendj.ldif;
 
-
-
 import java.util.ArrayList;
 import java.util.List;
 
 import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.LinkedHashMapEntry;
-import org.forgerock.opendj.ldif.LDIFEntryWriter;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-
 /**
  * This class tests the LDIFEntryWriter functionality.
  */
-public final class LDIFEntryWriterTestCase extends LDIFTestCase
-{
+public final class LDIFEntryWriterTestCase extends LDIFTestCase {
 
-  /**
-   * Tests writeEntry method of LDIFEntryWriter class.See
-   * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test()
-  public void testWriteEntry() throws Exception
-  {
-    final Entry entry = new LinkedHashMapEntry(
-        "cn=John Doe,ou=people,dc=example,dc=com");
-    entry.addAttribute("objectClass", "top", "person", "inetOrgPerson");
-    entry.addAttribute("cn", "John Doe");
-    entry.addAttribute("sn", "Doe");
-    entry.addAttribute("givenName", "John");
-    entry.addAttribute("description", "one two", "three four", "five six");
-    entry.addAttribute("typeOnly");
-    entry.addAttribute("localized;lang-fr", "\u00e7edilla");
+    /**
+     * Tests writeEntry method of LDIFEntryWriter class.See
+     * https://opends.dev.java.net/issues/show_bug.cgi?id=4545 for more details.
+     *
+     * @throws Exception
+     *             If the test failed unexpectedly.
+     */
+    @Test()
+    public void testWriteEntry() throws Exception {
+        final Entry entry = new LinkedHashMapEntry("cn=John Doe,ou=people,dc=example,dc=com");
+        entry.addAttribute("objectClass", "top", "person", "inetOrgPerson");
+        entry.addAttribute("cn", "John Doe");
+        entry.addAttribute("sn", "Doe");
+        entry.addAttribute("givenName", "John");
+        entry.addAttribute("description", "one two", "three four", "five six");
+        entry.addAttribute("typeOnly");
+        entry.addAttribute("localized;lang-fr", "\u00e7edilla");
 
-    final List<String> actual = new ArrayList<String>();
-    final LDIFEntryWriter writer = new LDIFEntryWriter(actual);
-    writer.writeEntry(entry);
-    writer.close();
+        final List<String> actual = new ArrayList<String>();
+        final LDIFEntryWriter writer = new LDIFEntryWriter(actual);
+        writer.writeEntry(entry);
+        writer.close();
 
-    final String[] expected = new String[] {
-        "dn: cn=John Doe,ou=people,dc=example,dc=com",
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: inetOrgPerson",
-        "cn: John Doe",
-        "sn: Doe",
-        "givenName: John",
-        "description: one two",
-        "description: three four",
-        "description: five six",
-        "typeOnly: ",
-        "localized;lang-fr:: w6dlZGlsbGE=",
-        "",
-        };
+        final String[] expected =
+                new String[] { "dn: cn=John Doe,ou=people,dc=example,dc=com", "objectClass: top",
+                    "objectClass: person", "objectClass: inetOrgPerson", "cn: John Doe", "sn: Doe",
+                    "givenName: John", "description: one two", "description: three four",
+                    "description: five six", "typeOnly: ", "localized;lang-fr:: w6dlZGlsbGE=", "", };
 
-    Assert.assertEquals(actual.size(), expected.length);
-    for (int i = 0; i < expected.length; i++)
-    {
-      Assert.assertEquals(actual.get(i), expected[i], "LDIF output was "
-          + actual);
+        Assert.assertEquals(actual.size(), expected.length);
+        for (int i = 0; i < expected.length; i++) {
+            Assert.assertEquals(actual.get(i), expected[i], "LDIF output was " + actual);
+        }
     }
-  }
 }
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java
index a88d9a0..f86faee 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,19 +26,14 @@
  */
 package org.forgerock.opendj.ldif;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all LDIF unit tests should extend. LDIF represents the
  * classes found directly under the package org.forgerock.opendj.ldif.
  */
 
 @Test(groups = { "precommit", "types", "sdk" })
-public abstract class LDIFTestCase extends ForgeRockTestCase
-{
+public abstract class LDIFTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-ldap-sync/pom.xml b/opendj3/opendj-ldap-sync/pom.xml
index b522a9d..192859e 100644
--- a/opendj3/opendj-ldap-sync/pom.xml
+++ b/opendj3/opendj-ldap-sync/pom.xml
@@ -7,17 +7,16 @@
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
- ! You can obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  ! or http://forgerock.org/license/CDDLv1.0.html.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
- ! file and include the License file at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- ! add the following below this CDDL HEADER, with the fields enclosed
- ! by brackets "[]" replaced with your own identifying information:
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/bat/ldapsync.bat b/opendj3/opendj-ldap-sync/src/main/assembly/bat/ldapsync.bat
index 0a00d8c..44a9c08 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/bat/ldapsync.bat
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/bat/ldapsync.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/descriptor.xml b/opendj3/opendj-ldap-sync/src/main/assembly/descriptor.xml
index 638c4eb..85bc9c7 100644
--- a/opendj3/opendj-ldap-sync/src/main/assembly/descriptor.xml
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/descriptor.xml
@@ -7,17 +7,16 @@
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
- ! You can obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  ! or http://forgerock.org/license/CDDLv1.0.html.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
- ! file and include the License file at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- ! add the following below this CDDL HEADER, with the fields enclosed
- ! by brackets "[]" replaced with your own identifying information:
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_client-script.bat b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_client-script.bat
index 8cc2431..5ac8809 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_client-script.bat
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_client-script.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_script-util.bat b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_script-util.bat
index 739a7b0..7ecb1f2 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_script-util.bat
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/_script-util.bat
@@ -7,14 +7,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/setcp.bat b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/setcp.bat
index 4a3fd8f..d0363c8 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/libbat/setcp.bat
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/libbat/setcp.bat
@@ -7,14 +7,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_client-script.sh b/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_client-script.sh
index c010f3a..5ef47c2 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_client-script.sh
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_client-script.sh
@@ -7,17 +7,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_script-util.sh b/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_script-util.sh
index 18e27bd..bfcc380 100755
--- a/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_script-util.sh
+++ b/opendj3/opendj-ldap-sync/src/main/assembly/libbin/_script-util.sh
@@ -7,17 +7,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/Main.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/Main.java
index be8363c..44e6920 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/Main.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/Main.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/ChangeRecordContext.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/ChangeRecordContext.java
index cef0cdd..2d2a628 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/ChangeRecordContext.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/ChangeRecordContext.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Filter.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Filter.java
index 7d4f4ac..f0849cc 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Filter.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Filter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/FilterResult.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/FilterResult.java
index 4ae54cb..a12b4d4 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/FilterResult.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/FilterResult.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Matchers.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Matchers.java
index c577365..7009ace 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Matchers.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Matchers.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Transforms.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Transforms.java
index c33187e..14ecb09 100644
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Transforms.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/Transforms.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/package-info.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/package-info.java
index 0808cb5..5eb8d69 100755
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/package-info.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/filters/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/package-info.java b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/package-info.java
index 363cfc1..acb26dd 100755
--- a/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/package-info.java
+++ b/opendj3/opendj-ldap-sync/src/main/java/org/forgerock/opendj/sync/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/pom.xml b/opendj3/opendj-ldap-toolkit/pom.xml
index 91b2fea..c120a3d 100644
--- a/opendj3/opendj-ldap-toolkit/pom.xml
+++ b/opendj3/opendj-ldap-toolkit/pom.xml
@@ -7,17 +7,16 @@
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
- ! You can obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  ! or http://forgerock.org/license/CDDLv1.0.html.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
- ! file and include the License file at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- ! add the following below this CDDL HEADER, with the fields enclosed
- ! by brackets "[]" replaced with your own identifying information:
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
index a293bb1..0764528 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
index 91e882c..f457741 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
index e4f64f2..b2d9e16 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
index bec2ed7..fdd9218 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
index 4148417..bad1fae 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
index e477693..02d4b51 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
index 6966992..17c16da 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
index df8271f..ef0c8a5 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
index 24fd2f6..5fac190 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
index a6f03fb..d2984a3 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/descriptor.xml b/opendj3/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
index e78bec7..d75cdd3 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
@@ -7,17 +7,16 @@
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
- ! You can obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  ! or http://forgerock.org/license/CDDLv1.0.html.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
- ! file and include the License file at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- ! add the following below this CDDL HEADER, with the fields enclosed
- ! by brackets "[]" replaced with your own identifying information:
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
index 8cc2431..5ac8809 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
@@ -8,14 +8,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
index 739a7b0..7ecb1f2 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
@@ -7,14 +7,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
index 4a3fd8f..d0363c8 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
@@ -7,14 +7,14 @@
 rem with the License.
 rem
 rem You can obtain a copy of the license at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt
+rem legal-notices/CDDLv1_0.txt
 rem or http://forgerock.org/license/CDDLv1.0.html.
 rem See the License for the specific language governing permissions
 rem and limitations under the License.
 rem
 rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at
-rem trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
+rem file and include the License file at legal-notices/CDDLv1_0.txt.
+rem legal-notices/CDDLv1_0.txt.  If applicable,
 rem add the following below this CDDL HEADER, with the fields enclosed
 rem by brackets "[]" replaced with your own identifying information:
 rem      Portions Copyright [yyyy] [name of copyright owner]
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
index c010f3a..5ef47c2 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
@@ -7,17 +7,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
index 18e27bd..bfcc380 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
+++ b/opendj3/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
@@ -7,17 +7,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java
index 036329d..2e0a556 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ApplicationKeyManager.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,14 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import java.net.Socket;
-import java.security.*;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.UnrecoverableKeyException;
 import java.security.cert.X509Certificate;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -41,295 +44,229 @@
 import javax.net.ssl.TrustManagerFactory;
 import javax.net.ssl.X509KeyManager;
 
-
-
 /**
  * This class is in charge of checking whether the certificates that are
  * presented are trusted or not. This implementation tries to check also that
  * the subject DN of the certificate corresponds to the host passed using the
  * setHostName method.
- *<p>
+ * <p>
  * The constructor tries to use a default TrustManager from the system and if it
  * cannot be retrieved this class will only accept the certificates explicitly
  * accepted by the user (and specified by calling acceptCertificate).
- *<p>
+ * <p>
  * NOTE: this class is not aimed to be used when we have connections in
  * parallel.
  */
-final class ApplicationKeyManager implements X509KeyManager
-{
-  static private final Logger LOG = Logger
-      .getLogger(ApplicationKeyManager.class.getName());
+final class ApplicationKeyManager implements X509KeyManager {
+    static private final Logger LOG = Logger.getLogger(ApplicationKeyManager.class.getName());
 
-  /**
-   * The default keyManager.
-   */
-  private X509KeyManager keyManager = null;
+    /**
+     * The default keyManager.
+     */
+    private X509KeyManager keyManager = null;
 
+    /**
+     * The default constructor.
+     *
+     * @param keystore
+     *            The keystore to use for this keymanager.
+     * @param password
+     *            The keystore password to use for this keymanager.
+     */
+    ApplicationKeyManager(final KeyStore keystore, final char[] password) {
+        KeyManagerFactory kmf = null;
+        String userSpecifiedAlgo = System.getProperty("org.opendj.admin.keymanageralgo");
+        String userSpecifiedProvider = System.getProperty("org.opendj.admin.keymanagerprovider");
 
-
-  /**
-   * The default constructor.
-   *
-   * @param keystore
-   *          The keystore to use for this keymanager.
-   * @param password
-   *          The keystore password to use for this keymanager.
-   */
-  ApplicationKeyManager(final KeyStore keystore, final char[] password)
-  {
-    KeyManagerFactory kmf = null;
-    String userSpecifiedAlgo = System
-        .getProperty("org.opendj.admin.keymanageralgo");
-    String userSpecifiedProvider = System
-        .getProperty("org.opendj.admin.keymanagerprovider");
-
-    // Handle IBM specific cases if the user did not specify a algorithm
-    // and/or provider.
-    final String vendor = System.getProperty("java.vendor");
-    if (vendor.startsWith("IBM"))
-    {
-      if (userSpecifiedAlgo == null)
-      {
-        userSpecifiedAlgo = "IbmX509";
-      }
-      if (userSpecifiedProvider == null)
-      {
-        userSpecifiedProvider = "IBMJSSE2";
-      }
-    }
-
-    // Have some fallbacks to choose the provider and algorith of the
-    // key manager. First see if the user wanted to use something
-    // specific, then try with the SunJSSE provider and SunX509
-    // algorithm. Finally, fallback to the default algorithm of the JVM.
-    final String[] preferredProvider = { userSpecifiedProvider, "SunJSSE",
-        null, null };
-    final String[] preferredAlgo = { userSpecifiedAlgo, "SunX509", "SunX509",
-        TrustManagerFactory.getDefaultAlgorithm() };
-    for (int i = 0; i < preferredProvider.length && keyManager == null; i++)
-    {
-      final String provider = preferredProvider[i];
-      final String algo = preferredAlgo[i];
-      if (algo == null)
-      {
-        continue;
-      }
-      try
-      {
-        if (provider != null)
-        {
-          kmf = KeyManagerFactory.getInstance(algo, provider);
+        // Handle IBM specific cases if the user did not specify a algorithm
+        // and/or provider.
+        final String vendor = System.getProperty("java.vendor");
+        if (vendor.startsWith("IBM")) {
+            if (userSpecifiedAlgo == null) {
+                userSpecifiedAlgo = "IbmX509";
+            }
+            if (userSpecifiedProvider == null) {
+                userSpecifiedProvider = "IBMJSSE2";
+            }
         }
-        else
-        {
-          kmf = KeyManagerFactory.getInstance(algo);
+
+        // Have some fallbacks to choose the provider and algorith of the
+        // key manager. First see if the user wanted to use something
+        // specific, then try with the SunJSSE provider and SunX509
+        // algorithm. Finally, fallback to the default algorithm of the JVM.
+        final String[] preferredProvider = { userSpecifiedProvider, "SunJSSE", null, null };
+        final String[] preferredAlgo = { userSpecifiedAlgo, "SunX509", "SunX509",
+                    TrustManagerFactory.getDefaultAlgorithm() };
+        for (int i = 0; i < preferredProvider.length && keyManager == null; i++) {
+            final String provider = preferredProvider[i];
+            final String algo = preferredAlgo[i];
+            if (algo == null) {
+                continue;
+            }
+            try {
+                if (provider != null) {
+                    kmf = KeyManagerFactory.getInstance(algo, provider);
+                } else {
+                    kmf = KeyManagerFactory.getInstance(algo);
+                }
+                kmf.init(keystore, password);
+                final KeyManager[] kms = kmf.getKeyManagers();
+                /*
+                 * Iterate over the returned keymanagers, look for an instance
+                 * of X509KeyManager. If found, use that as our "default" key
+                 * manager.
+                 */
+                for (final KeyManager km : kms) {
+                    if (kms[i] instanceof X509KeyManager) {
+                        keyManager = (X509KeyManager) km;
+                        break;
+                    }
+                }
+            } catch (final NoSuchAlgorithmException e) {
+                // Nothing to do. Maybe we should avoid this and be strict, but
+                // we are in a best effor mode.
+                LOG.log(Level.WARNING, "Error with the algorithm", e);
+            } catch (final KeyStoreException e) {
+                // Nothing to do. Maybe we should avoid this and be strict, but
+                // we are in a best effor mode..
+                LOG.log(Level.WARNING, "Error with the keystore", e);
+            } catch (final UnrecoverableKeyException e) {
+                // Nothing to do. Maybe we should avoid this and be strict, but
+                // we are in a best effor mode.
+                LOG.log(Level.WARNING, "Error with the key", e);
+            } catch (final NoSuchProviderException e) {
+                // Nothing to do. Maybe we should avoid this and be strict, but
+                // we are in a best effor mode.
+                LOG.log(Level.WARNING, "Error with the provider", e);
+            }
         }
-        kmf.init(keystore, password);
-        final KeyManager kms[] = kmf.getKeyManagers();
-        /*
-         * Iterate over the returned keymanagers, look for an instance of
-         * X509KeyManager. If found, use that as our "default" key manager.
-         */
-        for (final KeyManager km : kms)
-        {
-          if (kms[i] instanceof X509KeyManager)
-          {
-            keyManager = (X509KeyManager) km;
-            break;
-          }
+    }
+
+    /**
+     * Choose an alias to authenticate the client side of a secure socket given
+     * the public key type and the list of certificate issuer authorities
+     * recognized by the peer (if any).
+     *
+     * @param keyType
+     *            the key algorithm type name(s), ordered with the
+     *            most-preferred key type first.
+     * @param issuers
+     *            the list of acceptable CA issuer subject names or null if it
+     *            does not matter which issuers are used.
+     * @param socket
+     *            the socket to be used for this connection. This parameter can
+     *            be null, in which case this method will return the most
+     *            generic alias to use.
+     * @return the alias name for the desired key, or null if there are no
+     *         matches.
+     */
+    public String chooseClientAlias(final String[] keyType, final Principal[] issuers,
+            final Socket socket) {
+        if (keyManager != null) {
+            return keyManager.chooseClientAlias(keyType, issuers, socket);
+        } else {
+            return null;
         }
-      }
-      catch (final NoSuchAlgorithmException e)
-      {
-        // Nothing to do. Maybe we should avoid this and be strict, but
-        // we are in a best effor mode.
-        LOG.log(Level.WARNING, "Error with the algorithm", e);
-      }
-      catch (final KeyStoreException e)
-      {
-        // Nothing to do. Maybe we should avoid this and be strict, but
-        // we are in a best effor mode..
-        LOG.log(Level.WARNING, "Error with the keystore", e);
-      }
-      catch (final UnrecoverableKeyException e)
-      {
-        // Nothing to do. Maybe we should avoid this and be strict, but
-        // we are in a best effor mode.
-        LOG.log(Level.WARNING, "Error with the key", e);
-      }
-      catch (final NoSuchProviderException e)
-      {
-        // Nothing to do. Maybe we should avoid this and be strict, but
-        // we are in a best effor mode.
-        LOG.log(Level.WARNING, "Error with the provider", e);
-      }
     }
-  }
 
-
-
-  /**
-   * Choose an alias to authenticate the client side of a secure socket given
-   * the public key type and the list of certificate issuer authorities
-   * recognized by the peer (if any).
-   *
-   * @param keyType
-   *          the key algorithm type name(s), ordered with the most-preferred
-   *          key type first.
-   * @param issuers
-   *          the list of acceptable CA issuer subject names or null if it does
-   *          not matter which issuers are used.
-   * @param socket
-   *          the socket to be used for this connection. This parameter can be
-   *          null, in which case this method will return the most generic alias
-   *          to use.
-   * @return the alias name for the desired key, or null if there are no
-   *         matches.
-   */
-  public String chooseClientAlias(final String[] keyType,
-      final Principal[] issuers, final Socket socket)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.chooseClientAlias(keyType, issuers, socket);
+    /**
+     * Choose an alias to authenticate the client side of a secure socket given
+     * the public key type and the list of certificate issuer authorities
+     * recognized by the peer (if any).
+     *
+     * @param keyType
+     *            the key algorithm type name(s), ordered with the
+     *            most-preferred key type first.
+     * @param issuers
+     *            the list of acceptable CA issuer subject names or null if it
+     *            does not matter which issuers are used.
+     * @param socket
+     *            the socket to be used for this connection. This parameter can
+     *            be null, in which case this method will return the most
+     *            generic alias to use.
+     * @return the alias name for the desired key, or null if there are no
+     *         matches.
+     */
+    public String chooseServerAlias(final String keyType, final Principal[] issuers,
+            final Socket socket) {
+        if (keyManager != null) {
+            return keyManager.chooseServerAlias(keyType, issuers, socket);
+        } else {
+            return null;
+        }
     }
-    else
-    {
-      return null;
+
+    /**
+     * Returns the certificate chain associated with the given alias.
+     *
+     * @param alias
+     *            the alias name
+     * @return the certificate chain (ordered with the user's certificate first
+     *         and the root certificate authority last), or null if the alias
+     *         can't be found.
+     */
+    public X509Certificate[] getCertificateChain(final String alias) {
+        if (keyManager != null) {
+            return keyManager.getCertificateChain(alias);
+        } else {
+            return null;
+        }
     }
-  }
 
-
-
-  /**
-   * Choose an alias to authenticate the client side of a secure socket given
-   * the public key type and the list of certificate issuer authorities
-   * recognized by the peer (if any).
-   *
-   * @param keyType
-   *          the key algorithm type name(s), ordered with the most-preferred
-   *          key type first.
-   * @param issuers
-   *          the list of acceptable CA issuer subject names or null if it does
-   *          not matter which issuers are used.
-   * @param socket
-   *          the socket to be used for this connection. This parameter can be
-   *          null, in which case this method will return the most generic alias
-   *          to use.
-   * @return the alias name for the desired key, or null if there are no
-   *         matches.
-   */
-  public String chooseServerAlias(final String keyType,
-      final Principal[] issuers, final Socket socket)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.chooseServerAlias(keyType, issuers, socket);
+    /**
+     * Get the matching aliases for authenticating the server side of a secure
+     * socket given the public key type and the list of certificate issuer
+     * authorities recognized by the peer (if any).
+     *
+     * @param keyType
+     *            the key algorithm type name
+     * @param issuers
+     *            the list of acceptable CA issuer subject names or null if it
+     *            does not matter which issuers are used.
+     * @return an array of the matching alias names, or null if there were no
+     *         matches.
+     */
+    public String[] getClientAliases(final String keyType, final Principal[] issuers) {
+        if (keyManager != null) {
+            return keyManager.getClientAliases(keyType, issuers);
+        } else {
+            return null;
+        }
     }
-    else
-    {
-      return null;
+
+    /**
+     * Returns the key associated with the given alias.
+     *
+     * @param alias
+     *            the alias name
+     * @return the requested key, or null if the alias can't be found.
+     */
+    public PrivateKey getPrivateKey(final String alias) {
+        if (keyManager != null) {
+            return keyManager.getPrivateKey(alias);
+        } else {
+            return null;
+        }
     }
-  }
 
-
-
-  /**
-   * Returns the certificate chain associated with the given alias.
-   *
-   * @param alias
-   *          the alias name
-   * @return the certificate chain (ordered with the user's certificate first
-   *         and the root certificate authority last), or null if the alias
-   *         can't be found.
-   */
-  public X509Certificate[] getCertificateChain(final String alias)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.getCertificateChain(alias);
+    /**
+     * Get the matching aliases for authenticating the server side of a secure
+     * socket given the public key type and the list of certificate issuer
+     * authorities recognized by the peer (if any).
+     *
+     * @param keyType
+     *            the key algorithm type name
+     * @param issuers
+     *            the list of acceptable CA issuer subject names or null if it
+     *            does not matter which issuers are used.
+     * @return an array of the matching alias names, or null if there were no
+     *         matches.
+     */
+    public String[] getServerAliases(final String keyType, final Principal[] issuers) {
+        if (keyManager != null) {
+            return keyManager.getServerAliases(keyType, issuers);
+        } else {
+            return null;
+        }
     }
-    else
-    {
-      return null;
-    }
-  }
-
-
-
-  /**
-   * Get the matching aliases for authenticating the server side of a secure
-   * socket given the public key type and the list of certificate issuer
-   * authorities recognized by the peer (if any).
-   *
-   * @param keyType
-   *          the key algorithm type name
-   * @param issuers
-   *          the list of acceptable CA issuer subject names or null if it does
-   *          not matter which issuers are used.
-   * @return an array of the matching alias names, or null if there were no
-   *         matches.
-   */
-  public String[] getClientAliases(final String keyType,
-      final Principal[] issuers)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.getClientAliases(keyType, issuers);
-    }
-    else
-    {
-      return null;
-    }
-  }
-
-
-
-  /**
-   * Returns the key associated with the given alias.
-   *
-   * @param alias
-   *          the alias name
-   * @return the requested key, or null if the alias can't be found.
-   */
-  public PrivateKey getPrivateKey(final String alias)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.getPrivateKey(alias);
-    }
-    else
-    {
-      return null;
-    }
-  }
-
-
-
-  /**
-   * Get the matching aliases for authenticating the server side of a secure
-   * socket given the public key type and the list of certificate issuer
-   * authorities recognized by the peer (if any).
-   *
-   * @param keyType
-   *          the key algorithm type name
-   * @param issuers
-   *          the list of acceptable CA issuer subject names or null if it does
-   *          not matter which issuers are used.
-   * @return an array of the matching alias names, or null if there were no
-   *         matches.
-   */
-  public String[] getServerAliases(final String keyType,
-      final Principal[] issuers)
-  {
-    if (keyManager != null)
-    {
-      return keyManager.getServerAliases(keyType, issuers);
-    }
-    else
-    {
-      return null;
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Argument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Argument.java
index 60aad3b..11c5a55 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Argument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Argument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
 
@@ -37,753 +34,617 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines a generic argument that may be used in the argument list
  * for an application. This is an abstract class that must be subclassed in
  * order to provide specific functionality.
  */
-abstract class Argument
-{
-  // Indicates whether this argument should be hidden in the usage
-  // information.
-  private boolean isHidden;
+abstract class Argument {
+    // Indicates whether this argument should be hidden in the usage
+    // information.
+    private boolean isHidden;
 
-  // Indicates whether this argument may be specified more than once for
-  // multiple values.
-  private boolean isMultiValued;
+    // Indicates whether this argument may be specified more than once for
+    // multiple values.
+    private boolean isMultiValued;
 
-  // Indicates whether this argument was provided in the set of
-  // command-line
-  // arguments.
-  private boolean isPresent;
+    // Indicates whether this argument was provided in the set of
+    // command-line
+    // arguments.
+    private boolean isPresent;
 
-  // Indicates whether this argument is required to have a value.
-  private boolean isRequired;
+    // Indicates whether this argument is required to have a value.
+    private boolean isRequired;
 
-  // Indicates whether this argument requires a value.
-  private boolean needsValue;
+    // Indicates whether this argument requires a value.
+    private boolean needsValue;
 
-  // The single-character identifier for this argument.
-  private final Character shortIdentifier;
+    // The single-character identifier for this argument.
+    private final Character shortIdentifier;
 
-  // The unique ID of the description for this argument.
-  private final LocalizableMessage description;
+    // The unique ID of the description for this argument.
+    private final LocalizableMessage description;
 
-  // The set of values for this argument.
-  private final LinkedList<String> values;
+    // The set of values for this argument.
+    private final LinkedList<String> values;
 
-  // The default value for the argument if none other is provided.
-  private String defaultValue;
+    // The default value for the argument if none other is provided.
+    private String defaultValue;
 
-  // The long identifier for this argument.
-  private final String longIdentifier;
+    // The long identifier for this argument.
+    private final String longIdentifier;
 
-  // The generic name that will be used to refer to this argument.
-  private final String name;
+    // The generic name that will be used to refer to this argument.
+    private final String name;
 
-  // The name of the property that can be used to set the default value.
-  private String propertyName;
+    // The name of the property that can be used to set the default value.
+    private String propertyName;
 
-  // The value placeholder for this argument, which will be used in
-  // usage
-  // information.
-  private LocalizableMessage valuePlaceholder;
+    // The value placeholder for this argument, which will be used in
+    // usage
+    // information.
+    private LocalizableMessage valuePlaceholder;
 
-  // Indicates whether this argument was provided in the set of
-  // properties
-  // found is a properties file.
-  private boolean isValueSetByProperty;
+    // Indicates whether this argument was provided in the set of
+    // properties
+    // found is a properties file.
+    private boolean isValueSetByProperty;
 
+    /**
+     * Creates a new argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    protected Argument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final String defaultValue, final String propertyName,
+            final LocalizableMessage description) throws ArgumentException {
+        this.name = name;
+        this.shortIdentifier = shortIdentifier;
+        this.longIdentifier = longIdentifier;
+        this.isRequired = isRequired;
+        this.isMultiValued = isMultiValued;
+        this.needsValue = needsValue;
+        this.valuePlaceholder = valuePlaceholder;
+        this.defaultValue = defaultValue;
+        this.propertyName = propertyName;
+        this.description = description;
+        this.isValueSetByProperty = false;
 
+        if ((shortIdentifier == null) && (longIdentifier == null)) {
+            final LocalizableMessage message = ERR_ARG_NO_IDENTIFIER.get(name);
+            throw new ArgumentException(message);
+        }
 
-  /**
-   * Creates a new argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  protected Argument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final String defaultValue,
-      final String propertyName, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    this.name = name;
-    this.shortIdentifier = shortIdentifier;
-    this.longIdentifier = longIdentifier;
-    this.isRequired = isRequired;
-    this.isMultiValued = isMultiValued;
-    this.needsValue = needsValue;
-    this.valuePlaceholder = valuePlaceholder;
-    this.defaultValue = defaultValue;
-    this.propertyName = propertyName;
-    this.description = description;
-    this.isValueSetByProperty = false;
+        if (needsValue && (valuePlaceholder == null)) {
+            final LocalizableMessage message = ERR_ARG_NO_VALUE_PLACEHOLDER.get(name);
+            throw new ArgumentException(message);
+        }
 
-    if ((shortIdentifier == null) && (longIdentifier == null))
-    {
-      final LocalizableMessage message = ERR_ARG_NO_IDENTIFIER.get(name);
-      throw new ArgumentException(message);
+        values = new LinkedList<String>();
+        isPresent = false;
+        isHidden = false;
     }
 
-    if (needsValue && (valuePlaceholder == null))
-    {
-      final LocalizableMessage message = ERR_ARG_NO_VALUE_PLACEHOLDER.get(name);
-      throw new ArgumentException(message);
+    /**
+     * Adds a value to the set of values for this argument. This should only be
+     * called if the value is allowed by the <CODE>valueIsAcceptable</CODE>
+     * method.
+     *
+     * @param valueString
+     *            The string representation of the value to add to this
+     *            argument.
+     */
+    public void addValue(final String valueString) {
+        values.add(valueString);
     }
 
-    values = new LinkedList<String>();
-    isPresent = false;
-    isHidden = false;
-  }
-
-
-
-  /**
-   * Adds a value to the set of values for this argument. This should only be
-   * called if the value is allowed by the <CODE>valueIsAcceptable</CODE>
-   * method.
-   *
-   * @param valueString
-   *          The string representation of the value to add to this argument.
-   */
-  public void addValue(final String valueString)
-  {
-    values.add(valueString);
-  }
-
-
-
-  /**
-   * Clears the set of values assigned to this argument.
-   */
-  public void clearValues()
-  {
-    values.clear();
-  }
-
-
-
-  /**
-   * Retrieves the value of this argument as a <CODE>Boolean</CODE>.
-   *
-   * @return The value of this argument as a <CODE>Boolean</CODE>.
-   * @throws ArgumentException
-   *           If this argument cannot be interpreted as a Boolean value.
-   */
-  public boolean getBooleanValue() throws ArgumentException
-  {
-    if (values.isEmpty())
-    {
-      final LocalizableMessage message = ERR_ARG_NO_BOOLEAN_VALUE.get(name);
-      throw new ArgumentException(message);
+    /**
+     * Clears the set of values assigned to this argument.
+     */
+    public void clearValues() {
+        values.clear();
     }
 
-    final Iterator<String> iterator = values.iterator();
-    final String valueString = toLowerCase(iterator.next());
+    /**
+     * Retrieves the value of this argument as a <CODE>Boolean</CODE>.
+     *
+     * @return The value of this argument as a <CODE>Boolean</CODE>.
+     * @throws ArgumentException
+     *             If this argument cannot be interpreted as a Boolean value.
+     */
+    public boolean getBooleanValue() throws ArgumentException {
+        if (values.isEmpty()) {
+            final LocalizableMessage message = ERR_ARG_NO_BOOLEAN_VALUE.get(name);
+            throw new ArgumentException(message);
+        }
 
-    boolean booleanValue;
-    if (valueString.equals("true") || valueString.equals("yes")
-        || valueString.equals("on") || valueString.equals("1"))
-    {
-      booleanValue = true;
-    }
-    else if (valueString.equals("false") || valueString.equals("no")
-        || valueString.equals("off") || valueString.equals("0"))
-    {
-      booleanValue = false;
-    }
-    else
-    {
-      final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_BOOLEAN.get(
-          valueString, name);
-      throw new ArgumentException(message);
+        final Iterator<String> iterator = values.iterator();
+        final String valueString = toLowerCase(iterator.next());
+
+        boolean booleanValue;
+        if (valueString.equals("true") || valueString.equals("yes") || valueString.equals("on")
+                || valueString.equals("1")) {
+            booleanValue = true;
+        } else if (valueString.equals("false") || valueString.equals("no")
+                || valueString.equals("off") || valueString.equals("0")) {
+            booleanValue = false;
+        } else {
+            final LocalizableMessage message =
+                    ERR_ARG_CANNOT_DECODE_AS_BOOLEAN.get(valueString, name);
+            throw new ArgumentException(message);
+        }
+
+        if (iterator.hasNext()) {
+            final LocalizableMessage message = ERR_ARG_BOOLEAN_MULTIPLE_VALUES.get(name);
+            throw new ArgumentException(message);
+        } else {
+            return booleanValue;
+        }
     }
 
-    if (iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_ARG_BOOLEAN_MULTIPLE_VALUES
-          .get(name);
-      throw new ArgumentException(message);
-    }
-    else
-    {
-      return booleanValue;
-    }
-  }
-
-
-
-  /**
-   * Retrieves the default value that will be used for this argument if it is
-   * not specified on the command line and it is not set from a properties file.
-   *
-   * @return The default value that will be used for this argument if it is not
-   *         specified on the command line and it is not set from a properties
-   *         file, or <CODE>null</CODE> if there is no default value.
-   */
-  public String getDefaultValue()
-  {
-    return defaultValue;
-  }
-
-
-
-  /**
-   * Retrieves the human-readable description for this argument.
-   *
-   * @return The human-readable description for this argument.
-   */
-  public LocalizableMessage getDescription()
-  {
-    return description != null ? description : LocalizableMessage.EMPTY;
-  }
-
-
-
-  /**
-   * Retrieves the value of this argument as an integer.
-   *
-   * @return The value of this argument as an integer.
-   * @throws ArgumentException
-   *           If there are multiple values, or the value cannot be parsed as an
-   *           integer.
-   */
-  public double getDoubleValue() throws ArgumentException
-  {
-    if (values.isEmpty())
-    {
-      final LocalizableMessage message = ERR_ARG_NO_INT_VALUE.get(name);
-      throw new ArgumentException(message);
+    /**
+     * Retrieves the default value that will be used for this argument if it is
+     * not specified on the command line and it is not set from a properties
+     * file.
+     *
+     * @return The default value that will be used for this argument if it is
+     *         not specified on the command line and it is not set from a
+     *         properties file, or <CODE>null</CODE> if there is no default
+     *         value.
+     */
+    public String getDefaultValue() {
+        return defaultValue;
     }
 
-    final Iterator<String> iterator = values.iterator();
-    final String valueString = iterator.next();
-
-    double intValue;
-    try
-    {
-      intValue = Double.parseDouble(valueString);
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(
-          valueString, name);
-      throw new ArgumentException(message, e);
+    /**
+     * Retrieves the human-readable description for this argument.
+     *
+     * @return The human-readable description for this argument.
+     */
+    public LocalizableMessage getDescription() {
+        return description != null ? description : LocalizableMessage.EMPTY;
     }
 
-    if (iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_ARG_INT_MULTIPLE_VALUES.get(name);
-      throw new ArgumentException(message);
-    }
-    else
-    {
-      return intValue;
-    }
-  }
+    /**
+     * Retrieves the value of this argument as an integer.
+     *
+     * @return The value of this argument as an integer.
+     * @throws ArgumentException
+     *             If there are multiple values, or the value cannot be parsed
+     *             as an integer.
+     */
+    public double getDoubleValue() throws ArgumentException {
+        if (values.isEmpty()) {
+            final LocalizableMessage message = ERR_ARG_NO_INT_VALUE.get(name);
+            throw new ArgumentException(message);
+        }
 
+        final Iterator<String> iterator = values.iterator();
+        final String valueString = iterator.next();
 
+        double intValue;
+        try {
+            intValue = Double.parseDouble(valueString);
+        } catch (final Exception e) {
+            final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name);
+            throw new ArgumentException(message, e);
+        }
 
-  /**
-   * Retrieves the set of values for this argument as a list of integers.
-   *
-   * @return A list of the integer representations of the values for this
-   *         argument.
-   * @throws ArgumentException
-   *           If any of the values cannot be parsed as an integer.
-   */
-  public LinkedList<Double> getDoubleValues() throws ArgumentException
-  {
-    final LinkedList<Double> intList = new LinkedList<Double>();
-
-    final Iterator<String> iterator = values.iterator();
-    while (iterator.hasNext())
-    {
-      final String valueString = iterator.next();
-
-      try
-      {
-        intList.add(Double.valueOf(valueString));
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(
-            valueString, name);
-        throw new ArgumentException(message, e);
-      }
+        if (iterator.hasNext()) {
+            final LocalizableMessage message = ERR_ARG_INT_MULTIPLE_VALUES.get(name);
+            throw new ArgumentException(message);
+        } else {
+            return intValue;
+        }
     }
 
-    return intList;
-  }
+    /**
+     * Retrieves the set of values for this argument as a list of integers.
+     *
+     * @return A list of the integer representations of the values for this
+     *         argument.
+     * @throws ArgumentException
+     *             If any of the values cannot be parsed as an integer.
+     */
+    public LinkedList<Double> getDoubleValues() throws ArgumentException {
+        final LinkedList<Double> intList = new LinkedList<Double>();
 
+        final Iterator<String> iterator = values.iterator();
+        while (iterator.hasNext()) {
+            final String valueString = iterator.next();
 
+            try {
+                intList.add(Double.valueOf(valueString));
+            } catch (final Exception e) {
+                final LocalizableMessage message =
+                        ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name);
+                throw new ArgumentException(message, e);
+            }
+        }
 
-  /**
-   * Retrieves the value of this argument as an integer.
-   *
-   * @return The value of this argument as an integer.
-   * @throws ArgumentException
-   *           If there are multiple values, or the value cannot be parsed as an
-   *           integer.
-   */
-  public int getIntValue() throws ArgumentException
-  {
-    if (values.isEmpty())
-    {
-      final LocalizableMessage message = ERR_ARG_NO_INT_VALUE.get(name);
-      throw new ArgumentException(message);
+        return intList;
     }
 
-    final Iterator<String> iterator = values.iterator();
-    final String valueString = iterator.next();
+    /**
+     * Retrieves the value of this argument as an integer.
+     *
+     * @return The value of this argument as an integer.
+     * @throws ArgumentException
+     *             If there are multiple values, or the value cannot be parsed
+     *             as an integer.
+     */
+    public int getIntValue() throws ArgumentException {
+        if (values.isEmpty()) {
+            final LocalizableMessage message = ERR_ARG_NO_INT_VALUE.get(name);
+            throw new ArgumentException(message);
+        }
 
-    int intValue;
-    try
-    {
-      intValue = Integer.parseInt(valueString);
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(
-          valueString, name);
-      throw new ArgumentException(message, e);
+        final Iterator<String> iterator = values.iterator();
+        final String valueString = iterator.next();
+
+        int intValue;
+        try {
+            intValue = Integer.parseInt(valueString);
+        } catch (final Exception e) {
+            final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name);
+            throw new ArgumentException(message, e);
+        }
+
+        if (iterator.hasNext()) {
+            final LocalizableMessage message = ERR_ARG_INT_MULTIPLE_VALUES.get(name);
+            throw new ArgumentException(message);
+        } else {
+            return intValue;
+        }
     }
 
-    if (iterator.hasNext())
-    {
-      final LocalizableMessage message = ERR_ARG_INT_MULTIPLE_VALUES.get(name);
-      throw new ArgumentException(message);
-    }
-    else
-    {
-      return intValue;
-    }
-  }
+    /**
+     * Retrieves the set of values for this argument as a list of integers.
+     *
+     * @return A list of the integer representations of the values for this
+     *         argument.
+     * @throws ArgumentException
+     *             If any of the values cannot be parsed as an integer.
+     */
+    public LinkedList<Integer> getIntValues() throws ArgumentException {
+        final LinkedList<Integer> intList = new LinkedList<Integer>();
 
+        final Iterator<String> iterator = values.iterator();
+        while (iterator.hasNext()) {
+            final String valueString = iterator.next();
 
+            try {
+                intList.add(Integer.valueOf(valueString));
+            } catch (final Exception e) {
+                final LocalizableMessage message =
+                        ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name);
+                throw new ArgumentException(message, e);
+            }
+        }
 
-  /**
-   * Retrieves the set of values for this argument as a list of integers.
-   *
-   * @return A list of the integer representations of the values for this
-   *         argument.
-   * @throws ArgumentException
-   *           If any of the values cannot be parsed as an integer.
-   */
-  public LinkedList<Integer> getIntValues() throws ArgumentException
-  {
-    final LinkedList<Integer> intList = new LinkedList<Integer>();
-
-    final Iterator<String> iterator = values.iterator();
-    while (iterator.hasNext())
-    {
-      final String valueString = iterator.next();
-
-      try
-      {
-        intList.add(Integer.valueOf(valueString));
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage message = ERR_ARG_CANNOT_DECODE_AS_INT.get(
-            valueString, name);
-        throw new ArgumentException(message, e);
-      }
+        return intList;
     }
 
-    return intList;
-  }
-
-
-
-  /**
-   * Retrieves the long (multi-character) identifier that may be used to specify
-   * the value of this argument.
-   *
-   * @return The long (multi-character) identifier that may be used to specify
-   *         the value of this argument.
-   */
-  public String getLongIdentifier()
-  {
-    return longIdentifier;
-  }
-
-
-
-  /**
-   * Retrieves the generic name that will be used to refer to this argument.
-   *
-   * @return The generic name that will be used to refer to this argument.
-   */
-  public String getName()
-  {
-    return name;
-  }
-
-
-
-  /**
-   * Retrieves the name of a property in a properties file that may be used to
-   * set the default value for this argument if it is present. A value read from
-   * a properties file will override the default value returned from the
-   * <CODE>getDefaultValue</CODE>, but the properties file value will be
-   * overridden by a value supplied on the command line.
-   *
-   * @return The name of a property in a properties file that may be used to set
-   *         the default value for this argument if it is present.
-   */
-  public String getPropertyName()
-  {
-    return propertyName;
-  }
-
-
-
-  /**
-   * Retrieves the single-character identifier that may be used to specify the
-   * value of this argument.
-   *
-   * @return The single-character identifier that may be used to specify the
-   *         value of this argument, or <CODE>null</CODE> if there is none.
-   */
-  public Character getShortIdentifier()
-  {
-    return shortIdentifier;
-  }
-
-
-
-  /**
-   * Retrieves the string vale for this argument. If it has multiple values,
-   * then the first will be returned. If it does not have any values, then the
-   * default value will be returned.
-   *
-   * @return The string value for this argument, or <CODE>null</CODE> if there
-   *         are no values and no default value has been given.
-   */
-  public String getValue()
-  {
-    if (values.isEmpty())
-    {
-      return defaultValue;
+    /**
+     * Retrieves the long (multi-character) identifier that may be used to
+     * specify the value of this argument.
+     *
+     * @return The long (multi-character) identifier that may be used to specify
+     *         the value of this argument.
+     */
+    public String getLongIdentifier() {
+        return longIdentifier;
     }
 
-    return values.getFirst();
-  }
+    /**
+     * Retrieves the generic name that will be used to refer to this argument.
+     *
+     * @return The generic name that will be used to refer to this argument.
+     */
+    public String getName() {
+        return name;
+    }
 
+    /**
+     * Retrieves the name of a property in a properties file that may be used to
+     * set the default value for this argument if it is present. A value read
+     * from a properties file will override the default value returned from the
+     * <CODE>getDefaultValue</CODE>, but the properties file value will be
+     * overridden by a value supplied on the command line.
+     *
+     * @return The name of a property in a properties file that may be used to
+     *         set the default value for this argument if it is present.
+     */
+    public String getPropertyName() {
+        return propertyName;
+    }
 
+    /**
+     * Retrieves the single-character identifier that may be used to specify the
+     * value of this argument.
+     *
+     * @return The single-character identifier that may be used to specify the
+     *         value of this argument, or <CODE>null</CODE> if there is none.
+     */
+    public Character getShortIdentifier() {
+        return shortIdentifier;
+    }
 
-  /**
-   * Retrieves the value placeholder that will be displayed for this argument in
-   * the generated usage information.
-   *
-   * @return The value placeholder that will be displayed for this argument in
-   *         the generated usage information, or <CODE>null</CODE> if there is
-   *         none.
-   */
-  public LocalizableMessage getValuePlaceholder()
-  {
-    return valuePlaceholder;
-  }
+    /**
+     * Retrieves the string vale for this argument. If it has multiple values,
+     * then the first will be returned. If it does not have any values, then the
+     * default value will be returned.
+     *
+     * @return The string value for this argument, or <CODE>null</CODE> if there
+     *         are no values and no default value has been given.
+     */
+    public String getValue() {
+        if (values.isEmpty()) {
+            return defaultValue;
+        }
 
+        return values.getFirst();
+    }
 
+    /**
+     * Retrieves the value placeholder that will be displayed for this argument
+     * in the generated usage information.
+     *
+     * @return The value placeholder that will be displayed for this argument in
+     *         the generated usage information, or <CODE>null</CODE> if there is
+     *         none.
+     */
+    public LocalizableMessage getValuePlaceholder() {
+        return valuePlaceholder;
+    }
 
-  /**
-   * Retrieves the set of string values for this argument.
-   *
-   * @return The set of string values for this argument.
-   */
-  public LinkedList<String> getValues()
-  {
-    return values;
-  }
+    /**
+     * Retrieves the set of string values for this argument.
+     *
+     * @return The set of string values for this argument.
+     */
+    public LinkedList<String> getValues() {
+        return values;
+    }
 
+    /**
+     * Indicates whether this argument has at least one value.
+     *
+     * @return <CODE>true</CODE> if this argument has at least one value, or
+     *         <CODE>false</CODE> if it does not have any values.
+     */
+    public boolean hasValue() {
+        return (!values.isEmpty());
+    }
 
+    /**
+     * Indicates whether this argument should be hidden from the usage
+     * information.
+     *
+     * @return <CODE>true</CODE> if this argument should be hidden from the
+     *         usage information, or <CODE>false</CODE> if not.
+     */
+    public boolean isHidden() {
+        return isHidden;
+    }
 
-  /**
-   * Indicates whether this argument has at least one value.
-   *
-   * @return <CODE>true</CODE> if this argument has at least one value, or
-   *         <CODE>false</CODE> if it does not have any values.
-   */
-  public boolean hasValue()
-  {
-    return (!values.isEmpty());
-  }
+    /**
+     * Indicates whether this argument may be provided more than once on the
+     * command line to specify multiple values.
+     *
+     * @return <CODE>true</CODE> if this argument may be provided more than once
+     *         on the command line to specify multiple values, or
+     *         <CODE>false</CODE> if it may have at most one value.
+     */
+    public boolean isMultiValued() {
+        return isMultiValued;
+    }
 
+    /**
+     * Indicates whether this argument is present in the parsed set of
+     * command-line arguments.
+     *
+     * @return <CODE>true</CODE> if this argument is present in the parsed set
+     *         of command-line arguments, or <CODE>false</CODE> if not.
+     */
+    public boolean isPresent() {
+        return isPresent;
+    }
 
+    /**
+     * Indicates whether this argument is required to have at least one value.
+     *
+     * @return <CODE>true</CODE> if this argument is required to have at least
+     *         one value, or <CODE>false</CODE> if it does not need to have a
+     *         value.
+     */
+    public boolean isRequired() {
+        return isRequired;
+    }
 
-  /**
-   * Indicates whether this argument should be hidden from the usage
-   * information.
-   *
-   * @return <CODE>true</CODE> if this argument should be hidden from the usage
-   *         information, or <CODE>false</CODE> if not.
-   */
-  public boolean isHidden()
-  {
-    return isHidden;
-  }
+    /**
+     * Indicates whether this argument was provided in the set of properties
+     * found is a properties file.
+     *
+     * @return <CODE>true</CODE> if this argument was provided in the set of
+     *         properties found is a properties file, or <CODE>false</CODE> if
+     *         not.
+     */
+    public boolean isValueSetByProperty() {
+        return isValueSetByProperty;
+    }
 
+    /**
+     * Indicates whether a value must be provided with this argument if it is
+     * present.
+     *
+     * @return <CODE>true</CODE> if a value must be provided with the argument
+     *         if it is present, or <CODE>false</CODE> if the argument does not
+     *         take a value and the presence of the argument identifier itself
+     *         is sufficient to convey the necessary information.
+     */
+    public boolean needsValue() {
+        return needsValue;
+    }
 
+    /**
+     * Specifies the default value that will be used for this argument if it is
+     * not specified on the command line and it is not set from a properties
+     * file.
+     *
+     * @param defaultValue
+     *            The default value that will be used for this argument if it is
+     *            not specified on the command line and it is not set from a
+     *            properties file.
+     */
+    public void setDefaultValue(final String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
 
-  /**
-   * Indicates whether this argument may be provided more than once on the
-   * command line to specify multiple values.
-   *
-   * @return <CODE>true</CODE> if this argument may be provided more than once
-   *         on the command line to specify multiple values, or
-   *         <CODE>false</CODE> if it may have at most one value.
-   */
-  public boolean isMultiValued()
-  {
-    return isMultiValued;
-  }
+    /**
+     * Specifies whether this argument should be hidden from the usage
+     * information.
+     *
+     * @param isHidden
+     *            Indicates whether this argument should be hidden from the
+     *            usage information.
+     */
+    public void setHidden(final boolean isHidden) {
+        this.isHidden = isHidden;
+    }
 
+    /**
+     * Specifies whether this argument may be provided more than once on the
+     * command line to specify multiple values.
+     *
+     * @param isMultiValued
+     *            Indicates whether this argument may be provided more than once
+     *            on the command line to specify multiple values.
+     */
+    public void setMultiValued(final boolean isMultiValued) {
+        this.isMultiValued = isMultiValued;
+    }
 
+    /**
+     * Specifies whether a value must be provided with this argument if it is
+     * present. If this is changed from <CODE>false</CODE> to <CODE>true</CODE>,
+     * then a value placeholder must also be provided.
+     *
+     * @param needsValue
+     *            Indicates whether a value must be provided with this argument
+     *            if it is present.
+     */
+    public void setNeedsValue(final boolean needsValue) {
+        this.needsValue = needsValue;
+    }
 
-  /**
-   * Indicates whether this argument is present in the parsed set of
-   * command-line arguments.
-   *
-   * @return <CODE>true</CODE> if this argument is present in the parsed set of
-   *         command-line arguments, or <CODE>false</CODE> if not.
-   */
-  public boolean isPresent()
-  {
-    return isPresent;
-  }
+    /**
+     * Specifies whether this argument is present in the parsed set of
+     * command-line arguments.
+     *
+     * @param isPresent
+     *            Indicates whether this argument is present in the set of
+     *            command-line arguments.
+     */
+    public void setPresent(final boolean isPresent) {
+        this.isPresent = isPresent;
+    }
 
+    /**
+     * Specifies the name of a property in a properties file that may be used to
+     * set the default value for this argument if it is present.
+     *
+     * @param propertyName
+     *            The name of a property in a properties file that may be used
+     *            to set the default value for this argument if it is present.
+     */
+    public void setPropertyName(final String propertyName) {
+        this.propertyName = propertyName;
+    }
 
+    /**
+     * Specifies whether this argument is required to have at least one value.
+     *
+     * @param isRequired
+     *            Indicates whether this argument is required to have at least
+     *            one value.
+     */
+    public void setRequired(final boolean isRequired) {
+        this.isRequired = isRequired;
+    }
 
-  /**
-   * Indicates whether this argument is required to have at least one value.
-   *
-   * @return <CODE>true</CODE> if this argument is required to have at least one
-   *         value, or <CODE>false</CODE> if it does not need to have a value.
-   */
-  public boolean isRequired()
-  {
-    return isRequired;
-  }
+    /**
+     * Specifies the value placeholder that will be displayed for this argument
+     * in the generated usage information. It may be <CODE>null</CODE> only if
+     * <CODE>needsValue()</CODE> returns <CODE>false</CODE>.
+     *
+     * @param valuePlaceholder
+     *            The value placeholder that will be displayed for this argument
+     *            in the generated usage information.
+     */
+    public void setValuePlaceholder(final LocalizableMessage valuePlaceholder) {
+        this.valuePlaceholder = valuePlaceholder;
+    }
 
+    /**
+     * Specifies whether this argument was provided in the set of properties
+     * found is a properties file.
+     *
+     * @param isValueSetByProperty
+     *            Specify whether this argument was provided in the set of
+     *            properties found is a properties file.
+     */
+    public void setValueSetByProperty(final boolean isValueSetByProperty) {
+        this.isValueSetByProperty = isValueSetByProperty;
+    }
 
-
-  /**
-   * Indicates whether this argument was provided in the set of properties found
-   * is a properties file.
-   *
-   * @return <CODE>true</CODE> if this argument was provided in the set of
-   *         properties found is a properties file, or <CODE>false</CODE> if
-   *         not.
-   */
-  public boolean isValueSetByProperty()
-  {
-    return isValueSetByProperty;
-  }
-
-
-
-  /**
-   * Indicates whether a value must be provided with this argument if it is
-   * present.
-   *
-   * @return <CODE>true</CODE> if a value must be provided with the argument if
-   *         it is present, or <CODE>false</CODE> if the argument does not take
-   *         a value and the presence of the argument identifier itself is
-   *         sufficient to convey the necessary information.
-   */
-  public boolean needsValue()
-  {
-    return needsValue;
-  }
-
-
-
-  /**
-   * Specifies the default value that will be used for this argument if it is
-   * not specified on the command line and it is not set from a properties file.
-   *
-   * @param defaultValue
-   *          The default value that will be used for this argument if it is not
-   *          specified on the command line and it is not set from a properties
-   *          file.
-   */
-  public void setDefaultValue(final String defaultValue)
-  {
-    this.defaultValue = defaultValue;
-  }
-
-
-
-  /**
-   * Specifies whether this argument should be hidden from the usage
-   * information.
-   *
-   * @param isHidden
-   *          Indicates whether this argument should be hidden from the usage
-   *          information.
-   */
-  public void setHidden(final boolean isHidden)
-  {
-    this.isHidden = isHidden;
-  }
-
-
-
-  /**
-   * Specifies whether this argument may be provided more than once on the
-   * command line to specify multiple values.
-   *
-   * @param isMultiValued
-   *          Indicates whether this argument may be provided more than once on
-   *          the command line to specify multiple values.
-   */
-  public void setMultiValued(final boolean isMultiValued)
-  {
-    this.isMultiValued = isMultiValued;
-  }
-
-
-
-  /**
-   * Specifies whether a value must be provided with this argument if it is
-   * present. If this is changed from <CODE>false</CODE> to <CODE>true</CODE>,
-   * then a value placeholder must also be provided.
-   *
-   * @param needsValue
-   *          Indicates whether a value must be provided with this argument if
-   *          it is present.
-   */
-  public void setNeedsValue(final boolean needsValue)
-  {
-    this.needsValue = needsValue;
-  }
-
-
-
-  /**
-   * Specifies whether this argument is present in the parsed set of
-   * command-line arguments.
-   *
-   * @param isPresent
-   *          Indicates whether this argument is present in the set of
-   *          command-line arguments.
-   */
-  public void setPresent(final boolean isPresent)
-  {
-    this.isPresent = isPresent;
-  }
-
-
-
-  /**
-   * Specifies the name of a property in a properties file that may be used to
-   * set the default value for this argument if it is present.
-   *
-   * @param propertyName
-   *          The name of a property in a properties file that may be used to
-   *          set the default value for this argument if it is present.
-   */
-  public void setPropertyName(final String propertyName)
-  {
-    this.propertyName = propertyName;
-  }
-
-
-
-  /**
-   * Specifies whether this argument is required to have at least one value.
-   *
-   * @param isRequired
-   *          Indicates whether this argument is required to have at least one
-   *          value.
-   */
-  public void setRequired(final boolean isRequired)
-  {
-    this.isRequired = isRequired;
-  }
-
-
-
-  /**
-   * Specifies the value placeholder that will be displayed for this argument in
-   * the generated usage information. It may be <CODE>null</CODE> only if
-   * <CODE>needsValue()</CODE> returns <CODE>false</CODE>.
-   *
-   * @param valuePlaceholder
-   *          The value placeholder that will be displayed for this argument in
-   *          the generated usage information.
-   */
-  public void setValuePlaceholder(final LocalizableMessage valuePlaceholder)
-  {
-    this.valuePlaceholder = valuePlaceholder;
-  }
-
-
-
-  /**
-   * Specifies whether this argument was provided in the set of properties found
-   * is a properties file.
-   *
-   * @param isValueSetByProperty
-   *          Specify whether this argument was provided in the set of
-   *          properties found is a properties file.
-   */
-  public void setValueSetByProperty(final boolean isValueSetByProperty)
-  {
-    this.isValueSetByProperty = isValueSetByProperty;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  public abstract boolean valueIsAcceptable(String valueString,
-      LocalizableMessageBuilder invalidReason);
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    public abstract boolean valueIsAcceptable(String valueString,
+            LocalizableMessageBuilder invalidReason);
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentException.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentException.java
index 0f3f66a..2a9590f 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentException.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,61 +25,48 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import org.forgerock.i18n.LocalizableException;
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * This class defines an exception that may be thrown if there is a problem with
  * an argument definition.
  */
 @SuppressWarnings("serial")
-final class ArgumentException extends Exception implements LocalizableException
-{
-  // The I18N message associated with this exception.
-  private final LocalizableMessage message;
+final class ArgumentException extends Exception implements LocalizableException {
+    // The I18N message associated with this exception.
+    private final LocalizableMessage message;
 
+    /**
+     * Creates a new argument exception with the provided message.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     */
+    ArgumentException(final LocalizableMessage message) {
+        super(String.valueOf(message));
+        this.message = message;
+    }
 
+    /**
+     * Creates a new argument exception with the provided message and root
+     * cause.
+     *
+     * @param message
+     *            The message that explains the problem that occurred.
+     * @param cause
+     *            The exception that was caught to trigger this exception.
+     */
+    ArgumentException(final LocalizableMessage message, final Throwable cause) {
+        super(String.valueOf(message), cause);
+        this.message = message;
+    }
 
-  /**
-   * Creates a new argument exception with the provided message.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   */
-  ArgumentException(final LocalizableMessage message)
-  {
-    super(String.valueOf(message));
-    this.message = message;
-  }
-
-
-
-  /**
-   * Creates a new argument exception with the provided message and root cause.
-   *
-   * @param message
-   *          The message that explains the problem that occurred.
-   * @param cause
-   *          The exception that was caught to trigger this exception.
-   */
-  ArgumentException(final LocalizableMessage message, final Throwable cause)
-  {
-    super(String.valueOf(message), cause);
-    this.message = message;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public LocalizableMessage getMessageObject()
-  {
-    return this.message;
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public LocalizableMessage getMessageObject() {
+        return this.message;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentGroup.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentGroup.java
index dce50b0..e10b5c3 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentGroup.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentGroup.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -36,173 +33,138 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * Class for organizing options into logical groups when arguement usage is
  * printed. To use an argument group, create an instance and use
  * {@link org.opendj.server.util.args.ArgumentParser #addArgument(Argument, ArgumentGroup)}
  * when adding arguments for to the parser.
  */
-final class ArgumentGroup implements Comparable<ArgumentGroup>
-{
+final class ArgumentGroup implements Comparable<ArgumentGroup> {
 
-  // Description for this group of arguments
-  private LocalizableMessage description = null;
+    // Description for this group of arguments
+    private LocalizableMessage description = null;
 
-  // List of arguments belonging to this group
-  private List<Argument> args = null;
+    // List of arguments belonging to this group
+    private List<Argument> args = null;
 
-  // Governs groups position within usage statement
-  private final Integer priority;
+    // Governs groups position within usage statement
+    private final Integer priority;
 
+    /**
+     * Creates a parameterized instance.
+     *
+     * @param description
+     *            for options in this group that is printed before argument
+     *            descriptions in usage output
+     * @param priority
+     *            number governing the position of this group within the usage
+     *            statement. Groups with higher priority values appear before
+     *            groups with lower priority.
+     */
+    ArgumentGroup(final LocalizableMessage description, final int priority) {
+        this.description = description;
+        this.priority = priority;
+        this.args = new LinkedList<Argument>();
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo(final ArgumentGroup o) {
+        // Groups with higher priority numbers appear before
+        // those with lower priority in the usage output
+        return -1 * priority.compareTo(o.priority);
+    }
 
-  /**
-   * Creates a parameterized instance.
-   *
-   * @param description
-   *          for options in this group that is printed before argument
-   *          descriptions in usage output
-   * @param priority
-   *          number governing the position of this group within the usage
-   *          statement. Groups with higher priority values appear before groups
-   *          with lower priority.
-   */
-  ArgumentGroup(final LocalizableMessage description, final int priority)
-  {
-    this.description = description;
-    this.priority = priority;
-    this.args = new LinkedList<Argument>();
-  }
+    /**
+     * Adds an argument to this group.
+     *
+     * @param arg
+     *            to add
+     * @return boolean where true indicates the add was successful
+     */
+    boolean addArgument(final Argument arg) {
+        boolean success = false;
+        if (arg != null) {
+            final Character newShort = arg.getShortIdentifier();
+            final String newLong = arg.getLongIdentifier();
 
+            // See if there is already an argument in this group that the
+            // new argument should replace
+            for (final Iterator<Argument> it = this.args.iterator(); it.hasNext();) {
+                final Argument a = it.next();
+                if (newShort != null && newShort.equals(a.getShortIdentifier()) || newLong != null
+                        && newLong.equals(a.getLongIdentifier())) {
+                    it.remove();
+                    break;
+                }
+            }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public int compareTo(final ArgumentGroup o)
-  {
-    // Groups with higher priority numbers appear before
-    // those with lower priority in the usage output
-    return -1 * priority.compareTo(o.priority);
-  }
-
-
-
-  /**
-   * Adds an argument to this group.
-   *
-   * @param arg
-   *          to add
-   * @return boolean where true indicates the add was successful
-   */
-  boolean addArgument(final Argument arg)
-  {
-    boolean success = false;
-    if (arg != null)
-    {
-      final Character newShort = arg.getShortIdentifier();
-      final String newLong = arg.getLongIdentifier();
-
-      // See if there is already an argument in this group that the
-      // new argument should replace
-      for (final Iterator<Argument> it = this.args.iterator(); it.hasNext();)
-      {
-        final Argument a = it.next();
-        if (newShort != null && newShort.equals(a.getShortIdentifier())
-            || newLong != null && newLong.equals(a.getLongIdentifier()))
-        {
-          it.remove();
-          break;
+            success = this.args.add(arg);
         }
-      }
-
-      success = this.args.add(arg);
+        return success;
     }
-    return success;
-  }
 
-
-
-  /**
-   * Indicates whether this group contains any members.
-   *
-   * @return boolean where true means this group contains members
-   */
-  boolean containsArguments()
-  {
-    return this.args.size() > 0;
-  }
-
-
-
-  /**
-   * Indicates whether this group contains any non-hidden members.
-   *
-   * @return boolean where true means this group contains non-hidden members
-   */
-  boolean containsNonHiddenArguments()
-  {
-    for (final Argument arg : args)
-    {
-      if (!arg.isHidden())
-      {
-        return true;
-      }
+    /**
+     * Indicates whether this group contains any members.
+     *
+     * @return boolean where true means this group contains members
+     */
+    boolean containsArguments() {
+        return this.args.size() > 0;
     }
-    return false;
-  }
 
+    /**
+     * Indicates whether this group contains any non-hidden members.
+     *
+     * @return boolean where true means this group contains non-hidden members
+     */
+    boolean containsNonHiddenArguments() {
+        for (final Argument arg : args) {
+            if (!arg.isHidden()) {
+                return true;
+            }
+        }
+        return false;
+    }
 
+    /**
+     * Gets the list of arguments associated with this group.
+     *
+     * @return list of associated arguments
+     */
+    List<Argument> getArguments() {
+        return Collections.unmodifiableList(args);
+    }
 
-  /**
-   * Gets the list of arguments associated with this group.
-   *
-   * @return list of associated arguments
-   */
-  List<Argument> getArguments()
-  {
-    return Collections.unmodifiableList(args);
-  }
+    /**
+     * Gets the description for this group of arguments.
+     *
+     * @return description for this argument group
+     */
+    LocalizableMessage getDescription() {
+        return this.description;
+    }
 
+    /**
+     * Removes an argument from this group.
+     *
+     * @param arg
+     *            to remove
+     * @return boolean where true indicates the remove was successful
+     */
+    boolean removeArgument(final Argument arg) {
+        return this.args.remove(arg);
+    }
 
-
-  /**
-   * Gets the description for this group of arguments.
-   *
-   * @return description for this argument group
-   */
-  LocalizableMessage getDescription()
-  {
-    return this.description;
-  }
-
-
-
-  /**
-   * Removes an argument from this group.
-   *
-   * @param arg
-   *          to remove
-   * @return boolean where true indicates the remove was successful
-   */
-  boolean removeArgument(final Argument arg)
-  {
-    return this.args.remove(arg);
-  }
-
-
-
-  /**
-   * Sets the description for this group of arguments.
-   *
-   * @param description
-   *          for this argument group
-   */
-  void setDescription(final LocalizableMessage description)
-  {
-    this.description = description;
-  }
+    /**
+     * Sets the description for this group of arguments.
+     *
+     * @param description
+     *            for this argument group
+     */
+    void setDescription(final LocalizableMessage description) {
+        this.description = description;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentParser.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentParser.java
index 66a0283..c1207f6 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentParser.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ArgumentParser.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,10 +26,8 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.PROPERTY_SCRIPT_NAME;
 import static com.forgerock.opendj.ldap.tools.Utils.wrapText;
 import static com.forgerock.opendj.util.StaticUtils.EOL;
@@ -42,13 +39,19 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Properties;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines a utility that can be used to deal with command-line
  * arguments for applications in a CLIP-compliant manner using either short
@@ -59,1853 +62,1537 @@
  * file to obtain default values for arguments there if they are not specified
  * on the command-line.
  */
-final class ArgumentParser
-{
-  /**
-   * The argument that will be used to indicate the file properties.
-   */
-  private StringArgument filePropertiesPathArgument;
+final class ArgumentParser {
+    /**
+     * The argument that will be used to indicate the file properties.
+     */
+    private StringArgument filePropertiesPathArgument;
 
-  /**
-   * The argument that will be used to indicate that we'll not look for default
-   * properties file.
-   */
-  private BooleanArgument noPropertiesFileArgument;
+    /**
+     * The argument that will be used to indicate that we'll not look for
+     * default properties file.
+     */
+    private BooleanArgument noPropertiesFileArgument;
 
-  // The argument that will be used to trigger the display of usage
-  // information.
-  private Argument usageArgument;
+    // The argument that will be used to trigger the display of usage
+    // information.
+    private Argument usageArgument;
 
-  // The argument that will be used to trigger the display of the OpenDJ
-  // version.
-  private Argument versionArgument;
+    // The argument that will be used to trigger the display of the OpenDJ
+    // version.
+    private Argument versionArgument;
 
-  // The set of unnamed trailing arguments that were provided for this
-  // parser.
-  private final ArrayList<String> trailingArguments;
+    // The set of unnamed trailing arguments that were provided for this
+    // parser.
+    private final ArrayList<String> trailingArguments;
 
-  // Indicates whether this parser will allow additional unnamed
-  // arguments at the end of the list.
-  private final boolean allowsTrailingArguments;
+    // Indicates whether this parser will allow additional unnamed
+    // arguments at the end of the list.
+    private final boolean allowsTrailingArguments;
 
-  // Indicates whether long arguments should be treated in a
-  // case-sensitive manner.
-  private final boolean longArgumentsCaseSensitive;
+    // Indicates whether long arguments should be treated in a
+    // case-sensitive manner.
+    private final boolean longArgumentsCaseSensitive;
 
-  // Indicates whether the usage or version information has been
-  // displayed.
-  private boolean usageOrVersionDisplayed;
+    // Indicates whether the usage or version information has been
+    // displayed.
+    private boolean usageOrVersionDisplayed;
 
-  // Indicates whether the version argument was provided.
-  private boolean versionPresent;
+    // Indicates whether the version argument was provided.
+    private boolean versionPresent;
 
-  // The set of arguments defined for this parser, referenced by short
-  // ID.
-  private final HashMap<Character, Argument> shortIDMap;
+    // The set of arguments defined for this parser, referenced by short
+    // ID.
+    private final HashMap<Character, Argument> shortIDMap;
 
-  // The set of arguments defined for this parser, referenced by
-  // argument name.
-  private final HashMap<String, Argument> argumentMap;
+    // The set of arguments defined for this parser, referenced by
+    // argument name.
+    private final HashMap<String, Argument> argumentMap;
 
-  // The set of arguments defined for this parser, referenced by long
-  // ID.
-  private final HashMap<String, Argument> longIDMap;
+    // The set of arguments defined for this parser, referenced by long
+    // ID.
+    private final HashMap<String, Argument> longIDMap;
 
-  // The maximum number of unnamed trailing arguments that may be
-  // provided.
-  private final int maxTrailingArguments;
+    // The maximum number of unnamed trailing arguments that may be
+    // provided.
+    private final int maxTrailingArguments;
 
-  // The minimum number of unnamed trailing arguments that may be
-  // provided.
-  private final int minTrailingArguments;
+    // The minimum number of unnamed trailing arguments that may be
+    // provided.
+    private final int minTrailingArguments;
 
-  // The total set of arguments defined for this parser.
-  private final LinkedList<Argument> argumentList;
+    // The total set of arguments defined for this parser.
+    private final LinkedList<Argument> argumentList;
 
-  // The output stream to which usage information should be printed.
-  private OutputStream usageOutputStream;
+    // The output stream to which usage information should be printed.
+    private OutputStream usageOutputStream;
 
-  // The fully-qualified name of the Java class that should be invoked
-  // to launch the program with which this argument parser is associated.
-  private final String mainClassName;
+    // The fully-qualified name of the Java class that should be invoked
+    // to launch the program with which this argument parser is associated.
+    private final String mainClassName;
 
-  // A human-readable description for the tool, which will be included
-  // when displaying usage information.
-  private final LocalizableMessage toolDescription;
+    // A human-readable description for the tool, which will be included
+    // when displaying usage information.
+    private final LocalizableMessage toolDescription;
 
-  // The display name that will be used for the trailing arguments in
-  // the usage information.
-  private final String trailingArgsDisplayName;
+    // The display name that will be used for the trailing arguments in
+    // the usage information.
+    private final String trailingArgsDisplayName;
 
-  // The raw set of command-line arguments that were provided.
-  private String[] rawArguments;
+    // The raw set of command-line arguments that were provided.
+    private String[] rawArguments;
 
-  /** Set of argument groups. */
-  private Set<ArgumentGroup> argumentGroups;
+    /** Set of argument groups. */
+    private Set<ArgumentGroup> argumentGroups;
 
-  /**
-   * Group for arguments that have not been explicitly grouped. These will
-   * appear at the top of the usage statement without a header.
-   */
-  private final ArgumentGroup defaultArgGroup = new ArgumentGroup(
-      LocalizableMessage.EMPTY, Integer.MAX_VALUE);
+    /**
+     * Group for arguments that have not been explicitly grouped. These will
+     * appear at the top of the usage statement without a header.
+     */
+    private final ArgumentGroup defaultArgGroup = new ArgumentGroup(LocalizableMessage.EMPTY,
+            Integer.MAX_VALUE);
 
-  /**
-   * Group for arguments that are related to connection through LDAP. This
-   * includes options like the bind DN, the port, etc.
-   */
-  private final ArgumentGroup ldapArgGroup = new ArgumentGroup(
-      INFO_DESCRIPTION_LDAP_CONNECTION_ARGS.get(), Integer.MIN_VALUE + 2);
+    /**
+     * Group for arguments that are related to connection through LDAP. This
+     * includes options like the bind DN, the port, etc.
+     */
+    private final ArgumentGroup ldapArgGroup = new ArgumentGroup(
+            INFO_DESCRIPTION_LDAP_CONNECTION_ARGS.get(), Integer.MIN_VALUE + 2);
 
-  /**
-   * Group for arguments that are related to utility input/output like
-   * properties file, no-prompt etc. These will appear toward the bottom of the
-   * usage statement.
-   */
-  private final ArgumentGroup ioArgGroup = new ArgumentGroup(
-      INFO_DESCRIPTION_IO_ARGS.get(), Integer.MIN_VALUE + 1);
+    /**
+     * Group for arguments that are related to utility input/output like
+     * properties file, no-prompt etc. These will appear toward the bottom of
+     * the usage statement.
+     */
+    private final ArgumentGroup ioArgGroup = new ArgumentGroup(INFO_DESCRIPTION_IO_ARGS.get(),
+            Integer.MIN_VALUE + 1);
 
-  /**
-   * Group for arguments that are general like help, version etc. These will
-   * appear at the end of the usage statement.
-   */
-  private final ArgumentGroup generalArgGroup = new ArgumentGroup(
-      INFO_DESCRIPTION_GENERAL_ARGS.get(), Integer.MIN_VALUE);
+    /**
+     * Group for arguments that are general like help, version etc. These will
+     * appear at the end of the usage statement.
+     */
+    private final ArgumentGroup generalArgGroup = new ArgumentGroup(INFO_DESCRIPTION_GENERAL_ARGS
+            .get(), Integer.MIN_VALUE);
 
-  private final static String INDENT = "    ";
+    private final static String INDENT = "    ";
 
-  private final static int MAX_LENGTH = 80;
+    private final static int MAX_LENGTH = 80;
 
+    /**
+     * Creates a new instance of this argument parser with no arguments. Unnamed
+     * trailing arguments will not be allowed.
+     *
+     * @param mainClassName
+     *            The fully-qualified name of the Java class that should be
+     *            invoked to launch the program with which this argument parser
+     *            is associated.
+     * @param toolDescription
+     *            A human-readable description for the tool, which will be
+     *            included when displaying usage information.
+     * @param longArgumentsCaseSensitive
+     *            Indicates whether long arguments should be treated in a
+     *            case-sensitive manner.
+     */
+    ArgumentParser(final String mainClassName, final LocalizableMessage toolDescription,
+            final boolean longArgumentsCaseSensitive) {
+        this.mainClassName = mainClassName;
+        this.toolDescription = toolDescription;
+        this.longArgumentsCaseSensitive = longArgumentsCaseSensitive;
 
-
-  /**
-   * Creates a new instance of this argument parser with no arguments. Unnamed
-   * trailing arguments will not be allowed.
-   *
-   * @param mainClassName
-   *          The fully-qualified name of the Java class that should be invoked
-   *          to launch the program with which this argument parser is
-   *          associated.
-   * @param toolDescription
-   *          A human-readable description for the tool, which will be included
-   *          when displaying usage information.
-   * @param longArgumentsCaseSensitive
-   *          Indicates whether long arguments should be treated in a
-   *          case-sensitive manner.
-   */
-  ArgumentParser(final String mainClassName,
-      final LocalizableMessage toolDescription,
-      final boolean longArgumentsCaseSensitive)
-  {
-    this.mainClassName = mainClassName;
-    this.toolDescription = toolDescription;
-    this.longArgumentsCaseSensitive = longArgumentsCaseSensitive;
-
-    argumentList = new LinkedList<Argument>();
-    argumentMap = new HashMap<String, Argument>();
-    shortIDMap = new HashMap<Character, Argument>();
-    longIDMap = new HashMap<String, Argument>();
-    allowsTrailingArguments = false;
-    usageOrVersionDisplayed = false;
-    versionPresent = false;
-    trailingArgsDisplayName = null;
-    maxTrailingArguments = 0;
-    minTrailingArguments = 0;
-    trailingArguments = new ArrayList<String>();
-    rawArguments = null;
-    usageArgument = null;
-    filePropertiesPathArgument = null;
-    noPropertiesFileArgument = null;
-    usageOutputStream = System.out;
-    initGroups();
-  }
-
-
-
-  /**
-   * Creates a new instance of this argument parser with no arguments that may
-   * or may not be allowed to have unnamed trailing arguments.
-   *
-   * @param mainClassName
-   *          The fully-qualified name of the Java class that should be invoked
-   *          to launch the program with which this argument parser is
-   *          associated.
-   * @param toolDescription
-   *          A human-readable description for the tool, which will be included
-   *          when displaying usage information.
-   * @param longArgumentsCaseSensitive
-   *          Indicates whether long arguments should be treated in a
-   *          case-sensitive manner.
-   * @param allowsTrailingArguments
-   *          Indicates whether this parser allows unnamed trailing arguments to
-   *          be provided.
-   * @param minTrailingArguments
-   *          The minimum number of unnamed trailing arguments that must be
-   *          provided. A value less than or equal to zero indicates that no
-   *          minimum will be enforced.
-   * @param maxTrailingArguments
-   *          The maximum number of unnamed trailing arguments that may be
-   *          provided. A value less than or equal to zero indicates that no
-   *          maximum will be enforced.
-   * @param trailingArgsDisplayName
-   *          The display name that should be used as a placeholder for unnamed
-   *          trailing arguments in the generated usage information.
-   */
-  ArgumentParser(final String mainClassName,
-      final LocalizableMessage toolDescription,
-      final boolean longArgumentsCaseSensitive,
-      final boolean allowsTrailingArguments, final int minTrailingArguments,
-      final int maxTrailingArguments, final String trailingArgsDisplayName)
-  {
-    this.mainClassName = mainClassName;
-    this.toolDescription = toolDescription;
-    this.longArgumentsCaseSensitive = longArgumentsCaseSensitive;
-    this.allowsTrailingArguments = allowsTrailingArguments;
-    this.minTrailingArguments = minTrailingArguments;
-    this.maxTrailingArguments = maxTrailingArguments;
-    this.trailingArgsDisplayName = trailingArgsDisplayName;
-
-    argumentList = new LinkedList<Argument>();
-    argumentMap = new HashMap<String, Argument>();
-    shortIDMap = new HashMap<Character, Argument>();
-    longIDMap = new HashMap<String, Argument>();
-    trailingArguments = new ArrayList<String>();
-    usageOrVersionDisplayed = false;
-    versionPresent = false;
-    rawArguments = null;
-    usageArgument = null;
-    usageOutputStream = System.out;
-    initGroups();
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addArgument(final Argument argument) throws ArgumentException
-  {
-    addArgument(argument, null);
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @param group
-   *          The argument group to which the argument belongs.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addArgument(final Argument argument, ArgumentGroup group)
-      throws ArgumentException
-  {
-
-    final Character shortID = argument.getShortIdentifier();
-    if ((shortID != null) && shortIDMap.containsKey(shortID))
-    {
-      final String conflictingName = shortIDMap.get(shortID).getName();
-
-      final LocalizableMessage message = ERR_ARGPARSER_DUPLICATE_SHORT_ID.get(
-          argument.getName(), String.valueOf(shortID), conflictingName);
-      throw new ArgumentException(message);
+        argumentList = new LinkedList<Argument>();
+        argumentMap = new HashMap<String, Argument>();
+        shortIDMap = new HashMap<Character, Argument>();
+        longIDMap = new HashMap<String, Argument>();
+        allowsTrailingArguments = false;
+        usageOrVersionDisplayed = false;
+        versionPresent = false;
+        trailingArgsDisplayName = null;
+        maxTrailingArguments = 0;
+        minTrailingArguments = 0;
+        trailingArguments = new ArrayList<String>();
+        rawArguments = null;
+        usageArgument = null;
+        filePropertiesPathArgument = null;
+        noPropertiesFileArgument = null;
+        usageOutputStream = System.out;
+        initGroups();
     }
 
-    if (versionArgument != null)
-    {
-      if (shortID != null &&
-          shortID.equals(versionArgument.getShortIdentifier()))
-      {
-        // Update the version argument to not display its short
-        // identifier.
-        try
-        {
-          versionArgument = new BooleanArgument(OPTION_LONG_PRODUCT_VERSION,
-              null, OPTION_LONG_PRODUCT_VERSION,
-              INFO_DESCRIPTION_PRODUCT_VERSION.get());
-          this.generalArgGroup.addArgument(versionArgument);
-        }
-        catch (final ArgumentException e)
-        {
-          // ignore
-        }
-      }
+    /**
+     * Creates a new instance of this argument parser with no arguments that may
+     * or may not be allowed to have unnamed trailing arguments.
+     *
+     * @param mainClassName
+     *            The fully-qualified name of the Java class that should be
+     *            invoked to launch the program with which this argument parser
+     *            is associated.
+     * @param toolDescription
+     *            A human-readable description for the tool, which will be
+     *            included when displaying usage information.
+     * @param longArgumentsCaseSensitive
+     *            Indicates whether long arguments should be treated in a
+     *            case-sensitive manner.
+     * @param allowsTrailingArguments
+     *            Indicates whether this parser allows unnamed trailing
+     *            arguments to be provided.
+     * @param minTrailingArguments
+     *            The minimum number of unnamed trailing arguments that must be
+     *            provided. A value less than or equal to zero indicates that no
+     *            minimum will be enforced.
+     * @param maxTrailingArguments
+     *            The maximum number of unnamed trailing arguments that may be
+     *            provided. A value less than or equal to zero indicates that no
+     *            maximum will be enforced.
+     * @param trailingArgsDisplayName
+     *            The display name that should be used as a placeholder for
+     *            unnamed trailing arguments in the generated usage information.
+     */
+    ArgumentParser(final String mainClassName, final LocalizableMessage toolDescription,
+            final boolean longArgumentsCaseSensitive, final boolean allowsTrailingArguments,
+            final int minTrailingArguments, final int maxTrailingArguments,
+            final String trailingArgsDisplayName) {
+        this.mainClassName = mainClassName;
+        this.toolDescription = toolDescription;
+        this.longArgumentsCaseSensitive = longArgumentsCaseSensitive;
+        this.allowsTrailingArguments = allowsTrailingArguments;
+        this.minTrailingArguments = minTrailingArguments;
+        this.maxTrailingArguments = maxTrailingArguments;
+        this.trailingArgsDisplayName = trailingArgsDisplayName;
+
+        argumentList = new LinkedList<Argument>();
+        argumentMap = new HashMap<String, Argument>();
+        shortIDMap = new HashMap<Character, Argument>();
+        longIDMap = new HashMap<String, Argument>();
+        trailingArguments = new ArrayList<String>();
+        usageOrVersionDisplayed = false;
+        versionPresent = false;
+        rawArguments = null;
+        usageArgument = null;
+        usageOutputStream = System.out;
+        initGroups();
     }
 
-    String longID = argument.getLongIdentifier();
-    if (longID != null)
-    {
-      if (!longArgumentsCaseSensitive)
-      {
-        longID = toLowerCase(longID);
-      }
-      if (longIDMap.containsKey(longID))
-      {
-        final String conflictingName = longIDMap.get(longID).getName();
-
-        final LocalizableMessage message = ERR_ARGPARSER_DUPLICATE_LONG_ID.get(
-            argument.getName(), argument.getLongIdentifier(), conflictingName);
-        throw new ArgumentException(message);
-      }
+    /**
+     * Adds the provided argument to the set of arguments handled by this
+     * parser.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addArgument(final Argument argument) throws ArgumentException {
+        addArgument(argument, null);
     }
 
-    if (shortID != null)
-    {
-      shortIDMap.put(shortID, argument);
-    }
+    /**
+     * Adds the provided argument to the set of arguments handled by this
+     * parser.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @param group
+     *            The argument group to which the argument belongs.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addArgument(final Argument argument, ArgumentGroup group) throws ArgumentException {
 
-    if (longID != null)
-    {
-      longIDMap.put(longID, argument);
-    }
+        final Character shortID = argument.getShortIdentifier();
+        if ((shortID != null) && shortIDMap.containsKey(shortID)) {
+            final String conflictingName = shortIDMap.get(shortID).getName();
 
-    argumentList.add(argument);
-
-    if (group == null)
-    {
-      group = getStandardGroup(argument);
-    }
-    group.addArgument(argument);
-    argumentGroups.add(group);
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser
-   * and puts the arguement in the default group.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addDefaultArgument(final Argument argument) throws ArgumentException
-  {
-    addArgument(argument, defaultArgGroup);
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser
-   * and puts the arguement in the general group.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addGeneralArgument(final Argument argument) throws ArgumentException
-  {
-    addArgument(argument, generalArgGroup);
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser
-   * and puts the argument in the input/output group.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addInputOutputArgument(final Argument argument) throws ArgumentException
-  {
-    addArgument(argument, ioArgGroup);
-  }
-
-
-
-  /**
-   * Adds the provided argument to the set of arguments handled by this parser
-   * and puts the argument in the LDAP connection group.
-   *
-   * @param argument
-   *          The argument to be added.
-   * @throws ArgumentException
-   *           If the provided argument conflicts with another argument that has
-   *           already been defined.
-   */
-  void addLdapConnectionArgument(final Argument argument)
-      throws ArgumentException
-  {
-    addArgument(argument, ldapArgGroup);
-  }
-
-
-
-  /**
-   * Indicates whether this parser will allow unnamed trailing arguments. These
-   * will be arguments at the end of the list that are not preceded by either a
-   * long or short identifier and will need to be manually parsed by the
-   * application using this parser. Note that once an unnamed trailing argument
-   * has been identified, all remaining arguments will be classified as such.
-   *
-   * @return <CODE>true</CODE> if this parser allows unnamed trailing arguments,
-   *         or <CODE>false</CODE> if it does not.
-   */
-  boolean allowsTrailingArguments()
-  {
-    return allowsTrailingArguments;
-  }
-
-
-
-  /**
-   * Check if we have a properties file.
-   *
-   * @return The properties found in the properties file or null.
-   * @throws ArgumentException
-   *           If a problem was encountered while parsing the provided
-   *           arguments.
-   */
-  Properties checkExternalProperties() throws ArgumentException
-  {
-    // We don't look for properties file.
-    if ((noPropertiesFileArgument != null)
-        && (noPropertiesFileArgument.isPresent()))
-    {
-      return null;
-    }
-
-    // Check if we have a properties file argument
-    if (filePropertiesPathArgument == null)
-    {
-      return null;
-    }
-
-    // check if the properties file argument has been set. If not
-    // look for default location.
-    String propertiesFilePath = null;
-    if (filePropertiesPathArgument.isPresent())
-    {
-      propertiesFilePath = filePropertiesPathArgument.getValue();
-    }
-    else
-    {
-      // Check in "user home"/.opendj directory
-      final String userDir = System.getProperty("user.home");
-      propertiesFilePath = findPropertiesFile(userDir + File.separator
-          + DEFAULT_OPENDJ_CONFIG_DIR);
-    }
-
-    // We don't have a properties file location
-    if (propertiesFilePath == null)
-    {
-      return null;
-    }
-
-    // We have a location for the properties file.
-    final Properties argumentProperties = new Properties();
-    final String scriptName = System.getProperty(Utils.PROPERTY_SCRIPT_NAME);
-    try
-    {
-      final Properties p = new Properties();
-      final FileInputStream fis = new FileInputStream(propertiesFilePath);
-      p.load(fis);
-      fis.close();
-
-      for (final Enumeration<?> e = p.propertyNames(); e.hasMoreElements();)
-      {
-        final String currentPropertyName = (String) e.nextElement();
-        String propertyName = currentPropertyName;
-
-        // Property name form <script name>.<property name> has the
-        // precedence to <property name>
-        if (scriptName != null)
-        {
-          if (currentPropertyName.startsWith(scriptName))
-          {
-            propertyName = currentPropertyName
-                .substring(scriptName.length() + 1);
-          }
-          else
-          {
-            if (p.containsKey(scriptName + "." + currentPropertyName))
-            {
-              continue;
-            }
-          }
-        }
-        argumentProperties.setProperty(propertyName.toLowerCase(), p
-            .getProperty(currentPropertyName));
-      }
-    }
-    catch (final Exception e)
-    {
-      final LocalizableMessage message = ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE
-          .get(String.valueOf(propertiesFilePath), getExceptionMessage(e));
-      throw new ArgumentException(message, e);
-    }
-    return argumentProperties;
-  }
-
-
-
-  /**
-   * Retrieves the argument with the specified name.
-   *
-   * @param name
-   *          The name of the argument to retrieve.
-   * @return The argument with the specified name, or <CODE>null</CODE> if there
-   *         is no such argument.
-   */
-  Argument getArgument(final String name)
-  {
-    return argumentMap.get(name);
-  }
-
-
-
-  /**
-   * Retrieves the argument with the specified long identifier.
-   *
-   * @param longID
-   *          The long identifier of the argument to retrieve.
-   * @return The argument with the specified long identifier, or
-   *         <CODE>null</CODE> if there is no such argument.
-   */
-  Argument getArgumentForLongID(final String longID)
-  {
-    return longIDMap.get(longID);
-  }
-
-
-
-  /**
-   * Retrieves the argument with the specified short identifier.
-   *
-   * @param shortID
-   *          The short ID for the argument to retrieve.
-   * @return The argument with the specified short identifier, or
-   *         <CODE>null</CODE> if there is no such argument.
-   */
-  Argument getArgumentForShortID(final Character shortID)
-  {
-    return shortIDMap.get(shortID);
-  }
-
-
-
-  /**
-   * Retrieves the list of all arguments that have been defined for this
-   * argument parser.
-   *
-   * @return The list of all arguments that have been defined for this argument
-   *         parser.
-   */
-  LinkedList<Argument> getArgumentList()
-  {
-    return argumentList;
-  }
-
-
-
-  /**
-   * Retrieves the set of arguments mapped by the long identifier that may be
-   * used to reference them. Note that arguments that do not have a long
-   * identifier will not be present in this list.
-   *
-   * @return The set of arguments mapped by the long identifier that may be used
-   *         to reference them.
-   */
-  HashMap<String, Argument> getArgumentsByLongID()
-  {
-    return longIDMap;
-  }
-
-
-
-  /**
-   * Retrieves the set of arguments mapped by the short identifier that may be
-   * used to reference them. Note that arguments that do not have a short
-   * identifier will not be present in this list.
-   *
-   * @return The set of arguments mapped by the short identifier that may be
-   *         used to reference them.
-   */
-  HashMap<Character, Argument> getArgumentsByShortID()
-  {
-    return shortIDMap;
-  }
-
-
-
-  /**
-   * Retrieves the fully-qualified name of the Java class that should be invoked
-   * to launch the program with which this argument parser is associated.
-   *
-   * @return The fully-qualified name of the Java class that should be invoked
-   *         to launch the program with which this argument parser is
-   *         associated.
-   */
-  String getMainClassName()
-  {
-    return mainClassName;
-  }
-
-
-
-  /**
-   * Retrieves the maximum number of unnamed trailing arguments that may be
-   * provided.
-   *
-   * @return The maximum number of unnamed trailing arguments that may be
-   *         provided, or a value less than or equal to zero if no maximum will
-   *         be enforced.
-   */
-  int getMaxTrailingArguments()
-  {
-    return maxTrailingArguments;
-  }
-
-
-
-  /**
-   * Retrieves the minimum number of unnamed trailing arguments that must be
-   * provided.
-   *
-   * @return The minimum number of unnamed trailing arguments that must be
-   *         provided, or a value less than or equal to zero if no minimum will
-   *         be enforced.
-   */
-  int getMinTrailingArguments()
-  {
-    return minTrailingArguments;
-  }
-
-
-
-  /**
-   * Retrieves the raw set of arguments that were provided.
-   *
-   * @return The raw set of arguments that were provided, or <CODE>null</CODE>
-   *         if the argument list has not yet been parsed.
-   */
-  String[] getRawArguments()
-  {
-    return rawArguments;
-  }
-
-
-
-  /**
-   * Given an argument, returns an appropriate group. Arguments may be part of
-   * one of the special groups or the default group.
-   *
-   * @param argument
-   *          for which a group is requested
-   * @return argument group appropriate for <code>argument</code>
-   */
-  ArgumentGroup getStandardGroup(final Argument argument)
-  {
-    ArgumentGroup group;
-    if (isInputOutputArgument(argument))
-    {
-      group = ioArgGroup;
-    }
-    else if (isGeneralArgument(argument))
-    {
-      group = generalArgGroup;
-    }
-    else if (isLdapConnectionArgument(argument))
-    {
-      group = ldapArgGroup;
-    }
-    else
-    {
-      group = defaultArgGroup;
-    }
-    return group;
-  }
-
-
-
-  /**
-   * Retrieves a human-readable description for this tool, which should be
-   * included at the top of the command-line usage information.
-   *
-   * @return A human-readable description for this tool, or {@code null} if none
-   *         is available.
-   */
-  LocalizableMessage getToolDescription()
-  {
-    return toolDescription;
-  }
-
-
-
-  /**
-   * Retrieves the set of unnamed trailing arguments that were provided on the
-   * command line.
-   *
-   * @return The set of unnamed trailing arguments that were provided on the
-   *         command line.
-   */
-  ArrayList<String> getTrailingArguments()
-  {
-    return trailingArguments;
-  }
-
-
-
-  /**
-   * Retrieves a string containing usage information based on the defined
-   * arguments.
-   *
-   * @return A string containing usage information based on the defined
-   *         arguments.
-   */
-  String getUsage()
-  {
-    final StringBuilder buffer = new StringBuilder();
-    getUsage(buffer);
-
-    return buffer.toString();
-  }
-
-
-
-  /**
-   * Writes usage information based on the defined arguments to the provided
-   * output stream.
-   *
-   * @param outputStream
-   *          The output stream to which the usage information should be
-   *          written.
-   * @throws IOException
-   *           If a problem occurs while attempting to write the usage
-   *           information to the provided output stream.
-   */
-  void getUsage(final OutputStream outputStream) throws IOException
-  {
-    final StringBuilder buffer = new StringBuilder();
-    getUsage(buffer);
-
-    outputStream.write(getBytes(buffer.toString()));
-  }
-
-
-
-  /**
-   * Appends usage information based on the defined arguments to the provided
-   * buffer.
-   *
-   * @param buffer
-   *          The buffer to which the usage information should be appended.
-   */
-  void getUsage(final StringBuilder buffer)
-  {
-    usageOrVersionDisplayed = true;
-    final String scriptName = System.getProperty(PROPERTY_SCRIPT_NAME);
-    if ((scriptName == null) || (scriptName.length() == 0))
-    {
-      buffer.append(INFO_ARGPARSER_USAGE_JAVA_CLASSNAME.get(mainClassName));
-    }
-    else
-    {
-      buffer.append(INFO_ARGPARSER_USAGE_JAVA_SCRIPTNAME.get(scriptName));
-    }
-
-    if (allowsTrailingArguments)
-    {
-      if (trailingArgsDisplayName == null)
-      {
-        buffer.append(" " + INFO_ARGPARSER_USAGE_TRAILINGARGS.get());
-      }
-      else
-      {
-        buffer.append(" ");
-        buffer.append(trailingArgsDisplayName);
-      }
-    }
-    buffer.append(EOL);
-    buffer.append(EOL);
-    if ((toolDescription != null) && (toolDescription.length() > 0))
-    {
-      buffer.append(wrapText(toolDescription.toString(), MAX_LENGTH - 1));
-      buffer.append(EOL);
-      buffer.append(EOL);
-    }
-    buffer.append(INFO_SUBCMDPARSER_WHERE_OPTIONS_INCLUDE.get());
-    buffer.append(EOL);
-    buffer.append(EOL);
-
-    Argument helpArgument = null;
-
-    final boolean printHeaders = printUsageGroupHeaders();
-    for (final ArgumentGroup argGroup : argumentGroups)
-    {
-      if (argGroup.containsArguments() && printHeaders)
-      {
-        // Print the groups description if any
-        final LocalizableMessage groupDesc = argGroup.getDescription();
-        if (groupDesc != null && !LocalizableMessage.EMPTY.equals(groupDesc))
-        {
-          buffer.append(EOL);
-          buffer.append(wrapText(groupDesc.toString(), MAX_LENGTH - 1));
-          buffer.append(EOL);
-          buffer.append(EOL);
-        }
-      }
-
-      final SortedSet<Argument> args = new TreeSet<Argument>(
-          new Comparator<Argument>()
-          {
-
-            /**
-             * {@inheritDoc}
-             */
-            public int compare(final Argument o1, final Argument o2)
-            {
-              final String s1;
-              final String s2;
-
-              if (o1.getShortIdentifier() != null)
-              {
-                s1 = o1.getShortIdentifier().toString();
-              }
-              else
-              {
-                s1 = o1.getLongIdentifier();
-              }
-
-              if (o2.getShortIdentifier() != null)
-              {
-                s2 = o2.getShortIdentifier().toString();
-              }
-              else
-              {
-                s2 = o2.getLongIdentifier();
-              }
-
-              final int res = s1.compareToIgnoreCase(s2);
-              if (res != 0)
-              {
-                return res;
-              }
-              else
-              {
-                // Lowercase options first then uppercase.
-                return -s1.compareTo(s2);
-              }
-            }
-
-          });
-      args.addAll(argGroup.getArguments());
-
-      for (final Argument a : args)
-      {
-        // If this argument is hidden, then skip it.
-        if (a.isHidden())
-        {
-          continue;
-        }
-
-        // Help argument should be printed at the end
-        if ((usageArgument != null)
-            && usageArgument.getName().equals(a.getName()))
-        {
-          helpArgument = a;
-          continue;
-        }
-        printArgumentUsage(a, buffer);
-      }
-    }
-    if (helpArgument != null)
-    {
-      printArgumentUsage(helpArgument, buffer);
-    }
-    else
-    {
-      buffer.append(EOL);
-      buffer.append("-?");
-      buffer.append(EOL);
-    }
-  }
-
-
-
-  /**
-   * Retrieves a message containing usage information based on the defined
-   * arguments.
-   *
-   * @return A string containing usage information based on the defined
-   *         arguments.
-   */
-  LocalizableMessage getUsageMessage()
-  {
-    final StringBuilder buffer = new StringBuilder();
-    getUsage(buffer);
-
-    // TODO: rework getUsage(OutputStream) to work with messages
-    // framework
-    return LocalizableMessage.raw(buffer.toString());
-  }
-
-
-
-  /**
-   * Returns whether the usage argument was provided or not. This method should
-   * be called after a call to parseArguments.
-   *
-   * @return <CODE>true</CODE> if the usage argument was provided and
-   *         <CODE>false</CODE> otherwise.
-   */
-  boolean isUsageArgumentPresent()
-  {
-    boolean isUsageArgumentPresent = false;
-    if (usageArgument != null)
-    {
-      isUsageArgumentPresent = usageArgument.isPresent();
-    }
-    return isUsageArgumentPresent;
-  }
-
-
-
-  /**
-   * Returns whether the version argument was provided or not. This method
-   * should be called after a call to parseArguments.
-   *
-   * @return <CODE>true</CODE> if the version argument was provided and
-   *         <CODE>false</CODE> otherwise.
-   */
-  boolean isVersionArgumentPresent()
-  {
-    return versionPresent;
-  }
-
-
-
-  /**
-   * Parses the provided set of arguments and updates the information associated
-   * with this parser accordingly.
-   *
-   * @param rawArguments
-   *          The raw set of arguments to parse.
-   * @throws ArgumentException
-   *           If a problem was encountered while parsing the provided
-   *           arguments.
-   */
-  void parseArguments(final String[] rawArguments) throws ArgumentException
-  {
-    parseArguments(rawArguments, null);
-  }
-
-
-
-  /**
-   * Parses the provided set of arguments and updates the information associated
-   * with this parser accordingly. Default values for unspecified arguments may
-   * be read from the specified properties if any are provided.
-   *
-   * @param rawArguments
-   *          The set of raw arguments to parse.
-   * @param argumentProperties
-   *          A set of properties that may be used to provide default values for
-   *          arguments not included in the given raw arguments.
-   * @throws ArgumentException
-   *           If a problem was encountered while parsing the provided
-   *           arguments.
-   */
-  void parseArguments(final String[] rawArguments, Properties argumentProperties)
-      throws ArgumentException
-  {
-    this.rawArguments = rawArguments;
-
-    boolean inTrailingArgs = false;
-
-    final int numArguments = rawArguments.length;
-    for (int i = 0; i < numArguments; i++)
-    {
-      final String arg = rawArguments[i];
-
-      if (inTrailingArgs)
-      {
-        trailingArguments.add(arg);
-        if ((maxTrailingArguments > 0)
-            && (trailingArguments.size() > maxTrailingArguments))
-        {
-          final LocalizableMessage message = ERR_ARGPARSER_TOO_MANY_TRAILING_ARGS
-              .get(maxTrailingArguments);
-          throw new ArgumentException(message);
-        }
-
-        continue;
-      }
-
-      if (arg.equals("--"))
-      {
-        // This is a special indicator that we have reached the end of
-        // the named arguments and that everything that follows after this
-        // should be considered trailing arguments.
-        inTrailingArgs = true;
-      }
-      else if (arg.startsWith("--"))
-      {
-        // This indicates that we are using the long name to reference
-        // the argument. It may be in any of the following forms:
-        // --name
-        // --name value
-        // --name=value
-
-        String argName = arg.substring(2);
-        String argValue = null;
-        final int equalPos = argName.indexOf('=');
-        if (equalPos < 0)
-        {
-          // This is fine. The value is not part of the argument name
-          // token.
-        }
-        else if (equalPos == 0)
-        {
-          // The argument starts with "--=", which is not acceptable.
-          final LocalizableMessage message = ERR_ARGPARSER_LONG_ARG_WITHOUT_NAME
-              .get(arg);
-          throw new ArgumentException(message);
-        }
-        else
-        {
-          // The argument is in the form --name=value, so parse them
-          // both out.
-          argValue = argName.substring(equalPos + 1);
-          argName = argName.substring(0, equalPos);
-        }
-
-        // If we're not case-sensitive, then convert the name to
-        // lowercase.
-        final String origArgName = argName;
-        if (!longArgumentsCaseSensitive)
-        {
-          argName = toLowerCase(argName);
-        }
-
-        // Get the argument with the specified name.
-        final Argument a = longIDMap.get(argName);
-        if (a == null)
-        {
-          if (argName.equals(OPTION_LONG_HELP))
-          {
-            // "--help" will always be interpreted as requesting usage
-            // information.
-            try
-            {
-              getUsage(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-
-            return;
-          }
-          else if (argName.equals(OPTION_LONG_PRODUCT_VERSION))
-          {
-            // "--version" will always be interpreted as requesting
-            // version information.
-            usageOrVersionDisplayed = true;
-            versionPresent = true;
-            try
-            {
-              // TODO
-              // DirectoryServer.printVersion(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-
-            return;
-          }
-          else
-          {
-            // There is no such argument registered.
-            final LocalizableMessage message = ERR_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID
-                .get(origArgName);
+            final LocalizableMessage message =
+                    ERR_ARGPARSER_DUPLICATE_SHORT_ID.get(argument.getName(), String
+                            .valueOf(shortID), conflictingName);
             throw new ArgumentException(message);
-          }
-        }
-        else
-        {
-          a.setPresent(true);
-
-          // If this is the usage argument, then immediately stop and
-          // print usage information.
-          if ((usageArgument != null)
-              && usageArgument.getName().equals(a.getName()))
-          {
-            try
-            {
-              getUsage(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-
-            return;
-          }
         }
 
-        // See if the argument takes a value. If so, then make sure one
-        // was provided. If not, then make sure none was provided.
-        if (a.needsValue())
-        {
-          if (argValue == null)
-          {
-            if ((i + 1) == numArguments)
-            {
-              final LocalizableMessage message = ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID
-                  .get(origArgName);
-              throw new ArgumentException(message);
-            }
-
-            argValue = rawArguments[++i];
-          }
-
-          final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-          if (!a.valueIsAcceptable(argValue, invalidReason))
-          {
-            final LocalizableMessage message = ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_LONG_ID
-                .get(argValue, origArgName, invalidReason.toString());
-            throw new ArgumentException(message);
-          }
-
-          // If the argument already has a value, then make sure it is
-          // acceptable to have more than one.
-          if (a.hasValue() && (!a.isMultiValued()))
-          {
-            final LocalizableMessage message = ERR_ARGPARSER_NOT_MULTIVALUED_FOR_LONG_ID
-                .get(origArgName);
-            throw new ArgumentException(message);
-          }
-
-          a.addValue(argValue);
-        }
-        else
-        {
-          if (argValue != null)
-          {
-            final LocalizableMessage message = ERR_ARGPARSER_ARG_FOR_LONG_ID_DOESNT_TAKE_VALUE
-                .get(origArgName);
-            throw new ArgumentException(message);
-          }
-        }
-      }
-      else if (arg.startsWith("-"))
-      {
-        // This indicates that we are using the 1-character name to
-        // reference the argument. It may be in any of the following forms:
-        // -n
-        // -nvalue
-        // -n value
-        if (arg.equals("-"))
-        {
-          final LocalizableMessage message = ERR_ARGPARSER_INVALID_DASH_AS_ARGUMENT
-              .get();
-          throw new ArgumentException(message);
-        }
-
-        final char argCharacter = arg.charAt(1);
-        String argValue;
-        if (arg.length() > 2)
-        {
-          argValue = arg.substring(2);
-        }
-        else
-        {
-          argValue = null;
-        }
-
-        // Get the argument with the specified short ID.
-        final Argument a = shortIDMap.get(argCharacter);
-        if (a == null)
-        {
-          if (argCharacter == '?')
-          {
-            // "-?" will always be interpreted as requesting usage
-            // information.
-            try
-            {
-              getUsage(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-
-            return;
-          }
-          else if ((argCharacter == OPTION_SHORT_PRODUCT_VERSION)
-              && (!shortIDMap.containsKey(OPTION_SHORT_PRODUCT_VERSION)))
-          {
-            // "-V" will always be interpreted as requesting
-            // version information except if it's already defined (e.g
-            // in ldap tools).
-            usageOrVersionDisplayed = true;
-            versionPresent = true;
-            try
-            {
-              // TODO
-              // DirectoryServer.printVersion(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-            return;
-          }
-          else
-          {
-            // There is no such argument registered.
-            final LocalizableMessage message = ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID
-                .get(String.valueOf(argCharacter));
-            throw new ArgumentException(message);
-          }
-        }
-        else
-        {
-          a.setPresent(true);
-
-          // If this is the usage argument, then immediately stop and
-          // print usage information.
-          if ((usageArgument != null)
-              && usageArgument.getName().equals(a.getName()))
-          {
-            try
-            {
-              getUsage(usageOutputStream);
-            }
-            catch (final Exception e)
-            {
-            }
-
-            return;
-          }
-        }
-
-        // See if the argument takes a value. If so, then make sure one
-        // was provided. If not, then make sure none was provided.
-        if (a.needsValue())
-        {
-          if (argValue == null)
-          {
-            if ((i + 1) == numArguments)
-            {
-              final LocalizableMessage message = ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_SHORT_ID
-                  .get(String.valueOf(argCharacter));
-              throw new ArgumentException(message);
-            }
-
-            argValue = rawArguments[++i];
-          }
-
-          final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-          if (!a.valueIsAcceptable(argValue, invalidReason))
-          {
-            final LocalizableMessage message = ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_SHORT_ID
-                .get(argValue, String.valueOf(argCharacter), invalidReason
-                    .toString());
-            throw new ArgumentException(message);
-          }
-
-          // If the argument already has a value, then make sure it is
-          // acceptable to have more than one.
-          if (a.hasValue() && (!a.isMultiValued()))
-          {
-            final LocalizableMessage message = ERR_ARGPARSER_NOT_MULTIVALUED_FOR_SHORT_ID
-                .get(String.valueOf(argCharacter));
-            throw new ArgumentException(message);
-          }
-
-          a.addValue(argValue);
-        }
-        else
-        {
-          if (argValue != null)
-          {
-            // If we've gotten here, then it means that we're in a scenario like
-            // "-abc" where "a" is a valid argument that doesn't take a
-            // value. However, this could still be valid if all remaining
-            // characters in the value are also valid argument characters that
-            // don't take values.
-            final int valueLength = argValue.length();
-            for (int j = 0; j < valueLength; j++)
-            {
-              final char c = argValue.charAt(j);
-              final Argument b = shortIDMap.get(c);
-              if (b == null)
-              {
-                // There is no such argument registered.
-                final LocalizableMessage message = ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID
-                    .get(String.valueOf(argCharacter));
-                throw new ArgumentException(message);
-              }
-              else if (b.needsValue())
-              {
-                // This means we're in a scenario like "-abc" where b is
-                // a valid argument that takes a value. We don't support
-                // that.
-                final LocalizableMessage message = ERR_ARGPARSER_CANT_MIX_ARGS_WITH_VALUES
-                    .get(String.valueOf(argCharacter), argValue, String
-                        .valueOf(c));
-                throw new ArgumentException(message);
-              }
-              else
-              {
-                b.setPresent(true);
-
-                // If this is the usage argument, then immediately stop
-                // and print usage information.
-                if ((usageArgument != null)
-                    && usageArgument.getName().equals(b.getName()))
-                {
-                  try
-                  {
-                    getUsage(usageOutputStream);
-                  }
-                  catch (final Exception e)
-                  {
-                  }
-
-                  return;
+        if (versionArgument != null) {
+            if (shortID != null && shortID.equals(versionArgument.getShortIdentifier())) {
+                // Update the version argument to not display its short
+                // identifier.
+                try {
+                    versionArgument =
+                            new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, null,
+                                    OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION
+                                            .get());
+                    this.generalArgGroup.addArgument(versionArgument);
+                } catch (final ArgumentException e) {
+                    // ignore
                 }
-              }
             }
-          }
         }
-      }
-      else if (allowsTrailingArguments)
-      {
-        // It doesn't start with a dash, so it must be a trailing
-        // argument if that is acceptable.
-        inTrailingArgs = true;
-        trailingArguments.add(arg);
-      }
-      else
-      {
-        // It doesn't start with a dash and we don't allow trailing
-        // arguments, so this is illegal.
-        final LocalizableMessage message = ERR_ARGPARSER_DISALLOWED_TRAILING_ARGUMENT
-            .get(arg);
-        throw new ArgumentException(message);
-      }
-    }
 
-    // If we allow trailing arguments and there is a minimum number,
-    // then make sure at least that many were provided.
-    if (allowsTrailingArguments && (minTrailingArguments > 0))
-    {
-      if (trailingArguments.size() < minTrailingArguments)
-      {
-        final LocalizableMessage message = ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS
-            .get(minTrailingArguments);
-        throw new ArgumentException(message);
-      }
-    }
-
-    // If we don't have the argumentProperties, try to load a properties
-    // file.
-    if (argumentProperties == null)
-    {
-      argumentProperties = checkExternalProperties();
-    }
-
-    // Iterate through all of the arguments. For any that were not
-    // provided on the command line, see if there is an alternate default that
-    // can be used. For cases where there is not, see that argument is required.
-    for (final Argument a : argumentList)
-    {
-      if (!a.isPresent())
-      {
-        // See if there is a value in the properties that can be used
-        if ((argumentProperties != null) && (a.getPropertyName() != null))
-        {
-          final String value = argumentProperties.getProperty(a
-              .getPropertyName().toLowerCase());
-          final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-          if (value != null)
-          {
-            Boolean addValue = true;
-            if (!(a instanceof BooleanArgument))
-            {
-              addValue = a.valueIsAcceptable(value, invalidReason);
+        String longID = argument.getLongIdentifier();
+        if (longID != null) {
+            if (!longArgumentsCaseSensitive) {
+                longID = toLowerCase(longID);
             }
-            if (addValue)
-            {
-              a.addValue(value);
-              if (a.needsValue())
-              {
-                a.setPresent(true);
-              }
-              a.setValueSetByProperty(true);
+            if (longIDMap.containsKey(longID)) {
+                final String conflictingName = longIDMap.get(longID).getName();
+
+                final LocalizableMessage message =
+                        ERR_ARGPARSER_DUPLICATE_LONG_ID.get(argument.getName(), argument
+                                .getLongIdentifier(), conflictingName);
+                throw new ArgumentException(message);
             }
-          }
-        }
-      }
-
-      if ((!a.isPresent()) && a.needsValue())
-      {
-        // See if the argument defines a default.
-        if (a.getDefaultValue() != null)
-        {
-          a.addValue(a.getDefaultValue());
         }
 
-        // If there is still no value and the argument is required, then
-        // that's a problem.
-        if ((!a.hasValue()) && a.isRequired())
-        {
-          final LocalizableMessage message = ERR_ARGPARSER_NO_VALUE_FOR_REQUIRED_ARG
-              .get(a.getName());
-          throw new ArgumentException(message);
-        }
-      }
-    }
-  }
-
-
-
-  /**
-   * Parses the provided set of arguments and updates the information associated
-   * with this parser accordingly. Default values for unspecified arguments may
-   * be read from the specified properties file.
-   *
-   * @param rawArguments
-   *          The set of raw arguments to parse.
-   * @param propertiesFile
-   *          The path to the properties file to use to obtain default values
-   *          for unspecified properties.
-   * @param requirePropertiesFile
-   *          Indicates whether the parsing should fail if the provided
-   *          properties file does not exist or is not accessible.
-   * @throws ArgumentException
-   *           If a problem was encountered while parsing the provided arguments
-   *           or interacting with the properties file.
-   */
-  void parseArguments(final String[] rawArguments, final String propertiesFile,
-      final boolean requirePropertiesFile) throws ArgumentException
-  {
-    this.rawArguments = rawArguments;
-
-    Properties argumentProperties = null;
-
-    try
-    {
-      final Properties p = new Properties();
-      final FileInputStream fis = new FileInputStream(propertiesFile);
-      p.load(fis);
-      fis.close();
-      argumentProperties = p;
-    }
-    catch (final Exception e)
-    {
-      if (requirePropertiesFile)
-      {
-        final LocalizableMessage message = ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE
-            .get(String.valueOf(propertiesFile), getExceptionMessage(e));
-        throw new ArgumentException(message, e);
-      }
-    }
-
-    parseArguments(rawArguments, argumentProperties);
-  }
-
-
-
-  /**
-   * Indicates whether or not argument group description headers should be
-   * printed.
-   *
-   * @return boolean where true means print the descriptions
-   */
-  boolean printUsageGroupHeaders()
-  {
-    // If there is only a single group then we won't print them.
-    int groupsContainingArgs = 0;
-    for (final ArgumentGroup argGroup : argumentGroups)
-    {
-      if (argGroup.containsNonHiddenArguments())
-      {
-        groupsContainingArgs++;
-      }
-    }
-    return groupsContainingArgs > 1;
-  }
-
-
-
-  /**
-   * Sets the usage group description for the default argument group.
-   *
-   * @param description
-   *          for the default group
-   */
-  void setDefaultArgumentGroupDescription(final LocalizableMessage description)
-  {
-    this.defaultArgGroup.setDescription(description);
-  }
-
-
-
-  /**
-   * Sets the provided argument which will be used to identify the file
-   * properties.
-   *
-   * @param argument
-   *          The argument which will be used to identify the file properties.
-   */
-  void setFilePropertiesArgument(final StringArgument argument)
-  {
-    filePropertiesPathArgument = argument;
-  }
-
-
-
-  /**
-   * Sets the usage group description for the general argument group.
-   *
-   * @param description
-   *          for the general group
-   */
-  void setGeneralArgumentGroupDescription(final LocalizableMessage description)
-  {
-    this.generalArgGroup.setDescription(description);
-  }
-
-
-
-  /**
-   * Sets the usage group description for the input/output argument group.
-   *
-   * @param description
-   *          for the input/output group
-   */
-  void setInputOutputArgumentGroupDescription(
-      final LocalizableMessage description)
-  {
-    this.ioArgGroup.setDescription(description);
-  }
-
-
-
-  /**
-   * Sets the usage group description for the LDAP argument group.
-   *
-   * @param description
-   *          for the LDAP group
-   */
-  void setLdapArgumentGroupDescription(final LocalizableMessage description)
-  {
-    this.ldapArgGroup.setDescription(description);
-  }
-
-
-
-  /**
-   * Sets the provided argument which will be used to identify the file
-   * properties.
-   *
-   * @param argument
-   *          The argument which will be used to indicate if we have to look for
-   *          properties file.
-   */
-  void setNoPropertiesFileArgument(final BooleanArgument argument)
-  {
-    noPropertiesFileArgument = argument;
-  }
-
-
-
-  /**
-   * Sets the provided argument as one which will automatically trigger the
-   * output of usage information if it is provided on the command line and no
-   * further argument validation will be performed. Note that the caller will
-   * still need to add this argument to the parser with the
-   * <CODE>addArgument</CODE> method, and the argument should not be required
-   * and should not take a value. Also, the caller will still need to check for
-   * the presence of the usage argument after calling
-   * <CODE>parseArguments</CODE> to know that no further processing will be
-   * required.
-   *
-   * @param argument
-   *          The argument whose presence should automatically trigger the
-   *          display of usage information.
-   */
-  void setUsageArgument(final Argument argument)
-  {
-    usageArgument = argument;
-    usageOutputStream = System.out;
-  }
-
-
-
-  /**
-   * Sets the provided argument as one which will automatically trigger the
-   * output of usage information if it is provided on the command line and no
-   * further argument validation will be performed. Note that the caller will
-   * still need to add this argument to the parser with the
-   * <CODE>addArgument</CODE> method, and the argument should not be required
-   * and should not take a value. Also, the caller will still need to check for
-   * the presence of the usage argument after calling
-   * <CODE>parseArguments</CODE> to know that no further processing will be
-   * required.
-   *
-   * @param argument
-   *          The argument whose presence should automatically trigger the
-   *          display of usage information.
-   * @param outputStream
-   *          The output stream to which the usage information should be
-   *          written.
-   */
-  void setUsageArgument(final Argument argument, final OutputStream outputStream)
-  {
-    usageArgument = argument;
-    usageOutputStream = outputStream;
-  }
-
-
-
-  /**
-   * Indicates whether the version or the usage information has been displayed
-   * to the end user either by an explicit argument like "-H" or "--help", or by
-   * a built-in argument like "-?".
-   *
-   * @return {@code true} if the usage information has been displayed, or
-   *         {@code false} if not.
-   */
-  boolean usageOrVersionDisplayed()
-  {
-    return usageOrVersionDisplayed;
-  }
-
-
-
-  /**
-   * Get the absolute path of the properties file.
-   *
-   * @param directory
-   *          The location in which we should look for properties file
-   * @return The absolute path of the properties file or null
-   */
-  private String findPropertiesFile(final String directory)
-  {
-    // Look for the tools properties file
-    final File f = new File(directory, DEFAULT_OPENDJ_PROPERTIES_FILE_NAME
-        + DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION);
-    if (f.exists() && f.canRead())
-    {
-      return f.getAbsolutePath();
-    }
-    else
-    {
-      return null;
-    }
-  }
-
-
-
-  private void initGroups()
-  {
-    this.argumentGroups = new TreeSet<ArgumentGroup>();
-    this.argumentGroups.add(defaultArgGroup);
-    this.argumentGroups.add(ldapArgGroup);
-    this.argumentGroups.add(generalArgGroup);
-    this.argumentGroups.add(ioArgGroup);
-
-    try
-    {
-      versionArgument = new BooleanArgument(OPTION_LONG_PRODUCT_VERSION,
-          OPTION_SHORT_PRODUCT_VERSION, OPTION_LONG_PRODUCT_VERSION,
-          INFO_DESCRIPTION_PRODUCT_VERSION.get());
-      this.generalArgGroup.addArgument(versionArgument);
-    }
-    catch (final ArgumentException e)
-    {
-      // ignore
-    }
-  }
-
-
-
-  private boolean isGeneralArgument(final Argument arg)
-  {
-    boolean general = false;
-    if (arg != null)
-    {
-      final String longId = arg.getLongIdentifier();
-      general = OPTION_LONG_HELP.equals(longId)
-          || OPTION_LONG_PRODUCT_VERSION.equals(longId);
-    }
-    return general;
-  }
-
-
-
-  private boolean isInputOutputArgument(final Argument arg)
-  {
-    boolean io = false;
-    if (arg != null)
-    {
-      final String longId = arg.getLongIdentifier();
-      io = OPTION_LONG_VERBOSE.equals(longId)
-          || OPTION_LONG_QUIET.equals(longId)
-          || OPTION_LONG_NO_PROMPT.equals(longId)
-          || OPTION_LONG_PROP_FILE_PATH.equals(longId)
-          || OPTION_LONG_NO_PROP_FILE.equals(longId)
-          || OPTION_LONG_SCRIPT_FRIENDLY.equals(longId)
-          || OPTION_LONG_DONT_WRAP.equals(longId)
-          || OPTION_LONG_ENCODING.equals(longId)
-          || OPTION_LONG_BATCH_FILE_PATH.equals(longId);
-    }
-    return io;
-  }
-
-
-
-  private boolean isLdapConnectionArgument(final Argument arg)
-  {
-    boolean ldap = false;
-    if (arg != null)
-    {
-      final String longId = arg.getLongIdentifier();
-      ldap = OPTION_LONG_USE_SSL.equals(longId)
-          || OPTION_LONG_START_TLS.equals(longId)
-          || OPTION_LONG_HOST.equals(longId) || OPTION_LONG_PORT.equals(longId)
-          || OPTION_LONG_BINDDN.equals(longId)
-          || OPTION_LONG_BINDPWD.equals(longId)
-          || OPTION_LONG_BINDPWD_FILE.equals(longId)
-          || OPTION_LONG_SASLOPTION.equals(longId)
-          || OPTION_LONG_TRUSTALL.equals(longId)
-          || OPTION_LONG_TRUSTSTOREPATH.equals(longId)
-          || OPTION_LONG_TRUSTSTORE_PWD.equals(longId)
-          || OPTION_LONG_TRUSTSTORE_PWD_FILE.equals(longId)
-          || OPTION_LONG_KEYSTOREPATH.equals(longId)
-          || OPTION_LONG_KEYSTORE_PWD.equals(longId)
-          || OPTION_LONG_KEYSTORE_PWD_FILE.equals(longId)
-          || OPTION_LONG_CERT_NICKNAME.equals(longId)
-          || OPTION_LONG_REFERENCED_HOST_NAME.equals(longId)
-          || OPTION_LONG_ADMIN_UID.equals(longId)
-          || OPTION_LONG_REPORT_AUTHZ_ID.equals(longId)
-          || OPTION_LONG_USE_PW_POLICY_CTL.equals(longId)
-          || OPTION_LONG_USE_SASL_EXTERNAL.equals(longId)
-          || OPTION_LONG_PROTOCOL_VERSION.equals(longId);
-    }
-    return ldap;
-  }
-
-
-
-  /**
-   * Appends argument usage information to the provided buffer.
-   *
-   * @param a
-   *          The argument to handle.
-   * @param buffer
-   *          The buffer to which the usage information should be appended.
-   */
-  private void printArgumentUsage(final Argument a, final StringBuilder buffer)
-  {
-    // Write a line with the short and/or long identifiers that may be
-    // used
-    // for the argument.
-    final int indentLength = INDENT.length();
-    final Character shortID = a.getShortIdentifier();
-    final String longID = a.getLongIdentifier();
-    if (shortID != null)
-    {
-      final int currentLength = buffer.length();
-
-      if (usageArgument.getName().equals(a.getName()))
-      {
-        buffer.append("-?, ");
-      }
-
-      buffer.append("-");
-      buffer.append(shortID.charValue());
-
-      if (a.needsValue() && longID == null)
-      {
-        buffer.append(" ");
-        buffer.append(a.getValuePlaceholder());
-      }
-
-      if (longID != null)
-      {
-        final StringBuilder newBuffer = new StringBuilder();
-        newBuffer.append(", --");
-        newBuffer.append(longID);
-
-        if (a.needsValue())
-        {
-          newBuffer.append(" ");
-          newBuffer.append(a.getValuePlaceholder());
+        if (shortID != null) {
+            shortIDMap.put(shortID, argument);
         }
 
-        final int lineLength = (buffer.length() - currentLength)
-            + newBuffer.length();
-        if (lineLength > MAX_LENGTH)
-        {
-          buffer.append(EOL);
-          buffer.append(newBuffer.toString());
+        if (longID != null) {
+            longIDMap.put(longID, argument);
         }
-        else
-        {
-          buffer.append(newBuffer.toString());
-        }
-      }
 
-      buffer.append(EOL);
+        argumentList.add(argument);
+
+        if (group == null) {
+            group = getStandardGroup(argument);
+        }
+        group.addArgument(argument);
+        argumentGroups.add(group);
     }
-    else
-    {
-      if (longID != null)
-      {
-        if (usageArgument.getName().equals(a.getName()))
-        {
-          buffer.append("-?, ");
-        }
-        buffer.append("--");
-        buffer.append(longID);
 
-        if (a.needsValue())
-        {
-          buffer.append(" ");
-          buffer.append(a.getValuePlaceholder());
+    /**
+     * Adds the provided argument to the set of arguments handled by this parser
+     * and puts the arguement in the default group.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addDefaultArgument(final Argument argument) throws ArgumentException {
+        addArgument(argument, defaultArgGroup);
+    }
+
+    /**
+     * Adds the provided argument to the set of arguments handled by this parser
+     * and puts the arguement in the general group.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addGeneralArgument(final Argument argument) throws ArgumentException {
+        addArgument(argument, generalArgGroup);
+    }
+
+    /**
+     * Adds the provided argument to the set of arguments handled by this parser
+     * and puts the argument in the input/output group.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addInputOutputArgument(final Argument argument) throws ArgumentException {
+        addArgument(argument, ioArgGroup);
+    }
+
+    /**
+     * Adds the provided argument to the set of arguments handled by this parser
+     * and puts the argument in the LDAP connection group.
+     *
+     * @param argument
+     *            The argument to be added.
+     * @throws ArgumentException
+     *             If the provided argument conflicts with another argument that
+     *             has already been defined.
+     */
+    void addLdapConnectionArgument(final Argument argument) throws ArgumentException {
+        addArgument(argument, ldapArgGroup);
+    }
+
+    /**
+     * Indicates whether this parser will allow unnamed trailing arguments.
+     * These will be arguments at the end of the list that are not preceded by
+     * either a long or short identifier and will need to be manually parsed by
+     * the application using this parser. Note that once an unnamed trailing
+     * argument has been identified, all remaining arguments will be classified
+     * as such.
+     *
+     * @return <CODE>true</CODE> if this parser allows unnamed trailing
+     *         arguments, or <CODE>false</CODE> if it does not.
+     */
+    boolean allowsTrailingArguments() {
+        return allowsTrailingArguments;
+    }
+
+    /**
+     * Check if we have a properties file.
+     *
+     * @return The properties found in the properties file or null.
+     * @throws ArgumentException
+     *             If a problem was encountered while parsing the provided
+     *             arguments.
+     */
+    Properties checkExternalProperties() throws ArgumentException {
+        // We don't look for properties file.
+        if ((noPropertiesFileArgument != null) && (noPropertiesFileArgument.isPresent())) {
+            return null;
         }
 
+        // Check if we have a properties file argument
+        if (filePropertiesPathArgument == null) {
+            return null;
+        }
+
+        // check if the properties file argument has been set. If not
+        // look for default location.
+        String propertiesFilePath = null;
+        if (filePropertiesPathArgument.isPresent()) {
+            propertiesFilePath = filePropertiesPathArgument.getValue();
+        } else {
+            // Check in "user home"/.opendj directory
+            final String userDir = System.getProperty("user.home");
+            propertiesFilePath =
+                    findPropertiesFile(userDir + File.separator + DEFAULT_OPENDJ_CONFIG_DIR);
+        }
+
+        // We don't have a properties file location
+        if (propertiesFilePath == null) {
+            return null;
+        }
+
+        // We have a location for the properties file.
+        final Properties argumentProperties = new Properties();
+        final String scriptName = System.getProperty(Utils.PROPERTY_SCRIPT_NAME);
+        try {
+            final Properties p = new Properties();
+            final FileInputStream fis = new FileInputStream(propertiesFilePath);
+            p.load(fis);
+            fis.close();
+
+            for (final Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
+                final String currentPropertyName = (String) e.nextElement();
+                String propertyName = currentPropertyName;
+
+                // Property name form <script name>.<property name> has the
+                // precedence to <property name>
+                if (scriptName != null) {
+                    if (currentPropertyName.startsWith(scriptName)) {
+                        propertyName = currentPropertyName.substring(scriptName.length() + 1);
+                    } else {
+                        if (p.containsKey(scriptName + "." + currentPropertyName)) {
+                            continue;
+                        }
+                    }
+                }
+                argumentProperties.setProperty(propertyName.toLowerCase(), p
+                        .getProperty(currentPropertyName));
+            }
+        } catch (final Exception e) {
+            final LocalizableMessage message =
+                    ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE.get(String
+                            .valueOf(propertiesFilePath), getExceptionMessage(e));
+            throw new ArgumentException(message, e);
+        }
+        return argumentProperties;
+    }
+
+    /**
+     * Retrieves the argument with the specified name.
+     *
+     * @param name
+     *            The name of the argument to retrieve.
+     * @return The argument with the specified name, or <CODE>null</CODE> if
+     *         there is no such argument.
+     */
+    Argument getArgument(final String name) {
+        return argumentMap.get(name);
+    }
+
+    /**
+     * Retrieves the argument with the specified long identifier.
+     *
+     * @param longID
+     *            The long identifier of the argument to retrieve.
+     * @return The argument with the specified long identifier, or
+     *         <CODE>null</CODE> if there is no such argument.
+     */
+    Argument getArgumentForLongID(final String longID) {
+        return longIDMap.get(longID);
+    }
+
+    /**
+     * Retrieves the argument with the specified short identifier.
+     *
+     * @param shortID
+     *            The short ID for the argument to retrieve.
+     * @return The argument with the specified short identifier, or
+     *         <CODE>null</CODE> if there is no such argument.
+     */
+    Argument getArgumentForShortID(final Character shortID) {
+        return shortIDMap.get(shortID);
+    }
+
+    /**
+     * Retrieves the list of all arguments that have been defined for this
+     * argument parser.
+     *
+     * @return The list of all arguments that have been defined for this
+     *         argument parser.
+     */
+    LinkedList<Argument> getArgumentList() {
+        return argumentList;
+    }
+
+    /**
+     * Retrieves the set of arguments mapped by the long identifier that may be
+     * used to reference them. Note that arguments that do not have a long
+     * identifier will not be present in this list.
+     *
+     * @return The set of arguments mapped by the long identifier that may be
+     *         used to reference them.
+     */
+    HashMap<String, Argument> getArgumentsByLongID() {
+        return longIDMap;
+    }
+
+    /**
+     * Retrieves the set of arguments mapped by the short identifier that may be
+     * used to reference them. Note that arguments that do not have a short
+     * identifier will not be present in this list.
+     *
+     * @return The set of arguments mapped by the short identifier that may be
+     *         used to reference them.
+     */
+    HashMap<Character, Argument> getArgumentsByShortID() {
+        return shortIDMap;
+    }
+
+    /**
+     * Retrieves the fully-qualified name of the Java class that should be
+     * invoked to launch the program with which this argument parser is
+     * associated.
+     *
+     * @return The fully-qualified name of the Java class that should be invoked
+     *         to launch the program with which this argument parser is
+     *         associated.
+     */
+    String getMainClassName() {
+        return mainClassName;
+    }
+
+    /**
+     * Retrieves the maximum number of unnamed trailing arguments that may be
+     * provided.
+     *
+     * @return The maximum number of unnamed trailing arguments that may be
+     *         provided, or a value less than or equal to zero if no maximum
+     *         will be enforced.
+     */
+    int getMaxTrailingArguments() {
+        return maxTrailingArguments;
+    }
+
+    /**
+     * Retrieves the minimum number of unnamed trailing arguments that must be
+     * provided.
+     *
+     * @return The minimum number of unnamed trailing arguments that must be
+     *         provided, or a value less than or equal to zero if no minimum
+     *         will be enforced.
+     */
+    int getMinTrailingArguments() {
+        return minTrailingArguments;
+    }
+
+    /**
+     * Retrieves the raw set of arguments that were provided.
+     *
+     * @return The raw set of arguments that were provided, or <CODE>null</CODE>
+     *         if the argument list has not yet been parsed.
+     */
+    String[] getRawArguments() {
+        return rawArguments;
+    }
+
+    /**
+     * Given an argument, returns an appropriate group. Arguments may be part of
+     * one of the special groups or the default group.
+     *
+     * @param argument
+     *            for which a group is requested
+     * @return argument group appropriate for <code>argument</code>
+     */
+    ArgumentGroup getStandardGroup(final Argument argument) {
+        ArgumentGroup group;
+        if (isInputOutputArgument(argument)) {
+            group = ioArgGroup;
+        } else if (isGeneralArgument(argument)) {
+            group = generalArgGroup;
+        } else if (isLdapConnectionArgument(argument)) {
+            group = ldapArgGroup;
+        } else {
+            group = defaultArgGroup;
+        }
+        return group;
+    }
+
+    /**
+     * Retrieves a human-readable description for this tool, which should be
+     * included at the top of the command-line usage information.
+     *
+     * @return A human-readable description for this tool, or {@code null} if
+     *         none is available.
+     */
+    LocalizableMessage getToolDescription() {
+        return toolDescription;
+    }
+
+    /**
+     * Retrieves the set of unnamed trailing arguments that were provided on the
+     * command line.
+     *
+     * @return The set of unnamed trailing arguments that were provided on the
+     *         command line.
+     */
+    ArrayList<String> getTrailingArguments() {
+        return trailingArguments;
+    }
+
+    /**
+     * Retrieves a string containing usage information based on the defined
+     * arguments.
+     *
+     * @return A string containing usage information based on the defined
+     *         arguments.
+     */
+    String getUsage() {
+        final StringBuilder buffer = new StringBuilder();
+        getUsage(buffer);
+
+        return buffer.toString();
+    }
+
+    /**
+     * Writes usage information based on the defined arguments to the provided
+     * output stream.
+     *
+     * @param outputStream
+     *            The output stream to which the usage information should be
+     *            written.
+     * @throws IOException
+     *             If a problem occurs while attempting to write the usage
+     *             information to the provided output stream.
+     */
+    void getUsage(final OutputStream outputStream) throws IOException {
+        final StringBuilder buffer = new StringBuilder();
+        getUsage(buffer);
+
+        outputStream.write(getBytes(buffer.toString()));
+    }
+
+    /**
+     * Appends usage information based on the defined arguments to the provided
+     * buffer.
+     *
+     * @param buffer
+     *            The buffer to which the usage information should be appended.
+     */
+    void getUsage(final StringBuilder buffer) {
+        usageOrVersionDisplayed = true;
+        final String scriptName = System.getProperty(PROPERTY_SCRIPT_NAME);
+        if ((scriptName == null) || (scriptName.length() == 0)) {
+            buffer.append(INFO_ARGPARSER_USAGE_JAVA_CLASSNAME.get(mainClassName));
+        } else {
+            buffer.append(INFO_ARGPARSER_USAGE_JAVA_SCRIPTNAME.get(scriptName));
+        }
+
+        if (allowsTrailingArguments) {
+            if (trailingArgsDisplayName == null) {
+                buffer.append(" " + INFO_ARGPARSER_USAGE_TRAILINGARGS.get());
+            } else {
+                buffer.append(" ");
+                buffer.append(trailingArgsDisplayName);
+            }
+        }
         buffer.append(EOL);
-      }
+        buffer.append(EOL);
+        if ((toolDescription != null) && (toolDescription.length() > 0)) {
+            buffer.append(wrapText(toolDescription.toString(), MAX_LENGTH - 1));
+            buffer.append(EOL);
+            buffer.append(EOL);
+        }
+        buffer.append(INFO_SUBCMDPARSER_WHERE_OPTIONS_INCLUDE.get());
+        buffer.append(EOL);
+        buffer.append(EOL);
+
+        Argument helpArgument = null;
+
+        final boolean printHeaders = printUsageGroupHeaders();
+        for (final ArgumentGroup argGroup : argumentGroups) {
+            if (argGroup.containsArguments() && printHeaders) {
+                // Print the groups description if any
+                final LocalizableMessage groupDesc = argGroup.getDescription();
+                if (groupDesc != null && !LocalizableMessage.EMPTY.equals(groupDesc)) {
+                    buffer.append(EOL);
+                    buffer.append(wrapText(groupDesc.toString(), MAX_LENGTH - 1));
+                    buffer.append(EOL);
+                    buffer.append(EOL);
+                }
+            }
+
+            final SortedSet<Argument> args = new TreeSet<Argument>(new Comparator<Argument>() {
+
+                /**
+                 * {@inheritDoc}
+                 */
+                public int compare(final Argument o1, final Argument o2) {
+                    final String s1;
+                    final String s2;
+
+                    if (o1.getShortIdentifier() != null) {
+                        s1 = o1.getShortIdentifier().toString();
+                    } else {
+                        s1 = o1.getLongIdentifier();
+                    }
+
+                    if (o2.getShortIdentifier() != null) {
+                        s2 = o2.getShortIdentifier().toString();
+                    } else {
+                        s2 = o2.getLongIdentifier();
+                    }
+
+                    final int res = s1.compareToIgnoreCase(s2);
+                    if (res != 0) {
+                        return res;
+                    } else {
+                        // Lowercase options first then uppercase.
+                        return -s1.compareTo(s2);
+                    }
+                }
+
+            });
+            args.addAll(argGroup.getArguments());
+
+            for (final Argument a : args) {
+                // If this argument is hidden, then skip it.
+                if (a.isHidden()) {
+                    continue;
+                }
+
+                // Help argument should be printed at the end
+                if ((usageArgument != null) && usageArgument.getName().equals(a.getName())) {
+                    helpArgument = a;
+                    continue;
+                }
+                printArgumentUsage(a, buffer);
+            }
+        }
+        if (helpArgument != null) {
+            printArgumentUsage(helpArgument, buffer);
+        } else {
+            buffer.append(EOL);
+            buffer.append("-?");
+            buffer.append(EOL);
+        }
     }
 
-    // Write one or more lines with the description of the argument.
-    // We will
-    // indent the description five characters and try our best to wrap
-    // at or
-    // before column 79 so it will be friendly to 80-column displays.
-    buffer.append(
-        Utils.wrapText(a.getDescription(), MAX_LENGTH, indentLength));
-    buffer.append(EOL);
+    /**
+     * Retrieves a message containing usage information based on the defined
+     * arguments.
+     *
+     * @return A string containing usage information based on the defined
+     *         arguments.
+     */
+    LocalizableMessage getUsageMessage() {
+        final StringBuilder buffer = new StringBuilder();
+        getUsage(buffer);
 
-    if (a.needsValue() && (a.getDefaultValue() != null)
-        && (a.getDefaultValue().length() > 0))
-    {
-      buffer.append(INDENT);
-      buffer.append(INFO_ARGPARSER_USAGE_DEFAULT_VALUE.get(a.getDefaultValue())
-          .toString());
-      buffer.append(EOL);
+        // TODO: rework getUsage(OutputStream) to work with messages
+        // framework
+        return LocalizableMessage.raw(buffer.toString());
     }
-  }
+
+    /**
+     * Returns whether the usage argument was provided or not. This method
+     * should be called after a call to parseArguments.
+     *
+     * @return <CODE>true</CODE> if the usage argument was provided and
+     *         <CODE>false</CODE> otherwise.
+     */
+    boolean isUsageArgumentPresent() {
+        boolean isUsageArgumentPresent = false;
+        if (usageArgument != null) {
+            isUsageArgumentPresent = usageArgument.isPresent();
+        }
+        return isUsageArgumentPresent;
+    }
+
+    /**
+     * Returns whether the version argument was provided or not. This method
+     * should be called after a call to parseArguments.
+     *
+     * @return <CODE>true</CODE> if the version argument was provided and
+     *         <CODE>false</CODE> otherwise.
+     */
+    boolean isVersionArgumentPresent() {
+        return versionPresent;
+    }
+
+    /**
+     * Parses the provided set of arguments and updates the information
+     * associated with this parser accordingly.
+     *
+     * @param rawArguments
+     *            The raw set of arguments to parse.
+     * @throws ArgumentException
+     *             If a problem was encountered while parsing the provided
+     *             arguments.
+     */
+    void parseArguments(final String[] rawArguments) throws ArgumentException {
+        parseArguments(rawArguments, null);
+    }
+
+    /**
+     * Parses the provided set of arguments and updates the information
+     * associated with this parser accordingly. Default values for unspecified
+     * arguments may be read from the specified properties if any are provided.
+     *
+     * @param rawArguments
+     *            The set of raw arguments to parse.
+     * @param argumentProperties
+     *            A set of properties that may be used to provide default values
+     *            for arguments not included in the given raw arguments.
+     * @throws ArgumentException
+     *             If a problem was encountered while parsing the provided
+     *             arguments.
+     */
+    void parseArguments(final String[] rawArguments, Properties argumentProperties)
+            throws ArgumentException {
+        this.rawArguments = rawArguments;
+
+        boolean inTrailingArgs = false;
+
+        final int numArguments = rawArguments.length;
+        for (int i = 0; i < numArguments; i++) {
+            final String arg = rawArguments[i];
+
+            if (inTrailingArgs) {
+                trailingArguments.add(arg);
+                if ((maxTrailingArguments > 0) && (trailingArguments.size() > maxTrailingArguments)) {
+                    final LocalizableMessage message =
+                            ERR_ARGPARSER_TOO_MANY_TRAILING_ARGS.get(maxTrailingArguments);
+                    throw new ArgumentException(message);
+                }
+
+                continue;
+            }
+
+            if (arg.equals("--")) {
+                // This is a special indicator that we have reached the end of
+                // the named arguments and that everything that follows after
+                // this
+                // should be considered trailing arguments.
+                inTrailingArgs = true;
+            } else if (arg.startsWith("--")) {
+                // This indicates that we are using the long name to reference
+                // the argument. It may be in any of the following forms:
+                // --name
+                // --name value
+                // --name=value
+
+                String argName = arg.substring(2);
+                String argValue = null;
+                final int equalPos = argName.indexOf('=');
+                if (equalPos < 0) {
+                    // This is fine. The value is not part of the argument name
+                    // token.
+                } else if (equalPos == 0) {
+                    // The argument starts with "--=", which is not acceptable.
+                    final LocalizableMessage message = ERR_ARGPARSER_LONG_ARG_WITHOUT_NAME.get(arg);
+                    throw new ArgumentException(message);
+                } else {
+                    // The argument is in the form --name=value, so parse them
+                    // both out.
+                    argValue = argName.substring(equalPos + 1);
+                    argName = argName.substring(0, equalPos);
+                }
+
+                // If we're not case-sensitive, then convert the name to
+                // lowercase.
+                final String origArgName = argName;
+                if (!longArgumentsCaseSensitive) {
+                    argName = toLowerCase(argName);
+                }
+
+                // Get the argument with the specified name.
+                final Argument a = longIDMap.get(argName);
+                if (a == null) {
+                    if (argName.equals(OPTION_LONG_HELP)) {
+                        // "--help" will always be interpreted as requesting
+                        // usage
+                        // information.
+                        try {
+                            getUsage(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+
+                        return;
+                    } else if (argName.equals(OPTION_LONG_PRODUCT_VERSION)) {
+                        // "--version" will always be interpreted as requesting
+                        // version information.
+                        usageOrVersionDisplayed = true;
+                        versionPresent = true;
+                        try {
+                            // TODO
+                            // DirectoryServer.printVersion(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+
+                        return;
+                    } else {
+                        // There is no such argument registered.
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID.get(origArgName);
+                        throw new ArgumentException(message);
+                    }
+                } else {
+                    a.setPresent(true);
+
+                    // If this is the usage argument, then immediately stop and
+                    // print usage information.
+                    if ((usageArgument != null) && usageArgument.getName().equals(a.getName())) {
+                        try {
+                            getUsage(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+
+                        return;
+                    }
+                }
+
+                // See if the argument takes a value. If so, then make sure one
+                // was provided. If not, then make sure none was provided.
+                if (a.needsValue()) {
+                    if (argValue == null) {
+                        if ((i + 1) == numArguments) {
+                            final LocalizableMessage message =
+                                    ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID
+                                            .get(origArgName);
+                            throw new ArgumentException(message);
+                        }
+
+                        argValue = rawArguments[++i];
+                    }
+
+                    final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
+                    if (!a.valueIsAcceptable(argValue, invalidReason)) {
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_LONG_ID.get(argValue,
+                                        origArgName, invalidReason.toString());
+                        throw new ArgumentException(message);
+                    }
+
+                    // If the argument already has a value, then make sure it is
+                    // acceptable to have more than one.
+                    if (a.hasValue() && (!a.isMultiValued())) {
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_NOT_MULTIVALUED_FOR_LONG_ID.get(origArgName);
+                        throw new ArgumentException(message);
+                    }
+
+                    a.addValue(argValue);
+                } else {
+                    if (argValue != null) {
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_ARG_FOR_LONG_ID_DOESNT_TAKE_VALUE.get(origArgName);
+                        throw new ArgumentException(message);
+                    }
+                }
+            } else if (arg.startsWith("-")) {
+                // This indicates that we are using the 1-character name to
+                // reference the argument. It may be in any of the following
+                // forms:
+                // -n
+                // -nvalue
+                // -n value
+                if (arg.equals("-")) {
+                    final LocalizableMessage message = ERR_ARGPARSER_INVALID_DASH_AS_ARGUMENT.get();
+                    throw new ArgumentException(message);
+                }
+
+                final char argCharacter = arg.charAt(1);
+                String argValue;
+                if (arg.length() > 2) {
+                    argValue = arg.substring(2);
+                } else {
+                    argValue = null;
+                }
+
+                // Get the argument with the specified short ID.
+                final Argument a = shortIDMap.get(argCharacter);
+                if (a == null) {
+                    if (argCharacter == '?') {
+                        // "-?" will always be interpreted as requesting usage
+                        // information.
+                        try {
+                            getUsage(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+
+                        return;
+                    } else if ((argCharacter == OPTION_SHORT_PRODUCT_VERSION)
+                            && (!shortIDMap.containsKey(OPTION_SHORT_PRODUCT_VERSION))) {
+                        // "-V" will always be interpreted as requesting
+                        // version information except if it's already defined
+                        // (e.g
+                        // in ldap tools).
+                        usageOrVersionDisplayed = true;
+                        versionPresent = true;
+                        try {
+                            // TODO
+                            // DirectoryServer.printVersion(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+                        return;
+                    } else {
+                        // There is no such argument registered.
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID.get(String
+                                        .valueOf(argCharacter));
+                        throw new ArgumentException(message);
+                    }
+                } else {
+                    a.setPresent(true);
+
+                    // If this is the usage argument, then immediately stop and
+                    // print usage information.
+                    if ((usageArgument != null) && usageArgument.getName().equals(a.getName())) {
+                        try {
+                            getUsage(usageOutputStream);
+                        } catch (final Exception e) {
+                            // Ignored.
+                        }
+
+                        return;
+                    }
+                }
+
+                // See if the argument takes a value. If so, then make sure one
+                // was provided. If not, then make sure none was provided.
+                if (a.needsValue()) {
+                    if (argValue == null) {
+                        if ((i + 1) == numArguments) {
+                            final LocalizableMessage message =
+                                    ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_SHORT_ID.get(String
+                                            .valueOf(argCharacter));
+                            throw new ArgumentException(message);
+                        }
+
+                        argValue = rawArguments[++i];
+                    }
+
+                    final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
+                    if (!a.valueIsAcceptable(argValue, invalidReason)) {
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_SHORT_ID.get(argValue, String
+                                        .valueOf(argCharacter), invalidReason.toString());
+                        throw new ArgumentException(message);
+                    }
+
+                    // If the argument already has a value, then make sure it is
+                    // acceptable to have more than one.
+                    if (a.hasValue() && (!a.isMultiValued())) {
+                        final LocalizableMessage message =
+                                ERR_ARGPARSER_NOT_MULTIVALUED_FOR_SHORT_ID.get(String
+                                        .valueOf(argCharacter));
+                        throw new ArgumentException(message);
+                    }
+
+                    a.addValue(argValue);
+                } else {
+                    if (argValue != null) {
+                        // If we've gotten here, then it means that we're in a
+                        // scenario like
+                        // "-abc" where "a" is a valid argument that doesn't
+                        // take a
+                        // value. However, this could still be valid if all
+                        // remaining
+                        // characters in the value are also valid argument
+                        // characters that
+                        // don't take values.
+                        final int valueLength = argValue.length();
+                        for (int j = 0; j < valueLength; j++) {
+                            final char c = argValue.charAt(j);
+                            final Argument b = shortIDMap.get(c);
+                            if (b == null) {
+                                // There is no such argument registered.
+                                final LocalizableMessage message =
+                                        ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID.get(String
+                                                .valueOf(argCharacter));
+                                throw new ArgumentException(message);
+                            } else if (b.needsValue()) {
+                                // This means we're in a scenario like "-abc"
+                                // where b is
+                                // a valid argument that takes a value. We don't
+                                // support
+                                // that.
+                                final LocalizableMessage message =
+                                        ERR_ARGPARSER_CANT_MIX_ARGS_WITH_VALUES
+                                                .get(String.valueOf(argCharacter), argValue, String
+                                                        .valueOf(c));
+                                throw new ArgumentException(message);
+                            } else {
+                                b.setPresent(true);
+
+                                // If this is the usage argument, then
+                                // immediately stop
+                                // and print usage information.
+                                if ((usageArgument != null)
+                                        && usageArgument.getName().equals(b.getName())) {
+                                    try {
+                                        getUsage(usageOutputStream);
+                                    } catch (final Exception e) {
+                                        // Ignored.
+                                    }
+
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
+            } else if (allowsTrailingArguments) {
+                // It doesn't start with a dash, so it must be a trailing
+                // argument if that is acceptable.
+                inTrailingArgs = true;
+                trailingArguments.add(arg);
+            } else {
+                // It doesn't start with a dash and we don't allow trailing
+                // arguments, so this is illegal.
+                final LocalizableMessage message =
+                        ERR_ARGPARSER_DISALLOWED_TRAILING_ARGUMENT.get(arg);
+                throw new ArgumentException(message);
+            }
+        }
+
+        // If we allow trailing arguments and there is a minimum number,
+        // then make sure at least that many were provided.
+        if (allowsTrailingArguments && (minTrailingArguments > 0)) {
+            if (trailingArguments.size() < minTrailingArguments) {
+                final LocalizableMessage message =
+                        ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(minTrailingArguments);
+                throw new ArgumentException(message);
+            }
+        }
+
+        // If we don't have the argumentProperties, try to load a properties
+        // file.
+        if (argumentProperties == null) {
+            argumentProperties = checkExternalProperties();
+        }
+
+        // Iterate through all of the arguments. For any that were not
+        // provided on the command line, see if there is an alternate default
+        // that
+        // can be used. For cases where there is not, see that argument is
+        // required.
+        for (final Argument a : argumentList) {
+            if (!a.isPresent()) {
+                // See if there is a value in the properties that can be used
+                if ((argumentProperties != null) && (a.getPropertyName() != null)) {
+                    final String value =
+                            argumentProperties.getProperty(a.getPropertyName().toLowerCase());
+                    final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
+                    if (value != null) {
+                        Boolean addValue = true;
+                        if (!(a instanceof BooleanArgument)) {
+                            addValue = a.valueIsAcceptable(value, invalidReason);
+                        }
+                        if (addValue) {
+                            a.addValue(value);
+                            if (a.needsValue()) {
+                                a.setPresent(true);
+                            }
+                            a.setValueSetByProperty(true);
+                        }
+                    }
+                }
+            }
+
+            if ((!a.isPresent()) && a.needsValue()) {
+                // See if the argument defines a default.
+                if (a.getDefaultValue() != null) {
+                    a.addValue(a.getDefaultValue());
+                }
+
+                // If there is still no value and the argument is required, then
+                // that's a problem.
+                if ((!a.hasValue()) && a.isRequired()) {
+                    final LocalizableMessage message =
+                            ERR_ARGPARSER_NO_VALUE_FOR_REQUIRED_ARG.get(a.getName());
+                    throw new ArgumentException(message);
+                }
+            }
+        }
+    }
+
+    /**
+     * Parses the provided set of arguments and updates the information
+     * associated with this parser accordingly. Default values for unspecified
+     * arguments may be read from the specified properties file.
+     *
+     * @param rawArguments
+     *            The set of raw arguments to parse.
+     * @param propertiesFile
+     *            The path to the properties file to use to obtain default
+     *            values for unspecified properties.
+     * @param requirePropertiesFile
+     *            Indicates whether the parsing should fail if the provided
+     *            properties file does not exist or is not accessible.
+     * @throws ArgumentException
+     *             If a problem was encountered while parsing the provided
+     *             arguments or interacting with the properties file.
+     */
+    void parseArguments(final String[] rawArguments, final String propertiesFile,
+            final boolean requirePropertiesFile) throws ArgumentException {
+        this.rawArguments = rawArguments;
+
+        Properties argumentProperties = null;
+
+        try {
+            final Properties p = new Properties();
+            final FileInputStream fis = new FileInputStream(propertiesFile);
+            p.load(fis);
+            fis.close();
+            argumentProperties = p;
+        } catch (final Exception e) {
+            if (requirePropertiesFile) {
+                final LocalizableMessage message =
+                        ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE.get(String
+                                .valueOf(propertiesFile), getExceptionMessage(e));
+                throw new ArgumentException(message, e);
+            }
+        }
+
+        parseArguments(rawArguments, argumentProperties);
+    }
+
+    /**
+     * Indicates whether or not argument group description headers should be
+     * printed.
+     *
+     * @return boolean where true means print the descriptions
+     */
+    boolean printUsageGroupHeaders() {
+        // If there is only a single group then we won't print them.
+        int groupsContainingArgs = 0;
+        for (final ArgumentGroup argGroup : argumentGroups) {
+            if (argGroup.containsNonHiddenArguments()) {
+                groupsContainingArgs++;
+            }
+        }
+        return groupsContainingArgs > 1;
+    }
+
+    /**
+     * Sets the usage group description for the default argument group.
+     *
+     * @param description
+     *            for the default group
+     */
+    void setDefaultArgumentGroupDescription(final LocalizableMessage description) {
+        this.defaultArgGroup.setDescription(description);
+    }
+
+    /**
+     * Sets the provided argument which will be used to identify the file
+     * properties.
+     *
+     * @param argument
+     *            The argument which will be used to identify the file
+     *            properties.
+     */
+    void setFilePropertiesArgument(final StringArgument argument) {
+        filePropertiesPathArgument = argument;
+    }
+
+    /**
+     * Sets the usage group description for the general argument group.
+     *
+     * @param description
+     *            for the general group
+     */
+    void setGeneralArgumentGroupDescription(final LocalizableMessage description) {
+        this.generalArgGroup.setDescription(description);
+    }
+
+    /**
+     * Sets the usage group description for the input/output argument group.
+     *
+     * @param description
+     *            for the input/output group
+     */
+    void setInputOutputArgumentGroupDescription(final LocalizableMessage description) {
+        this.ioArgGroup.setDescription(description);
+    }
+
+    /**
+     * Sets the usage group description for the LDAP argument group.
+     *
+     * @param description
+     *            for the LDAP group
+     */
+    void setLdapArgumentGroupDescription(final LocalizableMessage description) {
+        this.ldapArgGroup.setDescription(description);
+    }
+
+    /**
+     * Sets the provided argument which will be used to identify the file
+     * properties.
+     *
+     * @param argument
+     *            The argument which will be used to indicate if we have to look
+     *            for properties file.
+     */
+    void setNoPropertiesFileArgument(final BooleanArgument argument) {
+        noPropertiesFileArgument = argument;
+    }
+
+    /**
+     * Sets the provided argument as one which will automatically trigger the
+     * output of usage information if it is provided on the command line and no
+     * further argument validation will be performed. Note that the caller will
+     * still need to add this argument to the parser with the
+     * <CODE>addArgument</CODE> method, and the argument should not be required
+     * and should not take a value. Also, the caller will still need to check
+     * for the presence of the usage argument after calling
+     * <CODE>parseArguments</CODE> to know that no further processing will be
+     * required.
+     *
+     * @param argument
+     *            The argument whose presence should automatically trigger the
+     *            display of usage information.
+     */
+    void setUsageArgument(final Argument argument) {
+        usageArgument = argument;
+        usageOutputStream = System.out;
+    }
+
+    /**
+     * Sets the provided argument as one which will automatically trigger the
+     * output of usage information if it is provided on the command line and no
+     * further argument validation will be performed. Note that the caller will
+     * still need to add this argument to the parser with the
+     * <CODE>addArgument</CODE> method, and the argument should not be required
+     * and should not take a value. Also, the caller will still need to check
+     * for the presence of the usage argument after calling
+     * <CODE>parseArguments</CODE> to know that no further processing will be
+     * required.
+     *
+     * @param argument
+     *            The argument whose presence should automatically trigger the
+     *            display of usage information.
+     * @param outputStream
+     *            The output stream to which the usage information should be
+     *            written.
+     */
+    void setUsageArgument(final Argument argument, final OutputStream outputStream) {
+        usageArgument = argument;
+        usageOutputStream = outputStream;
+    }
+
+    /**
+     * Indicates whether the version or the usage information has been displayed
+     * to the end user either by an explicit argument like "-H" or "--help", or
+     * by a built-in argument like "-?".
+     *
+     * @return {@code true} if the usage information has been displayed, or
+     *         {@code false} if not.
+     */
+    boolean usageOrVersionDisplayed() {
+        return usageOrVersionDisplayed;
+    }
+
+    /**
+     * Get the absolute path of the properties file.
+     *
+     * @param directory
+     *            The location in which we should look for properties file
+     * @return The absolute path of the properties file or null
+     */
+    private String findPropertiesFile(final String directory) {
+        // Look for the tools properties file
+        final File f =
+                new File(directory, DEFAULT_OPENDJ_PROPERTIES_FILE_NAME
+                        + DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION);
+        if (f.exists() && f.canRead()) {
+            return f.getAbsolutePath();
+        } else {
+            return null;
+        }
+    }
+
+    private void initGroups() {
+        this.argumentGroups = new TreeSet<ArgumentGroup>();
+        this.argumentGroups.add(defaultArgGroup);
+        this.argumentGroups.add(ldapArgGroup);
+        this.argumentGroups.add(generalArgGroup);
+        this.argumentGroups.add(ioArgGroup);
+
+        try {
+            versionArgument =
+                    new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, OPTION_SHORT_PRODUCT_VERSION,
+                            OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION.get());
+            this.generalArgGroup.addArgument(versionArgument);
+        } catch (final ArgumentException e) {
+            // ignore
+        }
+    }
+
+    private boolean isGeneralArgument(final Argument arg) {
+        boolean general = false;
+        if (arg != null) {
+            final String longId = arg.getLongIdentifier();
+            general = OPTION_LONG_HELP.equals(longId) || OPTION_LONG_PRODUCT_VERSION.equals(longId);
+        }
+        return general;
+    }
+
+    private boolean isInputOutputArgument(final Argument arg) {
+        boolean io = false;
+        if (arg != null) {
+            final String longId = arg.getLongIdentifier();
+            io =
+                    OPTION_LONG_VERBOSE.equals(longId) || OPTION_LONG_QUIET.equals(longId)
+                            || OPTION_LONG_NO_PROMPT.equals(longId)
+                            || OPTION_LONG_PROP_FILE_PATH.equals(longId)
+                            || OPTION_LONG_NO_PROP_FILE.equals(longId)
+                            || OPTION_LONG_SCRIPT_FRIENDLY.equals(longId)
+                            || OPTION_LONG_DONT_WRAP.equals(longId)
+                            || OPTION_LONG_ENCODING.equals(longId)
+                            || OPTION_LONG_BATCH_FILE_PATH.equals(longId);
+        }
+        return io;
+    }
+
+    private boolean isLdapConnectionArgument(final Argument arg) {
+        boolean ldap = false;
+        if (arg != null) {
+            final String longId = arg.getLongIdentifier();
+            ldap =
+                    OPTION_LONG_USE_SSL.equals(longId) || OPTION_LONG_START_TLS.equals(longId)
+                            || OPTION_LONG_HOST.equals(longId) || OPTION_LONG_PORT.equals(longId)
+                            || OPTION_LONG_BINDDN.equals(longId)
+                            || OPTION_LONG_BINDPWD.equals(longId)
+                            || OPTION_LONG_BINDPWD_FILE.equals(longId)
+                            || OPTION_LONG_SASLOPTION.equals(longId)
+                            || OPTION_LONG_TRUSTALL.equals(longId)
+                            || OPTION_LONG_TRUSTSTOREPATH.equals(longId)
+                            || OPTION_LONG_TRUSTSTORE_PWD.equals(longId)
+                            || OPTION_LONG_TRUSTSTORE_PWD_FILE.equals(longId)
+                            || OPTION_LONG_KEYSTOREPATH.equals(longId)
+                            || OPTION_LONG_KEYSTORE_PWD.equals(longId)
+                            || OPTION_LONG_KEYSTORE_PWD_FILE.equals(longId)
+                            || OPTION_LONG_CERT_NICKNAME.equals(longId)
+                            || OPTION_LONG_REFERENCED_HOST_NAME.equals(longId)
+                            || OPTION_LONG_ADMIN_UID.equals(longId)
+                            || OPTION_LONG_REPORT_AUTHZ_ID.equals(longId)
+                            || OPTION_LONG_USE_PW_POLICY_CTL.equals(longId)
+                            || OPTION_LONG_USE_SASL_EXTERNAL.equals(longId)
+                            || OPTION_LONG_PROTOCOL_VERSION.equals(longId);
+        }
+        return ldap;
+    }
+
+    /**
+     * Appends argument usage information to the provided buffer.
+     *
+     * @param a
+     *            The argument to handle.
+     * @param buffer
+     *            The buffer to which the usage information should be appended.
+     */
+    private void printArgumentUsage(final Argument a, final StringBuilder buffer) {
+        // Write a line with the short and/or long identifiers that may be
+        // used
+        // for the argument.
+        final int indentLength = INDENT.length();
+        final Character shortID = a.getShortIdentifier();
+        final String longID = a.getLongIdentifier();
+        if (shortID != null) {
+            final int currentLength = buffer.length();
+
+            if (usageArgument.getName().equals(a.getName())) {
+                buffer.append("-?, ");
+            }
+
+            buffer.append("-");
+            buffer.append(shortID.charValue());
+
+            if (a.needsValue() && longID == null) {
+                buffer.append(" ");
+                buffer.append(a.getValuePlaceholder());
+            }
+
+            if (longID != null) {
+                final StringBuilder newBuffer = new StringBuilder();
+                newBuffer.append(", --");
+                newBuffer.append(longID);
+
+                if (a.needsValue()) {
+                    newBuffer.append(" ");
+                    newBuffer.append(a.getValuePlaceholder());
+                }
+
+                final int lineLength = (buffer.length() - currentLength) + newBuffer.length();
+                if (lineLength > MAX_LENGTH) {
+                    buffer.append(EOL);
+                    buffer.append(newBuffer.toString());
+                } else {
+                    buffer.append(newBuffer.toString());
+                }
+            }
+
+            buffer.append(EOL);
+        } else {
+            if (longID != null) {
+                if (usageArgument.getName().equals(a.getName())) {
+                    buffer.append("-?, ");
+                }
+                buffer.append("--");
+                buffer.append(longID);
+
+                if (a.needsValue()) {
+                    buffer.append(" ");
+                    buffer.append(a.getValuePlaceholder());
+                }
+
+                buffer.append(EOL);
+            }
+        }
+
+        // Write one or more lines with the description of the argument.
+        // We will
+        // indent the description five characters and try our best to wrap
+        // at or
+        // before column 79 so it will be friendly to 80-column displays.
+        buffer.append(Utils.wrapText(a.getDescription(), MAX_LENGTH, indentLength));
+        buffer.append(EOL);
+
+        if (a.needsValue() && (a.getDefaultValue() != null) && (a.getDefaultValue().length() > 0)) {
+            buffer.append(INDENT);
+            buffer.append(INFO_ARGPARSER_USAGE_DEFAULT_VALUE.get(a.getDefaultValue()).toString());
+            buffer.append(EOL);
+        }
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
index 1ba09f3..438b66e 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,8 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
 import java.util.ArrayList;
@@ -42,613 +39,484 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.requests.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.ResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CRAMMD5SASLBindRequest;
+import org.forgerock.opendj.ldap.requests.DigestMD5SASLBindRequest;
+import org.forgerock.opendj.ldap.requests.ExternalSASLBindRequest;
+import org.forgerock.opendj.ldap.requests.GSSAPISASLBindRequest;
+import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.SimpleBindRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 
 import com.forgerock.opendj.util.RecursiveFutureResult;
 
-
-
 /**
  * A load generation tool that can be used to load a Directory Server with Bind
  * requests using one or more LDAP connections.
  */
-public final class AuthRate extends ConsoleApplication
-{
-  private final class BindPerformanceRunner extends PerformanceRunner
-  {
-    private final class BindStatsThread extends StatsThread
-    {
-      private final String[] extraColumn;
+public final class AuthRate extends ConsoleApplication {
+    private final class BindPerformanceRunner extends PerformanceRunner {
+        private final class BindStatsThread extends StatsThread {
+            private final String[] extraColumn;
 
+            private BindStatsThread(final boolean extraFieldRequired) {
+                super(extraFieldRequired ? new String[] { "bind time %" } : new String[0]);
+                extraColumn = new String[extraFieldRequired ? 1 : 0];
+            }
 
-
-      private BindStatsThread(final boolean extraFieldRequired)
-      {
-        super(extraFieldRequired ? new String[] { "bind time %" }
-            : new String[0]);
-        extraColumn = new String[extraFieldRequired ? 1 : 0];
-      }
-
-
-
-      @Override
-      String[] getAdditionalColumns()
-      {
-        invalidCredRecentCount.set(0);
-        if (extraColumn.length != 0)
-        {
-          final long searchWaitTime = searchWaitRecentTime.getAndSet(0);
-          extraColumn[0] = String.format("%.1f",
-              ((float) (waitTime - searchWaitTime) / waitTime) * 100.0);
+            @Override
+            String[] getAdditionalColumns() {
+                invalidCredRecentCount.set(0);
+                if (extraColumn.length != 0) {
+                    final long searchWaitTime = searchWaitRecentTime.getAndSet(0);
+                    extraColumn[0] =
+                            String.format("%.1f",
+                                    ((float) (waitTime - searchWaitTime) / waitTime) * 100.0);
+                }
+                return extraColumn;
+            }
         }
-        return extraColumn;
-      }
-    }
 
+        private final class BindUpdateStatsResultHandler extends
+                UpdateStatsResultHandler<BindResult> {
+            private BindUpdateStatsResultHandler(final long startTime) {
+                super(startTime);
+            }
 
+            @Override
+            public void handleErrorResult(final ErrorResultException error) {
+                super.handleErrorResult(error);
 
-    private final class BindUpdateStatsResultHandler extends
-        UpdateStatsResultHandler<BindResult>
-    {
-      private BindUpdateStatsResultHandler(final long startTime)
-      {
-        super(startTime);
-      }
-
-
-
-      @Override
-      public void handleErrorResult(final ErrorResultException error)
-      {
-        super.handleErrorResult(error);
-
-        if (error.getResult().getResultCode() == ResultCode.INVALID_CREDENTIALS)
-        {
-          invalidCredRecentCount.getAndIncrement();
+                if (error.getResult().getResultCode() == ResultCode.INVALID_CREDENTIALS) {
+                    invalidCredRecentCount.getAndIncrement();
+                }
+            }
         }
-      }
-    }
 
+        private final class BindWorkerThread extends WorkerThread {
+            private SearchRequest sr;
+            private BindRequest br;
+            private Object[] data;
+            private final char[] invalidPassword = "invalid-password".toCharArray();
 
+            private final ThreadLocal<Random> rng = new ThreadLocal<Random>() {
 
-    private final class BindWorkerThread extends WorkerThread
-    {
-      private SearchRequest sr;
-      private BindRequest br;
-      private Object[] data;
-      private final char[] invalidPassword = "invalid-password".toCharArray();
+                @Override
+                protected Random initialValue() {
+                    return new Random();
+                }
 
-      private final ThreadLocal<Random> rng = new ThreadLocal<Random>()
-      {
+            };
+
+            private BindWorkerThread(final Connection connection,
+                    final ConnectionFactory connectionFactory) {
+                super(connection, connectionFactory);
+            }
+
+            @Override
+            public FutureResult<?> performOperation(final Connection connection,
+                    final DataSource[] dataSources, final long startTime) {
+                if (dataSources != null) {
+                    data = DataSource.generateData(dataSources, data);
+                    if (data.length == dataSources.length) {
+                        final Object[] newData = new Object[data.length + 1];
+                        System.arraycopy(data, 0, newData, 0, data.length);
+                        data = newData;
+                    }
+                }
+                if (filter != null && baseDN != null) {
+                    if (sr == null) {
+                        if (dataSources == null) {
+                            sr = Requests.newSearchRequest(baseDN, scope, filter, attributes);
+                        } else {
+                            sr =
+                                    Requests.newSearchRequest(String.format(baseDN, data), scope,
+                                            String.format(filter, data), attributes);
+                        }
+                        sr.setDereferenceAliasesPolicy(dereferencesAliasesPolicy);
+                    } else if (dataSources != null) {
+                        sr.setFilter(String.format(filter, data));
+                        sr.setName(String.format(baseDN, data));
+                    }
+
+                    final RecursiveFutureResult<SearchResultEntry, BindResult> future =
+                            new RecursiveFutureResult<SearchResultEntry, BindResult>(
+                                    new BindUpdateStatsResultHandler(startTime)) {
+                                @Override
+                                protected FutureResult<? extends BindResult> chainResult(
+                                        final SearchResultEntry innerResult,
+                                        final ResultHandler<? super BindResult> resultHandler)
+                                        throws ErrorResultException {
+                                    searchWaitRecentTime.getAndAdd(System.nanoTime() - startTime);
+                                    if (data == null) {
+                                        data = new Object[1];
+                                    }
+                                    data[data.length - 1] = innerResult.getName().toString();
+                                    return performBind(connection, data, resultHandler);
+                                }
+                            };
+                    connection.searchSingleEntryAsync(sr, future);
+                    return future;
+                } else {
+                    return performBind(connection, data,
+                            new BindUpdateStatsResultHandler(startTime));
+                }
+            }
+
+            private FutureResult<BindResult> performBind(final Connection connection,
+                    final Object[] data, final ResultHandler<? super BindResult> handler) {
+                final boolean useInvalidPassword;
+
+                // Avoid rng if possible.
+                switch (invalidCredPercent) {
+                case 0:
+                    useInvalidPassword = false;
+                    break;
+                case 100:
+                    useInvalidPassword = true;
+                    break;
+                default:
+                    final Random r = rng.get();
+                    final int p = r.nextInt(100);
+                    useInvalidPassword = (p < invalidCredPercent);
+                    break;
+                }
+
+                if (bindRequest instanceof SimpleBindRequest) {
+                    final SimpleBindRequest o = (SimpleBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfSimpleBindRequest(o);
+                    }
+
+                    final SimpleBindRequest sbr = (SimpleBindRequest) br;
+                    if (data != null && o.getName() != null) {
+                        sbr.setName(String.format(o.getName(), data));
+                    }
+                    if (useInvalidPassword) {
+                        sbr.setPassword(invalidPassword);
+                    } else {
+                        sbr.setPassword(o.getPassword());
+                    }
+                } else if (bindRequest instanceof DigestMD5SASLBindRequest) {
+                    final DigestMD5SASLBindRequest o = (DigestMD5SASLBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfDigestMD5SASLBindRequest(o);
+                    }
+
+                    final DigestMD5SASLBindRequest sbr = (DigestMD5SASLBindRequest) br;
+                    if (data != null) {
+                        if (o.getAuthenticationID() != null) {
+                            sbr.setAuthenticationID(String.format(o.getAuthenticationID(), data));
+                        }
+                        if (o.getAuthorizationID() != null) {
+                            sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
+                        }
+                    }
+                    if (useInvalidPassword) {
+                        sbr.setPassword(invalidPassword);
+                    } else {
+                        sbr.setPassword(o.getPassword());
+                    }
+                } else if (bindRequest instanceof CRAMMD5SASLBindRequest) {
+                    final CRAMMD5SASLBindRequest o = (CRAMMD5SASLBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfCRAMMD5SASLBindRequest(o);
+                    }
+
+                    final CRAMMD5SASLBindRequest sbr = (CRAMMD5SASLBindRequest) br;
+                    if (data != null && o.getAuthenticationID() != null) {
+                        sbr.setAuthenticationID(String.format(o.getAuthenticationID(), data));
+                    }
+                    if (useInvalidPassword) {
+                        sbr.setPassword(invalidPassword);
+                    } else {
+                        sbr.setPassword(o.getPassword());
+                    }
+                } else if (bindRequest instanceof GSSAPISASLBindRequest) {
+                    final GSSAPISASLBindRequest o = (GSSAPISASLBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfGSSAPISASLBindRequest(o);
+                    }
+
+                    final GSSAPISASLBindRequest sbr = (GSSAPISASLBindRequest) br;
+                    if (data != null) {
+                        if (o.getAuthenticationID() != null) {
+                            sbr.setAuthenticationID(String.format(o.getAuthenticationID(), data));
+                        }
+                        if (o.getAuthorizationID() != null) {
+                            sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
+                        }
+                    }
+                    if (useInvalidPassword) {
+                        sbr.setPassword(invalidPassword);
+                    } else {
+                        sbr.setPassword(o.getPassword());
+                    }
+                } else if (bindRequest instanceof ExternalSASLBindRequest) {
+                    final ExternalSASLBindRequest o = (ExternalSASLBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfExternalSASLBindRequest(o);
+                    }
+
+                    final ExternalSASLBindRequest sbr = (ExternalSASLBindRequest) br;
+                    if (data != null && o.getAuthorizationID() != null) {
+                        sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
+                    }
+                } else if (bindRequest instanceof PlainSASLBindRequest) {
+                    final PlainSASLBindRequest o = (PlainSASLBindRequest) bindRequest;
+                    if (br == null) {
+                        br = Requests.copyOfPlainSASLBindRequest(o);
+                    }
+
+                    final PlainSASLBindRequest sbr = (PlainSASLBindRequest) br;
+                    if (data != null) {
+                        if (o.getAuthenticationID() != null) {
+                            sbr.setAuthenticationID(String.format(o.getAuthenticationID(), data));
+                        }
+                        if (o.getAuthorizationID() != null) {
+                            sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
+                        }
+                    }
+                    if (useInvalidPassword) {
+                        sbr.setPassword(invalidPassword);
+                    } else {
+                        sbr.setPassword(o.getPassword());
+                    }
+                }
+
+                return connection.bindAsync(br, null, handler);
+            }
+        }
+
+        private final AtomicLong searchWaitRecentTime = new AtomicLong();
+        private final AtomicInteger invalidCredRecentCount = new AtomicInteger();
+        private String filter;
+        private String baseDN;
+        private SearchScope scope;
+        private DereferenceAliasesPolicy dereferencesAliasesPolicy;
+        private String[] attributes;
+        private BindRequest bindRequest;
+        private int invalidCredPercent;
+
+        private BindPerformanceRunner(final ArgumentParser argParser, final ConsoleApplication app)
+                throws ArgumentException {
+            super(argParser, app, true, true, true);
+        }
 
         @Override
-        protected Random initialValue()
-        {
-          return new Random();
+        WorkerThread newWorkerThread(final Connection connection,
+                final ConnectionFactory connectionFactory) {
+            return new BindWorkerThread(connection, connectionFactory);
         }
 
-      };
-
-
-
-      private BindWorkerThread(final Connection connection,
-          final ConnectionFactory connectionFactory)
-      {
-        super(connection, connectionFactory);
-      }
-
-
-
-      @Override
-      public FutureResult<?> performOperation(final Connection connection,
-          final DataSource[] dataSources, final long startTime)
-      {
-        if (dataSources != null)
-        {
-          data = DataSource.generateData(dataSources, data);
-          if (data.length == dataSources.length)
-          {
-            final Object[] newData = new Object[data.length + 1];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-          }
+        @Override
+        StatsThread newStatsThread() {
+            return new BindStatsThread(filter != null && baseDN != null);
         }
-        if (filter != null && baseDN != null)
-        {
-          if (sr == null)
-          {
-            if (dataSources == null)
-            {
-              sr = Requests.newSearchRequest(baseDN, scope, filter, attributes);
-            }
-            else
-            {
-              sr = Requests.newSearchRequest(String.format(baseDN, data),
-                  scope, String.format(filter, data), attributes);
-            }
-            sr.setDereferenceAliasesPolicy(dereferencesAliasesPolicy);
-          }
-          else if (dataSources != null)
-          {
-            sr.setFilter(String.format(filter, data));
-            sr.setName(String.format(baseDN, data));
-          }
-
-          final RecursiveFutureResult<SearchResultEntry, BindResult> future =
-              new RecursiveFutureResult<SearchResultEntry, BindResult>(
-              new BindUpdateStatsResultHandler(startTime))
-          {
-            @Override
-            protected FutureResult<? extends BindResult> chainResult(
-                final SearchResultEntry innerResult,
-                final ResultHandler<? super BindResult> resultHandler)
-                throws ErrorResultException
-            {
-              searchWaitRecentTime.getAndAdd(System.nanoTime() - startTime);
-              if (data == null)
-              {
-                data = new Object[1];
-              }
-              data[data.length - 1] = innerResult.getName().toString();
-              return performBind(connection, data, resultHandler);
-            }
-          };
-          connection.searchSingleEntryAsync(sr, future);
-          return future;
-        }
-        else
-        {
-          return performBind(connection, data,
-              new BindUpdateStatsResultHandler(startTime));
-        }
-      }
-
-
-
-      private FutureResult<BindResult> performBind(final Connection connection,
-          final Object[] data, final ResultHandler<? super BindResult> handler)
-      {
-        final boolean useInvalidPassword;
-
-        // Avoid rng if possible.
-        switch (invalidCredPercent)
-        {
-        case 0:
-          useInvalidPassword = false;
-          break;
-        case 100:
-          useInvalidPassword = true;
-          break;
-        default:
-          final Random r = rng.get();
-          final int p = r.nextInt(100);
-          useInvalidPassword = (p < invalidCredPercent);
-          break;
-        }
-
-        if (bindRequest instanceof SimpleBindRequest)
-        {
-          final SimpleBindRequest o = (SimpleBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfSimpleBindRequest(o);
-          }
-
-          final SimpleBindRequest sbr = (SimpleBindRequest) br;
-          if (data != null && o.getName() != null)
-          {
-            sbr.setName(String.format(o.getName(), data));
-          }
-          if (useInvalidPassword)
-          {
-            sbr.setPassword(invalidPassword);
-          }
-          else
-          {
-            sbr.setPassword(o.getPassword());
-          }
-        }
-        else if (bindRequest instanceof DigestMD5SASLBindRequest)
-        {
-          final DigestMD5SASLBindRequest o = (DigestMD5SASLBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfDigestMD5SASLBindRequest(o);
-          }
-
-          final DigestMD5SASLBindRequest sbr = (DigestMD5SASLBindRequest) br;
-          if (data != null)
-          {
-            if (o.getAuthenticationID() != null)
-            {
-              sbr.setAuthenticationID(String.format(o.getAuthenticationID(),
-                  data));
-            }
-            if (o.getAuthorizationID() != null)
-            {
-              sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
-            }
-          }
-          if (useInvalidPassword)
-          {
-            sbr.setPassword(invalidPassword);
-          }
-          else
-          {
-            sbr.setPassword(o.getPassword());
-          }
-        }
-        else if (bindRequest instanceof CRAMMD5SASLBindRequest)
-        {
-          final CRAMMD5SASLBindRequest o = (CRAMMD5SASLBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfCRAMMD5SASLBindRequest(o);
-          }
-
-          final CRAMMD5SASLBindRequest sbr = (CRAMMD5SASLBindRequest) br;
-          if (data != null && o.getAuthenticationID() != null)
-          {
-            sbr.setAuthenticationID(String.format(o.getAuthenticationID(), data));
-          }
-          if (useInvalidPassword)
-          {
-            sbr.setPassword(invalidPassword);
-          }
-          else
-          {
-            sbr.setPassword(o.getPassword());
-          }
-        }
-        else if (bindRequest instanceof GSSAPISASLBindRequest)
-        {
-          final GSSAPISASLBindRequest o = (GSSAPISASLBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfGSSAPISASLBindRequest(o);
-          }
-
-          final GSSAPISASLBindRequest sbr = (GSSAPISASLBindRequest) br;
-          if (data != null)
-          {
-            if (o.getAuthenticationID() != null)
-            {
-              sbr.setAuthenticationID(String.format(o.getAuthenticationID(),
-                  data));
-            }
-            if (o.getAuthorizationID() != null)
-            {
-              sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
-            }
-          }
-          if (useInvalidPassword)
-          {
-            sbr.setPassword(invalidPassword);
-          }
-          else
-          {
-            sbr.setPassword(o.getPassword());
-          }
-        }
-        else if (bindRequest instanceof ExternalSASLBindRequest)
-        {
-          final ExternalSASLBindRequest o = (ExternalSASLBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfExternalSASLBindRequest(o);
-          }
-
-          final ExternalSASLBindRequest sbr = (ExternalSASLBindRequest) br;
-          if (data != null && o.getAuthorizationID() != null)
-          {
-            sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
-          }
-        }
-        else if (bindRequest instanceof PlainSASLBindRequest)
-        {
-          final PlainSASLBindRequest o = (PlainSASLBindRequest) bindRequest;
-          if (br == null)
-          {
-            br = Requests.copyOfPlainSASLBindRequest(o);
-          }
-
-          final PlainSASLBindRequest sbr = (PlainSASLBindRequest) br;
-          if (data != null)
-          {
-            if (o.getAuthenticationID() != null)
-            {
-              sbr.setAuthenticationID(String.format(o.getAuthenticationID(),
-                  data));
-            }
-            if (o.getAuthorizationID() != null)
-            {
-              sbr.setAuthorizationID(String.format(o.getAuthorizationID(), data));
-            }
-          }
-          if (useInvalidPassword)
-          {
-            sbr.setPassword(invalidPassword);
-          }
-          else
-          {
-            sbr.setPassword(o.getPassword());
-          }
-        }
-
-        return connection.bindAsync(br, null, handler);
-      }
     }
 
+    /**
+     * The main method for AuthRate tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-
-    private final AtomicLong searchWaitRecentTime = new AtomicLong();
-    private final AtomicInteger invalidCredRecentCount = new AtomicInteger();
-    private String filter;
-    private String baseDN;
-    private SearchScope scope;
-    private DereferenceAliasesPolicy dereferencesAliasesPolicy;
-    private String[] attributes;
-    private BindRequest bindRequest;
-    private int invalidCredPercent;
-
-
-
-    private BindPerformanceRunner(final ArgumentParser argParser,
-        final ConsoleApplication app) throws ArgumentException
-    {
-      super(argParser, app, true, true, true);
+    public static void main(final String[] args) {
+        final int retCode = new AuthRate().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
+    private BooleanArgument verbose;
+    private BooleanArgument scriptFriendly;
 
+    private AuthRate() {
+        // Nothing to do.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    WorkerThread newWorkerThread(final Connection connection,
-        final ConnectionFactory connectionFactory)
-    {
-      return new BindWorkerThread(connection, connectionFactory);
+    public boolean isScriptFriendly() {
+        return scriptFriendly.isPresent();
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    StatsThread newStatsThread()
-    {
-      return new BindStatsThread(filter != null && baseDN != null);
-    }
-  }
-
-
-
-  /**
-   * The main method for AuthRate tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-
-  public static void main(final String[] args)
-  {
-    final int retCode = new AuthRate().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-  private BooleanArgument scriptFriendly;
-
-
-
-  private AuthRate()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isScriptFriendly()
-  {
-    return scriptFriendly.isPresent();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_AUTHRATE_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        AuthRate.class.getName(), toolDescription, false, true, 0, 0,
-        "[filter format string] [attributes ...]");
-
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-    BindPerformanceRunner runner;
-
-    StringArgument baseDN;
-    MultiChoiceArgument<SearchScope> searchScope;
-    MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
-    BooleanArgument showUsage;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-    IntegerArgument invalidCredPercent;
-
-    try
-    {
-      Utils.setDefaultPerfToolProperties();
-
-      connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
-      runner = new BindPerformanceRunner(argParser, this);
-
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-
-      baseDN = new StringArgument("baseDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_BASEDN, false, false, true,
-          INFO_BASEDN_PLACEHOLDER.get(), null, null,
-          INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get());
-      baseDN.setPropertyName(OPTION_LONG_BASEDN);
-      argParser.addArgument(baseDN);
-
-      searchScope = new MultiChoiceArgument<SearchScope>("searchScope", 's',
-          "searchScope", false, true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(),
-          SearchScope.values(), false,
-          INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
-      searchScope.setPropertyName("searchScope");
-      searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
-      argParser.addArgument(searchScope);
-
-      dereferencePolicy = new MultiChoiceArgument<DereferenceAliasesPolicy>(
-          "derefpolicy", 'a', "dereferencePolicy", false, true,
-          INFO_DEREFERENCE_POLICE_PLACEHOLDER.get(),
-          DereferenceAliasesPolicy.values(), false,
-          INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
-      dereferencePolicy.setPropertyName("dereferencePolicy");
-      dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
-      argParser.addArgument(dereferencePolicy);
-
-      invalidCredPercent = new IntegerArgument("invalidPassword", 'I',
-          "invalidPassword", false, false, true,
-          LocalizableMessage.raw("{invalidPassword}"), 0, null, true, 0, true,
-          100,
-          LocalizableMessage.raw("Percent of bind operations with simulated "
-              + "invalid password"));
-      invalidCredPercent.setPropertyName("invalidPassword");
-      argParser.addArgument(invalidCredPercent);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      scriptFriendly = new BooleanArgument("scriptFriendly", 'S',
-          "scriptFriendly", INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-      scriptFriendly.setPropertyName("scriptFriendly");
-      argParser.addArgument(scriptFriendly);
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public boolean isVerbose() {
+        return verbose.isPresent();
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_AUTHRATE_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(AuthRate.class.getName(), toolDescription, false, true, 0, 0,
+                        "[filter format string] [attributes ...]");
 
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+        BindPerformanceRunner runner;
 
-      connectionFactory = connectionFactoryProvider.getConnectionFactory();
-      runner.validate();
+        StringArgument baseDN;
+        MultiChoiceArgument<SearchScope> searchScope;
+        MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
+        BooleanArgument showUsage;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
+        IntegerArgument invalidCredPercent;
 
-      runner.bindRequest = connectionFactoryProvider.getBindRequest();
-      if (runner.bindRequest == null)
-      {
-        throw new ArgumentException(
-            LocalizableMessage
-                .raw("Authentication information must be provided to use this tool"));
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+        try {
+            Utils.setDefaultPerfToolProperties();
 
-    final List<String> attributes = new LinkedList<String>();
-    final ArrayList<String> filterAndAttributeStrings = argParser
-        .getTrailingArguments();
-    if (filterAndAttributeStrings.size() > 0)
-    {
-      // the list of trailing arguments should be structured as follow:
-      // the first trailing argument is considered the filter, the other as
-      // attributes.
-      runner.filter = filterAndAttributeStrings.remove(0);
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            runner = new BindPerformanceRunner(argParser, this);
 
-      // The rest are attributes
-      for (final String s : filterAndAttributeStrings)
-      {
-        attributes.add(s);
-      }
-    }
-    runner.attributes = attributes.toArray(new String[attributes.size()]);
-    runner.baseDN = baseDN.getValue();
-    try
-    {
-      runner.scope = searchScope.getTypedValue();
-      runner.dereferencesAliasesPolicy = dereferencePolicy.getTypedValue();
-      runner.invalidCredPercent = invalidCredPercent.getIntValue();
-    }
-    catch (final ArgumentException ex1)
-    {
-      println(ex1.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-    // Try it out to make sure the format string and data sources
-    // match.
-    final Object[] data = DataSource
-        .generateData(runner.getDataSources(), null);
-    try
-    {
-      if (runner.baseDN != null && runner.filter != null)
-      {
-        String.format(runner.filter, data);
-        String.format(runner.baseDN, data);
-      }
-    }
-    catch (final Exception ex1)
-    {
-      println(LocalizableMessage.raw("Error formatting filter or base DN: "
-          + ex1.toString()));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
-    return runner.run(connectionFactory);
-  }
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+
+            baseDN =
+                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, false,
+                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get());
+            baseDN.setPropertyName(OPTION_LONG_BASEDN);
+            argParser.addArgument(baseDN);
+
+            searchScope =
+                    new MultiChoiceArgument<SearchScope>("searchScope", 's', "searchScope", false,
+                            true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(), SearchScope.values(), false,
+                            INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
+            searchScope.setPropertyName("searchScope");
+            searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
+            argParser.addArgument(searchScope);
+
+            dereferencePolicy =
+                    new MultiChoiceArgument<DereferenceAliasesPolicy>("derefpolicy", 'a',
+                            "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER
+                                    .get(), DereferenceAliasesPolicy.values(), false,
+                            INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
+            dereferencePolicy.setPropertyName("dereferencePolicy");
+            dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
+            argParser.addArgument(dereferencePolicy);
+
+            invalidCredPercent =
+                    new IntegerArgument("invalidPassword", 'I', "invalidPassword", false, false,
+                            true, LocalizableMessage.raw("{invalidPassword}"), 0, null, true, 0,
+                            true, 100, LocalizableMessage
+                                    .raw("Percent of bind operations with simulated "
+                                            + "invalid password"));
+            invalidCredPercent.setPropertyName("invalidPassword");
+            argParser.addArgument(invalidCredPercent);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            scriptFriendly =
+                    new BooleanArgument("scriptFriendly", 'S', "scriptFriendly",
+                            INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
+            scriptFriendly.setPropertyName("scriptFriendly");
+            argParser.addArgument(scriptFriendly);
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getConnectionFactory();
+            runner.validate();
+
+            runner.bindRequest = connectionFactoryProvider.getBindRequest();
+            if (runner.bindRequest == null) {
+                throw new ArgumentException(LocalizableMessage
+                        .raw("Authentication information must be provided to use this tool"));
+            }
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        final List<String> attributes = new LinkedList<String>();
+        final ArrayList<String> filterAndAttributeStrings = argParser.getTrailingArguments();
+        if (filterAndAttributeStrings.size() > 0) {
+            // the list of trailing arguments should be structured as follow:
+            // the first trailing argument is considered the filter, the other
+            // as
+            // attributes.
+            runner.filter = filterAndAttributeStrings.remove(0);
+
+            // The rest are attributes
+            for (final String s : filterAndAttributeStrings) {
+                attributes.add(s);
+            }
+        }
+        runner.attributes = attributes.toArray(new String[attributes.size()]);
+        runner.baseDN = baseDN.getValue();
+        try {
+            runner.scope = searchScope.getTypedValue();
+            runner.dereferencesAliasesPolicy = dereferencePolicy.getTypedValue();
+            runner.invalidCredPercent = invalidCredPercent.getIntValue();
+        } catch (final ArgumentException ex1) {
+            println(ex1.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Try it out to make sure the format string and data sources
+        // match.
+        final Object[] data = DataSource.generateData(runner.getDataSources(), null);
+        try {
+            if (runner.baseDN != null && runner.filter != null) {
+                String.format(runner.filter, data);
+                String.format(runner.baseDN, data);
+            }
+        } catch (final Exception ex1) {
+            println(LocalizableMessage.raw("Error formatting filter or base DN: " + ex1.toString()));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        return runner.run(connectionFactory);
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java
index 9c9f336..b320b42 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthenticatedConnectionFactory.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,15 +27,19 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
 
-import com.forgerock.opendj.util.*;
-
-
+import com.forgerock.opendj.util.ConnectionDecorator;
+import com.forgerock.opendj.util.FutureResultTransformer;
+import com.forgerock.opendj.util.RecursiveFutureResult;
+import com.forgerock.opendj.util.Validator;
 
 /**
  * An authenticated connection factory can be used to create pre-authenticated
@@ -58,345 +61,274 @@
  * the connection attempt will fail and an {@code ErrorResultException} will be
  * thrown.
  */
-final class AuthenticatedConnectionFactory implements ConnectionFactory
-{
+final class AuthenticatedConnectionFactory implements ConnectionFactory {
 
-  /**
-   * An authenticated connection supports all operations except Bind operations.
-   */
-  static final class AuthenticatedConnection extends ConnectionDecorator
-  {
+    /**
+     * An authenticated connection supports all operations except Bind
+     * operations.
+     */
+    static final class AuthenticatedConnection extends ConnectionDecorator {
+
+        private final BindRequest request;
+
+        private volatile BindResult result;
+
+        private AuthenticatedConnection(final Connection connection, final BindRequest request,
+                final BindResult result) {
+            super(connection);
+            this.request = request;
+            this.result = result;
+        }
+
+        /**
+         * Bind operations are not supported by pre-authenticated connections.
+         * This method will always throw {@code UnsupportedOperationException}.
+         */
+
+        /**
+         * {@inheritDoc}
+         */
+        public BindResult bind(BindRequest request) throws ErrorResultException,
+                InterruptedException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public BindResult bind(String name, char[] password) throws ErrorResultException,
+                InterruptedException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public FutureResult<BindResult> bindAsync(BindRequest request,
+                IntermediateResponseHandler intermediateResponseHandler,
+                ResultHandler<? super BindResult> resultHandler) {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * Returns an unmodifiable view of the Bind result which was returned
+         * from the server after authentication.
+         *
+         * @return The Bind result which was returned from the server after
+         *         authentication.
+         */
+        BindResult getAuthenticatedBindResult() {
+            return result;
+        }
+
+        /**
+         * Re-authenticates to the Directory Server using the bind request
+         * associated with this connection. If re-authentication fails for some
+         * reason then this connection will be automatically closed.
+         *
+         * @param handler
+         *            A result handler which can be used to asynchronously
+         *            process the operation result when it is received, may be
+         *            {@code null}.
+         * @return A future representing the result of the operation.
+         * @throws UnsupportedOperationException
+         *             If this connection does not support rebind operations.
+         * @throws IllegalStateException
+         *             If this connection has already been closed, i.e. if
+         *             {@code isClosed() == true}.
+         */
+        FutureResult<BindResult> rebindAsync(final ResultHandler<? super BindResult> handler) {
+            if (request == null) {
+                throw new UnsupportedOperationException();
+            }
+
+            // Wrap the client handler so that we can update the connection
+            // state.
+            final ResultHandler<? super BindResult> clientHandler = handler;
+
+            final ResultHandler<BindResult> handlerWrapper = new ResultHandler<BindResult>() {
+
+                public void handleErrorResult(final ErrorResultException error) {
+                    // This connection is now unauthenticated so prevent
+                    // further use.
+                    connection.close();
+
+                    if (clientHandler != null) {
+                        clientHandler.handleErrorResult(error);
+                    }
+                }
+
+                public void handleResult(final BindResult result) {
+                    // Save the result.
+                    AuthenticatedConnection.this.result = result;
+
+                    if (clientHandler != null) {
+                        clientHandler.handleResult(result);
+                    }
+                }
+
+            };
+
+            return connection.bindAsync(request, null, handlerWrapper);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append("AuthenticatedConnection(");
+            builder.append(connection);
+            builder.append(')');
+            return builder.toString();
+        }
+
+    }
+
+    private static final class FutureResultImpl {
+        private final FutureResultTransformer<BindResult, Connection> futureBindResult;
+        private final RecursiveFutureResult<Connection, BindResult> futureConnectionResult;
+        private final BindRequest bindRequest;
+        private Connection connection;
+
+        private FutureResultImpl(final BindRequest request,
+                final ResultHandler<? super Connection> handler) {
+            this.bindRequest = request;
+            this.futureBindResult = new FutureResultTransformer<BindResult, Connection>(handler) {
+
+                @Override
+                protected ErrorResultException transformErrorResult(
+                        final ErrorResultException errorResult) {
+                    // Ensure that the connection is closed.
+                    if (connection != null) {
+                        connection.close();
+                        connection = null;
+                    }
+                    return errorResult;
+                }
+
+                @Override
+                protected AuthenticatedConnection transformResult(final BindResult result)
+                        throws ErrorResultException {
+                    // FIXME: should make the result unmodifiable.
+                    return new AuthenticatedConnection(connection, bindRequest, result);
+                }
+
+            };
+            this.futureConnectionResult =
+                    new RecursiveFutureResult<Connection, BindResult>(futureBindResult) {
+
+                        @Override
+                        protected FutureResult<? extends BindResult> chainResult(
+                                final Connection innerResult,
+                                final ResultHandler<? super BindResult> handler)
+                                throws ErrorResultException {
+                            connection = innerResult;
+                            return connection.bindAsync(bindRequest, null, handler);
+                        }
+                    };
+            futureBindResult.setFutureResult(futureConnectionResult);
+        }
+
+    }
 
     private final BindRequest request;
-
-    private volatile BindResult result;
-
-
-
-    private AuthenticatedConnection(final Connection connection,
-        final BindRequest request, final BindResult result)
-    {
-      super(connection);
-      this.request = request;
-      this.result = result;
-    }
-
-
+    private final ConnectionFactory parentFactory;
+    private boolean allowRebinds = false;
 
     /**
-     * Bind operations are not supported by pre-authenticated connections. This
-     * method will always throw {@code UnsupportedOperationException}.
-     */
-
-    /**
-     * {@inheritDoc}
-     */
-    public BindResult bind(BindRequest request) throws ErrorResultException,
-        InterruptedException
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public BindResult bind(String name, char[] password)
-        throws ErrorResultException, InterruptedException
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public FutureResult<BindResult> bindAsync(BindRequest request,
-        IntermediateResponseHandler intermediateResponseHandler,
-        ResultHandler<? super BindResult> resultHandler)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-
-
-    /**
-     * Returns an unmodifiable view of the Bind result which was returned from
-     * the server after authentication.
+     * Creates a new authenticated connection factory which will obtain
+     * connections using the provided connection factory and immediately perform
+     * the provided Bind request.
      *
-     * @return The Bind result which was returned from the server after
-     *         authentication.
+     * @param factory
+     *            The connection factory to use for connecting to the Directory
+     *            Server.
+     * @param request
+     *            The Bind request to use for authentication.
+     * @throws NullPointerException
+     *             If {@code factory} or {@code request} was {@code null}.
      */
-    BindResult getAuthenticatedBindResult()
-    {
-      return result;
+    AuthenticatedConnectionFactory(final ConnectionFactory factory, final BindRequest request) {
+        Validator.ensureNotNull(factory, request);
+        this.parentFactory = factory;
+
+        // FIXME: should do a defensive copy.
+        this.request = request;
     }
 
-
-
-    /**
-     * Re-authenticates to the Directory Server using the bind request
-     * associated with this connection. If re-authentication fails for some
-     * reason then this connection will be automatically closed.
-     *
-     * @param handler
-     *          A result handler which can be used to asynchronously process the
-     *          operation result when it is received, may be {@code null}.
-     * @return A future representing the result of the operation.
-     * @throws UnsupportedOperationException
-     *           If this connection does not support rebind operations.
-     * @throws IllegalStateException
-     *           If this connection has already been closed, i.e. if
-     *           {@code isClosed() == true}.
-     */
-    FutureResult<BindResult> rebindAsync(
-        final ResultHandler<? super BindResult> handler)
-    {
-      if (request == null)
-      {
-        throw new UnsupportedOperationException();
-      }
-
-      // Wrap the client handler so that we can update the connection
-      // state.
-      final ResultHandler<? super BindResult> clientHandler = handler;
-
-      final ResultHandler<BindResult> handlerWrapper = new ResultHandler<BindResult>()
-      {
-
-        public void handleErrorResult(final ErrorResultException error)
-        {
-          // This connection is now unauthenticated so prevent
-          // further use.
-          connection.close();
-
-          if (clientHandler != null)
-          {
-            clientHandler.handleErrorResult(error);
-          }
-        }
-
-
-
-        public void handleResult(final BindResult result)
-        {
-          // Save the result.
-          AuthenticatedConnection.this.result = result;
-
-          if (clientHandler != null)
-          {
-            clientHandler.handleResult(result);
-          }
-        }
-
-      };
-
-      return connection.bindAsync(request, null, handlerWrapper);
-    }
-
-
-
     /**
      * {@inheritDoc}
      */
-    public String toString()
-    {
-      StringBuilder builder = new StringBuilder();
-      builder.append("AuthenticatedConnection(");
-      builder.append(connection);
-      builder.append(')');
-      return builder.toString();
-    }
-
-  }
-
-
-
-  private static final class FutureResultImpl
-  {
-    private final FutureResultTransformer<BindResult, Connection> futureBindResult;
-    private final RecursiveFutureResult<Connection, BindResult> futureConnectionResult;
-    private final BindRequest bindRequest;
-    private Connection connection;
-
-
-
-    private FutureResultImpl(final BindRequest request,
-        final ResultHandler<? super Connection> handler)
-    {
-      this.bindRequest = request;
-      this.futureBindResult = new FutureResultTransformer<BindResult, Connection>(
-          handler)
-      {
-
-        @Override
-        protected ErrorResultException transformErrorResult(
-            final ErrorResultException errorResult)
-        {
-          // Ensure that the connection is closed.
-          if (connection != null)
-          {
-            connection.close();
-            connection = null;
-          }
-          return errorResult;
+    public Connection getConnection() throws ErrorResultException, InterruptedException {
+        final Connection connection = parentFactory.getConnection();
+        BindResult bindResult = null;
+        try {
+            bindResult = connection.bind(request);
+        } finally {
+            if (bindResult == null) {
+                connection.close();
+            }
         }
-
-
-
-        @Override
-        protected AuthenticatedConnection transformResult(
-            final BindResult result) throws ErrorResultException
-        {
-          // FIXME: should make the result unmodifiable.
-          return new AuthenticatedConnection(connection, bindRequest, result);
-        }
-
-      };
-      this.futureConnectionResult = new RecursiveFutureResult<Connection, BindResult>(
-          futureBindResult)
-      {
-
-        @Override
-        protected FutureResult<? extends BindResult> chainResult(
-            final Connection innerResult,
-            final ResultHandler<? super BindResult> handler)
-            throws ErrorResultException
-        {
-          connection = innerResult;
-          return connection.bindAsync(bindRequest, null, handler);
-        }
-      };
-      futureBindResult.setFutureResult(futureConnectionResult);
+        // If the bind didn't succeed then an exception will have been thrown
+        // and
+        // this line will not be reached.
+        return new AuthenticatedConnection(connection, request, bindResult);
     }
 
-  }
-
-
-
-  private final BindRequest request;
-  private final ConnectionFactory parentFactory;
-  private boolean allowRebinds = false;
-
-
-
-  /**
-   * Creates a new authenticated connection factory which will obtain
-   * connections using the provided connection factory and immediately perform
-   * the provided Bind request.
-   *
-   * @param factory
-   *          The connection factory to use for connecting to the Directory
-   *          Server.
-   * @param request
-   *          The Bind request to use for authentication.
-   * @throws NullPointerException
-   *           If {@code factory} or {@code request} was {@code null}.
-   */
-  AuthenticatedConnectionFactory(final ConnectionFactory factory,
-      final BindRequest request)
-  {
-    Validator.ensureNotNull(factory, request);
-    this.parentFactory = factory;
-
-    // FIXME: should do a defensive copy.
-    this.request = request;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public Connection getConnection() throws ErrorResultException,
-      InterruptedException
-  {
-    final Connection connection = parentFactory.getConnection();
-    BindResult bindResult = null;
-    try
-    {
-      bindResult = connection.bind(request);
+    /**
+     * {@inheritDoc}
+     */
+    public FutureResult<Connection> getConnectionAsync(
+            final ResultHandler<? super Connection> handler) {
+        final FutureResultImpl future = new FutureResultImpl(request, handler);
+        future.futureConnectionResult.setFutureResult(parentFactory
+                .getConnectionAsync(future.futureConnectionResult));
+        return future.futureBindResult;
     }
-    finally
-    {
-      if (bindResult == null)
-      {
-        connection.close();
-      }
+
+    /**
+     * Indicates whether or not rebind requests are to be supported by
+     * connections created by this authenticated connection factory.
+     * <p>
+     * Rebind requests are invoked using the connection's {@code rebind} method
+     * which will throw an {@code UnsupportedOperationException} if rebinds are
+     * not supported (the default).
+     *
+     * @return allowRebinds {@code true} if the {@code rebind} operation is to
+     *         be supported, otherwise {@code false}.
+     */
+    boolean isRebindAllowed() {
+        return allowRebinds;
     }
-    // If the bind didn't succeed then an exception will have been thrown and
-    // this line will not be reached.
-    return new AuthenticatedConnection(connection, request, bindResult);
-  }
 
+    /**
+     * Specifies whether or not rebind requests are to be supported by
+     * connections created by this authenticated connection factory.
+     * <p>
+     * Rebind requests are invoked using the connection's {@code rebind} method
+     * which will throw an {@code UnsupportedOperationException} if rebinds are
+     * not supported (the default).
+     *
+     * @param allowRebinds
+     *            {@code true} if the {@code rebind} operation is to be
+     *            supported, otherwise {@code false}.
+     * @return A reference to this connection factory.
+     */
+    AuthenticatedConnectionFactory setRebindAllowed(final boolean allowRebinds) {
+        this.allowRebinds = allowRebinds;
+        return this;
+    }
 
-
-  /**
-   * {@inheritDoc}
-   */
-  public FutureResult<Connection> getConnectionAsync(
-      final ResultHandler<? super Connection> handler)
-  {
-    final FutureResultImpl future = new FutureResultImpl(request, handler);
-    future.futureConnectionResult.setFutureResult(parentFactory
-        .getConnectionAsync(future.futureConnectionResult));
-    return future.futureBindResult;
-  }
-
-
-
-  /**
-   * Indicates whether or not rebind requests are to be supported by connections
-   * created by this authenticated connection factory.
-   * <p>
-   * Rebind requests are invoked using the connection's {@code rebind} method
-   * which will throw an {@code UnsupportedOperationException} if rebinds are
-   * not supported (the default).
-   *
-   * @return allowRebinds {@code true} if the {@code rebind} operation is to be
-   *         supported, otherwise {@code false}.
-   */
-  boolean isRebindAllowed()
-  {
-    return allowRebinds;
-  }
-
-
-
-  /**
-   * Specifies whether or not rebind requests are to be supported by connections
-   * created by this authenticated connection factory.
-   * <p>
-   * Rebind requests are invoked using the connection's {@code rebind} method
-   * which will throw an {@code UnsupportedOperationException} if rebinds are
-   * not supported (the default).
-   *
-   * @param allowRebinds
-   *          {@code true} if the {@code rebind} operation is to be supported,
-   *          otherwise {@code false}.
-   * @return A reference to this connection factory.
-   */
-  AuthenticatedConnectionFactory setRebindAllowed(
-      final boolean allowRebinds)
-  {
-    this.allowRebinds = allowRebinds;
-    return this;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("AuthenticatedConnectionFactory(");
-    builder.append(String.valueOf(parentFactory));
-    builder.append(')');
-    return builder.toString();
-  }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AuthenticatedConnectionFactory(");
+        builder.append(String.valueOf(parentFactory));
+        builder.append(')');
+        return builder.toString();
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/BooleanArgument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/BooleanArgument.java
index 9c9756c..eee0a46 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/BooleanArgument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/BooleanArgument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,15 +25,11 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_BOOLEANARG_NO_VALUE_ALLOWED;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines an argument type that will be used to represent Boolean
  * values. These arguments will never take values from the command line but and
@@ -42,85 +37,74 @@
  * considered true, and if not then it will be considered false. As such, the
  * default value will always be "false".
  */
-final class BooleanArgument extends Argument
-{
-  /**
-   * Creates a new Boolean argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public BooleanArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, false, false, false, null,
-        String.valueOf(false), null, description);
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  final public void addValue(final String valueString)
-  {
-    if (valueString != null)
-    {
-      clearValues();
-      super.addValue(valueString);
-      super.setPresent(Boolean.valueOf(valueString));
+final class BooleanArgument extends Argument {
+    /**
+     * Creates a new Boolean argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public BooleanArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, false, false, false, null, String
+                .valueOf(false), null, description);
     }
-  }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    final public void addValue(final String valueString) {
+        if (valueString != null) {
+            clearValues();
+            super.addValue(valueString);
+            super.setPresent(Boolean.valueOf(valueString));
+        }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    final public void setPresent(final boolean isPresent) {
+        addValue(String.valueOf(isPresent));
+    }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  final public void setPresent(final boolean isPresent)
-  {
-    addValue(String.valueOf(isPresent));
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    @Override
+    public boolean valueIsAcceptable(final String valueString,
+            final LocalizableMessageBuilder invalidReason) {
+        // This argument type should never have a value, so any value
+        // provided will
+        // be unacceptable.
 
+        invalidReason.append(ERR_BOOLEANARG_NO_VALUE_ALLOWED.get(getName()));
 
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  @Override
-  public boolean valueIsAcceptable(final String valueString,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    // This argument type should never have a value, so any value
-    // provided will
-    // be unacceptable.
-
-    invalidReason.append(ERR_BOOLEANARG_NO_VALUE_ALLOWED.get(getName()));
-
-    return false;
-  }
+        return false;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/CLIException.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/CLIException.java
index be6e81e..ab2b4dd 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/CLIException.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/CLIException.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,77 +25,60 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_CONSOLE_INPUT_ERROR;
 
 import org.forgerock.i18n.LocalizableException;
 import org.forgerock.i18n.LocalizableMessage;
 
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
-
-
-
 /**
  * Thrown to indicate that a problem occurred when interacting with the client.
  * For example, if input provided by the client was invalid.
  */
 @SuppressWarnings("serial")
-final class CLIException extends Exception implements LocalizableException
-{
+final class CLIException extends Exception implements LocalizableException {
 
-  /**
-   * Adapts any exception that may have occurred whilst reading input from the
-   * console.
-   *
-   * @param cause
-   *          The exception that occurred whilst reading input from the console.
-   * @return Returns a new CLI exception describing a problem that occurred
-   *         whilst reading input from the console.
-   */
-  static CLIException adaptInputException(final Throwable cause)
-  {
-    return new CLIException(ERR_CONSOLE_INPUT_ERROR.get(cause
-        .getMessage()), cause);
-  }
+    /**
+     * Adapts any exception that may have occurred whilst reading input from the
+     * console.
+     *
+     * @param cause
+     *            The exception that occurred whilst reading input from the
+     *            console.
+     * @return Returns a new CLI exception describing a problem that occurred
+     *         whilst reading input from the console.
+     */
+    static CLIException adaptInputException(final Throwable cause) {
+        return new CLIException(ERR_CONSOLE_INPUT_ERROR.get(cause.getMessage()), cause);
+    }
 
+    private final LocalizableMessage message;
 
+    /**
+     * Creates a new CLI exception with the provided message.
+     *
+     * @param message
+     *            The message explaining the problem that occurred.
+     */
+    CLIException(final LocalizableMessage message) {
+        super(message.toString());
+        this.message = message;
+    }
 
-  private final LocalizableMessage message;
+    /**
+     * Creates a new CLI exception with the provided message and cause.
+     *
+     * @param message
+     *            The message explaining the problem that occurred.
+     * @param cause
+     *            The cause of this exception.
+     */
+    CLIException(final LocalizableMessage message, final Throwable cause) {
+        super(message.toString(), cause);
+        this.message = message;
+    }
 
-
-
-  /**
-   * Creates a new CLI exception with the provided message.
-   *
-   * @param message
-   *          The message explaining the problem that occurred.
-   */
-  CLIException(final LocalizableMessage message)
-  {
-    super(message.toString());
-    this.message = message;
-  }
-
-
-
-  /**
-   * Creates a new CLI exception with the provided message and cause.
-   *
-   * @param message
-   *          The message explaining the problem that occurred.
-   * @param cause
-   *          The cause of this exception.
-   */
-  CLIException(final LocalizableMessage message, final Throwable cause)
-  {
-    super(message.toString(), cause);
-    this.message = message;
-  }
-
-
-
-  public LocalizableMessage getMessageObject()
-  {
-    return message;
-  }
+    public LocalizableMessage getMessageObject() {
+        return message;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java
index e0e514f..aef0aa7 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProvider.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,8 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -50,879 +47,740 @@
 import javax.net.ssl.X509TrustManager;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.KeyManagers;
+import org.forgerock.opendj.ldap.LDAPConnectionFactory;
+import org.forgerock.opendj.ldap.LDAPOptions;
+import org.forgerock.opendj.ldap.SSLContextBuilder;
+import org.forgerock.opendj.ldap.TrustManagers;
 import org.forgerock.opendj.ldap.controls.AuthorizationIdentityRequestControl;
 import org.forgerock.opendj.ldap.controls.PasswordPolicyRequestControl;
-import org.forgerock.opendj.ldap.requests.*;
-
-
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CRAMMD5SASLBindRequest;
+import org.forgerock.opendj.ldap.requests.DigestMD5SASLBindRequest;
+import org.forgerock.opendj.ldap.requests.ExternalSASLBindRequest;
+import org.forgerock.opendj.ldap.requests.GSSAPISASLBindRequest;
+import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
 
 /**
  * A connection factory designed for use with command line tools.
  */
-final class ConnectionFactoryProvider
-{
-  /**
-   * End Of Line.
-   */
-  static final String EOL = System.getProperty("line.separator");
+final class ConnectionFactoryProvider {
+    /**
+     * End Of Line.
+     */
+    static final String EOL = System.getProperty("line.separator");
 
-  /**
-   * The Logger.
-   */
-  static final Logger LOG = Logger
-      .getLogger(ConnectionFactoryProvider.class.getName());
+    /**
+     * The Logger.
+     */
+    static final Logger LOG = Logger.getLogger(ConnectionFactoryProvider.class.getName());
 
-  /**
-   * The 'hostName' global argument.
-   */
-  private StringArgument hostNameArg = null;
+    /**
+     * The 'hostName' global argument.
+     */
+    private StringArgument hostNameArg = null;
 
-  /**
-   * The 'port' global argument.
-   */
-  private IntegerArgument portArg = null;
+    /**
+     * The 'port' global argument.
+     */
+    private IntegerArgument portArg = null;
 
-  /**
-   * The 'bindDN' global argument.
-   */
-  private StringArgument bindNameArg = null;
+    /**
+     * The 'bindDN' global argument.
+     */
+    private StringArgument bindNameArg = null;
 
-  /**
-   * The 'bindPasswordFile' global argument.
-   */
-  private FileBasedArgument bindPasswordFileArg = null;
+    /**
+     * The 'bindPasswordFile' global argument.
+     */
+    private FileBasedArgument bindPasswordFileArg = null;
 
-  /**
-   * The 'bindPassword' global argument.
-   */
-  private StringArgument bindPasswordArg = null;
+    /**
+     * The 'bindPassword' global argument.
+     */
+    private StringArgument bindPasswordArg = null;
 
-  /**
-   * The 'trustAllArg' global argument.
-   */
-  private BooleanArgument trustAllArg = null;
+    /**
+     * The 'trustAllArg' global argument.
+     */
+    private BooleanArgument trustAllArg = null;
 
-  /**
-   * The 'trustStore' global argument.
-   */
-  private StringArgument trustStorePathArg = null;
+    /**
+     * The 'trustStore' global argument.
+     */
+    private StringArgument trustStorePathArg = null;
 
-  /**
-   * The 'trustStorePassword' global argument.
-   */
-  private StringArgument trustStorePasswordArg = null;
+    /**
+     * The 'trustStorePassword' global argument.
+     */
+    private StringArgument trustStorePasswordArg = null;
 
-  /**
-   * The 'trustStorePasswordFile' global argument.
-   */
-  private FileBasedArgument trustStorePasswordFileArg = null;
+    /**
+     * The 'trustStorePasswordFile' global argument.
+     */
+    private FileBasedArgument trustStorePasswordFileArg = null;
 
-  /**
-   * The 'keyStore' global argument.
-   */
-  private StringArgument keyStorePathArg = null;
+    /**
+     * The 'keyStore' global argument.
+     */
+    private StringArgument keyStorePathArg = null;
 
-  /**
-   * The 'keyStorePassword' global argument.
-   */
-  private StringArgument keyStorePasswordArg = null;
+    /**
+     * The 'keyStorePassword' global argument.
+     */
+    private StringArgument keyStorePasswordArg = null;
 
-  /**
-   * The 'keyStorePasswordFile' global argument.
-   */
-  private FileBasedArgument keyStorePasswordFileArg = null;
+    /**
+     * The 'keyStorePasswordFile' global argument.
+     */
+    private FileBasedArgument keyStorePasswordFileArg = null;
 
-  /**
-   * The 'certNicknameArg' global argument.
-   */
-  private StringArgument certNicknameArg = null;
+    /**
+     * The 'certNicknameArg' global argument.
+     */
+    private StringArgument certNicknameArg = null;
 
-  /**
-   * The 'useSSLArg' global argument.
-   */
-  private BooleanArgument useSSLArg = null;
+    /**
+     * The 'useSSLArg' global argument.
+     */
+    private BooleanArgument useSSLArg = null;
 
-  /**
-   * The 'useStartTLSArg' global argument.
-   */
-  private BooleanArgument useStartTLSArg = null;
+    /**
+     * The 'useStartTLSArg' global argument.
+     */
+    private BooleanArgument useStartTLSArg = null;
 
-  /**
-   * Argument indicating a SASL option.
-   */
-  private StringArgument saslOptionArg = null;
+    /**
+     * Argument indicating a SASL option.
+     */
+    private StringArgument saslOptionArg = null;
 
-  /**
-   * Whether to request that the server return the authorization ID in the bind
-   * response.
-   */
-  private final BooleanArgument reportAuthzIDArg;
+    /**
+     * Whether to request that the server return the authorization ID in the
+     * bind response.
+     */
+    private final BooleanArgument reportAuthzIDArg;
 
-  /**
-   * Whether to use the password policy control in the bind request.
-   */
-  private final BooleanArgument usePasswordPolicyControlArg;
+    /**
+     * Whether to use the password policy control in the bind request.
+     */
+    private final BooleanArgument usePasswordPolicyControlArg;
 
-  private int port = 389;
+    private int port = 389;
 
-  private SSLContext sslContext;
+    private SSLContext sslContext;
 
-  private ConnectionFactory connFactory;
+    private ConnectionFactory connFactory;
 
-  private ConnectionFactory authenticatedConnFactory;
+    private ConnectionFactory authenticatedConnFactory;
 
-  private BindRequest bindRequest = null;
+    private BindRequest bindRequest = null;
 
-  private final ConsoleApplication app;
+    private final ConsoleApplication app;
 
-
-
-  public ConnectionFactoryProvider(final ArgumentParser argumentParser,
-      final ConsoleApplication app) throws ArgumentException
-  {
-    this(argumentParser, app, "cn=Directory Manager", 389, false);
-  }
-
-
-
-  public ConnectionFactoryProvider(final ArgumentParser argumentParser,
-      final ConsoleApplication app, final String defaultBindDN,
-      final int defaultPort, final boolean alwaysSSL) throws ArgumentException
-  {
-    this.app = app;
-    useSSLArg = new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL,
-        OPTION_LONG_USE_SSL, INFO_DESCRIPTION_USE_SSL.get());
-    useSSLArg.setPropertyName(OPTION_LONG_USE_SSL);
-    if (!alwaysSSL)
-    {
-      argumentParser.addLdapConnectionArgument(useSSLArg);
-    }
-    else
-    {
-      // simulate that the useSSL arg has been given in the CLI
-      useSSLArg.setPresent(true);
+    public ConnectionFactoryProvider(final ArgumentParser argumentParser,
+            final ConsoleApplication app) throws ArgumentException {
+        this(argumentParser, app, "cn=Directory Manager", 389, false);
     }
 
-    useStartTLSArg = new BooleanArgument("startTLS", OPTION_SHORT_START_TLS,
-        OPTION_LONG_START_TLS, INFO_DESCRIPTION_START_TLS.get());
-    useStartTLSArg.setPropertyName(OPTION_LONG_START_TLS);
-    if (!alwaysSSL)
-    {
-      argumentParser.addLdapConnectionArgument(useStartTLSArg);
-    }
-
-    String defaultHostName;
-    try
-    {
-      defaultHostName = InetAddress.getLocalHost().getHostName();
-    }
-    catch (final Exception e)
-    {
-      defaultHostName = "Unknown (" + e + ")";
-    }
-    hostNameArg = new StringArgument("host", OPTION_SHORT_HOST,
-        OPTION_LONG_HOST, false, false, true, INFO_HOST_PLACEHOLDER.get(),
-        defaultHostName, null, INFO_DESCRIPTION_HOST.get());
-    hostNameArg.setPropertyName(OPTION_LONG_HOST);
-    argumentParser.addLdapConnectionArgument(hostNameArg);
-
-    LocalizableMessage portDescription = INFO_DESCRIPTION_PORT.get();
-    if (alwaysSSL)
-    {
-      portDescription = INFO_DESCRIPTION_ADMIN_PORT.get();
-    }
-
-    portArg = new IntegerArgument("port", OPTION_SHORT_PORT, OPTION_LONG_PORT,
-        false, false, true, INFO_PORT_PLACEHOLDER.get(), defaultPort, null,
-        portDescription);
-    portArg.setPropertyName(OPTION_LONG_PORT);
-    argumentParser.addLdapConnectionArgument(portArg);
-
-    bindNameArg = new StringArgument("bindDN", OPTION_SHORT_BINDDN,
-        OPTION_LONG_BINDDN, false, false, true, INFO_BINDDN_PLACEHOLDER.get(),
-        defaultBindDN, null, INFO_DESCRIPTION_BINDDN.get());
-    bindNameArg.setPropertyName(OPTION_LONG_BINDDN);
-    argumentParser.addLdapConnectionArgument(bindNameArg);
-
-    bindPasswordArg = new StringArgument("bindPassword", OPTION_SHORT_BINDPWD,
-        OPTION_LONG_BINDPWD, false, false, true,
-        INFO_BINDPWD_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_BINDPASSWORD.get());
-    bindPasswordArg.setPropertyName(OPTION_LONG_BINDPWD);
-    argumentParser.addLdapConnectionArgument(bindPasswordArg);
-
-    bindPasswordFileArg = new FileBasedArgument("bindPasswordFile",
-        OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_BINDPWD_FILE, false, false,
-        INFO_BINDPWD_FILE_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_BINDPASSWORDFILE.get());
-    bindPasswordFileArg.setPropertyName(OPTION_LONG_BINDPWD_FILE);
-    argumentParser.addLdapConnectionArgument(bindPasswordFileArg);
-
-    saslOptionArg = new StringArgument("sasloption", OPTION_SHORT_SASLOPTION,
-        OPTION_LONG_SASLOPTION, false, true, true, INFO_SASL_OPTION_PLACEHOLDER
-            .get(), null, null, INFO_LDAP_CONN_DESCRIPTION_SASLOPTIONS.get());
-    saslOptionArg.setPropertyName(OPTION_LONG_SASLOPTION);
-    argumentParser.addLdapConnectionArgument(saslOptionArg);
-
-    trustAllArg = new BooleanArgument("trustAll", OPTION_SHORT_TRUSTALL,
-        OPTION_LONG_TRUSTALL, INFO_DESCRIPTION_TRUSTALL.get());
-    trustAllArg.setPropertyName(OPTION_LONG_TRUSTALL);
-    argumentParser.addLdapConnectionArgument(trustAllArg);
-
-    trustStorePathArg = new StringArgument("trustStorePath",
-        OPTION_SHORT_TRUSTSTOREPATH, OPTION_LONG_TRUSTSTOREPATH, false, false,
-        true, INFO_TRUSTSTOREPATH_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TRUSTSTOREPATH.get());
-    trustStorePathArg.setPropertyName(OPTION_LONG_TRUSTSTOREPATH);
-    argumentParser.addLdapConnectionArgument(trustStorePathArg);
-
-    trustStorePasswordArg = new StringArgument("trustStorePassword",
-        OPTION_SHORT_TRUSTSTORE_PWD, OPTION_LONG_TRUSTSTORE_PWD, false, false,
-        true, INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get());
-    trustStorePasswordArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD);
-    argumentParser.addLdapConnectionArgument(trustStorePasswordArg);
-
-    trustStorePasswordFileArg = new FileBasedArgument("trustStorePasswordFile",
-        OPTION_SHORT_TRUSTSTORE_PWD_FILE, OPTION_LONG_TRUSTSTORE_PWD_FILE,
-        false, false, INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get());
-    trustStorePasswordFileArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD_FILE);
-    argumentParser.addLdapConnectionArgument(trustStorePasswordFileArg);
-
-    keyStorePathArg = new StringArgument("keyStorePath",
-        OPTION_SHORT_KEYSTOREPATH, OPTION_LONG_KEYSTOREPATH, false, false,
-        true, INFO_KEYSTOREPATH_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_KEYSTOREPATH.get());
-    keyStorePathArg.setPropertyName(OPTION_LONG_KEYSTOREPATH);
-    argumentParser.addLdapConnectionArgument(keyStorePathArg);
-
-    keyStorePasswordArg = new StringArgument("keyStorePassword",
-        OPTION_SHORT_KEYSTORE_PWD, OPTION_LONG_KEYSTORE_PWD, false, false,
-        true, INFO_KEYSTORE_PWD_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_KEYSTOREPASSWORD.get());
-    keyStorePasswordArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD);
-    argumentParser.addLdapConnectionArgument(keyStorePasswordArg);
-
-    keyStorePasswordFileArg = new FileBasedArgument("keystorePasswordFile",
-        OPTION_SHORT_KEYSTORE_PWD_FILE, OPTION_LONG_KEYSTORE_PWD_FILE, false,
-        false, INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_KEYSTOREPASSWORD_FILE.get());
-    keyStorePasswordFileArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD_FILE);
-    argumentParser.addLdapConnectionArgument(keyStorePasswordFileArg);
-
-    certNicknameArg = new StringArgument("certNickname",
-        OPTION_SHORT_CERT_NICKNAME, OPTION_LONG_CERT_NICKNAME, false, false,
-        true, INFO_NICKNAME_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_CERT_NICKNAME.get());
-    certNicknameArg.setPropertyName(OPTION_LONG_CERT_NICKNAME);
-    argumentParser.addLdapConnectionArgument(certNicknameArg);
-
-    reportAuthzIDArg = new BooleanArgument("reportauthzid", 'E',
-        OPTION_LONG_REPORT_AUTHZ_ID, INFO_DESCRIPTION_REPORT_AUTHZID.get());
-    reportAuthzIDArg.setPropertyName(OPTION_LONG_REPORT_AUTHZ_ID);
-    argumentParser.addArgument(reportAuthzIDArg);
-
-    usePasswordPolicyControlArg = new BooleanArgument("usepwpolicycontrol", null,
-        OPTION_LONG_USE_PW_POLICY_CTL, INFO_DESCRIPTION_USE_PWP_CONTROL.get());
-    usePasswordPolicyControlArg.setPropertyName(OPTION_LONG_USE_PW_POLICY_CTL);
-    argumentParser.addArgument(usePasswordPolicyControlArg);
-  }
-
-
-  public ConnectionFactory getConnectionFactory() throws ArgumentException
-  {
-    if(connFactory == null)
-    {
-      port = portArg.getIntValue();
-
-      // Couldn't have at the same time bindPassword and bindPasswordFile
-      if (bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            bindPasswordArg.getLongIdentifier(), bindPasswordFileArg
-                .getLongIdentifier());
-        throw new ArgumentException(message);
-      }
-
-      // Couldn't have at the same time trustAll and
-      // trustStore related arg
-      if (trustAllArg.isPresent() && trustStorePathArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            trustAllArg.getLongIdentifier(), trustStorePathArg
-                .getLongIdentifier());
-        throw new ArgumentException(message);
-      }
-      if (trustAllArg.isPresent() && trustStorePasswordArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            trustAllArg.getLongIdentifier(), trustStorePasswordArg
-                .getLongIdentifier());
-        throw new ArgumentException(message);
-      }
-      if (trustAllArg.isPresent() && trustStorePasswordFileArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            trustAllArg.getLongIdentifier(), trustStorePasswordFileArg
-                .getLongIdentifier());
-        throw new ArgumentException(message);
-      }
-
-      // Couldn't have at the same time trustStorePasswordArg and
-      // trustStorePasswordFileArg
-      if (trustStorePasswordArg.isPresent()
-          && trustStorePasswordFileArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            trustStorePasswordArg.getLongIdentifier(), trustStorePasswordFileArg
-                .getLongIdentifier());
-        throw new ArgumentException(message);
-      }
-
-      if (trustStorePathArg.isPresent())
-      {
-        // Check that the path exists and is readable
-        final String value = trustStorePathArg.getValue();
-        if (!canRead(trustStorePathArg.getValue()))
-        {
-          final LocalizableMessage message = ERR_CANNOT_READ_TRUSTSTORE
-              .get(value);
-          throw new ArgumentException(message);
+    public ConnectionFactoryProvider(final ArgumentParser argumentParser,
+            final ConsoleApplication app, final String defaultBindDN, final int defaultPort,
+            final boolean alwaysSSL) throws ArgumentException {
+        this.app = app;
+        useSSLArg =
+                new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL, OPTION_LONG_USE_SSL,
+                        INFO_DESCRIPTION_USE_SSL.get());
+        useSSLArg.setPropertyName(OPTION_LONG_USE_SSL);
+        if (!alwaysSSL) {
+            argumentParser.addLdapConnectionArgument(useSSLArg);
+        } else {
+            // simulate that the useSSL arg has been given in the CLI
+            useSSLArg.setPresent(true);
         }
-      }
 
-      if (keyStorePathArg.isPresent())
-      {
-        // Check that the path exists and is readable
-        final String value = keyStorePathArg.getValue();
-        if (!canRead(trustStorePathArg.getValue()))
-        {
-          final LocalizableMessage message =
-              ERR_CANNOT_READ_KEYSTORE.get(value);
-          throw new ArgumentException(message);
+        useStartTLSArg =
+                new BooleanArgument("startTLS", OPTION_SHORT_START_TLS, OPTION_LONG_START_TLS,
+                        INFO_DESCRIPTION_START_TLS.get());
+        useStartTLSArg.setPropertyName(OPTION_LONG_START_TLS);
+        if (!alwaysSSL) {
+            argumentParser.addLdapConnectionArgument(useStartTLSArg);
         }
-      }
 
-      // Couldn't have at the same time startTLSArg and
-      // useSSLArg
-      if (useStartTLSArg.isPresent() && useSSLArg.isPresent())
-      {
-        final LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get(
-            useStartTLSArg.getLongIdentifier(), useSSLArg.getLongIdentifier());
-        throw new ArgumentException(message);
-      }
+        String defaultHostName;
+        try {
+            defaultHostName = InetAddress.getLocalHost().getHostName();
+        } catch (final Exception e) {
+            defaultHostName = "Unknown (" + e + ")";
+        }
+        hostNameArg =
+                new StringArgument("host", OPTION_SHORT_HOST, OPTION_LONG_HOST, false, false, true,
+                        INFO_HOST_PLACEHOLDER.get(), defaultHostName, null, INFO_DESCRIPTION_HOST
+                                .get());
+        hostNameArg.setPropertyName(OPTION_LONG_HOST);
+        argumentParser.addLdapConnectionArgument(hostNameArg);
 
-      try
-      {
-        if (useSSLArg.isPresent() || useStartTLSArg.isPresent())
-        {
-          String clientAlias;
-          if (certNicknameArg.isPresent())
-          {
-            clientAlias = certNicknameArg.getValue();
-          }
-          else
-          {
-            clientAlias = null;
-          }
+        LocalizableMessage portDescription = INFO_DESCRIPTION_PORT.get();
+        if (alwaysSSL) {
+            portDescription = INFO_DESCRIPTION_ADMIN_PORT.get();
+        }
 
-          if (sslContext == null)
-          {
-            final TrustManager trustManager = getTrustManager();
+        portArg =
+                new IntegerArgument("port", OPTION_SHORT_PORT, OPTION_LONG_PORT, false, false,
+                        true, INFO_PORT_PLACEHOLDER.get(), defaultPort, null, portDescription);
+        portArg.setPropertyName(OPTION_LONG_PORT);
+        argumentParser.addLdapConnectionArgument(portArg);
 
-            X509KeyManager keyManager = null;
-            final X509KeyManager akm =
-                getKeyManager(keyStorePathArg.getValue());
+        bindNameArg =
+                new StringArgument("bindDN", OPTION_SHORT_BINDDN, OPTION_LONG_BINDDN, false, false,
+                        true, INFO_BINDDN_PLACEHOLDER.get(), defaultBindDN, null,
+                        INFO_DESCRIPTION_BINDDN.get());
+        bindNameArg.setPropertyName(OPTION_LONG_BINDDN);
+        argumentParser.addLdapConnectionArgument(bindNameArg);
 
-            if (akm != null && clientAlias != null)
-            {
-              keyManager = KeyManagers.useSingleCertificate(clientAlias, akm);
+        bindPasswordArg =
+                new StringArgument("bindPassword", OPTION_SHORT_BINDPWD, OPTION_LONG_BINDPWD,
+                        false, false, true, INFO_BINDPWD_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_BINDPASSWORD.get());
+        bindPasswordArg.setPropertyName(OPTION_LONG_BINDPWD);
+        argumentParser.addLdapConnectionArgument(bindPasswordArg);
+
+        bindPasswordFileArg =
+                new FileBasedArgument("bindPasswordFile", OPTION_SHORT_BINDPWD_FILE,
+                        OPTION_LONG_BINDPWD_FILE, false, false,
+                        INFO_BINDPWD_FILE_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_BINDPASSWORDFILE.get());
+        bindPasswordFileArg.setPropertyName(OPTION_LONG_BINDPWD_FILE);
+        argumentParser.addLdapConnectionArgument(bindPasswordFileArg);
+
+        saslOptionArg =
+                new StringArgument("sasloption", OPTION_SHORT_SASLOPTION, OPTION_LONG_SASLOPTION,
+                        false, true, true, INFO_SASL_OPTION_PLACEHOLDER.get(), null, null,
+                        INFO_LDAP_CONN_DESCRIPTION_SASLOPTIONS.get());
+        saslOptionArg.setPropertyName(OPTION_LONG_SASLOPTION);
+        argumentParser.addLdapConnectionArgument(saslOptionArg);
+
+        trustAllArg =
+                new BooleanArgument("trustAll", OPTION_SHORT_TRUSTALL, OPTION_LONG_TRUSTALL,
+                        INFO_DESCRIPTION_TRUSTALL.get());
+        trustAllArg.setPropertyName(OPTION_LONG_TRUSTALL);
+        argumentParser.addLdapConnectionArgument(trustAllArg);
+
+        trustStorePathArg =
+                new StringArgument("trustStorePath", OPTION_SHORT_TRUSTSTOREPATH,
+                        OPTION_LONG_TRUSTSTOREPATH, false, false, true,
+                        INFO_TRUSTSTOREPATH_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_TRUSTSTOREPATH.get());
+        trustStorePathArg.setPropertyName(OPTION_LONG_TRUSTSTOREPATH);
+        argumentParser.addLdapConnectionArgument(trustStorePathArg);
+
+        trustStorePasswordArg =
+                new StringArgument("trustStorePassword", OPTION_SHORT_TRUSTSTORE_PWD,
+                        OPTION_LONG_TRUSTSTORE_PWD, false, false, true,
+                        INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get());
+        trustStorePasswordArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD);
+        argumentParser.addLdapConnectionArgument(trustStorePasswordArg);
+
+        trustStorePasswordFileArg =
+                new FileBasedArgument("trustStorePasswordFile", OPTION_SHORT_TRUSTSTORE_PWD_FILE,
+                        OPTION_LONG_TRUSTSTORE_PWD_FILE, false, false,
+                        INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get());
+        trustStorePasswordFileArg.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD_FILE);
+        argumentParser.addLdapConnectionArgument(trustStorePasswordFileArg);
+
+        keyStorePathArg =
+                new StringArgument("keyStorePath", OPTION_SHORT_KEYSTOREPATH,
+                        OPTION_LONG_KEYSTOREPATH, false, false, true, INFO_KEYSTOREPATH_PLACEHOLDER
+                                .get(), null, null, INFO_DESCRIPTION_KEYSTOREPATH.get());
+        keyStorePathArg.setPropertyName(OPTION_LONG_KEYSTOREPATH);
+        argumentParser.addLdapConnectionArgument(keyStorePathArg);
+
+        keyStorePasswordArg =
+                new StringArgument("keyStorePassword", OPTION_SHORT_KEYSTORE_PWD,
+                        OPTION_LONG_KEYSTORE_PWD, false, false, true, INFO_KEYSTORE_PWD_PLACEHOLDER
+                                .get(), null, null, INFO_DESCRIPTION_KEYSTOREPASSWORD.get());
+        keyStorePasswordArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD);
+        argumentParser.addLdapConnectionArgument(keyStorePasswordArg);
+
+        keyStorePasswordFileArg =
+                new FileBasedArgument("keystorePasswordFile", OPTION_SHORT_KEYSTORE_PWD_FILE,
+                        OPTION_LONG_KEYSTORE_PWD_FILE, false, false,
+                        INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(), null, null,
+                        INFO_DESCRIPTION_KEYSTOREPASSWORD_FILE.get());
+        keyStorePasswordFileArg.setPropertyName(OPTION_LONG_KEYSTORE_PWD_FILE);
+        argumentParser.addLdapConnectionArgument(keyStorePasswordFileArg);
+
+        certNicknameArg =
+                new StringArgument("certNickname", OPTION_SHORT_CERT_NICKNAME,
+                        OPTION_LONG_CERT_NICKNAME, false, false, true, INFO_NICKNAME_PLACEHOLDER
+                                .get(), null, null, INFO_DESCRIPTION_CERT_NICKNAME.get());
+        certNicknameArg.setPropertyName(OPTION_LONG_CERT_NICKNAME);
+        argumentParser.addLdapConnectionArgument(certNicknameArg);
+
+        reportAuthzIDArg =
+                new BooleanArgument("reportauthzid", 'E', OPTION_LONG_REPORT_AUTHZ_ID,
+                        INFO_DESCRIPTION_REPORT_AUTHZID.get());
+        reportAuthzIDArg.setPropertyName(OPTION_LONG_REPORT_AUTHZ_ID);
+        argumentParser.addArgument(reportAuthzIDArg);
+
+        usePasswordPolicyControlArg =
+                new BooleanArgument("usepwpolicycontrol", null, OPTION_LONG_USE_PW_POLICY_CTL,
+                        INFO_DESCRIPTION_USE_PWP_CONTROL.get());
+        usePasswordPolicyControlArg.setPropertyName(OPTION_LONG_USE_PW_POLICY_CTL);
+        argumentParser.addArgument(usePasswordPolicyControlArg);
+    }
+
+    public ConnectionFactory getConnectionFactory() throws ArgumentException {
+        if (connFactory == null) {
+            port = portArg.getIntValue();
+
+            // Couldn't have at the same time bindPassword and bindPasswordFile
+            if (bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(bindPasswordArg.getLongIdentifier(),
+                                bindPasswordFileArg.getLongIdentifier());
+                throw new ArgumentException(message);
             }
 
-            sslContext = new SSLContextBuilder().setTrustManager(trustManager)
-                .setKeyManager(keyManager).getSSLContext();
-          }
+            // Couldn't have at the same time trustAll and
+            // trustStore related arg
+            if (trustAllArg.isPresent() && trustStorePathArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(),
+                                trustStorePathArg.getLongIdentifier());
+                throw new ArgumentException(message);
+            }
+            if (trustAllArg.isPresent() && trustStorePasswordArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(),
+                                trustStorePasswordArg.getLongIdentifier());
+                throw new ArgumentException(message);
+            }
+            if (trustAllArg.isPresent() && trustStorePasswordFileArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(),
+                                trustStorePasswordFileArg.getLongIdentifier());
+                throw new ArgumentException(message);
+            }
+
+            // Couldn't have at the same time trustStorePasswordArg and
+            // trustStorePasswordFileArg
+            if (trustStorePasswordArg.isPresent() && trustStorePasswordFileArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(trustStorePasswordArg.getLongIdentifier(),
+                                trustStorePasswordFileArg.getLongIdentifier());
+                throw new ArgumentException(message);
+            }
+
+            if (trustStorePathArg.isPresent()) {
+                // Check that the path exists and is readable
+                final String value = trustStorePathArg.getValue();
+                if (!canRead(trustStorePathArg.getValue())) {
+                    final LocalizableMessage message = ERR_CANNOT_READ_TRUSTSTORE.get(value);
+                    throw new ArgumentException(message);
+                }
+            }
+
+            if (keyStorePathArg.isPresent()) {
+                // Check that the path exists and is readable
+                final String value = keyStorePathArg.getValue();
+                if (!canRead(trustStorePathArg.getValue())) {
+                    final LocalizableMessage message = ERR_CANNOT_READ_KEYSTORE.get(value);
+                    throw new ArgumentException(message);
+                }
+            }
+
+            // Couldn't have at the same time startTLSArg and
+            // useSSLArg
+            if (useStartTLSArg.isPresent() && useSSLArg.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_TOOL_CONFLICTING_ARGS.get(useStartTLSArg.getLongIdentifier(), useSSLArg
+                                .getLongIdentifier());
+                throw new ArgumentException(message);
+            }
+
+            try {
+                if (useSSLArg.isPresent() || useStartTLSArg.isPresent()) {
+                    String clientAlias;
+                    if (certNicknameArg.isPresent()) {
+                        clientAlias = certNicknameArg.getValue();
+                    } else {
+                        clientAlias = null;
+                    }
+
+                    if (sslContext == null) {
+                        final TrustManager trustManager = getTrustManager();
+
+                        X509KeyManager keyManager = null;
+                        final X509KeyManager akm = getKeyManager(keyStorePathArg.getValue());
+
+                        if (akm != null && clientAlias != null) {
+                            keyManager = KeyManagers.useSingleCertificate(clientAlias, akm);
+                        }
+
+                        sslContext =
+                                new SSLContextBuilder().setTrustManager(trustManager)
+                                        .setKeyManager(keyManager).getSSLContext();
+                    }
+                }
+            } catch (final Exception e) {
+                throw new ArgumentException(ERR_LDAP_CONN_CANNOT_INITIALIZE_SSL.get(e.toString()),
+                        e);
+            }
+
+            if (sslContext != null) {
+                final LDAPOptions options =
+                        new LDAPOptions().setSSLContext(sslContext).setUseStartTLS(
+                                useStartTLSArg.isPresent());
+                connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), port, options);
+            } else {
+                connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), port);
+            }
         }
-      }
-      catch (final Exception e)
-      {
-        throw new ArgumentException(ERR_LDAP_CONN_CANNOT_INITIALIZE_SSL.get(e
-            .toString()), e);
-      }
-
-      if (sslContext != null)
-      {
-        final LDAPOptions options = new LDAPOptions().setSSLContext(sslContext)
-            .setUseStartTLS(useStartTLSArg.isPresent());
-        connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), port,
-            options);
-      }
-      else
-      {
-        connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), port);
-      }
-    }
-    return connFactory;
-  }
-
-  public ConnectionFactory getAuthenticatedConnectionFactory()
-      throws ArgumentException
-  {
-    if(authenticatedConnFactory == null)
-    {
-      authenticatedConnFactory = getConnectionFactory();
-      BindRequest bindRequest = getBindRequest();
-      if(bindRequest != null)
-      {
-        authenticatedConnFactory = new AuthenticatedConnectionFactory(
-            authenticatedConnFactory, bindRequest);
-      }
-    }
-    return authenticatedConnFactory;
-  }
-
-  /**
-   * Returns <CODE>true</CODE> if we can read on the provided path and
-   * <CODE>false</CODE> otherwise.
-   *
-   * @param path
-   *          the path.
-   * @return <CODE>true</CODE> if we can read on the provided path and
-   *         <CODE>false</CODE> otherwise.
-   */
-  private boolean canRead(final String path)
-  {
-    boolean canRead;
-    final File file = new File(path);
-    canRead = file.exists() && file.canRead();
-    return canRead;
-  }
-
-
-
-  private String getAuthID(final String mech) throws ArgumentException
-  {
-    String value = null;
-    for (final String s : saslOptionArg.getValues())
-    {
-      if (s.startsWith(SASL_PROPERTY_AUTHID))
-      {
-        value = parseSASLOptionValue(s);
-        break;
-      }
-    }
-    if (value == null && bindNameArg.isPresent())
-    {
-      value = "dn: " + bindNameArg.getValue();
-    }
-    if (value == null && app.isInteractive())
-    {
-      try {
-        value = app.readInput(LocalizableMessage.raw("Authentication ID:"),
-            bindNameArg.getDefaultValue() == null ? null : "dn: "
-                + bindNameArg.getDefaultValue());
-      } catch (CLIException e) {
-        throw new ArgumentException(
-            LocalizableMessage.raw("Unable to read authentication ID"), e);
-      }
-    }
-    if (value == null)
-    {
-      final LocalizableMessage message = ERR_LDAPAUTH_SASL_AUTHID_REQUIRED
-          .get(mech);
-      throw new ArgumentException(message);
-    }
-    return value;
-  }
-
-
-
-  private String getAuthzID() throws ArgumentException
-  {
-    String value = null;
-    for (final String s : saslOptionArg.getValues())
-    {
-      if (s.startsWith(SASL_PROPERTY_AUTHZID))
-      {
-        value = parseSASLOptionValue(s);
-        break;
-      }
-    }
-    return value;
-  }
-
-
-
-  private String getBindName() throws ArgumentException
-  {
-    String value = "";
-    if (bindNameArg.isPresent())
-    {
-      value = bindNameArg.getValue();
-    }
-    else if (app.isInteractive())
-    {
-      try {
-        value = app.readInput(LocalizableMessage.raw("Bind name:"), bindNameArg
-            .getDefaultValue() == null ? value : bindNameArg.getDefaultValue());
-      } catch (CLIException e) {
-        throw new ArgumentException(
-            LocalizableMessage.raw("Unable to read bind name"), e);
-      }
+        return connFactory;
     }
 
-    return value;
-  }
-
-
-
-  public BindRequest getBindRequest() throws ArgumentException
-  {
-    if(bindRequest == null)
-    {
-      String mech = null;
-      for (final String s : saslOptionArg.getValues())
-      {
-        if (s.startsWith(SASL_PROPERTY_MECH))
-        {
-          mech = parseSASLOptionValue(s);
-          break;
+    public ConnectionFactory getAuthenticatedConnectionFactory() throws ArgumentException {
+        if (authenticatedConnFactory == null) {
+            authenticatedConnFactory = getConnectionFactory();
+            BindRequest bindRequest = getBindRequest();
+            if (bindRequest != null) {
+                authenticatedConnFactory =
+                        new AuthenticatedConnectionFactory(authenticatedConnFactory, bindRequest);
+            }
         }
-      }
+        return authenticatedConnFactory;
+    }
 
-      if (mech == null)
-      {
-        if (bindNameArg.isPresent() || bindPasswordFileArg.isPresent()
-            || bindPasswordArg.isPresent())
-        {
-          bindRequest = Requests.newSimpleBindRequest(getBindName(),
-              getPassword());
+    /**
+     * Returns <CODE>true</CODE> if we can read on the provided path and
+     * <CODE>false</CODE> otherwise.
+     *
+     * @param path
+     *            the path.
+     * @return <CODE>true</CODE> if we can read on the provided path and
+     *         <CODE>false</CODE> otherwise.
+     */
+    private boolean canRead(final String path) {
+        boolean canRead;
+        final File file = new File(path);
+        canRead = file.exists() && file.canRead();
+        return canRead;
+    }
+
+    private String getAuthID(final String mech) throws ArgumentException {
+        String value = null;
+        for (final String s : saslOptionArg.getValues()) {
+            if (s.startsWith(SASL_PROPERTY_AUTHID)) {
+                value = parseSASLOptionValue(s);
+                break;
+            }
         }
-      }
-      else if (mech.equals(DigestMD5SASLBindRequest.SASL_MECHANISM_NAME))
-      {
-        bindRequest = Requests.newDigestMD5SASLBindRequest(
-            getAuthID(DigestMD5SASLBindRequest.SASL_MECHANISM_NAME),
-            getPassword()).setAuthorizationID(getAuthzID())
-            .setRealm(getRealm());
-      }
-      else if (mech.equals(CRAMMD5SASLBindRequest.SASL_MECHANISM_NAME))
-      {
-        bindRequest = Requests.newCRAMMD5SASLBindRequest(
-            getAuthID(CRAMMD5SASLBindRequest.SASL_MECHANISM_NAME),
-            getPassword());
-      }
-      else if (mech.equals(GSSAPISASLBindRequest.SASL_MECHANISM_NAME))
-      {
-        bindRequest = Requests.newGSSAPISASLBindRequest(
-            getAuthID(GSSAPISASLBindRequest.SASL_MECHANISM_NAME),
-            getPassword()).setKDCAddress(getKDC()).setRealm(
-            getRealm()).setAuthorizationID(getAuthzID());
-      }
-      else if (mech.equals(ExternalSASLBindRequest.SASL_MECHANISM_NAME))
-      {
-        if (sslContext == null)
-        {
-          final LocalizableMessage message =
-              ERR_TOOL_SASLEXTERNAL_NEEDS_SSL_OR_TLS.get();
-          throw new ArgumentException(message);
+        if (value == null && bindNameArg.isPresent()) {
+            value = "dn: " + bindNameArg.getValue();
         }
-        if (!keyStorePathArg.isPresent() && getKeyStore() == null)
-        {
-          final LocalizableMessage message =
-              ERR_TOOL_SASLEXTERNAL_NEEDS_KEYSTORE.get();
-          throw new ArgumentException(message);
+        if (value == null && app.isInteractive()) {
+            try {
+                value =
+                        app.readInput(LocalizableMessage.raw("Authentication ID:"), bindNameArg
+                                .getDefaultValue() == null ? null : "dn: "
+                                + bindNameArg.getDefaultValue());
+            } catch (CLIException e) {
+                throw new ArgumentException(LocalizableMessage
+                        .raw("Unable to read authentication ID"), e);
+            }
         }
-        bindRequest = Requests.newExternalSASLBindRequest().setAuthorizationID(
-            getAuthzID());
-      }
-      else if (mech.equals(PlainSASLBindRequest.SASL_MECHANISM_NAME))
-      {
-        bindRequest = Requests.newPlainSASLBindRequest(
-            getAuthID(PlainSASLBindRequest.SASL_MECHANISM_NAME),
-            getPassword()).setAuthorizationID(getAuthzID());
-      }
-      else
-      {
-        throw new ArgumentException(ERR_LDAPAUTH_UNSUPPORTED_SASL_MECHANISM
-            .get(mech));
-      }
-
-      if (reportAuthzIDArg.isPresent())
-      {
-        bindRequest.addControl(AuthorizationIdentityRequestControl
-            .newControl(false));
-      }
-
-      if (usePasswordPolicyControlArg.isPresent())
-      {
-        bindRequest.addControl(PasswordPolicyRequestControl
-            .newControl(false));
-      }
-    }
-    return bindRequest;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public String toString()
-  {
-    return connFactory.toString();
-  }
-
-
-
-  private String getKDC() throws ArgumentException
-  {
-    String value = null;
-    for (final String s : saslOptionArg.getValues())
-    {
-      if (s.startsWith(SASL_PROPERTY_KDC))
-      {
-        value = parseSASLOptionValue(s);
-        break;
-      }
-    }
-    return value;
-  }
-
-
-
-  /**
-   * Retrieves a <CODE>KeyManager</CODE> object that may be used for
-   * interactions requiring access to a key manager.
-   *
-   * @param keyStoreFile
-   *          The path to the file containing the key store data.
-   * @return A set of <CODE>KeyManager</CODE> objects that may be used for
-   *         interactions requiring access to a key manager.
-   * @throws java.security.KeyStoreException
-   *           If a problem occurs while interacting with the key store.
-   */
-
-  private X509KeyManager getKeyManager(String keyStoreFile)
-      throws KeyStoreException, IOException, NoSuchAlgorithmException,
-      CertificateException
-  {
-    if (keyStoreFile == null)
-    {
-      // Lookup the file name through the JDK property.
-      keyStoreFile = getKeyStore();
+        if (value == null) {
+            final LocalizableMessage message = ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(mech);
+            throw new ArgumentException(message);
+        }
+        return value;
     }
 
-    if (keyStoreFile == null)
-    {
-      return null;
+    private String getAuthzID() throws ArgumentException {
+        String value = null;
+        for (final String s : saslOptionArg.getValues()) {
+            if (s.startsWith(SASL_PROPERTY_AUTHZID)) {
+                value = parseSASLOptionValue(s);
+                break;
+            }
+        }
+        return value;
     }
 
-    final String keyStorePass = getKeyStorePIN();
-    char[] keyStorePIN = null;
-    if (keyStorePass != null)
-    {
-      keyStorePIN = keyStorePass.toCharArray();
+    private String getBindName() throws ArgumentException {
+        String value = "";
+        if (bindNameArg.isPresent()) {
+            value = bindNameArg.getValue();
+        } else if (app.isInteractive()) {
+            try {
+                value =
+                        app.readInput(LocalizableMessage.raw("Bind name:"), bindNameArg
+                                .getDefaultValue() == null ? value : bindNameArg.getDefaultValue());
+            } catch (CLIException e) {
+                throw new ArgumentException(LocalizableMessage.raw("Unable to read bind name"), e);
+            }
+        }
+
+        return value;
     }
 
-    final FileInputStream fos = new FileInputStream(keyStoreFile);
-    final KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
-    keystore.load(fos, keyStorePIN);
-    fos.close();
+    public BindRequest getBindRequest() throws ArgumentException {
+        if (bindRequest == null) {
+            String mech = null;
+            for (final String s : saslOptionArg.getValues()) {
+                if (s.startsWith(SASL_PROPERTY_MECH)) {
+                    mech = parseSASLOptionValue(s);
+                    break;
+                }
+            }
 
-    return new ApplicationKeyManager(keystore, keyStorePIN);
-  }
+            if (mech == null) {
+                if (bindNameArg.isPresent() || bindPasswordFileArg.isPresent()
+                        || bindPasswordArg.isPresent()) {
+                    bindRequest = Requests.newSimpleBindRequest(getBindName(), getPassword());
+                }
+            } else if (mech.equals(DigestMD5SASLBindRequest.SASL_MECHANISM_NAME)) {
+                bindRequest =
+                        Requests.newDigestMD5SASLBindRequest(
+                                getAuthID(DigestMD5SASLBindRequest.SASL_MECHANISM_NAME),
+                                getPassword()).setAuthorizationID(getAuthzID())
+                                .setRealm(getRealm());
+            } else if (mech.equals(CRAMMD5SASLBindRequest.SASL_MECHANISM_NAME)) {
+                bindRequest =
+                        Requests.newCRAMMD5SASLBindRequest(
+                                getAuthID(CRAMMD5SASLBindRequest.SASL_MECHANISM_NAME),
+                                getPassword());
+            } else if (mech.equals(GSSAPISASLBindRequest.SASL_MECHANISM_NAME)) {
+                bindRequest =
+                        Requests.newGSSAPISASLBindRequest(
+                                getAuthID(GSSAPISASLBindRequest.SASL_MECHANISM_NAME), getPassword())
+                                .setKDCAddress(getKDC()).setRealm(getRealm()).setAuthorizationID(
+                                        getAuthzID());
+            } else if (mech.equals(ExternalSASLBindRequest.SASL_MECHANISM_NAME)) {
+                if (sslContext == null) {
+                    final LocalizableMessage message = ERR_TOOL_SASLEXTERNAL_NEEDS_SSL_OR_TLS.get();
+                    throw new ArgumentException(message);
+                }
+                if (!keyStorePathArg.isPresent() && getKeyStore() == null) {
+                    final LocalizableMessage message = ERR_TOOL_SASLEXTERNAL_NEEDS_KEYSTORE.get();
+                    throw new ArgumentException(message);
+                }
+                bindRequest =
+                        Requests.newExternalSASLBindRequest().setAuthorizationID(getAuthzID());
+            } else if (mech.equals(PlainSASLBindRequest.SASL_MECHANISM_NAME)) {
+                bindRequest =
+                        Requests.newPlainSASLBindRequest(
+                                getAuthID(PlainSASLBindRequest.SASL_MECHANISM_NAME), getPassword())
+                                .setAuthorizationID(getAuthzID());
+            } else {
+                throw new ArgumentException(ERR_LDAPAUTH_UNSUPPORTED_SASL_MECHANISM.get(mech));
+            }
 
+            if (reportAuthzIDArg.isPresent()) {
+                bindRequest.addControl(AuthorizationIdentityRequestControl.newControl(false));
+            }
 
-
-  /**
-   * Read the KeyStore from the JSSE system property.
-   *
-   * @return The path to the key store file.
-   */
-
-  private String getKeyStore()
-  {
-    return System.getProperty("javax.net.ssl.keyStore");
-  }
-
-
-
-  /**
-   * Read the KeyStore PIN from the JSSE system property.
-   *
-   * @return The PIN that should be used to access the key store.
-   */
-
-  private String getKeyStorePIN()
-  {
-    String pwd;
-    if (keyStorePasswordArg.isPresent())
-    {
-      pwd = keyStorePasswordArg.getValue();
-    }
-    else if (keyStorePasswordFileArg.isPresent())
-    {
-      pwd = keyStorePasswordFileArg.getValue();
-    }
-    else
-    {
-      pwd = System.getProperty("javax.net.ssl.keyStorePassword");
-    }
-    return pwd;
-  }
-
-
-
-  /**
-   * Get the password which has to be used for the command. If no password was
-   * specified, return null.
-   *
-   * @return The password stored into the specified file on by the command line
-   *         argument, or null it if not specified.
-   */
-  private char[] getPassword() throws ArgumentException
-  {
-    char[] value = "".toCharArray();
-
-    if (bindPasswordArg.isPresent())
-    {
-      value = bindPasswordArg.getValue().toCharArray();
-    }
-    else if (bindPasswordFileArg.isPresent())
-    {
-      value = bindPasswordFileArg.getValue().toCharArray();
+            if (usePasswordPolicyControlArg.isPresent()) {
+                bindRequest.addControl(PasswordPolicyRequestControl.newControl(false));
+            }
+        }
+        return bindRequest;
     }
 
-    if (value.length == 0 && app.isInteractive())
-    {
-      try
-      {
-        value = app.readPassword(LocalizableMessage.raw("Bind Password:"));
-      }
-      catch(CLIException e)
-      {
-        throw new ArgumentException(
-            LocalizableMessage.raw("Unable to read password"), e);
-      }
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return connFactory.toString();
     }
 
-    return value;
-  }
-
-
-
-  private String getRealm() throws ArgumentException
-  {
-    String value = null;
-    for (final String s : saslOptionArg.getValues())
-    {
-      if (s.startsWith(SASL_PROPERTY_REALM))
-      {
-        value = parseSASLOptionValue(s);
-        break;
-      }
-    }
-    return value;
-  }
-
-
-
-  /**
-   * Retrieves a <CODE>TrustManager</CODE> object that may be used for
-   * interactions requiring access to a trust manager.
-   *
-   * @return A set of <CODE>TrustManager</CODE> objects that may be used for
-   *         interactions requiring access to a trust manager.
-   * @throws GeneralSecurityException
-   *           If a problem occurs while interacting with the trust store.
-   */
-  private TrustManager getTrustManager() throws IOException,
-      GeneralSecurityException
-  {
-    if (trustAllArg.isPresent())
-    {
-      return TrustManagers.trustAll();
+    private String getKDC() throws ArgumentException {
+        String value = null;
+        for (final String s : saslOptionArg.getValues()) {
+            if (s.startsWith(SASL_PROPERTY_KDC)) {
+                value = parseSASLOptionValue(s);
+                break;
+            }
+        }
+        return value;
     }
 
-    X509TrustManager tm = null;
-    if (trustStorePathArg.isPresent()
-        && trustStorePathArg.getValue().length() > 0)
-    {
-      tm = TrustManagers.checkValidityDates(TrustManagers.checkHostName(
-          hostNameArg.getValue(), TrustManagers.checkUsingTrustStore(
-              trustStorePathArg.getValue(), getTrustStorePIN().toCharArray(),
-              null)));
-    }
-    else if (getTrustStore() != null)
-    {
-      tm = TrustManagers.checkValidityDates(TrustManagers.checkHostName(
-          hostNameArg.getValue(), TrustManagers.checkUsingTrustStore(
-              getTrustStore(), getTrustStorePIN().toCharArray(), null)));
+    /**
+     * Retrieves a <CODE>KeyManager</CODE> object that may be used for
+     * interactions requiring access to a key manager.
+     *
+     * @param keyStoreFile
+     *            The path to the file containing the key store data.
+     * @return A set of <CODE>KeyManager</CODE> objects that may be used for
+     *         interactions requiring access to a key manager.
+     * @throws java.security.KeyStoreException
+     *             If a problem occurs while interacting with the key store.
+     */
+
+    private X509KeyManager getKeyManager(String keyStoreFile) throws KeyStoreException,
+            IOException, NoSuchAlgorithmException, CertificateException {
+        if (keyStoreFile == null) {
+            // Lookup the file name through the JDK property.
+            keyStoreFile = getKeyStore();
+        }
+
+        if (keyStoreFile == null) {
+            return null;
+        }
+
+        final String keyStorePass = getKeyStorePIN();
+        char[] keyStorePIN = null;
+        if (keyStorePass != null) {
+            keyStorePIN = keyStorePass.toCharArray();
+        }
+
+        final FileInputStream fos = new FileInputStream(keyStoreFile);
+        final KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
+        keystore.load(fos, keyStorePIN);
+        fos.close();
+
+        return new ApplicationKeyManager(keystore, keyStorePIN);
     }
 
-    if (app != null && !app.isQuiet())
-    {
-      return new PromptingTrustManager(app, tm);
+    /**
+     * Read the KeyStore from the JSSE system property.
+     *
+     * @return The path to the key store file.
+     */
+
+    private String getKeyStore() {
+        return System.getProperty("javax.net.ssl.keyStore");
     }
 
-    return null;
-  }
+    /**
+     * Read the KeyStore PIN from the JSSE system property.
+     *
+     * @return The PIN that should be used to access the key store.
+     */
 
-
-
-  /**
-   * Read the TrustStore from the JSSE system property.
-   *
-   * @return The path to the trust store file.
-   */
-
-  private String getTrustStore()
-  {
-    return System.getProperty("javax.net.ssl.trustStore");
-  }
-
-
-
-  /**
-   * Read the TrustStore PIN from the JSSE system property.
-   *
-   * @return The PIN that should be used to access the trust store.
-   */
-
-  private String getTrustStorePIN()
-  {
-    String pwd;
-    if (trustStorePasswordArg.isPresent())
-    {
-      pwd = trustStorePasswordArg.getValue();
-    }
-    else if (trustStorePasswordFileArg.isPresent())
-    {
-      pwd = trustStorePasswordFileArg.getValue();
-    }
-    else
-    {
-      pwd = System.getProperty("javax.net.ssl.trustStorePassword");
-    }
-    return pwd;
-  }
-
-
-
-  private String parseSASLOptionValue(final String option)
-      throws ArgumentException
-  {
-    final int equalPos = option.indexOf('=');
-    if (equalPos <= 0)
-    {
-      final LocalizableMessage message = ERR_LDAP_CONN_CANNOT_PARSE_SASL_OPTION
-          .get(option);
-      throw new ArgumentException(message);
+    private String getKeyStorePIN() {
+        String pwd;
+        if (keyStorePasswordArg.isPresent()) {
+            pwd = keyStorePasswordArg.getValue();
+        } else if (keyStorePasswordFileArg.isPresent()) {
+            pwd = keyStorePasswordFileArg.getValue();
+        } else {
+            pwd = System.getProperty("javax.net.ssl.keyStorePassword");
+        }
+        return pwd;
     }
 
-    return option.substring(equalPos + 1, option.length());
-  }
+    /**
+     * Get the password which has to be used for the command. If no password was
+     * specified, return null.
+     *
+     * @return The password stored into the specified file on by the command
+     *         line argument, or null it if not specified.
+     */
+    private char[] getPassword() throws ArgumentException {
+        char[] value = "".toCharArray();
+
+        if (bindPasswordArg.isPresent()) {
+            value = bindPasswordArg.getValue().toCharArray();
+        } else if (bindPasswordFileArg.isPresent()) {
+            value = bindPasswordFileArg.getValue().toCharArray();
+        }
+
+        if (value.length == 0 && app.isInteractive()) {
+            try {
+                value = app.readPassword(LocalizableMessage.raw("Bind Password:"));
+            } catch (CLIException e) {
+                throw new ArgumentException(LocalizableMessage.raw("Unable to read password"), e);
+            }
+        }
+
+        return value;
+    }
+
+    private String getRealm() throws ArgumentException {
+        String value = null;
+        for (final String s : saslOptionArg.getValues()) {
+            if (s.startsWith(SASL_PROPERTY_REALM)) {
+                value = parseSASLOptionValue(s);
+                break;
+            }
+        }
+        return value;
+    }
+
+    /**
+     * Retrieves a <CODE>TrustManager</CODE> object that may be used for
+     * interactions requiring access to a trust manager.
+     *
+     * @return A set of <CODE>TrustManager</CODE> objects that may be used for
+     *         interactions requiring access to a trust manager.
+     * @throws GeneralSecurityException
+     *             If a problem occurs while interacting with the trust store.
+     */
+    private TrustManager getTrustManager() throws IOException, GeneralSecurityException {
+        if (trustAllArg.isPresent()) {
+            return TrustManagers.trustAll();
+        }
+
+        X509TrustManager tm = null;
+        if (trustStorePathArg.isPresent() && trustStorePathArg.getValue().length() > 0) {
+            tm =
+                    TrustManagers.checkValidityDates(TrustManagers.checkHostName(hostNameArg
+                            .getValue(), TrustManagers.checkUsingTrustStore(trustStorePathArg
+                            .getValue(), getTrustStorePIN().toCharArray(), null)));
+        } else if (getTrustStore() != null) {
+            tm =
+                    TrustManagers.checkValidityDates(TrustManagers.checkHostName(hostNameArg
+                            .getValue(), TrustManagers.checkUsingTrustStore(getTrustStore(),
+                            getTrustStorePIN().toCharArray(), null)));
+        }
+
+        if (app != null && !app.isQuiet()) {
+            return new PromptingTrustManager(app, tm);
+        }
+
+        return null;
+    }
+
+    /**
+     * Read the TrustStore from the JSSE system property.
+     *
+     * @return The path to the trust store file.
+     */
+
+    private String getTrustStore() {
+        return System.getProperty("javax.net.ssl.trustStore");
+    }
+
+    /**
+     * Read the TrustStore PIN from the JSSE system property.
+     *
+     * @return The PIN that should be used to access the trust store.
+     */
+
+    private String getTrustStorePIN() {
+        String pwd;
+        if (trustStorePasswordArg.isPresent()) {
+            pwd = trustStorePasswordArg.getValue();
+        } else if (trustStorePasswordFileArg.isPresent()) {
+            pwd = trustStorePasswordFileArg.getValue();
+        } else {
+            pwd = System.getProperty("javax.net.ssl.trustStorePassword");
+        }
+        return pwd;
+    }
+
+    private String parseSASLOptionValue(final String option) throws ArgumentException {
+        final int equalPos = option.indexOf('=');
+        if (equalPos <= 0) {
+            final LocalizableMessage message = ERR_LDAP_CONN_CANNOT_PARSE_SASL_OPTION.get(option);
+            throw new ArgumentException(message);
+        }
+
+        return option.substring(equalPos + 1, option.length());
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConsoleApplication.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConsoleApplication.java
index d68aa09..4294e84 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConsoleApplication.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ConsoleApplication.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,371 +27,284 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_ERROR_EMPTY_RESPONSE;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_MENU_PROMPT_RETURN_TO_CONTINUE;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_PROMPT_SINGLE_DEFAULT;
 import static com.forgerock.opendj.ldap.tools.Utils.MAX_LINE_WIDTH;
 import static com.forgerock.opendj.ldap.tools.Utils.wrapText;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.Closeable;
+import java.io.Console;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
 
 import org.forgerock.i18n.LocalizableMessage;
 
-
-
 /**
  * This class provides an abstract base class which can be used as the basis of
  * a console-based application.
  */
-abstract class ConsoleApplication
-{
-  private final PrintStream err = new PrintStream(System.err);
+abstract class ConsoleApplication {
+    private final PrintStream err = new PrintStream(System.err);
 
-  private final BufferedReader reader = new BufferedReader(
-      new InputStreamReader(System.in));
+    private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
 
-  private final InputStream in = System.in;
+    private final InputStream in = System.in;
 
-  private final PrintStream out = new PrintStream(System.out);
+    private final PrintStream out = new PrintStream(System.out);
 
-  private final Console console = System.console();
+    private final Console console = System.console();
 
-
-
-  /**
-   * Creates a new console application instance.
-   */
-  ConsoleApplication()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * Closes the provided {@code Closeable} if it is not {@code null}.
-   *
-   * @param closeable
-   *          The closeable to be closed.
-   */
-  final void closeIfNotNull(Closeable closeable)
-  {
-    if (closeable != null)
-    {
-      try
-      {
-        closeable.close();
-      }
-      catch (Exception ignored)
-      {
-        // Do nothing.
-      }
+    /**
+     * Creates a new console application instance.
+     */
+    ConsoleApplication() {
+        // Nothing to do.
     }
-  }
 
-
-
-  /**
-   * Returns the application error stream.
-   *
-   * @return The application error stream.
-   */
-  final PrintStream getErrorStream()
-  {
-    return err;
-  }
-
-
-
-  /**
-   * Returns the application input stream.
-   *
-   * @return The application input stream.
-   */
-  final InputStream getInputStream()
-  {
-    return in;
-  }
-
-
-
-  /**
-   * Returns the application output stream.
-   *
-   * @return The application output stream.
-   */
-  final PrintStream getOutputStream()
-  {
-    return out;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested interactive behavior. The
-   * default implementation returns {@code true}.
-   *
-   * @return {@code true} if the user has requested interactive behavior.
-   */
-  boolean isInteractive()
-  {
-    return true;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested quiet output. The default
-   * implementation returns {@code false}.
-   *
-   * @return {@code true} if the user has requested quiet output.
-   */
-  boolean isQuiet()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested script-friendly output. The
-   * default implementation returns {@code false}.
-   *
-   * @return {@code true} if the user has requested script-friendly output.
-   */
-  boolean isScriptFriendly()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested verbose output. The default
-   * implementation returns {@code false}.
-   *
-   * @return {@code true} if the user has requested verbose output.
-   */
-  boolean isVerbose()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Interactively prompts the user to press return to continue. This method
-   * should be called in situations where a user needs to be given a chance to
-   * read some documentation before continuing (continuing may cause the
-   * documentation to be scrolled out of view).
-   */
-  final void pressReturnToContinue()
-  {
-    final LocalizableMessage msg = INFO_MENU_PROMPT_RETURN_TO_CONTINUE
-        .get();
-    try
-    {
-      readLineOfInput(msg);
-    }
-    catch (final CLIException e)
-    {
-      // Ignore the exception - applications don't care.
-    }
-  }
-
-
-
-  /**
-   * Displays a message to the error stream.
-   *
-   * @param msg
-   *          The message.
-   */
-  final void print(final LocalizableMessage msg)
-  {
-    err.print(wrapText(msg, MAX_LINE_WIDTH));
-  }
-
-
-
-  /**
-   * Displays a blank line to the error stream.
-   */
-  final void println()
-  {
-    err.println();
-  }
-
-
-
-  /**
-   * Displays a message to the error stream.
-   *
-   * @param msg
-   *          The message.
-   */
-  final void println(final LocalizableMessage msg)
-  {
-    err.println(wrapText(msg, MAX_LINE_WIDTH));
-  }
-
-
-
-  /**
-   * Displays a message to the error stream indented by the specified number of
-   * columns.
-   *
-   * @param msg
-   *          The message.
-   * @param indent
-   *          The number of columns to indent.
-   */
-  final void println(final LocalizableMessage msg, final int indent)
-  {
-    err.println(wrapText(msg, MAX_LINE_WIDTH, indent));
-  }
-
-
-
-  /**
-   * Displays a message to the error stream if verbose mode is enabled.
-   *
-   * @param msg
-   *          The verbose message.
-   */
-  final void printVerboseMessage(final LocalizableMessage msg)
-  {
-    if (isVerbose() || isInteractive())
-    {
-      err.println(wrapText(msg, MAX_LINE_WIDTH));
-    }
-  }
-
-
-
-  /**
-   * Interactively prompts (on error output) the user to provide a string value.
-   * Any non-empty string will be allowed (the empty string will indicate that
-   * the default should be used, if there is one).
-   *
-   * @param prompt
-   *          The prompt to present to the user.
-   * @param defaultValue
-   *          The default value to assume if the user presses ENTER without
-   *          typing anything, or {@code null} if there should not be a default
-   *          and the user must explicitly provide a value.
-   * @throws CLIException
-   *           If the line of input could not be retrieved for some reason.
-   * @return The string value read from the user.
-   */
-  final String readInput(LocalizableMessage prompt,
-      final String defaultValue) throws CLIException
-  {
-    while (true)
-    {
-      if (defaultValue != null)
-      {
-        prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(),
-            defaultValue);
-      }
-      final String response = readLineOfInput(prompt);
-
-      if ("".equals(response))
-      {
-        if (defaultValue == null)
-        {
-          print(INFO_ERROR_EMPTY_RESPONSE.get());
+    /**
+     * Closes the provided {@code Closeable} if it is not {@code null}.
+     *
+     * @param closeable
+     *            The closeable to be closed.
+     */
+    final void closeIfNotNull(Closeable closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Exception ignored) {
+                // Do nothing.
+            }
         }
-        else
-        {
-          return defaultValue;
+    }
+
+    /**
+     * Returns the application error stream.
+     *
+     * @return The application error stream.
+     */
+    final PrintStream getErrorStream() {
+        return err;
+    }
+
+    /**
+     * Returns the application input stream.
+     *
+     * @return The application input stream.
+     */
+    final InputStream getInputStream() {
+        return in;
+    }
+
+    /**
+     * Returns the application output stream.
+     *
+     * @return The application output stream.
+     */
+    final PrintStream getOutputStream() {
+        return out;
+    }
+
+    /**
+     * Indicates whether or not the user has requested interactive behavior. The
+     * default implementation returns {@code true}.
+     *
+     * @return {@code true} if the user has requested interactive behavior.
+     */
+    boolean isInteractive() {
+        return true;
+    }
+
+    /**
+     * Indicates whether or not the user has requested quiet output. The default
+     * implementation returns {@code false}.
+     *
+     * @return {@code true} if the user has requested quiet output.
+     */
+    boolean isQuiet() {
+        return false;
+    }
+
+    /**
+     * Indicates whether or not the user has requested script-friendly output.
+     * The default implementation returns {@code false}.
+     *
+     * @return {@code true} if the user has requested script-friendly output.
+     */
+    boolean isScriptFriendly() {
+        return false;
+    }
+
+    /**
+     * Indicates whether or not the user has requested verbose output. The
+     * default implementation returns {@code false}.
+     *
+     * @return {@code true} if the user has requested verbose output.
+     */
+    boolean isVerbose() {
+        return false;
+    }
+
+    /**
+     * Interactively prompts the user to press return to continue. This method
+     * should be called in situations where a user needs to be given a chance to
+     * read some documentation before continuing (continuing may cause the
+     * documentation to be scrolled out of view).
+     */
+    final void pressReturnToContinue() {
+        final LocalizableMessage msg = INFO_MENU_PROMPT_RETURN_TO_CONTINUE.get();
+        try {
+            readLineOfInput(msg);
+        } catch (final CLIException e) {
+            // Ignore the exception - applications don't care.
         }
-      }
-      else
-      {
-        return response;
-      }
     }
-  }
 
+    /**
+     * Displays a message to the error stream.
+     *
+     * @param msg
+     *            The message.
+     */
+    final void print(final LocalizableMessage msg) {
+        err.print(wrapText(msg, MAX_LINE_WIDTH));
+    }
 
+    /**
+     * Displays a blank line to the error stream.
+     */
+    final void println() {
+        err.println();
+    }
 
-  /**
-   * Interactively reads a password from the console.
-   *
-   * @param prompt
-   *          The password prompt.
-   * @return The password.
-   * @throws CLIException
-   *           If the password could not be retrieved for some reason.
-   */
-  final char[] readPassword(final LocalizableMessage prompt)
-      throws CLIException
-  {
-    if (console != null)
-    {
-      if (prompt != null)
-      {
-        err.print(wrapText(prompt, MAX_LINE_WIDTH));
-        err.print(" ");
-      }
-      try
-      {
-        final char[] password = console.readPassword();
-        if (password == null)
-        {
-          throw new EOFException("End of input");
+    /**
+     * Displays a message to the error stream.
+     *
+     * @param msg
+     *            The message.
+     */
+    final void println(final LocalizableMessage msg) {
+        err.println(wrapText(msg, MAX_LINE_WIDTH));
+    }
+
+    /**
+     * Displays a message to the error stream indented by the specified number
+     * of columns.
+     *
+     * @param msg
+     *            The message.
+     * @param indent
+     *            The number of columns to indent.
+     */
+    final void println(final LocalizableMessage msg, final int indent) {
+        err.println(wrapText(msg, MAX_LINE_WIDTH, indent));
+    }
+
+    /**
+     * Displays a message to the error stream if verbose mode is enabled.
+     *
+     * @param msg
+     *            The verbose message.
+     */
+    final void printVerboseMessage(final LocalizableMessage msg) {
+        if (isVerbose() || isInteractive()) {
+            err.println(wrapText(msg, MAX_LINE_WIDTH));
         }
-        return password;
-      }
-      catch (final Throwable e)
-      {
-        throw CLIException.adaptInputException(e);
-      }
     }
-    else
-    {
-      // FIXME: should go direct to char[] and avoid the String.
-      return readLineOfInput(prompt).toCharArray();
-    }
-  }
 
+    /**
+     * Interactively prompts (on error output) the user to provide a string
+     * value. Any non-empty string will be allowed (the empty string will
+     * indicate that the default should be used, if there is one).
+     *
+     * @param prompt
+     *            The prompt to present to the user.
+     * @param defaultValue
+     *            The default value to assume if the user presses ENTER without
+     *            typing anything, or {@code null} if there should not be a
+     *            default and the user must explicitly provide a value.
+     * @throws CLIException
+     *             If the line of input could not be retrieved for some reason.
+     * @return The string value read from the user.
+     */
+    final String readInput(LocalizableMessage prompt, final String defaultValue)
+            throws CLIException {
+        while (true) {
+            if (defaultValue != null) {
+                prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(), defaultValue);
+            }
+            final String response = readLineOfInput(prompt);
 
+            if ("".equals(response)) {
+                if (defaultValue == null) {
+                    print(INFO_ERROR_EMPTY_RESPONSE.get());
+                } else {
+                    return defaultValue;
+                }
+            } else {
+                return response;
+            }
+        }
+    }
 
-  /**
-   * Interactively retrieves a line of input from the console.
-   *
-   * @param prompt
-   *          The prompt.
-   * @return The line of input.
-   * @throws CLIException
-   *           If the line of input could not be retrieved for some reason.
-   */
-  private final String readLineOfInput(final LocalizableMessage prompt)
-      throws CLIException
-  {
-    if (prompt != null)
-    {
-      err.print(wrapText(prompt, MAX_LINE_WIDTH));
-      err.print(" ");
+    /**
+     * Interactively reads a password from the console.
+     *
+     * @param prompt
+     *            The password prompt.
+     * @return The password.
+     * @throws CLIException
+     *             If the password could not be retrieved for some reason.
+     */
+    final char[] readPassword(final LocalizableMessage prompt) throws CLIException {
+        if (console != null) {
+            if (prompt != null) {
+                err.print(wrapText(prompt, MAX_LINE_WIDTH));
+                err.print(" ");
+            }
+            try {
+                final char[] password = console.readPassword();
+                if (password == null) {
+                    throw new EOFException("End of input");
+                }
+                return password;
+            } catch (final Throwable e) {
+                throw CLIException.adaptInputException(e);
+            }
+        } else {
+            // FIXME: should go direct to char[] and avoid the String.
+            return readLineOfInput(prompt).toCharArray();
+        }
     }
-    try
-    {
-      final String s = reader.readLine();
-      if (s == null)
-      {
-        throw CLIException.adaptInputException(new EOFException(
-            "End of input"));
-      }
-      else
-      {
-        return s;
-      }
+
+    /**
+     * Interactively retrieves a line of input from the console.
+     *
+     * @param prompt
+     *            The prompt.
+     * @return The line of input.
+     * @throws CLIException
+     *             If the line of input could not be retrieved for some reason.
+     */
+    private final String readLineOfInput(final LocalizableMessage prompt) throws CLIException {
+        if (prompt != null) {
+            err.print(wrapText(prompt, MAX_LINE_WIDTH));
+            err.print(" ");
+        }
+        try {
+            final String s = reader.readLine();
+            if (s == null) {
+                throw CLIException.adaptInputException(new EOFException("End of input"));
+            } else {
+                return s;
+            }
+        } catch (final IOException e) {
+            throw CLIException.adaptInputException(e);
+        }
     }
-    catch (final IOException e)
-    {
-      throw CLIException.adaptInputException(e);
-    }
-  }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
index 659998f..9d1b38e 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,564 +26,392 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import org.forgerock.i18n.LocalizableMessage;
 
 import com.forgerock.opendj.util.StaticUtils;
 import com.forgerock.opendj.util.Validator;
 
-import org.forgerock.i18n.LocalizableMessage;
-
-
 /**
  * A source of data for performance tools.
  */
-final class DataSource
-{
-  private static interface IDataSource
-  {
-    public IDataSource duplicate();
+final class DataSource {
+    private static interface IDataSource {
+        public IDataSource duplicate();
 
-
-
-    public Object getData();
-  }
-
-
-
-  private static class IncrementLineFileDataSource implements IDataSource
-  {
-    private final List<String> lines;
-    private int next;
-
-
-
-    public IncrementLineFileDataSource(final String file) throws IOException
-    {
-      lines = new ArrayList<String>();
-      final BufferedReader in = new BufferedReader(new FileReader(file));
-      try
-      {
-        String line;
-        while ((line = in.readLine()) != null)
-        {
-          lines.add(line);
-        }
-      }
-      finally
-      {
-        in.close();
-      }
+        public Object getData();
     }
 
+    private static class IncrementLineFileDataSource implements IDataSource {
+        private final List<String> lines;
+        private int next;
 
-
-    private IncrementLineFileDataSource(final List<String> lines)
-    {
-      this.lines = lines;
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      return new IncrementLineFileDataSource(lines);
-    }
-
-
-
-    public Object getData()
-    {
-      if (next == lines.size())
-      {
-        next = 0;
-      }
-
-      return lines.get(next++);
-    }
-
-    public static LocalizableMessage getUsage()
-    {
-      return LocalizableMessage.raw(
-        "\"inc({filename})\" Consecutive, incremental line from file");
-    }
-  }
-
-
-
-  private static class IncrementNumberDataSource implements IDataSource
-  {
-    private final int low;
-    private int next;
-    private final int high;
-
-
-
-    public IncrementNumberDataSource(final int low, final int high)
-    {
-      this.low = this.next = low;
-      this.high = high;
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      return new IncrementNumberDataSource(low, high);
-    }
-
-
-
-    public Object getData()
-    {
-      if (next == high)
-      {
-        next = low;
-        return high;
-      }
-
-      return next++;
-    }
-
-    public static LocalizableMessage getUsage()
-    {
-      return LocalizableMessage.raw(
-        "\"inc({min},{max})\" Consecutive, incremental number");
-    }
-  }
-
-
-
-  private static class RandomLineFileDataSource implements IDataSource
-  {
-    private final List<String> lines;
-    private final Random random;
-
-
-
-    public RandomLineFileDataSource(final long seed, final String file)
-        throws IOException
-    {
-      lines = new ArrayList<String>();
-      random = new Random(seed);
-      final BufferedReader in = new BufferedReader(new FileReader(file));
-      try
-      {
-        String line;
-        while ((line = in.readLine()) != null)
-        {
-          lines.add(line);
-        }
-      }
-      finally
-      {
-        in.close();
-      }
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      return this;
-    }
-
-
-
-    public Object getData()
-    {
-      return lines.get(random.nextInt(lines.size()));
-    }
-
-    public static LocalizableMessage getUsage()
-    {
-      return LocalizableMessage.raw(
-        "\"rand({filename})\" Random line from file");
-    }
-  }
-
-
-
-  private static class RandomNumberDataSource implements IDataSource
-  {
-    private final Random random;
-    private final int offset;
-    private final int range;
-
-
-
-    public RandomNumberDataSource(final long seed, final int low, final int high)
-    {
-      random = new Random(seed);
-      offset = low;
-      range = high - low;
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      // There is no state info so threads can just share one instance.
-      return this;
-    }
-
-
-
-    public Object getData()
-    {
-      return random.nextInt(range) + offset;
-    }
-
-    public static LocalizableMessage getUsage()
-    {
-      return LocalizableMessage.raw(
-          "\"rand({min},{max})\" Random number");
-    }
-  }
-
-
-
-  private static final class RandomStringDataSource implements IDataSource
-  {
-    private final Random random;
-    private final int length;
-    private final Character[] charSet;
-
-
-
-    private RandomStringDataSource(final int seed, final int length,
-        final String charSet)
-    {
-      this.length = length;
-      final Set<Character> chars = new HashSet<Character>();
-      for (int i = 0; i < charSet.length(); i++)
-      {
-        final char c = charSet.charAt(i);
-        if (c == '[')
-        {
-          i += 1;
-          final char start = charSet.charAt(i);
-          i += 2;
-          final char end = charSet.charAt(i);
-          i += 1;
-          for (int j = start; j <= end; j++)
-          {
-            chars.add((char) j);
-          }
-        }
-        else
-        {
-          chars.add(c);
-        }
-      }
-      this.charSet = chars.toArray(new Character[chars.size()]);
-      this.random = new Random(seed);
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      return this;
-    }
-
-
-
-    public Object getData()
-    {
-      final char[] str = new char[length];
-      for (int i = 0; i < length; i++)
-      {
-        str[i] = charSet[random.nextInt(charSet.length)];
-      }
-      return new String(str);
-    }
-
-    public static LocalizableMessage getUsage()
-    {
-      return LocalizableMessage.raw(
-        "\"randstr({length},<charSet>)\" Random string of specified " +
-            "length and optionally from characters in " +
-            "the charSet string. A range of character " +
-            "can be specified with [start-end] charSet notation. " +
-            "If no charSet is specified, the default charSet of " +
-            "[A-Z][a-z][0-9] will be used");
-    }
-  }
-
-
-
-  private static final class StaticDataSource implements IDataSource
-  {
-    private final Object data;
-
-
-
-    private StaticDataSource(final Object data)
-    {
-      this.data = data;
-    }
-
-
-
-    public IDataSource duplicate()
-    {
-      // There is no state info so threads can just share one instance.
-      return this;
-    }
-
-
-
-    public Object getData()
-    {
-      return data;
-    }
-  }
-
-
-
-  /**
-   * Returns Generated data from the specified data sources. Generated data will
-   * be placed in the specified data array. If the data array is null or smaller
-   * than the number of data sources, one will be allocated.
-   *
-   * @param dataSources
-   *          Data sources that will generate arguments referenced by the format
-   *          specifiers in the format string.
-   * @param data
-   *          The array where genereated data will be placed to format the
-   *          string.
-   * @return A formatted string
-   */
-  public static Object[] generateData(final DataSource[] dataSources,
-      Object[] data)
-  {
-    if (data == null || data.length < dataSources.length)
-    {
-      data = new Object[dataSources.length];
-    }
-    for (int i = 0; i < dataSources.length; i++)
-    {
-      data[i] = dataSources[i].getData();
-    }
-    return data;
-  }
-
-
-
-  /**
-   * Parses a list of source definitions into an array of data source objects. A
-   * data source is defined as follows: - rand({min},{max}) generates a random
-   * integer between the min and max. - rand({filename}) retrieves a random line
-   * from a file. - inc({min},{max}) returns incremental integer between the min
-   * and max. - inc({filename}) retrieves lines in order from a file. - {number}
-   * always return the integer as given. - {string} always return the string as
-   * given.
-   *
-   * @param sources
-   *          The list of source definitions to parse.
-   * @return The array of parsed data sources.
-   * @throws ArgumentException
-   *           If an exception occurs while parsing.
-   */
-  public static DataSource[] parse(final List<String> sources)
-      throws ArgumentException
-  {
-    Validator.ensureNotNull(sources);
-    final DataSource[] dataSources = new DataSource[sources.size()];
-    for (int i = 0; i < sources.size(); i++)
-    {
-      final String dataSourceDef = sources.get(i);
-      if (dataSourceDef.startsWith("rand(") && dataSourceDef.endsWith(")"))
-      {
-        final int lparenPos = dataSourceDef.indexOf("(");
-        final int commaPos = dataSourceDef.indexOf(",");
-        final int rparenPos = dataSourceDef.indexOf(")");
-
-        if (commaPos < 0)
-        {
-          try
-          {
-            // This is a file name
-            dataSources[i] = new DataSource(new RandomLineFileDataSource(0,
-                dataSourceDef.substring(lparenPos + 1, rparenPos)));
-          }
-          catch(IOException ioe)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error opening file %s: %s",
-                dataSourceDef.substring(lparenPos + 1, rparenPos),
-                ioe.getMessage()), ioe);
-          }
-          catch(Exception e)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error parsing value generator: %s", e.getMessage()), e);
-          }
-        }
-        else
-        {
-          try
-          {
-            // This range of integers
-            final int low = Integer.parseInt(dataSourceDef.substring(
-                lparenPos + 1, commaPos));
-            final int high = Integer.parseInt(dataSourceDef.substring(
-                commaPos + 1, rparenPos));
-            dataSources[i] = new DataSource(new RandomNumberDataSource(Thread
-                .currentThread().getId(), low, high));
-          }
-          catch(Exception e)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error parsing value generator: %s", e.getMessage()), e);
-          }
+        public IncrementLineFileDataSource(final String file) throws IOException {
+            lines = new ArrayList<String>();
+            final BufferedReader in = new BufferedReader(new FileReader(file));
+            try {
+                String line;
+                while ((line = in.readLine()) != null) {
+                    lines.add(line);
+                }
+            } finally {
+                in.close();
+            }
         }
 
-      }
-      else if (dataSourceDef.startsWith("randstr(")
-          && dataSourceDef.endsWith(")"))
-      {
-        final int lparenPos = dataSourceDef.indexOf("(");
-        final int commaPos = dataSourceDef.indexOf(",");
-        final int rparenPos = dataSourceDef.indexOf(")");
-        int length;
-        String charSet;
-        try
-        {
-          if (commaPos < 0)
-          {
-            length = Integer.parseInt(dataSourceDef.substring(lparenPos + 1,
-                rparenPos));
-            charSet = "[A-Z][a-z][0-9]";
-          }
-          else
-          {
-            // length and charSet
-            length = Integer.parseInt(dataSourceDef.substring(lparenPos + 1,
-                commaPos));
-            charSet = dataSourceDef.substring(commaPos + 1, rparenPos);
-          }
-          dataSources[i] = new DataSource(new RandomStringDataSource(0, length,
-              charSet));
+        private IncrementLineFileDataSource(final List<String> lines) {
+            this.lines = lines;
         }
-        catch(Exception e)
-        {
-          throw new ArgumentException(LocalizableMessage.raw(
-              "Error parsing value generator: %s", e.getMessage()), e);
+
+        public IDataSource duplicate() {
+            return new IncrementLineFileDataSource(lines);
         }
-      }
-      else if (dataSourceDef.startsWith("inc(") && dataSourceDef.endsWith(")"))
-      {
-        final int lparenPos = dataSourceDef.indexOf("(");
-        final int commaPos = dataSourceDef.indexOf(",");
-        final int rparenPos = dataSourceDef.indexOf(")");
-        if (commaPos < 0)
-        {
-          try
-          {
-            // This is a file name
-            dataSources[i] = new DataSource(new IncrementLineFileDataSource(
-                dataSourceDef.substring(lparenPos + 1, rparenPos)));
-          }
-          catch(IOException ioe)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error opening file %s: %s",
-                dataSourceDef.substring(lparenPos + 1, rparenPos),
-                ioe.getMessage()), ioe);
-          }
-          catch(Exception e)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error parsing value generator: %s", e.getMessage()), e);
-          }
+
+        public Object getData() {
+            if (next == lines.size()) {
+                next = 0;
+            }
+
+            return lines.get(next++);
         }
-        else
-        {
-          try
-          {
-            final int low = Integer.parseInt(dataSourceDef.substring(
-                lparenPos + 1, commaPos));
-            final int high = Integer.parseInt(dataSourceDef.substring(
-                commaPos + 1, rparenPos));
-            dataSources[i] = new DataSource(new IncrementNumberDataSource(low,
-                high));
-          }
-          catch(Exception e)
-          {
-            throw new ArgumentException(LocalizableMessage.raw(
-                "Error parsing value generator: %s", e.getMessage()), e);
-          }
+
+        public static LocalizableMessage getUsage() {
+            return LocalizableMessage
+                    .raw("\"inc({filename})\" Consecutive, incremental line from file");
         }
-      }
-      else
-      {
-        try
-        {
-          dataSources[i] = new DataSource(new StaticDataSource(Integer
-              .parseInt(dataSourceDef)));
-        }
-        catch (final NumberFormatException nfe)
-        {
-          dataSources[i] = new DataSource(new StaticDataSource(dataSourceDef));
-        }
-      }
     }
 
-    return dataSources;
-  }
+    private static class IncrementNumberDataSource implements IDataSource {
+        private final int low;
+        private int next;
+        private final int high;
 
+        public IncrementNumberDataSource(final int low, final int high) {
+            this.low = this.next = low;
+            this.high = high;
+        }
 
-  public static LocalizableMessage getUsage()
-  {
-    StringBuilder builder = new StringBuilder();
-    builder.append(IncrementLineFileDataSource.getUsage());
-    builder.append(StaticUtils.EOL);
-    builder.append(IncrementNumberDataSource.getUsage());
-    builder.append(StaticUtils.EOL);
-    builder.append(RandomLineFileDataSource.getUsage());
-    builder.append(StaticUtils.EOL);
-    builder.append(RandomNumberDataSource.getUsage());
-    builder.append(StaticUtils.EOL);
-    builder.append(RandomStringDataSource.getUsage());
-    return LocalizableMessage.raw(builder.toString());
-  }
+        public IDataSource duplicate() {
+            return new IncrementNumberDataSource(low, high);
+        }
 
+        public Object getData() {
+            if (next == high) {
+                next = low;
+                return high;
+            }
 
+            return next++;
+        }
 
-  private final IDataSource impl;
-
-
-
-  private DataSource(final IDataSource impl)
-  {
-    this.impl = impl;
-  }
-
-
-
-  public DataSource duplicate()
-  {
-    final IDataSource dup = impl.duplicate();
-    if (dup == impl)
-    {
-      return this;
+        public static LocalizableMessage getUsage() {
+            return LocalizableMessage.raw("\"inc({min},{max})\" Consecutive, incremental number");
+        }
     }
-    else
-    {
-      return new DataSource(dup);
+
+    private static class RandomLineFileDataSource implements IDataSource {
+        private final List<String> lines;
+        private final Random random;
+
+        public RandomLineFileDataSource(final long seed, final String file) throws IOException {
+            lines = new ArrayList<String>();
+            random = new Random(seed);
+            final BufferedReader in = new BufferedReader(new FileReader(file));
+            try {
+                String line;
+                while ((line = in.readLine()) != null) {
+                    lines.add(line);
+                }
+            } finally {
+                in.close();
+            }
+        }
+
+        public IDataSource duplicate() {
+            return this;
+        }
+
+        public Object getData() {
+            return lines.get(random.nextInt(lines.size()));
+        }
+
+        public static LocalizableMessage getUsage() {
+            return LocalizableMessage.raw("\"rand({filename})\" Random line from file");
+        }
     }
-  }
 
+    private static class RandomNumberDataSource implements IDataSource {
+        private final Random random;
+        private final int offset;
+        private final int range;
 
+        public RandomNumberDataSource(final long seed, final int low, final int high) {
+            random = new Random(seed);
+            offset = low;
+            range = high - low;
+        }
 
-  public Object getData()
-  {
-    return impl.getData();
-  }
+        public IDataSource duplicate() {
+            // There is no state info so threads can just share one instance.
+            return this;
+        }
+
+        public Object getData() {
+            return random.nextInt(range) + offset;
+        }
+
+        public static LocalizableMessage getUsage() {
+            return LocalizableMessage.raw("\"rand({min},{max})\" Random number");
+        }
+    }
+
+    private static final class RandomStringDataSource implements IDataSource {
+        private final Random random;
+        private final int length;
+        private final Character[] charSet;
+
+        private RandomStringDataSource(final int seed, final int length, final String charSet) {
+            this.length = length;
+            final Set<Character> chars = new HashSet<Character>();
+            for (int i = 0; i < charSet.length(); i++) {
+                final char c = charSet.charAt(i);
+                if (c == '[') {
+                    i += 1;
+                    final char start = charSet.charAt(i);
+                    i += 2;
+                    final char end = charSet.charAt(i);
+                    i += 1;
+                    for (int j = start; j <= end; j++) {
+                        chars.add((char) j);
+                    }
+                } else {
+                    chars.add(c);
+                }
+            }
+            this.charSet = chars.toArray(new Character[chars.size()]);
+            this.random = new Random(seed);
+        }
+
+        public IDataSource duplicate() {
+            return this;
+        }
+
+        public Object getData() {
+            final char[] str = new char[length];
+            for (int i = 0; i < length; i++) {
+                str[i] = charSet[random.nextInt(charSet.length)];
+            }
+            return new String(str);
+        }
+
+        public static LocalizableMessage getUsage() {
+            return LocalizableMessage
+                    .raw("\"randstr({length},<charSet>)\" Random string of specified "
+                            + "length and optionally from characters in "
+                            + "the charSet string. A range of character "
+                            + "can be specified with [start-end] charSet notation. "
+                            + "If no charSet is specified, the default charSet of "
+                            + "[A-Z][a-z][0-9] will be used");
+        }
+    }
+
+    private static final class StaticDataSource implements IDataSource {
+        private final Object data;
+
+        private StaticDataSource(final Object data) {
+            this.data = data;
+        }
+
+        public IDataSource duplicate() {
+            // There is no state info so threads can just share one instance.
+            return this;
+        }
+
+        public Object getData() {
+            return data;
+        }
+    }
+
+    /**
+     * Returns Generated data from the specified data sources. Generated data
+     * will be placed in the specified data array. If the data array is null or
+     * smaller than the number of data sources, one will be allocated.
+     *
+     * @param dataSources
+     *            Data sources that will generate arguments referenced by the
+     *            format specifiers in the format string.
+     * @param data
+     *            The array where genereated data will be placed to format the
+     *            string.
+     * @return A formatted string
+     */
+    public static Object[] generateData(final DataSource[] dataSources, Object[] data) {
+        if (data == null || data.length < dataSources.length) {
+            data = new Object[dataSources.length];
+        }
+        for (int i = 0; i < dataSources.length; i++) {
+            data[i] = dataSources[i].getData();
+        }
+        return data;
+    }
+
+    /**
+     * Parses a list of source definitions into an array of data source objects.
+     * A data source is defined as follows: - rand({min},{max}) generates a
+     * random integer between the min and max. - rand({filename}) retrieves a
+     * random line from a file. - inc({min},{max}) returns incremental integer
+     * between the min and max. - inc({filename}) retrieves lines in order from
+     * a file. - {number} always return the integer as given. - {string} always
+     * return the string as given.
+     *
+     * @param sources
+     *            The list of source definitions to parse.
+     * @return The array of parsed data sources.
+     * @throws ArgumentException
+     *             If an exception occurs while parsing.
+     */
+    public static DataSource[] parse(final List<String> sources) throws ArgumentException {
+        Validator.ensureNotNull(sources);
+        final DataSource[] dataSources = new DataSource[sources.size()];
+        for (int i = 0; i < sources.size(); i++) {
+            final String dataSourceDef = sources.get(i);
+            if (dataSourceDef.startsWith("rand(") && dataSourceDef.endsWith(")")) {
+                final int lparenPos = dataSourceDef.indexOf("(");
+                final int commaPos = dataSourceDef.indexOf(",");
+                final int rparenPos = dataSourceDef.indexOf(")");
+
+                if (commaPos < 0) {
+                    try {
+                        // This is a file name
+                        dataSources[i] =
+                                new DataSource(new RandomLineFileDataSource(0, dataSourceDef
+                                        .substring(lparenPos + 1, rparenPos)));
+                    } catch (IOException ioe) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error opening file %s: %s", dataSourceDef.substring(lparenPos + 1,
+                                        rparenPos), ioe.getMessage()), ioe);
+                    } catch (Exception e) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error parsing value generator: %s", e.getMessage()), e);
+                    }
+                } else {
+                    try {
+                        // This range of integers
+                        final int low =
+                                Integer.parseInt(dataSourceDef.substring(lparenPos + 1, commaPos));
+                        final int high =
+                                Integer.parseInt(dataSourceDef.substring(commaPos + 1, rparenPos));
+                        dataSources[i] =
+                                new DataSource(new RandomNumberDataSource(Thread.currentThread()
+                                        .getId(), low, high));
+                    } catch (Exception e) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error parsing value generator: %s", e.getMessage()), e);
+                    }
+                }
+
+            } else if (dataSourceDef.startsWith("randstr(") && dataSourceDef.endsWith(")")) {
+                final int lparenPos = dataSourceDef.indexOf("(");
+                final int commaPos = dataSourceDef.indexOf(",");
+                final int rparenPos = dataSourceDef.indexOf(")");
+                int length;
+                String charSet;
+                try {
+                    if (commaPos < 0) {
+                        length =
+                                Integer.parseInt(dataSourceDef.substring(lparenPos + 1, rparenPos));
+                        charSet = "[A-Z][a-z][0-9]";
+                    } else {
+                        // length and charSet
+                        length = Integer.parseInt(dataSourceDef.substring(lparenPos + 1, commaPos));
+                        charSet = dataSourceDef.substring(commaPos + 1, rparenPos);
+                    }
+                    dataSources[i] = new DataSource(new RandomStringDataSource(0, length, charSet));
+                } catch (Exception e) {
+                    throw new ArgumentException(LocalizableMessage.raw(
+                            "Error parsing value generator: %s", e.getMessage()), e);
+                }
+            } else if (dataSourceDef.startsWith("inc(") && dataSourceDef.endsWith(")")) {
+                final int lparenPos = dataSourceDef.indexOf("(");
+                final int commaPos = dataSourceDef.indexOf(",");
+                final int rparenPos = dataSourceDef.indexOf(")");
+                if (commaPos < 0) {
+                    try {
+                        // This is a file name
+                        dataSources[i] =
+                                new DataSource(new IncrementLineFileDataSource(dataSourceDef
+                                        .substring(lparenPos + 1, rparenPos)));
+                    } catch (IOException ioe) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error opening file %s: %s", dataSourceDef.substring(lparenPos + 1,
+                                        rparenPos), ioe.getMessage()), ioe);
+                    } catch (Exception e) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error parsing value generator: %s", e.getMessage()), e);
+                    }
+                } else {
+                    try {
+                        final int low =
+                                Integer.parseInt(dataSourceDef.substring(lparenPos + 1, commaPos));
+                        final int high =
+                                Integer.parseInt(dataSourceDef.substring(commaPos + 1, rparenPos));
+                        dataSources[i] = new DataSource(new IncrementNumberDataSource(low, high));
+                    } catch (Exception e) {
+                        throw new ArgumentException(LocalizableMessage.raw(
+                                "Error parsing value generator: %s", e.getMessage()), e);
+                    }
+                }
+            } else {
+                try {
+                    dataSources[i] =
+                            new DataSource(new StaticDataSource(Integer.parseInt(dataSourceDef)));
+                } catch (final NumberFormatException nfe) {
+                    dataSources[i] = new DataSource(new StaticDataSource(dataSourceDef));
+                }
+            }
+        }
+
+        return dataSources;
+    }
+
+    public static LocalizableMessage getUsage() {
+        StringBuilder builder = new StringBuilder();
+        builder.append(IncrementLineFileDataSource.getUsage());
+        builder.append(StaticUtils.EOL);
+        builder.append(IncrementNumberDataSource.getUsage());
+        builder.append(StaticUtils.EOL);
+        builder.append(RandomLineFileDataSource.getUsage());
+        builder.append(StaticUtils.EOL);
+        builder.append(RandomNumberDataSource.getUsage());
+        builder.append(StaticUtils.EOL);
+        builder.append(RandomStringDataSource.getUsage());
+        return LocalizableMessage.raw(builder.toString());
+    }
+
+    private final IDataSource impl;
+
+    private DataSource(final IDataSource impl) {
+        this.impl = impl;
+    }
+
+    public DataSource duplicate() {
+        final IDataSource dup = impl.duplicate();
+        if (dup == impl) {
+            return this;
+        } else {
+            return new DataSource(dup);
+        }
+    }
+
+    public Object getData() {
+        return impl.getData();
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/FileBasedArgument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/FileBasedArgument.java
index 3f00da0..816f891 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/FileBasedArgument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/FileBasedArgument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
 
@@ -39,8 +36,6 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines an argument whose value will be read from a file rather
  * than actually specified on the command-line. When a value is specified on the
@@ -56,223 +51,193 @@
  * argument is on a single line in the specified file. If the file contains
  * multiple lines, then only the first line will be read.
  */
-final class FileBasedArgument extends Argument
-{
-  // The mapping between filenames specified and the first lines read
-  // from those
-  // files.
-  private final LinkedHashMap<String, String> namesToValues;
+final class FileBasedArgument extends Argument {
+    // The mapping between filenames specified and the first lines read
+    // from those
+    // files.
+    private final LinkedHashMap<String, String> namesToValues;
 
+    /**
+     * Creates a new file-based argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public FileBasedArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final LocalizableMessage valuePlaceholder, final String defaultValue,
+            final String propertyName, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, true,
+                valuePlaceholder, defaultValue, propertyName, description);
 
-
-  /**
-   * Creates a new file-based argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public FileBasedArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final LocalizableMessage valuePlaceholder,
-      final String defaultValue, final String propertyName,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        true, valuePlaceholder, defaultValue, propertyName, description);
-
-    namesToValues = new LinkedHashMap<String, String>();
-  }
-
-
-
-  /**
-   * Creates a new file-based argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public FileBasedArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final LocalizableMessage valuePlaceholder,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, false, true,
-        valuePlaceholder, null, null, description);
-
-    namesToValues = new LinkedHashMap<String, String>();
-  }
-
-
-
-  /**
-   * Adds a value to the set of values for this argument. This should only be
-   * called if the value is allowed by the <CODE>valueIsAcceptable</CODE>
-   * method. Note that in this case, correct behavior depends on a previous
-   * successful call to <CODE>valueIsAcceptable</CODE> so that the value read
-   * from the file may be stored in the name-to-value hash and used in place of
-   * the filename here.
-   *
-   * @param valueString
-   *          The string representation of the value to add to this argument.
-   */
-  @Override
-  public void addValue(final String valueString)
-  {
-    final String actualValue = namesToValues.get(valueString);
-    if (actualValue != null)
-    {
-      super.addValue(actualValue);
-    }
-  }
-
-
-
-  /**
-   * Retrieves a map between the filenames specified on the command line and the
-   * first lines read from those files.
-   *
-   * @return A map between the filenames specified on the command line and the
-   *         first lines read from those files.
-   */
-  public LinkedHashMap<String, String> getNameToValueMap()
-  {
-    return namesToValues;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  @Override
-  public boolean valueIsAcceptable(final String valueString,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    // First, make sure that the specified file exists.
-    File valueFile;
-    try
-    {
-      valueFile = new File(valueString);
-      if (!valueFile.exists())
-      {
-        invalidReason.append(ERR_FILEARG_NO_SUCH_FILE.get(valueString,
-            getName()));
-        return false;
-      }
-    }
-    catch (final Exception e)
-    {
-      invalidReason.append(ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE.get(
-          valueString, getName(), getExceptionMessage(e)));
-      return false;
+        namesToValues = new LinkedHashMap<String, String>();
     }
 
-    // Open the file for reading.
-    BufferedReader reader;
-    try
-    {
-      reader = new BufferedReader(new FileReader(valueFile));
-    }
-    catch (final Exception e)
-    {
-      invalidReason.append(ERR_FILEARG_CANNOT_OPEN_FILE.get(valueString,
-          getName(), getExceptionMessage(e)));
-      return false;
+    /**
+     * Creates a new file-based argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public FileBasedArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired,
+            final LocalizableMessage valuePlaceholder, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, false, true, valuePlaceholder,
+                null, null, description);
+
+        namesToValues = new LinkedHashMap<String, String>();
     }
 
-    // Read the first line and close the file.
-    String line;
-    try
-    {
-      line = reader.readLine();
-    }
-    catch (final Exception e)
-    {
-      invalidReason.append(ERR_FILEARG_CANNOT_READ_FILE.get(valueString,
-          getName(), getExceptionMessage(e)));
-      return false;
-    }
-    finally
-    {
-      try
-      {
-        reader.close();
-      }
-      catch (final Exception e)
-      {
-      }
+    /**
+     * Adds a value to the set of values for this argument. This should only be
+     * called if the value is allowed by the <CODE>valueIsAcceptable</CODE>
+     * method. Note that in this case, correct behavior depends on a previous
+     * successful call to <CODE>valueIsAcceptable</CODE> so that the value read
+     * from the file may be stored in the name-to-value hash and used in place
+     * of the filename here.
+     *
+     * @param valueString
+     *            The string representation of the value to add to this
+     *            argument.
+     */
+    @Override
+    public void addValue(final String valueString) {
+        final String actualValue = namesToValues.get(valueString);
+        if (actualValue != null) {
+            super.addValue(actualValue);
+        }
     }
 
-    // If the line read is null, then that means the file was empty.
-    if (line == null)
-    {
-
-      invalidReason.append(ERR_FILEARG_EMPTY_FILE.get(valueString, getName()));
-      return false;
+    /**
+     * Retrieves a map between the filenames specified on the command line and
+     * the first lines read from those files.
+     *
+     * @return A map between the filenames specified on the command line and the
+     *         first lines read from those files.
+     */
+    public LinkedHashMap<String, String> getNameToValueMap() {
+        return namesToValues;
     }
 
-    // Store the value in the hash so it will be available for addValue.
-    // We
-    // won't do any validation on the value itself, so anything that we
-    // read
-    // will be considered acceptable.
-    namesToValues.put(valueString, line);
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    @Override
+    public boolean valueIsAcceptable(final String valueString,
+            final LocalizableMessageBuilder invalidReason) {
+        // First, make sure that the specified file exists.
+        File valueFile;
+        try {
+            valueFile = new File(valueString);
+            if (!valueFile.exists()) {
+                invalidReason.append(ERR_FILEARG_NO_SUCH_FILE.get(valueString, getName()));
+                return false;
+            }
+        } catch (final Exception e) {
+            invalidReason.append(ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE.get(valueString,
+                    getName(), getExceptionMessage(e)));
+            return false;
+        }
+
+        // Open the file for reading.
+        BufferedReader reader;
+        try {
+            reader = new BufferedReader(new FileReader(valueFile));
+        } catch (final Exception e) {
+            invalidReason.append(ERR_FILEARG_CANNOT_OPEN_FILE.get(valueString, getName(),
+                    getExceptionMessage(e)));
+            return false;
+        }
+
+        // Read the first line and close the file.
+        String line;
+        try {
+            line = reader.readLine();
+        } catch (final Exception e) {
+            invalidReason.append(ERR_FILEARG_CANNOT_READ_FILE.get(valueString, getName(),
+                    getExceptionMessage(e)));
+            return false;
+        } finally {
+            try {
+                reader.close();
+            } catch (final Exception e) {
+                // Ignored.
+            }
+        }
+
+        // If the line read is null, then that means the file was empty.
+        if (line == null) {
+
+            invalidReason.append(ERR_FILEARG_EMPTY_FILE.get(valueString, getName()));
+            return false;
+        }
+
+        // Store the value in the hash so it will be available for addValue.
+        // We
+        // won't do any validation on the value itself, so anything that we
+        // read
+        // will be considered acceptable.
+        namesToValues.put(valueString, line);
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/IntegerArgument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/IntegerArgument.java
index ff6f72f..3effa04 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/IntegerArgument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/IntegerArgument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,508 +25,461 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_INTARG_VALUE_BELOW_LOWER_BOUND;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines an argument type that will only accept integer values, and
  * potentially only those in a given range.
  */
-final class IntegerArgument extends Argument
-{
-  // Indicates whether a lower bound will be enforced for this argument.
-  private final boolean hasLowerBound;
+final class IntegerArgument extends Argument {
+    // Indicates whether a lower bound will be enforced for this argument.
+    private final boolean hasLowerBound;
 
-  // Indicates whether an upper bound will be enforced for this
-  // argument.
-  private final boolean hasUpperBound;
+    // Indicates whether an upper bound will be enforced for this
+    // argument.
+    private final boolean hasUpperBound;
 
-  // The lower bound that will be enforced for this argument.
-  private final double lowerBound;
+    // The lower bound that will be enforced for this argument.
+    private final double lowerBound;
 
-  // The upper bound that will be enforced for this argument.
-  private final double upperBound;
+    // The upper bound that will be enforced for this argument.
+    private final double upperBound;
 
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param hasLowerBound
+     *            Indicates whether a lower bound should be enforced for values
+     *            of this argument.
+     * @param lowerBound
+     *            The lower bound that should be enforced for values of this
+     *            argument.
+     * @param hasUpperBound
+     *            Indicates whether an upperbound should be enforced for values
+     *            of this argument.
+     * @param upperBound
+     *            The upper bound that should be enforced for values of this
+     *            argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final double defaultValue, final String propertyName, final boolean hasLowerBound,
+            final double lowerBound, final boolean hasUpperBound, final double upperBound,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, String.valueOf(defaultValue), propertyName, description);
 
+        this.hasLowerBound = hasLowerBound;
+        this.hasUpperBound = hasUpperBound;
+        this.lowerBound = lowerBound;
+        this.upperBound = upperBound;
 
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param hasLowerBound
-   *          Indicates whether a lower bound should be enforced for values of
-   *          this argument.
-   * @param lowerBound
-   *          The lower bound that should be enforced for values of this
-   *          argument.
-   * @param hasUpperBound
-   *          Indicates whether an upperbound should be enforced for values of
-   *          this argument.
-   * @param upperBound
-   *          The upper bound that should be enforced for values of this
-   *          argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final double defaultValue,
-      final String propertyName, final boolean hasLowerBound,
-      final double lowerBound, final boolean hasUpperBound,
-      final double upperBound, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, String.valueOf(defaultValue),
-        propertyName, description);
-
-    this.hasLowerBound = hasLowerBound;
-    this.hasUpperBound = hasUpperBound;
-    this.lowerBound = lowerBound;
-    this.upperBound = upperBound;
-
-    if (hasLowerBound && hasUpperBound && (lowerBound > upperBound))
-    {
-      final LocalizableMessage message = ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND
-          .get(name, lowerBound, upperBound);
-      throw new ArgumentException(message);
-    }
-  }
-
-
-
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final double defaultValue,
-      final String propertyName, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, String.format("%f", defaultValue),
-        propertyName, description);
-
-    hasLowerBound = false;
-    hasUpperBound = false;
-    lowerBound = Integer.MIN_VALUE;
-    upperBound = Integer.MAX_VALUE;
-  }
-
-
-
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param hasLowerBound
-   *          Indicates whether a lower bound should be enforced for values of
-   *          this argument.
-   * @param lowerBound
-   *          The lower bound that should be enforced for values of this
-   *          argument.
-   * @param hasUpperBound
-   *          Indicates whether an upperbound should be enforced for values of
-   *          this argument.
-   * @param upperBound
-   *          The upper bound that should be enforced for values of this
-   *          argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final int defaultValue,
-      final String propertyName, final boolean hasLowerBound,
-      final double lowerBound, final boolean hasUpperBound,
-      final double upperBound, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, String.valueOf(defaultValue),
-        propertyName, description);
-
-    this.hasLowerBound = hasLowerBound;
-    this.hasUpperBound = hasUpperBound;
-    this.lowerBound = lowerBound;
-    this.upperBound = upperBound;
-
-    if (hasLowerBound && hasUpperBound && (lowerBound > upperBound))
-    {
-      final LocalizableMessage message = ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND
-          .get(name, lowerBound, upperBound);
-      throw new ArgumentException(message);
-    }
-  }
-
-
-
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final int defaultValue,
-      final String propertyName, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, String.valueOf(defaultValue),
-        propertyName, description);
-
-    hasLowerBound = false;
-    hasUpperBound = false;
-    lowerBound = Integer.MIN_VALUE;
-    upperBound = Integer.MAX_VALUE;
-  }
-
-
-
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param hasLowerBound
-   *          Indicates whether a lower bound should be enforced for values of
-   *          this argument.
-   * @param lowerBound
-   *          The lower bound that should be enforced for values of this
-   *          argument.
-   * @param hasUpperBound
-   *          Indicates whether an upperbound should be enforced for values of
-   *          this argument.
-   * @param upperBound
-   *          The upper bound that should be enforced for values of this
-   *          argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean needsValue, final LocalizableMessage valuePlaceholder,
-      final boolean hasLowerBound, final double lowerBound,
-      final boolean hasUpperBound, final double upperBound,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
-        valuePlaceholder, null, null, description);
-
-    this.hasLowerBound = hasLowerBound;
-    this.hasUpperBound = hasUpperBound;
-    this.lowerBound = lowerBound;
-    this.upperBound = upperBound;
-
-    if (hasLowerBound && hasUpperBound && (lowerBound > upperBound))
-    {
-      final LocalizableMessage message = ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND
-          .get(name, lowerBound, upperBound);
-      throw new ArgumentException(message);
-    }
-  }
-
-
-
-  /**
-   * Creates a new integer argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public IntegerArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean needsValue, final LocalizableMessage valuePlaceholder,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
-        valuePlaceholder, null, null, description);
-
-    hasLowerBound = false;
-    hasUpperBound = false;
-    lowerBound = Double.MIN_VALUE;
-    upperBound = Double.MAX_VALUE;
-  }
-
-
-
-  /**
-   * Retrieves the lower bound that may be enforced for values of this argument.
-   *
-   * @return The lower bound that may be enforced for values of this argument.
-   */
-  public double getLowerBound()
-  {
-    return lowerBound;
-  }
-
-
-
-  /**
-   * Retrieves the upper bound that may be enforced for values of this argument.
-   *
-   * @return The upper bound that may be enforced for values of this argument.
-   */
-  public double getUpperBound()
-  {
-    return upperBound;
-  }
-
-
-
-  /**
-   * Indicates whether a lower bound should be enforced for values of this
-   * argument.
-   *
-   * @return <CODE>true</CODE> if a lower bound should be enforced for values of
-   *         this argument, or <CODE>false</CODE> if not.
-   */
-  public boolean hasLowerBound()
-  {
-    return hasLowerBound;
-  }
-
-
-
-  /**
-   * Indicates whether a upper bound should be enforced for values of this
-   * argument.
-   *
-   * @return <CODE>true</CODE> if a upper bound should be enforced for values of
-   *         this argument, or <CODE>false</CODE> if not.
-   */
-  public boolean hasUpperBound()
-  {
-    return hasUpperBound;
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  @Override
-  public boolean valueIsAcceptable(final String valueString,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    // First, the value must be decodable as an integer.
-    double intValue;
-    try
-    {
-      intValue = Double.parseDouble(valueString);
-    }
-    catch (final Exception e)
-    {
-      invalidReason.append(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString,
-          getName()));
-      return false;
+        if (hasLowerBound && hasUpperBound && (lowerBound > upperBound)) {
+            final LocalizableMessage message =
+                    ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(name, lowerBound, upperBound);
+            throw new ArgumentException(message);
+        }
     }
 
-    // If there is a lower bound, then the value must be greater than or
-    // equal to it.
-    if (hasLowerBound && (intValue < lowerBound))
-    {
-      invalidReason.append(ERR_INTARG_VALUE_BELOW_LOWER_BOUND.get(getName(),
-          intValue, lowerBound));
-      return false;
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final double defaultValue, final String propertyName,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, String.format("%f", defaultValue), propertyName, description);
+
+        hasLowerBound = false;
+        hasUpperBound = false;
+        lowerBound = Integer.MIN_VALUE;
+        upperBound = Integer.MAX_VALUE;
     }
 
-    // If there is an upper bound, then the value must be less than or
-    // equal to it.
-    if (hasUpperBound && (intValue > upperBound))
-    {
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param hasLowerBound
+     *            Indicates whether a lower bound should be enforced for values
+     *            of this argument.
+     * @param lowerBound
+     *            The lower bound that should be enforced for values of this
+     *            argument.
+     * @param hasUpperBound
+     *            Indicates whether an upperbound should be enforced for values
+     *            of this argument.
+     * @param upperBound
+     *            The upper bound that should be enforced for values of this
+     *            argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final int defaultValue, final String propertyName, final boolean hasLowerBound,
+            final double lowerBound, final boolean hasUpperBound, final double upperBound,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, String.valueOf(defaultValue), propertyName, description);
 
-      invalidReason.append(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get(getName(),
-          intValue, upperBound));
-      return false;
+        this.hasLowerBound = hasLowerBound;
+        this.hasUpperBound = hasUpperBound;
+        this.lowerBound = lowerBound;
+        this.upperBound = upperBound;
+
+        if (hasLowerBound && hasUpperBound && (lowerBound > upperBound)) {
+            final LocalizableMessage message =
+                    ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(name, lowerBound, upperBound);
+            throw new ArgumentException(message);
+        }
     }
 
-    // At this point, the value should be acceptable.
-    return true;
-  }
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final int defaultValue, final String propertyName, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, String.valueOf(defaultValue), propertyName, description);
+
+        hasLowerBound = false;
+        hasUpperBound = false;
+        lowerBound = Integer.MIN_VALUE;
+        upperBound = Integer.MAX_VALUE;
+    }
+
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param hasLowerBound
+     *            Indicates whether a lower bound should be enforced for values
+     *            of this argument.
+     * @param lowerBound
+     *            The lower bound that should be enforced for values of this
+     *            argument.
+     * @param hasUpperBound
+     *            Indicates whether an upperbound should be enforced for values
+     *            of this argument.
+     * @param upperBound
+     *            The upper bound that should be enforced for values of this
+     *            argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean needsValue,
+            final LocalizableMessage valuePlaceholder, final boolean hasLowerBound,
+            final double lowerBound, final boolean hasUpperBound, final double upperBound,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
+                valuePlaceholder, null, null, description);
+
+        this.hasLowerBound = hasLowerBound;
+        this.hasUpperBound = hasUpperBound;
+        this.lowerBound = lowerBound;
+        this.upperBound = upperBound;
+
+        if (hasLowerBound && hasUpperBound && (lowerBound > upperBound)) {
+            final LocalizableMessage message =
+                    ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(name, lowerBound, upperBound);
+            throw new ArgumentException(message);
+        }
+    }
+
+    /**
+     * Creates a new integer argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public IntegerArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean needsValue,
+            final LocalizableMessage valuePlaceholder, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
+                valuePlaceholder, null, null, description);
+
+        hasLowerBound = false;
+        hasUpperBound = false;
+        lowerBound = Double.MIN_VALUE;
+        upperBound = Double.MAX_VALUE;
+    }
+
+    /**
+     * Retrieves the lower bound that may be enforced for values of this
+     * argument.
+     *
+     * @return The lower bound that may be enforced for values of this argument.
+     */
+    public double getLowerBound() {
+        return lowerBound;
+    }
+
+    /**
+     * Retrieves the upper bound that may be enforced for values of this
+     * argument.
+     *
+     * @return The upper bound that may be enforced for values of this argument.
+     */
+    public double getUpperBound() {
+        return upperBound;
+    }
+
+    /**
+     * Indicates whether a lower bound should be enforced for values of this
+     * argument.
+     *
+     * @return <CODE>true</CODE> if a lower bound should be enforced for values
+     *         of this argument, or <CODE>false</CODE> if not.
+     */
+    public boolean hasLowerBound() {
+        return hasLowerBound;
+    }
+
+    /**
+     * Indicates whether a upper bound should be enforced for values of this
+     * argument.
+     *
+     * @return <CODE>true</CODE> if a upper bound should be enforced for values
+     *         of this argument, or <CODE>false</CODE> if not.
+     */
+    public boolean hasUpperBound() {
+        return hasUpperBound;
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    @Override
+    public boolean valueIsAcceptable(final String valueString,
+            final LocalizableMessageBuilder invalidReason) {
+        // First, the value must be decodable as an integer.
+        double intValue;
+        try {
+            intValue = Double.parseDouble(valueString);
+        } catch (final Exception e) {
+            invalidReason.append(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, getName()));
+            return false;
+        }
+
+        // If there is a lower bound, then the value must be greater than or
+        // equal to it.
+        if (hasLowerBound && (intValue < lowerBound)) {
+            invalidReason.append(ERR_INTARG_VALUE_BELOW_LOWER_BOUND.get(getName(), intValue,
+                    lowerBound));
+            return false;
+        }
+
+        // If there is an upper bound, then the value must be less than or
+        // equal to it.
+        if (hasUpperBound && (intValue > upperBound)) {
+
+            invalidReason.append(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get(getName(), intValue,
+                    upperBound));
+            return false;
+        }
+
+        // At this point, the value should be acceptable.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
index 7cba37f..446d876 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,27 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
@@ -50,496 +57,388 @@
 
 import com.forgerock.opendj.util.Base64;
 
-
-
 /**
  * A tool that can be used to issue Compare requests to the Directory Server.
  */
-public final class LDAPCompare extends ConsoleApplication
-{
-  /**
-   * The main method for LDAPModify tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
+public final class LDAPCompare extends ConsoleApplication {
+    /**
+     * The main method for LDAPModify tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDAPCompare().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-
-
-
-  private LDAPCompare()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int executeCompare(final CompareRequest request,
-      final Connection connection)
-  {
-    println(INFO_PROCESSING_COMPARE_OPERATION.get(request
-        .getAttributeDescription().toString(), request
-        .getAssertionValueAsString(), request.getName().toString()));
-    if (connection != null)
-    {
-      try
-      {
-        Result result;
-        try
-        {
-          result = connection.compare(request);
-        }
-        catch (final InterruptedException e)
-        {
-          // This shouldn't happen because there are no other threads to
-          // interrupt this one.
-          throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-              e.getLocalizedMessage(), e);
-        }
-
-        if (result.getResultCode() == ResultCode.COMPARE_FALSE)
-        {
-          println(INFO_COMPARE_OPERATION_RESULT_FALSE.get(request.getName()
-              .toString()));
-        }
-        else
-        {
-
-          println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(request.getName()
-              .toString()));
-        }
-      }
-      catch (final ErrorResultException ere)
-      {
-        final LocalizableMessage msg = INFO_OPERATION_FAILED.get("COMPARE");
-        println(msg);
-        final Result r = ere.getResult();
-        println(ERR_TOOL_RESULT_CODE.get(r.getResultCode().intValue(), r
-            .getResultCode().toString()));
-        if ((r.getDiagnosticMessage() != null)
-            && (r.getDiagnosticMessage().length() > 0))
-        {
-          println(LocalizableMessage.raw(r.getDiagnosticMessage()));
-        }
-        if (r.getMatchedDN() != null && r.getMatchedDN().length() > 0)
-        {
-          println(ERR_TOOL_MATCHED_DN.get(r.getMatchedDN()));
-        }
-        return r.getResultCode().intValue();
-      }
-    }
-    return ResultCode.SUCCESS.intValue();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_LDAPCOMPARE_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(LDAPCompare.class
-        .getName(), toolDescription, false, true, 1, 0,
-        "attribute:value [DN ...]");
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-
-    BooleanArgument continueOnError;
-    BooleanArgument noop;
-    BooleanArgument showUsage;
-    IntegerArgument version;
-    StringArgument assertionFilter;
-    StringArgument controlStr;
-    StringArgument encodingStr;
-    StringArgument filename;
-    StringArgument proxyAuthzID;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-
-    try
-    {
-      connectionFactoryProvider =
-          new ConnectionFactoryProvider(argParser, this);
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      filename = new StringArgument("filename", OPTION_SHORT_FILENAME,
-          OPTION_LONG_FILENAME, false, false, true,
-          INFO_FILE_PLACEHOLDER.get(), null, null,
-          INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
-      filename.setPropertyName(OPTION_LONG_FILENAME);
-      argParser.addArgument(filename);
-
-      proxyAuthzID = new StringArgument("proxy_authzid",
-          OPTION_SHORT_PROXYAUTHID, OPTION_LONG_PROXYAUTHID, false, false,
-          true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROXY_AUTHZID.get());
-      proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
-      argParser.addArgument(proxyAuthzID);
-
-      assertionFilter = new StringArgument("assertionfilter", null,
-          OPTION_LONG_ASSERTION_FILE, false, false, true,
-          INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_ASSERTION_FILTER.get());
-      assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-      argParser.addArgument(assertionFilter);
-
-      controlStr = new StringArgument("control", 'J', "control", false, true,
-          true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_CONTROLS.get());
-      controlStr.setPropertyName("control");
-      argParser.addArgument(controlStr);
-
-      version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
-          OPTION_LONG_PROTOCOL_VERSION, false, false, true,
-          INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
-          INFO_DESCRIPTION_VERSION.get());
-      version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
-      argParser.addArgument(version);
-
-      encodingStr = new StringArgument("encoding", 'i', "encoding", false,
-          false, true, INFO_ENCODING_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_ENCODING.get());
-      encodingStr.setPropertyName("encoding");
-      argParser.addArgument(encodingStr);
-
-      continueOnError = new BooleanArgument("continueOnError", 'c',
-          "continueOnError", INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
-      continueOnError.setPropertyName("continueOnError");
-      argParser.addArgument(continueOnError);
-
-      noop = new BooleanArgument("no-op", OPTION_SHORT_DRYRUN,
-          OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get());
-      noop.setPropertyName(OPTION_LONG_DRYRUN);
-      argParser.addArgument(noop);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public static void main(final String[] args) {
+        final int retCode = new LDAPCompare().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
+    private BooleanArgument verbose;
 
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-
-      connectionFactory =
-          connectionFactoryProvider.getAuthenticatedConnectionFactory();
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    private LDAPCompare() {
+        // Nothing to do.
     }
 
-    try
-    {
-      final int versionNumber = version.getIntValue();
-      if (versionNumber != 2 && versionNumber != 3)
-      {
-        println(ERR_DESCRIPTION_INVALID_VERSION.get(String
-            .valueOf(versionNumber)));
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version
-          .getValue())));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isVerbose() {
+        return verbose.isPresent();
     }
 
-    final ArrayList<String> dnStrings = new ArrayList<String>();
-    final ArrayList<String> attrAndDNStrings = argParser.getTrailingArguments();
+    private int executeCompare(final CompareRequest request, final Connection connection) {
+        println(INFO_PROCESSING_COMPARE_OPERATION.get(request.getAttributeDescription().toString(),
+                request.getAssertionValueAsString(), request.getName().toString()));
+        if (connection != null) {
+            try {
+                Result result;
+                try {
+                    result = connection.compare(request);
+                } catch (final InterruptedException e) {
+                    // This shouldn't happen because there are no other threads
+                    // to
+                    // interrupt this one.
+                    throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                            .getLocalizedMessage(), e);
+                }
 
-    if (attrAndDNStrings.isEmpty())
-    {
-      final LocalizableMessage message = ERR_LDAPCOMPARE_NO_ATTR.get();
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+                if (result.getResultCode() == ResultCode.COMPARE_FALSE) {
+                    println(INFO_COMPARE_OPERATION_RESULT_FALSE.get(request.getName().toString()));
+                } else {
 
-    // First element should be an attribute string.
-    final String attributeString = attrAndDNStrings.remove(0);
-
-    // Rest are DN strings
-    for (final String s : attrAndDNStrings)
-    {
-      dnStrings.add(s);
-    }
-
-    // If no DNs were provided, then exit with an error.
-    if (dnStrings.isEmpty() && (!filename.isPresent()))
-    {
-      println(ERR_LDAPCOMPARE_NO_DNS.get());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // If trailing DNs were provided and the filename argument was also
-    // provided, exit with an error.
-    if (!dnStrings.isEmpty() && filename.isPresent())
-    {
-      println(ERR_LDAPCOMPARE_FILENAME_AND_DNS.get());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // parse the attribute string
-    final int idx = attributeString.indexOf(":");
-    if (idx == -1)
-    {
-      final LocalizableMessage message = ERR_LDAPCOMPARE_INVALID_ATTR_STRING
-          .get(attributeString);
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-    final String attributeType = attributeString.substring(0, idx);
-    ByteString attributeVal;
-    final String remainder = attributeString.substring(idx + 1, attributeString
-        .length());
-    if (remainder.length() > 0)
-    {
-      final char nextChar = remainder.charAt(0);
-      if (nextChar == ':')
-      {
-        final String base64 = remainder.substring(1, remainder.length());
-        try
-        {
-          attributeVal = Base64.decode(base64);
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          println(INFO_COMPARE_CANNOT_BASE64_DECODE_ASSERTION_VALUE.get());
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-      else if (nextChar == '<')
-      {
-        try
-        {
-          final String filePath = remainder.substring(1, remainder.length());
-          attributeVal = ByteString.wrap(Utils.readBytesFromFile(filePath));
-        }
-        catch (final Exception e)
-        {
-          println(INFO_COMPARE_CANNOT_READ_ASSERTION_VALUE_FROM_FILE.get(String
-              .valueOf(e)));
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-      else
-      {
-        attributeVal = ByteString.valueOf(remainder);
-      }
-    }
-    else
-    {
-      attributeVal = ByteString.valueOf(remainder);
-    }
-
-    final CompareRequest compare = Requests.newCompareRequest("",
-        attributeType, attributeVal);
-
-    if (controlStr.isPresent())
-    {
-      for (final String ctrlString : controlStr.getValues())
-      {
-        try
-        {
-          final Control ctrl = Utils.getControl(ctrlString);
-          compare.addControl(ctrl);
-        }
-        catch (final DecodeException de)
-        {
-          final LocalizableMessage message = ERR_TOOL_INVALID_CONTROL_STRING
-              .get(ctrlString);
-          println(message);
-          ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-    }
-
-    if (proxyAuthzID.isPresent())
-    {
-      final Control proxyControl = ProxiedAuthV2RequestControl
-          .newControl(proxyAuthzID.getValue());
-      compare.addControl(proxyControl);
-    }
-
-    if (assertionFilter.isPresent())
-    {
-      final String filterString = assertionFilter.getValue();
-      Filter filter;
-      try
-      {
-        filter = Filter.valueOf(filterString);
-
-        // FIXME -- Change this to the correct OID when the official one
-        // is assigned.
-        final Control assertionControl = AssertionRequestControl.newControl(
-            true, filter);
-        compare.addControl(assertionControl);
-      }
-      catch (final LocalizedIllegalArgumentException le)
-      {
-        final LocalizableMessage message = ERR_LDAP_ASSERTION_INVALID_FILTER
-            .get(le.getMessage());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    BufferedReader rdr = null;
-    if (!filename.isPresent() && dnStrings.isEmpty())
-    {
-      // Read from stdin.
-      rdr = new BufferedReader(new InputStreamReader(System.in));
-    }
-    else if (filename.isPresent())
-    {
-      try
-      {
-        rdr = new BufferedReader(new FileReader(filename.getValue()));
-      }
-      catch (final FileNotFoundException t)
-      {
-        println(ERR_LDAPCOMPARE_ERROR_READING_FILE.get(filename.getValue(), t
-            .toString()));
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    Connection connection = null;
-    if (!noop.isPresent())
-    {
-      try
-      {
-        connection = connectionFactory.getConnection();
-      }
-      catch (final ErrorResultException ere)
-      {
-        println(LocalizableMessage.raw(ere.getMessage()));
-        return ere.getResult().getResultCode().intValue();
-      }
-      catch (final InterruptedException e)
-      {
-        // This shouldn't happen because there are no other threads to
-        // interrupt this one.
-        println(LocalizableMessage.raw(e.getLocalizedMessage()));
-        return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
-      }
-    }
-
-    try
-    {
-      int result;
-      if (rdr == null)
-      {
-        for (final String dn : dnStrings)
-        {
-          compare.setName(dn);
-          result = executeCompare(compare, connection);
-          if (result != 0 && !continueOnError.isPresent())
-          {
-            return result;
-          }
-        }
-      }
-      else
-      {
-        String dn;
-        try
-        {
-          while ((dn = rdr.readLine()) != null)
-          {
-            compare.setName(dn);
-            result = executeCompare(compare, connection);
-            if (result != 0 && !continueOnError.isPresent())
-            {
-              return result;
+                    println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(request.getName().toString()));
+                }
+            } catch (final ErrorResultException ere) {
+                final LocalizableMessage msg = INFO_OPERATION_FAILED.get("COMPARE");
+                println(msg);
+                final Result r = ere.getResult();
+                println(ERR_TOOL_RESULT_CODE.get(r.getResultCode().intValue(), r.getResultCode()
+                        .toString()));
+                if ((r.getDiagnosticMessage() != null) && (r.getDiagnosticMessage().length() > 0)) {
+                    println(LocalizableMessage.raw(r.getDiagnosticMessage()));
+                }
+                if (r.getMatchedDN() != null && r.getMatchedDN().length() > 0) {
+                    println(ERR_TOOL_MATCHED_DN.get(r.getMatchedDN()));
+                }
+                return r.getResultCode().intValue();
             }
-          }
         }
-        catch (final IOException ioe)
-        {
-          println(ERR_LDAPCOMPARE_ERROR_READING_FILE.get(filename.getValue(),
-              ioe.toString()));
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-      if (rdr != null)
-      {
-        try
-        {
-          rdr.close();
-        }
-        catch (final IOException ioe)
-        {
-          // Just ignore
-        }
-      }
+        return ResultCode.SUCCESS.intValue();
     }
 
-    return 0;
-  }
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_LDAPCOMPARE_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDAPCompare.class.getName(), toolDescription, false, true, 1, 0,
+                        "attribute:value [DN ...]");
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+
+        BooleanArgument continueOnError;
+        BooleanArgument noop;
+        BooleanArgument showUsage;
+        IntegerArgument version;
+        StringArgument assertionFilter;
+        StringArgument controlStr;
+        StringArgument encodingStr;
+        StringArgument filename;
+        StringArgument proxyAuthzID;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
+
+        try {
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            filename =
+                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
+                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
+            filename.setPropertyName(OPTION_LONG_FILENAME);
+            argParser.addArgument(filename);
+
+            proxyAuthzID =
+                    new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID,
+                            OPTION_LONG_PROXYAUTHID, false, false, true,
+                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROXY_AUTHZID.get());
+            proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
+            argParser.addArgument(proxyAuthzID);
+
+            assertionFilter =
+                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
+                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
+            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
+            argParser.addArgument(assertionFilter);
+
+            controlStr =
+                    new StringArgument("control", 'J', "control", false, true, true,
+                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_CONTROLS.get());
+            controlStr.setPropertyName("control");
+            argParser.addArgument(controlStr);
+
+            version =
+                    new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
+                            OPTION_LONG_PROTOCOL_VERSION, false, false, true,
+                            INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
+                            INFO_DESCRIPTION_VERSION.get());
+            version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
+            argParser.addArgument(version);
+
+            encodingStr =
+                    new StringArgument("encoding", 'i', "encoding", false, false, true,
+                            INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING
+                                    .get());
+            encodingStr.setPropertyName("encoding");
+            argParser.addArgument(encodingStr);
+
+            continueOnError =
+                    new BooleanArgument("continueOnError", 'c', "continueOnError",
+                            INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
+            continueOnError.setPropertyName("continueOnError");
+            argParser.addArgument(continueOnError);
+
+            noop =
+                    new BooleanArgument("no-op", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN,
+                            INFO_DESCRIPTION_NOOP.get());
+            noop.setPropertyName(OPTION_LONG_DRYRUN);
+            argParser.addArgument(noop);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        try {
+            final int versionNumber = version.getIntValue();
+            if (versionNumber != 2 && versionNumber != 3) {
+                println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(versionNumber)));
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        } catch (final ArgumentException ae) {
+            println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version.getValue())));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        final ArrayList<String> dnStrings = new ArrayList<String>();
+        final ArrayList<String> attrAndDNStrings = argParser.getTrailingArguments();
+
+        if (attrAndDNStrings.isEmpty()) {
+            final LocalizableMessage message = ERR_LDAPCOMPARE_NO_ATTR.get();
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // First element should be an attribute string.
+        final String attributeString = attrAndDNStrings.remove(0);
+
+        // Rest are DN strings
+        for (final String s : attrAndDNStrings) {
+            dnStrings.add(s);
+        }
+
+        // If no DNs were provided, then exit with an error.
+        if (dnStrings.isEmpty() && (!filename.isPresent())) {
+            println(ERR_LDAPCOMPARE_NO_DNS.get());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // If trailing DNs were provided and the filename argument was also
+        // provided, exit with an error.
+        if (!dnStrings.isEmpty() && filename.isPresent()) {
+            println(ERR_LDAPCOMPARE_FILENAME_AND_DNS.get());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // parse the attribute string
+        final int idx = attributeString.indexOf(":");
+        if (idx == -1) {
+            final LocalizableMessage message =
+                    ERR_LDAPCOMPARE_INVALID_ATTR_STRING.get(attributeString);
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+        final String attributeType = attributeString.substring(0, idx);
+        ByteString attributeVal;
+        final String remainder = attributeString.substring(idx + 1, attributeString.length());
+        if (remainder.length() > 0) {
+            final char nextChar = remainder.charAt(0);
+            if (nextChar == ':') {
+                final String base64 = remainder.substring(1, remainder.length());
+                try {
+                    attributeVal = Base64.decode(base64);
+                } catch (final LocalizedIllegalArgumentException e) {
+                    println(INFO_COMPARE_CANNOT_BASE64_DECODE_ASSERTION_VALUE.get());
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            } else if (nextChar == '<') {
+                try {
+                    final String filePath = remainder.substring(1, remainder.length());
+                    attributeVal = ByteString.wrap(Utils.readBytesFromFile(filePath));
+                } catch (final Exception e) {
+                    println(INFO_COMPARE_CANNOT_READ_ASSERTION_VALUE_FROM_FILE.get(String
+                            .valueOf(e)));
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            } else {
+                attributeVal = ByteString.valueOf(remainder);
+            }
+        } else {
+            attributeVal = ByteString.valueOf(remainder);
+        }
+
+        final CompareRequest compare = Requests.newCompareRequest("", attributeType, attributeVal);
+
+        if (controlStr.isPresent()) {
+            for (final String ctrlString : controlStr.getValues()) {
+                try {
+                    final Control ctrl = Utils.getControl(ctrlString);
+                    compare.addControl(ctrl);
+                } catch (final DecodeException de) {
+                    final LocalizableMessage message =
+                            ERR_TOOL_INVALID_CONTROL_STRING.get(ctrlString);
+                    println(message);
+                    ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+        }
+
+        if (proxyAuthzID.isPresent()) {
+            final Control proxyControl =
+                    ProxiedAuthV2RequestControl.newControl(proxyAuthzID.getValue());
+            compare.addControl(proxyControl);
+        }
+
+        if (assertionFilter.isPresent()) {
+            final String filterString = assertionFilter.getValue();
+            Filter filter;
+            try {
+                filter = Filter.valueOf(filterString);
+
+                // FIXME -- Change this to the correct OID when the official one
+                // is assigned.
+                final Control assertionControl = AssertionRequestControl.newControl(true, filter);
+                compare.addControl(assertionControl);
+            } catch (final LocalizedIllegalArgumentException le) {
+                final LocalizableMessage message =
+                        ERR_LDAP_ASSERTION_INVALID_FILTER.get(le.getMessage());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+
+        BufferedReader rdr = null;
+        if (!filename.isPresent() && dnStrings.isEmpty()) {
+            // Read from stdin.
+            rdr = new BufferedReader(new InputStreamReader(System.in));
+        } else if (filename.isPresent()) {
+            try {
+                rdr = new BufferedReader(new FileReader(filename.getValue()));
+            } catch (final FileNotFoundException t) {
+                println(ERR_LDAPCOMPARE_ERROR_READING_FILE.get(filename.getValue(), t.toString()));
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+
+        Connection connection = null;
+        if (!noop.isPresent()) {
+            try {
+                connection = connectionFactory.getConnection();
+            } catch (final ErrorResultException ere) {
+                println(LocalizableMessage.raw(ere.getMessage()));
+                return ere.getResult().getResultCode().intValue();
+            } catch (final InterruptedException e) {
+                // This shouldn't happen because there are no other threads to
+                // interrupt this one.
+                println(LocalizableMessage.raw(e.getLocalizedMessage()));
+                return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
+            }
+        }
+
+        try {
+            int result;
+            if (rdr == null) {
+                for (final String dn : dnStrings) {
+                    compare.setName(dn);
+                    result = executeCompare(compare, connection);
+                    if (result != 0 && !continueOnError.isPresent()) {
+                        return result;
+                    }
+                }
+            } else {
+                String dn;
+                try {
+                    while ((dn = rdr.readLine()) != null) {
+                        compare.setName(dn);
+                        result = executeCompare(compare, connection);
+                        if (result != 0 && !continueOnError.isPresent()) {
+                            return result;
+                        }
+                    }
+                } catch (final IOException ioe) {
+                    println(ERR_LDAPCOMPARE_ERROR_READING_FILE.get(filename.getValue(), ioe
+                            .toString()));
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+            if (rdr != null) {
+                try {
+                    rdr.close();
+                } catch (final IOException ioe) {
+                    // Just ignore
+                }
+            }
+        }
+
+        return 0;
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
index f4f36b4..9bed33d 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,8 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
@@ -44,636 +41,515 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.controls.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
+import org.forgerock.opendj.ldap.controls.Control;
+import org.forgerock.opendj.ldap.controls.PostReadRequestControl;
+import org.forgerock.opendj.ldap.controls.PostReadResponseControl;
+import org.forgerock.opendj.ldap.controls.PreReadRequestControl;
+import org.forgerock.opendj.ldap.controls.PreReadResponseControl;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
 import org.forgerock.opendj.ldap.requests.AddRequest;
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 import org.forgerock.opendj.ldap.responses.Result;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldif.ChangeRecord;
+import org.forgerock.opendj.ldif.ChangeRecordReader;
+import org.forgerock.opendj.ldif.ChangeRecordVisitor;
+import org.forgerock.opendj.ldif.EntryWriter;
+import org.forgerock.opendj.ldif.LDIFChangeRecordReader;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
 /**
  * A tool that can be used to issue update (Add/Delete/Modify/ModifyDN) requests
  * to the Directory Server.
  */
-public final class LDAPModify extends ConsoleApplication
-{
-  private class VisitorImpl implements
-      ChangeRecordVisitor<Integer, java.lang.Void>
-  {
-    public Integer visitChangeRecord(final Void aVoid, final AddRequest change)
-    {
-      for (final Control control : controls)
-      {
-        change.addControl(control);
-      }
-      final String opType = "ADD";
-      println(INFO_PROCESSING_OPERATION
-          .get(opType, change.getName().toString()));
-      if (connection != null)
-      {
-        try
-        {
-          Result r;
-          try
-          {
-            r = connection.add(change);
-          }
-          catch (final InterruptedException e)
-          {
-            // This shouldn't happen because there are no other threads
-            // to interrupt this one.
-            throw newErrorResult(
-                ResultCode.CLIENT_SIDE_USER_CANCELLED,
-                e.getLocalizedMessage(), e);
-          }
-          printResult(opType, change.getName().toString(), r);
-          return r.getResultCode().intValue();
+public final class LDAPModify extends ConsoleApplication {
+    private class VisitorImpl implements ChangeRecordVisitor<Integer, java.lang.Void> {
+        public Integer visitChangeRecord(final Void aVoid, final AddRequest change) {
+            for (final Control control : controls) {
+                change.addControl(control);
+            }
+            final String opType = "ADD";
+            println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
+            if (connection != null) {
+                try {
+                    Result r;
+                    try {
+                        r = connection.add(change);
+                    } catch (final InterruptedException e) {
+                        // This shouldn't happen because there are no other
+                        // threads
+                        // to interrupt this one.
+                        throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                                .getLocalizedMessage(), e);
+                    }
+                    printResult(opType, change.getName().toString(), r);
+                    return r.getResultCode().intValue();
+                } catch (final ErrorResultException ere) {
+                    return Utils.printErrorMessage(LDAPModify.this, ere);
+                }
+            }
+            return ResultCode.SUCCESS.intValue();
         }
-        catch (final ErrorResultException ere)
-        {
-          return Utils.printErrorMessage(LDAPModify.this, ere);
+
+        public Integer visitChangeRecord(final Void aVoid, final DeleteRequest change) {
+            for (final Control control : controls) {
+                change.addControl(control);
+            }
+            final String opType = "DELETE";
+            println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
+            if (connection != null) {
+                try {
+                    Result r;
+                    try {
+                        r = connection.delete(change);
+                    } catch (final InterruptedException e) {
+                        // This shouldn't happen because there are no other
+                        // threads
+                        // to interrupt this one.
+                        throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                                .getLocalizedMessage(), e);
+                    }
+                    printResult(opType, change.getName().toString(), r);
+                    return r.getResultCode().intValue();
+                } catch (final ErrorResultException ere) {
+                    return Utils.printErrorMessage(LDAPModify.this, ere);
+                }
+            }
+            return ResultCode.SUCCESS.intValue();
         }
-      }
-      return ResultCode.SUCCESS.intValue();
+
+        public Integer visitChangeRecord(final Void aVoid, final ModifyDNRequest change) {
+            for (final Control control : controls) {
+                change.addControl(control);
+            }
+            final String opType = "MODIFY DN";
+            println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
+            if (connection != null) {
+                try {
+                    Result r;
+                    try {
+                        r = connection.modifyDN(change);
+                    } catch (final InterruptedException e) {
+                        // This shouldn't happen because there are no other
+                        // threads
+                        // to interrupt this one.
+                        throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                                .getLocalizedMessage(), e);
+                    }
+                    printResult(opType, change.getName().toString(), r);
+                    return r.getResultCode().intValue();
+                } catch (final ErrorResultException ere) {
+                    return Utils.printErrorMessage(LDAPModify.this, ere);
+                }
+            }
+            return ResultCode.SUCCESS.intValue();
+        }
+
+        public Integer visitChangeRecord(final Void aVoid, final ModifyRequest change) {
+            for (final Control control : controls) {
+                change.addControl(control);
+            }
+            final String opType = "MODIFY";
+            println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
+            if (connection != null) {
+                try {
+                    Result r;
+                    try {
+                        r = connection.modify(change);
+                    } catch (final InterruptedException e) {
+                        // This shouldn't happen because there are no other
+                        // threads
+                        // to interrupt this one.
+                        throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                                .getLocalizedMessage(), e);
+                    }
+                    printResult(opType, change.getName().toString(), r);
+                    return r.getResultCode().intValue();
+                } catch (final ErrorResultException ere) {
+                    return Utils.printErrorMessage(LDAPModify.this, ere);
+                }
+            }
+            return ResultCode.SUCCESS.intValue();
+        }
+
+        private void printResult(final String operationType, final String name, final Result r) {
+            if (r.getResultCode() != ResultCode.SUCCESS && r.getResultCode() != ResultCode.REFERRAL) {
+                final LocalizableMessage msg = INFO_OPERATION_FAILED.get(operationType);
+                println(msg);
+                println(ERR_TOOL_RESULT_CODE.get(r.getResultCode().intValue(), r.getResultCode()
+                        .toString()));
+                if ((r.getDiagnosticMessage() != null) && (r.getDiagnosticMessage().length() > 0)) {
+                    println(LocalizableMessage.raw(r.getDiagnosticMessage()));
+                }
+                if (r.getMatchedDN() != null && r.getMatchedDN().length() > 0) {
+                    println(ERR_TOOL_MATCHED_DN.get(r.getMatchedDN()));
+                }
+            } else {
+                final LocalizableMessage msg = INFO_OPERATION_SUCCESSFUL.get(operationType, name);
+                println(msg);
+                if ((r.getDiagnosticMessage() != null) && (r.getDiagnosticMessage().length() > 0)) {
+                    println(LocalizableMessage.raw(r.getDiagnosticMessage()));
+                }
+                if (r.getReferralURIs() != null) {
+                    for (final String uri : r.getReferralURIs()) {
+                        println(LocalizableMessage.raw(uri));
+                    }
+                }
+            }
+
+            try {
+                final PreReadResponseControl control =
+                        r.getControl(PreReadResponseControl.DECODER, new DecodeOptions());
+                if (control != null) {
+                    println(INFO_LDAPMODIFY_PREREAD_ENTRY.get());
+                    writer.writeEntry(control.getEntry());
+                }
+            } catch (final DecodeException de) {
+                println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
+            } catch (final IOException ioe) {
+                throw new RuntimeException(ioe);
+            }
+
+            try {
+                final PostReadResponseControl control =
+                        r.getControl(PostReadResponseControl.DECODER, new DecodeOptions());
+                if (control != null) {
+                    println(INFO_LDAPMODIFY_POSTREAD_ENTRY.get());
+                    writer.writeEntry(control.getEntry());
+                }
+            } catch (final DecodeException de) {
+                println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
+            } catch (final IOException ioe) {
+                throw new RuntimeException(ioe);
+            }
+
+            // TODO: CSN control
+        }
     }
 
+    /**
+     * The main method for LDAPModify tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
+    public static void main(final String[] args) {
+        final int retCode = new LDAPModify().run(args);
+        System.exit(filterExitCode(retCode));
+    }
 
-    public Integer visitChangeRecord(final Void aVoid,
-        final DeleteRequest change)
-    {
-      for (final Control control : controls)
-      {
-        change.addControl(control);
-      }
-      final String opType = "DELETE";
-      println(INFO_PROCESSING_OPERATION
-          .get(opType, change.getName().toString()));
-      if (connection != null)
-      {
-        try
-        {
-          Result r;
-          try
-          {
-            r = connection.delete(change);
-          }
-          catch (final InterruptedException e)
-          {
-            // This shouldn't happen because there are no other threads
-            // to interrupt this one.
-            throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-                e.getLocalizedMessage(), e);
-          }
-          printResult(opType, change.getName().toString(), r);
-          return r.getResultCode().intValue();
+    private Connection connection;
+
+    private EntryWriter writer;
+
+    private Collection<Control> controls;
+
+    private BooleanArgument verbose;
+
+    private LDAPModify() {
+        // Nothing to do.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isVerbose() {
+        return verbose.isPresent();
+    }
+
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDAPModify.class.getName(), toolDescription, false);
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+
+        BooleanArgument continueOnError;
+        // TODO: Remove this due to new LDIF reader api?
+        BooleanArgument defaultAdd;
+        BooleanArgument noop;
+        BooleanArgument showUsage;
+        IntegerArgument version;
+        StringArgument assertionFilter;
+        StringArgument controlStr;
+        StringArgument encodingStr;
+        StringArgument filename;
+        StringArgument postReadAttributes;
+        StringArgument preReadAttributes;
+        StringArgument proxyAuthzID;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
+
+        try {
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            defaultAdd =
+                    new BooleanArgument("defaultAdd", 'a', "defaultAdd",
+                            INFO_MODIFY_DESCRIPTION_DEFAULT_ADD.get());
+            argParser.addArgument(defaultAdd);
+
+            filename =
+                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
+                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
+            filename.setPropertyName(OPTION_LONG_FILENAME);
+            argParser.addArgument(filename);
+
+            proxyAuthzID =
+                    new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID,
+                            OPTION_LONG_PROXYAUTHID, false, false, true,
+                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROXY_AUTHZID.get());
+            proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
+            argParser.addArgument(proxyAuthzID);
+
+            assertionFilter =
+                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
+                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
+            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
+            argParser.addArgument(assertionFilter);
+
+            preReadAttributes =
+                    new StringArgument("prereadattrs", null, "preReadAttributes", false, false,
+                            true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PREREAD_ATTRS.get());
+            preReadAttributes.setPropertyName("preReadAttributes");
+            argParser.addArgument(preReadAttributes);
+
+            postReadAttributes =
+                    new StringArgument("postreadattrs", null, "postReadAttributes", false, false,
+                            true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_POSTREAD_ATTRS.get());
+            postReadAttributes.setPropertyName("postReadAttributes");
+            argParser.addArgument(postReadAttributes);
+
+            controlStr =
+                    new StringArgument("control", 'J', "control", false, true, true,
+                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_CONTROLS.get());
+            controlStr.setPropertyName("control");
+            argParser.addArgument(controlStr);
+
+            version =
+                    new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
+                            OPTION_LONG_PROTOCOL_VERSION, false, false, true,
+                            INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
+                            INFO_DESCRIPTION_VERSION.get());
+            version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
+            argParser.addArgument(version);
+
+            encodingStr =
+                    new StringArgument("encoding", 'i', "encoding", false, false, true,
+                            INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING
+                                    .get());
+            encodingStr.setPropertyName("encoding");
+            argParser.addArgument(encodingStr);
+
+            continueOnError =
+                    new BooleanArgument("continueOnError", 'c', "continueOnError",
+                            INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
+            continueOnError.setPropertyName("continueOnError");
+            argParser.addArgument(continueOnError);
+
+            noop =
+                    new BooleanArgument("no-op", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN,
+                            INFO_DESCRIPTION_NOOP.get());
+            noop.setPropertyName(OPTION_LONG_DRYRUN);
+            argParser.addArgument(noop);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-        catch (final ErrorResultException ere)
-        {
-          return Utils.printErrorMessage(LDAPModify.this, ere);
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-      }
-      return ResultCode.SUCCESS.intValue();
-    }
 
-
-
-    public Integer visitChangeRecord(final Void aVoid,
-        final ModifyDNRequest change)
-    {
-      for (final Control control : controls)
-      {
-        change.addControl(control);
-      }
-      final String opType = "MODIFY DN";
-      println(INFO_PROCESSING_OPERATION
-          .get(opType, change.getName().toString()));
-      if (connection != null)
-      {
-        try
-        {
-          Result r;
-          try
-          {
-            r = connection.modifyDN(change);
-          }
-          catch (final InterruptedException e)
-          {
-            // This shouldn't happen because there are no other threads
-            // to interrupt this one.
-            throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-                e.getLocalizedMessage(), e);
-          }
-          printResult(opType, change.getName().toString(), r);
-          return r.getResultCode().intValue();
+        try {
+            final int versionNumber = version.getIntValue();
+            if (versionNumber != 2 && versionNumber != 3) {
+                println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(versionNumber)));
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        } catch (final ArgumentException ae) {
+            println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version.getValue())));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-        catch (final ErrorResultException ere)
-        {
-          return Utils.printErrorMessage(LDAPModify.this, ere);
+
+        // modifyOptions.setShowOperations(noop.isPresent());
+        // modifyOptions.setVerbose(verbose.isPresent());
+        // modifyOptions.setContinueOnError(continueOnError.isPresent());
+        // modifyOptions.setEncoding(encodingStr.getValue());
+        // modifyOptions.setDefaultAdd(defaultAdd.isPresent());
+
+        controls = new LinkedList<Control>();
+        if (controlStr.isPresent()) {
+            for (final String ctrlString : controlStr.getValues()) {
+                try {
+                    final Control ctrl = Utils.getControl(ctrlString);
+                    controls.add(ctrl);
+                } catch (final DecodeException de) {
+                    final LocalizableMessage message =
+                            ERR_TOOL_INVALID_CONTROL_STRING.get(ctrlString);
+                    println(message);
+                    ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
         }
-      }
-      return ResultCode.SUCCESS.intValue();
-    }
 
-
-
-    public Integer visitChangeRecord(final Void aVoid,
-        final ModifyRequest change)
-    {
-      for (final Control control : controls)
-      {
-        change.addControl(control);
-      }
-      final String opType = "MODIFY";
-      println(INFO_PROCESSING_OPERATION
-          .get(opType, change.getName().toString()));
-      if (connection != null)
-      {
-        try
-        {
-          Result r;
-          try
-          {
-            r = connection.modify(change);
-          }
-          catch (final InterruptedException e)
-          {
-            // This shouldn't happen because there are no other threads
-            // to interrupt this one.
-            throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-                e.getLocalizedMessage(), e);
-          }
-          printResult(opType, change.getName().toString(), r);
-          return r.getResultCode().intValue();
+        if (proxyAuthzID.isPresent()) {
+            final Control proxyControl =
+                    ProxiedAuthV2RequestControl.newControl(proxyAuthzID.getValue());
+            controls.add(proxyControl);
         }
-        catch (final ErrorResultException ere)
-        {
-          return Utils.printErrorMessage(LDAPModify.this, ere);
+
+        if (assertionFilter.isPresent()) {
+            final String filterString = assertionFilter.getValue();
+            Filter filter;
+            try {
+                filter = Filter.valueOf(filterString);
+
+                // FIXME -- Change this to the correct OID when the official one
+                // is assigned.
+                final Control assertionControl = AssertionRequestControl.newControl(true, filter);
+                controls.add(assertionControl);
+            } catch (final LocalizedIllegalArgumentException le) {
+                final LocalizableMessage message =
+                        ERR_LDAP_ASSERTION_INVALID_FILTER.get(le.getMessage());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
         }
-      }
-      return ResultCode.SUCCESS.intValue();
-    }
 
-
-
-    private void printResult(final String operationType, final String name,
-        final Result r)
-    {
-      if (r.getResultCode() != ResultCode.SUCCESS
-          && r.getResultCode() != ResultCode.REFERRAL)
-      {
-        final LocalizableMessage msg = INFO_OPERATION_FAILED.get(operationType);
-        println(msg);
-        println(ERR_TOOL_RESULT_CODE.get(r.getResultCode().intValue(), r
-            .getResultCode().toString()));
-        if ((r.getDiagnosticMessage() != null)
-            && (r.getDiagnosticMessage().length() > 0))
-        {
-          println(LocalizableMessage.raw(r.getDiagnosticMessage()));
+        if (preReadAttributes.isPresent()) {
+            final String valueStr = preReadAttributes.getValue();
+            final StringTokenizer tokenizer = new StringTokenizer(valueStr, ", ");
+            final List<String> attributes = new LinkedList<String>();
+            while (tokenizer.hasMoreTokens()) {
+                attributes.add(tokenizer.nextToken());
+            }
+            final PreReadRequestControl control =
+                    PreReadRequestControl.newControl(true, attributes);
+            controls.add(control);
         }
-        if (r.getMatchedDN() != null && r.getMatchedDN().length() > 0)
-        {
-          println(ERR_TOOL_MATCHED_DN.get(r.getMatchedDN()));
+
+        if (postReadAttributes.isPresent()) {
+            final String valueStr = postReadAttributes.getValue();
+            final StringTokenizer tokenizer = new StringTokenizer(valueStr, ", ");
+            final List<String> attributes = new LinkedList<String>();
+            while (tokenizer.hasMoreTokens()) {
+                attributes.add(tokenizer.nextToken());
+            }
+            final PostReadRequestControl control =
+                    PostReadRequestControl.newControl(true, attributes);
+            controls.add(control);
         }
-      }
-      else
-      {
-        final LocalizableMessage msg = INFO_OPERATION_SUCCESSFUL.get(
-            operationType, name);
-        println(msg);
-        if ((r.getDiagnosticMessage() != null)
-            && (r.getDiagnosticMessage().length() > 0))
-        {
-          println(LocalizableMessage.raw(r.getDiagnosticMessage()));
+
+        if (!noop.isPresent()) {
+            try {
+                connection = connectionFactory.getConnection();
+            } catch (final ErrorResultException ere) {
+                return Utils.printErrorMessage(this, ere);
+            } catch (final InterruptedException e) {
+                // This shouldn't happen because there are no other threads to
+                // interrupt this one.
+                println(LocalizableMessage.raw(e.getLocalizedMessage()));
+                return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
+            }
         }
-        if (r.getReferralURIs() != null)
-        {
-          for (final String uri : r.getReferralURIs())
-          {
-            println(LocalizableMessage.raw(uri));
-          }
+
+        Utils.printPasswordPolicyResults(this, connection);
+
+        writer = new LDIFEntryWriter(getOutputStream());
+        final VisitorImpl visitor = new VisitorImpl();
+        try {
+            ChangeRecordReader reader;
+            if (filename.isPresent()) {
+                try {
+                    reader = new LDIFChangeRecordReader(new FileInputStream(filename.getValue()));
+                } catch (final Exception e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(filename.getValue(), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            } else {
+                reader = new LDIFChangeRecordReader(getInputStream());
+            }
+
+            try {
+                while (reader.hasNext()) {
+                    final ChangeRecord cr = reader.readChangeRecord();
+                    final int result = cr.accept(visitor, null);
+                    if (result != 0 && !continueOnError.isPresent()) {
+                        return result;
+                    }
+                }
+            } catch (final IOException ioe) {
+                final LocalizableMessage message =
+                        ERR_LDIF_FILE_READ_ERROR
+                                .get(filename.getValue(), ioe.getLocalizedMessage());
+                println(message);
+                return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+            }
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
         }
-      }
 
-      try
-      {
-        final PreReadResponseControl control = r.getControl(
-            PreReadResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          println(INFO_LDAPMODIFY_PREREAD_ENTRY.get());
-          writer.writeEntry(control.getEntry());
-        }
-      }
-      catch (final DecodeException de)
-      {
-        println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
-      }
-      catch (final IOException ioe)
-      {
-        throw new RuntimeException(ioe);
-      }
-
-      try
-      {
-        final PostReadResponseControl control = r.getControl(
-            PostReadResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          println(INFO_LDAPMODIFY_POSTREAD_ENTRY.get());
-          writer.writeEntry(control.getEntry());
-        }
-      }
-      catch (final DecodeException de)
-      {
-        println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
-      }
-      catch (final IOException ioe)
-      {
-        throw new RuntimeException(ioe);
-      }
-
-      // TODO: CSN control
+        return ResultCode.SUCCESS.intValue();
     }
-  }
-
-
-
-  /**
-   * The main method for LDAPModify tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDAPModify().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private Connection connection;
-
-  private EntryWriter writer;
-
-  private Collection<Control> controls;
-
-  private BooleanArgument verbose;
-
-
-
-  private LDAPModify()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(LDAPModify.class
-        .getName(), toolDescription, false);
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-
-    BooleanArgument continueOnError;
-    // TODO: Remove this due to new LDIF reader api?
-    BooleanArgument defaultAdd;
-    BooleanArgument noop;
-    BooleanArgument showUsage;
-    IntegerArgument version;
-    StringArgument assertionFilter;
-    StringArgument controlStr;
-    StringArgument encodingStr;
-    StringArgument filename;
-    StringArgument postReadAttributes;
-    StringArgument preReadAttributes;
-    StringArgument proxyAuthzID;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-
-    try
-    {
-      connectionFactoryProvider =
-          new ConnectionFactoryProvider(argParser, this);
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      defaultAdd = new BooleanArgument("defaultAdd", 'a', "defaultAdd",
-          INFO_MODIFY_DESCRIPTION_DEFAULT_ADD.get());
-      argParser.addArgument(defaultAdd);
-
-      filename = new StringArgument("filename", OPTION_SHORT_FILENAME,
-          OPTION_LONG_FILENAME, false, false, true,
-          INFO_FILE_PLACEHOLDER.get(), null, null,
-          INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
-      filename.setPropertyName(OPTION_LONG_FILENAME);
-      argParser.addArgument(filename);
-
-      proxyAuthzID = new StringArgument("proxy_authzid",
-          OPTION_SHORT_PROXYAUTHID, OPTION_LONG_PROXYAUTHID, false, false,
-          true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROXY_AUTHZID.get());
-      proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
-      argParser.addArgument(proxyAuthzID);
-
-      assertionFilter = new StringArgument("assertionfilter", null,
-          OPTION_LONG_ASSERTION_FILE, false, false, true,
-          INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_ASSERTION_FILTER.get());
-      assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-      argParser.addArgument(assertionFilter);
-
-      preReadAttributes = new StringArgument("prereadattrs", null,
-          "preReadAttributes", false, false, true,
-          INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PREREAD_ATTRS.get());
-      preReadAttributes.setPropertyName("preReadAttributes");
-      argParser.addArgument(preReadAttributes);
-
-      postReadAttributes = new StringArgument("postreadattrs", null,
-          "postReadAttributes", false, false, true,
-          INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_POSTREAD_ATTRS.get());
-      postReadAttributes.setPropertyName("postReadAttributes");
-      argParser.addArgument(postReadAttributes);
-
-      controlStr = new StringArgument("control", 'J', "control", false, true,
-          true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_CONTROLS.get());
-      controlStr.setPropertyName("control");
-      argParser.addArgument(controlStr);
-
-      version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
-          OPTION_LONG_PROTOCOL_VERSION, false, false, true,
-          INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
-          INFO_DESCRIPTION_VERSION.get());
-      version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
-      argParser.addArgument(version);
-
-      encodingStr = new StringArgument("encoding", 'i', "encoding", false,
-          false, true, INFO_ENCODING_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_ENCODING.get());
-      encodingStr.setPropertyName("encoding");
-      argParser.addArgument(encodingStr);
-
-      continueOnError = new BooleanArgument("continueOnError", 'c',
-          "continueOnError", INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
-      continueOnError.setPropertyName("continueOnError");
-      argParser.addArgument(continueOnError);
-
-      noop = new BooleanArgument("no-op", OPTION_SHORT_DRYRUN,
-          OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get());
-      noop.setPropertyName(OPTION_LONG_DRYRUN);
-      argParser.addArgument(noop);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
-
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-
-      connectionFactory =
-          connectionFactoryProvider.getAuthenticatedConnectionFactory();
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    try
-    {
-      final int versionNumber = version.getIntValue();
-      if (versionNumber != 2 && versionNumber != 3)
-      {
-        println(ERR_DESCRIPTION_INVALID_VERSION.get(String
-            .valueOf(versionNumber)));
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version
-          .getValue())));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // modifyOptions.setShowOperations(noop.isPresent());
-    // modifyOptions.setVerbose(verbose.isPresent());
-    // modifyOptions.setContinueOnError(continueOnError.isPresent());
-    // modifyOptions.setEncoding(encodingStr.getValue());
-    // modifyOptions.setDefaultAdd(defaultAdd.isPresent());
-
-    controls = new LinkedList<Control>();
-    if (controlStr.isPresent())
-    {
-      for (final String ctrlString : controlStr.getValues())
-      {
-        try
-        {
-          final Control ctrl = Utils.getControl(ctrlString);
-          controls.add(ctrl);
-        }
-        catch (final DecodeException de)
-        {
-          final LocalizableMessage message = ERR_TOOL_INVALID_CONTROL_STRING
-              .get(ctrlString);
-          println(message);
-          ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-    }
-
-    if (proxyAuthzID.isPresent())
-    {
-      final Control proxyControl = ProxiedAuthV2RequestControl
-          .newControl(proxyAuthzID.getValue());
-      controls.add(proxyControl);
-    }
-
-    if (assertionFilter.isPresent())
-    {
-      final String filterString = assertionFilter.getValue();
-      Filter filter;
-      try
-      {
-        filter = Filter.valueOf(filterString);
-
-        // FIXME -- Change this to the correct OID when the official one
-        // is assigned.
-        final Control assertionControl = AssertionRequestControl.newControl(
-            true, filter);
-        controls.add(assertionControl);
-      }
-      catch (final LocalizedIllegalArgumentException le)
-      {
-        final LocalizableMessage message = ERR_LDAP_ASSERTION_INVALID_FILTER
-            .get(le.getMessage());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    if (preReadAttributes.isPresent())
-    {
-      final String valueStr = preReadAttributes.getValue();
-      final StringTokenizer tokenizer = new StringTokenizer(valueStr, ", ");
-      final List<String> attributes = new LinkedList<String>();
-      while (tokenizer.hasMoreTokens())
-      {
-        attributes.add(tokenizer.nextToken());
-      }
-      final PreReadRequestControl control = PreReadRequestControl.newControl(
-          true, attributes);
-      controls.add(control);
-    }
-
-    if (postReadAttributes.isPresent())
-    {
-      final String valueStr = postReadAttributes.getValue();
-      final StringTokenizer tokenizer = new StringTokenizer(valueStr, ", ");
-      final List<String> attributes = new LinkedList<String>();
-      while (tokenizer.hasMoreTokens())
-      {
-        attributes.add(tokenizer.nextToken());
-      }
-      final PostReadRequestControl control = PostReadRequestControl.newControl(
-          true, attributes);
-      controls.add(control);
-    }
-
-    if (!noop.isPresent())
-    {
-      try
-      {
-        connection = connectionFactory.getConnection();
-      }
-      catch (final ErrorResultException ere)
-      {
-        return Utils.printErrorMessage(this, ere);
-      }
-      catch (final InterruptedException e)
-      {
-        // This shouldn't happen because there are no other threads to
-        // interrupt this one.
-        println(LocalizableMessage.raw(e.getLocalizedMessage()));
-        return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
-      }
-    }
-
-    Utils.printPasswordPolicyResults(this, connection);
-
-    writer = new LDIFEntryWriter(getOutputStream());
-    final VisitorImpl visitor = new VisitorImpl();
-    try
-    {
-      ChangeRecordReader reader;
-      if (filename.isPresent())
-      {
-        try
-        {
-          reader = new LDIFChangeRecordReader(new FileInputStream(filename
-              .getValue()));
-        }
-        catch (final Exception e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(filename.getValue(), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-      else
-      {
-        reader = new LDIFChangeRecordReader(getInputStream());
-      }
-
-      try
-      {
-        while (reader.hasNext())
-        {
-          final ChangeRecord cr = reader.readChangeRecord();
-          final int result = cr.accept(visitor, null);
-          if (result != 0 && !continueOnError.isPresent())
-          {
-            return result;
-          }
-        }
-      }
-      catch (final IOException ioe)
-      {
-        final LocalizableMessage message = ERR_LDIF_FILE_READ_ERROR.get(
-            filename.getValue(), ioe.getLocalizedMessage());
-        println(message);
-        return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-      }
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-    }
-
-    return ResultCode.SUCCESS.intValue();
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
index 478d2a0..17b2cef 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,22 +27,23 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.controls.Control;
 import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult;
 
-
-
 /**
  * A tool that can be used to issue LDAP password modify extended requests to
  * the Directory Server. It exposes the three primary options available for this
@@ -56,319 +56,268 @@
  * All of these are optional components that may be included or omitted from the
  * request.
  */
-public final class LDAPPasswordModify extends ConsoleApplication
-{
-  /**
-   * Parses the command-line arguments, establishes a connection to the
-   * Directory Server, sends the password modify request, and reads the
-   * response.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDAPPasswordModify().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-
-
-
-  private LDAPPasswordModify()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        LDAPPasswordModify.class.getName(), toolDescription, false);
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-
-    FileBasedArgument currentPWFile;
-    FileBasedArgument newPWFile;
-    BooleanArgument showUsage;
-    IntegerArgument version;
-    StringArgument currentPW;
-    StringArgument controlStr;
-    StringArgument newPW;
-    StringArgument proxyAuthzID;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-
-    try
-    {
-      connectionFactoryProvider =
-          new ConnectionFactoryProvider(argParser, this);
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      newPW = new StringArgument("newpw", 'n', "newPassword", false, false,
-          true, INFO_NEW_PASSWORD_PLACEHOLDER.get(), null, null,
-          INFO_LDAPPWMOD_DESCRIPTION_NEWPW.get());
-      newPW.setPropertyName("newPassword");
-      argParser.addArgument(newPW);
-
-      newPWFile = new FileBasedArgument("newpwfile", 'F', "newPasswordFile",
-          false, false, INFO_FILE_PLACEHOLDER.get(), null, null,
-          INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE.get());
-      newPWFile.setPropertyName("newPasswordFile");
-      argParser.addArgument(newPWFile);
-
-      currentPW = new StringArgument("currentpw", 'c', "currentPassword",
-          false, false, true, INFO_CURRENT_PASSWORD_PLACEHOLDER.get(), null,
-          null, INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW.get());
-      currentPW.setPropertyName("currentPassword");
-      argParser.addArgument(currentPW);
-
-      currentPWFile = new FileBasedArgument("currentpwfile", 'C',
-          "currentPasswordFile", false, false, INFO_FILE_PLACEHOLDER.get(),
-          null, null, INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE.get());
-      currentPWFile.setPropertyName("currentPasswordFile");
-      argParser.addArgument(currentPWFile);
-
-      proxyAuthzID = new StringArgument("authzid", 'a', "authzID", false,
-          false, true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-          INFO_LDAPPWMOD_DESCRIPTION_AUTHZID.get());
-      proxyAuthzID.setPropertyName("authzID");
-      argParser.addArgument(proxyAuthzID);
-
-      controlStr = new StringArgument("control", 'J', "control", false, true,
-          true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_CONTROLS.get());
-      controlStr.setPropertyName("control");
-      argParser.addArgument(controlStr);
-
-      version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
-          OPTION_LONG_PROTOCOL_VERSION, false, false, true,
-          INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
-          INFO_DESCRIPTION_VERSION.get());
-      version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
-      argParser.addArgument(version);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+public final class LDAPPasswordModify extends ConsoleApplication {
+    /**
+     * Parses the command-line arguments, establishes a connection to the
+     * Directory Server, sends the password modify request, and reads the
+     * response.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
+    public static void main(final String[] args) {
+        final int retCode = new LDAPPasswordModify().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
+    private BooleanArgument verbose;
 
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
+    private LDAPPasswordModify() {
+        // Nothing to do.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isVerbose() {
+        return verbose.isPresent();
+    }
+
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDAPPasswordModify.class.getName(), toolDescription, false);
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+
+        FileBasedArgument currentPWFile;
+        FileBasedArgument newPWFile;
+        BooleanArgument showUsage;
+        IntegerArgument version;
+        StringArgument currentPW;
+        StringArgument controlStr;
+        StringArgument newPW;
+        StringArgument proxyAuthzID;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
+
+        try {
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            newPW =
+                    new StringArgument("newpw", 'n', "newPassword", false, false, true,
+                            INFO_NEW_PASSWORD_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPPWMOD_DESCRIPTION_NEWPW.get());
+            newPW.setPropertyName("newPassword");
+            argParser.addArgument(newPW);
+
+            newPWFile =
+                    new FileBasedArgument("newpwfile", 'F', "newPasswordFile", false, false,
+                            INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE.get());
+            newPWFile.setPropertyName("newPasswordFile");
+            argParser.addArgument(newPWFile);
+
+            currentPW =
+                    new StringArgument("currentpw", 'c', "currentPassword", false, false, true,
+                            INFO_CURRENT_PASSWORD_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW.get());
+            currentPW.setPropertyName("currentPassword");
+            argParser.addArgument(currentPW);
+
+            currentPWFile =
+                    new FileBasedArgument("currentpwfile", 'C', "currentPasswordFile", false,
+                            false, INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE.get());
+            currentPWFile.setPropertyName("currentPasswordFile");
+            argParser.addArgument(currentPWFile);
+
+            proxyAuthzID =
+                    new StringArgument("authzid", 'a', "authzID", false, false, true,
+                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
+                            INFO_LDAPPWMOD_DESCRIPTION_AUTHZID.get());
+            proxyAuthzID.setPropertyName("authzID");
+            argParser.addArgument(proxyAuthzID);
+
+            controlStr =
+                    new StringArgument("control", 'J', "control", false, true, true,
+                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_CONTROLS.get());
+            controlStr.setPropertyName("control");
+            argParser.addArgument(controlStr);
+
+            version =
+                    new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
+                            OPTION_LONG_PROTOCOL_VERSION, false, false, true,
+                            INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
+                            INFO_DESCRIPTION_VERSION.get());
+            version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
+            argParser.addArgument(version);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        final PasswordModifyExtendedRequest request = Requests.newPasswordModifyExtendedRequest();
+        try {
+            final int versionNumber = version.getIntValue();
+            if (versionNumber != 2 && versionNumber != 3) {
+                println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(versionNumber)));
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        } catch (final ArgumentException ae) {
+            println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version.getValue())));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        if (controlStr.isPresent()) {
+            for (final String ctrlString : controlStr.getValues()) {
+                try {
+                    final Control ctrl = Utils.getControl(ctrlString);
+                    request.addControl(ctrl);
+                } catch (final DecodeException de) {
+                    final LocalizableMessage message =
+                            ERR_TOOL_INVALID_CONTROL_STRING.get(ctrlString);
+                    println(message);
+                    ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+        }
+
+        if (newPW.isPresent() && newPWFile.isPresent()) {
+            final LocalizableMessage message =
+                    ERR_LDAPPWMOD_CONFLICTING_ARGS.get(newPW.getLongIdentifier(), newPWFile
+                            .getLongIdentifier());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        if (currentPW.isPresent() && currentPWFile.isPresent()) {
+            final LocalizableMessage message =
+                    ERR_LDAPPWMOD_CONFLICTING_ARGS.get(currentPW.getLongIdentifier(), currentPWFile
+                            .getLongIdentifier());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        Connection connection;
+        try {
+            connection = connectionFactory.getConnection();
+        } catch (final ErrorResultException ere) {
+            return Utils.printErrorMessage(this, ere);
+        } catch (final InterruptedException e) {
+            // This shouldn't happen because there are no other threads to
+            // interrupt this one.
+            println(LocalizableMessage.raw(e.getLocalizedMessage()));
+            return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
+        }
+
+        if (proxyAuthzID.isPresent()) {
+            request.setUserIdentity(proxyAuthzID.getValue());
+        }
+
+        if (currentPW.isPresent()) {
+            request.setOldPassword(ByteString.valueOf(currentPW.getValue()));
+        } else if (currentPWFile.isPresent()) {
+            request.setOldPassword(ByteString.valueOf(currentPWFile.getValue()));
+        }
+
+        if (newPW.isPresent()) {
+            request.setNewPassword(ByteString.valueOf(newPW.getValue()));
+        } else if (newPWFile.isPresent()) {
+            request.setNewPassword(ByteString.valueOf(newPWFile.getValue()));
+        }
+
+        PasswordModifyExtendedResult result;
+        try {
+            try {
+                result = connection.extendedRequest(request);
+            } catch (final InterruptedException e) {
+                // This shouldn't happen because there are no other threads to
+                // interrupt this one.
+                throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
+                        e.getLocalizedMessage(), e);
+            }
+        } catch (final ErrorResultException e) {
+            LocalizableMessage message =
+                    ERR_LDAPPWMOD_FAILED.get(e.getResult().getResultCode().intValue(), e
+                            .getResult().getResultCode().toString());
+            println(message);
+
+            final String errorMessage = e.getResult().getDiagnosticMessage();
+            if ((errorMessage != null) && (errorMessage.length() > 0)) {
+                message = ERR_LDAPPWMOD_FAILURE_ERROR_MESSAGE.get(errorMessage);
+                println(message);
+            }
+
+            final String matchedDN = e.getResult().getMatchedDN();
+            if (matchedDN != null && matchedDN.length() > 0) {
+                message = ERR_LDAPPWMOD_FAILURE_MATCHED_DN.get(matchedDN);
+                println(message);
+            }
+            return e.getResult().getResultCode().intValue();
+        }
+
+        LocalizableMessage message = INFO_LDAPPWMOD_SUCCESSFUL.get();
+        println(message);
+
+        final String additionalInfo = result.getDiagnosticMessage();
+        if ((additionalInfo != null) && (additionalInfo.length() > 0)) {
+
+            message = INFO_LDAPPWMOD_ADDITIONAL_INFO.get(additionalInfo);
+            println(message);
+        }
+
+        if (result.getGeneratedPassword() != null) {
+            message =
+                    INFO_LDAPPWMOD_GENERATED_PASSWORD.get(result.getGeneratedPassword().toString());
+            println(message);
+        }
+
         return 0;
-      }
-
-      connectionFactory =
-          connectionFactoryProvider.getAuthenticatedConnectionFactory();
     }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    final PasswordModifyExtendedRequest request = Requests
-        .newPasswordModifyExtendedRequest();
-    try
-    {
-      final int versionNumber = version.getIntValue();
-      if (versionNumber != 2 && versionNumber != 3)
-      {
-        println(ERR_DESCRIPTION_INVALID_VERSION.get(String
-            .valueOf(versionNumber)));
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version
-          .getValue())));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    if (controlStr.isPresent())
-    {
-      for (final String ctrlString : controlStr.getValues())
-      {
-        try
-        {
-          final Control ctrl = Utils.getControl(ctrlString);
-          request.addControl(ctrl);
-        }
-        catch (final DecodeException de)
-        {
-          final LocalizableMessage message = ERR_TOOL_INVALID_CONTROL_STRING
-              .get(ctrlString);
-          println(message);
-          ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-    }
-
-    if (newPW.isPresent() && newPWFile.isPresent())
-    {
-      final LocalizableMessage message = ERR_LDAPPWMOD_CONFLICTING_ARGS.get(
-          newPW.getLongIdentifier(), newPWFile.getLongIdentifier());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    if (currentPW.isPresent() && currentPWFile.isPresent())
-    {
-      final LocalizableMessage message = ERR_LDAPPWMOD_CONFLICTING_ARGS.get(
-          currentPW.getLongIdentifier(), currentPWFile.getLongIdentifier());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    Connection connection;
-    try
-    {
-      connection = connectionFactory.getConnection();
-    }
-    catch (final ErrorResultException ere)
-    {
-      return Utils.printErrorMessage(this, ere);
-    }
-    catch (final InterruptedException e)
-    {
-      // This shouldn't happen because there are no other threads to
-      // interrupt this one.
-      println(LocalizableMessage.raw(e.getLocalizedMessage()));
-      return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
-    }
-
-    if (proxyAuthzID.isPresent())
-    {
-      request.setUserIdentity(proxyAuthzID.getValue());
-    }
-
-    if (currentPW.isPresent())
-    {
-      request.setOldPassword(ByteString.valueOf(currentPW.getValue()));
-    }
-    else if (currentPWFile.isPresent())
-    {
-      request.setOldPassword(ByteString.valueOf(currentPWFile.getValue()));
-    }
-
-    if (newPW.isPresent())
-    {
-      request.setNewPassword(ByteString.valueOf(newPW.getValue()));
-    }
-    else if (newPWFile.isPresent())
-    {
-      request.setNewPassword(ByteString.valueOf(newPWFile.getValue()));
-    }
-
-    PasswordModifyExtendedResult result;
-    try
-    {
-      try
-      {
-        result = connection.extendedRequest(request);
-      }
-      catch (final InterruptedException e)
-      {
-        // This shouldn't happen because there are no other threads to
-        // interrupt this one.
-        throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-            e.getLocalizedMessage(), e);
-      }
-    }
-    catch (final ErrorResultException e)
-    {
-      LocalizableMessage message = ERR_LDAPPWMOD_FAILED
-          .get(e.getResult().getResultCode().intValue(), e.getResult()
-              .getResultCode().toString());
-      println(message);
-
-      final String errorMessage = e.getResult().getDiagnosticMessage();
-      if ((errorMessage != null) && (errorMessage.length() > 0))
-      {
-        message = ERR_LDAPPWMOD_FAILURE_ERROR_MESSAGE.get(errorMessage);
-        println(message);
-      }
-
-      final String matchedDN = e.getResult().getMatchedDN();
-      if (matchedDN != null && matchedDN.length() > 0)
-      {
-        message = ERR_LDAPPWMOD_FAILURE_MATCHED_DN.get(matchedDN);
-        println(message);
-      }
-      return e.getResult().getResultCode().intValue();
-    }
-
-    LocalizableMessage message = INFO_LDAPPWMOD_SUCCESSFUL.get();
-    println(message);
-
-    final String additionalInfo = result.getDiagnosticMessage();
-    if ((additionalInfo != null) && (additionalInfo.length() > 0))
-    {
-
-      message = INFO_LDAPPWMOD_ADDITIONAL_INFO.get(additionalInfo);
-      println(message);
-    }
-
-    if (result.getGeneratedPassword() != null)
-    {
-      message = INFO_LDAPPWMOD_GENERATED_PASSWORD.get(result
-          .getGeneratedPassword().toString());
-      println(message);
-    }
-
-    return 0;
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
index 11a373e..27b8331 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,20 +27,47 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
-import java.io.*;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.controls.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
+import org.forgerock.opendj.ldap.controls.Control;
+import org.forgerock.opendj.ldap.controls.EntryChangeNotificationResponseControl;
+import org.forgerock.opendj.ldap.controls.GetEffectiveRightsRequestControl;
+import org.forgerock.opendj.ldap.controls.MatchedValuesRequestControl;
+import org.forgerock.opendj.ldap.controls.PersistentSearchChangeType;
+import org.forgerock.opendj.ldap.controls.PersistentSearchRequestControl;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
+import org.forgerock.opendj.ldap.controls.ServerSideSortRequestControl;
+import org.forgerock.opendj.ldap.controls.ServerSideSortResponseControl;
+import org.forgerock.opendj.ldap.controls.SimplePagedResultsControl;
+import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl;
+import org.forgerock.opendj.ldap.controls.VirtualListViewResponseControl;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.Result;
@@ -53,1100 +79,892 @@
 import com.forgerock.opendj.ldap.controls.AccountUsabilityResponseControl;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * A tool that can be used to issue Search requests to the Directory Server.
  */
-public final class LDAPSearch extends ConsoleApplication
-{
-  private class LDAPSearchResultHandler implements SearchResultHandler
-  {
-    private int entryCount = 0;
+public final class LDAPSearch extends ConsoleApplication {
+    private class LDAPSearchResultHandler implements SearchResultHandler {
+        private int entryCount = 0;
 
+        /**
+         * {@inheritDoc}
+         */
+        public boolean handleEntry(final SearchResultEntry entry) {
+            entryCount++;
 
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean handleEntry(final SearchResultEntry entry)
-    {
-      entryCount++;
-
-      try
-      {
-        final EntryChangeNotificationResponseControl control = entry
-            .getControl(EntryChangeNotificationResponseControl.DECODER,
-                new DecodeOptions());
-        if (control != null)
-        {
-          println(INFO_LDAPSEARCH_PSEARCH_CHANGE_TYPE.get(control
-              .getChangeType().toString()));
-          final DN previousDN = control.getPreviousName();
-          if (previousDN != null)
-          {
-            println(INFO_LDAPSEARCH_PSEARCH_PREVIOUS_DN.get(previousDN
-                .toString()));
-          }
-        }
-      }
-      catch (final DecodeException de)
-      {
-        println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
-      }
-
-      try
-      {
-        final AccountUsabilityResponseControl control = entry.getControl(
-            AccountUsabilityResponseControl.DECODER, new DecodeOptions());
-
-        if (control != null)
-        {
-          println(INFO_LDAPSEARCH_ACCTUSABLE_HEADER.get());
-          if (control.isUsable())
-          {
-
-            println(INFO_LDAPSEARCH_ACCTUSABLE_IS_USABLE.get());
-            if (control.getSecondsBeforeExpiration() > 0)
-            {
-              final int timeToExp = control.getSecondsBeforeExpiration();
-              final LocalizableMessage timeToExpStr = Utils
-                  .secondsToTimeString(timeToExp);
-
-              println(INFO_LDAPSEARCH_ACCTUSABLE_TIME_UNTIL_EXPIRATION
-                  .get(timeToExpStr));
-            }
-          }
-          else
-          {
-
-            println(INFO_LDAPSEARCH_ACCTUSABLE_NOT_USABLE.get());
-            if (control.isInactive())
-            {
-              println(INFO_LDAPSEARCH_ACCTUSABLE_ACCT_INACTIVE.get());
-            }
-            if (control.isReset())
-            {
-              println(INFO_LDAPSEARCH_ACCTUSABLE_PW_RESET.get());
-            }
-            if (control.isExpired())
-            {
-              println(INFO_LDAPSEARCH_ACCTUSABLE_PW_EXPIRED.get());
-
-              if (control.getRemainingGraceLogins() > 0)
-              {
-                println(INFO_LDAPSEARCH_ACCTUSABLE_REMAINING_GRACE.get(control
-                    .getRemainingGraceLogins()));
-              }
-            }
-            if (control.isLocked())
-            {
-              println(INFO_LDAPSEARCH_ACCTUSABLE_LOCKED.get());
-              if (control.getSecondsBeforeUnlock() > 0)
-              {
-                final int timeToUnlock = control.getSecondsBeforeUnlock();
-                final LocalizableMessage timeToUnlockStr = Utils
-                    .secondsToTimeString(timeToUnlock);
-
-                println(INFO_LDAPSEARCH_ACCTUSABLE_TIME_UNTIL_UNLOCK
-                    .get(timeToUnlockStr));
-              }
-            }
-          }
-        }
-      }
-      catch (final DecodeException de)
-      {
-        println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
-      }
-
-      try
-      {
-        ldifWriter.writeEntry(entry);
-        ldifWriter.flush();
-      }
-      catch (final IOException ioe)
-      {
-        // Something is seriously wrong
-        throw new RuntimeException(ioe);
-      }
-      return true;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean handleReference(final SearchResultReference reference)
-    {
-      println(LocalizableMessage.raw(reference.toString()));
-      return true;
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void handleErrorResult(ErrorResultException error)
-    {
-      // Ignore.
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void handleResult(Result result)
-    {
-      // Ignore.
-    }
-  }
-
-
-
-  /**
-   * The main method for LDAPSearch tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDAPSearch().run(args, false);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-
-  private EntryWriter ldifWriter;
-
-
-
-  private LDAPSearch()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args, final boolean returnMatchingEntries)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_LDAPSEARCH_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(LDAPSearch.class
-        .getName(), toolDescription, false, true, 0, 0,
-        "[filter] [attributes ...]");
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-
-    BooleanArgument countEntries;
-    BooleanArgument dontWrap;
-    BooleanArgument noop;
-    BooleanArgument typesOnly;
-    IntegerArgument simplePageSize;
-    IntegerArgument timeLimit;
-    IntegerArgument version;
-    StringArgument baseDN;
-    StringArgument controlStr;
-    MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
-    StringArgument filename;
-    StringArgument matchedValuesFilter;
-    StringArgument pSearchInfo;
-    MultiChoiceArgument<SearchScope> searchScope;
-    StringArgument vlvDescriptor;
-    StringArgument effectiveRightsUser;
-    StringArgument effectiveRightsAttrs;
-    StringArgument sortOrder;
-    StringArgument proxyAuthzID;
-    StringArgument assertionFilter;
-    IntegerArgument sizeLimit;
-    try
-    {
-      connectionFactoryProvider =
-          new ConnectionFactoryProvider(argParser, this);
-      final StringArgument propertiesFileArgument = new StringArgument(
-          "propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH, false, false,
-          true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      final BooleanArgument noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      baseDN = new StringArgument("baseDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_BASEDN, true, false, true, INFO_BASEDN_PLACEHOLDER.get(),
-          null, null, INFO_SEARCH_DESCRIPTION_BASEDN.get());
-      baseDN.setPropertyName(OPTION_LONG_BASEDN);
-      argParser.addArgument(baseDN);
-
-      searchScope = new MultiChoiceArgument<SearchScope>("searchScope", 's',
-          "searchScope", false, true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(),
-          SearchScope.values(), false, INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE
-              .get());
-      searchScope.setPropertyName("searchScope");
-      searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
-      argParser.addArgument(searchScope);
-
-      filename = new StringArgument("filename", OPTION_SHORT_FILENAME,
-          OPTION_LONG_FILENAME, false, false, true,
-          INFO_FILE_PLACEHOLDER.get(), null, null,
-          INFO_SEARCH_DESCRIPTION_FILENAME.get());
-      searchScope.setPropertyName(OPTION_LONG_FILENAME);
-      argParser.addArgument(filename);
-
-      proxyAuthzID = new StringArgument("proxy_authzid",
-          OPTION_SHORT_PROXYAUTHID, OPTION_LONG_PROXYAUTHID, false, false,
-          true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROXY_AUTHZID.get());
-      proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
-      argParser.addArgument(proxyAuthzID);
-
-      pSearchInfo = new StringArgument("psearchinfo", 'C', "persistentSearch",
-          false, false, true, INFO_PSEARCH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PSEARCH_INFO.get());
-      pSearchInfo.setPropertyName("persistentSearch");
-      argParser.addArgument(pSearchInfo);
-
-      simplePageSize = new IntegerArgument("simplepagesize", null,
-          "simplePageSize", false, false, true, INFO_NUM_ENTRIES_PLACEHOLDER
-              .get(), 1000, null, true, 1, false, 0,
-          INFO_DESCRIPTION_SIMPLE_PAGE_SIZE.get());
-      simplePageSize.setPropertyName("simplePageSize");
-      argParser.addArgument(simplePageSize);
-
-      assertionFilter = new StringArgument("assertionfilter", null,
-          OPTION_LONG_ASSERTION_FILE, false, false, true,
-          INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_ASSERTION_FILTER.get());
-      assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-      argParser.addArgument(assertionFilter);
-
-      matchedValuesFilter = new StringArgument("matchedvalues", null,
-          "matchedValuesFilter", false, true, true, INFO_FILTER_PLACEHOLDER
-              .get(), null, null, INFO_DESCRIPTION_MATCHED_VALUES_FILTER.get());
-      matchedValuesFilter.setPropertyName("matchedValuesFilter");
-      argParser.addArgument(matchedValuesFilter);
-
-      sortOrder = new StringArgument("sortorder", 'S', "sortOrder", false,
-          false, true, INFO_SORT_ORDER_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_SORT_ORDER.get());
-      sortOrder.setPropertyName("sortOrder");
-      argParser.addArgument(sortOrder);
-
-      vlvDescriptor = new StringArgument("vlvdescriptor", 'G',
-          "virtualListView", false, false, true, INFO_VLV_PLACEHOLDER.get(),
-          null, null, INFO_DESCRIPTION_VLV.get());
-      vlvDescriptor.setPropertyName("virtualListView");
-      argParser.addArgument(vlvDescriptor);
-
-      controlStr = new StringArgument("control", 'J', "control", false, true,
-          true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_CONTROLS.get());
-      controlStr.setPropertyName("control");
-      argParser.addArgument(controlStr);
-
-      effectiveRightsUser = new StringArgument("effectiveRightsUser",
-          OPTION_SHORT_EFFECTIVERIGHTSUSER, OPTION_LONG_EFFECTIVERIGHTSUSER,
-          false, false, true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_EFFECTIVERIGHTS_USER.get());
-      effectiveRightsUser.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSUSER);
-      argParser.addArgument(effectiveRightsUser);
-
-      effectiveRightsAttrs = new StringArgument("effectiveRightsAttrs",
-          OPTION_SHORT_EFFECTIVERIGHTSATTR, OPTION_LONG_EFFECTIVERIGHTSATTR,
-          false, true, true, INFO_ATTRIBUTE_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_EFFECTIVERIGHTS_ATTR.get());
-      effectiveRightsAttrs.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSATTR);
-      argParser.addArgument(effectiveRightsAttrs);
-
-      version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
-          OPTION_LONG_PROTOCOL_VERSION, false, false, true,
-          INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
-          INFO_DESCRIPTION_VERSION.get());
-      version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
-      argParser.addArgument(version);
-
-      final StringArgument encodingStr = new StringArgument("encoding", 'i',
-          "encoding", false, false, true, INFO_ENCODING_PLACEHOLDER.get(),
-          null, null, INFO_DESCRIPTION_ENCODING.get());
-      encodingStr.setPropertyName("encoding");
-      argParser.addArgument(encodingStr);
-
-      dereferencePolicy = new MultiChoiceArgument<DereferenceAliasesPolicy>(
-          "derefpolicy", 'a', "dereferencePolicy", false, true,
-          INFO_DEREFERENCE_POLICE_PLACEHOLDER.get(), DereferenceAliasesPolicy
-              .values(), false, INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY
-              .get());
-      dereferencePolicy.setPropertyName("dereferencePolicy");
-      dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
-      argParser.addArgument(dereferencePolicy);
-
-      typesOnly = new BooleanArgument("typesOnly", 'A', "typesOnly",
-          INFO_DESCRIPTION_TYPES_ONLY.get());
-      typesOnly.setPropertyName("typesOnly");
-      argParser.addArgument(typesOnly);
-
-      sizeLimit = new IntegerArgument("sizeLimit", 'z', "sizeLimit", false,
-          false, true, INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
-          INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
-      sizeLimit.setPropertyName("sizeLimit");
-      argParser.addArgument(sizeLimit);
-
-      timeLimit = new IntegerArgument("timeLimit", 'l', "timeLimit", false,
-          false, true, INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
-          INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
-      timeLimit.setPropertyName("timeLimit");
-      argParser.addArgument(timeLimit);
-
-      dontWrap = new BooleanArgument("dontwrap", 't', "dontWrap",
-          INFO_DESCRIPTION_DONT_WRAP.get());
-      dontWrap.setPropertyName("dontWrap");
-      argParser.addArgument(dontWrap);
-
-      countEntries = new BooleanArgument("countentries", null, "countEntries",
-          INFO_DESCRIPTION_COUNT_ENTRIES.get());
-      countEntries.setPropertyName("countEntries");
-      argParser.addArgument(countEntries);
-
-      final BooleanArgument continueOnError = new BooleanArgument(
-          "continueOnError", 'c', "continueOnError",
-          INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
-      continueOnError.setPropertyName("continueOnError");
-      argParser.addArgument(continueOnError);
-
-      noop = new BooleanArgument("noop", OPTION_SHORT_DRYRUN,
-          OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get());
-      noop.setPropertyName(OPTION_LONG_DRYRUN);
-      argParser.addArgument(noop);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      final BooleanArgument showUsage = new BooleanArgument("showUsage",
-          OPTION_SHORT_HELP, OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
-
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-
-      connectionFactory =
-          connectionFactoryProvider.getAuthenticatedConnectionFactory();
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    final List<Filter> filters = new LinkedList<Filter>();
-    final List<String> attributes = new LinkedList<String>();
-    final ArrayList<String> filterAndAttributeStrings = argParser
-        .getTrailingArguments();
-    if (filterAndAttributeStrings.size() > 0)
-    {
-      // the list of trailing arguments should be structured as follow:
-      // - If a filter file is present, trailing arguments are
-      // considered as attributes
-      // - If filter file is not present, the first trailing argument is
-      // considered the filter, the other as attributes.
-      if (!filename.isPresent())
-      {
-        final String filterString = filterAndAttributeStrings.remove(0);
-
-        try
-        {
-          filters.add(Filter.valueOf(filterString));
-        }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          println(e.getMessageObject());
-          return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-        }
-      }
-      // The rest are attributes
-      for (final String s : filterAndAttributeStrings)
-      {
-        attributes.add(s);
-      }
-    }
-
-    if (filename.isPresent())
-    {
-      // Read the filter strings.
-      BufferedReader in = null;
-      try
-      {
-        in = new BufferedReader(new FileReader(filename.getValue()));
-        String line = null;
-
-        while ((line = in.readLine()) != null)
-        {
-          if (line.trim().equals(""))
-          {
-            // ignore empty lines.
-            continue;
-          }
-          final Filter ldapFilter = Filter.valueOf(line);
-          filters.add(ldapFilter);
-        }
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        println(e.getMessageObject());
-        return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-      }
-      catch (final IOException e)
-      {
-        println(LocalizableMessage.raw(e.toString()));
-        return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-      }
-      finally
-      {
-        if (in != null)
-        {
-          try
-          {
-            in.close();
-          }
-          catch (final IOException ioe)
-          {
-          }
-        }
-      }
-    }
-
-    if (filters.isEmpty())
-    {
-      println(ERR_SEARCH_NO_FILTERS.get());
-      println(argParser.getUsageMessage());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    SearchScope scope;
-    try
-    {
-      scope = searchScope.getTypedValue();
-    }
-    catch (final ArgumentException ex1)
-    {
-      println(ex1.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    SearchRequest search;
-    try
-    {
-      search = Requests.newSearchRequest(DN.valueOf(baseDN.getValue()), scope,
-          filters.get(0), attributes.toArray(new String[attributes.size()]));
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      println(e.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    // Read the LDAP version number.
-    try
-    {
-      final int versionNumber = version.getIntValue();
-      if (versionNumber != 2 && versionNumber != 3)
-      {
-        println(ERR_DESCRIPTION_INVALID_VERSION.get(String
-            .valueOf(versionNumber)));
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version
-          .getValue())));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    search.setTypesOnly(typesOnly.isPresent());
-    // searchOptions.setShowOperations(noop.isPresent());
-    // searchOptions.setVerbose(verbose.isPresent());
-    // searchOptions.setContinueOnError(continueOnError.isPresent());
-    // searchOptions.setEncoding(encodingStr.getValue());
-    // searchOptions.setCountMatchingEntries(countEntries.isPresent());
-    try
-    {
-      search.setTimeLimit(timeLimit.getIntValue());
-      search.setSizeLimit(sizeLimit.getIntValue());
-    }
-    catch (final ArgumentException ex1)
-    {
-      println(ex1.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-    try
-    {
-      search.setDereferenceAliasesPolicy(dereferencePolicy.getTypedValue());
-    }
-    catch (final ArgumentException ex1)
-    {
-      println(ex1.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    if (controlStr.isPresent())
-    {
-      for (final String ctrlString : controlStr.getValues())
-      {
-        try
-        {
-          final Control ctrl = Utils.getControl(ctrlString);
-          search.addControl(ctrl);
-        }
-        catch (final DecodeException de)
-        {
-          final LocalizableMessage message = ERR_TOOL_INVALID_CONTROL_STRING
-              .get(ctrlString);
-          println(message);
-          ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-    }
-
-    if (effectiveRightsUser.isPresent())
-    {
-      final String authzID = effectiveRightsUser.getValue();
-      if (!authzID.startsWith("dn:"))
-      {
-        final LocalizableMessage message = ERR_EFFECTIVERIGHTS_INVALID_AUTHZID
-            .get(authzID);
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-      final Control effectiveRightsControl = GetEffectiveRightsRequestControl
-          .newControl(false, authzID.substring(3), effectiveRightsAttrs
-              .getValues().toArray(
-                  new String[effectiveRightsAttrs.getValues().size()]));
-      search.addControl(effectiveRightsControl);
-    }
-
-    if (proxyAuthzID.isPresent())
-    {
-      final Control proxyControl = ProxiedAuthV2RequestControl
-          .newControl(proxyAuthzID.getValue());
-      search.addControl(proxyControl);
-    }
-
-    if (pSearchInfo.isPresent())
-    {
-      final String infoString = StaticUtils.toLowerCase(pSearchInfo.getValue()
-          .trim());
-      boolean changesOnly = true;
-      boolean returnECs = true;
-
-      final StringTokenizer tokenizer = new StringTokenizer(infoString, ":");
-
-      if (!tokenizer.hasMoreTokens())
-      {
-        final LocalizableMessage message = ERR_PSEARCH_MISSING_DESCRIPTOR.get();
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-      else
-      {
-        final String token = tokenizer.nextToken();
-        if (!token.equals("ps"))
-        {
-          final LocalizableMessage message = ERR_PSEARCH_DOESNT_START_WITH_PS
-              .get(String.valueOf(infoString));
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-
-      final ArrayList<PersistentSearchChangeType> ct = new ArrayList<PersistentSearchChangeType>(
-          4);
-      if (tokenizer.hasMoreTokens())
-      {
-        final StringTokenizer st = new StringTokenizer(tokenizer.nextToken(),
-            ", ");
-        if (!st.hasMoreTokens())
-        {
-          ct.add(PersistentSearchChangeType.ADD);
-          ct.add(PersistentSearchChangeType.DELETE);
-          ct.add(PersistentSearchChangeType.MODIFY);
-          ct.add(PersistentSearchChangeType.MODIFY_DN);
-        }
-        else
-        {
-          do
-          {
-            final String token = st.nextToken();
-            if (token.equals("add"))
-            {
-              ct.add(PersistentSearchChangeType.ADD);
-            }
-            else if (token.equals("delete") || token.equals("del"))
-            {
-              ct.add(PersistentSearchChangeType.DELETE);
-            }
-            else if (token.equals("modify") || token.equals("mod"))
-            {
-              ct.add(PersistentSearchChangeType.MODIFY);
-            }
-            else if (token.equals("modifydn") || token.equals("moddn")
-                || token.equals("modrdn"))
-            {
-              ct.add(PersistentSearchChangeType.MODIFY_DN);
-            }
-            else if (token.equals("any") || token.equals("all"))
-            {
-              ct.add(PersistentSearchChangeType.ADD);
-              ct.add(PersistentSearchChangeType.DELETE);
-              ct.add(PersistentSearchChangeType.MODIFY);
-              ct.add(PersistentSearchChangeType.MODIFY_DN);
-            }
-            else
-            {
-              final LocalizableMessage message = ERR_PSEARCH_INVALID_CHANGE_TYPE
-                  .get(String.valueOf(token));
-              println(message);
-              return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-            }
-          }
-          while (st.hasMoreTokens());
-        }
-      }
-
-      if (tokenizer.hasMoreTokens())
-      {
-        final String token = tokenizer.nextToken();
-        if (token.equals("1") || token.equals("true") || token.equals("yes"))
-        {
-          changesOnly = true;
-        }
-        else if (token.equals("0") || token.equals("false")
-            || token.equals("no"))
-        {
-          changesOnly = false;
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_PSEARCH_INVALID_CHANGESONLY
-              .get(String.valueOf(token));
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-
-      if (tokenizer.hasMoreTokens())
-      {
-        final String token = tokenizer.nextToken();
-        if (token.equals("1") || token.equals("true") || token.equals("yes"))
-        {
-          returnECs = true;
-        }
-        else if (token.equals("0") || token.equals("false")
-            || token.equals("no"))
-        {
-          returnECs = false;
-        }
-        else
-        {
-          final LocalizableMessage message = ERR_PSEARCH_INVALID_RETURN_ECS
-              .get(String.valueOf(token));
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-
-      final PersistentSearchRequestControl psearchControl = PersistentSearchRequestControl
-          .newControl(true, changesOnly, returnECs, ct
-              .toArray(new PersistentSearchChangeType[ct.size()]));
-      search.addControl(psearchControl);
-    }
-
-    if (assertionFilter.isPresent())
-    {
-      final String filterString = assertionFilter.getValue();
-      Filter filter;
-      try
-      {
-        filter = Filter.valueOf(filterString);
-
-        // FIXME -- Change this to the correct OID when the official one
-        // is assigned.
-        final Control assertionControl = AssertionRequestControl.newControl(
-            true, filter);
-        search.addControl(assertionControl);
-      }
-      catch (final LocalizedIllegalArgumentException le)
-      {
-        final LocalizableMessage message = ERR_LDAP_ASSERTION_INVALID_FILTER
-            .get(le.getMessage());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    if (matchedValuesFilter.isPresent())
-    {
-      final LinkedList<String> mvFilterStrings = matchedValuesFilter
-          .getValues();
-      final List<Filter> mvFilters = new ArrayList<Filter>();
-      for (final String s : mvFilterStrings)
-      {
-        try
-        {
-          final Filter f = Filter.valueOf(s);
-          mvFilters.add(f);
-        }
-        catch (final LocalizedIllegalArgumentException le)
-        {
-          final LocalizableMessage message = ERR_LDAP_MATCHEDVALUES_INVALID_FILTER
-              .get(le.getMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-
-      final MatchedValuesRequestControl mvc = MatchedValuesRequestControl
-          .newControl(true, mvFilters);
-      search.addControl(mvc);
-    }
-
-    if (sortOrder.isPresent())
-    {
-      try
-      {
-        search.addControl(ServerSideSortRequestControl.newControl(false,
-            sortOrder.getValue()));
-      }
-      catch (final LocalizedIllegalArgumentException le)
-      {
-        final LocalizableMessage message = ERR_LDAP_SORTCONTROL_INVALID_ORDER
-            .get(le.getMessageObject());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    if (vlvDescriptor.isPresent())
-    {
-      if (!sortOrder.isPresent())
-      {
-        final LocalizableMessage message = ERR_LDAPSEARCH_VLV_REQUIRES_SORT
-            .get(vlvDescriptor.getLongIdentifier(), sortOrder
-                .getLongIdentifier());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-
-      final StringTokenizer tokenizer = new StringTokenizer(vlvDescriptor
-          .getValue(), ":");
-      final int numTokens = tokenizer.countTokens();
-      if (numTokens == 3)
-      {
-        try
-        {
-          final int beforeCount = Integer.parseInt(tokenizer.nextToken());
-          final int afterCount = Integer.parseInt(tokenizer.nextToken());
-          final ByteString assertionValue = ByteString.valueOf(tokenizer
-              .nextToken());
-          search.addControl(VirtualListViewRequestControl.newAssertionControl(
-              true, assertionValue, beforeCount, afterCount, null));
-        }
-        catch (final Exception e)
-        {
-          final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR
-              .get();
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-      else if (numTokens == 4)
-      {
-        try
-        {
-          final int beforeCount = Integer.parseInt(tokenizer.nextToken());
-          final int afterCount = Integer.parseInt(tokenizer.nextToken());
-          final int offset = Integer.parseInt(tokenizer.nextToken());
-          final int contentCount = Integer.parseInt(tokenizer.nextToken());
-          search.addControl(VirtualListViewRequestControl.newOffsetControl(
-              true, offset, contentCount, beforeCount, afterCount, null));
-        }
-        catch (final Exception e)
-        {
-          final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR
-              .get();
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-      else
-      {
-        final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR
-            .get();
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-
-    int pageSize = 0;
-    if (simplePageSize.isPresent())
-    {
-      if (filters.size() > 1)
-      {
-        final LocalizableMessage message = ERR_PAGED_RESULTS_REQUIRES_SINGLE_FILTER
-            .get();
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-
-      try
-      {
-        pageSize = simplePageSize.getIntValue();
-        search.addControl(SimplePagedResultsControl.newControl(true, pageSize,
-            ByteString.empty()));
-      }
-      catch (final ArgumentException ae)
-      {
-        final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-            .getMessage());
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-    }
-    /*
-     * if(connectionOptions.useSASLExternal()) { if(!connectionOptions.useSSL()
-     * && !connectionOptions.useStartTLS()) { LocalizableMessage message =
-     * ERR_TOOL_SASLEXTERNAL_NEEDS_SSL_OR_TLS.get();
-     * err.println(wrapText(message, MAX_LINE_WIDTH)); return
-     * CLIENT_SIDE_PARAM_ERROR; } if(keyStorePathValue == null) {
-     * LocalizableMessage message = ERR_TOOL_SASLEXTERNAL_NEEDS_KEYSTORE.get();
-     * err.println(wrapText(message, MAX_LINE_WIDTH)); return
-     * CLIENT_SIDE_PARAM_ERROR; } }
-     * connectionOptions.setVerbose(verbose.isPresent());
-     */
-
-    int wrapColumn = 80;
-    if (dontWrap.isPresent())
-    {
-      wrapColumn = 0;
-    }
-
-    if (noop.isPresent())
-    {
-      // We don't actually need to open a connection or perform the
-      // search, so we're done. We should return 0 to either mean that the
-      // processing was successful or that there were no matching entries, based
-      // on countEntries.isPresent() (but in either case the return value should
-      // be zero).
-      return 0;
-    }
-
-    Connection connection;
-    try
-    {
-      connection = connectionFactory.getConnection();
-    }
-    catch (final ErrorResultException ere)
-    {
-      return Utils.printErrorMessage(this, ere);
-    }
-    catch (final InterruptedException e)
-    {
-      // This shouldn't happen because there are no other threads to
-      // interrupt this one.
-      println(LocalizableMessage.raw(e.getLocalizedMessage()));
-      return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
-    }
-
-    Utils.printPasswordPolicyResults(this, connection);
-
-    try
-    {
-      int filterIndex = 0;
-      ldifWriter = new LDIFEntryWriter(getOutputStream())
-          .setWrapColumn(wrapColumn);
-      final LDAPSearchResultHandler resultHandler = new LDAPSearchResultHandler();
-      while (true)
-      {
-        Result result;
-        try
-        {
-          result = connection.search(search, resultHandler);
-        }
-        catch (final InterruptedException e)
-        {
-          // This shouldn't happen because there are no other threads to
-          // interrupt this one.
-          throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
-              e.getLocalizedMessage(), e);
-        }
-
-        try
-        {
-          final ServerSideSortResponseControl control = result.getControl(
-              ServerSideSortResponseControl.DECODER, new DecodeOptions());
-          if (control != null)
-          {
-            if (control.getResult() != ResultCode.SUCCESS)
-            {
-              final LocalizableMessage msg = WARN_LDAPSEARCH_SORT_ERROR
-                  .get(control.getResult().toString());
-              println(msg);
-            }
-          }
-        }
-        catch (final DecodeException e)
-        {
-          println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-        }
-
-        try
-        {
-          final VirtualListViewResponseControl control = result.getControl(
-              VirtualListViewResponseControl.DECODER, new DecodeOptions());
-          if (control != null)
-          {
-            if (control.getResult() == ResultCode.SUCCESS)
-            {
-              LocalizableMessage msg = INFO_LDAPSEARCH_VLV_TARGET_OFFSET
-                  .get(control.getTargetPosition());
-              println(msg);
-
-              msg = INFO_LDAPSEARCH_VLV_CONTENT_COUNT.get(control
-                  .getContentCount());
-              println(msg);
-            }
-            else
-            {
-              final LocalizableMessage msg = WARN_LDAPSEARCH_VLV_ERROR
-                  .get(control.getResult().toString());
-              println(msg);
-            }
-          }
-        }
-        catch (final DecodeException e)
-        {
-          println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-        }
-
-        try
-        {
-          SimplePagedResultsControl control = result.getControl(
-              SimplePagedResultsControl.DECODER, new DecodeOptions());
-          if (control != null)
-          {
-            if (control.getCookie().length() > 0)
-            {
-              if (!isQuiet())
-              {
-                pressReturnToContinue();
-              }
-              final Iterator<Control> iterator = search.getControls()
-                  .iterator();
-              while (iterator.hasNext())
-              {
-                if (iterator.next().getOID().equals(
-                    SimplePagedResultsControl.OID))
-                {
-                  iterator.remove();
+            try {
+                final EntryChangeNotificationResponseControl control =
+                        entry.getControl(EntryChangeNotificationResponseControl.DECODER,
+                                new DecodeOptions());
+                if (control != null) {
+                    println(INFO_LDAPSEARCH_PSEARCH_CHANGE_TYPE.get(control.getChangeType()
+                            .toString()));
+                    final DN previousDN = control.getPreviousName();
+                    if (previousDN != null) {
+                        println(INFO_LDAPSEARCH_PSEARCH_PREVIOUS_DN.get(previousDN.toString()));
+                    }
                 }
-              }
-              control = SimplePagedResultsControl.newControl(true, pageSize,
-                  control.getCookie());
-              search.addControl(control);
-              continue;
+            } catch (final DecodeException de) {
+                println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
             }
-          }
-        }
-        catch (final DecodeException e)
-        {
-          println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+
+            try {
+                final AccountUsabilityResponseControl control =
+                        entry.getControl(AccountUsabilityResponseControl.DECODER,
+                                new DecodeOptions());
+
+                if (control != null) {
+                    println(INFO_LDAPSEARCH_ACCTUSABLE_HEADER.get());
+                    if (control.isUsable()) {
+
+                        println(INFO_LDAPSEARCH_ACCTUSABLE_IS_USABLE.get());
+                        if (control.getSecondsBeforeExpiration() > 0) {
+                            final int timeToExp = control.getSecondsBeforeExpiration();
+                            final LocalizableMessage timeToExpStr =
+                                    Utils.secondsToTimeString(timeToExp);
+
+                            println(INFO_LDAPSEARCH_ACCTUSABLE_TIME_UNTIL_EXPIRATION
+                                    .get(timeToExpStr));
+                        }
+                    } else {
+
+                        println(INFO_LDAPSEARCH_ACCTUSABLE_NOT_USABLE.get());
+                        if (control.isInactive()) {
+                            println(INFO_LDAPSEARCH_ACCTUSABLE_ACCT_INACTIVE.get());
+                        }
+                        if (control.isReset()) {
+                            println(INFO_LDAPSEARCH_ACCTUSABLE_PW_RESET.get());
+                        }
+                        if (control.isExpired()) {
+                            println(INFO_LDAPSEARCH_ACCTUSABLE_PW_EXPIRED.get());
+
+                            if (control.getRemainingGraceLogins() > 0) {
+                                println(INFO_LDAPSEARCH_ACCTUSABLE_REMAINING_GRACE.get(control
+                                        .getRemainingGraceLogins()));
+                            }
+                        }
+                        if (control.isLocked()) {
+                            println(INFO_LDAPSEARCH_ACCTUSABLE_LOCKED.get());
+                            if (control.getSecondsBeforeUnlock() > 0) {
+                                final int timeToUnlock = control.getSecondsBeforeUnlock();
+                                final LocalizableMessage timeToUnlockStr =
+                                        Utils.secondsToTimeString(timeToUnlock);
+
+                                println(INFO_LDAPSEARCH_ACCTUSABLE_TIME_UNTIL_UNLOCK
+                                        .get(timeToUnlockStr));
+                            }
+                        }
+                    }
+                }
+            } catch (final DecodeException de) {
+                println(ERR_DECODE_CONTROL_FAILURE.get(de.getLocalizedMessage()));
+            }
+
+            try {
+                ldifWriter.writeEntry(entry);
+                ldifWriter.flush();
+            } catch (final IOException ioe) {
+                // Something is seriously wrong
+                throw new RuntimeException(ioe);
+            }
+            return true;
         }
 
-        println();
-        println(ERR_TOOL_RESULT_CODE.get(result.getResultCode().intValue(),
-            result.getResultCode().toString()));
-        if ((result.getDiagnosticMessage() != null)
-            && (result.getDiagnosticMessage().length() > 0))
-        {
-          println(LocalizableMessage.raw(result.getDiagnosticMessage()));
-        }
-        if (result.getMatchedDN() != null && result.getMatchedDN().length() > 0)
-        {
-          println(ERR_TOOL_MATCHED_DN.get(result.getMatchedDN()));
+        /**
+         * {@inheritDoc}
+         */
+        public boolean handleReference(final SearchResultReference reference) {
+            println(LocalizableMessage.raw(reference.toString()));
+            return true;
         }
 
-        filterIndex++;
-        if (filterIndex < filters.size())
-        {
-          search.setFilter(filters.get(filterIndex));
+        /**
+         * {@inheritDoc}
+         */
+        public void handleErrorResult(ErrorResultException error) {
+            // Ignore.
         }
-        else
-        {
-          break;
+
+        /**
+         * {@inheritDoc}
+         */
+        public void handleResult(Result result) {
+            // Ignore.
         }
-      }
-      if (countEntries.isPresent() && !isQuiet())
-      {
-        final LocalizableMessage message = INFO_LDAPSEARCH_MATCHING_ENTRY_COUNT
-            .get(resultHandler.entryCount);
-        println(message);
-        println();
-      }
-    }
-    catch (final ErrorResultException ere)
-    {
-      return Utils.printErrorMessage(this, ere);
-    }
-    finally
-    {
-      connection.close();
     }
 
-    return 0;
-  }
+    /**
+     * The main method for LDAPSearch tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
+
+    public static void main(final String[] args) {
+        final int retCode = new LDAPSearch().run(args, false);
+        System.exit(filterExitCode(retCode));
+    }
+
+    private BooleanArgument verbose;
+
+    private EntryWriter ldifWriter;
+
+    private LDAPSearch() {
+        // Nothing to do.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isVerbose() {
+        return verbose.isPresent();
+    }
+
+    private int run(final String[] args, final boolean returnMatchingEntries) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_LDAPSEARCH_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDAPSearch.class.getName(), toolDescription, false, true, 0, 0,
+                        "[filter] [attributes ...]");
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+
+        BooleanArgument countEntries;
+        BooleanArgument dontWrap;
+        BooleanArgument noop;
+        BooleanArgument typesOnly;
+        IntegerArgument simplePageSize;
+        IntegerArgument timeLimit;
+        IntegerArgument version;
+        StringArgument baseDN;
+        StringArgument controlStr;
+        MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
+        StringArgument filename;
+        StringArgument matchedValuesFilter;
+        StringArgument pSearchInfo;
+        MultiChoiceArgument<SearchScope> searchScope;
+        StringArgument vlvDescriptor;
+        StringArgument effectiveRightsUser;
+        StringArgument effectiveRightsAttrs;
+        StringArgument sortOrder;
+        StringArgument proxyAuthzID;
+        StringArgument assertionFilter;
+        IntegerArgument sizeLimit;
+        try {
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            final StringArgument propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            final BooleanArgument noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            baseDN =
+                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true,
+                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCH_DESCRIPTION_BASEDN.get());
+            baseDN.setPropertyName(OPTION_LONG_BASEDN);
+            argParser.addArgument(baseDN);
+
+            searchScope =
+                    new MultiChoiceArgument<SearchScope>("searchScope", 's', "searchScope", false,
+                            true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(), SearchScope.values(), false,
+                            INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
+            searchScope.setPropertyName("searchScope");
+            searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
+            argParser.addArgument(searchScope);
+
+            filename =
+                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
+                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCH_DESCRIPTION_FILENAME.get());
+            searchScope.setPropertyName(OPTION_LONG_FILENAME);
+            argParser.addArgument(filename);
+
+            proxyAuthzID =
+                    new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID,
+                            OPTION_LONG_PROXYAUTHID, false, false, true,
+                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROXY_AUTHZID.get());
+            proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
+            argParser.addArgument(proxyAuthzID);
+
+            pSearchInfo =
+                    new StringArgument("psearchinfo", 'C', "persistentSearch", false, false, true,
+                            INFO_PSEARCH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PSEARCH_INFO.get());
+            pSearchInfo.setPropertyName("persistentSearch");
+            argParser.addArgument(pSearchInfo);
+
+            simplePageSize =
+                    new IntegerArgument("simplepagesize", null, "simplePageSize", false, false,
+                            true, INFO_NUM_ENTRIES_PLACEHOLDER.get(), 1000, null, true, 1, false,
+                            0, INFO_DESCRIPTION_SIMPLE_PAGE_SIZE.get());
+            simplePageSize.setPropertyName("simplePageSize");
+            argParser.addArgument(simplePageSize);
+
+            assertionFilter =
+                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
+                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
+            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
+            argParser.addArgument(assertionFilter);
+
+            matchedValuesFilter =
+                    new StringArgument("matchedvalues", null, "matchedValuesFilter", false, true,
+                            true, INFO_FILTER_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_MATCHED_VALUES_FILTER.get());
+            matchedValuesFilter.setPropertyName("matchedValuesFilter");
+            argParser.addArgument(matchedValuesFilter);
+
+            sortOrder =
+                    new StringArgument("sortorder", 'S', "sortOrder", false, false, true,
+                            INFO_SORT_ORDER_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_SORT_ORDER.get());
+            sortOrder.setPropertyName("sortOrder");
+            argParser.addArgument(sortOrder);
+
+            vlvDescriptor =
+                    new StringArgument("vlvdescriptor", 'G', "virtualListView", false, false, true,
+                            INFO_VLV_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_VLV.get());
+            vlvDescriptor.setPropertyName("virtualListView");
+            argParser.addArgument(vlvDescriptor);
+
+            controlStr =
+                    new StringArgument("control", 'J', "control", false, true, true,
+                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_CONTROLS.get());
+            controlStr.setPropertyName("control");
+            argParser.addArgument(controlStr);
+
+            effectiveRightsUser =
+                    new StringArgument("effectiveRightsUser", OPTION_SHORT_EFFECTIVERIGHTSUSER,
+                            OPTION_LONG_EFFECTIVERIGHTSUSER, false, false, true,
+                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_EFFECTIVERIGHTS_USER.get());
+            effectiveRightsUser.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSUSER);
+            argParser.addArgument(effectiveRightsUser);
+
+            effectiveRightsAttrs =
+                    new StringArgument("effectiveRightsAttrs", OPTION_SHORT_EFFECTIVERIGHTSATTR,
+                            OPTION_LONG_EFFECTIVERIGHTSATTR, false, true, true,
+                            INFO_ATTRIBUTE_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_EFFECTIVERIGHTS_ATTR.get());
+            effectiveRightsAttrs.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSATTR);
+            argParser.addArgument(effectiveRightsAttrs);
+
+            version =
+                    new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
+                            OPTION_LONG_PROTOCOL_VERSION, false, false, true,
+                            INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
+                            INFO_DESCRIPTION_VERSION.get());
+            version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
+            argParser.addArgument(version);
+
+            final StringArgument encodingStr =
+                    new StringArgument("encoding", 'i', "encoding", false, false, true,
+                            INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING
+                                    .get());
+            encodingStr.setPropertyName("encoding");
+            argParser.addArgument(encodingStr);
+
+            dereferencePolicy =
+                    new MultiChoiceArgument<DereferenceAliasesPolicy>("derefpolicy", 'a',
+                            "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER
+                                    .get(), DereferenceAliasesPolicy.values(), false,
+                            INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
+            dereferencePolicy.setPropertyName("dereferencePolicy");
+            dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
+            argParser.addArgument(dereferencePolicy);
+
+            typesOnly =
+                    new BooleanArgument("typesOnly", 'A', "typesOnly", INFO_DESCRIPTION_TYPES_ONLY
+                            .get());
+            typesOnly.setPropertyName("typesOnly");
+            argParser.addArgument(typesOnly);
+
+            sizeLimit =
+                    new IntegerArgument("sizeLimit", 'z', "sizeLimit", false, false, true,
+                            INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
+                            INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
+            sizeLimit.setPropertyName("sizeLimit");
+            argParser.addArgument(sizeLimit);
+
+            timeLimit =
+                    new IntegerArgument("timeLimit", 'l', "timeLimit", false, false, true,
+                            INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
+                            INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
+            timeLimit.setPropertyName("timeLimit");
+            argParser.addArgument(timeLimit);
+
+            dontWrap =
+                    new BooleanArgument("dontwrap", 't', "dontWrap", INFO_DESCRIPTION_DONT_WRAP
+                            .get());
+            dontWrap.setPropertyName("dontWrap");
+            argParser.addArgument(dontWrap);
+
+            countEntries =
+                    new BooleanArgument("countentries", null, "countEntries",
+                            INFO_DESCRIPTION_COUNT_ENTRIES.get());
+            countEntries.setPropertyName("countEntries");
+            argParser.addArgument(countEntries);
+
+            final BooleanArgument continueOnError =
+                    new BooleanArgument("continueOnError", 'c', "continueOnError",
+                            INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
+            continueOnError.setPropertyName("continueOnError");
+            argParser.addArgument(continueOnError);
+
+            noop =
+                    new BooleanArgument("noop", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN,
+                            INFO_DESCRIPTION_NOOP.get());
+            noop.setPropertyName(OPTION_LONG_DRYRUN);
+            argParser.addArgument(noop);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            final BooleanArgument showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        final List<Filter> filters = new LinkedList<Filter>();
+        final List<String> attributes = new LinkedList<String>();
+        final ArrayList<String> filterAndAttributeStrings = argParser.getTrailingArguments();
+        if (filterAndAttributeStrings.size() > 0) {
+            // the list of trailing arguments should be structured as follow:
+            // - If a filter file is present, trailing arguments are
+            // considered as attributes
+            // - If filter file is not present, the first trailing argument is
+            // considered the filter, the other as attributes.
+            if (!filename.isPresent()) {
+                final String filterString = filterAndAttributeStrings.remove(0);
+
+                try {
+                    filters.add(Filter.valueOf(filterString));
+                } catch (final LocalizedIllegalArgumentException e) {
+                    println(e.getMessageObject());
+                    return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+                }
+            }
+            // The rest are attributes
+            for (final String s : filterAndAttributeStrings) {
+                attributes.add(s);
+            }
+        }
+
+        if (filename.isPresent()) {
+            // Read the filter strings.
+            BufferedReader in = null;
+            try {
+                in = new BufferedReader(new FileReader(filename.getValue()));
+                String line = null;
+
+                while ((line = in.readLine()) != null) {
+                    if (line.trim().equals("")) {
+                        // ignore empty lines.
+                        continue;
+                    }
+                    final Filter ldapFilter = Filter.valueOf(line);
+                    filters.add(ldapFilter);
+                }
+            } catch (final LocalizedIllegalArgumentException e) {
+                println(e.getMessageObject());
+                return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+            } catch (final IOException e) {
+                println(LocalizableMessage.raw(e.toString()));
+                return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+            } finally {
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (final IOException ioe) {
+                        // Ignored.
+                    }
+                }
+            }
+        }
+
+        if (filters.isEmpty()) {
+            println(ERR_SEARCH_NO_FILTERS.get());
+            println(argParser.getUsageMessage());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        SearchScope scope;
+        try {
+            scope = searchScope.getTypedValue();
+        } catch (final ArgumentException ex1) {
+            println(ex1.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        SearchRequest search;
+        try {
+            search =
+                    Requests.newSearchRequest(DN.valueOf(baseDN.getValue()), scope, filters.get(0),
+                            attributes.toArray(new String[attributes.size()]));
+        } catch (final LocalizedIllegalArgumentException e) {
+            println(e.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Read the LDAP version number.
+        try {
+            final int versionNumber = version.getIntValue();
+            if (versionNumber != 2 && versionNumber != 3) {
+                println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(versionNumber)));
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        } catch (final ArgumentException ae) {
+            println(ERR_DESCRIPTION_INVALID_VERSION.get(String.valueOf(version.getValue())));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        search.setTypesOnly(typesOnly.isPresent());
+        // searchOptions.setShowOperations(noop.isPresent());
+        // searchOptions.setVerbose(verbose.isPresent());
+        // searchOptions.setContinueOnError(continueOnError.isPresent());
+        // searchOptions.setEncoding(encodingStr.getValue());
+        // searchOptions.setCountMatchingEntries(countEntries.isPresent());
+        try {
+            search.setTimeLimit(timeLimit.getIntValue());
+            search.setSizeLimit(sizeLimit.getIntValue());
+        } catch (final ArgumentException ex1) {
+            println(ex1.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+        try {
+            search.setDereferenceAliasesPolicy(dereferencePolicy.getTypedValue());
+        } catch (final ArgumentException ex1) {
+            println(ex1.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        if (controlStr.isPresent()) {
+            for (final String ctrlString : controlStr.getValues()) {
+                try {
+                    final Control ctrl = Utils.getControl(ctrlString);
+                    search.addControl(ctrl);
+                } catch (final DecodeException de) {
+                    final LocalizableMessage message =
+                            ERR_TOOL_INVALID_CONTROL_STRING.get(ctrlString);
+                    println(message);
+                    ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+        }
+
+        if (effectiveRightsUser.isPresent()) {
+            final String authzID = effectiveRightsUser.getValue();
+            if (!authzID.startsWith("dn:")) {
+                final LocalizableMessage message = ERR_EFFECTIVERIGHTS_INVALID_AUTHZID.get(authzID);
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+            final Control effectiveRightsControl =
+                    GetEffectiveRightsRequestControl.newControl(false, authzID.substring(3),
+                            effectiveRightsAttrs.getValues().toArray(
+                                    new String[effectiveRightsAttrs.getValues().size()]));
+            search.addControl(effectiveRightsControl);
+        }
+
+        if (proxyAuthzID.isPresent()) {
+            final Control proxyControl =
+                    ProxiedAuthV2RequestControl.newControl(proxyAuthzID.getValue());
+            search.addControl(proxyControl);
+        }
+
+        if (pSearchInfo.isPresent()) {
+            final String infoString = StaticUtils.toLowerCase(pSearchInfo.getValue().trim());
+            boolean changesOnly = true;
+            boolean returnECs = true;
+
+            final StringTokenizer tokenizer = new StringTokenizer(infoString, ":");
+
+            if (!tokenizer.hasMoreTokens()) {
+                final LocalizableMessage message = ERR_PSEARCH_MISSING_DESCRIPTOR.get();
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            } else {
+                final String token = tokenizer.nextToken();
+                if (!token.equals("ps")) {
+                    final LocalizableMessage message =
+                            ERR_PSEARCH_DOESNT_START_WITH_PS.get(String.valueOf(infoString));
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            final ArrayList<PersistentSearchChangeType> ct =
+                    new ArrayList<PersistentSearchChangeType>(4);
+            if (tokenizer.hasMoreTokens()) {
+                final StringTokenizer st = new StringTokenizer(tokenizer.nextToken(), ", ");
+                if (!st.hasMoreTokens()) {
+                    ct.add(PersistentSearchChangeType.ADD);
+                    ct.add(PersistentSearchChangeType.DELETE);
+                    ct.add(PersistentSearchChangeType.MODIFY);
+                    ct.add(PersistentSearchChangeType.MODIFY_DN);
+                } else {
+                    do {
+                        final String token = st.nextToken();
+                        if (token.equals("add")) {
+                            ct.add(PersistentSearchChangeType.ADD);
+                        } else if (token.equals("delete") || token.equals("del")) {
+                            ct.add(PersistentSearchChangeType.DELETE);
+                        } else if (token.equals("modify") || token.equals("mod")) {
+                            ct.add(PersistentSearchChangeType.MODIFY);
+                        } else if (token.equals("modifydn") || token.equals("moddn")
+                                || token.equals("modrdn")) {
+                            ct.add(PersistentSearchChangeType.MODIFY_DN);
+                        } else if (token.equals("any") || token.equals("all")) {
+                            ct.add(PersistentSearchChangeType.ADD);
+                            ct.add(PersistentSearchChangeType.DELETE);
+                            ct.add(PersistentSearchChangeType.MODIFY);
+                            ct.add(PersistentSearchChangeType.MODIFY_DN);
+                        } else {
+                            final LocalizableMessage message =
+                                    ERR_PSEARCH_INVALID_CHANGE_TYPE.get(String.valueOf(token));
+                            println(message);
+                            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                        }
+                    } while (st.hasMoreTokens());
+                }
+            }
+
+            if (tokenizer.hasMoreTokens()) {
+                final String token = tokenizer.nextToken();
+                if (token.equals("1") || token.equals("true") || token.equals("yes")) {
+                    changesOnly = true;
+                } else if (token.equals("0") || token.equals("false") || token.equals("no")) {
+                    changesOnly = false;
+                } else {
+                    final LocalizableMessage message =
+                            ERR_PSEARCH_INVALID_CHANGESONLY.get(String.valueOf(token));
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            if (tokenizer.hasMoreTokens()) {
+                final String token = tokenizer.nextToken();
+                if (token.equals("1") || token.equals("true") || token.equals("yes")) {
+                    returnECs = true;
+                } else if (token.equals("0") || token.equals("false") || token.equals("no")) {
+                    returnECs = false;
+                } else {
+                    final LocalizableMessage message =
+                            ERR_PSEARCH_INVALID_RETURN_ECS.get(String.valueOf(token));
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            final PersistentSearchRequestControl psearchControl =
+                    PersistentSearchRequestControl.newControl(true, changesOnly, returnECs, ct
+                            .toArray(new PersistentSearchChangeType[ct.size()]));
+            search.addControl(psearchControl);
+        }
+
+        if (assertionFilter.isPresent()) {
+            final String filterString = assertionFilter.getValue();
+            Filter filter;
+            try {
+                filter = Filter.valueOf(filterString);
+
+                // FIXME -- Change this to the correct OID when the official one
+                // is assigned.
+                final Control assertionControl = AssertionRequestControl.newControl(true, filter);
+                search.addControl(assertionControl);
+            } catch (final LocalizedIllegalArgumentException le) {
+                final LocalizableMessage message =
+                        ERR_LDAP_ASSERTION_INVALID_FILTER.get(le.getMessage());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+
+        if (matchedValuesFilter.isPresent()) {
+            final LinkedList<String> mvFilterStrings = matchedValuesFilter.getValues();
+            final List<Filter> mvFilters = new ArrayList<Filter>();
+            for (final String s : mvFilterStrings) {
+                try {
+                    final Filter f = Filter.valueOf(s);
+                    mvFilters.add(f);
+                } catch (final LocalizedIllegalArgumentException le) {
+                    final LocalizableMessage message =
+                            ERR_LDAP_MATCHEDVALUES_INVALID_FILTER.get(le.getMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            final MatchedValuesRequestControl mvc =
+                    MatchedValuesRequestControl.newControl(true, mvFilters);
+            search.addControl(mvc);
+        }
+
+        if (sortOrder.isPresent()) {
+            try {
+                search.addControl(ServerSideSortRequestControl.newControl(false, sortOrder
+                        .getValue()));
+            } catch (final LocalizedIllegalArgumentException le) {
+                final LocalizableMessage message =
+                        ERR_LDAP_SORTCONTROL_INVALID_ORDER.get(le.getMessageObject());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+
+        if (vlvDescriptor.isPresent()) {
+            if (!sortOrder.isPresent()) {
+                final LocalizableMessage message =
+                        ERR_LDAPSEARCH_VLV_REQUIRES_SORT.get(vlvDescriptor.getLongIdentifier(),
+                                sortOrder.getLongIdentifier());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+
+            final StringTokenizer tokenizer = new StringTokenizer(vlvDescriptor.getValue(), ":");
+            final int numTokens = tokenizer.countTokens();
+            if (numTokens == 3) {
+                try {
+                    final int beforeCount = Integer.parseInt(tokenizer.nextToken());
+                    final int afterCount = Integer.parseInt(tokenizer.nextToken());
+                    final ByteString assertionValue = ByteString.valueOf(tokenizer.nextToken());
+                    search.addControl(VirtualListViewRequestControl.newAssertionControl(true,
+                            assertionValue, beforeCount, afterCount, null));
+                } catch (final Exception e) {
+                    final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR.get();
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            } else if (numTokens == 4) {
+                try {
+                    final int beforeCount = Integer.parseInt(tokenizer.nextToken());
+                    final int afterCount = Integer.parseInt(tokenizer.nextToken());
+                    final int offset = Integer.parseInt(tokenizer.nextToken());
+                    final int contentCount = Integer.parseInt(tokenizer.nextToken());
+                    search.addControl(VirtualListViewRequestControl.newOffsetControl(true, offset,
+                            contentCount, beforeCount, afterCount, null));
+                } catch (final Exception e) {
+                    final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR.get();
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            } else {
+                final LocalizableMessage message = ERR_LDAPSEARCH_VLV_INVALID_DESCRIPTOR.get();
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+
+        int pageSize = 0;
+        if (simplePageSize.isPresent()) {
+            if (filters.size() > 1) {
+                final LocalizableMessage message = ERR_PAGED_RESULTS_REQUIRES_SINGLE_FILTER.get();
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+
+            try {
+                pageSize = simplePageSize.getIntValue();
+                search.addControl(SimplePagedResultsControl.newControl(true, pageSize, ByteString
+                        .empty()));
+            } catch (final ArgumentException ae) {
+                final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+        }
+        /*
+         * if(connectionOptions.useSASLExternal()) {
+         * if(!connectionOptions.useSSL() && !connectionOptions.useStartTLS()) {
+         * LocalizableMessage message =
+         * ERR_TOOL_SASLEXTERNAL_NEEDS_SSL_OR_TLS.get();
+         * err.println(wrapText(message, MAX_LINE_WIDTH)); return
+         * CLIENT_SIDE_PARAM_ERROR; } if(keyStorePathValue == null) {
+         * LocalizableMessage message =
+         * ERR_TOOL_SASLEXTERNAL_NEEDS_KEYSTORE.get();
+         * err.println(wrapText(message, MAX_LINE_WIDTH)); return
+         * CLIENT_SIDE_PARAM_ERROR; } }
+         * connectionOptions.setVerbose(verbose.isPresent());
+         */
+
+        int wrapColumn = 80;
+        if (dontWrap.isPresent()) {
+            wrapColumn = 0;
+        }
+
+        if (noop.isPresent()) {
+            // We don't actually need to open a connection or perform the
+            // search, so we're done. We should return 0 to either mean that the
+            // processing was successful or that there were no matching entries,
+            // based
+            // on countEntries.isPresent() (but in either case the return value
+            // should
+            // be zero).
+            return 0;
+        }
+
+        Connection connection;
+        try {
+            connection = connectionFactory.getConnection();
+        } catch (final ErrorResultException ere) {
+            return Utils.printErrorMessage(this, ere);
+        } catch (final InterruptedException e) {
+            // This shouldn't happen because there are no other threads to
+            // interrupt this one.
+            println(LocalizableMessage.raw(e.getLocalizedMessage()));
+            return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
+        }
+
+        Utils.printPasswordPolicyResults(this, connection);
+
+        try {
+            int filterIndex = 0;
+            ldifWriter = new LDIFEntryWriter(getOutputStream()).setWrapColumn(wrapColumn);
+            final LDAPSearchResultHandler resultHandler = new LDAPSearchResultHandler();
+            while (true) {
+                Result result;
+                try {
+                    result = connection.search(search, resultHandler);
+                } catch (final InterruptedException e) {
+                    // This shouldn't happen because there are no other threads
+                    // to
+                    // interrupt this one.
+                    throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
+                            .getLocalizedMessage(), e);
+                }
+
+                try {
+                    final ServerSideSortResponseControl control =
+                            result.getControl(ServerSideSortResponseControl.DECODER,
+                                    new DecodeOptions());
+                    if (control != null) {
+                        if (control.getResult() != ResultCode.SUCCESS) {
+                            final LocalizableMessage msg =
+                                    WARN_LDAPSEARCH_SORT_ERROR.get(control.getResult().toString());
+                            println(msg);
+                        }
+                    }
+                } catch (final DecodeException e) {
+                    println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+                }
+
+                try {
+                    final VirtualListViewResponseControl control =
+                            result.getControl(VirtualListViewResponseControl.DECODER,
+                                    new DecodeOptions());
+                    if (control != null) {
+                        if (control.getResult() == ResultCode.SUCCESS) {
+                            LocalizableMessage msg =
+                                    INFO_LDAPSEARCH_VLV_TARGET_OFFSET.get(control
+                                            .getTargetPosition());
+                            println(msg);
+
+                            msg = INFO_LDAPSEARCH_VLV_CONTENT_COUNT.get(control.getContentCount());
+                            println(msg);
+                        } else {
+                            final LocalizableMessage msg =
+                                    WARN_LDAPSEARCH_VLV_ERROR.get(control.getResult().toString());
+                            println(msg);
+                        }
+                    }
+                } catch (final DecodeException e) {
+                    println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+                }
+
+                try {
+                    SimplePagedResultsControl control =
+                            result.getControl(SimplePagedResultsControl.DECODER,
+                                    new DecodeOptions());
+                    if (control != null) {
+                        if (control.getCookie().length() > 0) {
+                            if (!isQuiet()) {
+                                pressReturnToContinue();
+                            }
+                            final Iterator<Control> iterator = search.getControls().iterator();
+                            while (iterator.hasNext()) {
+                                if (iterator.next().getOID().equals(SimplePagedResultsControl.OID)) {
+                                    iterator.remove();
+                                }
+                            }
+                            control =
+                                    SimplePagedResultsControl.newControl(true, pageSize, control
+                                            .getCookie());
+                            search.addControl(control);
+                            continue;
+                        }
+                    }
+                } catch (final DecodeException e) {
+                    println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+                }
+
+                println();
+                println(ERR_TOOL_RESULT_CODE.get(result.getResultCode().intValue(), result
+                        .getResultCode().toString()));
+                if ((result.getDiagnosticMessage() != null)
+                        && (result.getDiagnosticMessage().length() > 0)) {
+                    println(LocalizableMessage.raw(result.getDiagnosticMessage()));
+                }
+                if (result.getMatchedDN() != null && result.getMatchedDN().length() > 0) {
+                    println(ERR_TOOL_MATCHED_DN.get(result.getMatchedDN()));
+                }
+
+                filterIndex++;
+                if (filterIndex < filters.size()) {
+                    search.setFilter(filters.get(filterIndex));
+                } else {
+                    break;
+                }
+            }
+            if (countEntries.isPresent() && !isQuiet()) {
+                final LocalizableMessage message =
+                        INFO_LDAPSEARCH_MATCHING_ENTRY_COUNT.get(resultHandler.entryCount);
+                println(message);
+                println();
+            }
+        } catch (final ErrorResultException ere) {
+            return Utils.printErrorMessage(this, ere);
+        } finally {
+            connection.close();
+        }
+
+        return 0;
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
index a3e5380..e564198 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,13 +26,19 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_LONG_HELP;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_LONG_OUTPUT_LDIF_FILENAME;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_SHORT_HELP;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableException;
@@ -43,209 +48,168 @@
 import org.forgerock.opendj.ldif.LDIFChangeRecordWriter;
 import org.forgerock.opendj.ldif.LDIFEntryReader;
 
-
-
 /**
  * This utility can be used to compare two LDIF files and report the differences
  * in LDIF format.
  */
-public final class LDIFDiff extends ConsoleApplication
-{
+public final class LDIFDiff extends ConsoleApplication {
 
-  /**
-   * The main method for LDIFDiff tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
+    /**
+     * The main method for LDIFDiff tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDIFDiff().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private LDIFDiff()
-  {
-    // Nothing to do.
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-
-    final LocalizableMessage toolDescription = INFO_LDIFDIFF_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        LDIFDiff.class.getName(), toolDescription, false, true, 2, 2,
-        "source target");
-
-    final BooleanArgument showUsage;
-    final StringArgument outputFilename;
-
-    try
-    {
-      outputFilename = new StringArgument("outputFilename",
-          OPTION_SHORT_OUTPUT_LDIF_FILENAME, OPTION_LONG_OUTPUT_LDIF_FILENAME,
-          false, false, true, INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(),
-          "stdout", null,
-          INFO_LDIFDIFF_DESCRIPTION_OUTPUT_FILENAME
-              .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-      argParser.addArgument(outputFilename);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public static void main(final String[] args) {
+        final int retCode = new LDIFDiff().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
-
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    private LDIFDiff() {
+        // Nothing to do.
     }
 
-    InputStream sourceInputStream = null;
-    InputStream targetInputStream = null;
-    OutputStream outputStream = null;
-    LDIFEntryReader sourceReader = null;
-    LDIFEntryReader targetReader = null;
-    LDIFChangeRecordWriter outputWriter = null;
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
 
-    try
-    {
-      // First source file.
-      final List<String> trailingArguments = argParser.getTrailingArguments();
-      if (!trailingArguments.get(0).equals("-"))
-      {
-        try
-        {
-          sourceInputStream = new FileInputStream(trailingArguments.get(0));
+        final LocalizableMessage toolDescription = INFO_LDIFDIFF_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDIFDiff.class.getName(), toolDescription, false, true, 2, 2,
+                        "source target");
+
+        final BooleanArgument showUsage;
+        final StringArgument outputFilename;
+
+        try {
+            outputFilename =
+                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
+                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
+                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
+                            INFO_LDIFDIFF_DESCRIPTION_OUTPUT_FILENAME
+                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
+            argParser.addArgument(outputFilename);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(trailingArguments.get(0), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-      }
 
-      // Patch file.
-      if (!trailingArguments.get(1).equals("-"))
-      {
-        try
-        {
-          targetInputStream = new FileInputStream(trailingArguments.get(1));
+        InputStream sourceInputStream = null;
+        InputStream targetInputStream = null;
+        OutputStream outputStream = null;
+        LDIFEntryReader sourceReader = null;
+        LDIFEntryReader targetReader = null;
+        LDIFChangeRecordWriter outputWriter = null;
+
+        try {
+            // First source file.
+            final List<String> trailingArguments = argParser.getTrailingArguments();
+            if (!trailingArguments.get(0).equals("-")) {
+                try {
+                    sourceInputStream = new FileInputStream(trailingArguments.get(0));
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(trailingArguments.get(0), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Patch file.
+            if (!trailingArguments.get(1).equals("-")) {
+                try {
+                    targetInputStream = new FileInputStream(trailingArguments.get(1));
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(trailingArguments.get(1), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Output file.
+            if (outputFilename.isPresent() && !outputFilename.getValue().equals("-")) {
+                try {
+                    outputStream = new FileOutputStream(outputFilename.getValue());
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE.get(outputFilename.getValue(), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Default to stdin/stdout for all streams if not specified.
+            if (sourceInputStream == null) {
+                // Command line parameter was "-".
+                sourceInputStream = System.in;
+            }
+
+            if (targetInputStream == null) {
+                targetInputStream = System.in;
+            }
+
+            if (outputStream == null) {
+                outputStream = System.out;
+            }
+
+            // Check that we are not attempting to read both the source and
+            // target
+            // from stdin.
+            if (sourceInputStream == targetInputStream) {
+                final LocalizableMessage message = ERR_LDIFDIFF_MULTIPLE_USES_OF_STDIN.get();
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+
+            // Perform the diff.
+            sourceReader = new LDIFEntryReader(sourceInputStream);
+            targetReader = new LDIFEntryReader(targetInputStream);
+            outputWriter = new LDIFChangeRecordWriter(outputStream);
+            LDIF.copyTo(LDIF.diff(sourceReader, targetReader), outputWriter);
+        } catch (final IOException e) {
+            if (e instanceof LocalizableException) {
+                println(ERR_LDIFDIFF_DIFF_FAILED.get(((LocalizableException) e).getMessageObject()));
+            } else {
+                println(ERR_LDIFDIFF_DIFF_FAILED.get(e.getLocalizedMessage()));
+            }
+            return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+        } finally {
+            closeIfNotNull(sourceReader);
+            closeIfNotNull(targetReader);
+            closeIfNotNull(outputWriter);
+
+            closeIfNotNull(sourceInputStream);
+            closeIfNotNull(targetInputStream);
+            closeIfNotNull(outputStream);
         }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(trailingArguments.get(1), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
 
-      // Output file.
-      if (outputFilename.isPresent() && !outputFilename.getValue().equals("-"))
-      {
-        try
-        {
-          outputStream = new FileOutputStream(outputFilename.getValue());
-        }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE
-              .get(outputFilename.getValue(), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
-
-      // Default to stdin/stdout for all streams if not specified.
-      if (sourceInputStream == null)
-      {
-        // Command line parameter was "-".
-        sourceInputStream = System.in;
-      }
-
-      if (targetInputStream == null)
-      {
-        targetInputStream = System.in;
-      }
-
-      if (outputStream == null)
-      {
-        outputStream = System.out;
-      }
-
-      // Check that we are not attempting to read both the source and target
-      // from stdin.
-      if (sourceInputStream == targetInputStream)
-      {
-        final LocalizableMessage message = ERR_LDIFDIFF_MULTIPLE_USES_OF_STDIN
-            .get();
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-
-      // Perform the diff.
-      sourceReader = new LDIFEntryReader(sourceInputStream);
-      targetReader = new LDIFEntryReader(targetInputStream);
-      outputWriter = new LDIFChangeRecordWriter(outputStream);
-      LDIF.copyTo(LDIF.diff(sourceReader, targetReader), outputWriter);
+        return ResultCode.SUCCESS.intValue();
     }
-    catch (final IOException e)
-    {
-      if (e instanceof LocalizableException)
-      {
-        println(ERR_LDIFDIFF_DIFF_FAILED.get(((LocalizableException) e)
-            .getMessageObject()));
-      }
-      else
-      {
-        println(ERR_LDIFDIFF_DIFF_FAILED.get(e.getLocalizedMessage()));
-      }
-      return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-    }
-    finally
-    {
-      closeIfNotNull(sourceReader);
-      closeIfNotNull(targetReader);
-      closeIfNotNull(outputWriter);
-
-      closeIfNotNull(sourceInputStream);
-      closeIfNotNull(targetInputStream);
-      closeIfNotNull(outputStream);
-    }
-
-    return ResultCode.SUCCESS.intValue();
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
index 561fca9..a4ac2dc 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,13 +26,19 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_LONG_HELP;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_LONG_OUTPUT_LDIF_FILENAME;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_SHORT_HELP;
+import static com.forgerock.opendj.ldap.tools.ToolConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableException;
@@ -45,334 +50,255 @@
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
-import org.forgerock.opendj.ldif.*;
-
-
+import org.forgerock.opendj.ldif.LDIF;
+import org.forgerock.opendj.ldif.LDIFChangeRecordReader;
+import org.forgerock.opendj.ldif.LDIFEntryReader;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
+import org.forgerock.opendj.ldif.RejectedChangeRecordListener;
 
 /**
  * A tool that can be used to issue update (Add/Delete/Modify/ModifyDN) requests
  * to a set of entries contained in an LDIF file.
  */
-public final class LDIFModify extends ConsoleApplication
-{
+public final class LDIFModify extends ConsoleApplication {
 
-  /**
-   * The main method for LDIFModify tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
+    /**
+     * The main method for LDIFModify tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDIFModify().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private LDIFModify()
-  {
-    // Nothing to do.
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-
-    final LocalizableMessage toolDescription = INFO_LDIFMODIFY_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        LDIFModify.class.getName(), toolDescription, false, true, 1, 2,
-        "source [changes]");
-
-    final BooleanArgument continueOnError;
-    final BooleanArgument showUsage;
-    final StringArgument outputFilename;
-
-    try
-    {
-      outputFilename = new StringArgument("outputFilename",
-          OPTION_SHORT_OUTPUT_LDIF_FILENAME, OPTION_LONG_OUTPUT_LDIF_FILENAME,
-          false, false, true, INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(),
-          "stdout", null,
-          INFO_LDIFMODIFY_DESCRIPTION_OUTPUT_FILENAME
-              .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-      argParser.addArgument(outputFilename);
-
-      continueOnError = new BooleanArgument("continueOnError", 'c',
-          "continueOnError", INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
-      continueOnError.setPropertyName("continueOnError");
-      argParser.addArgument(continueOnError);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public static void main(final String[] args) {
+        final int retCode = new LDIFModify().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
-
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    private LDIFModify() {
+        // Nothing to do.
     }
 
-    InputStream sourceInputStream = null;
-    InputStream changesInputStream = null;
-    OutputStream outputStream = null;
-    LDIFEntryReader sourceReader = null;
-    LDIFChangeRecordReader changesReader = null;
-    LDIFEntryWriter outputWriter = null;
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
 
-    try
-    {
-      // First source file.
-      final List<String> trailingArguments = argParser.getTrailingArguments();
-      if (!trailingArguments.get(0).equals("-"))
-      {
-        try
-        {
-          sourceInputStream = new FileInputStream(trailingArguments.get(0));
-        }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(trailingArguments.get(0), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
+        final LocalizableMessage toolDescription = INFO_LDIFMODIFY_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDIFModify.class.getName(), toolDescription, false, true, 1, 2,
+                        "source [changes]");
 
-      // Patch file.
-      if (trailingArguments.size() > 1 && !trailingArguments.get(1).equals("-"))
-      {
-        try
-        {
-          changesInputStream = new FileInputStream(trailingArguments.get(1));
-        }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(trailingArguments.get(1), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
+        final BooleanArgument continueOnError;
+        final BooleanArgument showUsage;
+        final StringArgument outputFilename;
 
-      // Output file.
-      if (outputFilename.isPresent() && !outputFilename.getValue().equals("-"))
-      {
-        try
-        {
-          outputStream = new FileOutputStream(outputFilename.getValue());
-        }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE
-              .get(outputFilename.getValue(), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-        }
-      }
+        try {
+            outputFilename =
+                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
+                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
+                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
+                            INFO_LDIFMODIFY_DESCRIPTION_OUTPUT_FILENAME
+                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
+            argParser.addArgument(outputFilename);
 
-      // Default to stdin/stdout for all streams if not specified.
-      if (sourceInputStream == null)
-      {
-        // Command line parameter was "-".
-        sourceInputStream = System.in;
-      }
+            continueOnError =
+                    new BooleanArgument("continueOnError", 'c', "continueOnError",
+                            INFO_DESCRIPTION_CONTINUE_ON_ERROR.get());
+            continueOnError.setPropertyName("continueOnError");
+            argParser.addArgument(continueOnError);
 
-      if (changesInputStream == null)
-      {
-        changesInputStream = System.in;
-      }
-
-      if (outputStream == null)
-      {
-        outputStream = System.out;
-      }
-
-      // Check that we are not attempting to read both the source and changes
-      // from stdin.
-      if (sourceInputStream == changesInputStream)
-      {
-        final LocalizableMessage message = ERR_LDIFMODIFY_MULTIPLE_USES_OF_STDIN
-            .get();
-        println(message);
-        return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-      }
-
-      // Apply the changes.
-      sourceReader = new LDIFEntryReader(sourceInputStream);
-      changesReader = new LDIFChangeRecordReader(changesInputStream);
-      outputWriter = new LDIFEntryWriter(outputStream);
-
-      final RejectedChangeRecordListener listener = new RejectedChangeRecordListener()
-      {
-        public Entry handleDuplicateEntry(final AddRequest change,
-            final Entry existingEntry) throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleDuplicateEntry(change,
-                existingEntry);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
-          return change;
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
 
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
 
-
-        public Entry handleDuplicateEntry(final ModifyDNRequest change,
-            final Entry existingEntry, final Entry renamedEntry)
-            throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleDuplicateEntry(change,
-                existingEntry, renamedEntry);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
-          return renamedEntry;
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
 
+        InputStream sourceInputStream = null;
+        InputStream changesInputStream = null;
+        OutputStream outputStream = null;
+        LDIFEntryReader sourceReader = null;
+        LDIFChangeRecordReader changesReader = null;
+        LDIFEntryWriter outputWriter = null;
 
+        try {
+            // First source file.
+            final List<String> trailingArguments = argParser.getTrailingArguments();
+            if (!trailingArguments.get(0).equals("-")) {
+                try {
+                    sourceInputStream = new FileInputStream(trailingArguments.get(0));
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(trailingArguments.get(0), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
 
-        public void handleRejectedChangeRecord(final AddRequest change,
-            final LocalizableMessage reason) throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(
-                change, reason);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
+            // Patch file.
+            if (trailingArguments.size() > 1 && !trailingArguments.get(1).equals("-")) {
+                try {
+                    changesInputStream = new FileInputStream(trailingArguments.get(1));
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(trailingArguments.get(1), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Output file.
+            if (outputFilename.isPresent() && !outputFilename.getValue().equals("-")) {
+                try {
+                    outputStream = new FileOutputStream(outputFilename.getValue());
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE.get(outputFilename.getValue(), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Default to stdin/stdout for all streams if not specified.
+            if (sourceInputStream == null) {
+                // Command line parameter was "-".
+                sourceInputStream = System.in;
+            }
+
+            if (changesInputStream == null) {
+                changesInputStream = System.in;
+            }
+
+            if (outputStream == null) {
+                outputStream = System.out;
+            }
+
+            // Check that we are not attempting to read both the source and
+            // changes
+            // from stdin.
+            if (sourceInputStream == changesInputStream) {
+                final LocalizableMessage message = ERR_LDIFMODIFY_MULTIPLE_USES_OF_STDIN.get();
+                println(message);
+                return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+            }
+
+            // Apply the changes.
+            sourceReader = new LDIFEntryReader(sourceInputStream);
+            changesReader = new LDIFChangeRecordReader(changesInputStream);
+            outputWriter = new LDIFEntryWriter(outputStream);
+
+            final RejectedChangeRecordListener listener = new RejectedChangeRecordListener() {
+                public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry)
+                        throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleDuplicateEntry(change,
+                                existingEntry);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                    return change;
+                }
+
+                public Entry handleDuplicateEntry(final ModifyDNRequest change,
+                        final Entry existingEntry, final Entry renamedEntry) throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleDuplicateEntry(change,
+                                existingEntry, renamedEntry);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                    return renamedEntry;
+                }
+
+                public void handleRejectedChangeRecord(final AddRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(change,
+                                reason);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                }
+
+                public void handleRejectedChangeRecord(final DeleteRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(change,
+                                reason);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                }
+
+                public void handleRejectedChangeRecord(final ModifyDNRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(change,
+                                reason);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                }
+
+                public void handleRejectedChangeRecord(final ModifyRequest change,
+                        final LocalizableMessage reason) throws DecodeException {
+                    try {
+                        RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(change,
+                                reason);
+                    } catch (final DecodeException e) {
+                        logErrorOrFail(e);
+                    }
+                }
+
+                private void logErrorOrFail(final DecodeException e) throws DecodeException {
+                    if (continueOnError.isPresent()) {
+                        println(e.getMessageObject());
+                    } else {
+                        throw e;
+                    }
+                }
+            };
+
+            LDIF.copyTo(LDIF.patch(sourceReader, changesReader, listener), outputWriter);
+        } catch (final IOException e) {
+            if (e instanceof LocalizableException) {
+                println(ERR_LDIFMODIFY_PATCH_FAILED.get(((LocalizableException) e)
+                        .getMessageObject()));
+            } else {
+                println(ERR_LDIFMODIFY_PATCH_FAILED.get(e.getLocalizedMessage()));
+            }
+            return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+        } finally {
+            closeIfNotNull(sourceReader);
+            closeIfNotNull(changesReader);
+            closeIfNotNull(outputWriter);
+
+            closeIfNotNull(sourceInputStream);
+            closeIfNotNull(changesInputStream);
+            closeIfNotNull(outputStream);
         }
 
-
-
-        public void handleRejectedChangeRecord(final DeleteRequest change,
-            final LocalizableMessage reason) throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(
-                change, reason);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
-        }
-
-
-
-        public void handleRejectedChangeRecord(final ModifyDNRequest change,
-            final LocalizableMessage reason) throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(
-                change, reason);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
-        }
-
-
-
-        public void handleRejectedChangeRecord(final ModifyRequest change,
-            final LocalizableMessage reason) throws DecodeException
-        {
-          try
-          {
-            RejectedChangeRecordListener.FAIL_FAST.handleRejectedChangeRecord(
-                change, reason);
-          }
-          catch (final DecodeException e)
-          {
-            logErrorOrFail(e);
-          }
-        }
-
-
-
-        private void logErrorOrFail(final DecodeException e)
-            throws DecodeException
-        {
-          if (continueOnError.isPresent())
-          {
-            println(e.getMessageObject());
-          }
-          else
-          {
-            throw e;
-          }
-        }
-      };
-
-      LDIF.copyTo(LDIF.patch(sourceReader, changesReader, listener),
-          outputWriter);
+        return ResultCode.SUCCESS.intValue();
     }
-    catch (final IOException e)
-    {
-      if (e instanceof LocalizableException)
-      {
-        println(ERR_LDIFMODIFY_PATCH_FAILED.get(((LocalizableException) e)
-            .getMessageObject()));
-      }
-      else
-      {
-        println(ERR_LDIFMODIFY_PATCH_FAILED.get(e.getLocalizedMessage()));
-      }
-      return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-    }
-    finally
-    {
-      closeIfNotNull(sourceReader);
-      closeIfNotNull(changesReader);
-      closeIfNotNull(outputWriter);
-
-      closeIfNotNull(sourceInputStream);
-      closeIfNotNull(changesInputStream);
-      closeIfNotNull(outputStream);
-    }
-
-    return ResultCode.SUCCESS.intValue();
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
index f157417..f5bfca9 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,13 +26,18 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -50,314 +54,259 @@
 import org.forgerock.opendj.ldif.LDIFEntryReader;
 import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
-
-
 /**
  * This utility can be used to perform search operations against data in an LDIF
  * file.
  */
-public final class LDIFSearch extends ConsoleApplication
-{
+public final class LDIFSearch extends ConsoleApplication {
 
-  /**
-   * The main method for LDIFSearch tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
+    /**
+     * The main method for LDIFSearch tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-  public static void main(final String[] args)
-  {
-    final int retCode = new LDIFSearch().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private LDIFSearch()
-  {
-    // Nothing to do.
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-
-    final LocalizableMessage toolDescription = INFO_LDIFSEARCH_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        LDIFSearch.class.getName(), toolDescription, false, true, 1, 0,
-        "source [filter] [attributes ...]");
-
-    final BooleanArgument showUsage;
-    final StringArgument outputFilename;
-    final BooleanArgument typesOnly;
-    final IntegerArgument timeLimit;
-    final StringArgument filename;
-    final StringArgument baseDN;
-    final MultiChoiceArgument<SearchScope> searchScope;
-    final IntegerArgument sizeLimit;
-
-    try
-    {
-      outputFilename = new StringArgument("outputFilename",
-          OPTION_SHORT_OUTPUT_LDIF_FILENAME, OPTION_LONG_OUTPUT_LDIF_FILENAME,
-          false, false, true, INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(),
-          "stdout", null,
-          INFO_LDIFSEARCH_DESCRIPTION_OUTPUT_FILENAME
-              .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-      argParser.addArgument(outputFilename);
-
-      baseDN = new StringArgument("baseDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_BASEDN, true, false, true, INFO_BASEDN_PLACEHOLDER.get(),
-          null, null, INFO_SEARCH_DESCRIPTION_BASEDN.get());
-      baseDN.setPropertyName(OPTION_LONG_BASEDN);
-      argParser.addArgument(baseDN);
-
-      searchScope = new MultiChoiceArgument<SearchScope>("searchScope", 's',
-          "searchScope", false, true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(),
-          SearchScope.values(), false,
-          INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
-      searchScope.setPropertyName("searchScope");
-      searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
-      argParser.addArgument(searchScope);
-
-      filename = new StringArgument("filename", OPTION_SHORT_FILENAME,
-          OPTION_LONG_FILENAME, false, false, true,
-          INFO_FILE_PLACEHOLDER.get(), null, null,
-          INFO_SEARCH_DESCRIPTION_FILENAME.get());
-      searchScope.setPropertyName(OPTION_LONG_FILENAME);
-      argParser.addArgument(filename);
-
-      typesOnly = new BooleanArgument("typesOnly", 'A', "typesOnly",
-          INFO_DESCRIPTION_TYPES_ONLY.get());
-      typesOnly.setPropertyName("typesOnly");
-      argParser.addArgument(typesOnly);
-
-      sizeLimit = new IntegerArgument("sizeLimit", 'z', "sizeLimit", false,
-          false, true, INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
-          INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
-      sizeLimit.setPropertyName("sizeLimit");
-      argParser.addArgument(sizeLimit);
-
-      timeLimit = new IntegerArgument("timeLimit", 'l', "timeLimit", false,
-          false, true, INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
-          INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
-      timeLimit.setPropertyName("timeLimit");
-      argParser.addArgument(timeLimit);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public static void main(final String[] args) {
+        final int retCode = new LDIFSearch().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
-
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    private LDIFSearch() {
+        // Nothing to do.
     }
 
-    final List<Filter> filters = new LinkedList<Filter>();
-    final List<String> attributes = new LinkedList<String>();
-    final List<String> trailingArguments = argParser.getTrailingArguments();
-    if (trailingArguments.size() > 1)
-    {
-      final List<String> filterAndAttributeStrings = trailingArguments.subList(
-          1, trailingArguments.size());
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
 
-      // the list of trailing arguments should be structured as follow:
-      // - If a filter file is present, trailing arguments are
-      // considered as attributes
-      // - If filter file is not present, the first trailing argument is
-      // considered the filter, the other as attributes.
-      if (!filename.isPresent())
-      {
-        final String filterString = filterAndAttributeStrings.remove(0);
-        try
-        {
-          filters.add(Filter.valueOf(filterString));
+        final LocalizableMessage toolDescription = INFO_LDIFSEARCH_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(LDIFSearch.class.getName(), toolDescription, false, true, 1, 0,
+                        "source [filter] [attributes ...]");
+
+        final BooleanArgument showUsage;
+        final StringArgument outputFilename;
+        final BooleanArgument typesOnly;
+        final IntegerArgument timeLimit;
+        final StringArgument filename;
+        final StringArgument baseDN;
+        final MultiChoiceArgument<SearchScope> searchScope;
+        final IntegerArgument sizeLimit;
+
+        try {
+            outputFilename =
+                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
+                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
+                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
+                            INFO_LDIFSEARCH_DESCRIPTION_OUTPUT_FILENAME
+                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
+            argParser.addArgument(outputFilename);
+
+            baseDN =
+                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true,
+                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCH_DESCRIPTION_BASEDN.get());
+            baseDN.setPropertyName(OPTION_LONG_BASEDN);
+            argParser.addArgument(baseDN);
+
+            searchScope =
+                    new MultiChoiceArgument<SearchScope>("searchScope", 's', "searchScope", false,
+                            true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(), SearchScope.values(), false,
+                            INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
+            searchScope.setPropertyName("searchScope");
+            searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
+            argParser.addArgument(searchScope);
+
+            filename =
+                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
+                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCH_DESCRIPTION_FILENAME.get());
+            searchScope.setPropertyName(OPTION_LONG_FILENAME);
+            argParser.addArgument(filename);
+
+            typesOnly =
+                    new BooleanArgument("typesOnly", 'A', "typesOnly", INFO_DESCRIPTION_TYPES_ONLY
+                            .get());
+            typesOnly.setPropertyName("typesOnly");
+            argParser.addArgument(typesOnly);
+
+            sizeLimit =
+                    new IntegerArgument("sizeLimit", 'z', "sizeLimit", false, false, true,
+                            INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
+                            INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
+            sizeLimit.setPropertyName("sizeLimit");
+            argParser.addArgument(sizeLimit);
+
+            timeLimit =
+                    new IntegerArgument("timeLimit", 'l', "timeLimit", false, false, true,
+                            INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
+                            INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
+            timeLimit.setPropertyName("timeLimit");
+            argParser.addArgument(timeLimit);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-        catch (final LocalizedIllegalArgumentException e)
-        {
-          println(e.getMessageObject());
-          return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-      }
-      // The rest are attributes
-      for (final String s : filterAndAttributeStrings)
-      {
-        attributes.add(s);
-      }
-    }
 
-    if (filename.isPresent())
-    {
-      // Read the filter strings.
-      BufferedReader in = null;
-      try
-      {
-        in = new BufferedReader(new FileReader(filename.getValue()));
-        String line = null;
+        final List<Filter> filters = new LinkedList<Filter>();
+        final List<String> attributes = new LinkedList<String>();
+        final List<String> trailingArguments = argParser.getTrailingArguments();
+        if (trailingArguments.size() > 1) {
+            final List<String> filterAndAttributeStrings =
+                    trailingArguments.subList(1, trailingArguments.size());
 
-        while ((line = in.readLine()) != null)
-        {
-          if (line.trim().equals(""))
-          {
-            // ignore empty lines.
-            continue;
-          }
-          final Filter ldapFilter = Filter.valueOf(line);
-          filters.add(ldapFilter);
+            // the list of trailing arguments should be structured as follow:
+            // - If a filter file is present, trailing arguments are
+            // considered as attributes
+            // - If filter file is not present, the first trailing argument is
+            // considered the filter, the other as attributes.
+            if (!filename.isPresent()) {
+                final String filterString = filterAndAttributeStrings.remove(0);
+                try {
+                    filters.add(Filter.valueOf(filterString));
+                } catch (final LocalizedIllegalArgumentException e) {
+                    println(e.getMessageObject());
+                    return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+                }
+            }
+            // The rest are attributes
+            for (final String s : filterAndAttributeStrings) {
+                attributes.add(s);
+            }
         }
-      }
-      catch (final LocalizedIllegalArgumentException e)
-      {
-        println(e.getMessageObject());
-        return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-      }
-      catch (final IOException e)
-      {
-        println(LocalizableMessage.raw(e.toString()));
-        return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-      }
-      finally
-      {
-        closeIfNotNull(in);
-      }
-    }
 
-    if (filters.isEmpty())
-    {
-      println(ERR_SEARCH_NO_FILTERS.get());
-      println(argParser.getUsageMessage());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+        if (filename.isPresent()) {
+            // Read the filter strings.
+            BufferedReader in = null;
+            try {
+                in = new BufferedReader(new FileReader(filename.getValue()));
+                String line = null;
 
-    final SearchRequest search;
-    try
-    {
-      final SearchScope scope = searchScope.getTypedValue();
-      search = Requests
-          .newSearchRequest(DN.valueOf(baseDN.getValue()), scope,
-              filters.get(0), attributes.toArray(new String[attributes.size()]))
-          .setTypesOnly(typesOnly.isPresent())
-          .setTimeLimit(timeLimit.getIntValue())
-          .setSizeLimit(sizeLimit.getIntValue());
-    }
-    catch (final ArgumentException e)
-    {
-      println(e.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-    catch (final LocalizedIllegalArgumentException e)
-    {
-      println(e.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    InputStream sourceInputStream = null;
-    OutputStream outputStream = null;
-    LDIFEntryReader sourceReader = null;
-    LDIFEntryWriter outputWriter = null;
-
-    try
-    {
-      // First source file.
-      if (!trailingArguments.get(0).equals("-"))
-      {
-        try
-        {
-          sourceInputStream = new FileInputStream(trailingArguments.get(0));
+                while ((line = in.readLine()) != null) {
+                    if (line.trim().equals("")) {
+                        // ignore empty lines.
+                        continue;
+                    }
+                    final Filter ldapFilter = Filter.valueOf(line);
+                    filters.add(ldapFilter);
+                }
+            } catch (final LocalizedIllegalArgumentException e) {
+                println(e.getMessageObject());
+                return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+            } catch (final IOException e) {
+                println(LocalizableMessage.raw(e.toString()));
+                return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
+            } finally {
+                closeIfNotNull(in);
+            }
         }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ
-              .get(trailingArguments.get(0), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+
+        if (filters.isEmpty()) {
+            println(ERR_SEARCH_NO_FILTERS.get());
+            println(argParser.getUsageMessage());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-      }
 
-      // Output file.
-      if (outputFilename.isPresent() && !outputFilename.getValue().equals("-"))
-      {
-        try
-        {
-          outputStream = new FileOutputStream(outputFilename.getValue());
+        final SearchRequest search;
+        try {
+            final SearchScope scope = searchScope.getTypedValue();
+            search =
+                    Requests.newSearchRequest(DN.valueOf(baseDN.getValue()), scope, filters.get(0),
+                            attributes.toArray(new String[attributes.size()])).setTypesOnly(
+                            typesOnly.isPresent()).setTimeLimit(timeLimit.getIntValue())
+                            .setSizeLimit(sizeLimit.getIntValue());
+        } catch (final ArgumentException e) {
+            println(e.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        } catch (final LocalizedIllegalArgumentException e) {
+            println(e.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
         }
-        catch (final FileNotFoundException e)
-        {
-          final LocalizableMessage message = ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE
-              .get(outputFilename.getValue(), e.getLocalizedMessage());
-          println(message);
-          return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+
+        InputStream sourceInputStream = null;
+        OutputStream outputStream = null;
+        LDIFEntryReader sourceReader = null;
+        LDIFEntryWriter outputWriter = null;
+
+        try {
+            // First source file.
+            if (!trailingArguments.get(0).equals("-")) {
+                try {
+                    sourceInputStream = new FileInputStream(trailingArguments.get(0));
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(trailingArguments.get(0), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Output file.
+            if (outputFilename.isPresent() && !outputFilename.getValue().equals("-")) {
+                try {
+                    outputStream = new FileOutputStream(outputFilename.getValue());
+                } catch (final FileNotFoundException e) {
+                    final LocalizableMessage message =
+                            ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE.get(outputFilename.getValue(), e
+                                    .getLocalizedMessage());
+                    println(message);
+                    return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+                }
+            }
+
+            // Default to stdin/stdout for all streams if not specified.
+            if (sourceInputStream == null) {
+                // Command line parameter was "-".
+                sourceInputStream = System.in;
+            }
+
+            if (outputStream == null) {
+                outputStream = System.out;
+            }
+
+            // Perform the search.
+            sourceReader = new LDIFEntryReader(sourceInputStream);
+            outputWriter = new LDIFEntryWriter(outputStream);
+            LDIF.copyTo(LDIF.search(sourceReader, search), outputWriter);
+        } catch (final IOException e) {
+            if (e instanceof LocalizableException) {
+                println(ERR_LDIFSEARCH_FAILED.get(((LocalizableException) e).getMessageObject()));
+            } else {
+                println(ERR_LDIFSEARCH_FAILED.get(e.getLocalizedMessage()));
+            }
+            return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
+        } finally {
+            closeIfNotNull(sourceReader);
+            closeIfNotNull(outputWriter);
+
+            closeIfNotNull(sourceInputStream);
+            closeIfNotNull(outputStream);
         }
-      }
 
-      // Default to stdin/stdout for all streams if not specified.
-      if (sourceInputStream == null)
-      {
-        // Command line parameter was "-".
-        sourceInputStream = System.in;
-      }
-
-      if (outputStream == null)
-      {
-        outputStream = System.out;
-      }
-
-      // Perform the search.
-      sourceReader = new LDIFEntryReader(sourceInputStream);
-      outputWriter = new LDIFEntryWriter(outputStream);
-      LDIF.copyTo(LDIF.search(sourceReader, search), outputWriter);
+        return ResultCode.SUCCESS.intValue();
     }
-    catch (final IOException e)
-    {
-      if (e instanceof LocalizableException)
-      {
-        println(ERR_LDIFSEARCH_FAILED.get(((LocalizableException) e)
-            .getMessageObject()));
-      }
-      else
-      {
-        println(ERR_LDIFSEARCH_FAILED.get(e.getLocalizedMessage()));
-      }
-      return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
-    }
-    finally
-    {
-      closeIfNotNull(sourceReader);
-      closeIfNotNull(outputWriter);
-
-      closeIfNotNull(sourceInputStream);
-      closeIfNotNull(outputStream);
-    }
-
-    return ResultCode.SUCCESS.intValue();
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
index 2bbb066..9be618a 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,290 +27,226 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.responses.Result;
 
-
-
 /**
  * A load generation tool that can be used to load a Directory Server with
  * Modify requests using one or more LDAP connections.
  */
-public final class ModRate extends ConsoleApplication
-{
-  private static final class ModifyPerformanceRunner extends PerformanceRunner
-  {
-    private final class ModifyWorkerThread extends WorkerThread
-    {
-      private ModifyRequest mr;
-      private Object[] data;
+public final class ModRate extends ConsoleApplication {
+    private static final class ModifyPerformanceRunner extends PerformanceRunner {
+        private final class ModifyWorkerThread extends WorkerThread {
+            private ModifyRequest mr;
+            private Object[] data;
 
+            private ModifyWorkerThread(final Connection connection,
+                    final ConnectionFactory connectionFactory) {
+                super(connection, connectionFactory);
+            }
 
+            @Override
+            public FutureResult<?> performOperation(final Connection connection,
+                    final DataSource[] dataSources, final long startTime) {
+                if (dataSources != null) {
+                    data = DataSource.generateData(dataSources, data);
+                }
+                mr = newModifyRequest(data);
+                return connection.modifyAsync(mr, null, new UpdateStatsResultHandler<Result>(
+                        startTime));
+            }
 
-      private ModifyWorkerThread(final Connection connection,
-          final ConnectionFactory connectionFactory)
-      {
-        super(connection, connectionFactory);
-      }
-
-
-
-      @Override
-      public FutureResult<?> performOperation(final Connection connection,
-          final DataSource[] dataSources, final long startTime)
-      {
-        if (dataSources != null)
-        {
-          data = DataSource.generateData(dataSources, data);
+            private ModifyRequest newModifyRequest(final Object[] data) {
+                String formattedString;
+                int colonPos;
+                ModifyRequest mr;
+                if (data == null) {
+                    mr = Requests.newModifyRequest(baseDN);
+                } else {
+                    mr = Requests.newModifyRequest(String.format(baseDN, data));
+                }
+                for (final String modString : modStrings) {
+                    if (data == null) {
+                        formattedString = modString;
+                    } else {
+                        formattedString = String.format(modString, data);
+                    }
+                    colonPos = formattedString.indexOf(':');
+                    if (colonPos > 0) {
+                        mr.addModification(ModificationType.REPLACE, formattedString.substring(0,
+                                colonPos), formattedString.substring(colonPos + 1));
+                    }
+                }
+                return mr;
+            }
         }
-        mr = newModifyRequest(data);
-        return connection.modifyAsync(mr, null,
-            new UpdateStatsResultHandler<Result>(startTime));
-      }
 
+        private String baseDN;
+        private String[] modStrings;
 
+        private ModifyPerformanceRunner(final ArgumentParser argParser, final ConsoleApplication app)
+                throws ArgumentException {
+            super(argParser, app, false, false, false);
+        }
 
-      private ModifyRequest newModifyRequest(final Object[] data)
-      {
-        String formattedString;
-        int colonPos;
-        ModifyRequest mr;
-        if (data == null)
-        {
-          mr = Requests.newModifyRequest(baseDN);
+        @Override
+        WorkerThread newWorkerThread(final Connection connection,
+                final ConnectionFactory connectionFactory) {
+            return new ModifyWorkerThread(connection, connectionFactory);
         }
-        else
-        {
-          mr = Requests.newModifyRequest(String.format(baseDN, data));
+
+        @Override
+        StatsThread newStatsThread() {
+            return new StatsThread(new String[0]);
         }
-        for (final String modString : modStrings)
-        {
-          if (data == null)
-          {
-            formattedString = modString;
-          }
-          else
-          {
-            formattedString = String.format(modString, data);
-          }
-          colonPos = formattedString.indexOf(':');
-          if (colonPos > 0)
-          {
-            mr.addModification(ModificationType.REPLACE,
-                formattedString.substring(0, colonPos),
-                formattedString.substring(colonPos + 1));
-          }
-        }
-        return mr;
-      }
     }
 
+    /**
+     * The main method for ModRate tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-
-    private String baseDN;
-    private String[] modStrings;
-
-
-
-    private ModifyPerformanceRunner(final ArgumentParser argParser,
-        final ConsoleApplication app) throws ArgumentException
-    {
-      super(argParser, app, false, false, false);
+    public static void main(final String[] args) {
+        final int retCode = new ModRate().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
+    private BooleanArgument verbose;
+    private BooleanArgument scriptFriendly;
 
+    private ModRate() {
+        // Nothing to do.
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    WorkerThread newWorkerThread(final Connection connection,
-        final ConnectionFactory connectionFactory)
-    {
-      return new ModifyWorkerThread(connection, connectionFactory);
+    public boolean isScriptFriendly() {
+        return scriptFriendly.isPresent();
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    StatsThread newStatsThread()
-    {
-      return new StatsThread(new String[0]);
-    }
-  }
-
-
-
-  /**
-   * The main method for ModRate tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-
-  public static void main(final String[] args)
-  {
-    final int retCode = new ModRate().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-  private BooleanArgument scriptFriendly;
-
-
-
-  private ModRate()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isScriptFriendly()
-  {
-    return scriptFriendly.isPresent();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_MODRATE_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        ModRate.class.getName(), toolDescription, false, true, 1, 0,
-        "[(attribute:value format string) ...]");
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-    ModifyPerformanceRunner runner;
-
-    BooleanArgument showUsage;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-    StringArgument baseDN;
-
-    try
-    {
-      Utils.setDefaultPerfToolProperties();
-
-      connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
-      runner = new ModifyPerformanceRunner(argParser, this);
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      baseDN = new StringArgument("targetDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_TARGETDN, true, false, true,
-          INFO_TARGETDN_PLACEHOLDER.get(), null, null,
-          INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get());
-      baseDN.setPropertyName(OPTION_LONG_BASEDN);
-      argParser.addArgument(baseDN);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-
-      scriptFriendly = new BooleanArgument("scriptFriendly", 'S',
-          "scriptFriendly", INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-      scriptFriendly.setPropertyName("scriptFriendly");
-      argParser.addArgument(scriptFriendly);
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public boolean isVerbose() {
+        return verbose.isPresent();
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_MODRATE_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(ModRate.class.getName(), toolDescription, false, true, 1, 0,
+                        "[(attribute:value format string) ...]");
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+        ModifyPerformanceRunner runner;
 
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
+        BooleanArgument showUsage;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
+        StringArgument baseDN;
 
-      connectionFactory = connectionFactoryProvider
-          .getAuthenticatedConnectionFactory();
-      runner.validate();
+        try {
+            Utils.setDefaultPerfToolProperties();
+
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            runner = new ModifyPerformanceRunner(argParser, this);
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            baseDN =
+                    new StringArgument("targetDN", OPTION_SHORT_BASEDN, OPTION_LONG_TARGETDN, true,
+                            false, true, INFO_TARGETDN_PLACEHOLDER.get(), null, null,
+                            INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get());
+            baseDN.setPropertyName(OPTION_LONG_BASEDN);
+            argParser.addArgument(baseDN);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+
+            scriptFriendly =
+                    new BooleanArgument("scriptFriendly", 'S', "scriptFriendly",
+                            INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
+            scriptFriendly.setPropertyName("scriptFriendly");
+            argParser.addArgument(scriptFriendly);
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+            runner.validate();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        runner.modStrings =
+                argParser.getTrailingArguments().toArray(
+                        new String[argParser.getTrailingArguments().size()]);
+        runner.baseDN = baseDN.getValue();
+
+        try {
+
+            // Try it out to make sure the format string and data sources
+            // match.
+            final Object[] data = DataSource.generateData(runner.getDataSources(), null);
+            for (final String modString : runner.modStrings) {
+                String.format(modString, data);
+            }
+            String.format(runner.baseDN, data);
+        } catch (final Exception ex1) {
+            println(LocalizableMessage.raw("Error formatting filter or base DN: " + ex1.toString()));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        return runner.run(connectionFactory);
     }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    runner.modStrings = argParser.getTrailingArguments().toArray(
-        new String[argParser.getTrailingArguments().size()]);
-    runner.baseDN = baseDN.getValue();
-
-    try
-    {
-
-      // Try it out to make sure the format string and data sources
-      // match.
-      final Object[] data = DataSource.generateData(runner.getDataSources(),
-          null);
-      for (final String modString : runner.modStrings)
-      {
-        String.format(modString, data);
-      }
-      String.format(runner.baseDN, data);
-    }
-    catch (final Exception ex1)
-    {
-      println(LocalizableMessage.raw("Error formatting filter or base DN: "
-          + ex1.toString()));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
-
-    return runner.run(connectionFactory);
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiChoiceArgument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiChoiceArgument.java
index fe06a94..6d0e92d 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiChoiceArgument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiChoiceArgument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_MCARG_VALUE_NOT_ALLOWED;
 
 import java.util.Collection;
@@ -35,237 +32,207 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines an argument type that will only accept one or more of a
  * specific set of string values.
  *
  * @param <T>
- *          The type of values returned by this argument.
+ *            The type of values returned by this argument.
  */
-final class MultiChoiceArgument<T> extends Argument
-{
-  // Indicates whether argument values should be treated in a
-  // case-sensitive manner.
-  private final boolean caseSensitive;
+final class MultiChoiceArgument<T> extends Argument {
+    // Indicates whether argument values should be treated in a
+    // case-sensitive manner.
+    private final boolean caseSensitive;
 
-  // The set of values that will be allowed for use with this argument.
-  private final Collection<T> allowedValues;
+    // The set of values that will be allowed for use with this argument.
+    private final Collection<T> allowedValues;
 
+    /**
+     * Creates a new string argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param allowedValues
+     *            The set of values that are allowed for use for this argument.
+     *            If they are not to be treated in a case-sensitive value then
+     *            they should all be formatted in lowercase.
+     * @param caseSensitive
+     *            Indicates whether the set of allowed values should be treated
+     *            in a case-sensitive manner.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public MultiChoiceArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final String defaultValue, final String propertyName,
+            final Collection<T> allowedValues, final boolean caseSensitive,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, defaultValue, propertyName, description);
 
-
-  /**
-   * Creates a new string argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param allowedValues
-   *          The set of values that are allowed for use for this argument. If
-   *          they are not to be treated in a case-sensitive value then they
-   *          should all be formatted in lowercase.
-   * @param caseSensitive
-   *          Indicates whether the set of allowed values should be treated in a
-   *          case-sensitive manner.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public MultiChoiceArgument(final String name,
-      final Character shortIdentifier, final String longIdentifier,
-      final boolean isRequired, final boolean isMultiValued,
-      final boolean needsValue, final LocalizableMessage valuePlaceholder,
-      final String defaultValue, final String propertyName,
-      final Collection<T> allowedValues, final boolean caseSensitive,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, defaultValue, propertyName, description);
-
-    this.allowedValues = allowedValues;
-    this.caseSensitive = caseSensitive;
-  }
-
-
-
-  /**
-   * Creates a new string argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param allowedValues
-   *          The set of values that are allowed for use for this argument. If
-   *          they are not to be treated in a case-sensitive value then they
-   *          should all be formatted in lowercase.
-   * @param caseSensitive
-   *          Indicates whether the set of allowed values should be treated in a
-   *          case-sensitive manner.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public MultiChoiceArgument(final String name,
-      final Character shortIdentifier, final String longIdentifier,
-      final boolean isRequired, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder,
-      final Collection<T> allowedValues, final boolean caseSensitive,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
-        valuePlaceholder, null, null, description);
-
-    this.allowedValues = allowedValues;
-    this.caseSensitive = caseSensitive;
-  }
-
-
-
-  /**
-   * Retrieves the set of allowed values for this argument. The contents of this
-   * set must not be altered by the caller.
-   *
-   * @return The set of allowed values for this argument.
-   */
-  public Collection<T> getAllowedValues()
-  {
-    return allowedValues;
-  }
-
-
-
-  /**
-   * Retrieves the string vale for this argument. If it has multiple values,
-   * then the first will be returned. If it does not have any values, then the
-   * default value will be returned.
-   *
-   * @return The string value for this argument, or <CODE>null</CODE> if there
-   *         are no values and no default value has been given.
-   * @throws ArgumentException
-   *           The value cannot be parsed.
-   */
-  public T getTypedValue() throws ArgumentException
-  {
-    final String v = super.getValue();
-    if (v == null)
-    {
-      return null;
+        this.allowedValues = allowedValues;
+        this.caseSensitive = caseSensitive;
     }
-    for (final T o : allowedValues)
-    {
-      if ((caseSensitive && o.toString().equals(v))
-          || o.toString().equalsIgnoreCase(v))
-      {
-        return o;
-      }
+
+    /**
+     * Creates a new string argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param allowedValues
+     *            The set of values that are allowed for use for this argument.
+     *            If they are not to be treated in a case-sensitive value then
+     *            they should all be formatted in lowercase.
+     * @param caseSensitive
+     *            Indicates whether the set of allowed values should be treated
+     *            in a case-sensitive manner.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public MultiChoiceArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean needsValue,
+            final LocalizableMessage valuePlaceholder, final Collection<T> allowedValues,
+            final boolean caseSensitive, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
+                valuePlaceholder, null, null, description);
+
+        this.allowedValues = allowedValues;
+        this.caseSensitive = caseSensitive;
     }
-    // TODO: Some message
-    throw new ArgumentException(null);
-  }
 
-
-
-  /**
-   * Indicates whether the set of allowed values for this argument should be
-   * treated in a case-sensitive manner.
-   *
-   * @return <CODE>true</CODE> if the values are to be treated in a
-   *         case-sensitive manner, or <CODE>false</CODE> if not.
-   */
-  public boolean isCaseSensitive()
-  {
-    return caseSensitive;
-  }
-
-
-
-  /**
-   * Specifies the default value that will be used for this argument if it is
-   * not specified on the command line and it is not set from a properties file.
-   *
-   * @param defaultValue
-   *          The default value that will be used for this argument if it is not
-   *          specified on the command line and it is not set from a properties
-   *          file.
-   */
-  public void setDefaultValue(final T defaultValue)
-  {
-    super.setDefaultValue(defaultValue.toString());
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  @Override
-  public boolean valueIsAcceptable(final String valueString,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    for (final T o : allowedValues)
-    {
-      if ((caseSensitive && o.toString().equals(valueString))
-          || o.toString().equalsIgnoreCase(valueString))
-      {
-        return true;
-      }
+    /**
+     * Retrieves the set of allowed values for this argument. The contents of
+     * this set must not be altered by the caller.
+     *
+     * @return The set of allowed values for this argument.
+     */
+    public Collection<T> getAllowedValues() {
+        return allowedValues;
     }
-    invalidReason.append(ERR_MCARG_VALUE_NOT_ALLOWED
-        .get(getName(), valueString));
 
-    return false;
-  }
+    /**
+     * Retrieves the string vale for this argument. If it has multiple values,
+     * then the first will be returned. If it does not have any values, then the
+     * default value will be returned.
+     *
+     * @return The string value for this argument, or <CODE>null</CODE> if there
+     *         are no values and no default value has been given.
+     * @throws ArgumentException
+     *             The value cannot be parsed.
+     */
+    public T getTypedValue() throws ArgumentException {
+        final String v = super.getValue();
+        if (v == null) {
+            return null;
+        }
+        for (final T o : allowedValues) {
+            if ((caseSensitive && o.toString().equals(v)) || o.toString().equalsIgnoreCase(v)) {
+                return o;
+            }
+        }
+        // TODO: Some message
+        throw new ArgumentException(null);
+    }
+
+    /**
+     * Indicates whether the set of allowed values for this argument should be
+     * treated in a case-sensitive manner.
+     *
+     * @return <CODE>true</CODE> if the values are to be treated in a
+     *         case-sensitive manner, or <CODE>false</CODE> if not.
+     */
+    public boolean isCaseSensitive() {
+        return caseSensitive;
+    }
+
+    /**
+     * Specifies the default value that will be used for this argument if it is
+     * not specified on the command line and it is not set from a properties
+     * file.
+     *
+     * @param defaultValue
+     *            The default value that will be used for this argument if it is
+     *            not specified on the command line and it is not set from a
+     *            properties file.
+     */
+    public void setDefaultValue(final T defaultValue) {
+        super.setDefaultValue(defaultValue.toString());
+    }
+
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    @Override
+    public boolean valueIsAcceptable(final String valueString,
+            final LocalizableMessageBuilder invalidReason) {
+        for (final T o : allowedValues) {
+            if ((caseSensitive && o.toString().equals(valueString))
+                    || o.toString().equalsIgnoreCase(valueString)) {
+                return true;
+            }
+        }
+        invalidReason.append(ERR_MCARG_VALUE_NOT_ALLOWED.get(getName(), valueString));
+
+        return false;
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiColumnPrinter.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiColumnPrinter.java
index d4becc2..bf4ac0c 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiColumnPrinter.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MultiColumnPrinter.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,13 +26,9 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import java.util.Enumeration;
 import java.util.Vector;
 
-
-
 /**
  * Utility class for printing aligned columns of text.
  * <P>
@@ -124,424 +119,351 @@
  *      John   Doe    john@foo.com  456-7890
  * </PRE>
  */
-final class MultiColumnPrinter
-{
+final class MultiColumnPrinter {
 
-  final public static int LEFT = 0;
+    final public static int LEFT = 0;
 
-  final public static int CENTER = 1;
+    final public static int CENTER = 1;
 
-  final public static int RIGHT = 2;
+    final public static int RIGHT = 2;
 
-  private int numCol = 2;
+    private int numCol = 2;
 
-  private int gap = 4;
+    private int gap = 4;
 
-  private int align = CENTER;
+    private int align = CENTER;
 
-  private int titleAlign = CENTER;
+    private int titleAlign = CENTER;
 
-  private String border = null;
+    private String border = null;
 
-  private Vector<String[]> titleTable = null;
+    private Vector<String[]> titleTable = null;
 
-  private Vector<int[]> titleSpanTable = null;
+    private Vector<int[]> titleSpanTable = null;
 
-  private final int curLength[];
+    private final int[] curLength;
 
-  private final ConsoleApplication app;
+    private final ConsoleApplication app;
 
-
-
-  /**
-   * Creates a sorted new MultiColumnPrinter class using LEFT alignment and with
-   * no title border.
-   *
-   * @param numCol
-   *          number of columns
-   * @param gap
-   *          gap between each column
-   */
-  MultiColumnPrinter(final int numCol, final int gap,
-      final ConsoleApplication app)
-  {
-    this(numCol, gap, null, LEFT, app);
-  }
-
-
-
-  /**
-   * Creates a sorted new MultiColumnPrinter class using LEFT alignment.
-   *
-   * @param numCol
-   *          number of columns
-   * @param gap
-   *          gap between each column
-   * @param border
-   *          character used to frame the titles
-   */
-  MultiColumnPrinter(final int numCol, final int gap, final String border,
-      final ConsoleApplication app)
-  {
-    this(numCol, gap, border, LEFT, app);
-  }
-
-
-
-  /**
-   * Creates a new MultiColumnPrinter class.
-   *
-   * @param numCol
-   *          number of columns
-   * @param gap
-   *          gap between each column
-   * @param border
-   *          character used to frame the titles
-   * @param align
-   *          type of alignment within columns
-   */
-  MultiColumnPrinter(final int numCol, final int gap, final String border,
-      final int align, final ConsoleApplication app)
-  {
-
-    titleTable = new Vector<String[]>();
-    titleSpanTable = new Vector<int[]>();
-    curLength = new int[numCol];
-
-    this.numCol = numCol;
-    this.gap = gap;
-    this.border = border;
-    this.align = align;
-    this.titleAlign = LEFT;
-
-    this.app = app;
-  }
-
-
-
-  /**
-   * Adds to the row of strings to be used as the title for the table.
-   *
-   * @param row
-   *          Array of strings to print in one row of title.
-   */
-  void addTitle(final String[] row)
-  {
-    if (row == null)
-    {
-      return;
+    /**
+     * Creates a sorted new MultiColumnPrinter class using LEFT alignment and
+     * with no title border.
+     *
+     * @param numCol
+     *            number of columns
+     * @param gap
+     *            gap between each column
+     */
+    MultiColumnPrinter(final int numCol, final int gap, final ConsoleApplication app) {
+        this(numCol, gap, null, LEFT, app);
     }
 
-    final int[] span = new int[row.length];
-    for (int i = 0; i < row.length; i++)
-    {
-      span[i] = 1;
+    /**
+     * Creates a sorted new MultiColumnPrinter class using LEFT alignment.
+     *
+     * @param numCol
+     *            number of columns
+     * @param gap
+     *            gap between each column
+     * @param border
+     *            character used to frame the titles
+     */
+    MultiColumnPrinter(final int numCol, final int gap, final String border,
+            final ConsoleApplication app) {
+        this(numCol, gap, border, LEFT, app);
     }
 
-    addTitle(row, span);
-  }
+    /**
+     * Creates a new MultiColumnPrinter class.
+     *
+     * @param numCol
+     *            number of columns
+     * @param gap
+     *            gap between each column
+     * @param border
+     *            character used to frame the titles
+     * @param align
+     *            type of alignment within columns
+     */
+    MultiColumnPrinter(final int numCol, final int gap, final String border, final int align,
+            final ConsoleApplication app) {
 
+        titleTable = new Vector<String[]>();
+        titleSpanTable = new Vector<int[]>();
+        curLength = new int[numCol];
 
+        this.numCol = numCol;
+        this.gap = gap;
+        this.border = border;
+        this.align = align;
+        this.titleAlign = LEFT;
 
-  /**
-   * Adds to the row of strings to be used as the title for the table. Also
-   * allows for certain title strings to span multiple collumns The span
-   * parameter is an array of integers which indicate how many collumns the
-   * corresponding title string will occupy. For a row that is 4 collumns wide,
-   * it is possible to have some title strings in a row to 'span' multiple
-   * collumns:
-   * <P>
-   *
-   * <PRE>
-   * ------------------------------------
-   *     Name             Contact
-   * First  Last      Email       Phone
-   * ------------------------------------
-   * Bob    Jones  bob@foo.com   123-4567
-   * John   Doe    john@foo.com  456-7890
-   * </PRE>
-   *
-   * In the example above, the title row has a string 'Name' that spans 2
-   * collumns. The string 'Contact' also spans 2 collumns. The above is done by
-   * passing in to addTitle() an array that contains:
-   *
-   * <PRE>
-   * span[0] = 2; // spans 2 collumns
-   * span[1] = 0; // spans 0 collumns, ignore
-   * span[2] = 2; // spans 2 collumns
-   * span[3] = 0; // spans 0 collumns, ignore
-   * </PRE>
-   * <P>
-   * A span value of 1 is the default. The method addTitle(String[] row)
-   * basically does:
-   *
-   * <PRE>
-   * int[] span = new int[row.length];
-   * for (int i = 0; i &lt; row.length; i++)
-   * {
-   *   span[i] = 1;
-   * }
-   * addTitle(row, span);
-   * </PRE>
-   *
-   * @param row
-   *          Array of strings to print in one row of title.
-   * @param span
-   *          Array of integers that reflect the number of collumns the
-   *          corresponding title string will occupy.
-   */
-  void addTitle(final String[] row, final int span[])
-  {
-    // Need to create a new instance of it, otherwise the new values
-    // will always overwrite the old values.
-
-    final String[] rowInstance = new String[(row.length)];
-    for (int i = 0; i < row.length; i++)
-    {
-      rowInstance[i] = row[i];
+        this.app = app;
     }
-    titleTable.addElement(rowInstance);
 
-    titleSpanTable.addElement(span);
-  }
-
-
-
-  /**
-   * Clears title strings.
-   */
-  void clearTitle()
-  {
-    titleTable.clear();
-    titleSpanTable.clear();
-  }
-
-
-
-  /**
-   * Adds one row of text to output.
-   *
-   * @param row
-   *          Array of strings to print in one row.
-   */
-  void printRow(final String... row)
-  {
-    for (int i = 0; i < numCol; i++)
-    {
-      if (titleAlign == RIGHT)
-      {
-        final int spaceBefore = curLength[i] - row[i].length();
-        printSpaces(spaceBefore);
-        app.getOutputStream().print(row[i]);
-        if (i < numCol - 1)
-        {
-          printSpaces(gap);
+    /**
+     * Adds to the row of strings to be used as the title for the table.
+     *
+     * @param row
+     *            Array of strings to print in one row of title.
+     */
+    void addTitle(final String[] row) {
+        if (row == null) {
+            return;
         }
-      }
-      else if (align == CENTER)
-      {
-        int space1, space2;
-        space1 = (curLength[i] - row[i].length()) / 2;
-        space2 = curLength[i] - row[i].length() - space1;
 
-        printSpaces(space1);
-        app.getOutputStream().print(row[i]);
-        printSpaces(space2);
-        if (i < numCol - 1)
-        {
-          printSpaces(gap);
+        final int[] span = new int[row.length];
+        for (int i = 0; i < row.length; i++) {
+            span[i] = 1;
         }
-      }
-      else
-      {
-        app.getOutputStream().print(row[i]);
-        if (i < numCol - 1)
-        {
-          printSpaces(curLength[i] - row[i].length() + gap);
-        }
-      }
+
+        addTitle(row, span);
     }
-    app.getOutputStream().println("");
-  }
 
+    /**
+     * Adds to the row of strings to be used as the title for the table. Also
+     * allows for certain title strings to span multiple collumns The span
+     * parameter is an array of integers which indicate how many collumns the
+     * corresponding title string will occupy. For a row that is 4 collumns
+     * wide, it is possible to have some title strings in a row to 'span'
+     * multiple collumns:
+     * <P>
+     *
+     * <PRE>
+     * ------------------------------------
+     *     Name             Contact
+     * First  Last      Email       Phone
+     * ------------------------------------
+     * Bob    Jones  bob@foo.com   123-4567
+     * John   Doe    john@foo.com  456-7890
+     * </PRE>
+     *
+     * In the example above, the title row has a string 'Name' that spans 2
+     * collumns. The string 'Contact' also spans 2 collumns. The above is done
+     * by passing in to addTitle() an array that contains:
+     *
+     * <PRE>
+     * span[0] = 2; // spans 2 collumns
+     * span[1] = 0; // spans 0 collumns, ignore
+     * span[2] = 2; // spans 2 collumns
+     * span[3] = 0; // spans 0 collumns, ignore
+     * </PRE>
+     * <P>
+     * A span value of 1 is the default. The method addTitle(String[] row)
+     * basically does:
+     *
+     * <PRE>
+     * int[] span = new int[row.length];
+     * for (int i = 0; i &lt; row.length; i++) {
+     *     span[i] = 1;
+     * }
+     * addTitle(row, span);
+     * </PRE>
+     *
+     * @param row
+     *            Array of strings to print in one row of title.
+     * @param span
+     *            Array of integers that reflect the number of collumns the
+     *            corresponding title string will occupy.
+     */
+    void addTitle(final String[] row, final int[] span) {
+        // Need to create a new instance of it, otherwise the new values
+        // will always overwrite the old values.
 
-
-  /**
-   * Prints the table title
-   */
-  void printTitle()
-  {
-    // Get the longest string for each column and store in curLength[]
-
-    // Scan through title rows
-    Enumeration<String[]> elm = titleTable.elements();
-    Enumeration<int[]> spanEnum = titleSpanTable.elements();
-    while (elm.hasMoreElements())
-    {
-      final String[] row = elm.nextElement();
-      final int[] curSpan = spanEnum.nextElement();
-
-      for (int i = 0; i < numCol; i++)
-      {
-        // None of the fields should be null, but if it
-        // happens to be so, replace it with "-".
-        if (row[i] == null)
-        {
-          row[i] = "-";
+        final String[] rowInstance = new String[(row.length)];
+        for (int i = 0; i < row.length; i++) {
+            rowInstance[i] = row[i];
         }
+        titleTable.addElement(rowInstance);
 
-        int len = row[i].length();
+        titleSpanTable.addElement(span);
+    }
 
-        /*
-         * If a title string spans multiple collumns, then the space it occupies
-         * in each collumn is at most len/span (since we have gap to take into
-         * account as well).
-         */
-        final int span = curSpan[i];
-        int rem = 0;
-        if (span > 1)
-        {
-          rem = len % span;
-          len = len / span;
-        }
+    /**
+     * Clears title strings.
+     */
+    void clearTitle() {
+        titleTable.clear();
+        titleSpanTable.clear();
+    }
 
-        if (curLength[i] < len)
-        {
-          curLength[i] = len;
+    /**
+     * Adds one row of text to output.
+     *
+     * @param row
+     *            Array of strings to print in one row.
+     */
+    void printRow(final String... row) {
+        for (int i = 0; i < numCol; i++) {
+            if (titleAlign == RIGHT) {
+                final int spaceBefore = curLength[i] - row[i].length();
+                printSpaces(spaceBefore);
+                app.getOutputStream().print(row[i]);
+                if (i < numCol - 1) {
+                    printSpaces(gap);
+                }
+            } else if (align == CENTER) {
+                int space1, space2;
+                space1 = (curLength[i] - row[i].length()) / 2;
+                space2 = curLength[i] - row[i].length() - space1;
 
-          if ((span > 1) && ((i + span) <= numCol))
-          {
-            for (int j = i + 1; j < (i + span); ++j)
-            {
-              curLength[j] = len;
+                printSpaces(space1);
+                app.getOutputStream().print(row[i]);
+                printSpaces(space2);
+                if (i < numCol - 1) {
+                    printSpaces(gap);
+                }
+            } else {
+                app.getOutputStream().print(row[i]);
+                if (i < numCol - 1) {
+                    printSpaces(curLength[i] - row[i].length() + gap);
+                }
             }
-
-            /*
-             * Add remainder to last collumn in span to avoid round-off errors.
-             */
-            curLength[(i + span) - 1] += rem;
-          }
         }
-      }
+        app.getOutputStream().println("");
     }
 
-    printBorder();
-    elm = titleTable.elements();
-    spanEnum = titleSpanTable.elements();
+    /**
+     * Prints the table title.
+     */
+    void printTitle() {
+        // Get the longest string for each column and store in curLength[]
 
-    while (elm.hasMoreElements())
-    {
-      final String[] row = elm.nextElement();
-      final int[] curSpan = spanEnum.nextElement();
+        // Scan through title rows
+        Enumeration<String[]> elm = titleTable.elements();
+        Enumeration<int[]> spanEnum = titleSpanTable.elements();
+        while (elm.hasMoreElements()) {
+            final String[] row = elm.nextElement();
+            final int[] curSpan = spanEnum.nextElement();
 
-      for (int i = 0; i < numCol; i++)
-      {
-        int availableSpace = 0;
-        final int span = curSpan[i];
+            for (int i = 0; i < numCol; i++) {
+                // None of the fields should be null, but if it
+                // happens to be so, replace it with "-".
+                if (row[i] == null) {
+                    row[i] = "-";
+                }
 
-        if (span == 0)
-        {
-          continue;
+                int len = row[i].length();
+
+                /*
+                 * If a title string spans multiple collumns, then the space it
+                 * occupies in each collumn is at most len/span (since we have
+                 * gap to take into account as well).
+                 */
+                final int span = curSpan[i];
+                int rem = 0;
+                if (span > 1) {
+                    rem = len % span;
+                    len = len / span;
+                }
+
+                if (curLength[i] < len) {
+                    curLength[i] = len;
+
+                    if ((span > 1) && ((i + span) <= numCol)) {
+                        for (int j = i + 1; j < (i + span); ++j) {
+                            curLength[j] = len;
+                        }
+
+                        /*
+                         * Add remainder to last collumn in span to avoid
+                         * round-off errors.
+                         */
+                        curLength[(i + span) - 1] += rem;
+                    }
+                }
+            }
         }
 
-        availableSpace = curLength[i];
+        printBorder();
+        elm = titleTable.elements();
+        spanEnum = titleSpanTable.elements();
 
-        if ((span > 1) && ((i + span) <= numCol))
-        {
-          for (int j = i + 1; j < (i + span); ++j)
-          {
-            availableSpace += gap;
-            availableSpace += curLength[j];
-          }
+        while (elm.hasMoreElements()) {
+            final String[] row = elm.nextElement();
+            final int[] curSpan = spanEnum.nextElement();
+
+            for (int i = 0; i < numCol; i++) {
+                int availableSpace = 0;
+                final int span = curSpan[i];
+
+                if (span == 0) {
+                    continue;
+                }
+
+                availableSpace = curLength[i];
+
+                if ((span > 1) && ((i + span) <= numCol)) {
+                    for (int j = i + 1; j < (i + span); ++j) {
+                        availableSpace += gap;
+                        availableSpace += curLength[j];
+                    }
+                }
+
+                if (titleAlign == RIGHT) {
+                    final int spaceBefore = availableSpace - row[i].length();
+                    printSpaces(spaceBefore);
+                    app.getOutputStream().print(row[i]);
+                    if (i < numCol - 1) {
+                        printSpaces(gap);
+                    }
+                } else if (titleAlign == CENTER) {
+                    int spaceBefore, spaceAfter;
+                    spaceBefore = (availableSpace - row[i].length()) / 2;
+                    spaceAfter = availableSpace - row[i].length() - spaceBefore;
+
+                    printSpaces(spaceBefore);
+                    app.getOutputStream().print(row[i]);
+                    printSpaces(spaceAfter);
+                    if (i < numCol - 1) {
+                        printSpaces(gap);
+                    }
+                } else {
+                    app.getOutputStream().print(row[i]);
+                    if (i < numCol - 1) {
+                        printSpaces(availableSpace - row[i].length() + gap);
+                    }
+                }
+
+            }
+            app.getOutputStream().println("");
+        }
+        printBorder();
+    }
+
+    /**
+     * Set alignment for title strings.
+     *
+     * @param titleAlign
+     */
+    void setTitleAlign(final int titleAlign) {
+        this.titleAlign = titleAlign;
+    }
+
+    private void printBorder() {
+        if (border == null) {
+            return;
         }
 
-        if (titleAlign == RIGHT)
-        {
-          final int spaceBefore = availableSpace - row[i].length();
-          printSpaces(spaceBefore);
-          app.getOutputStream().print(row[i]);
-          if (i < numCol - 1)
-          {
-            printSpaces(gap);
-          }
-        }
-        else if (titleAlign == CENTER)
-        {
-          int spaceBefore, spaceAfter;
-          spaceBefore = (availableSpace - row[i].length()) / 2;
-          spaceAfter = availableSpace - row[i].length() - spaceBefore;
-
-          printSpaces(spaceBefore);
-          app.getOutputStream().print(row[i]);
-          printSpaces(spaceAfter);
-          if (i < numCol - 1)
-          {
-            printSpaces(gap);
-          }
-        }
-        else
-        {
-          app.getOutputStream().print(row[i]);
-          if (i < numCol - 1)
-          {
-            printSpaces(availableSpace - row[i].length() + gap);
-          }
+        // For the value in each column
+        for (int i = 0; i < numCol; i++) {
+            for (int j = 0; j < curLength[i]; j++) {
+                app.getOutputStream().print(border);
+            }
         }
 
-      }
-      app.getOutputStream().println("");
-    }
-    printBorder();
-  }
-
-
-
-  /**
-   * Set alignment for title strings
-   *
-   * @param titleAlign
-   */
-  void setTitleAlign(final int titleAlign)
-  {
-    this.titleAlign = titleAlign;
-  }
-
-
-
-  private void printBorder()
-  {
-    if (border == null)
-    {
-      return;
+        // For the gap between each column
+        for (int i = 0; i < numCol - 1; i++) {
+            for (int j = 0; j < gap; j++) {
+                app.getOutputStream().print(border);
+            }
+        }
+        app.getOutputStream().println("");
     }
 
-    // For the value in each column
-    for (int i = 0; i < numCol; i++)
-    {
-      for (int j = 0; j < curLength[i]; j++)
-      {
-        app.getOutputStream().print(border);
-      }
+    private void printSpaces(final int count) {
+        for (int i = 0; i < count; ++i) {
+            app.getOutputStream().print(" ");
+        }
     }
-
-    // For the gap between each column
-    for (int i = 0; i < numCol - 1; i++)
-    {
-      for (int j = 0; j < gap; j++)
-      {
-        app.getOutputStream().print(border);
-      }
-    }
-    app.getOutputStream().println("");
-  }
-
-
-
-  private void printSpaces(final int count)
-  {
-    for (int i = 0; i < count; ++i)
-    {
-      app.getOutputStream().print(" ");
-    }
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
index 1637257..3e73ec3 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,1074 +27,840 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import java.io.IOException;
 import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionEventListener;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultHandler;
 import org.forgerock.opendj.ldap.responses.ExtendedResult;
 import org.forgerock.opendj.ldap.responses.Result;
 
-import com.forgerock.opendj.ldap.tools.AuthenticatedConnectionFactory.*;
+import com.forgerock.opendj.ldap.tools.AuthenticatedConnectionFactory.AuthenticatedConnection;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * Benchmark application framework.
  */
-abstract class PerformanceRunner implements ConnectionEventListener
-{
-  /**
-   * Statistics thread base implementation.
-   */
-  class StatsThread extends Thread
-  {
-    private final String[] additionalColumns;
+abstract class PerformanceRunner implements ConnectionEventListener {
+    /**
+     * Statistics thread base implementation.
+     */
+    class StatsThread extends Thread {
+        private final String[] additionalColumns;
 
-    private final List<GarbageCollectorMXBean> beans;
+        private final List<GarbageCollectorMXBean> beans;
 
-    private final Set<Double> percentiles;
+        private final Set<Double> percentiles;
 
-    private final int numColumns;
+        private final int numColumns;
 
-    private ReversableArray etimes = new ReversableArray(100000);
+        private ReversableArray etimes = new ReversableArray(100000);
 
-    private final ReversableArray array = new ReversableArray(200000);
+        private final ReversableArray array = new ReversableArray(200000);
 
-    protected long totalSuccessCount;
+        protected long totalSuccessCount;
 
-    protected long totalOperationCount;
+        protected long totalOperationCount;
 
-    protected long totalFailedCount;
+        protected long totalFailedCount;
 
-    protected long totalWaitTime;
+        protected long totalWaitTime;
 
-    protected int successCount;
+        protected int successCount;
 
-    protected int operationCount;
+        protected int operationCount;
 
-    protected int failedCount;
+        protected int failedCount;
 
-    protected long waitTime;
+        protected long waitTime;
 
-    protected long lastStatTime;
+        protected long lastStatTime;
 
-    protected long lastGCDuration;
+        protected long lastGCDuration;
 
-    protected double recentDuration;
+        protected double recentDuration;
 
-    protected double averageDuration;
+        protected double averageDuration;
 
+        public StatsThread(final String[] additionalColumns) {
+            super("Stats Thread");
 
+            this.additionalColumns = additionalColumns;
 
-    public StatsThread(final String[] additionalColumns)
-    {
-      super("Stats Thread");
-
-      this.additionalColumns = additionalColumns;
-
-      final TreeSet<Double> pSet = new TreeSet<Double>();
-      if (!percentilesArgument.isPresent())
-      {
-        pSet.add(.1);
-        pSet.add(.01);
-        pSet.add(.001);
-      }
-      else
-      {
-        for (final String percentile : percentilesArgument.getValues())
-        {
-          pSet.add(100.0 - Double.parseDouble(percentile));
-        }
-      }
-      this.percentiles = pSet.descendingSet();
-      this.numColumns = 5 + this.percentiles.size() + additionalColumns.length
-          + (isAsync ? 1 : 0);
-      this.beans = ManagementFactory.getGarbageCollectorMXBeans();
-    }
-
-
-
-    @Override
-    public void run()
-    {
-      final MultiColumnPrinter printer;
-
-      if (!app.isScriptFriendly())
-      {
-        printer = new MultiColumnPrinter(numColumns, 2, "-",
-            MultiColumnPrinter.RIGHT, app);
-        printer.setTitleAlign(MultiColumnPrinter.RIGHT);
-
-        String[] title = new String[numColumns];
-        Arrays.fill(title, "");
-        title[0] = "Throughput";
-        title[2] = "Response Time";
-        int[] span = new int[numColumns];
-        span[0] = 2;
-        span[1] = 0;
-        span[2] = 2 + this.percentiles.size();
-        Arrays.fill(span, 3, 4 + this.percentiles.size(), 0);
-        Arrays.fill(span, 4 + this.percentiles.size(), span.length, 1);
-        printer.addTitle(title, span);
-        title = new String[numColumns];
-        Arrays.fill(title, "");
-        title[0] = "(ops/second)";
-        title[2] = "(milliseconds)";
-        printer.addTitle(title, span);
-        title = new String[numColumns];
-        title[0] = "recent";
-        title[1] = "average";
-        title[2] = "recent";
-        title[3] = "average";
-        int i = 4;
-        for (final Double percentile : this.percentiles)
-        {
-          title[i++] = Double.toString(100.0 - percentile) + "%";
-        }
-        title[i++] = "err/sec";
-        if (isAsync)
-        {
-          title[i++] = "req/res";
-        }
-        for (final String column : additionalColumns)
-        {
-          title[i++] = column;
-        }
-        span = new int[numColumns];
-        Arrays.fill(span, 1);
-        printer.addTitle(title, span);
-        printer.printTitle();
-      }
-      else
-      {
-        app.getOutputStream().print("Time (seconds)");
-        app.getOutputStream().print(",");
-        app.getOutputStream().print("Recent throughput (ops/second)");
-        app.getOutputStream().print(",");
-        app.getOutputStream().print("Average throughput (ops/second)");
-        app.getOutputStream().print(",");
-        app.getOutputStream().print("Recent response time (milliseconds)");
-        app.getOutputStream().print(",");
-        app.getOutputStream().print("Average response time (milliseconds)");
-        for (final Double percentile : this.percentiles)
-        {
-          app.getOutputStream().print(",");
-          app.getOutputStream().print(Double.toString(100.0 - percentile));
-          app.getOutputStream().print("% response time (milliseconds)");
-        }
-        app.getOutputStream().print(",");
-        app.getOutputStream().print("Errors/second");
-        if (isAsync)
-        {
-          app.getOutputStream().print(",");
-          app.getOutputStream().print("Requests/response");
-        }
-        for (final String column : additionalColumns)
-        {
-          app.getOutputStream().print(",");
-          app.getOutputStream().print(column);
-        }
-        app.getOutputStream().println();
-        printer = null;
-      }
-
-      final String[] strings = new String[numColumns];
-
-      final long startTime = System.currentTimeMillis();
-      long statTime = startTime;
-      long gcDuration = 0;
-      for (final GarbageCollectorMXBean bean : beans)
-      {
-        gcDuration += bean.getCollectionTime();
-      }
-      while (!stopRequested)
-      {
-        try
-        {
-          sleep(statsInterval);
-        }
-        catch (final InterruptedException ie)
-        {
-          // Ignore.
-        }
-
-        lastStatTime = statTime;
-        statTime = System.currentTimeMillis();
-
-        lastGCDuration = gcDuration;
-        gcDuration = 0;
-        for (final GarbageCollectorMXBean bean : beans)
-        {
-          gcDuration += bean.getCollectionTime();
-        }
-
-        operationCount = operationRecentCount.getAndSet(0);
-        successCount = successRecentCount.getAndSet(0);
-        failedCount = failedRecentCount.getAndSet(0);
-        waitTime = waitRecentTime.getAndSet(0);
-
-        final int resultCount = successCount + failedCount;
-
-        totalOperationCount += operationCount;
-        totalSuccessCount += successCount;
-        totalFailedCount += failedCount;
-        totalWaitTime += waitTime;
-
-        final long totalResultCount = totalSuccessCount + totalFailedCount;
-
-        recentDuration = statTime - lastStatTime;
-        averageDuration = statTime - startTime;
-        recentDuration -= gcDuration - lastGCDuration;
-        averageDuration -= gcDuration;
-        recentDuration /= 1000.0;
-        averageDuration /= 1000.0;
-
-        strings[0] = String.format("%.1f", resultCount / recentDuration);
-        strings[1] = String.format("%.1f", totalResultCount / averageDuration);
-
-        if (resultCount > 0)
-        {
-          strings[2] = String.format("%.3f",
-              (waitTime - (gcDuration - lastGCDuration)) / (double) resultCount
-                  / 1000000.0);
-        }
-        else
-        {
-          strings[2] = "-";
-        }
-
-        if (totalResultCount > 0)
-        {
-          strings[3] = String.format("%.3f", (totalWaitTime - gcDuration)
-              / (double) totalResultCount / 1000000.0);
-        }
-        else
-        {
-          strings[3] = "-";
-        }
-
-        boolean changed = false;
-        etimes = eTimeBuffer.getAndSet(etimes);
-        final int appendLength = Math.min(array.remaining(), etimes.size());
-        if (appendLength > 0)
-        {
-          array.append(etimes, appendLength);
-          for (int i = array.size - appendLength; i < array.size; i++)
-          {
-            array.siftUp(0, i);
-          }
-          changed = true;
-        }
-
-        // Our window buffer is now full. Replace smallest with anything
-        // larger and re-heapify
-        for (int i = appendLength; i < etimes.size(); i++)
-        {
-          if (etimes.get(i) > array.get(0))
-          {
-            array.set(0, etimes.get(i));
-            array.siftDown(0, array.size() - 1);
-            changed = true;
-          }
-        }
-        etimes.clear();
-
-        if (changed)
-        {
-          // Perform heapsort
-          int i = array.size() - 1;
-          while (i > 0)
-          {
-            array.swap(i, 0);
-            array.siftDown(0, i - 1);
-            i--;
-          }
-          array.reverse();
-        }
-
-        // Now everything is ordered from smallest to largest
-        int index;
-        int i = 4;
-        for (final Double percent : percentiles)
-        {
-          if (array.size() <= 0)
-          {
-            strings[i++] = "-";
-          }
-          else
-          {
-            index = array.size()
-                - (int) Math.floor((percent / 100.0) * totalResultCount) - 1;
-            if (index < 0)
-            {
-              strings[i++] = String.format("*%.3f", array.get(0) / 1000000.0);
+            final TreeSet<Double> pSet = new TreeSet<Double>();
+            if (!percentilesArgument.isPresent()) {
+                pSet.add(.1);
+                pSet.add(.01);
+                pSet.add(.001);
+            } else {
+                for (final String percentile : percentilesArgument.getValues()) {
+                    pSet.add(100.0 - Double.parseDouble(percentile));
+                }
             }
-            else
-            {
-              strings[i++] = String
-                  .format("%.3f", array.get(index) / 1000000.0);
+            this.percentiles = pSet.descendingSet();
+            this.numColumns =
+                    5 + this.percentiles.size() + additionalColumns.length + (isAsync ? 1 : 0);
+            this.beans = ManagementFactory.getGarbageCollectorMXBeans();
+        }
+
+        @Override
+        public void run() {
+            final MultiColumnPrinter printer;
+
+            if (!app.isScriptFriendly()) {
+                printer = new MultiColumnPrinter(numColumns, 2, "-", MultiColumnPrinter.RIGHT, app);
+                printer.setTitleAlign(MultiColumnPrinter.RIGHT);
+
+                String[] title = new String[numColumns];
+                Arrays.fill(title, "");
+                title[0] = "Throughput";
+                title[2] = "Response Time";
+                int[] span = new int[numColumns];
+                span[0] = 2;
+                span[1] = 0;
+                span[2] = 2 + this.percentiles.size();
+                Arrays.fill(span, 3, 4 + this.percentiles.size(), 0);
+                Arrays.fill(span, 4 + this.percentiles.size(), span.length, 1);
+                printer.addTitle(title, span);
+                title = new String[numColumns];
+                Arrays.fill(title, "");
+                title[0] = "(ops/second)";
+                title[2] = "(milliseconds)";
+                printer.addTitle(title, span);
+                title = new String[numColumns];
+                title[0] = "recent";
+                title[1] = "average";
+                title[2] = "recent";
+                title[3] = "average";
+                int i = 4;
+                for (final Double percentile : this.percentiles) {
+                    title[i++] = Double.toString(100.0 - percentile) + "%";
+                }
+                title[i++] = "err/sec";
+                if (isAsync) {
+                    title[i++] = "req/res";
+                }
+                for (final String column : additionalColumns) {
+                    title[i++] = column;
+                }
+                span = new int[numColumns];
+                Arrays.fill(span, 1);
+                printer.addTitle(title, span);
+                printer.printTitle();
+            } else {
+                app.getOutputStream().print("Time (seconds)");
+                app.getOutputStream().print(",");
+                app.getOutputStream().print("Recent throughput (ops/second)");
+                app.getOutputStream().print(",");
+                app.getOutputStream().print("Average throughput (ops/second)");
+                app.getOutputStream().print(",");
+                app.getOutputStream().print("Recent response time (milliseconds)");
+                app.getOutputStream().print(",");
+                app.getOutputStream().print("Average response time (milliseconds)");
+                for (final Double percentile : this.percentiles) {
+                    app.getOutputStream().print(",");
+                    app.getOutputStream().print(Double.toString(100.0 - percentile));
+                    app.getOutputStream().print("% response time (milliseconds)");
+                }
+                app.getOutputStream().print(",");
+                app.getOutputStream().print("Errors/second");
+                if (isAsync) {
+                    app.getOutputStream().print(",");
+                    app.getOutputStream().print("Requests/response");
+                }
+                for (final String column : additionalColumns) {
+                    app.getOutputStream().print(",");
+                    app.getOutputStream().print(column);
+                }
+                app.getOutputStream().println();
+                printer = null;
             }
-          }
-        }
-        strings[i++] = String.format("%.1f", failedCount / recentDuration);
-        if (isAsync)
-        {
-          if (resultCount > 0)
-          {
-            strings[i++] = String.format("%.1f", (double) operationCount
-                / resultCount);
-          }
-          else
-          {
-            strings[i++] = "-";
-          }
-        }
-        for (final String column : getAdditionalColumns())
-        {
-          strings[i++] = column;
+
+            final String[] strings = new String[numColumns];
+
+            final long startTime = System.currentTimeMillis();
+            long statTime = startTime;
+            long gcDuration = 0;
+            for (final GarbageCollectorMXBean bean : beans) {
+                gcDuration += bean.getCollectionTime();
+            }
+            while (!stopRequested) {
+                try {
+                    sleep(statsInterval);
+                } catch (final InterruptedException ie) {
+                    // Ignore.
+                }
+
+                lastStatTime = statTime;
+                statTime = System.currentTimeMillis();
+
+                lastGCDuration = gcDuration;
+                gcDuration = 0;
+                for (final GarbageCollectorMXBean bean : beans) {
+                    gcDuration += bean.getCollectionTime();
+                }
+
+                operationCount = operationRecentCount.getAndSet(0);
+                successCount = successRecentCount.getAndSet(0);
+                failedCount = failedRecentCount.getAndSet(0);
+                waitTime = waitRecentTime.getAndSet(0);
+
+                final int resultCount = successCount + failedCount;
+
+                totalOperationCount += operationCount;
+                totalSuccessCount += successCount;
+                totalFailedCount += failedCount;
+                totalWaitTime += waitTime;
+
+                final long totalResultCount = totalSuccessCount + totalFailedCount;
+
+                recentDuration = statTime - lastStatTime;
+                averageDuration = statTime - startTime;
+                recentDuration -= gcDuration - lastGCDuration;
+                averageDuration -= gcDuration;
+                recentDuration /= 1000.0;
+                averageDuration /= 1000.0;
+
+                strings[0] = String.format("%.1f", resultCount / recentDuration);
+                strings[1] = String.format("%.1f", totalResultCount / averageDuration);
+
+                if (resultCount > 0) {
+                    strings[2] =
+                            String.format("%.3f", (waitTime - (gcDuration - lastGCDuration))
+                                    / (double) resultCount / 1000000.0);
+                } else {
+                    strings[2] = "-";
+                }
+
+                if (totalResultCount > 0) {
+                    strings[3] =
+                            String.format("%.3f", (totalWaitTime - gcDuration)
+                                    / (double) totalResultCount / 1000000.0);
+                } else {
+                    strings[3] = "-";
+                }
+
+                boolean changed = false;
+                etimes = eTimeBuffer.getAndSet(etimes);
+                final int appendLength = Math.min(array.remaining(), etimes.size());
+                if (appendLength > 0) {
+                    array.append(etimes, appendLength);
+                    for (int i = array.size - appendLength; i < array.size; i++) {
+                        array.siftUp(0, i);
+                    }
+                    changed = true;
+                }
+
+                // Our window buffer is now full. Replace smallest with anything
+                // larger and re-heapify
+                for (int i = appendLength; i < etimes.size(); i++) {
+                    if (etimes.get(i) > array.get(0)) {
+                        array.set(0, etimes.get(i));
+                        array.siftDown(0, array.size() - 1);
+                        changed = true;
+                    }
+                }
+                etimes.clear();
+
+                if (changed) {
+                    // Perform heapsort
+                    int i = array.size() - 1;
+                    while (i > 0) {
+                        array.swap(i, 0);
+                        array.siftDown(0, i - 1);
+                        i--;
+                    }
+                    array.reverse();
+                }
+
+                // Now everything is ordered from smallest to largest
+                int index;
+                int i = 4;
+                for (final Double percent : percentiles) {
+                    if (array.size() <= 0) {
+                        strings[i++] = "-";
+                    } else {
+                        index =
+                                array.size()
+                                        - (int) Math.floor((percent / 100.0) * totalResultCount)
+                                        - 1;
+                        if (index < 0) {
+                            strings[i++] = String.format("*%.3f", array.get(0) / 1000000.0);
+                        } else {
+                            strings[i++] = String.format("%.3f", array.get(index) / 1000000.0);
+                        }
+                    }
+                }
+                strings[i++] = String.format("%.1f", failedCount / recentDuration);
+                if (isAsync) {
+                    if (resultCount > 0) {
+                        strings[i++] = String.format("%.1f", (double) operationCount / resultCount);
+                    } else {
+                        strings[i++] = "-";
+                    }
+                }
+                for (final String column : getAdditionalColumns()) {
+                    strings[i++] = column;
+                }
+
+                if (printer != null) {
+                    printer.printRow(strings);
+                } else {
+                    // Script-friendly.
+                    app.getOutputStream().print(averageDuration);
+                    for (final String s : strings) {
+                        app.getOutputStream().print(",");
+                        app.getOutputStream().print(s);
+                    }
+                    app.getOutputStream().println();
+                }
+            }
         }
 
-        if (printer != null)
-        {
-          printer.printRow(strings);
+        String[] getAdditionalColumns() {
+            return EMPTY_STRINGS;
         }
-        else
-        {
-          // Script-friendly.
-          app.getOutputStream().print(averageDuration);
-          for (final String s : strings)
-          {
-            app.getOutputStream().print(",");
-            app.getOutputStream().print(s);
-          }
-          app.getOutputStream().println();
+    }
+
+    /**
+     * Statistics update result handler implementation.
+     *
+     * @param <S>
+     *            The type of expected result.
+     */
+    class UpdateStatsResultHandler<S extends Result> implements ResultHandler<S> {
+        private final long startTime;
+
+        UpdateStatsResultHandler(final long startTime) {
+            this.startTime = startTime;
         }
-      }
-    }
 
+        public void handleErrorResult(final ErrorResultException error) {
+            failedRecentCount.getAndIncrement();
+            updateStats();
 
-
-    String[] getAdditionalColumns()
-    {
-      return EMPTY_STRINGS;
-    }
-  }
-
-
-
-  /**
-   * Statistics update result handler implementation.
-   *
-   * @param <S>
-   *          The type of expected result.
-   */
-  class UpdateStatsResultHandler<S extends Result> implements ResultHandler<S>
-  {
-    private final long startTime;
-
-
-
-    UpdateStatsResultHandler(final long startTime)
-    {
-      this.startTime = startTime;
-    }
-
-
-
-    public void handleErrorResult(final ErrorResultException error)
-    {
-      failedRecentCount.getAndIncrement();
-      updateStats();
-
-      if (app.isVerbose())
-      {
-        app.println(LocalizableMessage.raw(error.getResult().toString()));
-      }
-    }
-
-
-
-    public void handleResult(final S result)
-    {
-      successRecentCount.getAndIncrement();
-      updateStats();
-    }
-
-
-
-    private void updateStats()
-    {
-      final long eTime = System.nanoTime() - startTime;
-      waitRecentTime.getAndAdd(eTime);
-      synchronized (this)
-      {
-        final ReversableArray array = eTimeBuffer.get();
-        if (array.remaining() == 0)
-        {
-          array.set(array.size() - 1, eTime);
+            if (app.isVerbose()) {
+                app.println(LocalizableMessage.raw(error.getResult().toString()));
+            }
         }
-        else
-        {
-          array.append(eTime);
+
+        public void handleResult(final S result) {
+            successRecentCount.getAndIncrement();
+            updateStats();
         }
-      }
-    }
-  }
 
-
-
-  /**
-   * Worker thread base implementation.
-   */
-  abstract class WorkerThread extends Thread
-  {
-    private int count;
-    private final Connection connection;
-    private final ConnectionFactory connectionFactory;
-
-
-
-    WorkerThread(final Connection connection,
-        final ConnectionFactory connectionFactory)
-    {
-      super("Worker Thread");
-      this.connection = connection;
-      this.connectionFactory = connectionFactory;
+        private void updateStats() {
+            final long eTime = System.nanoTime() - startTime;
+            waitRecentTime.getAndAdd(eTime);
+            synchronized (this) {
+                final ReversableArray array = eTimeBuffer.get();
+                if (array.remaining() == 0) {
+                    array.set(array.size() - 1, eTime);
+                } else {
+                    array.append(eTime);
+                }
+            }
+        }
     }
 
+    /**
+     * Worker thread base implementation.
+     */
+    abstract class WorkerThread extends Thread {
+        private int count;
+        private final Connection connection;
+        private final ConnectionFactory connectionFactory;
 
+        WorkerThread(final Connection connection, final ConnectionFactory connectionFactory) {
+            super("Worker Thread");
+            this.connection = connection;
+            this.connectionFactory = connectionFactory;
+        }
 
-    public abstract FutureResult<?> performOperation(Connection connection,
-        DataSource[] dataSources, long startTime);
+        public abstract FutureResult<?> performOperation(Connection connection,
+                DataSource[] dataSources, long startTime);
 
+        @Override
+        public void run() {
+            FutureResult<?> future;
+            Connection connection;
 
+            final double targetTimeInMS =
+                    (1000.0 / (targetThroughput / (double) (numThreads * numConnections)));
+            double sleepTimeInMS = 0;
+            long start;
+            while (!stopRequested && !(maxIterations > 0 && count >= maxIterations)) {
+                if (this.connection == null) {
+                    try {
+                        connection = connectionFactory.getConnectionAsync(null).get();
+                    } catch (final InterruptedException e) {
+                        // Ignore and check stop requested
+                        continue;
+                    } catch (final ErrorResultException e) {
+                        app.println(LocalizableMessage.raw(e.getResult().getDiagnosticMessage()));
+                        if (e.getCause() != null && app.isVerbose()) {
+                            e.getCause().printStackTrace(app.getErrorStream());
+                        }
+                        stopRequested = true;
+                        break;
+                    }
+                } else {
+                    connection = this.connection;
+                    if (!noRebind && connection instanceof AuthenticatedConnection) {
+                        final AuthenticatedConnection ac = (AuthenticatedConnection) connection;
+                        try {
+                            ac.rebindAsync(null).get();
+                        } catch (final InterruptedException e) {
+                            // Ignore and check stop requested
+                            continue;
+                        } catch (final ErrorResultException e) {
+                            app.println(LocalizableMessage.raw(e.getResult().toString()));
+                            if (e.getCause() != null && app.isVerbose()) {
+                                e.getCause().printStackTrace(app.getErrorStream());
+                            }
+                            stopRequested = true;
+                            break;
+                        }
+                    }
+                }
 
-    @Override
-    public void run()
-    {
-      FutureResult<?> future;
-      Connection connection;
+                start = System.nanoTime();
+                future = performOperation(connection, dataSources.get(), start);
+                operationRecentCount.getAndIncrement();
+                count++;
+                if (!isAsync) {
+                    try {
+                        future.get();
+                    } catch (final InterruptedException e) {
+                        // Ignore and check stop requested
+                        continue;
+                    } catch (final ErrorResultException e) {
+                        if (e.getCause() instanceof IOException) {
+                            e.getCause().printStackTrace(app.getErrorStream());
+                            stopRequested = true;
+                            break;
+                        }
+                        // Ignore. Handled by result handler
+                    } finally {
+                        if (this.connection == null) {
+                            connection.close();
+                        }
+                    }
+                }
+                if (targetThroughput > 0) {
+                    try {
+                        if (sleepTimeInMS > 1) {
+                            sleep((long) Math.floor(sleepTimeInMS));
+                        }
+                    } catch (final InterruptedException e) {
+                        continue;
+                    }
 
-      final double targetTimeInMS = (1000.0 / (targetThroughput /
-          (double) (numThreads * numConnections)));
-      double sleepTimeInMS = 0;
-      long start;
-      while (!stopRequested && !(maxIterations > 0 && count >= maxIterations))
-      {
-        if (this.connection == null)
-        {
-          try
-          {
-            connection = connectionFactory.getConnectionAsync(null).get();
-          }
-          catch (final InterruptedException e)
-          {
-            // Ignore and check stop requested
-            continue;
-          }
-          catch (final ErrorResultException e)
-          {
-            app.println(LocalizableMessage.raw(e.getResult()
-                .getDiagnosticMessage()));
-            if (e.getCause() != null && app.isVerbose())
-            {
-              e.getCause().printStackTrace(app.getErrorStream());
+                    sleepTimeInMS += targetTimeInMS - ((System.nanoTime() - start) / 1000000.0);
+                    if (sleepTimeInMS < -60000) {
+                        // If we fall behind by 60 seconds, just forget about
+                        // catching up
+                        sleepTimeInMS = -60000;
+                    }
+                }
+            }
+        }
+    }
+
+    private static class ReversableArray {
+        private final long[] array;
+
+        private boolean reversed;
+
+        private int size;
+
+        public ReversableArray(final int capacity) {
+            this.array = new long[capacity];
+        }
+
+        public void append(final long value) {
+            if (size == array.length) {
+                throw new IndexOutOfBoundsException();
+            }
+
+            if (!reversed) {
+                array[size] = value;
+            } else {
+                System.arraycopy(array, 0, array, 1, size);
+                array[0] = value;
+            }
+            size++;
+        }
+
+        public void append(final ReversableArray a, final int length) {
+            if (length > a.size() || length > remaining()) {
+                throw new IndexOutOfBoundsException();
+            }
+            if (!reversed) {
+                System.arraycopy(a.array, 0, array, size, length);
+            } else {
+                System.arraycopy(array, 0, array, length, size);
+                System.arraycopy(a.array, 0, array, 0, length);
+            }
+            size += length;
+        }
+
+        public void clear() {
+            size = 0;
+        }
+
+        public long get(final int index) {
+            if (index >= size) {
+                throw new IndexOutOfBoundsException();
+            }
+            if (!reversed) {
+                return array[index];
+            } else {
+                return array[size - index - 1];
+            }
+        }
+
+        public int remaining() {
+            return array.length - size;
+        }
+
+        public void reverse() {
+            reversed = !reversed;
+        }
+
+        public void set(final int index, final long value) {
+            if (index >= size) {
+                throw new IndexOutOfBoundsException();
+            }
+            if (!reversed) {
+                array[index] = value;
+            } else {
+                array[size - index - 1] = value;
+            }
+        }
+
+        public void siftDown(final int start, final int end) {
+            int root = start;
+            int child;
+            while (root * 2 + 1 <= end) {
+                child = root * 2 + 1;
+                if (child + 1 <= end && get(child) > get(child + 1)) {
+                    child = child + 1;
+                }
+                if (get(root) > get(child)) {
+                    swap(root, child);
+                    root = child;
+                } else {
+                    return;
+                }
+            }
+        }
+
+        public void siftUp(final int start, final int end) {
+            int child = end;
+            int parent;
+            while (child > start) {
+                parent = (int) Math.floor((child - 1) / 2.0);
+                if (get(parent) > get(child)) {
+                    swap(parent, child);
+                    child = parent;
+                } else {
+                    return;
+                }
+            }
+        }
+
+        public int size() {
+            return size;
+        }
+
+        private void swap(final int i, final int i2) {
+            final long temp = get(i);
+            set(i, get(i2));
+            set(i2, temp);
+        }
+    }
+
+    private static final String[] EMPTY_STRINGS = new String[0];
+
+    private final AtomicInteger operationRecentCount = new AtomicInteger();
+
+    protected final AtomicInteger successRecentCount = new AtomicInteger();
+
+    protected final AtomicInteger failedRecentCount = new AtomicInteger();
+
+    private final AtomicLong waitRecentTime = new AtomicLong();
+
+    private final AtomicReference<ReversableArray> eTimeBuffer =
+            new AtomicReference<ReversableArray>(new ReversableArray(100000));
+
+    private final ConsoleApplication app;
+
+    private DataSource[] dataSourcePrototypes;
+
+    // Thread local copies of the data sources
+    private final ThreadLocal<DataSource[]> dataSources = new ThreadLocal<DataSource[]>() {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected DataSource[] initialValue() {
+            final DataSource[] prototypes = getDataSources();
+            final int sz = prototypes.length;
+            final DataSource[] threadLocalCopy = new DataSource[sz];
+            for (int i = 0; i < sz; i++) {
+                threadLocalCopy[i] = prototypes[i].duplicate();
+            }
+            return threadLocalCopy;
+        }
+
+    };
+
+    private volatile boolean stopRequested;
+
+    private int numThreads;
+
+    private int numConnections;
+
+    private int targetThroughput;
+
+    private int maxIterations;
+
+    private boolean isAsync;
+
+    private boolean noRebind;
+
+    private int statsInterval;
+
+    private final IntegerArgument numThreadsArgument;
+
+    private final IntegerArgument maxIterationsArgument;
+
+    private final IntegerArgument statsIntervalArgument;
+
+    private final IntegerArgument targetThroughputArgument;
+
+    private final IntegerArgument numConnectionsArgument;
+
+    private final IntegerArgument percentilesArgument;
+
+    private final BooleanArgument keepConnectionsOpen;
+
+    private final BooleanArgument noRebindArgument;
+
+    private final BooleanArgument asyncArgument;
+
+    private final StringArgument arguments;
+
+    PerformanceRunner(final ArgumentParser argParser, final ConsoleApplication app,
+            final boolean neverRebind, final boolean neverAsynchronous,
+            final boolean alwaysSingleThreaded) throws ArgumentException {
+        this.app = app;
+        numThreadsArgument =
+                new IntegerArgument("numThreads", 't', "numThreads", false, false, true,
+                        LocalizableMessage.raw("{numThreads}"), 1, null, true, 1, false, 0,
+                        LocalizableMessage.raw("Number of worker threads per connection"));
+        numThreadsArgument.setPropertyName("numThreads");
+        if (!alwaysSingleThreaded) {
+            argParser.addArgument(numThreadsArgument);
+        } else {
+            numThreadsArgument.addValue("1");
+        }
+
+        numConnectionsArgument =
+                new IntegerArgument("numConnections", 'c', "numConnections", false, false, true,
+                        LocalizableMessage.raw("{numConnections}"), 1, null, true, 1, false, 0,
+                        LocalizableMessage.raw("Number of connections"));
+        numConnectionsArgument.setPropertyName("numConnections");
+        argParser.addArgument(numConnectionsArgument);
+
+        maxIterationsArgument =
+                new IntegerArgument("maxIterations", 'm', "maxIterations", false, false, true,
+                        LocalizableMessage.raw("{maxIterations}"), 0, null, LocalizableMessage
+                                .raw("Max iterations, 0 for unlimited"));
+        maxIterationsArgument.setPropertyName("maxIterations");
+        argParser.addArgument(maxIterationsArgument);
+
+        statsIntervalArgument =
+                new IntegerArgument("statInterval", 'i', "statInterval", false, false, true,
+                        LocalizableMessage.raw("{statInterval}"), 5, null, true, 1, false, 0,
+                        LocalizableMessage.raw("Display results each specified number of seconds"));
+        statsIntervalArgument.setPropertyName("statInterval");
+        argParser.addArgument(statsIntervalArgument);
+
+        targetThroughputArgument =
+                new IntegerArgument("targetThroughput", 'M', "targetThroughput", false, false,
+                        true, LocalizableMessage.raw("{targetThroughput}"), 0, null,
+                        LocalizableMessage.raw("Target average throughput to achieve"));
+        targetThroughputArgument.setPropertyName("targetThroughput");
+        argParser.addArgument(targetThroughputArgument);
+
+        percentilesArgument =
+                new IntegerArgument("percentile", 'e', "percentile", false, true,
+                        LocalizableMessage.raw("{percentile}"), true, 0, true, 100,
+                        LocalizableMessage.raw("Calculate max response time for a "
+                                + "percentile of operations"));
+        percentilesArgument.setPropertyName("percentile");
+        percentilesArgument.setMultiValued(true);
+        argParser.addArgument(percentilesArgument);
+
+        keepConnectionsOpen =
+                new BooleanArgument("keepConnectionsOpen", 'f', "keepConnectionsOpen",
+                        LocalizableMessage.raw("Keep connections open"));
+        keepConnectionsOpen.setPropertyName("keepConnectionsOpen");
+        argParser.addArgument(keepConnectionsOpen);
+
+        noRebindArgument =
+                new BooleanArgument("noRebind", 'F', "noRebind", LocalizableMessage
+                        .raw("Keep connections open and don't rebind"));
+        noRebindArgument.setPropertyName("noRebind");
+        if (!neverRebind) {
+            argParser.addArgument(noRebindArgument);
+        } else {
+            noRebindArgument.addValue(String.valueOf(true));
+        }
+
+        asyncArgument =
+                new BooleanArgument("asynchronous", 'A', "asynchronous", LocalizableMessage
+                        .raw("Use asynchronous mode and don't "
+                                + "wait for results before sending the next request"));
+        asyncArgument.setPropertyName("asynchronous");
+        if (!neverAsynchronous) {
+            argParser.addArgument(asyncArgument);
+        }
+
+        arguments =
+                new StringArgument(
+                        "argument",
+                        'g',
+                        "argument",
+                        false,
+                        true,
+                        true,
+                        LocalizableMessage.raw("{generator function or static string}"),
+                        null,
+                        null,
+                        LocalizableMessage
+                                .raw("Argument used to evaluate the Java "
+                                        + "style format strings in program parameters (ie. Base DN, "
+                                        + "Search Filter). The set of all arguments provided form the "
+                                        + "the argument list in order. Besides static string "
+                                        + "arguments, they can be generated per iteration with the "
+                                        + "following functions: " + StaticUtils.EOL
+                                        + DataSource.getUsage()));
+        argParser.addArgument(arguments);
+    }
+
+    public void handleConnectionClosed() {
+        // Ignore
+    }
+
+    public synchronized void handleConnectionError(final boolean isDisconnectNotification,
+            final ErrorResultException error) {
+        if (!stopRequested) {
+            app.println(LocalizableMessage.raw("Error occurred on one or more " + "connections: "
+                    + error.getResult().toString()));
+            if (error.getCause() != null && app.isVerbose()) {
+                error.getCause().printStackTrace(app.getErrorStream());
             }
             stopRequested = true;
-            break;
-          }
         }
-        else
-        {
-          connection = this.connection;
-          if (!noRebind && connection instanceof AuthenticatedConnection)
-          {
-            final AuthenticatedConnection ac = (AuthenticatedConnection) connection;
-            try
-            {
-              ac.rebindAsync(null).get();
+    }
+
+    public void handleUnsolicitedNotification(final ExtendedResult notification) {
+        // Ignore
+    }
+
+    public final void validate() throws ArgumentException {
+        numConnections = numConnectionsArgument.getIntValue();
+        numThreads = numThreadsArgument.getIntValue();
+        maxIterations = maxIterationsArgument.getIntValue() / numConnections / numThreads;
+        statsInterval = statsIntervalArgument.getIntValue() * 1000;
+        targetThroughput = targetThroughputArgument.getIntValue();
+
+        isAsync = asyncArgument.isPresent();
+        noRebind = noRebindArgument.isPresent();
+
+        if (!noRebindArgument.isPresent() && this.numThreads > 1) {
+            throw new ArgumentException(LocalizableMessage.raw("--"
+                    + noRebindArgument.getLongIdentifier() + " must be used if --"
+                    + numThreadsArgument.getLongIdentifier() + " is > 1"));
+        }
+
+        if (!noRebindArgument.isPresent() && asyncArgument.isPresent()) {
+            throw new ArgumentException(LocalizableMessage.raw("--"
+                    + noRebindArgument.getLongIdentifier() + " must be used when using --"
+                    + asyncArgument.getLongIdentifier()));
+        }
+
+        dataSourcePrototypes = DataSource.parse(arguments.getValues());
+    }
+
+    final DataSource[] getDataSources() {
+        if (dataSourcePrototypes == null) {
+            throw new IllegalStateException(
+                    "dataSources are null - validate() must be called first");
+        }
+        return dataSourcePrototypes;
+    }
+
+    abstract WorkerThread newWorkerThread(final Connection connection,
+            final ConnectionFactory connectionFactory);
+
+    abstract StatsThread newStatsThread();
+
+    final int run(final ConnectionFactory connectionFactory) {
+        final List<Thread> threads = new ArrayList<Thread>();
+        final List<Connection> connections = new ArrayList<Connection>();
+
+        Connection connection = null;
+        try {
+            for (int i = 0; i < numConnections; i++) {
+                if (keepConnectionsOpen.isPresent() || noRebindArgument.isPresent()) {
+                    connection = connectionFactory.getConnectionAsync(null).get();
+                    connection.addConnectionEventListener(this);
+                    connections.add(connection);
+                }
+                for (int j = 0; j < numThreads; j++) {
+                    final Thread thread = newWorkerThread(connection, connectionFactory);
+                    threads.add(thread);
+                    thread.start();
+                }
             }
-            catch (final InterruptedException e)
-            {
-              // Ignore and check stop requested
-              continue;
+
+            final Thread statsThread = newStatsThread();
+            statsThread.start();
+
+            for (final Thread t : threads) {
+                t.join();
             }
-            catch (final ErrorResultException e)
-            {
-              app.println(LocalizableMessage.raw(e.getResult().toString()));
-              if (e.getCause() != null && app.isVerbose())
-              {
-                e.getCause().printStackTrace(app.getErrorStream());
-              }
-              stopRequested = true;
-              break;
+            stopRequested = true;
+            statsThread.join();
+        } catch (final InterruptedException e) {
+            stopRequested = true;
+        } catch (final ErrorResultException e) {
+            stopRequested = true;
+            app.println(LocalizableMessage.raw(e.getResult().getDiagnosticMessage()));
+        } finally {
+            for (final Connection c : connections) {
+                c.close();
             }
-          }
         }
 
-        start = System.nanoTime();
-        future = performOperation(connection, dataSources.get(), start);
-        operationRecentCount.getAndIncrement();
-        count++;
-        if (!isAsync)
-        {
-          try
-          {
-            future.get();
-          }
-          catch (final InterruptedException e)
-          {
-            // Ignore and check stop requested
-            continue;
-          }
-          catch (final ErrorResultException e)
-          {
-            if (e.getCause() instanceof IOException)
-            {
-              e.getCause().printStackTrace(app.getErrorStream());
-              stopRequested = true;
-              break;
-            }
-            // Ignore. Handled by result handler
-          }
-          finally
-          {
-            if (this.connection == null)
-            {
-              connection.close();
-            }
-          }
-        }
-        if (targetThroughput > 0)
-        {
-          try
-          {
-            if (sleepTimeInMS > 1)
-            {
-              sleep((long) Math.floor(sleepTimeInMS));
-            }
-          }
-          catch (final InterruptedException e)
-          {
-            continue;
-          }
-
-          sleepTimeInMS += targetTimeInMS
-              - ((System.nanoTime() - start) / 1000000.0);
-          if (sleepTimeInMS < -60000)
-          {
-            // If we fall behind by 60 seconds, just forget about
-            // catching up
-            sleepTimeInMS = -60000;
-          }
-        }
-      }
+        return 0;
     }
-  }
-
-
-
-  private static class ReversableArray
-  {
-    private final long[] array;
-
-    private boolean reversed;
-
-    private int size;
-
-
-
-    public ReversableArray(final int capacity)
-    {
-      this.array = new long[capacity];
-    }
-
-
-
-    public void append(final long value)
-    {
-      if (size == array.length)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-
-      if (!reversed)
-      {
-        array[size] = value;
-      }
-      else
-      {
-        System.arraycopy(array, 0, array, 1, size);
-        array[0] = value;
-      }
-      size++;
-    }
-
-
-
-    public void append(final ReversableArray a, final int length)
-    {
-      if (length > a.size() || length > remaining())
-      {
-        throw new IndexOutOfBoundsException();
-      }
-      if (!reversed)
-      {
-        System.arraycopy(a.array, 0, array, size, length);
-      }
-      else
-      {
-        System.arraycopy(array, 0, array, length, size);
-        System.arraycopy(a.array, 0, array, 0, length);
-      }
-      size += length;
-    }
-
-
-
-    public void clear()
-    {
-      size = 0;
-    }
-
-
-
-    public long get(final int index)
-    {
-      if (index >= size)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-      if (!reversed)
-      {
-        return array[index];
-      }
-      else
-      {
-        return array[size - index - 1];
-      }
-    }
-
-
-
-    public int remaining()
-    {
-      return array.length - size;
-    }
-
-
-
-    public void reverse()
-    {
-      reversed = !reversed;
-    }
-
-
-
-    public void set(final int index, final long value)
-    {
-      if (index >= size)
-      {
-        throw new IndexOutOfBoundsException();
-      }
-      if (!reversed)
-      {
-        array[index] = value;
-      }
-      else
-      {
-        array[size - index - 1] = value;
-      }
-    }
-
-
-
-    public void siftDown(final int start, final int end)
-    {
-      int root = start;
-      int child;
-      while (root * 2 + 1 <= end)
-      {
-        child = root * 2 + 1;
-        if (child + 1 <= end && get(child) > get(child + 1))
-        {
-          child = child + 1;
-        }
-        if (get(root) > get(child))
-        {
-          swap(root, child);
-          root = child;
-        }
-        else
-        {
-          return;
-        }
-      }
-    }
-
-
-
-    public void siftUp(final int start, final int end)
-    {
-      int child = end;
-      int parent;
-      while (child > start)
-      {
-        parent = (int) Math.floor((child - 1) / 2.0);
-        if (get(parent) > get(child))
-        {
-          swap(parent, child);
-          child = parent;
-        }
-        else
-        {
-          return;
-        }
-      }
-    }
-
-
-
-    public int size()
-    {
-      return size;
-    }
-
-
-
-    private void swap(final int i, final int i2)
-    {
-      final long temp = get(i);
-      set(i, get(i2));
-      set(i2, temp);
-    }
-  }
-
-
-
-  private static final String[] EMPTY_STRINGS = new String[0];
-
-  private final AtomicInteger operationRecentCount = new AtomicInteger();
-
-  protected final AtomicInteger successRecentCount = new AtomicInteger();
-
-  protected final AtomicInteger failedRecentCount = new AtomicInteger();
-
-  private final AtomicLong waitRecentTime = new AtomicLong();
-
-  private final AtomicReference<ReversableArray> eTimeBuffer = new AtomicReference<ReversableArray>(
-      new ReversableArray(100000));
-
-  private final ConsoleApplication app;
-
-  private DataSource[] dataSourcePrototypes;
-
-  // Thread local copies of the data sources
-  private final ThreadLocal<DataSource[]> dataSources = new ThreadLocal<DataSource[]>()
-  {
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected DataSource[] initialValue()
-    {
-      final DataSource[] prototypes = getDataSources();
-      final int sz = prototypes.length;
-      final DataSource[] threadLocalCopy = new DataSource[sz];
-      for (int i = 0; i < sz; i++)
-      {
-        threadLocalCopy[i] = prototypes[i].duplicate();
-      }
-      return threadLocalCopy;
-    }
-
-  };
-
-  private volatile boolean stopRequested;
-
-  private int numThreads;
-
-  private int numConnections;
-
-  private int targetThroughput;
-
-  private int maxIterations;
-
-  private boolean isAsync;
-
-  private boolean noRebind;
-
-  private int statsInterval;
-
-  private final IntegerArgument numThreadsArgument;
-
-  private final IntegerArgument maxIterationsArgument;
-
-  private final IntegerArgument statsIntervalArgument;
-
-  private final IntegerArgument targetThroughputArgument;
-
-  private final IntegerArgument numConnectionsArgument;
-
-  private final IntegerArgument percentilesArgument;
-
-  private final BooleanArgument keepConnectionsOpen;
-
-  private final BooleanArgument noRebindArgument;
-
-  private final BooleanArgument asyncArgument;
-
-  private final StringArgument arguments;
-
-
-
-  PerformanceRunner(final ArgumentParser argParser,
-      final ConsoleApplication app, final boolean neverRebind,
-      final boolean neverAsynchronous, final boolean alwaysSingleThreaded)
-      throws ArgumentException
-  {
-    this.app = app;
-    numThreadsArgument = new IntegerArgument("numThreads", 't', "numThreads",
-        false, false, true, LocalizableMessage.raw("{numThreads}"), 1, null,
-        true, 1, false, 0,
-        LocalizableMessage.raw("Number of worker threads per connection"));
-    numThreadsArgument.setPropertyName("numThreads");
-    if (!alwaysSingleThreaded)
-    {
-      argParser.addArgument(numThreadsArgument);
-    }
-    else
-    {
-      numThreadsArgument.addValue("1");
-    }
-
-    numConnectionsArgument = new IntegerArgument("numConnections", 'c',
-        "numConnections", false, false, true,
-        LocalizableMessage.raw("{numConnections}"), 1, null, true, 1, false, 0,
-        LocalizableMessage.raw("Number of connections"));
-    numConnectionsArgument.setPropertyName("numConnections");
-    argParser.addArgument(numConnectionsArgument);
-
-    maxIterationsArgument = new IntegerArgument("maxIterations", 'm',
-        "maxIterations", false, false, true,
-        LocalizableMessage.raw("{maxIterations}"), 0, null,
-        LocalizableMessage.raw("Max iterations, 0 for unlimited"));
-    maxIterationsArgument.setPropertyName("maxIterations");
-    argParser.addArgument(maxIterationsArgument);
-
-    statsIntervalArgument = new IntegerArgument("statInterval", 'i',
-        "statInterval", false, false, true,
-        LocalizableMessage.raw("{statInterval}"), 5, null, true, 1, false, 0,
-        LocalizableMessage
-            .raw("Display results each specified number of seconds"));
-    statsIntervalArgument.setPropertyName("statInterval");
-    argParser.addArgument(statsIntervalArgument);
-
-    targetThroughputArgument = new IntegerArgument("targetThroughput", 'M',
-        "targetThroughput", false, false, true,
-        LocalizableMessage.raw("{targetThroughput}"), 0, null,
-        LocalizableMessage.raw("Target average throughput to achieve"));
-    targetThroughputArgument.setPropertyName("targetThroughput");
-    argParser.addArgument(targetThroughputArgument);
-
-    percentilesArgument = new IntegerArgument("percentile", 'e', "percentile",
-        false, true, LocalizableMessage.raw("{percentile}"), true, 0, true,
-        100, LocalizableMessage.raw("Calculate max response time for a "
-            + "percentile of operations"));
-    percentilesArgument.setPropertyName("percentile");
-    percentilesArgument.setMultiValued(true);
-    argParser.addArgument(percentilesArgument);
-
-    keepConnectionsOpen = new BooleanArgument("keepConnectionsOpen", 'f',
-        "keepConnectionsOpen", LocalizableMessage.raw("Keep connections open"));
-    keepConnectionsOpen.setPropertyName("keepConnectionsOpen");
-    argParser.addArgument(keepConnectionsOpen);
-
-    noRebindArgument = new BooleanArgument("noRebind", 'F', "noRebind",
-        LocalizableMessage.raw("Keep connections open and don't rebind"));
-    noRebindArgument.setPropertyName("noRebind");
-    if (!neverRebind)
-    {
-      argParser.addArgument(noRebindArgument);
-    }
-    else
-    {
-      noRebindArgument.addValue(String.valueOf(true));
-    }
-
-    asyncArgument = new BooleanArgument("asynchronous", 'A', "asynchronous",
-        LocalizableMessage.raw("Use asynchronous mode and don't "
-            + "wait for results before sending the next request"));
-    asyncArgument.setPropertyName("asynchronous");
-    if (!neverAsynchronous)
-    {
-      argParser.addArgument(asyncArgument);
-    }
-
-    arguments = new StringArgument(
-        "argument",
-        'g',
-        "argument",
-        false,
-        true,
-        true,
-        LocalizableMessage.raw("{generator function or static string}"),
-        null,
-        null,
-        LocalizableMessage.raw("Argument used to evaluate the Java "
-            + "style format strings in program parameters (ie. Base DN, "
-            + "Search Filter). The set of all arguments provided form the "
-            + "the argument list in order. Besides static string "
-            + "arguments, they can be generated per iteration with the "
-            + "following functions: " + StaticUtils.EOL + DataSource.getUsage()));
-    argParser.addArgument(arguments);
-  }
-
-
-
-  public void handleConnectionClosed()
-  {
-    // Ignore
-  }
-
-
-
-  public synchronized void handleConnectionError(
-      final boolean isDisconnectNotification, final ErrorResultException error)
-  {
-    if (!stopRequested)
-    {
-      app.println(LocalizableMessage.raw("Error occurred on one or more "
-          + "connections: " + error.getResult().toString()));
-      if (error.getCause() != null && app.isVerbose())
-      {
-        error.getCause().printStackTrace(app.getErrorStream());
-      }
-      stopRequested = true;
-    }
-  }
-
-
-
-  public void handleUnsolicitedNotification(final ExtendedResult notification)
-  {
-    // Ignore
-  }
-
-
-
-  public final void validate() throws ArgumentException
-  {
-    numConnections = numConnectionsArgument.getIntValue();
-    numThreads = numThreadsArgument.getIntValue();
-    maxIterations = maxIterationsArgument.getIntValue() / numConnections
-        / numThreads;
-    statsInterval = statsIntervalArgument.getIntValue() * 1000;
-    targetThroughput = targetThroughputArgument.getIntValue();
-
-    isAsync = asyncArgument.isPresent();
-    noRebind = noRebindArgument.isPresent();
-
-    if (!noRebindArgument.isPresent() && this.numThreads > 1)
-    {
-      throw new ArgumentException(LocalizableMessage.raw("--"
-          + noRebindArgument.getLongIdentifier() + " must be used if --"
-          + numThreadsArgument.getLongIdentifier() + " is > 1"));
-    }
-
-    if (!noRebindArgument.isPresent() && asyncArgument.isPresent())
-    {
-      throw new ArgumentException(LocalizableMessage.raw("--"
-          + noRebindArgument.getLongIdentifier()
-          + " must be used when using --" + asyncArgument.getLongIdentifier()));
-    }
-
-    dataSourcePrototypes = DataSource.parse(arguments.getValues());
-  }
-
-
-
-  final DataSource[] getDataSources()
-  {
-    if (dataSourcePrototypes == null)
-    {
-      throw new IllegalStateException(
-          "dataSources are null - validate() must be called first");
-    }
-    return dataSourcePrototypes;
-  }
-
-
-
-  abstract WorkerThread newWorkerThread(final Connection connection,
-      final ConnectionFactory connectionFactory);
-
-
-
-  abstract StatsThread newStatsThread();
-
-
-
-  final int run(final ConnectionFactory connectionFactory)
-  {
-    final List<Thread> threads = new ArrayList<Thread>();
-    final List<Connection> connections = new ArrayList<Connection>();
-
-    Connection connection = null;
-    try
-    {
-      for (int i = 0; i < numConnections; i++)
-      {
-        if (keepConnectionsOpen.isPresent() || noRebindArgument.isPresent())
-        {
-          connection = connectionFactory.getConnectionAsync(null).get();
-          connection.addConnectionEventListener(this);
-          connections.add(connection);
-        }
-        for (int j = 0; j < numThreads; j++)
-        {
-          final Thread thread = newWorkerThread(connection, connectionFactory);
-          threads.add(thread);
-          thread.start();
-        }
-      }
-
-      final Thread statsThread = newStatsThread();
-      statsThread.start();
-
-      for (final Thread t : threads)
-      {
-        t.join();
-      }
-      stopRequested = true;
-      statsThread.join();
-    }
-    catch (final InterruptedException e)
-    {
-      stopRequested = true;
-    }
-    catch (final ErrorResultException e)
-    {
-      stopRequested = true;
-      app.println(LocalizableMessage.raw(e.getResult().getDiagnosticMessage()));
-    }
-    finally
-    {
-      for (final Connection c : connections)
-      {
-        c.close();
-      }
-    }
-
-    return 0;
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java
index 4dfa7e7..d574e61 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PromptingTrustManager.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,8 +26,6 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 
 import java.io.File;
@@ -54,429 +51,317 @@
 
 import com.forgerock.opendj.util.Validator;
 
-
-
 /**
  * A trust manager which prompts the user for the length of time that they would
  * like to trust a server certificate.
  */
-final class PromptingTrustManager implements X509TrustManager
-{
-  /**
-   * Enumeration description server certificate trust option.
-   */
-  private static enum TrustOption
-  {
-    UNTRUSTED(1, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_NO.get()), SESSION(
-        2, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_SESSION.get()), PERMANENT(
-        3, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_ALWAYS.get()), CERTIFICATE_DETAILS(
-        4, INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS.get());
+final class PromptingTrustManager implements X509TrustManager {
+    /**
+     * Enumeration description server certificate trust option.
+     */
+    private static enum TrustOption {
+        UNTRUSTED(1, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_NO.get()), SESSION(2,
+                INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_SESSION.get()), PERMANENT(3,
+                INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_ALWAYS.get()), CERTIFICATE_DETAILS(4,
+                INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS.get());
 
-    private Integer choice;
+        private Integer choice;
 
-    private LocalizableMessage msg;
+        private LocalizableMessage msg;
 
+        /**
+         * Private constructor.
+         *
+         * @param i
+         *            the menu return value.
+         * @param msg
+         *            the message message.
+         */
+        private TrustOption(final int i, final LocalizableMessage msg) {
+            choice = i;
+            this.msg = msg;
+        }
 
+        /**
+         * Returns the choice number.
+         *
+         * @return the attribute name.
+         */
+        Integer getChoice() {
+            return choice;
+        }
+
+        /**
+         * Return the menu message.
+         *
+         * @return the menu message.
+         */
+        LocalizableMessage getMenuMessage() {
+            return msg;
+        }
+    }
+
+    static private final Logger LOG = Logger.getLogger(PromptingTrustManager.class.getName());
+
+    static private final String DEFAULT_PATH = System.getProperty("user.home") + File.separator
+            + ".opendj" + File.separator + "keystore";
+
+    static private final char[] DEFAULT_PASSWORD = "OpenDJ".toCharArray();
+
+    private final KeyStore inMemoryTrustStore;
+
+    private final KeyStore onDiskTrustStore;
+
+    private final X509TrustManager inMemoryTrustManager;
+
+    private final X509TrustManager onDiskTrustManager;
+
+    private final X509TrustManager nestedTrustManager;
+
+    private final ConsoleApplication app;
+
+    PromptingTrustManager(final ConsoleApplication app, final String acceptedStorePath,
+            final X509TrustManager sourceTrustManager) throws KeyStoreException, IOException,
+            NoSuchAlgorithmException, CertificateException {
+        Validator.ensureNotNull(app, acceptedStorePath);
+        this.app = app;
+        this.nestedTrustManager = sourceTrustManager;
+        inMemoryTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+        onDiskTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+
+        final File onDiskTrustStorePath = new File(acceptedStorePath);
+        inMemoryTrustStore.load(null, null);
+        if (!onDiskTrustStorePath.exists()) {
+            onDiskTrustStore.load(null, null);
+        } else {
+            final FileInputStream fos = new FileInputStream(onDiskTrustStorePath);
+            try {
+                onDiskTrustStore.load(fos, DEFAULT_PASSWORD);
+            } finally {
+                fos.close();
+            }
+        }
+        final TrustManagerFactory tmf =
+                TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+
+        tmf.init(inMemoryTrustStore);
+        X509TrustManager x509tm = null;
+        for (final TrustManager tm : tmf.getTrustManagers()) {
+            if (tm instanceof X509TrustManager) {
+                x509tm = (X509TrustManager) tm;
+                break;
+            }
+        }
+        if (x509tm == null) {
+            throw new NoSuchAlgorithmException();
+        }
+        this.inMemoryTrustManager = x509tm;
+
+        tmf.init(onDiskTrustStore);
+        x509tm = null;
+        for (final TrustManager tm : tmf.getTrustManagers()) {
+            if (tm instanceof X509TrustManager) {
+                x509tm = (X509TrustManager) tm;
+                break;
+            }
+        }
+        if (x509tm == null) {
+            throw new NoSuchAlgorithmException();
+        }
+        this.onDiskTrustManager = x509tm;
+    }
+
+    PromptingTrustManager(final ConsoleApplication app, final X509TrustManager sourceTrustManager)
+            throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
+        this(app, DEFAULT_PATH, sourceTrustManager);
+    }
+
+    public void checkClientTrusted(final X509Certificate[] x509Certificates, final String s)
+            throws CertificateException {
+        try {
+            inMemoryTrustManager.checkClientTrusted(x509Certificates, s);
+        } catch (final Exception ce1) {
+            try {
+                onDiskTrustManager.checkClientTrusted(x509Certificates, s);
+            } catch (final Exception ce2) {
+                if (nestedTrustManager != null) {
+                    try {
+                        nestedTrustManager.checkClientTrusted(x509Certificates, s);
+                    } catch (final Exception ce3) {
+                        checkManuallyTrusted(x509Certificates, ce3);
+                    }
+                } else {
+                    checkManuallyTrusted(x509Certificates, ce1);
+                }
+            }
+        }
+    }
+
+    public void checkServerTrusted(final X509Certificate[] x509Certificates, final String s)
+            throws CertificateException {
+        try {
+            inMemoryTrustManager.checkServerTrusted(x509Certificates, s);
+        } catch (final Exception ce1) {
+            try {
+                onDiskTrustManager.checkServerTrusted(x509Certificates, s);
+            } catch (final Exception ce2) {
+                if (nestedTrustManager != null) {
+                    try {
+                        nestedTrustManager.checkServerTrusted(x509Certificates, s);
+                    } catch (final Exception ce3) {
+                        checkManuallyTrusted(x509Certificates, ce3);
+                    }
+                } else {
+                    checkManuallyTrusted(x509Certificates, ce1);
+                }
+            }
+        }
+    }
+
+    public X509Certificate[] getAcceptedIssuers() {
+        if (nestedTrustManager != null) {
+            return nestedTrustManager.getAcceptedIssuers();
+        }
+        return new X509Certificate[0];
+    }
 
     /**
-     * Private constructor.
+     * This method is called when the user accepted a certificate.
      *
-     * @param i
-     *          the menu return value.
-     * @param msg
-     *          the message message.
+     * @param chain
+     *            the certificate chain accepted by the user. certificate.
      */
-    private TrustOption(final int i, final LocalizableMessage msg)
-    {
-      choice = i;
-      this.msg = msg;
+    private void acceptCertificate(final X509Certificate[] chain, final boolean permanent) {
+        if (permanent) {
+            LOG.log(Level.INFO, "Permanently accepting certificate chain to " + "truststore");
+        } else {
+            LOG.log(Level.INFO, "Accepting certificate chain for this session");
+        }
+
+        for (final X509Certificate aChain : chain) {
+            try {
+                final String alias = aChain.getSubjectDN().getName();
+                inMemoryTrustStore.setCertificateEntry(alias, aChain);
+                if (permanent) {
+                    onDiskTrustStore.setCertificateEntry(alias, aChain);
+                }
+            } catch (final Exception e) {
+                LOG.log(Level.WARNING, "Error setting certificate to store: " + e + "\nCert: "
+                        + aChain.toString());
+            }
+        }
+
+        if (permanent) {
+            try {
+                final File truststoreFile = new File(DEFAULT_PATH);
+                if (!truststoreFile.exists()) {
+                    createFile(truststoreFile);
+                }
+                final FileOutputStream fos = new FileOutputStream(truststoreFile);
+                onDiskTrustStore.store(fos, DEFAULT_PASSWORD);
+                fos.close();
+            } catch (final Exception e) {
+                LOG.log(Level.WARNING, "Error saving store to disk: " + e);
+            }
+        }
     }
 
-
-
     /**
-     * Returns the choice number.
+     * Indicate if the certificate chain can be trusted.
      *
-     * @return the attribute name.
+     * @param chain
+     *            The certificate chain to validate certificate.
      */
-    Integer getChoice()
-    {
-      return choice;
-    }
-
-
-
-    /**
-     * Return the menu message.
-     *
-     * @return the menu message.
-     */
-    LocalizableMessage getMenuMessage()
-    {
-      return msg;
-    }
-  }
-
-
-
-  static private final Logger LOG = Logger
-      .getLogger(PromptingTrustManager.class.getName());
-
-  static private final String DEFAULT_PATH = System.getProperty("user.home")
-      + File.separator + ".opendj" + File.separator + "keystore";
-
-  static private final char[] DEFAULT_PASSWORD = "OpenDJ".toCharArray();
-
-  private final KeyStore inMemoryTrustStore;
-
-  private final KeyStore onDiskTrustStore;
-
-  private final X509TrustManager inMemoryTrustManager;
-
-  private final X509TrustManager onDiskTrustManager;
-
-  private final X509TrustManager nestedTrustManager;
-
-  private final ConsoleApplication app;
-
-
-
-  PromptingTrustManager(final ConsoleApplication app,
-      final String acceptedStorePath, final X509TrustManager sourceTrustManager)
-      throws KeyStoreException, IOException, NoSuchAlgorithmException,
-      CertificateException
-  {
-    Validator.ensureNotNull(app, acceptedStorePath);
-    this.app = app;
-    this.nestedTrustManager = sourceTrustManager;
-    inMemoryTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-    onDiskTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-
-    final File onDiskTrustStorePath = new File(acceptedStorePath);
-    inMemoryTrustStore.load(null, null);
-    if (!onDiskTrustStorePath.exists())
-    {
-      onDiskTrustStore.load(null, null);
-    }
-    else
-    {
-      final FileInputStream fos = new FileInputStream(onDiskTrustStorePath);
-      try
-      {
-        onDiskTrustStore.load(fos, DEFAULT_PASSWORD);
-      }
-      finally
-      {
-        fos.close();
-      }
-    }
-    final TrustManagerFactory tmf = TrustManagerFactory
-        .getInstance(TrustManagerFactory.getDefaultAlgorithm());
-
-    tmf.init(inMemoryTrustStore);
-    X509TrustManager x509tm = null;
-    for (final TrustManager tm : tmf.getTrustManagers())
-    {
-      if (tm instanceof X509TrustManager)
-      {
-        x509tm = (X509TrustManager) tm;
-        break;
-      }
-    }
-    if (x509tm == null)
-    {
-      throw new NoSuchAlgorithmException();
-    }
-    this.inMemoryTrustManager = x509tm;
-
-    tmf.init(onDiskTrustStore);
-    x509tm = null;
-    for (final TrustManager tm : tmf.getTrustManagers())
-    {
-      if (tm instanceof X509TrustManager)
-      {
-        x509tm = (X509TrustManager) tm;
-        break;
-      }
-    }
-    if (x509tm == null)
-    {
-      throw new NoSuchAlgorithmException();
-    }
-    this.onDiskTrustManager = x509tm;
-  }
-
-
-
-  PromptingTrustManager(final ConsoleApplication app,
-      final X509TrustManager sourceTrustManager) throws KeyStoreException,
-      IOException, NoSuchAlgorithmException, CertificateException
-  {
-    this(app, DEFAULT_PATH, sourceTrustManager);
-  }
-
-
-
-  public void checkClientTrusted(final X509Certificate[] x509Certificates,
-      final String s) throws CertificateException
-  {
-    try
-    {
-      inMemoryTrustManager.checkClientTrusted(x509Certificates, s);
-    }
-    catch (final Exception ce1)
-    {
-      try
-      {
-        onDiskTrustManager.checkClientTrusted(x509Certificates, s);
-      }
-      catch (final Exception ce2)
-      {
-        if (nestedTrustManager != null)
-        {
-          try
-          {
-            nestedTrustManager.checkClientTrusted(x509Certificates, s);
-          }
-          catch (final Exception ce3)
-          {
-            checkManuallyTrusted(x509Certificates, ce3);
-          }
-        }
-        else
-        {
-          checkManuallyTrusted(x509Certificates, ce1);
-        }
-      }
-    }
-  }
-
-
-
-  public void checkServerTrusted(final X509Certificate[] x509Certificates,
-      final String s) throws CertificateException
-  {
-    try
-    {
-      inMemoryTrustManager.checkServerTrusted(x509Certificates, s);
-    }
-    catch (final Exception ce1)
-    {
-      try
-      {
-        onDiskTrustManager.checkServerTrusted(x509Certificates, s);
-      }
-      catch (final Exception ce2)
-      {
-        if (nestedTrustManager != null)
-        {
-          try
-          {
-            nestedTrustManager.checkServerTrusted(x509Certificates, s);
-          }
-          catch (final Exception ce3)
-          {
-            checkManuallyTrusted(x509Certificates, ce3);
-          }
-        }
-        else
-        {
-          checkManuallyTrusted(x509Certificates, ce1);
-        }
-      }
-    }
-  }
-
-
-
-  public X509Certificate[] getAcceptedIssuers()
-  {
-    if (nestedTrustManager != null)
-    {
-      return nestedTrustManager.getAcceptedIssuers();
-    }
-    return new X509Certificate[0];
-  }
-
-
-
-  /**
-   * This method is called when the user accepted a certificate.
-   *
-   * @param chain
-   *          the certificate chain accepted by the user. certificate.
-   */
-  private void acceptCertificate(final X509Certificate[] chain,
-      final boolean permanent)
-  {
-    if (permanent)
-    {
-      LOG.log(Level.INFO, "Permanently accepting certificate chain to "
-          + "truststore");
-    }
-    else
-    {
-      LOG.log(Level.INFO, "Accepting certificate chain for this session");
-    }
-
-    for (final X509Certificate aChain : chain)
-    {
-      try
-      {
-        final String alias = aChain.getSubjectDN().getName();
-        inMemoryTrustStore.setCertificateEntry(alias, aChain);
-        if (permanent)
-        {
-          onDiskTrustStore.setCertificateEntry(alias, aChain);
-        }
-      }
-      catch (final Exception e)
-      {
-        LOG.log(Level.WARNING, "Error setting certificate to store: " + e
-            + "\nCert: " + aChain.toString());
-      }
-    }
-
-    if (permanent)
-    {
-      try
-      {
-        final File truststoreFile = new File(DEFAULT_PATH);
-        if (!truststoreFile.exists())
-        {
-          createFile(truststoreFile);
-        }
-        final FileOutputStream fos = new FileOutputStream(truststoreFile);
-        onDiskTrustStore.store(fos, DEFAULT_PASSWORD);
-        fos.close();
-      }
-      catch (final Exception e)
-      {
-        LOG.log(Level.WARNING, "Error saving store to disk: " + e);
-      }
-    }
-  }
-
-
-
-  /**
-   * Indicate if the certificate chain can be trusted.
-   *
-   * @param chain
-   *          The certificate chain to validate certificate.
-   */
-  private void checkManuallyTrusted(final X509Certificate[] chain,
-      final Exception exception) throws CertificateException
-  {
-    app.println();
-    app.println(INFO_LDAP_CONN_PROMPT_SECURITY_SERVER_CERTIFICATE.get());
-    app.println();
-    for (final X509Certificate element : chain)
-    {
-      // Certificate DN
-      app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN
-          .get(element.getSubjectDN().toString()));
-
-      // certificate validity
-      app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY.get(
-          element.getNotBefore().toString(), element.getNotAfter().toString()));
-
-      // certificate Issuer
-      app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(element
-          .getIssuerDN().toString()));
-
-      app.println();
-      app.println();
-    }
-
-    app.println();
-    app.println(INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION.get());
-    app.println();
-
-    final Map<String, TrustOption> menuOptions = new HashMap<String, TrustOption>();
-    for (final TrustOption t : TrustOption.values())
-    {
-      menuOptions.put(t.getChoice().toString(), t);
-
-      final LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
-      builder.append(t.getChoice());
-      builder.append(") ");
-      builder.append(t.getMenuMessage());
-      app.println(builder.toMessage(), 2 /* Indent options */);
-    }
-
-    final TrustOption defaultTrustMethod = TrustOption.SESSION;
-    final LocalizableMessage promptMsg = INFO_MENU_PROMPT_SINGLE.get();
-
-    while (true)
-    {
-      app.println();
-      String choice;
-      try
-      {
-        choice = app.readInput(promptMsg, defaultTrustMethod.getChoice()
-            .toString());
-      }
-      catch (final CLIException e)
-      {
-        // What can we do here?
-        throw new CertificateException(exception);
-      }
-      finally
-      {
+    private void checkManuallyTrusted(final X509Certificate[] chain, final Exception exception)
+            throws CertificateException {
         app.println();
-      }
-
-      final TrustOption option = menuOptions.get(choice.trim());
-      if (option == null)
-      {
-        app.println(ERR_MENU_BAD_CHOICE_SINGLE.get());
+        app.println(INFO_LDAP_CONN_PROMPT_SECURITY_SERVER_CERTIFICATE.get());
         app.println();
-        continue;
-      }
+        for (final X509Certificate element : chain) {
+            // Certificate DN
+            app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN.get(element
+                    .getSubjectDN().toString()));
 
-      switch (option)
-      {
-      case UNTRUSTED:
-        if (exception instanceof CertificateException)
-        {
-          throw (CertificateException) exception;
+            // certificate validity
+            app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY.get(element
+                    .getNotBefore().toString(), element.getNotAfter().toString()));
+
+            // certificate Issuer
+            app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER.get(element.getIssuerDN()
+                    .toString()));
+
+            app.println();
+            app.println();
         }
-        else
-        {
-          throw new CertificateException(exception);
+
+        app.println();
+        app.println(INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION.get());
+        app.println();
+
+        final Map<String, TrustOption> menuOptions = new HashMap<String, TrustOption>();
+        for (final TrustOption t : TrustOption.values()) {
+            menuOptions.put(t.getChoice().toString(), t);
+
+            final LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
+            builder.append(t.getChoice());
+            builder.append(") ");
+            builder.append(t.getMenuMessage());
+            app.println(builder.toMessage(), 2 /* Indent options */);
         }
-      case CERTIFICATE_DETAILS:
-        for (final X509Certificate aChain : chain)
-        {
-          app.println();
-          app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE.get(aChain
-              .toString()));
-          app.println();
+
+        final TrustOption defaultTrustMethod = TrustOption.SESSION;
+        final LocalizableMessage promptMsg = INFO_MENU_PROMPT_SINGLE.get();
+
+        while (true) {
+            app.println();
+            String choice;
+            try {
+                choice = app.readInput(promptMsg, defaultTrustMethod.getChoice().toString());
+            } catch (final CLIException e) {
+                // What can we do here?
+                throw new CertificateException(exception);
+            } finally {
+                app.println();
+            }
+
+            final TrustOption option = menuOptions.get(choice.trim());
+            if (option == null) {
+                app.println(ERR_MENU_BAD_CHOICE_SINGLE.get());
+                app.println();
+                continue;
+            }
+
+            switch (option) {
+            case UNTRUSTED:
+                if (exception instanceof CertificateException) {
+                    throw (CertificateException) exception;
+                } else {
+                    throw new CertificateException(exception);
+                }
+            case CERTIFICATE_DETAILS:
+                for (final X509Certificate aChain : chain) {
+                    app.println();
+                    app.println(INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE.get(aChain.toString()));
+                    app.println();
+                }
+                break;
+            default: // SESSION / PERMANENT.
+                // Update the trust manager with the new certificate
+                acceptCertificate(chain, option == TrustOption.PERMANENT);
+                return;
+            }
         }
-        break;
-      default: // SESSION / PERMANENT.
-        // Update the trust manager with the new certificate
-        acceptCertificate(chain, option == TrustOption.PERMANENT);
-        return;
-      }
     }
-  }
 
-
-
-  private boolean createFile(final File f) throws IOException
-  {
-    boolean success = false;
-    if (f != null)
-    {
-      final File parent = f.getParentFile();
-      if (!parent.exists())
-      {
-        parent.mkdirs();
-      }
-      success = f.createNewFile();
+    private boolean createFile(final File f) throws IOException {
+        boolean success = false;
+        if (f != null) {
+            final File parent = f.getParentFile();
+            if (!parent.exists()) {
+                parent.mkdirs();
+            }
+            success = f.createNewFile();
+        }
+        return success;
     }
-    return success;
-  }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
index 5a7a566..a90d11d 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,10 +27,8 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
-import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 
 import java.util.ArrayList;
@@ -40,371 +37,290 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.FutureResult;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.Result;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.ldap.responses.SearchResultReference;
 
-
-
 /**
  * A load generation tool that can be used to load a Directory Server with
  * Search requests using one or more LDAP connections.
  */
-public final class SearchRate extends ConsoleApplication
-{
-  private final class SearchPerformanceRunner extends PerformanceRunner
-  {
-    private final class SearchStatsHandler extends
-        UpdateStatsResultHandler<Result> implements SearchResultHandler
-    {
-      private SearchStatsHandler(final long startTime)
-      {
-        super(startTime);
-      }
+public final class SearchRate extends ConsoleApplication {
+    private final class SearchPerformanceRunner extends PerformanceRunner {
+        private final class SearchStatsHandler extends UpdateStatsResultHandler<Result> implements
+                SearchResultHandler {
+            private SearchStatsHandler(final long startTime) {
+                super(startTime);
+            }
 
+            @Override
+            public boolean handleEntry(final SearchResultEntry entry) {
+                entryRecentCount.getAndIncrement();
+                return true;
+            }
 
+            @Override
+            public boolean handleReference(final SearchResultReference reference) {
+                return true;
+            }
+        }
 
-      @Override
-      public boolean handleEntry(final SearchResultEntry entry)
-      {
-        entryRecentCount.getAndIncrement();
-        return true;
-      }
+        private final class SearchStatsThread extends StatsThread {
+            private final String[] extraColumn;
 
+            private SearchStatsThread() {
+                super(new String[] { "Entries/Srch" });
+                extraColumn = new String[1];
+            }
 
+            @Override
+            String[] getAdditionalColumns() {
+                final int entryCount = entryRecentCount.getAndSet(0);
+                if (successCount > 0) {
+                    extraColumn[0] = String.format("%.1f", (double) entryCount / successCount);
+                } else {
+                    extraColumn[0] = String.format("%.1f", 0.0);
+                }
+                return extraColumn;
+            }
+        }
 
-      @Override
-      public boolean handleReference(final SearchResultReference reference)
-      {
-        return true;
-      }
+        private final class SearchWorkerThread extends WorkerThread {
+            private SearchRequest sr;
+            private Object[] data;
+
+            private SearchWorkerThread(final Connection connection,
+                    final ConnectionFactory connectionFactory) {
+                super(connection, connectionFactory);
+            }
+
+            @Override
+            public FutureResult<?> performOperation(final Connection connection,
+                    final DataSource[] dataSources, final long startTime) {
+                if (sr == null) {
+                    if (dataSources == null) {
+                        sr = Requests.newSearchRequest(baseDN, scope, filter, attributes);
+                    } else {
+                        data = DataSource.generateData(dataSources, data);
+                        sr =
+                                Requests.newSearchRequest(String.format(baseDN, data), scope,
+                                        String.format(filter, data), attributes);
+                    }
+                    sr.setDereferenceAliasesPolicy(dereferencesAliasesPolicy);
+                } else if (dataSources != null) {
+                    data = DataSource.generateData(dataSources, data);
+                    sr.setFilter(String.format(filter, data));
+                    sr.setName(String.format(baseDN, data));
+                }
+                return connection.searchAsync(sr, null, new SearchStatsHandler(startTime));
+            }
+        }
+
+        private String filter;
+        private String baseDN;
+        private SearchScope scope;
+        private DereferenceAliasesPolicy dereferencesAliasesPolicy;
+        private String[] attributes;
+
+        private SearchPerformanceRunner(final ArgumentParser argParser, final ConsoleApplication app)
+                throws ArgumentException {
+            super(argParser, app, false, false, false);
+        }
+
+        @Override
+        WorkerThread newWorkerThread(final Connection connection,
+                final ConnectionFactory connectionFactory) {
+            return new SearchWorkerThread(connection, connectionFactory);
+        }
+
+        @Override
+        StatsThread newStatsThread() {
+            return new SearchStatsThread();
+        }
     }
 
+    /**
+     * The main method for SearchRate tool.
+     *
+     * @param args
+     *            The command-line arguments provided to this program.
+     */
 
-
-    private final class SearchStatsThread extends StatsThread
-    {
-      private final String[] extraColumn;
-
-
-
-      private SearchStatsThread()
-      {
-        super(new String[] { "Entries/Srch" });
-        extraColumn = new String[1];
-      }
-
-
-
-      @Override
-      String[] getAdditionalColumns()
-      {
-        final int entryCount = entryRecentCount.getAndSet(0);
-        if (successCount > 0)
-        {
-          extraColumn[0] = String.format("%.1f", (double) entryCount
-              / successCount);
-        }
-        else
-        {
-          extraColumn[0] = String.format("%.1f", 0.0);
-        }
-        return extraColumn;
-      }
+    public static void main(final String[] args) {
+        final int retCode = new SearchRate().run(args);
+        System.exit(filterExitCode(retCode));
     }
 
+    private BooleanArgument verbose;
 
+    private BooleanArgument scriptFriendly;
 
-    private final class SearchWorkerThread extends WorkerThread
-    {
-      private SearchRequest sr;
-      private Object[] data;
+    private final AtomicInteger entryRecentCount = new AtomicInteger();
 
-
-
-      private SearchWorkerThread(final Connection connection,
-          final ConnectionFactory connectionFactory)
-      {
-        super(connection, connectionFactory);
-      }
-
-
-
-      @Override
-      public FutureResult<?> performOperation(final Connection connection,
-          final DataSource[] dataSources, final long startTime)
-      {
-        if (sr == null)
-        {
-          if (dataSources == null)
-          {
-            sr = Requests.newSearchRequest(baseDN, scope, filter, attributes);
-          }
-          else
-          {
-            data = DataSource.generateData(dataSources, data);
-            sr = Requests.newSearchRequest(String.format(baseDN, data), scope,
-                String.format(filter, data), attributes);
-          }
-          sr.setDereferenceAliasesPolicy(dereferencesAliasesPolicy);
-        }
-        else if (dataSources != null)
-        {
-          data = DataSource.generateData(dataSources, data);
-          sr.setFilter(String.format(filter, data));
-          sr.setName(String.format(baseDN, data));
-        }
-        return connection.searchAsync(sr, null, new SearchStatsHandler(
-            startTime));
-      }
+    private SearchRate() {
+        // Nothing to do.
     }
 
-
-
-    private String filter;
-    private String baseDN;
-    private SearchScope scope;
-    private DereferenceAliasesPolicy dereferencesAliasesPolicy;
-    private String[] attributes;
-
-
-
-    private SearchPerformanceRunner(final ArgumentParser argParser,
-        final ConsoleApplication app) throws ArgumentException
-    {
-      super(argParser, app, false, false, false);
-    }
-
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    WorkerThread newWorkerThread(final Connection connection,
-        final ConnectionFactory connectionFactory)
-    {
-      return new SearchWorkerThread(connection, connectionFactory);
+    public boolean isScriptFriendly() {
+        return scriptFriendly.isPresent();
     }
 
-
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    StatsThread newStatsThread()
-    {
-      return new SearchStatsThread();
-    }
-  }
-
-
-
-  /**
-   * The main method for SearchRate tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   */
-
-  public static void main(final String[] args)
-  {
-    final int retCode = new SearchRate().run(args);
-    System.exit(filterExitCode(retCode));
-  }
-
-
-
-  private BooleanArgument verbose;
-
-  private BooleanArgument scriptFriendly;
-
-  private final AtomicInteger entryRecentCount = new AtomicInteger();
-
-
-
-  private SearchRate()
-  {
-    // Nothing to do.
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isScriptFriendly()
-  {
-    return scriptFriendly.isPresent();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isVerbose()
-  {
-    return verbose.isPresent();
-  }
-
-
-
-  private int run(final String[] args)
-  {
-    // Create the command-line argument parser for use with this
-    // program.
-    final LocalizableMessage toolDescription = INFO_SEARCHRATE_TOOL_DESCRIPTION
-        .get();
-    final ArgumentParser argParser = new ArgumentParser(
-        SearchRate.class.getName(), toolDescription, false, true, 1, 0,
-        "[filter format string] [attributes ...]");
-
-    ConnectionFactoryProvider connectionFactoryProvider;
-    ConnectionFactory connectionFactory;
-    SearchPerformanceRunner runner;
-
-    StringArgument baseDN;
-    MultiChoiceArgument<SearchScope> searchScope;
-    MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
-    BooleanArgument showUsage;
-    StringArgument propertiesFileArgument;
-    BooleanArgument noPropertiesFileArgument;
-
-    try
-    {
-      Utils.setDefaultPerfToolProperties();
-
-      connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
-      runner = new SearchPerformanceRunner(argParser, this);
-
-      propertiesFileArgument = new StringArgument("propertiesFilePath", null,
-          OPTION_LONG_PROP_FILE_PATH, false, false, true,
-          INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
-          INFO_DESCRIPTION_PROP_FILE_PATH.get());
-      argParser.addArgument(propertiesFileArgument);
-      argParser.setFilePropertiesArgument(propertiesFileArgument);
-
-      noPropertiesFileArgument = new BooleanArgument(
-          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
-          INFO_DESCRIPTION_NO_PROP_FILE.get());
-      argParser.addArgument(noPropertiesFileArgument);
-      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
-
-      showUsage = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
-          OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
-      argParser.addArgument(showUsage);
-      argParser.setUsageArgument(showUsage, getOutputStream());
-
-      baseDN = new StringArgument("baseDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_BASEDN, true, false, true, INFO_BASEDN_PLACEHOLDER.get(),
-          null, null, INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get());
-      baseDN.setPropertyName(OPTION_LONG_BASEDN);
-      argParser.addArgument(baseDN);
-
-      searchScope = new MultiChoiceArgument<SearchScope>("searchScope", 's',
-          "searchScope", false, true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(),
-          SearchScope.values(), false,
-          INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
-      searchScope.setPropertyName("searchScope");
-      searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
-      argParser.addArgument(searchScope);
-
-      dereferencePolicy = new MultiChoiceArgument<DereferenceAliasesPolicy>(
-          "derefpolicy", 'a', "dereferencePolicy", false, true,
-          INFO_DEREFERENCE_POLICE_PLACEHOLDER.get(),
-          DereferenceAliasesPolicy.values(), false,
-          INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
-      dereferencePolicy.setPropertyName("dereferencePolicy");
-      dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
-      argParser.addArgument(dereferencePolicy);
-
-      verbose = new BooleanArgument("verbose", 'v', "verbose",
-          INFO_DESCRIPTION_VERBOSE.get());
-      verbose.setPropertyName("verbose");
-      argParser.addArgument(verbose);
-
-      scriptFriendly = new BooleanArgument("scriptFriendly", 'S',
-          "scriptFriendly", INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-      scriptFriendly.setPropertyName("scriptFriendly");
-      argParser.addArgument(scriptFriendly);
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+    public boolean isVerbose() {
+        return verbose.isPresent();
     }
 
-    // Parse the command-line arguments provided to this program.
-    try
-    {
-      argParser.parseArguments(args);
+    private int run(final String[] args) {
+        // Create the command-line argument parser for use with this
+        // program.
+        final LocalizableMessage toolDescription = INFO_SEARCHRATE_TOOL_DESCRIPTION.get();
+        final ArgumentParser argParser =
+                new ArgumentParser(SearchRate.class.getName(), toolDescription, false, true, 1, 0,
+                        "[filter format string] [attributes ...]");
 
-      // If we should just display usage or version information,
-      // then print it and exit.
-      if (argParser.usageOrVersionDisplayed())
-      {
-        return 0;
-      }
+        ConnectionFactoryProvider connectionFactoryProvider;
+        ConnectionFactory connectionFactory;
+        SearchPerformanceRunner runner;
 
-      connectionFactory = connectionFactoryProvider
-          .getAuthenticatedConnectionFactory();
-      runner.validate();
-    }
-    catch (final ArgumentException ae)
-    {
-      final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae
-          .getMessage());
-      println(message);
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+        StringArgument baseDN;
+        MultiChoiceArgument<SearchScope> searchScope;
+        MultiChoiceArgument<DereferenceAliasesPolicy> dereferencePolicy;
+        BooleanArgument showUsage;
+        StringArgument propertiesFileArgument;
+        BooleanArgument noPropertiesFileArgument;
 
-    final List<String> attributes = new LinkedList<String>();
-    final ArrayList<String> filterAndAttributeStrings = argParser
-        .getTrailingArguments();
-    if (filterAndAttributeStrings.size() > 0)
-    {
-      // the list of trailing arguments should be structured as follow:
-      // the first trailing argument is
-      // considered the filter, the other as attributes.
-      runner.filter = filterAndAttributeStrings.remove(0);
-      // The rest are attributes
-      for (final String s : filterAndAttributeStrings)
-      {
-        attributes.add(s);
-      }
-    }
-    runner.attributes = attributes.toArray(new String[attributes.size()]);
-    runner.baseDN = baseDN.getValue();
-    try
-    {
-      runner.scope = searchScope.getTypedValue();
-      runner.dereferencesAliasesPolicy = dereferencePolicy.getTypedValue();
-    }
-    catch (final ArgumentException ex1)
-    {
-      println(ex1.getMessageObject());
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+        try {
+            Utils.setDefaultPerfToolProperties();
 
-    try
-    {
-      // Try it out to make sure the format string and data sources
-      // match.
-      final Object[] data = DataSource.generateData(runner.getDataSources(),
-          null);
-      String.format(runner.filter, data);
-      String.format(runner.baseDN, data);
-    }
-    catch (final Exception ex1)
-    {
-      println(LocalizableMessage.raw("Error formatting filter or base DN: "
-          + ex1.toString()));
-      return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
-    }
+            connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
+            runner = new SearchPerformanceRunner(argParser, this);
 
-    return runner.run(connectionFactory);
-  }
+            propertiesFileArgument =
+                    new StringArgument("propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH,
+                            false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
+                            INFO_DESCRIPTION_PROP_FILE_PATH.get());
+            argParser.addArgument(propertiesFileArgument);
+            argParser.setFilePropertiesArgument(propertiesFileArgument);
+
+            noPropertiesFileArgument =
+                    new BooleanArgument("noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
+                            INFO_DESCRIPTION_NO_PROP_FILE.get());
+            argParser.addArgument(noPropertiesFileArgument);
+            argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
+
+            showUsage =
+                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            argParser.addArgument(showUsage);
+            argParser.setUsageArgument(showUsage, getOutputStream());
+
+            baseDN =
+                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true,
+                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
+                            INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get());
+            baseDN.setPropertyName(OPTION_LONG_BASEDN);
+            argParser.addArgument(baseDN);
+
+            searchScope =
+                    new MultiChoiceArgument<SearchScope>("searchScope", 's', "searchScope", false,
+                            true, INFO_SEARCH_SCOPE_PLACEHOLDER.get(), SearchScope.values(), false,
+                            INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get());
+            searchScope.setPropertyName("searchScope");
+            searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE);
+            argParser.addArgument(searchScope);
+
+            dereferencePolicy =
+                    new MultiChoiceArgument<DereferenceAliasesPolicy>("derefpolicy", 'a',
+                            "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER
+                                    .get(), DereferenceAliasesPolicy.values(), false,
+                            INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
+            dereferencePolicy.setPropertyName("dereferencePolicy");
+            dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
+            argParser.addArgument(dereferencePolicy);
+
+            verbose =
+                    new BooleanArgument("verbose", 'v', "verbose", INFO_DESCRIPTION_VERBOSE.get());
+            verbose.setPropertyName("verbose");
+            argParser.addArgument(verbose);
+
+            scriptFriendly =
+                    new BooleanArgument("scriptFriendly", 'S', "scriptFriendly",
+                            INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
+            scriptFriendly.setPropertyName("scriptFriendly");
+            argParser.addArgument(scriptFriendly);
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        // Parse the command-line arguments provided to this program.
+        try {
+            argParser.parseArguments(args);
+
+            // If we should just display usage or version information,
+            // then print it and exit.
+            if (argParser.usageOrVersionDisplayed()) {
+                return 0;
+            }
+
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
+            runner.validate();
+        } catch (final ArgumentException ae) {
+            final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+            println(message);
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        final List<String> attributes = new LinkedList<String>();
+        final ArrayList<String> filterAndAttributeStrings = argParser.getTrailingArguments();
+        if (filterAndAttributeStrings.size() > 0) {
+            // the list of trailing arguments should be structured as follow:
+            // the first trailing argument is
+            // considered the filter, the other as attributes.
+            runner.filter = filterAndAttributeStrings.remove(0);
+            // The rest are attributes
+            for (final String s : filterAndAttributeStrings) {
+                attributes.add(s);
+            }
+        }
+        runner.attributes = attributes.toArray(new String[attributes.size()]);
+        runner.baseDN = baseDN.getValue();
+        try {
+            runner.scope = searchScope.getTypedValue();
+            runner.dereferencesAliasesPolicy = dereferencePolicy.getTypedValue();
+        } catch (final ArgumentException ex1) {
+            println(ex1.getMessageObject());
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        try {
+            // Try it out to make sure the format string and data sources
+            // match.
+            final Object[] data = DataSource.generateData(runner.getDataSources(), null);
+            String.format(runner.filter, data);
+            String.format(runner.baseDN, data);
+        } catch (final Exception ex1) {
+            println(LocalizableMessage.raw("Error formatting filter or base DN: " + ex1.toString()));
+            return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
+        }
+
+        return runner.run(connectionFactory);
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StringArgument.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StringArgument.java
index c32e40a..1fc8e4e 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StringArgument.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StringArgument.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,122 +25,111 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 
-
-
 /**
  * This class defines an argument type that will accept any string value.
  */
-final class StringArgument extends Argument
-{
-  /**
-   * Creates a new string argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param isMultiValued
-   *          Indicates whether this argument may be specified more than once to
-   *          provide multiple values.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param defaultValue
-   *          The default value that should be used for this argument if none is
-   *          provided in a properties file or on the command line. This may be
-   *          <CODE>null</CODE> if there is no generic default.
-   * @param propertyName
-   *          The name of the property in a property file that may be used to
-   *          override the default value but will be overridden by a
-   *          command-line argument.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public StringArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean isMultiValued, final boolean needsValue,
-      final LocalizableMessage valuePlaceholder, final String defaultValue,
-      final String propertyName, final LocalizableMessage description)
-      throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
-        needsValue, valuePlaceholder, defaultValue, propertyName, description);
-  }
+final class StringArgument extends Argument {
+    /**
+     * Creates a new string argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param isMultiValued
+     *            Indicates whether this argument may be specified more than
+     *            once to provide multiple values.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param defaultValue
+     *            The default value that should be used for this argument if
+     *            none is provided in a properties file or on the command line.
+     *            This may be <CODE>null</CODE> if there is no generic default.
+     * @param propertyName
+     *            The name of the property in a property file that may be used
+     *            to override the default value but will be overridden by a
+     *            command-line argument.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public StringArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean isMultiValued,
+            final boolean needsValue, final LocalizableMessage valuePlaceholder,
+            final String defaultValue, final String propertyName,
+            final LocalizableMessage description) throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue,
+                valuePlaceholder, defaultValue, propertyName, description);
+    }
 
+    /**
+     * Creates a new string argument with the provided information.
+     *
+     * @param name
+     *            The generic name that should be used to refer to this
+     *            argument.
+     * @param shortIdentifier
+     *            The single-character identifier for this argument, or
+     *            <CODE>null</CODE> if there is none.
+     * @param longIdentifier
+     *            The long identifier for this argument, or <CODE>null</CODE> if
+     *            there is none.
+     * @param isRequired
+     *            Indicates whether this argument must be specified on the
+     *            command line.
+     * @param needsValue
+     *            Indicates whether this argument requires a value.
+     * @param valuePlaceholder
+     *            The placeholder for the argument value that will be displayed
+     *            in usage information, or <CODE>null</CODE> if this argument
+     *            does not require a value.
+     * @param description
+     *            LocalizableMessage for the description of this argument.
+     * @throws ArgumentException
+     *             If there is a problem with any of the parameters used to
+     *             create this argument.
+     */
+    public StringArgument(final String name, final Character shortIdentifier,
+            final String longIdentifier, final boolean isRequired, final boolean needsValue,
+            final LocalizableMessage valuePlaceholder, final LocalizableMessage description)
+            throws ArgumentException {
+        super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
+                valuePlaceholder, null, null, description);
+    }
 
-
-  /**
-   * Creates a new string argument with the provided information.
-   *
-   * @param name
-   *          The generic name that should be used to refer to this argument.
-   * @param shortIdentifier
-   *          The single-character identifier for this argument, or
-   *          <CODE>null</CODE> if there is none.
-   * @param longIdentifier
-   *          The long identifier for this argument, or <CODE>null</CODE> if
-   *          there is none.
-   * @param isRequired
-   *          Indicates whether this argument must be specified on the command
-   *          line.
-   * @param needsValue
-   *          Indicates whether this argument requires a value.
-   * @param valuePlaceholder
-   *          The placeholder for the argument value that will be displayed in
-   *          usage information, or <CODE>null</CODE> if this argument does not
-   *          require a value.
-   * @param description
-   *          LocalizableMessage for the description of this argument.
-   * @throws ArgumentException
-   *           If there is a problem with any of the parameters used to create
-   *           this argument.
-   */
-  public StringArgument(final String name, final Character shortIdentifier,
-      final String longIdentifier, final boolean isRequired,
-      final boolean needsValue, final LocalizableMessage valuePlaceholder,
-      final LocalizableMessage description) throws ArgumentException
-  {
-    super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue,
-        valuePlaceholder, null, null, description);
-  }
-
-
-
-  /**
-   * Indicates whether the provided value is acceptable for use in this
-   * argument.
-   *
-   * @param valueString
-   *          The value for which to make the determination.
-   * @param invalidReason
-   *          A buffer into which the invalid reason may be written if the value
-   *          is not acceptable.
-   * @return <CODE>true</CODE> if the value is acceptable, or <CODE>false</CODE>
-   *         if it is not.
-   */
-  @Override
-  public boolean valueIsAcceptable(final String valueString,
-      final LocalizableMessageBuilder invalidReason)
-  {
-    // All values will be acceptable for this argument.
-    return true;
-  }
+    /**
+     * Indicates whether the provided value is acceptable for use in this
+     * argument.
+     *
+     * @param valueString
+     *            The value for which to make the determination.
+     * @param invalidReason
+     *            A buffer into which the invalid reason may be written if the
+     *            value is not acceptable.
+     * @return <CODE>true</CODE> if the value is acceptable, or
+     *         <CODE>false</CODE> if it is not.
+     */
+    @Override
+    public boolean valueIsAcceptable(final String valueString,
+            final LocalizableMessageBuilder invalidReason) {
+        // All values will be acceptable for this argument.
+        return true;
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ToolConstants.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ToolConstants.java
index ce3688e..cdb9837 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ToolConstants.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ToolConstants.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -27,605 +26,600 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 /**
  * This class defines a number of constants used in one or more Directory Server
  * tools.
  */
-final class ToolConstants
-{
-  /**
-   * The name of the SASL property that can be used to provide the
-   * authentication ID for the bind.
-   */
-  static final String SASL_PROPERTY_AUTHID = "authid";
+final class ToolConstants {
+    /**
+     * The name of the SASL property that can be used to provide the
+     * authentication ID for the bind.
+     */
+    static final String SASL_PROPERTY_AUTHID = "authid";
 
-  /**
-   * The name of the SASL property that can be used to provide the authorization
-   * ID for the bind.
-   */
-  static final String SASL_PROPERTY_AUTHZID = "authzid";
+    /**
+     * The name of the SASL property that can be used to provide the
+     * authorization ID for the bind.
+     */
+    static final String SASL_PROPERTY_AUTHZID = "authzid";
 
-  /**
-   * The name of the SASL property that can be used to provide the digest URI
-   * for the bind.
-   */
-  static final String SASL_PROPERTY_DIGEST_URI = "digest-uri";
+    /**
+     * The name of the SASL property that can be used to provide the digest URI
+     * for the bind.
+     */
+    static final String SASL_PROPERTY_DIGEST_URI = "digest-uri";
 
-  /**
-   * The name of the SASL property that can be used to provide the KDC for use
-   * in Kerberos authentication.
-   */
-  static final String SASL_PROPERTY_KDC = "kdc";
+    /**
+     * The name of the SASL property that can be used to provide the KDC for use
+     * in Kerberos authentication.
+     */
+    static final String SASL_PROPERTY_KDC = "kdc";
 
-  /**
-   * The name of the SASL property that can be used to provide the quality of
-   * protection for the bind.
-   */
-  static final String SASL_PROPERTY_QOP = "qop";
+    /**
+     * The name of the SASL property that can be used to provide the quality of
+     * protection for the bind.
+     */
+    static final String SASL_PROPERTY_QOP = "qop";
 
-  /**
-   * The name of the SASL property that can be used to provide the realm for the
-   * bind.
-   */
-  static final String SASL_PROPERTY_REALM = "realm";
+    /**
+     * The name of the SASL property that can be used to provide the realm for
+     * the bind.
+     */
+    static final String SASL_PROPERTY_REALM = "realm";
 
-  /**
-   * The name of the SASL property that can be used to provide trace information
-   * for a SASL ANONYMOUS request.
-   */
-  static final String SASL_PROPERTY_TRACE = "trace";
+    /**
+     * The name of the SASL property that can be used to provide trace
+     * information for a SASL ANONYMOUS request.
+     */
+    static final String SASL_PROPERTY_TRACE = "trace";
 
-  /**
-   * The name of the SASL property that can be used to provide the SASL
-   * mechanism to use.
-   */
-  static final String SASL_PROPERTY_MECH = "mech";
+    /**
+     * The name of the SASL property that can be used to provide the SASL
+     * mechanism to use.
+     */
+    static final String SASL_PROPERTY_MECH = "mech";
 
-  /**
-   * The name of the opendj configuration direction in the user home directory.
-   */
-  static final String DEFAULT_OPENDJ_CONFIG_DIR = ".opendj";
+    /**
+     * The name of the opendj configuration direction in the user home
+     * directory.
+     */
+    static final String DEFAULT_OPENDJ_CONFIG_DIR = ".opendj";
 
-  /**
-   * The default properties file name.
-   */
-  static final String DEFAULT_OPENDJ_PROPERTIES_FILE_NAME = "tools";
+    /**
+     * The default properties file name.
+     */
+    static final String DEFAULT_OPENDJ_PROPERTIES_FILE_NAME = "tools";
 
-  /**
-   * The default properties file extension.
-   */
-  static final String DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION = ".properties";
+    /**
+     * The default properties file extension.
+     */
+    static final String DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION = ".properties";
 
-  /**
-   * The value for the short option batchFilePath.
-   */
-  static final char OPTION_SHORT_BATCH_FILE_PATH = 'F';
+    /**
+     * The value for the short option batchFilePath.
+     */
+    static final char OPTION_SHORT_BATCH_FILE_PATH = 'F';
 
-  /**
-   * The value for the long option batchFilePath .
-   */
-  static final String OPTION_LONG_BATCH_FILE_PATH = "batchFilePath";
+    /**
+     * The value for the long option batchFilePath .
+     */
+    static final String OPTION_LONG_BATCH_FILE_PATH = "batchFilePath";
 
-  /**
-   * The value for the short option hostname.
-   */
-  static final char OPTION_SHORT_HOST = 'h';
+    /**
+     * The value for the short option hostname.
+     */
+    static final char OPTION_SHORT_HOST = 'h';
 
-  /**
-   * The value for the long option hostname.
-   */
-  static final String OPTION_LONG_HOST = "hostname";
+    /**
+     * The value for the long option hostname.
+     */
+    static final String OPTION_LONG_HOST = "hostname";
 
-  /**
-   * The value for the short option port.
-   */
-  static final char OPTION_SHORT_PORT = 'p';
+    /**
+     * The value for the short option port.
+     */
+    static final char OPTION_SHORT_PORT = 'p';
 
-  /**
-   * The value for the long option port.
-   */
-  static final String OPTION_LONG_PORT = "port";
+    /**
+     * The value for the long option port.
+     */
+    static final String OPTION_LONG_PORT = "port";
 
-  /**
-   * The value for the short option useSSL.
-   */
-  static final char OPTION_SHORT_USE_SSL = 'Z';
+    /**
+     * The value for the short option useSSL.
+     */
+    static final char OPTION_SHORT_USE_SSL = 'Z';
 
-  /**
-   * The value for the long option useSSL.
-   */
-  static final String OPTION_LONG_USE_SSL = "useSSL";
+    /**
+     * The value for the long option useSSL.
+     */
+    static final String OPTION_LONG_USE_SSL = "useSSL";
 
-  /**
-   * The value for the short option baseDN.
-   */
-  static final char OPTION_SHORT_BASEDN = 'b';
+    /**
+     * The value for the short option baseDN.
+     */
+    static final char OPTION_SHORT_BASEDN = 'b';
 
-  /**
-   * The value for the long option baseDN.
-   */
-  static final String OPTION_LONG_BASEDN = "baseDN";
+    /**
+     * The value for the long option baseDN.
+     */
+    static final String OPTION_LONG_BASEDN = "baseDN";
 
-  /**
-   * The value for the short option bindDN.
-   */
-  static final char OPTION_SHORT_BINDDN = 'D';
+    /**
+     * The value for the short option bindDN.
+     */
+    static final char OPTION_SHORT_BINDDN = 'D';
 
-  /**
-   * The value for the long option bindDN.
-   */
-  static final String OPTION_LONG_BINDDN = "bindDN";
+    /**
+     * The value for the long option bindDN.
+     */
+    static final String OPTION_LONG_BINDDN = "bindDN";
 
-  /**
-   * The value for the short option bindPassword.
-   */
-  static final char OPTION_SHORT_BINDPWD = 'w';
+    /**
+     * The value for the short option bindPassword.
+     */
+    static final char OPTION_SHORT_BINDPWD = 'w';
 
-  /**
-   * The value for the long option bindPassword.
-   */
-  static final String OPTION_LONG_BINDPWD = "bindPassword";
+    /**
+     * The value for the long option bindPassword.
+     */
+    static final String OPTION_LONG_BINDPWD = "bindPassword";
 
-  /**
-   * The value for the short option bindPasswordFile.
-   */
-  static final char OPTION_SHORT_BINDPWD_FILE = 'j';
+    /**
+     * The value for the short option bindPasswordFile.
+     */
+    static final char OPTION_SHORT_BINDPWD_FILE = 'j';
 
-  /**
-   * The value for the long option bindPasswordFile.
-   */
-  static final String OPTION_LONG_BINDPWD_FILE = "bindPasswordFile";
+    /**
+     * The value for the long option bindPasswordFile.
+     */
+    static final String OPTION_LONG_BINDPWD_FILE = "bindPasswordFile";
 
-  /**
-   * The value for the short option compress.
-   */
-  static final char OPTION_SHORT_COMPRESS = 'c';
+    /**
+     * The value for the short option compress.
+     */
+    static final char OPTION_SHORT_COMPRESS = 'c';
 
-  /**
-   * The value for the long option compress.
-   */
-  static final String OPTION_LONG_COMPRESS = "compress";
+    /**
+     * The value for the long option compress.
+     */
+    static final String OPTION_LONG_COMPRESS = "compress";
 
-  /**
-   * The value for the short option filename.
-   */
-  static final char OPTION_SHORT_FILENAME = 'f';
+    /**
+     * The value for the short option filename.
+     */
+    static final char OPTION_SHORT_FILENAME = 'f';
 
-  /**
-   * The value for the long option filename.
-   */
-  static final String OPTION_LONG_FILENAME = "filename";
+    /**
+     * The value for the long option filename.
+     */
+    static final String OPTION_LONG_FILENAME = "filename";
 
-  /**
-   * The value for the short option ldifFile.
-   */
-  static final char OPTION_SHORT_LDIF_FILE = 'l';
+    /**
+     * The value for the short option ldifFile.
+     */
+    static final char OPTION_SHORT_LDIF_FILE = 'l';
 
-  /**
-   * The value for the long option ldifFile.
-   */
-  static final String OPTION_LONG_LDIF_FILE = "ldifFile";
+    /**
+     * The value for the long option ldifFile.
+     */
+    static final String OPTION_LONG_LDIF_FILE = "ldifFile";
 
-  /**
-   * The value for the short option useStartTLS.
-   */
-  static final char OPTION_SHORT_START_TLS = 'q';
+    /**
+     * The value for the short option useStartTLS.
+     */
+    static final char OPTION_SHORT_START_TLS = 'q';
 
-  /**
-   * The value for the long option useStartTLS.
-   */
-  static final String OPTION_LONG_START_TLS = "useStartTLS";
+    /**
+     * The value for the long option useStartTLS.
+     */
+    static final String OPTION_LONG_START_TLS = "useStartTLS";
 
-  /**
-   * The value for the short option randomSeed.
-   */
-  static final char OPTION_SHORT_RANDOM_SEED = 's';
+    /**
+     * The value for the short option randomSeed.
+     */
+    static final char OPTION_SHORT_RANDOM_SEED = 's';
 
-  /**
-   * The value for the long option randomSeed.
-   */
-  static final String OPTION_LONG_RANDOM_SEED = "randomSeed";
+    /**
+     * The value for the long option randomSeed.
+     */
+    static final String OPTION_LONG_RANDOM_SEED = "randomSeed";
 
-  /**
-   * The value for the short option keyStorePath.
-   */
-  static final char OPTION_SHORT_KEYSTOREPATH = 'K';
+    /**
+     * The value for the short option keyStorePath.
+     */
+    static final char OPTION_SHORT_KEYSTOREPATH = 'K';
 
-  /**
-   * The value for the long option keyStorePath.
-   */
-  static final String OPTION_LONG_KEYSTOREPATH = "keyStorePath";
+    /**
+     * The value for the long option keyStorePath.
+     */
+    static final String OPTION_LONG_KEYSTOREPATH = "keyStorePath";
 
-  /**
-   * The value for the short option trustStorePath.
-   */
-  static final char OPTION_SHORT_TRUSTSTOREPATH = 'P';
+    /**
+     * The value for the short option trustStorePath.
+     */
+    static final char OPTION_SHORT_TRUSTSTOREPATH = 'P';
 
-  /**
-   * The value for the long option trustStorePath.
-   */
-  static final String OPTION_LONG_TRUSTSTOREPATH = "trustStorePath";
+    /**
+     * The value for the long option trustStorePath.
+     */
+    static final String OPTION_LONG_TRUSTSTOREPATH = "trustStorePath";
 
-  /**
-   * The value for the short option keyStorePassword.
-   */
-  static final char OPTION_SHORT_KEYSTORE_PWD = 'W';
+    /**
+     * The value for the short option keyStorePassword.
+     */
+    static final char OPTION_SHORT_KEYSTORE_PWD = 'W';
 
-  /**
-   * The value for the long option keyStorePassword.
-   */
-  static final String OPTION_LONG_KEYSTORE_PWD = "keyStorePassword";
+    /**
+     * The value for the long option keyStorePassword.
+     */
+    static final String OPTION_LONG_KEYSTORE_PWD = "keyStorePassword";
 
-  /**
-   * The value for the short option trustStorePassword.
-   */
-  static final char OPTION_SHORT_TRUSTSTORE_PWD = 'T';
+    /**
+     * The value for the short option trustStorePassword.
+     */
+    static final char OPTION_SHORT_TRUSTSTORE_PWD = 'T';
 
-  /**
-   * The value for the long option trustStorePassword.
-   */
-  static final String OPTION_LONG_TRUSTSTORE_PWD = "trustStorePassword";
+    /**
+     * The value for the long option trustStorePassword.
+     */
+    static final String OPTION_LONG_TRUSTSTORE_PWD = "trustStorePassword";
 
-  /**
-   * The value for the short option keyStorePasswordFile .
-   */
-  static final char OPTION_SHORT_KEYSTORE_PWD_FILE = 'u';
+    /**
+     * The value for the short option keyStorePasswordFile .
+     */
+    static final char OPTION_SHORT_KEYSTORE_PWD_FILE = 'u';
 
-  /**
-   * The value for the long option keyStorePasswordFile .
-   */
-  static final String OPTION_LONG_KEYSTORE_PWD_FILE = "keyStorePasswordFile";
+    /**
+     * The value for the long option keyStorePasswordFile .
+     */
+    static final String OPTION_LONG_KEYSTORE_PWD_FILE = "keyStorePasswordFile";
 
-  /**
-   * The value for the short option keyStorePasswordFile .
-   */
-  static final char OPTION_SHORT_TRUSTSTORE_PWD_FILE = 'U';
+    /**
+     * The value for the short option keyStorePasswordFile .
+     */
+    static final char OPTION_SHORT_TRUSTSTORE_PWD_FILE = 'U';
 
-  /**
-   * The value for the long option keyStorePasswordFile .
-   */
-  static final String OPTION_LONG_TRUSTSTORE_PWD_FILE = "trustStorePasswordFile";
+    /**
+     * The value for the long option keyStorePasswordFile .
+     */
+    static final String OPTION_LONG_TRUSTSTORE_PWD_FILE = "trustStorePasswordFile";
 
-  /**
-   * The value for the short option trustAll .
-   */
-  static final char OPTION_SHORT_TRUSTALL = 'X';
+    /**
+     * The value for the short option trustAll .
+     */
+    static final char OPTION_SHORT_TRUSTALL = 'X';
 
-  /**
-   * The value for the long option trustAll .
-   */
-  static final String OPTION_LONG_TRUSTALL = "trustAll";
+    /**
+     * The value for the long option trustAll .
+     */
+    static final String OPTION_LONG_TRUSTALL = "trustAll";
 
-  /**
-   * The value for the short option certNickname .
-   */
-  static final char OPTION_SHORT_CERT_NICKNAME = 'N';
+    /**
+     * The value for the short option certNickname .
+     */
+    static final char OPTION_SHORT_CERT_NICKNAME = 'N';
 
-  /**
-   * The value for the long option certNickname .
-   */
-  static final String OPTION_LONG_CERT_NICKNAME = "certNickname";
+    /**
+     * The value for the long option certNickname .
+     */
+    static final String OPTION_LONG_CERT_NICKNAME = "certNickname";
 
-  /**
-   * The value for the long option assertionFilter .
-   */
-  static final String OPTION_LONG_ASSERTION_FILE = "assertionFilter";
+    /**
+     * The value for the long option assertionFilter .
+     */
+    static final String OPTION_LONG_ASSERTION_FILE = "assertionFilter";
 
-  /**
-   * The value for the short option dry-run.
-   */
-  static final char OPTION_SHORT_DRYRUN = 'n';
+    /**
+     * The value for the short option dry-run.
+     */
+    static final char OPTION_SHORT_DRYRUN = 'n';
 
-  /**
-   * The value for the long option dry-run.
-   */
-  static final String OPTION_LONG_DRYRUN = "dry-run";
+    /**
+     * The value for the long option dry-run.
+     */
+    static final String OPTION_LONG_DRYRUN = "dry-run";
 
-  /**
-   * The value for the short option help.
-   */
-  static final char OPTION_SHORT_HELP = 'H';
+    /**
+     * The value for the short option help.
+     */
+    static final char OPTION_SHORT_HELP = 'H';
 
-  /**
-   * The value for the long option help.
-   */
-  static final String OPTION_LONG_HELP = "help";
-
-  /**
-   * The value for the long option cli.
-   */
-  static final String OPTION_LONG_CLI = "cli";
-
-  /**
-   * The value for the short option cli.
-   */
-  static final char OPTION_SHORT_CLI = 'i';
+    /**
+     * The value for the long option help.
+     */
+    static final String OPTION_LONG_HELP = "help";
 
-  /**
-   * The value for the short option proxyAs.
-   */
-  static final char OPTION_SHORT_PROXYAUTHID = 'Y';
+    /**
+     * The value for the long option cli.
+     */
+    static final String OPTION_LONG_CLI = "cli";
 
-  /**
-   * The value for the long option proxyAs.
-   */
-  static final String OPTION_LONG_PROXYAUTHID = "proxyAs";
+    /**
+     * The value for the short option cli.
+     */
+    static final char OPTION_SHORT_CLI = 'i';
 
-  /**
-   * The value for the short option saslOption.
-   */
-  static final char OPTION_SHORT_SASLOPTION = 'o';
+    /**
+     * The value for the short option proxyAs.
+     */
+    static final char OPTION_SHORT_PROXYAUTHID = 'Y';
 
-  /**
-   * The value for the long option saslOption.
-   */
-  static final String OPTION_LONG_SASLOPTION = "saslOption";
+    /**
+     * The value for the long option proxyAs.
+     */
+    static final String OPTION_LONG_PROXYAUTHID = "proxyAs";
 
-  /**
-   * The value for the short option geteffectiverights control authzid.
-   */
-  static final char OPTION_SHORT_EFFECTIVERIGHTSUSER = 'g';
+    /**
+     * The value for the short option saslOption.
+     */
+    static final char OPTION_SHORT_SASLOPTION = 'o';
 
-  /**
-   * The value for the long option geteffectiverights control authzid.
-   */
-  static final String OPTION_LONG_EFFECTIVERIGHTSUSER = "getEffectiveRightsAuthzid";
+    /**
+     * The value for the long option saslOption.
+     */
+    static final String OPTION_LONG_SASLOPTION = "saslOption";
 
-  /**
-   * The value for the short option geteffectiveights control attributes.
-   */
-  static final char OPTION_SHORT_EFFECTIVERIGHTSATTR = 'e';
+    /**
+     * The value for the short option geteffectiverights control authzid.
+     */
+    static final char OPTION_SHORT_EFFECTIVERIGHTSUSER = 'g';
 
-  /**
-   * The value for the long option geteffectiverights control specific attribute
-   * list.
-   */
-  static final String OPTION_LONG_EFFECTIVERIGHTSATTR = "getEffectiveRightsAttribute";
+    /**
+     * The value for the long option geteffectiverights control authzid.
+     */
+    static final String OPTION_LONG_EFFECTIVERIGHTSUSER = "getEffectiveRightsAuthzid";
 
-  /**
-   * The value for the short option protocol version attributes.
-   */
-  static final char OPTION_SHORT_PROTOCOL_VERSION = 'V';
+    /**
+     * The value for the short option geteffectiveights control attributes.
+     */
+    static final char OPTION_SHORT_EFFECTIVERIGHTSATTR = 'e';
 
-  /**
-   * The value for the long option protocol version attribute.
-   */
-  static final String OPTION_LONG_PROTOCOL_VERSION = "ldapVersion";
+    /**
+     * The value for the long option geteffectiverights control specific
+     * attribute list.
+     */
+    static final String OPTION_LONG_EFFECTIVERIGHTSATTR = "getEffectiveRightsAttribute";
 
-  /**
-   * The value for the long option version.
-   */
-  static final char OPTION_SHORT_PRODUCT_VERSION = 'V';
+    /**
+     * The value for the short option protocol version attributes.
+     */
+    static final char OPTION_SHORT_PROTOCOL_VERSION = 'V';
 
-  /**
-   * The value for the long option version.
-   */
-  static final String OPTION_LONG_PRODUCT_VERSION = "version";
+    /**
+     * The value for the long option protocol version attribute.
+     */
+    static final String OPTION_LONG_PROTOCOL_VERSION = "ldapVersion";
 
-  /**
-   * The value for the short option description attributes.
-   */
-  static final char OPTION_SHORT_DESCRIPTION = 'd';
+    /**
+     * The value for the long option version.
+     */
+    static final char OPTION_SHORT_PRODUCT_VERSION = 'V';
 
-  /**
-   * The value for the long option description attribute.
-   */
-  static final String OPTION_LONG_DESCRIPTION = "description";
+    /**
+     * The value for the long option version.
+     */
+    static final String OPTION_LONG_PRODUCT_VERSION = "version";
 
-  /**
-   * The value for the short option groupName attributes.
-   */
-  static final char OPTION_SHORT_GROUPNAME = 'g';
+    /**
+     * The value for the short option description attributes.
+     */
+    static final char OPTION_SHORT_DESCRIPTION = 'd';
 
-  /**
-   * The value for the long option groupName attribute.
-   */
-  static final String OPTION_LONG_GROUPNAME = "groupName";
+    /**
+     * The value for the long option description attribute.
+     */
+    static final String OPTION_LONG_DESCRIPTION = "description";
 
-  /**
-   * The value for the short option newGroupName attribute.
-   */
-  static final char OPTION_SHORT_NEWGROUPNAME = 'n';
+    /**
+     * The value for the short option groupName attributes.
+     */
+    static final char OPTION_SHORT_GROUPNAME = 'g';
 
-  /**
-   * The value for the long option groupName attribute.
-   */
-  static final String OPTION_LONG_NEWGROUPNAME = "newGroupName";
+    /**
+     * The value for the long option groupName attribute.
+     */
+    static final String OPTION_LONG_GROUPNAME = "groupName";
 
-  /**
-   * The value for the short option member-name attributes.
-   */
-  static final char OPTION_SHORT_MEMBERNAME = 'm';
+    /**
+     * The value for the short option newGroupName attribute.
+     */
+    static final char OPTION_SHORT_NEWGROUPNAME = 'n';
 
-  /**
-   * The value for the long member-name version attribute.
-   */
-  static final String OPTION_LONG_MEMBERNAME = "memberName";
+    /**
+     * The value for the long option groupName attribute.
+     */
+    static final String OPTION_LONG_NEWGROUPNAME = "newGroupName";
 
-  /**
-   * The value for the short option serverID attributes.
-   */
-  static final String OPTION_SHORT_SERVERID = null;
+    /**
+     * The value for the short option member-name attributes.
+     */
+    static final char OPTION_SHORT_MEMBERNAME = 'm';
 
-  /**
-   * The value for the long option serverID attribute.
-   */
-  static final String OPTION_LONG_SERVERID = "serverID";
+    /**
+     * The value for the long member-name version attribute.
+     */
+    static final String OPTION_LONG_MEMBERNAME = "memberName";
 
-  /**
-   * The value for the short option userID attributes.
-   */
-  static final String OPTION_SHORT_USERID = null;
+    /**
+     * The value for the short option serverID attributes.
+     */
+    static final String OPTION_SHORT_SERVERID = null;
 
-  /**
-   * The value for the long option userID attribute.
-   */
-  static final String OPTION_LONG_USERID = "userID";
+    /**
+     * The value for the long option serverID attribute.
+     */
+    static final String OPTION_LONG_SERVERID = "serverID";
 
-  /**
-   * The value for the short option set.
-   */
-  static final Character OPTION_SHORT_SET = null;
+    /**
+     * The value for the short option userID attributes.
+     */
+    static final String OPTION_SHORT_USERID = null;
 
-  /**
-   * The value for the long option set.
-   */
-  static final String OPTION_LONG_SET = "set";
+    /**
+     * The value for the long option userID attribute.
+     */
+    static final String OPTION_LONG_USERID = "userID";
 
-  /**
-   * Value for the quiet option short form.
-   */
-  static final Character OPTION_SHORT_QUIET = 'Q';
+    /**
+     * The value for the short option set.
+     */
+    static final Character OPTION_SHORT_SET = null;
 
-  /**
-   * Value for the quiet option long form.
-   */
-  static final String OPTION_LONG_QUIET = "quiet";
+    /**
+     * The value for the long option set.
+     */
+    static final String OPTION_LONG_SET = "set";
 
-  /**
-   * Value for noninteractive session short form.
-   */
-  static final Character OPTION_SHORT_NO_PROMPT = 'n';
+    /**
+     * Value for the quiet option short form.
+     */
+    static final Character OPTION_SHORT_QUIET = 'Q';
 
-  /**
-   * Value for noninteractive session long form.
-   */
-  static final String OPTION_LONG_NO_PROMPT = "no-prompt";
+    /**
+     * Value for the quiet option long form.
+     */
+    static final String OPTION_LONG_QUIET = "quiet";
 
-  /**
-   * Long form of script friendly option.
-   */
-  static final String OPTION_LONG_SCRIPT_FRIENDLY = "script-friendly";
+    /**
+     * Value for noninteractive session short form.
+     */
+    static final Character OPTION_SHORT_NO_PROMPT = 'n';
 
-  /**
-   * Short form of script friendly option.
-   */
-  static final Character OPTION_SHORT_SCRIPT_FRIENDLY = 's';
+    /**
+     * Value for noninteractive session long form.
+     */
+    static final String OPTION_LONG_NO_PROMPT = "no-prompt";
 
-  /**
-   * Value for verbose option short form.
-   */
-  static final Character OPTION_SHORT_VERBOSE = 'v';
+    /**
+     * Long form of script friendly option.
+     */
+    static final String OPTION_LONG_SCRIPT_FRIENDLY = "script-friendly";
 
-  /**
-   * Value for verbose option long form.
-   */
-  static final String OPTION_LONG_VERBOSE = "verbose";
+    /**
+     * Short form of script friendly option.
+     */
+    static final Character OPTION_SHORT_SCRIPT_FRIENDLY = 's';
 
-  /**
-   * The value for the long option propertiesFilePAth .
-   */
-  static final String OPTION_LONG_PROP_FILE_PATH = "propertiesFilePath";
+    /**
+     * Value for verbose option short form.
+     */
+    static final Character OPTION_SHORT_VERBOSE = 'v';
 
-  /**
-   * The value for the long option propertiesFilePAth .
-   */
-  static final String OPTION_LONG_NO_PROP_FILE = "noPropertiesFile";
+    /**
+     * Value for verbose option long form.
+     */
+    static final String OPTION_LONG_VERBOSE = "verbose";
 
-  /**
-   * Long form of referenced host name.
-   */
-  static final String OPTION_LONG_REFERENCED_HOST_NAME = "referencedHostName";
+    /**
+     * The value for the long option propertiesFilePAth .
+     */
+    static final String OPTION_LONG_PROP_FILE_PATH = "propertiesFilePath";
 
-  /**
-   * Long form of admin UID.
-   */
-  static final String OPTION_LONG_ADMIN_UID = "adminUID";
+    /**
+     * The value for the long option propertiesFilePAth .
+     */
+    static final String OPTION_LONG_NO_PROP_FILE = "noPropertiesFile";
 
-  /**
-   * Long form of report authorization ID connection option.
-   */
-  static final String OPTION_LONG_REPORT_AUTHZ_ID = "reportAuthzID";
+    /**
+     * Long form of referenced host name.
+     */
+    static final String OPTION_LONG_REFERENCED_HOST_NAME = "referencedHostName";
 
-  /**
-   * Long form of use password policy control connection option.
-   */
-  static final String OPTION_LONG_USE_PW_POLICY_CTL = "usePasswordPolicyControl";
+    /**
+     * Long form of admin UID.
+     */
+    static final String OPTION_LONG_ADMIN_UID = "adminUID";
 
-  /**
-   * Long form of use SASL external connection option.
-   */
-  static final String OPTION_LONG_USE_SASL_EXTERNAL = "useSASLExternal";
+    /**
+     * Long form of report authorization ID connection option.
+     */
+    static final String OPTION_LONG_REPORT_AUTHZ_ID = "reportAuthzID";
 
-  /**
-   * Long form of option for the command-line encoding option.
-   */
-  static final String OPTION_LONG_ENCODING = "encoding";
+    /**
+     * Long form of use password policy control connection option.
+     */
+    static final String OPTION_LONG_USE_PW_POLICY_CTL = "usePasswordPolicyControl";
 
-  /**
-   * Long form of option specifying no wrapping of the command-line.
-   */
-  static final String OPTION_LONG_DONT_WRAP = "dontWrap";
+    /**
+     * Long form of use SASL external connection option.
+     */
+    static final String OPTION_LONG_USE_SASL_EXTERNAL = "useSASLExternal";
 
-  /**
-   * The value for the long option targetDN.
-   */
-  static final String OPTION_LONG_TARGETDN = "targetDN";
+    /**
+     * Long form of option for the command-line encoding option.
+     */
+    static final String OPTION_LONG_ENCODING = "encoding";
 
-  /**
-   * Long form of email notification upon completion option.
-   */
-  static final String OPTION_LONG_COMPLETION_NOTIFICATION_EMAIL = "completionNotify";
+    /**
+     * Long form of option specifying no wrapping of the command-line.
+     */
+    static final String OPTION_LONG_DONT_WRAP = "dontWrap";
 
-  /**
-   * Short form of email notification upon completion option.
-   */
-  static final Character OPTION_SHORT_COMPLETION_NOTIFICATION_EMAIL = null;
+    /**
+     * The value for the long option targetDN.
+     */
+    static final String OPTION_LONG_TARGETDN = "targetDN";
 
-  /**
-   * Long form of email notification upon error option.
-   */
-  static final String OPTION_LONG_ERROR_NOTIFICATION_EMAIL = "errorNotify";
+    /**
+     * Long form of email notification upon completion option.
+     */
+    static final String OPTION_LONG_COMPLETION_NOTIFICATION_EMAIL = "completionNotify";
 
-  /**
-   * Short form of email notification upon error option.
-   */
-  static final Character OPTION_SHORT_ERROR_NOTIFICATION_EMAIL = null;
+    /**
+     * Short form of email notification upon completion option.
+     */
+    static final Character OPTION_SHORT_COMPLETION_NOTIFICATION_EMAIL = null;
 
-  /**
-   * Long form of dependency option.
-   */
-  static final String OPTION_LONG_DEPENDENCY = "dependency";
+    /**
+     * Long form of email notification upon error option.
+     */
+    static final String OPTION_LONG_ERROR_NOTIFICATION_EMAIL = "errorNotify";
 
-  /**
-   * Short form of dependency option.
-   */
-  static final Character OPTION_SHORT_DEPENDENCY = null;
+    /**
+     * Short form of email notification upon error option.
+     */
+    static final Character OPTION_SHORT_ERROR_NOTIFICATION_EMAIL = null;
 
-  /**
-   * Long form of failed dependency action option.
-   */
-  static final String OPTION_LONG_FAILED_DEPENDENCY_ACTION = "failedDependencyAction";
+    /**
+     * Long form of dependency option.
+     */
+    static final String OPTION_LONG_DEPENDENCY = "dependency";
 
-  /**
-   * Short form of failed dependency action option.
-   */
-  static final Character OPTION_SHORT_FAILED_DEPENDENCY_ACTION = null;
+    /**
+     * Short form of dependency option.
+     */
+    static final Character OPTION_SHORT_DEPENDENCY = null;
 
-  /**
-   * The default separator to be used in tables.
-   */
-  static final String LIST_TABLE_SEPARATOR = ":";
+    /**
+     * Long form of failed dependency action option.
+     */
+    static final String OPTION_LONG_FAILED_DEPENDENCY_ACTION = "failedDependencyAction";
 
-  /**
-   *
-   * The value for the short option output LDIF filename.
-   */
-  static final char OPTION_SHORT_OUTPUT_LDIF_FILENAME= 'o';
+    /**
+     * Short form of failed dependency action option.
+     */
+    static final Character OPTION_SHORT_FAILED_DEPENDENCY_ACTION = null;
 
-  /**
-   * The value for the long option output LDIF filename.
-   */
-  static final String OPTION_LONG_OUTPUT_LDIF_FILENAME = "outputLDIF";
+    /**
+     * The default separator to be used in tables.
+     */
+    static final String LIST_TABLE_SEPARATOR = ":";
 
+    /**
+     *
+     * The value for the short option output LDIF filename.
+     */
+    static final char OPTION_SHORT_OUTPUT_LDIF_FILENAME = 'o';
 
+    /**
+     * The value for the long option output LDIF filename.
+     */
+    static final String OPTION_LONG_OUTPUT_LDIF_FILENAME = "outputLDIF";
 
-  // Prevent instantiation.
-  private ToolConstants()
-  {
+    // Prevent instantiation.
+    private ToolConstants() {
 
-  }
+    }
 
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
index 915bace..51c711c 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -26,8 +25,6 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.util.StaticUtils.EOL;
 
@@ -37,721 +34,573 @@
 import java.util.StringTokenizer;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.*;
-import org.forgerock.opendj.ldap.controls.*;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.controls.AuthorizationIdentityRequestControl;
+import org.forgerock.opendj.ldap.controls.AuthorizationIdentityResponseControl;
+import org.forgerock.opendj.ldap.controls.GenericControl;
+import org.forgerock.opendj.ldap.controls.GetEffectiveRightsRequestControl;
+import org.forgerock.opendj.ldap.controls.PasswordExpiredResponseControl;
+import org.forgerock.opendj.ldap.controls.PasswordExpiringResponseControl;
+import org.forgerock.opendj.ldap.controls.PasswordPolicyErrorType;
+import org.forgerock.opendj.ldap.controls.PasswordPolicyRequestControl;
+import org.forgerock.opendj.ldap.controls.PasswordPolicyResponseControl;
+import org.forgerock.opendj.ldap.controls.PasswordPolicyWarningType;
+import org.forgerock.opendj.ldap.controls.SubtreeDeleteRequestControl;
 import org.forgerock.opendj.ldap.responses.BindResult;
 
 import com.forgerock.opendj.ldap.controls.AccountUsabilityRequestControl;
-import com.forgerock.opendj.ldap.tools.AuthenticatedConnectionFactory.*;
+import com.forgerock.opendj.ldap.tools.AuthenticatedConnectionFactory.AuthenticatedConnection;
 import com.forgerock.opendj.util.StaticUtils;
 
-
-
 /**
  * This class provides utility functions for all the client side tools.
  */
-final class Utils
-{
-  /**
-   * The name of a command-line script used to launch a tool.
-   */
-  static final String PROPERTY_SCRIPT_NAME = "com.forgerock.opendj.ldap.tools.scriptName";
+final class Utils {
+    /**
+     * The name of a command-line script used to launch a tool.
+     */
+    static final String PROPERTY_SCRIPT_NAME = "com.forgerock.opendj.ldap.tools.scriptName";
 
-  /**
-   * The column at which to wrap long lines of output in the command-line tools.
-   */
-  static final int MAX_LINE_WIDTH;
+    /**
+     * The column at which to wrap long lines of output in the command-line
+     * tools.
+     */
+    static final int MAX_LINE_WIDTH;
 
-  static
-  {
-    int columns = 80;
-    try
-    {
-      final String s = System.getenv("COLUMNS");
-      if (s != null)
-      {
-        columns = Integer.parseInt(s);
-      }
-    }
-    catch (final Exception e)
-    {
-      // Do nothing.
-    }
-    MAX_LINE_WIDTH = columns - 1;
-  }
-
-
-
-  /**
-   * Filters the provided value to ensure that it is appropriate for use as an
-   * exit code. Exit code values are generally only allowed to be between 0 and
-   * 255, so any value outside of this range will be converted to 255, which is
-   * the typical exit code used to indicate an overflow value.
-   *
-   * @param exitCode
-   *          The exit code value to be processed.
-   * @return An integer value between 0 and 255, inclusive. If the provided exit
-   *         code was already between 0 and 255, then the original value will be
-   *         returned. If the provided value was out of this range, then 255
-   *         will be returned.
-   */
-  static int filterExitCode(final int exitCode)
-  {
-    if (exitCode < 0)
-    {
-      return 255;
-    }
-    else if (exitCode > 255)
-    {
-      return 255;
-    }
-    else
-    {
-      return exitCode;
-    }
-  }
-
-
-
-  /**
-   * Parse the specified command line argument to create the appropriate
-   * LDAPControl. The argument string should be in the format
-   * controloid[:criticality[:value|::b64value|:&lt;fileurl]]
-   *
-   * @param argString
-   *          The argument string containing the encoded control information.
-   * @return The control decoded from the provided string, or <CODE>null</CODE>
-   *         if an error occurs while parsing the argument value.
-   * @throws org.forgerock.opendj.ldap.DecodeException
-   *           If an error occurs.
-   */
-  static GenericControl getControl(final String argString)
-      throws DecodeException
-  {
-    String controlOID = null;
-    boolean controlCriticality = false;
-    ByteString controlValue = null;
-
-    int idx = argString.indexOf(":");
-
-    if (idx < 0)
-    {
-      controlOID = argString;
-    }
-    else
-    {
-      controlOID = argString.substring(0, idx);
-    }
-
-    final String lowerOID = StaticUtils.toLowerCase(controlOID);
-    if (lowerOID.equals("accountusable") || lowerOID.equals("accountusability"))
-    {
-      controlOID = AccountUsabilityRequestControl.OID;
-    }
-    else if (lowerOID.equals("authzid")
-        || lowerOID.equals("authorizationidentity"))
-    {
-      controlOID = AuthorizationIdentityRequestControl.OID;
-    }
-    else if (lowerOID.equals("noop") || lowerOID.equals("no-op"))
-    {
-      // controlOID = OID_LDAP_NOOP_OPENLDAP_ASSIGNED;
-    }
-    else if (lowerOID.equals("subentries"))
-    {
-      // controlOID = OID_LDAP_SUBENTRIES;
-    }
-    else if (lowerOID.equals("managedsait"))
-    {
-      // controlOID = OID_MANAGE_DSAIT_CONTROL;
-    }
-    else if (lowerOID.equals("pwpolicy") || lowerOID.equals("passwordpolicy"))
-    {
-      controlOID = PasswordPolicyRequestControl.OID;
-    }
-    else if (lowerOID.equals("subtreedelete") || lowerOID.equals("treedelete"))
-    {
-      controlOID = SubtreeDeleteRequestControl.OID;
-    }
-    else if (lowerOID.equals("realattrsonly")
-        || lowerOID.equals("realattributesonly"))
-    {
-      // controlOID = OID_REAL_ATTRS_ONLY;
-    }
-    else if (lowerOID.equals("virtualattrsonly")
-        || lowerOID.equals("virtualattributesonly"))
-    {
-      // controlOID = OID_VIRTUAL_ATTRS_ONLY;
-    }
-    else if (lowerOID.equals("effectiverights")
-        || lowerOID.equals("geteffectiverights"))
-    {
-      controlOID = GetEffectiveRightsRequestControl.OID;
-    }
-
-    if (idx < 0)
-    {
-      return GenericControl.newControl(controlOID);
-    }
-
-    final String remainder = argString.substring(idx + 1, argString.length());
-
-    idx = remainder.indexOf(":");
-    if (idx == -1)
-    {
-      if (remainder.equalsIgnoreCase("true"))
-      {
-        controlCriticality = true;
-      }
-      else if (remainder.equalsIgnoreCase("false"))
-      {
-        controlCriticality = false;
-      }
-      else
-      {
-        // TODO: I18N
-        throw DecodeException.error(LocalizableMessage
-            .raw("Invalid format for criticality value:" + remainder));
-      }
-      return GenericControl.newControl(controlOID, controlCriticality);
-
-    }
-
-    final String critical = remainder.substring(0, idx);
-    if (critical.equalsIgnoreCase("true"))
-    {
-      controlCriticality = true;
-    }
-    else if (critical.equalsIgnoreCase("false"))
-    {
-      controlCriticality = false;
-    }
-    else
-    {
-      // TODO: I18N
-      throw DecodeException.error(LocalizableMessage
-          .raw("Invalid format for criticality value:" + critical));
-    }
-
-    final String valString = remainder.substring(idx + 1, remainder.length());
-    if (valString.charAt(0) == ':')
-    {
-      controlValue = ByteString.valueOf(valString.substring(1, valString
-          .length()));
-    }
-    else if (valString.charAt(0) == '<')
-    {
-      // Read data from the file.
-      final String filePath = valString.substring(1, valString.length());
-      try
-      {
-        final byte[] val = readBytesFromFile(filePath);
-        controlValue = ByteString.wrap(val);
-      }
-      catch (final Exception e)
-      {
-        return null;
-      }
-    }
-    else
-    {
-      controlValue = ByteString.valueOf(valString);
-    }
-
-    return GenericControl.newControl(controlOID, controlCriticality,
-        controlValue);
-  }
-
-
-
-  /**
-   * Prints a multi-line error message with the provided information to the
-   * given print stream.
-   *
-   * @param app
-   *          The console app to use to write the error message.
-   * @param ere
-   *          The error result.
-   * @return The error code.
-   */
-  static int printErrorMessage(final ConsoleApplication app,
-      final ErrorResultException ere)
-  {
-    // if ((ere.getMessage() != null) && (ere.getMessage().length() >
-    // 0))
-    // {
-    // app.println(LocalizableMessage.raw(ere.getMessage()));
-    // }
-
-    if (ere.getResult().getResultCode().intValue() >= 0)
-    {
-      app.println(ERR_TOOL_RESULT_CODE.get(ere.getResult().getResultCode()
-          .intValue(), ere.getResult().getResultCode().toString()));
-    }
-
-    if ((ere.getResult().getDiagnosticMessage() != null)
-        && (ere.getResult().getDiagnosticMessage().length() > 0))
-    {
-      app.println(ERR_TOOL_ERROR_MESSAGE.get(ere.getResult()
-          .getDiagnosticMessage()));
-    }
-
-    if (ere.getResult().getMatchedDN() != null
-        && ere.getResult().getMatchedDN().length() > 0)
-    {
-      app.println(ERR_TOOL_MATCHED_DN.get(ere.getResult().getMatchedDN()));
-    }
-
-    if (app.isVerbose() && ere.getResult().getCause() != null)
-    {
-      ere.getResult().getCause().printStackTrace(app.getErrorStream());
-    }
-
-    return ere.getResult().getResultCode().intValue();
-  }
-
-
-
-  static void printPasswordPolicyResults(final ConsoleApplication app,
-      final Connection connection)
-  {
-    if (connection instanceof AuthenticatedConnection)
-    {
-      final AuthenticatedConnection conn = (AuthenticatedConnection) connection;
-      final BindResult result = conn.getAuthenticatedBindResult();
-
-      try
-      {
-        final AuthorizationIdentityResponseControl control = result.getControl(
-            AuthorizationIdentityResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          final LocalizableMessage message = INFO_BIND_AUTHZID_RETURNED
-              .get(control.getAuthorizationID());
-          app.println(message);
-        }
-      }
-      catch (final DecodeException e)
-      {
-        app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-      }
-
-      try
-      {
-        final PasswordExpiredResponseControl control = result.getControl(
-            PasswordExpiredResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
-          app.println(message);
-        }
-      }
-      catch (final DecodeException e)
-      {
-        app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-      }
-
-      try
-      {
-        final PasswordExpiringResponseControl control = result.getControl(
-            PasswordExpiringResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          final LocalizableMessage timeString = Utils
-              .secondsToTimeString(control.getSecondsUntilExpiration());
-          final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRING
-              .get(timeString);
-          app.println(message);
-        }
-      }
-      catch (final DecodeException e)
-      {
-        app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-      }
-
-      try
-      {
-        final PasswordPolicyResponseControl control = result.getControl(
-            PasswordPolicyResponseControl.DECODER, new DecodeOptions());
-        if (control != null)
-        {
-          final PasswordPolicyErrorType errorType = control.getErrorType();
-          if (errorType == PasswordPolicyErrorType.PASSWORD_EXPIRED)
-          {
-            final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
-            app.println(message);
-          }
-          else if (errorType == PasswordPolicyErrorType.ACCOUNT_LOCKED)
-          {
-            final LocalizableMessage message = INFO_BIND_ACCOUNT_LOCKED.get();
-            app.println(message);
-          }
-          else if (errorType == PasswordPolicyErrorType.CHANGE_AFTER_RESET)
-          {
-
-            final LocalizableMessage message = INFO_BIND_MUST_CHANGE_PASSWORD
-                .get();
-            app.println(message);
-          }
-
-          final PasswordPolicyWarningType warningType = control
-              .getWarningType();
-          if (warningType == PasswordPolicyWarningType.TIME_BEFORE_EXPIRATION)
-          {
-            final LocalizableMessage timeString = Utils
-                .secondsToTimeString(control.getWarningValue());
-            final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRING
-                .get(timeString);
-            app.println(message);
-          }
-          else if (warningType == PasswordPolicyWarningType.GRACE_LOGINS_REMAINING)
-          {
-            final LocalizableMessage message = INFO_BIND_GRACE_LOGINS_REMAINING
-                .get(control.getWarningValue());
-            app.println(message);
-          }
-        }
-      }
-      catch (final DecodeException e)
-      {
-        app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
-      }
-    }
-  }
-
-
-
-  /**
-   * Read the data from the specified file and return it in a byte array.
-   *
-   * @param filePath
-   *          The path to the file that should be read.
-   * @return A byte array containing the contents of the requested file.
-   * @throws IOException
-   *           If a problem occurs while trying to read the specified file.
-   */
-  static byte[] readBytesFromFile(final String filePath) throws IOException
-  {
-    byte[] val = null;
-    FileInputStream fis = null;
-    try
-    {
-      final File file = new File(filePath);
-      fis = new FileInputStream(file);
-      final long length = file.length();
-      val = new byte[(int) length];
-      // Read in the bytes
-      int offset = 0;
-      int numRead = 0;
-      while (offset < val.length
-          && (numRead = fis.read(val, offset, val.length - offset)) >= 0)
-      {
-        offset += numRead;
-      }
-
-      // Ensure all the bytes have been read in
-      if (offset < val.length)
-      {
-        throw new IOException("Could not completely read file " + filePath);
-      }
-
-      return val;
-    }
-    finally
-    {
-      if (fis != null)
-      {
-        fis.close();
-      }
-    }
-  }
-
-
-
-  /**
-   * Retrieves a user-friendly string that indicates the length of time (in
-   * days, hours, minutes, and seconds) in the specified number of seconds.
-   *
-   * @param numSeconds
-   *          The number of seconds to be converted to a more user-friendly
-   *          value.
-   * @return The user-friendly representation of the specified number of
-   *         seconds.
-   */
-  static LocalizableMessage secondsToTimeString(final int numSeconds)
-  {
-    if (numSeconds < 60)
-    {
-      // We can express it in seconds.
-      return INFO_TIME_IN_SECONDS.get(numSeconds);
-    }
-    else if (numSeconds < 3600)
-    {
-      // We can express it in minutes and seconds.
-      final int m = numSeconds / 60;
-      final int s = numSeconds % 60;
-      return INFO_TIME_IN_MINUTES_SECONDS.get(m, s);
-    }
-    else if (numSeconds < 86400)
-    {
-      // We can express it in hours, minutes, and seconds.
-      final int h = numSeconds / 3600;
-      final int m = (numSeconds % 3600) / 60;
-      final int s = numSeconds % 3600 % 60;
-      return INFO_TIME_IN_HOURS_MINUTES_SECONDS.get(h, m, s);
-    }
-    else
-    {
-      // We can express it in days, hours, minutes, and seconds.
-      final int d = numSeconds / 86400;
-      final int h = (numSeconds % 86400) / 3600;
-      final int m = (numSeconds % 86400 % 3600) / 60;
-      final int s = numSeconds % 86400 % 3600 % 60;
-      return INFO_TIME_IN_DAYS_HOURS_MINUTES_SECONDS.get(d, h, m, s);
-    }
-  }
-
-
-
-  /**
-   * Sets default system property settings for the xxxrate performance tools.
-   */
-  static void setDefaultPerfToolProperties()
-  {
-    // Use SameThreadStrategy by default.
-    if (System
-        .getProperty("org.forgerock.opendj.transport.useWorkerThreads") == null)
-    {
-      System.setProperty(
-          "org.forgerock.opendj.transport.useWorkerThreads", "false");
-    }
-
-    // Configure connections to be terminate immediately after closing (this
-    // prevents port exhaustion in xxxrate tools when connecting/disconnecting).
-    if (System.getProperty("org.forgerock.opendj.transport.linger") == null)
-    {
-      System.setProperty("org.forgerock.opendj.transport.linger", "0");
-    }
-  }
-
-
-
-  /**
-   * Inserts line breaks into the provided buffer to wrap text at no more than
-   * the specified column width. Wrapping will only be done at space boundaries
-   * and if there are no spaces within the specified width, then wrapping will
-   * be performed at the first space after the specified column.
-   *
-   * @param message
-   *          The message to be wrapped.
-   * @param width
-   *          The maximum number of characters to allow on a line if there is a
-   *          suitable breaking point.
-   * @return The wrapped text.
-   */
-  static String wrapText(final LocalizableMessage message, final int width)
-  {
-    return wrapText(message.toString(), width, 0);
-  }
-
-
-
-  /**
-   * Inserts line breaks into the provided buffer to wrap text at no more than
-   * the specified column width. Wrapping will only be done at space boundaries
-   * and if there are no spaces within the specified width, then wrapping will
-   * be performed at the first space after the specified column. In addition
-   * each line will be indented by the specified amount.
-   *
-   * @param message
-   *          The message to be wrapped.
-   * @param width
-   *          The maximum number of characters to allow on a line if there is a
-   *          suitable breaking point (including any indentation).
-   * @param indent
-   *          The number of columns to indent each line.
-   * @return The wrapped text.
-   */
-  static String wrapText(final LocalizableMessage message, final int width,
-      final int indent)
-  {
-    return wrapText(message.toString(), width, indent);
-  }
-
-
-
-  /**
-   * Inserts line breaks into the provided buffer to wrap text at no more than
-   * the specified column width. Wrapping will only be done at space boundaries
-   * and if there are no spaces within the specified width, then wrapping will
-   * be performed at the first space after the specified column.
-   *
-   * @param text
-   *          The text to be wrapped.
-   * @param width
-   *          The maximum number of characters to allow on a line if there is a
-   *          suitable breaking point.
-   * @return The wrapped text.
-   */
-  static String wrapText(final String text, final int width)
-  {
-    return wrapText(text, width, 0);
-  }
-
-
-
-  /**
-   * Inserts line breaks into the provided buffer to wrap text at no more than
-   * the specified column width. Wrapping will only be done at space boundaries
-   * and if there are no spaces within the specified width, then wrapping will
-   * be performed at the first space after the specified column. In addition
-   * each line will be indented by the specified amount.
-   *
-   * @param text
-   *          The text to be wrapped.
-   * @param width
-   *          The maximum number of characters to allow on a line if there is a
-   *          suitable breaking point (including any indentation).
-   * @param indent
-   *          The number of columns to indent each line.
-   * @return The wrapped text.
-   */
-  static String wrapText(final String text, int width, final int indent)
-  {
-    // Calculate the real width and indentation padding.
-    width -= indent;
-    final StringBuilder pb = new StringBuilder();
-    for (int i = 0; i < indent; i++)
-    {
-      pb.append(' ');
-    }
-    final String padding = pb.toString();
-
-    final StringBuilder buffer = new StringBuilder();
-    if (text != null)
-    {
-      final StringTokenizer lineTokenizer = new StringTokenizer(text, "\r\n",
-          true);
-      while (lineTokenizer.hasMoreTokens())
-      {
-        final String line = lineTokenizer.nextToken();
-        if (line.equals("\r") || line.equals("\n"))
-        {
-          // It's an end-of-line character, so append it as-is.
-          buffer.append(line);
-        }
-        else if (line.length() <= width)
-        {
-          // The line fits in the specified width, so append it as-is.
-          buffer.append(padding);
-          buffer.append(line);
-        }
-        else
-        {
-          // The line doesn't fit in the specified width, so it needs to
-          // be
-          // wrapped. Do so at space boundaries.
-          StringBuilder lineBuffer = new StringBuilder();
-          StringBuilder delimBuffer = new StringBuilder();
-          final StringTokenizer wordTokenizer = new StringTokenizer(line, " ",
-              true);
-          while (wordTokenizer.hasMoreTokens())
-          {
-            final String word = wordTokenizer.nextToken();
-            if (word.equals(" "))
-            {
-              // It's a space, so add it to the delim buffer only if the
-              // line
-              // buffer is not empty.
-              if (lineBuffer.length() > 0)
-              {
-                delimBuffer.append(word);
-              }
+    static {
+        int columns = 80;
+        try {
+            final String s = System.getenv("COLUMNS");
+            if (s != null) {
+                columns = Integer.parseInt(s);
             }
-            else if (word.length() > width)
-            {
-              // This is a long word that can't be wrapped, so we'll
-              // just have
-              // to make do.
-              if (lineBuffer.length() > 0)
-              {
-                buffer.append(padding);
-                buffer.append(lineBuffer);
-                buffer.append(EOL);
-                lineBuffer = new StringBuilder();
-              }
-              buffer.append(padding);
-              buffer.append(word);
-
-              if (wordTokenizer.hasMoreTokens())
-              {
-                // The next token must be a space, so remove it. If
-                // there are
-                // still more tokens after that, then append an EOL.
-                wordTokenizer.nextToken();
-                if (wordTokenizer.hasMoreTokens())
-                {
-                  buffer.append(EOL);
-                }
-              }
-
-              if (delimBuffer.length() > 0)
-              {
-                delimBuffer = new StringBuilder();
-              }
-            }
-            else
-            {
-              // It's not a space, so see if we can fit it on the curent
-              // line.
-              final int newLineLength = lineBuffer.length()
-                  + delimBuffer.length() + word.length();
-              if (newLineLength < width)
-              {
-                // It does fit on the line, so add it.
-                lineBuffer.append(delimBuffer).append(word);
-
-                if (delimBuffer.length() > 0)
-                {
-                  delimBuffer = new StringBuilder();
-                }
-              }
-              else
-              {
-                // It doesn't fit on the line, so end the current line
-                // and start
-                // a new one.
-                buffer.append(padding);
-                buffer.append(lineBuffer);
-                buffer.append(EOL);
-
-                lineBuffer = new StringBuilder();
-                lineBuffer.append(word);
-
-                if (delimBuffer.length() > 0)
-                {
-                  delimBuffer = new StringBuilder();
-                }
-              }
-            }
-          }
-
-          // If there's anything left in the line buffer, then add it to
-          // the
-          // final buffer.
-          buffer.append(padding);
-          buffer.append(lineBuffer);
+        } catch (final Exception e) {
+            // Do nothing.
         }
-      }
+        MAX_LINE_WIDTH = columns - 1;
     }
-    return buffer.toString();
-  }
 
+    /**
+     * Filters the provided value to ensure that it is appropriate for use as an
+     * exit code. Exit code values are generally only allowed to be between 0
+     * and 255, so any value outside of this range will be converted to 255,
+     * which is the typical exit code used to indicate an overflow value.
+     *
+     * @param exitCode
+     *            The exit code value to be processed.
+     * @return An integer value between 0 and 255, inclusive. If the provided
+     *         exit code was already between 0 and 255, then the original value
+     *         will be returned. If the provided value was out of this range,
+     *         then 255 will be returned.
+     */
+    static int filterExitCode(final int exitCode) {
+        if (exitCode < 0) {
+            return 255;
+        } else if (exitCode > 255) {
+            return 255;
+        } else {
+            return exitCode;
+        }
+    }
 
+    /**
+     * Parse the specified command line argument to create the appropriate
+     * LDAPControl. The argument string should be in the format
+     * controloid[:criticality[:value|::b64value|:&lt;fileurl]]
+     *
+     * @param argString
+     *            The argument string containing the encoded control
+     *            information.
+     * @return The control decoded from the provided string, or
+     *         <CODE>null</CODE> if an error occurs while parsing the argument
+     *         value.
+     * @throws org.forgerock.opendj.ldap.DecodeException
+     *             If an error occurs.
+     */
+    static GenericControl getControl(final String argString) throws DecodeException {
+        String controlOID = null;
+        boolean controlCriticality = false;
+        ByteString controlValue = null;
 
-  // Prevent instantiation.
-  private Utils()
-  {
-    // Do nothing.
-  }
+        int idx = argString.indexOf(":");
+
+        if (idx < 0) {
+            controlOID = argString;
+        } else {
+            controlOID = argString.substring(0, idx);
+        }
+
+        final String lowerOID = StaticUtils.toLowerCase(controlOID);
+        if (lowerOID.equals("accountusable") || lowerOID.equals("accountusability")) {
+            controlOID = AccountUsabilityRequestControl.OID;
+        } else if (lowerOID.equals("authzid") || lowerOID.equals("authorizationidentity")) {
+            controlOID = AuthorizationIdentityRequestControl.OID;
+        } else if (lowerOID.equals("noop") || lowerOID.equals("no-op")) {
+            // controlOID = OID_LDAP_NOOP_OPENLDAP_ASSIGNED;
+        } else if (lowerOID.equals("subentries")) {
+            // controlOID = OID_LDAP_SUBENTRIES;
+        } else if (lowerOID.equals("managedsait")) {
+            // controlOID = OID_MANAGE_DSAIT_CONTROL;
+        } else if (lowerOID.equals("pwpolicy") || lowerOID.equals("passwordpolicy")) {
+            controlOID = PasswordPolicyRequestControl.OID;
+        } else if (lowerOID.equals("subtreedelete") || lowerOID.equals("treedelete")) {
+            controlOID = SubtreeDeleteRequestControl.OID;
+        } else if (lowerOID.equals("realattrsonly") || lowerOID.equals("realattributesonly")) {
+            // controlOID = OID_REAL_ATTRS_ONLY;
+        } else if (lowerOID.equals("virtualattrsonly") || lowerOID.equals("virtualattributesonly")) {
+            // controlOID = OID_VIRTUAL_ATTRS_ONLY;
+        } else if (lowerOID.equals("effectiverights") || lowerOID.equals("geteffectiverights")) {
+            controlOID = GetEffectiveRightsRequestControl.OID;
+        }
+
+        if (idx < 0) {
+            return GenericControl.newControl(controlOID);
+        }
+
+        final String remainder = argString.substring(idx + 1, argString.length());
+
+        idx = remainder.indexOf(":");
+        if (idx == -1) {
+            if (remainder.equalsIgnoreCase("true")) {
+                controlCriticality = true;
+            } else if (remainder.equalsIgnoreCase("false")) {
+                controlCriticality = false;
+            } else {
+                // TODO: I18N
+                throw DecodeException.error(LocalizableMessage
+                        .raw("Invalid format for criticality value:" + remainder));
+            }
+            return GenericControl.newControl(controlOID, controlCriticality);
+
+        }
+
+        final String critical = remainder.substring(0, idx);
+        if (critical.equalsIgnoreCase("true")) {
+            controlCriticality = true;
+        } else if (critical.equalsIgnoreCase("false")) {
+            controlCriticality = false;
+        } else {
+            // TODO: I18N
+            throw DecodeException.error(LocalizableMessage
+                    .raw("Invalid format for criticality value:" + critical));
+        }
+
+        final String valString = remainder.substring(idx + 1, remainder.length());
+        if (valString.charAt(0) == ':') {
+            controlValue = ByteString.valueOf(valString.substring(1, valString.length()));
+        } else if (valString.charAt(0) == '<') {
+            // Read data from the file.
+            final String filePath = valString.substring(1, valString.length());
+            try {
+                final byte[] val = readBytesFromFile(filePath);
+                controlValue = ByteString.wrap(val);
+            } catch (final Exception e) {
+                return null;
+            }
+        } else {
+            controlValue = ByteString.valueOf(valString);
+        }
+
+        return GenericControl.newControl(controlOID, controlCriticality, controlValue);
+    }
+
+    /**
+     * Prints a multi-line error message with the provided information to the
+     * given print stream.
+     *
+     * @param app
+     *            The console app to use to write the error message.
+     * @param ere
+     *            The error result.
+     * @return The error code.
+     */
+    static int printErrorMessage(final ConsoleApplication app, final ErrorResultException ere) {
+        // if ((ere.getMessage() != null) && (ere.getMessage().length() >
+        // 0))
+        // {
+        // app.println(LocalizableMessage.raw(ere.getMessage()));
+        // }
+
+        if (ere.getResult().getResultCode().intValue() >= 0) {
+            app.println(ERR_TOOL_RESULT_CODE.get(ere.getResult().getResultCode().intValue(), ere
+                    .getResult().getResultCode().toString()));
+        }
+
+        if ((ere.getResult().getDiagnosticMessage() != null)
+                && (ere.getResult().getDiagnosticMessage().length() > 0)) {
+            app.println(ERR_TOOL_ERROR_MESSAGE.get(ere.getResult().getDiagnosticMessage()));
+        }
+
+        if (ere.getResult().getMatchedDN() != null && ere.getResult().getMatchedDN().length() > 0) {
+            app.println(ERR_TOOL_MATCHED_DN.get(ere.getResult().getMatchedDN()));
+        }
+
+        if (app.isVerbose() && ere.getResult().getCause() != null) {
+            ere.getResult().getCause().printStackTrace(app.getErrorStream());
+        }
+
+        return ere.getResult().getResultCode().intValue();
+    }
+
+    static void printPasswordPolicyResults(final ConsoleApplication app, final Connection connection) {
+        if (connection instanceof AuthenticatedConnection) {
+            final AuthenticatedConnection conn = (AuthenticatedConnection) connection;
+            final BindResult result = conn.getAuthenticatedBindResult();
+
+            try {
+                final AuthorizationIdentityResponseControl control =
+                        result.getControl(AuthorizationIdentityResponseControl.DECODER,
+                                new DecodeOptions());
+                if (control != null) {
+                    final LocalizableMessage message =
+                            INFO_BIND_AUTHZID_RETURNED.get(control.getAuthorizationID());
+                    app.println(message);
+                }
+            } catch (final DecodeException e) {
+                app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+            }
+
+            try {
+                final PasswordExpiredResponseControl control =
+                        result.getControl(PasswordExpiredResponseControl.DECODER,
+                                new DecodeOptions());
+                if (control != null) {
+                    final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
+                    app.println(message);
+                }
+            } catch (final DecodeException e) {
+                app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+            }
+
+            try {
+                final PasswordExpiringResponseControl control =
+                        result.getControl(PasswordExpiringResponseControl.DECODER,
+                                new DecodeOptions());
+                if (control != null) {
+                    final LocalizableMessage timeString =
+                            Utils.secondsToTimeString(control.getSecondsUntilExpiration());
+                    final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRING.get(timeString);
+                    app.println(message);
+                }
+            } catch (final DecodeException e) {
+                app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+            }
+
+            try {
+                final PasswordPolicyResponseControl control =
+                        result.getControl(PasswordPolicyResponseControl.DECODER,
+                                new DecodeOptions());
+                if (control != null) {
+                    final PasswordPolicyErrorType errorType = control.getErrorType();
+                    if (errorType == PasswordPolicyErrorType.PASSWORD_EXPIRED) {
+                        final LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
+                        app.println(message);
+                    } else if (errorType == PasswordPolicyErrorType.ACCOUNT_LOCKED) {
+                        final LocalizableMessage message = INFO_BIND_ACCOUNT_LOCKED.get();
+                        app.println(message);
+                    } else if (errorType == PasswordPolicyErrorType.CHANGE_AFTER_RESET) {
+
+                        final LocalizableMessage message = INFO_BIND_MUST_CHANGE_PASSWORD.get();
+                        app.println(message);
+                    }
+
+                    final PasswordPolicyWarningType warningType = control.getWarningType();
+                    if (warningType == PasswordPolicyWarningType.TIME_BEFORE_EXPIRATION) {
+                        final LocalizableMessage timeString =
+                                Utils.secondsToTimeString(control.getWarningValue());
+                        final LocalizableMessage message =
+                                INFO_BIND_PASSWORD_EXPIRING.get(timeString);
+                        app.println(message);
+                    } else if (warningType == PasswordPolicyWarningType.GRACE_LOGINS_REMAINING) {
+                        final LocalizableMessage message =
+                                INFO_BIND_GRACE_LOGINS_REMAINING.get(control.getWarningValue());
+                        app.println(message);
+                    }
+                }
+            } catch (final DecodeException e) {
+                app.println(ERR_DECODE_CONTROL_FAILURE.get(e.getLocalizedMessage()));
+            }
+        }
+    }
+
+    /**
+     * Read the data from the specified file and return it in a byte array.
+     *
+     * @param filePath
+     *            The path to the file that should be read.
+     * @return A byte array containing the contents of the requested file.
+     * @throws IOException
+     *             If a problem occurs while trying to read the specified file.
+     */
+    static byte[] readBytesFromFile(final String filePath) throws IOException {
+        byte[] val = null;
+        FileInputStream fis = null;
+        try {
+            final File file = new File(filePath);
+            fis = new FileInputStream(file);
+            final long length = file.length();
+            val = new byte[(int) length];
+            // Read in the bytes
+            int offset = 0;
+            int numRead = 0;
+            while (offset < val.length
+                    && (numRead = fis.read(val, offset, val.length - offset)) >= 0) {
+                offset += numRead;
+            }
+
+            // Ensure all the bytes have been read in
+            if (offset < val.length) {
+                throw new IOException("Could not completely read file " + filePath);
+            }
+
+            return val;
+        } finally {
+            if (fis != null) {
+                fis.close();
+            }
+        }
+    }
+
+    /**
+     * Retrieves a user-friendly string that indicates the length of time (in
+     * days, hours, minutes, and seconds) in the specified number of seconds.
+     *
+     * @param numSeconds
+     *            The number of seconds to be converted to a more user-friendly
+     *            value.
+     * @return The user-friendly representation of the specified number of
+     *         seconds.
+     */
+    static LocalizableMessage secondsToTimeString(final int numSeconds) {
+        if (numSeconds < 60) {
+            // We can express it in seconds.
+            return INFO_TIME_IN_SECONDS.get(numSeconds);
+        } else if (numSeconds < 3600) {
+            // We can express it in minutes and seconds.
+            final int m = numSeconds / 60;
+            final int s = numSeconds % 60;
+            return INFO_TIME_IN_MINUTES_SECONDS.get(m, s);
+        } else if (numSeconds < 86400) {
+            // We can express it in hours, minutes, and seconds.
+            final int h = numSeconds / 3600;
+            final int m = (numSeconds % 3600) / 60;
+            final int s = numSeconds % 3600 % 60;
+            return INFO_TIME_IN_HOURS_MINUTES_SECONDS.get(h, m, s);
+        } else {
+            // We can express it in days, hours, minutes, and seconds.
+            final int d = numSeconds / 86400;
+            final int h = (numSeconds % 86400) / 3600;
+            final int m = (numSeconds % 86400 % 3600) / 60;
+            final int s = numSeconds % 86400 % 3600 % 60;
+            return INFO_TIME_IN_DAYS_HOURS_MINUTES_SECONDS.get(d, h, m, s);
+        }
+    }
+
+    /**
+     * Sets default system property settings for the xxxrate performance tools.
+     */
+    static void setDefaultPerfToolProperties() {
+        // Use SameThreadStrategy by default.
+        if (System.getProperty("org.forgerock.opendj.transport.useWorkerThreads") == null) {
+            System.setProperty("org.forgerock.opendj.transport.useWorkerThreads", "false");
+        }
+
+        // Configure connections to be terminate immediately after closing (this
+        // prevents port exhaustion in xxxrate tools when
+        // connecting/disconnecting).
+        if (System.getProperty("org.forgerock.opendj.transport.linger") == null) {
+            System.setProperty("org.forgerock.opendj.transport.linger", "0");
+        }
+    }
+
+    /**
+     * Inserts line breaks into the provided buffer to wrap text at no more than
+     * the specified column width. Wrapping will only be done at space
+     * boundaries and if there are no spaces within the specified width, then
+     * wrapping will be performed at the first space after the specified column.
+     *
+     * @param message
+     *            The message to be wrapped.
+     * @param width
+     *            The maximum number of characters to allow on a line if there
+     *            is a suitable breaking point.
+     * @return The wrapped text.
+     */
+    static String wrapText(final LocalizableMessage message, final int width) {
+        return wrapText(message.toString(), width, 0);
+    }
+
+    /**
+     * Inserts line breaks into the provided buffer to wrap text at no more than
+     * the specified column width. Wrapping will only be done at space
+     * boundaries and if there are no spaces within the specified width, then
+     * wrapping will be performed at the first space after the specified column.
+     * In addition each line will be indented by the specified amount.
+     *
+     * @param message
+     *            The message to be wrapped.
+     * @param width
+     *            The maximum number of characters to allow on a line if there
+     *            is a suitable breaking point (including any indentation).
+     * @param indent
+     *            The number of columns to indent each line.
+     * @return The wrapped text.
+     */
+    static String wrapText(final LocalizableMessage message, final int width, final int indent) {
+        return wrapText(message.toString(), width, indent);
+    }
+
+    /**
+     * Inserts line breaks into the provided buffer to wrap text at no more than
+     * the specified column width. Wrapping will only be done at space
+     * boundaries and if there are no spaces within the specified width, then
+     * wrapping will be performed at the first space after the specified column.
+     *
+     * @param text
+     *            The text to be wrapped.
+     * @param width
+     *            The maximum number of characters to allow on a line if there
+     *            is a suitable breaking point.
+     * @return The wrapped text.
+     */
+    static String wrapText(final String text, final int width) {
+        return wrapText(text, width, 0);
+    }
+
+    /**
+     * Inserts line breaks into the provided buffer to wrap text at no more than
+     * the specified column width. Wrapping will only be done at space
+     * boundaries and if there are no spaces within the specified width, then
+     * wrapping will be performed at the first space after the specified column.
+     * In addition each line will be indented by the specified amount.
+     *
+     * @param text
+     *            The text to be wrapped.
+     * @param width
+     *            The maximum number of characters to allow on a line if there
+     *            is a suitable breaking point (including any indentation).
+     * @param indent
+     *            The number of columns to indent each line.
+     * @return The wrapped text.
+     */
+    static String wrapText(final String text, int width, final int indent) {
+        // Calculate the real width and indentation padding.
+        width -= indent;
+        final StringBuilder pb = new StringBuilder();
+        for (int i = 0; i < indent; i++) {
+            pb.append(' ');
+        }
+        final String padding = pb.toString();
+
+        final StringBuilder buffer = new StringBuilder();
+        if (text != null) {
+            final StringTokenizer lineTokenizer = new StringTokenizer(text, "\r\n", true);
+            while (lineTokenizer.hasMoreTokens()) {
+                final String line = lineTokenizer.nextToken();
+                if (line.equals("\r") || line.equals("\n")) {
+                    // It's an end-of-line character, so append it as-is.
+                    buffer.append(line);
+                } else if (line.length() <= width) {
+                    // The line fits in the specified width, so append it as-is.
+                    buffer.append(padding);
+                    buffer.append(line);
+                } else {
+                    // The line doesn't fit in the specified width, so it needs
+                    // to
+                    // be
+                    // wrapped. Do so at space boundaries.
+                    StringBuilder lineBuffer = new StringBuilder();
+                    StringBuilder delimBuffer = new StringBuilder();
+                    final StringTokenizer wordTokenizer = new StringTokenizer(line, " ", true);
+                    while (wordTokenizer.hasMoreTokens()) {
+                        final String word = wordTokenizer.nextToken();
+                        if (word.equals(" ")) {
+                            // It's a space, so add it to the delim buffer only
+                            // if the
+                            // line
+                            // buffer is not empty.
+                            if (lineBuffer.length() > 0) {
+                                delimBuffer.append(word);
+                            }
+                        } else if (word.length() > width) {
+                            // This is a long word that can't be wrapped, so
+                            // we'll
+                            // just have
+                            // to make do.
+                            if (lineBuffer.length() > 0) {
+                                buffer.append(padding);
+                                buffer.append(lineBuffer);
+                                buffer.append(EOL);
+                                lineBuffer = new StringBuilder();
+                            }
+                            buffer.append(padding);
+                            buffer.append(word);
+
+                            if (wordTokenizer.hasMoreTokens()) {
+                                // The next token must be a space, so remove it.
+                                // If
+                                // there are
+                                // still more tokens after that, then append an
+                                // EOL.
+                                wordTokenizer.nextToken();
+                                if (wordTokenizer.hasMoreTokens()) {
+                                    buffer.append(EOL);
+                                }
+                            }
+
+                            if (delimBuffer.length() > 0) {
+                                delimBuffer = new StringBuilder();
+                            }
+                        } else {
+                            // It's not a space, so see if we can fit it on the
+                            // curent
+                            // line.
+                            final int newLineLength =
+                                    lineBuffer.length() + delimBuffer.length() + word.length();
+                            if (newLineLength < width) {
+                                // It does fit on the line, so add it.
+                                lineBuffer.append(delimBuffer).append(word);
+
+                                if (delimBuffer.length() > 0) {
+                                    delimBuffer = new StringBuilder();
+                                }
+                            } else {
+                                // It doesn't fit on the line, so end the
+                                // current line
+                                // and start
+                                // a new one.
+                                buffer.append(padding);
+                                buffer.append(lineBuffer);
+                                buffer.append(EOL);
+
+                                lineBuffer = new StringBuilder();
+                                lineBuffer.append(word);
+
+                                if (delimBuffer.length() > 0) {
+                                    delimBuffer = new StringBuilder();
+                                }
+                            }
+                        }
+                    }
+
+                    // If there's anything left in the line buffer, then add it
+                    // to
+                    // the
+                    // final buffer.
+                    buffer.append(padding);
+                    buffer.append(lineBuffer);
+                }
+            }
+        }
+        return buffer.toString();
+    }
+
+    // Prevent instantiation.
+    private Utils() {
+        // Do nothing.
+    }
 }
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java
index 9f042a6..fdb5da3 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -30,5 +29,3 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
-
-
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties
index 49e6c80..3daf739 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties
@@ -6,17 +6,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_de.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_de.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_de.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_de.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_es.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_es.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_es.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_es.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_fr.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_fr.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_fr.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_fr.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ja.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ja.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ja.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ja.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ko.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ko.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ko.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_ko.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_CN.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_CN.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_CN.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_CN.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_TW.properties b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_TW.properties
index d99ac39..45b0198 100755
--- a/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_TW.properties
+++ b/opendj3/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools_zh_TW.properties
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
diff --git a/opendj3/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java b/opendj3/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
index c15e09a..c1e0300 100644
--- a/opendj3/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
+++ b/opendj3/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
@@ -28,19 +27,14 @@
 
 package com.forgerock.opendj.ldap.tools;
 
-
-
 import org.forgerock.testng.ForgeRockTestCase;
 import org.testng.annotations.Test;
 
-
-
 /**
  * An abstract class that all tools unit tests should extend. A tool represents
  * the classes found directly under the package com.forgerock.opendj.ldap.tools.
  */
 
 @Test(groups = { "precommit", "tools", "sdk" })
-public abstract class ToolsTestCase extends ForgeRockTestCase
-{
+public abstract class ToolsTestCase extends ForgeRockTestCase {
 }
diff --git a/opendj3/opendj-rest2ldap/pom.xml b/opendj3/opendj-rest2ldap/pom.xml
index 1910fc8..b7fe6c0 100644
--- a/opendj3/opendj-rest2ldap/pom.xml
+++ b/opendj3/opendj-rest2ldap/pom.xml
@@ -7,17 +7,16 @@
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
- ! You can obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  ! or http://forgerock.org/license/CDDLv1.0.html.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
- ! file and include the License file at
- ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- ! add the following below this CDDL HEADER, with the fields enclosed
- ! by brackets "[]" replaced with your own identifying information:
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/AttributeMapper.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/AttributeMapper.java
new file mode 100644
index 0000000..3d6c4de
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/AttributeMapper.java
@@ -0,0 +1,95 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.forgerock.json.fluent.JsonPointer;
+import org.forgerock.json.fluent.JsonValue;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.Entry;
+
+/**
+ *
+ */
+public interface AttributeMapper {
+
+    /**
+     * Transforms attributes contained in the provided LDAP entry to JSON
+     * content, invoking a completion handler once the transformation has
+     * completed.
+     * <p>
+     * This method is invoked whenever an LDAP entry is converted to a REST
+     * resource, i.e. when responding to read, query, create, put, or patch
+     * requests.
+     *
+     * @param c
+     * @param e
+     * @param v
+     * @param h
+     */
+    void toJson(Context c, Entry e, JsonValue v, CompletionHandler<JsonValue> h);
+
+    /**
+     * Transforms JSON content in the provided JSON value to LDAP attributes,
+     * invoking a completion handler once the transformation has completed.
+     * <p>
+     * This method is invoked whenever a REST resource is converted to an LDAP
+     * entry or LDAP modification, i.e. when performing create, put, or patch
+     * requests.
+     *
+     * @param c
+     * @param v
+     * @param a
+     * @param h
+     */
+    void toLDAP(Context c, JsonValue v, List<Attribute> a,
+            CompletionHandler<Entry> h);
+
+    /**
+     * Returns an unmodifiable set containing the names of the LDAP attributes
+     * required by this attribute mapper. The returned set should only contain
+     * the names of attributes found in the LDAP entry directly associated with
+     * the resource.
+     *
+     * @return An unmodifiable set containing the names of the LDAP attributes
+     *         required by this attribute mapper.
+     */
+    Set<String> getAllLDAPAttributes();
+
+    /**
+     * Returns an unmodifiable collection containing the names of the LDAP
+     * attributes required by this attribute mapper and which are associated
+     * with the provided resource attribute. The returned set should only
+     * contain the names of attributes found in the LDAP entry directly
+     * associated with the resource.
+     *
+     * @param resourceAttribute
+     *            The name of the resource attribute requested by the client.
+     * @return An unmodifiable collection containing the names of the LDAP
+     *         attributes required by this attribute mapper and which are
+     *         associated with the provided resource attribute.
+     */
+    Collection<String> getLDAPAttributesFor(JsonPointer resourceAttribute);
+
+    // TODO: methods for obtaining schema information (e.g. name, description,
+    // type information).
+    // TODO: methods for creating filters createLDAPEqualityFilter().
+    // TODO: methods for creating sort controls.
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/CompletionHandler.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/CompletionHandler.java
new file mode 100644
index 0000000..4fd14e7
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/CompletionHandler.java
@@ -0,0 +1,27 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+/**
+ *
+ */
+public interface CompletionHandler<T> {
+
+    void completed(T result);
+
+    void failed(Throwable t);
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java
new file mode 100644
index 0000000..dcb7982
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java
@@ -0,0 +1,27 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+/**
+ *
+ */
+public final class Context {
+    // FIXME: this is a stub until JsonResource is complete.
+    public String getAuthenticationID() {
+        return "bjensen";
+    }
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java
new file mode 100644
index 0000000..3dd3de4
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/EntryContainer.java
@@ -0,0 +1,46 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+import java.util.Set;
+
+import org.forgerock.opendj.ldap.Entry;
+
+/**
+ *
+ */
+public final class EntryContainer {
+
+    /**
+     * Reads the entry having the specified resource ID.
+     *
+     * @param c
+     *            The request context.
+     * @param id
+     *            The resource ID.
+     * @param attributes
+     *            The set of LDAP attributes to be read.
+     * @param h
+     *            The result handler.
+     */
+    public void readEntry(Context c, String id, Set<String> attributes,
+            CompletionHandler<Entry> h) {
+        // TODO Auto-generated method stub
+
+    }
+
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java
new file mode 100644
index 0000000..ba2a5b1
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java
@@ -0,0 +1,137 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.forgerock.json.fluent.JsonPointer;
+import org.forgerock.json.fluent.JsonValue;
+import org.forgerock.opendj.ldap.Entry;
+
+/**
+ *
+ */
+public class LDAPResource {
+    // FIXME: This will inherit from JsonResource.
+    private EntryContainer container;
+    private List<AttributeMapper> mappers;
+    private Set<String> allLDAPAttributes;
+
+    /**
+     * Creates a new LDAP resource.
+     *
+     * @param container
+     *            The entry container which will be used to interact with the
+     *            LDAP server.
+     * @param mappers
+     *            The list of attribute mappers.
+     */
+    public LDAPResource(EntryContainer container, List<AttributeMapper> mappers) {
+        this.container = container;
+        this.mappers = mappers;
+        cacheAllLDAPAttributes();
+    }
+
+    /**
+     * Caches the set of LDAP attributes associated with all of this resource's
+     * mappers.
+     */
+    private void cacheAllLDAPAttributes() {
+        allLDAPAttributes = new LinkedHashSet<String>(mappers.size());
+        for (AttributeMapper mapper : mappers) {
+            allLDAPAttributes.addAll(mapper.getAllLDAPAttributes());
+        }
+    }
+
+    /**
+     * Reads a resource from the LDAP directory.
+     *
+     * @param c
+     *            The request context.
+     * @param r
+     *            The read request.
+     * @param h
+     *            The read result handler.
+     */
+    public void read(final Context c, final ReadRequest r,
+            final CompletionHandler<JsonValue> h) {
+        // Determine the set of LDAP attributes that need to be read.
+        final Set<JsonPointer> requestedAttributes = r.getRequestedAttributes();
+        Set<String> requestedLDAPAttributes = getRequestedLDAPAttributes(requestedAttributes);
+
+        // Create a completion handler which will convert the entry to a
+        // JsonValue.
+        CompletionHandler<Entry> eh = new CompletionHandler<Entry>() {
+            public void failed(Throwable t) {
+                // Unable to read the entry.
+                handleReadFailure(c, h, t);
+            }
+
+            public void completed(Entry result) {
+                // Convert the entry to a JsonValue.
+                mapEntryToJson(c, requestedAttributes, result, h);
+            }
+
+        };
+
+        // Read the entry.
+        container.readEntry(c, r.getResourceID(), requestedLDAPAttributes, eh);
+    }
+
+    /**
+     * Determines the set of LDAP attributes to request in an LDAP read (search,
+     * post-read), based on the provided set of JSON pointers.
+     *
+     * @param requestedAttributes
+     *            The set of resource attributes to be read.
+     * @return The set of LDAP attributes associated with the resource
+     *         attributes.
+     */
+    private Set<String> getRequestedLDAPAttributes(
+            Set<JsonPointer> requestedAttributes) {
+        if (requestedAttributes.isEmpty()) {
+            // Full read.
+            return allLDAPAttributes;
+        } else {
+            // Partial read.
+            Set<String> requestedLDAPAttributes = new LinkedHashSet<String>(
+                    requestedAttributes.size());
+            for (JsonPointer requestedAttribute : requestedAttributes) {
+                for (AttributeMapper mapper : mappers) {
+                    requestedLDAPAttributes.addAll(mapper
+                            .getLDAPAttributesFor(requestedAttribute));
+                }
+            }
+            return requestedLDAPAttributes;
+        }
+    }
+
+    private void handleReadFailure(Context c, CompletionHandler<JsonValue> h,
+            Throwable t) {
+        // TODO Auto-generated method stub
+
+    }
+
+    private void mapEntryToJson(Context c,
+            Set<JsonPointer> requestedAttributes, Entry result,
+            CompletionHandler<JsonValue> h) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReadRequest.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReadRequest.java
new file mode 100644
index 0000000..6d35430
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReadRequest.java
@@ -0,0 +1,37 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.forgerock.json.fluent.JsonPointer;
+
+/**
+ *
+ */
+public class ReadRequest extends RestRequest {
+    // FIXME: this is a stub until JsonResource is complete.
+
+    public String getResourceID() {
+        return "dummy";
+    }
+
+    public Set<JsonPointer> getRequestedAttributes() {
+        return Collections.emptySet();
+    }
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RestRequest.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RestRequest.java
new file mode 100644
index 0000000..684f549
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RestRequest.java
@@ -0,0 +1,24 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+/**
+ *
+ */
+public class RestRequest {
+
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Validator.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Validator.java
new file mode 100644
index 0000000..b91de14
--- /dev/null
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Validator.java
@@ -0,0 +1,41 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]".
+ *
+ * Copyright 2012 ForgeRock AS. All rights reserved.
+ */
+
+package org.forgerock.opendj.rest2ldap;
+
+/**
+ *
+ */
+final class Validator {
+
+    private Validator() {
+        // Prevent instantiation.
+    }
+
+    static <T> T ensureNotNull(T object) {
+        if (object == null) {
+            throw new NullPointerException();
+        }
+        return object;
+    }
+
+    static <T> T ensureNotNull(T object, String message) {
+        if (object == null) {
+            throw new NullPointerException(message);
+        }
+        return object;
+    }
+}
diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/package-info.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/package-info.java
index 40cf7b4..3bfa0f4 100755
--- a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/package-info.java
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/package-info.java
@@ -6,17 +6,16 @@
  * (the "License").  You may not use this file except in compliance
  * with the License.
  *
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
  * or http://forgerock.org/license/CDDLv1.0.html.
  * See the License for the specific language governing permissions
  * and limitations under the License.
  *
  * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
  *      Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
diff --git a/opendj3/pom.xml b/opendj3/pom.xml
index b8e33e3..6caf4e9 100644
--- a/opendj3/pom.xml
+++ b/opendj3/pom.xml
@@ -7,17 +7,16 @@
   ! (the "License").  You may not use this file except in compliance
   ! with the License.
   !
-  ! You can obtain a copy of the license at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt
+  ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
   ! or http://forgerock.org/license/CDDLv1.0.html.
   ! See the License for the specific language governing permissions
   ! and limitations under the License.
   !
   ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
+  ! file and include the License file at legal-notices/CDDLv1_0.txt.
+  ! If applicable, add the following below this CDDL HEADER, with the
+  ! fields enclosed by brackets "[]" replaced with your own identifying
+  ! information:
   !      Portions Copyright [yyyy] [name of copyright owner]
   !
   ! CDDL HEADER END
@@ -110,7 +109,7 @@
     <siteDistributionURL>scp://forgerock.org/var/www/vhosts/opendj.forgerock.org/httpdocs</siteDistributionURL>
     <i18nFrameworkVersion>1.4.0</i18nFrameworkVersion>
     <gaId>UA-23412190-8</gaId>
-    <checkstyleFailOnError>false</checkstyleFailOnError>
+    <checkstyleHeaderLocation>org/forgerock/checkstyle/opendj-java-header</checkstyleHeaderLocation>
   </properties>
   <build>
     <plugins>
diff --git a/opendj3/src/site/resources/Example.ldif b/opendj3/src/site/resources/Example.ldif
index ed7cddf..7a2e3ef 100644
--- a/opendj3/src/site/resources/Example.ldif
+++ b/opendj3/src/site/resources/Example.ldif
@@ -5,17 +5,16 @@
 # (the "License").  You may not use this file except in compliance
 # with the License.
 #
-# You can obtain a copy of the license at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 # or http://forgerock.org/license/CDDLv1.0.html.
 # See the License for the specific language governing permissions
 # and limitations under the License.
 #
 # When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# trunk/opendj3/legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
+# file and include the License file at legal-notices/CDDLv1_0.txt.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information:
 #      Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END

--
Gitblit v1.10.0